1.优化
Showing
16 changed files
with
239 additions
and
93 deletions
... | @@ -52,7 +52,7 @@ public class DataSyncMsg implements Serializable { | ... | @@ -52,7 +52,7 @@ public class DataSyncMsg implements Serializable { |
52 | private Long mediaId; | 52 | private Long mediaId; |
53 | private Long itemId; | 53 | private Long itemId; |
54 | private String param; | 54 | private String param; |
55 | 55 | private String description; | |
56 | } | 56 | } |
57 | 57 | ||
58 | @Data | 58 | @Data | ... | ... |
... | @@ -12,6 +12,13 @@ import java.util.List; | ... | @@ -12,6 +12,13 @@ import java.util.List; |
12 | public interface MemberService { | 12 | public interface MemberService { |
13 | 13 | ||
14 | /** | 14 | /** |
15 | * 获取会员code | ||
16 | * @param id | ||
17 | * @return | ||
18 | */ | ||
19 | String findCodeById(Long id); | ||
20 | |||
21 | /** | ||
15 | * 根据ID查询 | 22 | * 根据ID查询 |
16 | * @param id ID | 23 | * @param id ID |
17 | * @return MemberDTO | 24 | * @return MemberDTO | ... | ... |
... | @@ -47,6 +47,12 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -47,6 +47,12 @@ public class MemberServiceImpl implements MemberService { |
47 | 47 | ||
48 | 48 | ||
49 | @Override | 49 | @Override |
50 | public String findCodeById(Long id) { | ||
51 | MemberDTO memberDTO = this.findById(id); | ||
52 | return memberDTO.getCode(); | ||
53 | } | ||
54 | |||
55 | @Override | ||
50 | public MemberDTO findById(Long id) { | 56 | public MemberDTO findById(Long id) { |
51 | Member member = this.memberRepository.findById(id).orElseGet(Member::new); | 57 | Member member = this.memberRepository.findById(id).orElseGet(Member::new); |
52 | ValidationUtil.isNull(member.getId(),"Member","id",id); | 58 | ValidationUtil.isNull(member.getId(),"Member","id",id); | ... | ... |
... | @@ -26,8 +26,12 @@ public interface UserWeixinRepository extends JpaRepository<UserWeixin, Long>, J | ... | @@ -26,8 +26,12 @@ public interface UserWeixinRepository extends JpaRepository<UserWeixin, Long>, J |
26 | 26 | ||
27 | Optional<UserWeixin> findFirstByUnionidAndAppid(String unionid, String appId); | 27 | Optional<UserWeixin> findFirstByUnionidAndAppid(String unionid, String appId); |
28 | 28 | ||
29 | Optional<UserWeixin> findFirstByMemberId(Long memberId); | ||
30 | |||
29 | @Modifying | 31 | @Modifying |
30 | @Transactional | 32 | @Transactional |
31 | @Query(value = "update `uc_user_weixin` set update_time = :#{#resources.updateTime} where appid = :#{#resources.appid} and openid = :#{#resources.openid}" , nativeQuery = true) | 33 | @Query(value = "update `uc_user_weixin` set update_time = :#{#resources.updateTime} " + |
34 | "where appid = :#{#resources.appid} and openid = :#{#resources.openid}", nativeQuery = true) | ||
32 | void updateTime(@Param("resources") UserWeixin resources); | 35 | void updateTime(@Param("resources") UserWeixin resources); |
36 | |||
33 | } | 37 | } | ... | ... |
... | @@ -13,9 +13,9 @@ import io.swagger.annotations.*; | ... | @@ -13,9 +13,9 @@ import io.swagger.annotations.*; |
13 | * @author XiangHan | 13 | * @author XiangHan |
14 | * @date 2021-12-16 | 14 | * @date 2021-12-16 |
15 | */ | 15 | */ |
16 | @Api(tags = "UserWeixin管理") | 16 | @Api(tags = "微信管理") |
17 | @RestController | 17 | @RestController |
18 | @RequestMapping("/ucEngine/api/userWeixin") | 18 | @RequestMapping("/uce/userWeixin") |
19 | public class UserWeixinController { | 19 | public class UserWeixinController { |
20 | 20 | ||
21 | @Autowired | 21 | @Autowired |
... | @@ -45,11 +45,4 @@ public class UserWeixinController { | ... | @@ -45,11 +45,4 @@ public class UserWeixinController { |
45 | return ResultInfo.success(); | 45 | return ResultInfo.success(); |
46 | } | 46 | } |
47 | 47 | ||
48 | @DeleteMapping(value = "/{id}") | ||
49 | @ApiOperation("删除UserWeixin") | ||
50 | public ResultInfo delete(@PathVariable Long id) { | ||
51 | UserWeixinService.delete(id); | ||
52 | return ResultInfo.success(); | ||
53 | } | ||
54 | |||
55 | } | 48 | } | ... | ... |
... | @@ -80,4 +80,11 @@ public interface UserWeixinService { | ... | @@ -80,4 +80,11 @@ public interface UserWeixinService { |
80 | * @return | 80 | * @return |
81 | */ | 81 | */ |
82 | UserWeixinDTO findFirstByUnionidAndAppid(String unionid, String appId); | 82 | UserWeixinDTO findFirstByUnionidAndAppid(String unionid, String appId); |
83 | |||
84 | /** | ||
85 | * | ||
86 | * @param memberId | ||
87 | * @return | ||
88 | */ | ||
89 | UserWeixinDTO findFirstByMemberId(Long memberId); | ||
83 | } | 90 | } | ... | ... |
... | @@ -98,4 +98,10 @@ public class UserWeixinServiceImpl implements UserWeixinService { | ... | @@ -98,4 +98,10 @@ public class UserWeixinServiceImpl implements UserWeixinService { |
98 | return this.userWeixinMapper.toDto(userWeixin); | 98 | return this.userWeixinMapper.toDto(userWeixin); |
99 | } | 99 | } |
100 | 100 | ||
101 | @Override | ||
102 | public UserWeixinDTO findFirstByMemberId(Long memberId) { | ||
103 | UserWeixin userWeixin = this.userWeixinRepository.findFirstByMemberId(memberId).orElseGet(UserWeixin::new); | ||
104 | return this.userWeixinMapper.toDto(userWeixin); | ||
105 | } | ||
106 | |||
101 | } | 107 | } | ... | ... |
... | @@ -11,4 +11,6 @@ public class BindBean extends WeiXinUserBean { | ... | @@ -11,4 +11,6 @@ public class BindBean extends WeiXinUserBean { |
11 | 11 | ||
12 | @NotNull(message = "platformAccount can't be null" , groups = {BindGroup.class}) | 12 | @NotNull(message = "platformAccount can't be null" , groups = {BindGroup.class}) |
13 | private String platformAccount; | 13 | private String platformAccount; |
14 | |||
15 | |||
14 | } | 16 | } | ... | ... |
... | @@ -57,7 +57,15 @@ public class WeiXinUserBean { | ... | @@ -57,7 +57,15 @@ public class WeiXinUserBean { |
57 | /** 推荐者id */ | 57 | /** 推荐者id */ |
58 | private Long sourceUser; | 58 | private Long sourceUser; |
59 | 59 | ||
60 | /** 昵称 */ | ||
60 | private String nikename; | 61 | private String nikename; |
61 | 62 | ||
63 | /** 头像 */ | ||
62 | private String headimgurl; | 64 | private String headimgurl; |
65 | |||
66 | /** 授权码 */ | ||
67 | private String authCode; | ||
68 | |||
69 | /** 来源信息 */ | ||
70 | private String resourceInfo; | ||
63 | } | 71 | } | ... | ... |
... | @@ -186,21 +186,32 @@ public class UserOperationController { | ... | @@ -186,21 +186,32 @@ public class UserOperationController { |
186 | } | 186 | } |
187 | 187 | ||
188 | @Log("微信小程序绑定大屏") | 188 | @Log("微信小程序绑定大屏") |
189 | @PostMapping("/appletBind") | 189 | @PostMapping("/minaBind") |
190 | @ApiOperation("微信小程序绑定大屏") | 190 | @ApiOperation("微信小程序绑定大屏") |
191 | @AnonymousAccess | 191 | @AnonymousAccess |
192 | public ResultInfo appletBind(@Validated(value = {BindGroup.class}) @RequestBody BindBean resources) { | 192 | public ResultInfo minaBind(@Validated(value = {BindGroup.class}) @RequestBody BindBean resources) { |
193 | log.info("UserOperationController ==> appletBind ==>> param ==> [{}]",resources); | 193 | log.info("UserOperationController ==> appletBind ==>> param ==> [{}]",resources); |
194 | 194 | ||
195 | boolean result = this.userOperationService.appletBind(resources); | 195 | boolean result = this.userOperationService.minaBind(resources); |
196 | return ResultInfo.success(result); | 196 | return ResultInfo.success(result); |
197 | } | 197 | } |
198 | 198 | ||
199 | @Log("小屏解绑") | ||
200 | @PostMapping("/minaUnbind") | ||
201 | @ApiOperation("小屏解绑") | ||
202 | @AnonymousAccess | ||
203 | public ResultInfo minaUnbind(@Validated(value = {BindGroup.class}) @RequestBody TvUnBindBean tvUnBindBean) { | ||
204 | log.info("UserOperationController ==> appletBind ==>> param ==> [{}]",tvUnBindBean); | ||
205 | |||
206 | this.userOperationService.minaUnbind(tvUnBindBean); | ||
207 | return ResultInfo.success(); | ||
208 | } | ||
209 | |||
199 | @Log("暂存大小屏信息并检查关注与绑定状态") | 210 | @Log("暂存大小屏信息并检查关注与绑定状态") |
200 | @PostMapping(value = "/saveUserInfo") | 211 | @PostMapping(value = "/memberPreprocess") |
201 | @ApiOperation("暂存大小屏信息并检查关注与绑定状态") | 212 | @ApiOperation("暂存大小屏信息并检查关注与绑定状态") |
202 | @AnonymousAccess | 213 | @AnonymousAccess |
203 | public ResultInfo saveUserInfo(@RequestBody String data) { | 214 | public ResultInfo memberPreprocess(@RequestBody String data) { |
204 | 215 | ||
205 | log.info("UserOperationController ==> saveUserInfo ==>> param ==>> [{}]",data); | 216 | log.info("UserOperationController ==> saveUserInfo ==>> param ==>> [{}]",data); |
206 | Assert.notNull(data, "用户数据不可为空"); | 217 | Assert.notNull(data, "用户数据不可为空"); |
... | @@ -325,14 +336,14 @@ public class UserOperationController { | ... | @@ -325,14 +336,14 @@ public class UserOperationController { |
325 | return ResultInfo.success(result); | 336 | return ResultInfo.success(result); |
326 | } | 337 | } |
327 | 338 | ||
328 | @Log("大屏用户解绑") | 339 | @Log("大屏解绑") |
329 | @RequestMapping(value = "/unbind") | 340 | @RequestMapping(value = "/tvUnbind") |
330 | @ApiOperation("大屏用户解绑") | 341 | @ApiOperation("大屏解绑") |
331 | @AnonymousAccess | 342 | @AnonymousAccess |
332 | public ResultInfo unbind(@Validated(value = {UpdateGroup.class}) @RequestBody UserTv resources) { | 343 | public ResultInfo tvUnbind(@Validated(value = {UpdateGroup.class}) @RequestBody TvUnBindBean resources) { |
333 | log.info("UserOperationController ==> unbind ==>> param ==> [{}]",resources); | 344 | log.info("UserOperationController ==> unbind ==>> param ==> [{}]",resources); |
334 | 345 | ||
335 | this.userOperationService.unbind(resources); | 346 | this.userOperationService.tvUnbind(resources); |
336 | return ResultInfo.success(); | 347 | return ResultInfo.success(); |
337 | } | 348 | } |
338 | 349 | ||
... | @@ -340,10 +351,18 @@ public class UserOperationController { | ... | @@ -340,10 +351,18 @@ public class UserOperationController { |
340 | @RequestMapping(value = "/changeMainAccount") | 351 | @RequestMapping(value = "/changeMainAccount") |
341 | @ApiOperation("大屏更换主账号") | 352 | @ApiOperation("大屏更换主账号") |
342 | @AnonymousAccess | 353 | @AnonymousAccess |
343 | public ResultInfo changeMainAccount(@Validated(value = {UpdateGroup.class}) @RequestBody UserTv resources) { | 354 | public ResultInfo changeMainAccount(@Validated(value = {UpdateGroup.class}) @RequestBody BindBean resources) { |
344 | log.info("UserOperationController ==> changeMainAccount ==>> param ==> [{}]",resources); | 355 | log.info("UserOperationController ==> changeMainAccount ==>> param ==> [{}]",resources); |
345 | 356 | ||
346 | this.userOperationService.changeMainAccount(resources); | 357 | Long memberId = resources.getMemberId(); |
358 | String platformAccount = resources.getPlatformAccount(); | ||
359 | String code = this.memberService.findCodeById(memberId); | ||
360 | |||
361 | UserTv userTv = new UserTv(); | ||
362 | userTv.setMemberCode(code); | ||
363 | userTv.setPlatformAccount(platformAccount); | ||
364 | this.userOperationService.changeMainAccount(userTv); | ||
365 | |||
347 | return ResultInfo.success(); | 366 | return ResultInfo.success(); |
348 | } | 367 | } |
349 | 368 | ... | ... |
... | @@ -7,6 +7,7 @@ import com.topdraw.business.module.user.weixin.domain.UserWeixin; | ... | @@ -7,6 +7,7 @@ import com.topdraw.business.module.user.weixin.domain.UserWeixin; |
7 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | 7 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; |
8 | import com.topdraw.business.process.domian.weixin.BindBean; | 8 | import com.topdraw.business.process.domian.weixin.BindBean; |
9 | import com.topdraw.business.process.domian.weixin.SubscribeBean; | 9 | import com.topdraw.business.process.domian.weixin.SubscribeBean; |
10 | import com.topdraw.business.process.domian.weixin.TvUnBindBean; | ||
10 | 11 | ||
11 | 12 | ||
12 | public interface UserOperationService { | 13 | public interface UserOperationService { |
... | @@ -43,7 +44,7 @@ public interface UserOperationService { | ... | @@ -43,7 +44,7 @@ public interface UserOperationService { |
43 | * 大屏解绑 | 44 | * 大屏解绑 |
44 | * @param userTv | 45 | * @param userTv |
45 | */ | 46 | */ |
46 | void unbind(UserTv userTv); | 47 | void tvUnbind(TvUnBindBean userTv); |
47 | 48 | ||
48 | /** | 49 | /** |
49 | * 大屏切换主账户(会员) | 50 | * 大屏切换主账户(会员) |
... | @@ -101,7 +102,7 @@ public interface UserOperationService { | ... | @@ -101,7 +102,7 @@ public interface UserOperationService { |
101 | * @param resources | 102 | * @param resources |
102 | * @return | 103 | * @return |
103 | */ | 104 | */ |
104 | boolean appletBind(BindBean resources); | 105 | boolean minaBind(BindBean resources); |
105 | 106 | ||
106 | /** | 107 | /** |
107 | * | 108 | * |
... | @@ -138,4 +139,10 @@ public interface UserOperationService { | ... | @@ -138,4 +139,10 @@ public interface UserOperationService { |
138 | * @return | 139 | * @return |
139 | */ | 140 | */ |
140 | UserTvDTO findByPlatformAccount(String platformAccount); | 141 | UserTvDTO findByPlatformAccount(String platformAccount); |
142 | |||
143 | /** | ||
144 | * 小屏解绑 | ||
145 | * @param tvUnBindBean | ||
146 | */ | ||
147 | void minaUnbind(TvUnBindBean tvUnBindBean); | ||
141 | } | 148 | } | ... | ... |
... | @@ -4,7 +4,6 @@ import cn.hutool.core.date.DateUtil; | ... | @@ -4,7 +4,6 @@ import cn.hutool.core.date.DateUtil; |
4 | import cn.hutool.core.util.ObjectUtil; | 4 | import cn.hutool.core.util.ObjectUtil; |
5 | import cn.hutool.core.util.StrUtil; | 5 | import cn.hutool.core.util.StrUtil; |
6 | import com.alibaba.fastjson.JSON; | 6 | import com.alibaba.fastjson.JSON; |
7 | import com.alibaba.fastjson.JSONArray; | ||
8 | import com.alibaba.fastjson.JSONObject; | 7 | import com.alibaba.fastjson.JSONObject; |
9 | import com.topdraw.aspect.AsyncMqSend; | 8 | import com.topdraw.aspect.AsyncMqSend; |
10 | import com.topdraw.business.module.member.domain.Member; | 9 | import com.topdraw.business.module.member.domain.Member; |
... | @@ -55,7 +54,6 @@ import org.springframework.transaction.annotation.Propagation; | ... | @@ -55,7 +54,6 @@ import org.springframework.transaction.annotation.Propagation; |
55 | import org.springframework.transaction.annotation.Transactional; | 54 | import org.springframework.transaction.annotation.Transactional; |
56 | import org.springframework.util.Assert; | 55 | import org.springframework.util.Assert; |
57 | 56 | ||
58 | import javax.annotation.Resource; | ||
59 | import java.nio.charset.StandardCharsets; | 57 | import java.nio.charset.StandardCharsets; |
60 | import java.time.LocalDateTime; | 58 | import java.time.LocalDateTime; |
61 | import java.util.*; | 59 | import java.util.*; |
... | @@ -372,7 +370,8 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -372,7 +370,8 @@ public class UserOperationServiceImpl implements UserOperationService { |
372 | JSONObject json = JSONObject.parseObject(data); | 370 | JSONObject json = JSONObject.parseObject(data); |
373 | String unionId = json.getString("unionid"); | 371 | String unionId = json.getString("unionid"); |
374 | // 订阅号appid | 372 | // 订阅号appid |
375 | String appId = json.getString("dyAppid"); | 373 | // String appId = json.getString("dyAppid"); |
374 | String appId = json.getString("appid"); | ||
376 | 375 | ||
377 | try { | 376 | try { |
378 | 377 | ||
... | @@ -433,20 +432,23 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -433,20 +432,23 @@ public class UserOperationServiceImpl implements UserOperationService { |
433 | * @param resources | 432 | * @param resources |
434 | */ | 433 | */ |
435 | @Override | 434 | @Override |
436 | public void unbind(UserTv resources) { | 435 | public void tvUnbind(TvUnBindBean resources) { |
437 | 436 | ||
437 | Boolean autoModel = resources.getAutoModel(); | ||
438 | String platformAccount = resources.getPlatformAccount(); | 438 | String platformAccount = resources.getPlatformAccount(); |
439 | String memberCode = resources.getMemberCode(); | 439 | Long memberId = resources.getMemberId(); |
440 | MemberDTO memberDTO = this.memberService.findById(memberId); | ||
441 | String memberCode = memberDTO.getCode(); | ||
440 | 442 | ||
441 | UserTvDTO userTvDTO = this.findByPlatformAccount(platformAccount); | 443 | UserTvDTO userTvDTO = this.findByPlatformAccount(platformAccount); |
442 | if (Objects.isNull(userTvDTO)) | 444 | if (Objects.isNull(userTvDTO)) |
443 | throw new EntityNotFoundException(UserTvDTO.class, "PlatformAccount", GlobeExceptionMsg.IPTV_IS_NULL); | 445 | throw new EntityNotFoundException(UserTvDTO.class, "PlatformAccount", GlobeExceptionMsg.IPTV_IS_NULL); |
444 | 446 | ||
445 | // 解绑(置空大屏信息) | 447 | // 解绑(置空大屏信息) |
446 | MemberDTO _memberDTO = this.resetIptvColumn(this.findMemberByCode(memberCode)); | 448 | MemberDTO _memberDTO = this.minaUnbind_(this.findMemberByCode(memberCode)); |
447 | 449 | ||
448 | // 置空主账号 | 450 | // 置空主账号 |
449 | UserTvDTO _userTvDTO = this.resetMainAccount(memberCode, userTvDTO.getId()); | 451 | UserTvDTO _userTvDTO = this.resetMainAccount(memberCode, userTvDTO.getId(), autoModel); |
450 | 452 | ||
451 | // 同步至iptv | 453 | // 同步至iptv |
452 | ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUnbind(new MemberAndUserTvDTO(_memberDTO, _userTvDTO)); | 454 | ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUnbind(new MemberAndUserTvDTO(_memberDTO, _userTvDTO)); |
... | @@ -615,34 +617,31 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -615,34 +617,31 @@ public class UserOperationServiceImpl implements UserOperationService { |
615 | } | 617 | } |
616 | 618 | ||
617 | @Override | 619 | @Override |
618 | public boolean appletBind(BindBean resources) { | 620 | public boolean minaBind(BindBean resources) { |
619 | 621 | ||
620 | Long id = resources.getId(); | 622 | Long _memberId = resources.getMemberId(); |
621 | String unionid = resources.getUnionid(); | ||
622 | 623 | ||
623 | String platformAccount = resources.getPlatformAccount(); | 624 | String platformAccount = resources.getPlatformAccount(); |
624 | 625 | ||
625 | // 大屏账户 | 626 | // 大屏账户 |
626 | UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); | 627 | UserTvDTO userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); |
627 | // 账户是否存在 | 628 | // 账户是否存在 |
628 | if (Objects.isNull(userTvDTO.getId())){ | 629 | if (Objects.isNull(userTvDTO.getId())) { |
629 | log.error("appletBind ==> platformAccount ==> [{}]",platformAccount); | 630 | log.error("appletBind ==> platformAccount ==> [{}]",platformAccount); |
630 | throw new EntityNotFoundException(UserTvDTO.class,"id",GlobeExceptionMsg.IPTV_IS_NULL); | 631 | throw new EntityNotFoundException(UserTvDTO.class,"id",GlobeExceptionMsg.IPTV_IS_NULL); |
631 | } | 632 | } |
633 | |||
632 | resources.setPlatformUserId(userTvDTO.getId()); | 634 | resources.setPlatformUserId(userTvDTO.getId()); |
633 | 635 | ||
634 | UserWeixinDTO userWeixinDTO = null; | 636 | UserWeixinDTO userWeixinDTO = null; |
635 | // 微信账户 | 637 | // 微信账户 |
636 | if (Objects.nonNull(id)) { | 638 | if (Objects.nonNull(_memberId)) { |
637 | userWeixinDTO = this.userWeixinService.findById(id); | 639 | userWeixinDTO = this.userWeixinService.findFirstByMemberId(_memberId); |
638 | } else { | ||
639 | userWeixinDTO = this.findFirstByUnionId(unionid); | ||
640 | } | 640 | } |
641 | |||
642 | // 账户是否存在 | 641 | // 账户是否存在 |
643 | if (Objects.isNull(userWeixinDTO.getId())) { | 642 | if (Objects.isNull(userWeixinDTO.getId())) { |
644 | log.error("appletBind ==> weixinId ==> [{}]",id); | 643 | log.error("appletBind ==> weixinId ==> [{}]",userWeixinDTO.getId()); |
645 | throw new EntityNotFoundException(UserWeixinDTO.class, "id", id.toString()); | 644 | throw new EntityNotFoundException(UserWeixinDTO.class, "id", userWeixinDTO.getId().toString()); |
646 | } | 645 | } |
647 | 646 | ||
648 | // 会员 | 647 | // 会员 |
... | @@ -697,7 +696,8 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -697,7 +696,8 @@ public class UserOperationServiceImpl implements UserOperationService { |
697 | MemberDTO _memberDTO = this.doUpdateMemberByMemberDTO(memberDTO); | 696 | MemberDTO _memberDTO = this.doUpdateMemberByMemberDTO(memberDTO); |
698 | 697 | ||
699 | // 同步至iptv | 698 | // 同步至iptv |
700 | ((UserOperationServiceImpl)AopContext.currentProxy()).asyncAppletBind(new MemberAndUserTvDTO(_memberDTO, _userTvDTO)); | 699 | ((UserOperationServiceImpl)AopContext.currentProxy()) |
700 | .asyncAppletBind(new MemberAndUserTvDTO(_memberDTO, _userTvDTO)); | ||
701 | 701 | ||
702 | return true; | 702 | return true; |
703 | } | 703 | } |
... | @@ -932,32 +932,28 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -932,32 +932,28 @@ public class UserOperationServiceImpl implements UserOperationService { |
932 | 932 | ||
933 | /** | 933 | /** |
934 | * 重置主账号 | 934 | * 重置主账号 |
935 | * @param memberCode | 935 | * @param memberCode 会员code |
936 | * @param id 大屏id | ||
937 | * @param autoModel true:自动设置主账号 false: 手动设置 | ||
936 | */ | 938 | */ |
937 | private UserTvDTO resetMainAccount(String memberCode, Long id) { | 939 | private UserTvDTO resetMainAccount(String memberCode, Long id, Boolean autoModel) { |
938 | 940 | ||
939 | UserTvDTO userTvDTO = this.userTvService.findByPriorityMemberCode(memberCode); | 941 | UserTvDTO userTvDTO = this.userTvService.findByPriorityMemberCode(memberCode); |
940 | if (Objects.nonNull(userTvDTO)) { | 942 | if (Objects.nonNull(userTvDTO)) { |
941 | 943 | ||
942 | userTvDTO.setPriorityMemberCode(null); | 944 | if (autoModel == true) { |
943 | UserTv userTv = new UserTv(); | ||
944 | BeanUtils.copyProperties(userTvDTO,userTv); | ||
945 | 945 | ||
946 | UserTvDTO _userTvDTO = this.userTvService.update(userTv); | 946 | List<MemberDTO> memberDTOList = this.memberService.findByUserIptvId(id); |
947 | |||
948 | return _userTvDTO; | ||
949 | |||
950 | /*List<MemberDTO> memberDTOList = this.memberService.findByUserIptvId(id); | ||
951 | if (CollectionUtils.isNotEmpty(memberDTOList)) { | 947 | if (CollectionUtils.isNotEmpty(memberDTOList)) { |
952 | 948 | ||
953 | // 过滤解绑的会员 | 949 | // 过滤预解绑的会员 |
954 | List<MemberDTO> memberDTOS = memberDTOList.stream().filter(memberDTO -> !memberDTO.getCode().equalsIgnoreCase(memberCode)) | 950 | /*List<MemberDTO> memberDTOS = memberDTOList.stream().filter(memberDTO -> |
955 | .collect(Collectors.toList()); | 951 | !memberDTO.getCode().equalsIgnoreCase(memberCode)).collect(Collectors.toList());*/ |
956 | 952 | ||
957 | if (CollectionUtils.isNotEmpty(memberDTOS)) { | 953 | // if (CollectionUtils.isNotEmpty(memberDTOS)) { |
958 | 954 | ||
959 | // 按绑定时间倒排 | 955 | // 按绑定时间倒排 |
960 | memberDTOS.sort(new Comparator<MemberDTO>() { | 956 | memberDTOList.sort(new Comparator<MemberDTO>() { |
961 | @Override | 957 | @Override |
962 | public int compare(MemberDTO memberDTO, MemberDTO t1) { | 958 | public int compare(MemberDTO memberDTO, MemberDTO t1) { |
963 | return t1.getBindIptvTime().compareTo(memberDTO.getBindIptvTime()); | 959 | return t1.getBindIptvTime().compareTo(memberDTO.getBindIptvTime()); |
... | @@ -965,22 +961,13 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -965,22 +961,13 @@ public class UserOperationServiceImpl implements UserOperationService { |
965 | }); | 961 | }); |
966 | 962 | ||
967 | // 绑定新的主账号 | 963 | // 绑定新的主账号 |
968 | UserTvDTO _userTvDTO = this.bondPriorityMember(userTvDTO, memberDTOS.get(0).getCode(), "manual"); | 964 | UserTvDTO _userTvDTO = this.bondPriorityMember(userTvDTO, memberDTOList.get(0).getCode(), "manual"); |
969 | 965 | ||
970 | return _userTvDTO; | 966 | return _userTvDTO; |
971 | } | 967 | } |
972 | 968 | ||
973 | } else { | 969 | // } |
974 | 970 | } | |
975 | // 没有绑定其他会员,直接解绑,不换绑 | ||
976 | userTvDTO.setPriorityMemberCode(null); | ||
977 | UserTv userTv = new UserTv(); | ||
978 | BeanUtils.copyProperties(userTvDTO,userTv); | ||
979 | |||
980 | UserTvDTO _userTvDTO = this.userTvService.unbindPriorityMemberCode(userTv); | ||
981 | |||
982 | return _userTvDTO; | ||
983 | }*/ | ||
984 | 971 | ||
985 | } | 972 | } |
986 | 973 | ||
... | @@ -992,7 +979,7 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -992,7 +979,7 @@ public class UserOperationServiceImpl implements UserOperationService { |
992 | * 解绑(置空大屏信息) | 979 | * 解绑(置空大屏信息) |
993 | * @param memberDTOS | 980 | * @param memberDTOS |
994 | */ | 981 | */ |
995 | private MemberDTO resetIptvColumn(MemberDTO memberDTOS) { | 982 | private MemberDTO minaUnbind_(MemberDTO memberDTOS) { |
996 | 983 | ||
997 | // 若无关系,不做处理 | 984 | // 若无关系,不做处理 |
998 | if (Objects.nonNull(memberDTOS) && Objects.isNull(memberDTOS.getUserIptvId())) | 985 | if (Objects.nonNull(memberDTOS) && Objects.isNull(memberDTOS.getUserIptvId())) |
... | @@ -1003,7 +990,8 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -1003,7 +990,8 @@ public class UserOperationServiceImpl implements UserOperationService { |
1003 | memberDTOS.setUserIptvId(null); | 990 | memberDTOS.setUserIptvId(null); |
1004 | memberDTOS.setBindIptvPlatformType(null); | 991 | memberDTOS.setBindIptvPlatformType(null); |
1005 | BeanUtils.copyProperties(memberDTOS, member); | 992 | BeanUtils.copyProperties(memberDTOS, member); |
1006 | return this.memberService.update(member); | 993 | MemberDTO memberDTO = this.memberService.update(member); |
994 | return memberDTO; | ||
1007 | } | 995 | } |
1008 | 996 | ||
1009 | /** | 997 | /** |
... | @@ -1177,4 +1165,15 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -1177,4 +1165,15 @@ public class UserOperationServiceImpl implements UserOperationService { |
1177 | public UserTvDTO findByPlatformAccount(String platformAccount) { | 1165 | public UserTvDTO findByPlatformAccount(String platformAccount) { |
1178 | return this.userTvService.findByPlatformAccount(platformAccount); | 1166 | return this.userTvService.findByPlatformAccount(platformAccount); |
1179 | } | 1167 | } |
1168 | |||
1169 | @Override | ||
1170 | public void minaUnbind(TvUnBindBean tvUnBindBean) { | ||
1171 | |||
1172 | Long memberId = tvUnBindBean.getMemberId(); | ||
1173 | MemberDTO memberDTO = this.memberService.findById(memberId); | ||
1174 | UserTvDTO userTvDTO = this.userTvService.findById(memberDTO.getUserIptvId()); | ||
1175 | String platformAccount = userTvDTO.getPlatformAccount(); | ||
1176 | tvUnBindBean.setPlatformAccount(platformAccount); | ||
1177 | this.tvUnbind(tvUnBindBean); | ||
1178 | } | ||
1180 | } | 1179 | } | ... | ... |
... | @@ -15,7 +15,7 @@ public class RabbitMqConfig { | ... | @@ -15,7 +15,7 @@ public class RabbitMqConfig { |
15 | 15 | ||
16 | /** 队列-- */ | 16 | /** 队列-- */ |
17 | public static final String UC_QUEUE_DIRECT_BBB = "uc.route.key.direct.event.bbb"; | 17 | public static final String UC_QUEUE_DIRECT_BBB = "uc.route.key.direct.event.bbb"; |
18 | public static final String UC_QUEUE_DIRECT_CCC = "uc.route.key.direct.event.ccc"; | 18 | public static final String UC_QUEUE_DIRECT_CCC = "uc.route.key.direct.event.ccc.new"; |
19 | 19 | ||
20 | public static final String ENGINE_TO_IPTV_CONSUMER_MEMBER_DIRECT = "engine.iptv.consumer.member.direct"; | 20 | public static final String ENGINE_TO_IPTV_CONSUMER_MEMBER_DIRECT = "engine.iptv.consumer.member.direct"; |
21 | 21 | ... | ... |
... | @@ -5,7 +5,7 @@ spring: | ... | @@ -5,7 +5,7 @@ spring: |
5 | # url: jdbc:log4jdbc:mysql://139.196.192.242:3306/tj_user_0819?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false | 5 | # url: jdbc:log4jdbc:mysql://139.196.192.242:3306/tj_user_0819?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false |
6 | # username: root | 6 | # username: root |
7 | # password: Tjlh@2017 | 7 | # password: Tjlh@2017 |
8 | url: jdbc:log4jdbc:mysql://122.112.214.149:3306/tj_user?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false | 8 | url: jdbc:log4jdbc:mysql://122.112.214.149:3306/tj_user_iptv?serverTimezone=Asia/Shanghai&characterEncoding=utf8&useSSL=false |
9 | username: root | 9 | username: root |
10 | password: root | 10 | password: root |
11 | 11 | ||
... | @@ -109,7 +109,7 @@ engine: | ... | @@ -109,7 +109,7 @@ engine: |
109 | # 部署类型 management:管理侧 service:服务侧 | 109 | # 部署类型 management:管理侧 service:服务侧 |
110 | platform: service | 110 | platform: service |
111 | # 可选参数 mobile:小屏 vis:大屏 | 111 | # 可选参数 mobile:小屏 vis:大屏 |
112 | type: mobile | 112 | type: vis |
113 | 113 | ||
114 | weixin: | 114 | weixin: |
115 | list: | 115 | list: | ... | ... |
1 | package com.topdraw.test.business.process.rest; | 1 | package com.topdraw.test.business.process.rest; |
2 | 2 | ||
3 | import com.alibaba.fastjson.JSON; | 3 | import com.alibaba.fastjson.JSON; |
4 | import com.alibaba.fastjson.JSONObject; | ||
4 | import com.topdraw.BaseTest; | 5 | import com.topdraw.BaseTest; |
6 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; | ||
7 | import com.topdraw.business.process.domian.weixin.BindBean; | ||
8 | import com.topdraw.business.process.domian.weixin.TvUnBindBean; | ||
5 | import com.topdraw.business.process.rest.TaskOperationController; | 9 | import com.topdraw.business.process.rest.TaskOperationController; |
10 | import com.topdraw.business.process.rest.UserOperationController; | ||
6 | import com.topdraw.business.process.service.dto.TaskOperationQueryCriteria; | 11 | import com.topdraw.business.process.service.dto.TaskOperationQueryCriteria; |
12 | import com.topdraw.common.ResultInfo; | ||
7 | import com.topdraw.module.mq.DataSyncMsg; | 13 | import com.topdraw.module.mq.DataSyncMsg; |
8 | import com.topdraw.module.mq.EventType; | 14 | import com.topdraw.module.mq.EventType; |
9 | import org.junit.Test; | 15 | import org.junit.Test; |
... | @@ -15,26 +21,95 @@ import java.util.concurrent.FutureTask; | ... | @@ -15,26 +21,95 @@ import java.util.concurrent.FutureTask; |
15 | public class UserOperationControllerTest extends BaseTest { | 21 | public class UserOperationControllerTest extends BaseTest { |
16 | 22 | ||
17 | @Autowired | 23 | @Autowired |
18 | TaskOperationController taskOperationController; | 24 | private UserOperationController userOperationController; |
19 | 25 | ||
20 | @Test | 26 | @Test |
21 | public void dealTask() { | 27 | public void minaUnbind() { |
22 | try { | 28 | try { |
23 | DataSyncMsg dataSyncMsg = new DataSyncMsg(); | 29 | TvUnBindBean bindBean = new TvUnBindBean(); |
24 | dataSyncMsg.setEventType(EventType.VIEWING.name()); | 30 | // 小屏会员 |
25 | DataSyncMsg.MsgData msgData = new DataSyncMsg.MsgData(); | 31 | bindBean.setMemberId(4L); |
26 | msgData.setEvent(6); // 类型 1-登录 2-观影 3-参加活动 4-订购 5-优享会员 6-签到 | 32 | bindBean.setAutoModel(true); |
27 | msgData.setRemarks("remark"); | 33 | ResultInfo weixinUserAndMember = this.userOperationController.minaUnbind(bindBean); |
28 | msgData.setMemberId(2261L); | 34 | System.out.println(weixinUserAndMember); |
29 | msgData.setDeviceType(2); | 35 | } catch (Exception e) { |
30 | msgData.setAppCode("WEI_XIN_GOLD_PANDA"); | 36 | e.printStackTrace(); |
31 | dataSyncMsg.setMsg(msgData); | 37 | } |
32 | String s = JSON.toJSONString(dataSyncMsg); | 38 | } |
33 | TaskOperationQueryCriteria pointsQueryCriteria = new TaskOperationQueryCriteria(); | 39 | |
34 | pointsQueryCriteria.setContent(s); | 40 | @Test |
35 | String s1 = JSON.toJSONString(pointsQueryCriteria); | 41 | public void memberPreprocess() { |
36 | System.out.println(s1); | 42 | try { |
37 | this.taskOperationController.dealTask(pointsQueryCriteria); | 43 | String a = "{\"IPTVappid\":\"kids3\",\"platformAccount\":\"topdraw\"," + |
44 | "\"appid\":\"wx5d88c7fe99f89f32\",\"unionid\":\"oqDha5lxMuXYMGgT6gyLIFL7VumM\"," + | ||
45 | "\"nickname\":\"%E5%90%89%E8%B4%9D\"," + | ||
46 | "\"headimgurl\":\"https%3A%2F%2Fthirdwx.qlogo.cn%2Fmmopen%2Fvi_32%2FDYAIOgq83erGuDK9HlicY2iasIB5VHXTNWtuqfIZxIpzicQKWg9ogSRKRO1DeYtWicDHMMibpibHOEZRfp1Fvd4EQgrg%2F132\"}"; | ||
47 | |||
48 | ResultInfo weixinUserAndMember = this.userOperationController.memberPreprocess(a); | ||
49 | System.out.println(weixinUserAndMember); | ||
50 | } catch (Exception e) { | ||
51 | e.printStackTrace(); | ||
52 | } | ||
53 | } | ||
54 | |||
55 | @Test | ||
56 | public void tvUnbind() { | ||
57 | try { | ||
58 | TvUnBindBean bindBean = new TvUnBindBean(); | ||
59 | bindBean.setPlatformAccount("topdraw"); | ||
60 | // 小屏会员 | ||
61 | bindBean.setMemberId(20559L); | ||
62 | bindBean.setAutoModel(true); | ||
63 | |||
64 | ResultInfo weixinUserAndMember = this.userOperationController.tvUnbind(bindBean); | ||
65 | System.out.println(weixinUserAndMember); | ||
66 | } catch (Exception e) { | ||
67 | e.printStackTrace(); | ||
68 | } | ||
69 | } | ||
70 | |||
71 | @Test | ||
72 | public void changeMainAccount() { | ||
73 | try { | ||
74 | BindBean bindBean = new BindBean(); | ||
75 | bindBean.setPlatformAccount("topdraw"); | ||
76 | // 小屏会员 | ||
77 | bindBean.setMemberId(20560L); | ||
78 | |||
79 | ResultInfo weixinUserAndMember = this.userOperationController.changeMainAccount(bindBean); | ||
80 | System.out.println(weixinUserAndMember); | ||
81 | } catch (Exception e) { | ||
82 | e.printStackTrace(); | ||
83 | } | ||
84 | } | ||
85 | |||
86 | @Test | ||
87 | public void minaBind() { | ||
88 | try { | ||
89 | BindBean bindBean = new BindBean(); | ||
90 | bindBean.setPlatformAccount("topdraw"); | ||
91 | // 小屏会员 | ||
92 | bindBean.setMemberId(4L); | ||
93 | |||
94 | ResultInfo weixinUserAndMember = this.userOperationController.minaBind(bindBean); | ||
95 | System.out.println(weixinUserAndMember); | ||
96 | } catch (Exception e) { | ||
97 | e.printStackTrace(); | ||
98 | } | ||
99 | } | ||
100 | |||
101 | @Test | ||
102 | public void createWeixinUserAndMember() { | ||
103 | try { | ||
104 | String a = "{\n" + | ||
105 | "\"unionid\":\"oqDha5gjkNC4sivrcjbZSRq9foXM\",\n" + | ||
106 | "\"appid\":\"wx37ea49702cdc693b\", \n" + | ||
107 | "\"openid\":\"oM3jj5ke7o68I9-mIrAuQ8StkD_0\", \n" + | ||
108 | "\"authTime\":\"2022-03-22 20:10:43.47\"\n" + | ||
109 | "}"; | ||
110 | UserWeixin parse = JSONObject.parseObject(a, UserWeixin.class); | ||
111 | ResultInfo weixinUserAndMember = this.userOperationController.createWeixinUserAndMember(parse); | ||
112 | System.out.println(weixinUserAndMember); | ||
38 | } catch (Exception e) { | 113 | } catch (Exception e) { |
39 | e.printStackTrace(); | 114 | e.printStackTrace(); |
40 | } | 115 | } | ... | ... |
-
Please register or sign in to post a comment