1.修改部分保存逻辑
Showing
8 changed files
with
113 additions
and
50 deletions
... | @@ -2,6 +2,7 @@ package com.topdraw; | ... | @@ -2,6 +2,7 @@ package com.topdraw; |
2 | 2 | ||
3 | import com.topdraw.utils.SpringContextHolder; | 3 | import com.topdraw.utils.SpringContextHolder; |
4 | import org.springframework.boot.SpringApplication; | 4 | import org.springframework.boot.SpringApplication; |
5 | import org.springframework.boot.autoconfigure.EnableAutoConfiguration; | ||
5 | import org.springframework.boot.autoconfigure.SpringBootApplication; | 6 | import org.springframework.boot.autoconfigure.SpringBootApplication; |
6 | import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; | 7 | import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; |
7 | import org.springframework.boot.builder.SpringApplicationBuilder; | 8 | import org.springframework.boot.builder.SpringApplicationBuilder; |
... | @@ -20,10 +21,10 @@ import org.springframework.web.bind.annotation.CrossOrigin; | ... | @@ -20,10 +21,10 @@ import org.springframework.web.bind.annotation.CrossOrigin; |
20 | */ | 21 | */ |
21 | @EnableJpaAuditing | 22 | @EnableJpaAuditing |
22 | @EnableAsync | 23 | @EnableAsync |
23 | @SpringBootApplication(exclude = {SecurityAutoConfiguration.class}) | ||
24 | @EnableTransactionManagement | 24 | @EnableTransactionManagement |
25 | @EnableRetry | 25 | @EnableRetry |
26 | @EnableCaching | 26 | @EnableCaching |
27 | @SpringBootApplication(exclude = {SecurityAutoConfiguration.class}) | ||
27 | public class MemberServiceApplication extends SpringBootServletInitializer { | 28 | public class MemberServiceApplication extends SpringBootServletInitializer { |
28 | 29 | ||
29 | public static void main(String[] args) { | 30 | public static void main(String[] args) { |
... | @@ -40,3 +41,5 @@ public class MemberServiceApplication extends SpringBootServletInitializer { | ... | @@ -40,3 +41,5 @@ public class MemberServiceApplication extends SpringBootServletInitializer { |
40 | return new SpringContextHolder(); | 41 | return new SpringContextHolder(); |
41 | } | 42 | } |
42 | } | 43 | } |
44 | |||
45 | ... | ... |
... | @@ -28,7 +28,7 @@ import java.util.Objects; | ... | @@ -28,7 +28,7 @@ import java.util.Objects; |
28 | @Slf4j | 28 | @Slf4j |
29 | @Api(tags = "MemberRelatedInfo管理") | 29 | @Api(tags = "MemberRelatedInfo管理") |
30 | @RestController | 30 | @RestController |
31 | @RequestMapping("/ucEngine/api/memberRelatedInfoController") | 31 | @RequestMapping("/ucEngine/api/memberRelatedInfo") |
32 | @CrossOrigin | 32 | @CrossOrigin |
33 | public class MemberRelatedInfoController { | 33 | public class MemberRelatedInfoController { |
34 | 34 | ||
... | @@ -46,6 +46,7 @@ public class MemberRelatedInfoController { | ... | @@ -46,6 +46,7 @@ public class MemberRelatedInfoController { |
46 | @Log | 46 | @Log |
47 | @PostMapping(value = "/create") | 47 | @PostMapping(value = "/create") |
48 | @ApiOperation("新增MemberRelatedInfo") | 48 | @ApiOperation("新增MemberRelatedInfo") |
49 | @AnonymousAccess | ||
49 | public ResultInfo create(@Validated @RequestBody MemberRelatedInfo resources) { | 50 | public ResultInfo create(@Validated @RequestBody MemberRelatedInfo resources) { |
50 | MemberRelatedInfoService.create(resources); | 51 | MemberRelatedInfoService.create(resources); |
51 | return ResultInfo.success(); | 52 | return ResultInfo.success(); |
... | @@ -86,6 +87,7 @@ public class MemberRelatedInfoController { | ... | @@ -86,6 +87,7 @@ public class MemberRelatedInfoController { |
86 | @Log | 87 | @Log |
87 | @DeleteMapping(value = "/delete/{id}") | 88 | @DeleteMapping(value = "/delete/{id}") |
88 | @ApiOperation("删除MemberRelatedInfo") | 89 | @ApiOperation("删除MemberRelatedInfo") |
90 | @AnonymousAccess | ||
89 | public ResultInfo delete(@PathVariable Long id) { | 91 | public ResultInfo delete(@PathVariable Long id) { |
90 | MemberRelatedInfoService.delete(id); | 92 | MemberRelatedInfoService.delete(id); |
91 | return ResultInfo.success(); | 93 | return ResultInfo.success(); | ... | ... |
1 | package com.topdraw.business.process.rest; | 1 | package com.topdraw.business.process.rest; |
2 | 2 | ||
3 | import com.topdraw.annotation.AnonymousAccess; | ||
3 | import com.topdraw.annotation.Log; | 4 | import com.topdraw.annotation.Log; |
4 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | 5 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
6 | import com.topdraw.business.module.member.service.dto.MemberDTO; | ||
5 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinQueryCriteria; | 7 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinQueryCriteria; |
6 | import com.topdraw.business.process.domian.weixin.BuyVipBean; | 8 | import com.topdraw.business.process.domian.weixin.BuyVipBean; |
7 | import com.topdraw.business.process.domian.weixin.WeiXinUserBean; | 9 | import com.topdraw.business.process.domian.weixin.WeiXinUserBean; |
... | @@ -15,15 +17,16 @@ import org.springframework.web.bind.annotation.*; | ... | @@ -15,15 +17,16 @@ import org.springframework.web.bind.annotation.*; |
15 | 17 | ||
16 | @Api("会员处理") | 18 | @Api("会员处理") |
17 | @RestController | 19 | @RestController |
18 | @RequestMapping(value = "/ucEngine/api/memberOperationController") | 20 | @RequestMapping(value = "/ucEngine/api/memberOperation") |
19 | public class MemberOperationController { | 21 | public class MemberOperationController { |
20 | 22 | ||
21 | @Autowired | 23 | @Autowired |
22 | private MemberOperationService memberOperationService; | 24 | private MemberOperationService memberOperationService; |
23 | 25 | ||
24 | @Log("获取会员加密信息并且检查vip状态") | 26 | @Log("获取会员基本信息并且检查vip状态") |
25 | @GetMapping("/getMemberProfileAndCheckVip/{appId}/{memberId}") | 27 | @GetMapping("/getMemberProfileAndCheckVip/{appId}/{memberId}") |
26 | @ApiOperation("获取会员加密信息并且检查vip状态") | 28 | @ApiOperation("获取会员基本信息并且检查vip状态") |
29 | @AnonymousAccess | ||
27 | public IResultInfo getMemberProfileAndCheckVip(@PathVariable(value = "appId") String appId, @PathVariable(value = "memberId") Long memberId) { | 30 | public IResultInfo getMemberProfileAndCheckVip(@PathVariable(value = "appId") String appId, @PathVariable(value = "memberId") Long memberId) { |
28 | MemberProfileDTO memberProfileDTO = this.memberOperationService.getMemberProfileAndCheckVip(memberId, appId); | 31 | MemberProfileDTO memberProfileDTO = this.memberOperationService.getMemberProfileAndCheckVip(memberId, appId); |
29 | return ResultInfo.success(memberProfileDTO); | 32 | return ResultInfo.success(memberProfileDTO); |
... | @@ -32,9 +35,10 @@ public class MemberOperationController { | ... | @@ -32,9 +35,10 @@ public class MemberOperationController { |
32 | @Log("购买vip") | 35 | @Log("购买vip") |
33 | @PutMapping("/buyVip") | 36 | @PutMapping("/buyVip") |
34 | @ApiOperation("购买vip") | 37 | @ApiOperation("购买vip") |
38 | @AnonymousAccess | ||
35 | public ResultInfo buyVip(@RequestBody BuyVipBean buyVipBean) { | 39 | public ResultInfo buyVip(@RequestBody BuyVipBean buyVipBean) { |
36 | memberOperationService.buyVip(buyVipBean); | 40 | MemberDTO memberDTO = memberOperationService.buyVip(buyVipBean); |
37 | return ResultInfo.success(); | 41 | return ResultInfo.success(memberDTO); |
38 | } | 42 | } |
39 | } | 43 | } |
40 | 44 | ... | ... |
... | @@ -51,6 +51,17 @@ public class UserOperationController { | ... | @@ -51,6 +51,17 @@ public class UserOperationController { |
51 | @Autowired | 51 | @Autowired |
52 | private RedisUtils redisUtils; | 52 | private RedisUtils redisUtils; |
53 | 53 | ||
54 | @Log("新增大屏账户同时创建会员信息") | ||
55 | @PostMapping(value = "/createUserAndCreateMember") | ||
56 | @ApiOperation("新增大屏账户同时创建会员信息") | ||
57 | @AnonymousAccess | ||
58 | public ResultInfo createUserAndCreateMember(@Validated @RequestBody TempIptvUser resources) { | ||
59 | UserTv userTv = new UserTv(); | ||
60 | BeanUtils.copyProperties(resources,userTv); | ||
61 | boolean result = this.userTvOperationService.createMemberByUserTv(userTv); | ||
62 | return ResultInfo.success(result); | ||
63 | } | ||
64 | |||
54 | @Log("获取大屏绑定的小屏会员列表") | 65 | @Log("获取大屏绑定的小屏会员列表") |
55 | @GetMapping(value = "/findBindByPlatformAccount/{platformAccount}") | 66 | @GetMapping(value = "/findBindByPlatformAccount/{platformAccount}") |
56 | @AnonymousAccess | 67 | @AnonymousAccess |
... | @@ -100,16 +111,7 @@ public class UserOperationController { | ... | @@ -100,16 +111,7 @@ public class UserOperationController { |
100 | return ResultInfo.success(result); | 111 | return ResultInfo.success(result); |
101 | } | 112 | } |
102 | 113 | ||
103 | @Log("新增大屏账户同时创建会员信息") | 114 | |
104 | @PostMapping(value = "/createUserAndCreateMember") | ||
105 | @ApiOperation("新增大屏账户同时创建会员信息") | ||
106 | @AnonymousAccess | ||
107 | public ResultInfo createUserAndCreateMember(@Validated @RequestBody TempIptvUser resources) { | ||
108 | UserTv userTv = new UserTv(); | ||
109 | BeanUtils.copyProperties(resources,userTv); | ||
110 | this.userTvOperationService.createMemberByUserTv(userTv); | ||
111 | return ResultInfo.success(); | ||
112 | } | ||
113 | 115 | ||
114 | @Log("大屏用户解绑") | 116 | @Log("大屏用户解绑") |
115 | @PutMapping(value = "/unbind") | 117 | @PutMapping(value = "/unbind") |
... | @@ -290,8 +292,17 @@ public class UserOperationController { | ... | @@ -290,8 +292,17 @@ public class UserOperationController { |
290 | @ApiOperation("保存大屏侧信息") | 292 | @ApiOperation("保存大屏侧信息") |
291 | @AnonymousAccess | 293 | @AnonymousAccess |
292 | public ResultInfo saveUserInfo(@RequestBody String data) { | 294 | public ResultInfo saveUserInfo(@RequestBody String data) { |
295 | |||
296 | Assert.notNull(data, "用户数据不可为空"); | ||
297 | |||
298 | JSONObject json = JSONObject.parseObject(data); | ||
299 | |||
300 | String unionid = json.getString("unionid"); | ||
301 | Assert.state(StrUtil.isNotBlank(unionid), "unionid不可为空"); | ||
302 | |||
293 | log.info("resources :[{}]",data); | 303 | log.info("resources :[{}]",data); |
294 | String s = this.userTvOperationService.saveUserInfo(data); | 304 | String s = this.userTvOperationService.saveUserInfo(data); |
305 | |||
295 | return ResultInfo.success(s); | 306 | return ResultInfo.success(s); |
296 | } | 307 | } |
297 | 308 | ... | ... |
... | @@ -69,7 +69,6 @@ public class MemberOperationServiceImpl implements MemberOperationService { | ... | @@ -69,7 +69,6 @@ public class MemberOperationServiceImpl implements MemberOperationService { |
69 | memberVipHistory.setStatus(1); | 69 | memberVipHistory.setStatus(1); |
70 | } | 70 | } |
71 | 71 | ||
72 | |||
73 | LocalDateTime vipExpireTime = memberDTO.getVipExpireTime(); | 72 | LocalDateTime vipExpireTime = memberDTO.getVipExpireTime(); |
74 | LocalDateTime now = LocalDateTime.now(); | 73 | LocalDateTime now = LocalDateTime.now(); |
75 | //判断之前有没有买过,没买过,失效时间为一年后; | 74 | //判断之前有没有买过,没买过,失效时间为一年后; |
... | @@ -96,12 +95,10 @@ public class MemberOperationServiceImpl implements MemberOperationService { | ... | @@ -96,12 +95,10 @@ public class MemberOperationServiceImpl implements MemberOperationService { |
96 | 95 | ||
97 | Member member = new Member(); | 96 | Member member = new Member(); |
98 | BeanUtils.copyProperties(memberDTO,member); | 97 | BeanUtils.copyProperties(memberDTO,member); |
99 | Long memberId0 = this.memberService.create(member); | 98 | this.memberService.create(member); |
100 | |||
101 | memberVipHistory.setVipExpireTime(member.getVipExpireTime()); | 99 | memberVipHistory.setVipExpireTime(member.getVipExpireTime()); |
102 | memberVipHistoryService.create(memberVipHistory); | 100 | memberVipHistoryService.create(memberVipHistory); |
103 | 101 | ||
104 | memberService.update(member); | ||
105 | return memberDTO; | 102 | return memberDTO; |
106 | } | 103 | } |
107 | 104 | ... | ... |
... | @@ -304,21 +304,22 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -304,21 +304,22 @@ public class UserOperationServiceImpl implements UserOperationService { |
304 | */ | 304 | */ |
305 | @Override | 305 | @Override |
306 | public String saveUserInfo(String data) { | 306 | public String saveUserInfo(String data) { |
307 | Assert.notNull(data, "用户数据不可为空"); | 307 | |
308 | JSONObject json = JSONObject.parseObject(data); | 308 | JSONObject json = JSONObject.parseObject(data); |
309 | String unionid = json.getString("unionid"); | 309 | String unionId = json.getString("unionid"); |
310 | Assert.state(StrUtil.isNotBlank(unionid), "unionid不可为空"); | ||
311 | String result = ""; | 310 | String result = ""; |
312 | // 订阅号appid | 311 | // 订阅号appid |
313 | String appId = json.getString("dyAppid"); | 312 | String appId = json.getString("dyAppid"); |
313 | |||
314 | try { | 314 | try { |
315 | 315 | ||
316 | // 过期时间300S | 316 | // 过期时间300S |
317 | this.redisUtils.set(RedisKeyUtil.genSeSuSubscribeKey(unionid), data, 300); | 317 | this.redisUtils.set(RedisKeyUtil.genSeSuSubscribeKey(unionId), data, 300); |
318 | 318 | ||
319 | // 若未传dyAppId。不走下面的流程 | 319 | // 若未传dyAppId。不走下面的流程 |
320 | if (StrUtil.isNotBlank(appId)) | 320 | if (StrUtil.isNotBlank(appId)) |
321 | result = this.checkWeiXinUserAndSubscribeStatus(appId,unionid); | 321 | result = this.checkWeiXinUserAndSubscribeStatus(appId,unionId); |
322 | |||
322 | } catch (Exception e) { | 323 | } catch (Exception e) { |
323 | log.error(" saveUserInfo get an error || data: {} || msg: {} ", data, e.getMessage()); | 324 | log.error(" saveUserInfo get an error || data: {} || msg: {} ", data, e.getMessage()); |
324 | } | 325 | } |
... | @@ -350,6 +351,12 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -350,6 +351,12 @@ public class UserOperationServiceImpl implements UserOperationService { |
350 | return SUBSCRIBE; | 351 | return SUBSCRIBE; |
351 | } | 352 | } |
352 | 353 | ||
354 | /** | ||
355 | * | ||
356 | * @param unionid | ||
357 | * @param appId | ||
358 | * @return | ||
359 | */ | ||
353 | private UserWeixinDTO findUserWeiXinByUnionIdAndAppId(String unionid, String appId) { | 360 | private UserWeixinDTO findUserWeiXinByUnionIdAndAppId(String unionid, String appId) { |
354 | return this.userWeixinService.findFirstByUnionidAndAppid(unionid,appId); | 361 | return this.userWeixinService.findFirstByUnionidAndAppid(unionid,appId); |
355 | } | 362 | } |
... | @@ -693,9 +700,21 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -693,9 +700,21 @@ public class UserOperationServiceImpl implements UserOperationService { |
693 | */ | 700 | */ |
694 | @Override | 701 | @Override |
695 | public void changeMainAccount(UserTv resources) { | 702 | public void changeMainAccount(UserTv resources) { |
703 | |||
696 | // 会员编码 | 704 | // 会员编码 |
697 | String memberCode = resources.getMemberCode(); | 705 | String memberCode = resources.getMemberCode(); |
698 | 706 | ||
707 | UserTvDTO userTvDTO_0 = this.findByPriorityMemberCode(memberCode); | ||
708 | |||
709 | if (Objects.nonNull(userTvDTO_0)) { | ||
710 | log.error("Param ==>> memberCode ==> [{}]",memberCode); | ||
711 | |||
712 | if (userTvDTO_0.getPriorityMemberCode().equalsIgnoreCase(memberCode)) | ||
713 | throw new BadRequestException("会员已是主账户,不能重复绑定"); | ||
714 | |||
715 | throw new BadRequestException("该会员已绑定其他账户,不能重复绑定"); | ||
716 | } | ||
717 | |||
699 | // 大屏账户 | 718 | // 大屏账户 |
700 | UserTvDTO userTvDTO = this.findByUserTv(resources); | 719 | UserTvDTO userTvDTO = this.findByUserTv(resources); |
701 | 720 | ||
... | @@ -707,6 +726,12 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -707,6 +726,12 @@ public class UserOperationServiceImpl implements UserOperationService { |
707 | 726 | ||
708 | } | 727 | } |
709 | 728 | ||
729 | |||
730 | private UserTvDTO findByPriorityMemberCode(String memberCode) { | ||
731 | UserTvDTO userTvDTO = this.userTvService.findByPriorityMemberCode(memberCode); | ||
732 | return userTvDTO; | ||
733 | } | ||
734 | |||
710 | /** | 735 | /** |
711 | * 设置主会员 | 736 | * 设置主会员 |
712 | * @description 检查大屏账户有没有绑定小屏会员,如果没有绑定就将当前会员的code保存到大屏账户中 | 737 | * @description 检查大屏账户有没有绑定小屏会员,如果没有绑定就将当前会员的code保存到大屏账户中 |
... | @@ -836,7 +861,9 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -836,7 +861,9 @@ public class UserOperationServiceImpl implements UserOperationService { |
836 | public boolean createMemberByUserTv(UserTv resources) { | 861 | public boolean createMemberByUserTv(UserTv resources) { |
837 | String platformAccount = resources.getPlatformAccount(); | 862 | String platformAccount = resources.getPlatformAccount(); |
838 | UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); | 863 | UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); |
864 | |||
839 | if (Objects.isNull(userTvDTO)) { | 865 | if (Objects.isNull(userTvDTO)) { |
866 | |||
840 | Member member = new Member(); | 867 | Member member = new Member(); |
841 | // 大屏 | 868 | // 大屏 |
842 | member.setType(LocalConstants.MEMBER_PLATFORM_TYPE_VIS); | 869 | member.setType(LocalConstants.MEMBER_PLATFORM_TYPE_VIS); |
... | @@ -846,8 +873,10 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -846,8 +873,10 @@ public class UserOperationServiceImpl implements UserOperationService { |
846 | member.setType(1); | 873 | member.setType(1); |
847 | Long memberId = this.memberService.create(member); | 874 | Long memberId = this.memberService.create(member); |
848 | 875 | ||
849 | if (Objects.nonNull(memberId)) { | ||
850 | UserTv userTv = new UserTv(); | 876 | UserTv userTv = new UserTv(); |
877 | |||
878 | if (Objects.nonNull(memberId)) { | ||
879 | |||
851 | BeanUtils.copyProperties(resources,userTv); | 880 | BeanUtils.copyProperties(resources,userTv); |
852 | userTv.setPlatformAccount(platformAccount); | 881 | userTv.setPlatformAccount(platformAccount); |
853 | userTv.setMemberCode(member.getCode()); | 882 | userTv.setMemberCode(member.getCode()); |
... | @@ -860,14 +889,19 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -860,14 +889,19 @@ public class UserOperationServiceImpl implements UserOperationService { |
860 | userTv.setCreateBy("system"); | 889 | userTv.setCreateBy("system"); |
861 | userTv.setUpdateBy("system"); | 890 | userTv.setUpdateBy("system"); |
862 | this.userTvService.create(userTv); | 891 | this.userTvService.create(userTv); |
863 | 892 | return true; | |
864 | } | 893 | } |
865 | 894 | ||
866 | } else { | ||
867 | return false; | 895 | return false; |
868 | } | ||
869 | 896 | ||
897 | } else { | ||
898 | |||
899 | UserTv userTv = new UserTv(); | ||
900 | BeanUtils.copyProperties(userTvDTO,userTv); | ||
870 | return true; | 901 | return true; |
902 | |||
903 | } | ||
904 | |||
871 | } | 905 | } |
872 | 906 | ||
873 | /** | 907 | /** |
... | @@ -1189,12 +1223,33 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -1189,12 +1223,33 @@ public class UserOperationServiceImpl implements UserOperationService { |
1189 | 1223 | ||
1190 | @Override | 1224 | @Override |
1191 | public boolean appletBind(BindBean resources) { | 1225 | public boolean appletBind(BindBean resources) { |
1226 | |||
1192 | Long id = resources.getId(); | 1227 | Long id = resources.getId(); |
1193 | Long platformUserId = resources.getPlatformUserId(); | 1228 | Long platformUserId = resources.getPlatformUserId(); |
1194 | 1229 | ||
1230 | // 大屏账户 | ||
1231 | UserTvDTO userTvDTO = this.findUserIptvById(platformUserId); | ||
1232 | |||
1233 | // 账户是否存在 | ||
1234 | if (Objects.isNull(userTvDTO.getId())){ | ||
1235 | log.error("Param ==> platformUserId ==> [{}]",platformUserId); | ||
1236 | throw new EntityNotFoundException(UserTvDTO.class,"id","大屏账户不存在!"); | ||
1237 | } | ||
1238 | |||
1239 | // 是否绑定主账户 | ||
1240 | if (Objects.nonNull(userTvDTO.getId())) { | ||
1241 | |||
1242 | // 主账户 | ||
1243 | String priorityMemberCode = userTvDTO.getPriorityMemberCode(); | ||
1244 | |||
1245 | if (StringUtils.isNotBlank(priorityMemberCode)) | ||
1246 | throw new BadRequestException("该账户已绑定其他会员,不能重复绑定"); | ||
1247 | |||
1248 | } | ||
1249 | |||
1195 | // 微信账户 | 1250 | // 微信账户 |
1196 | UserWeixinDTO userWeixinDTO = this.userWeixinService.findById(id); | 1251 | UserWeixinDTO userWeixinDTO = this.userWeixinService.findById(id); |
1197 | 1252 | // 账户是否存在 | |
1198 | if (Objects.isNull(userWeixinDTO.getId())) { | 1253 | if (Objects.isNull(userWeixinDTO.getId())) { |
1199 | log.error("param ==> id ==> [{}]",id); | 1254 | log.error("param ==> id ==> [{}]",id); |
1200 | throw new EntityNotFoundException(UserWeixinDTO.class, "id", userWeixinDTO.getId().toString()); | 1255 | throw new EntityNotFoundException(UserWeixinDTO.class, "id", userWeixinDTO.getId().toString()); |
... | @@ -1202,38 +1257,26 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -1202,38 +1257,26 @@ public class UserOperationServiceImpl implements UserOperationService { |
1202 | 1257 | ||
1203 | // 会员 | 1258 | // 会员 |
1204 | Long memberId = userWeixinDTO.getMemberId(); | 1259 | Long memberId = userWeixinDTO.getMemberId(); |
1205 | MemberDTO memberDTO = this.findMemberById(memberId); | 1260 | if (Objects.isNull(memberId)) { |
1206 | if (Objects.isNull(memberDTO.getId())) { | ||
1207 | log.error("param ==> memberId ==> [{}]",id); | 1261 | log.error("param ==> memberId ==> [{}]",id); |
1208 | throw new EntityNotFoundException(MemberDTO.class, "id", memberId.toString()); | 1262 | throw new EntityNotFoundException(UserWeixinDTO.class, "id", id.toString()); |
1209 | } | 1263 | } |
1210 | 1264 | ||
1211 | // 已绑定大屏 | 1265 | MemberDTO memberDTO = this.findMemberById(memberId); |
1212 | Long userIptvId = memberDTO.getUserIptvId(); | 1266 | if (Objects.isNull(memberId)) { |
1213 | if (Objects.nonNull(userIptvId) && userIptvId == platformUserId) { | 1267 | log.error("param ==> memberId ==> [{}]",id); |
1214 | throw new BadRequestException("不能重复绑定同一个账户"); | 1268 | throw new EntityNotFoundException(MemberDTO.class, "id", memberId.toString()); |
1215 | } | 1269 | } |
1216 | 1270 | ||
1217 | // 大屏账户 | 1271 | // 主账户会员 |
1218 | UserTvDTO userTvDTO = this.findUserIptvById(platformUserId); | ||
1219 | if (Objects.nonNull(userTvDTO.getId())) { | ||
1220 | // 主账户 | ||
1221 | String priorityMemberCode = userTvDTO.getPriorityMemberCode(); | ||
1222 | |||
1223 | if (StringUtils.isEmpty(priorityMemberCode)) { | ||
1224 | |||
1225 | String code = memberDTO.getCode(); | 1272 | String code = memberDTO.getCode(); |
1226 | userTvDTO.setPriorityMemberCode(code); | 1273 | userTvDTO.setPriorityMemberCode(code); |
1227 | 1274 | ||
1228 | // 更新大屏信息 | 1275 | // 更新大屏信息 |
1229 | this.doUpdateUserTv(userTvDTO); | 1276 | this.doUpdateUserTv(userTvDTO); |
1230 | } | ||
1231 | |||
1232 | // 会员绑定大屏 | 1277 | // 会员绑定大屏 |
1233 | this.bindIptvId(memberDTO,userTvDTO); | 1278 | this.bindIptvId(memberDTO,userTvDTO); |
1234 | 1279 | ||
1235 | } | ||
1236 | |||
1237 | return true; | 1280 | return true; |
1238 | } | 1281 | } |
1239 | 1282 | ... | ... |
-
Please register or sign in to post a comment