Commit 60b8b824 60b8b824da5589211d1dbd44fe6287f0c2eb5131 by xianghan

1.修改会员信息修改、账号信息修改的方式

1 parent 9c38b950
...@@ -5,6 +5,7 @@ import org.springframework.data.jpa.repository.JpaRepository; ...@@ -5,6 +5,7 @@ import org.springframework.data.jpa.repository.JpaRepository;
5 import org.springframework.data.jpa.repository.JpaSpecificationExecutor; 5 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
6 import org.springframework.data.jpa.repository.Modifying; 6 import org.springframework.data.jpa.repository.Modifying;
7 import org.springframework.data.jpa.repository.Query; 7 import org.springframework.data.jpa.repository.Query;
8 import org.springframework.data.repository.query.Param;
8 9
9 import java.time.LocalDateTime; 10 import java.time.LocalDateTime;
10 import java.util.Optional; 11 import java.util.Optional;
...@@ -24,4 +25,35 @@ public interface UserTvRepository extends JpaRepository<UserTv, Long>, JpaSpecif ...@@ -24,4 +25,35 @@ public interface UserTvRepository extends JpaRepository<UserTv, Long>, JpaSpecif
24 @Modifying 25 @Modifying
25 @Query(value = "UPDATE `uc_user_tv` SET `vis_user_id` = ?2, `update_time` = ?3 WHERE `id` = ?1", nativeQuery = true) 26 @Query(value = "UPDATE `uc_user_tv` SET `vis_user_id` = ?2, `update_time` = ?3 WHERE `id` = ?1", nativeQuery = true)
26 Integer updateUserTvVisUserId(Long id, Long visUserId, LocalDateTime now); 27 Integer updateUserTvVisUserId(Long id, Long visUserId, LocalDateTime now);
28
29
30 @Modifying
31 @Query(value = "UPDATE `uc_user_tv` SET `member_id` = ?2, `update_time` = now() WHERE `platform_account` = ?1", nativeQuery = true)
32 void updateMemberId(String platformAccount, Long memberId);
33
34 @Modifying
35 @Query(value = "UPDATE `uc_user_tv` SET `priority_member_code` = ?2, `update_time` = now() WHERE `platform_account` = ?1", nativeQuery = true)
36 void updatePriorityMemberCode(String platformAccount, String priorityMemberCode);
37
38 @Modifying
39 @Query(value = "UPDATE `uc_user_tv` SET " +
40 " `cellphone` = :#{#resources.cellphone}, " +
41 " `username` = :#{#resources.username}, " +
42 " `nickname` = :#{#resources.nickname}, " +
43 " `image` = :#{#resources.image}, " +
44 " `platform` = :#{#resources.platform}, " +
45 " `login_days` = :#{#resources.loginDays}, " +
46 " `continue_days` = :#{#resources.continueDays}, " +
47 " `active_time` = :#{#resources.activeTime}, " +
48 " `groups` = :#{#resources.groups}, " +
49 " `tags` = :#{#resources.tags}, " +
50 " `login_type` = :#{#resources.loginType}, " +
51 " `status` = :#{#resources.status}, " +
52 " `description` = :#{#resources.description}, " +
53 " `create_by` = :#{#resources.createBy}, " +
54 " `update_by` = :#{#resources.updateBy}, " +
55 " `priority_member_code` = :#{#resources.priorityMemberCode}, " +
56 " `vis_user_id` = :#{#resources.visUserId}, " +
57 " `update_time` = now() WHERE `platform_account` = :#{#resources.platformAccount}", nativeQuery = true)
58 void updateUserTvByPlatformAccount(@Param("resources") UserTv userTv);
27 } 59 }
......
...@@ -88,4 +88,24 @@ public interface UserTvService { ...@@ -88,4 +88,24 @@ public interface UserTvService {
88 */ 88 */
89 UserTvDTO asyncUpdateUserTvVisUserId(UserTv resources); 89 UserTvDTO asyncUpdateUserTvVisUserId(UserTv resources);
90 90
91
92 /**
93 *
94 * @param platformAccount
95 * @param id
96 */
97 void updateMemberId(String platformAccount, Long id);
98
99 /**
100 *
101 * @param platformAccount
102 * @param priorityMemberCode
103 */
104 void updatePriorityMemberCode(String platformAccount, String priorityMemberCode);
105
106 /**
107 *
108 * @param userTv
109 */
110 void updateUserTvByPlatformAccount(UserTv userTv);
91 } 111 }
......
...@@ -44,6 +44,25 @@ public class UserTvServiceImpl implements UserTvService { ...@@ -44,6 +44,25 @@ public class UserTvServiceImpl implements UserTvService {
44 @Autowired 44 @Autowired
45 private UserTvRepository userTvRepository; 45 private UserTvRepository userTvRepository;
46 46
47 @Override
48 @Transactional(rollbackFor = Exception.class)
49 public void updateMemberId(String platformAccount, Long memberId) {
50 this.userTvRepository.updateMemberId(platformAccount, memberId);
51 }
52
53 @Override
54 @Transactional(rollbackFor = Exception.class)
55 public void updatePriorityMemberCode(String platformAccount, String priorityMemberCode) {
56 this.userTvRepository.updatePriorityMemberCode(platformAccount, priorityMemberCode);
57 }
58
59 @Override
60 @Transactional(rollbackFor = Exception.class)
61 public void updateUserTvByPlatformAccount(UserTv userTv) {
62 this.userTvRepository.updateUserTvByPlatformAccount(userTv);
63 }
64
65
47 /** 66 /**
48 * 获取大屏账户对应的会员 67 * 获取大屏账户对应的会员
49 * <Waring> 68 * <Waring>
......
...@@ -2,6 +2,9 @@ package com.topdraw.business.process.service.impl; ...@@ -2,6 +2,9 @@ package com.topdraw.business.process.service.impl;
2 2
3 3
4 import com.topdraw.business.module.member.domain.Member; 4 import com.topdraw.business.module.member.domain.Member;
5 import com.topdraw.business.module.member.profile.domain.MemberProfile;
6 import com.topdraw.business.module.member.profile.service.MemberProfileService;
7 import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO;
5 import com.topdraw.business.module.member.service.MemberService; 8 import com.topdraw.business.module.member.service.MemberService;
6 import com.topdraw.business.module.member.service.dto.MemberDTO; 9 import com.topdraw.business.module.member.service.dto.MemberDTO;
7 import com.topdraw.business.module.user.iptv.domain.UserTv; 10 import com.topdraw.business.module.user.iptv.domain.UserTv;
...@@ -37,6 +40,8 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -37,6 +40,8 @@ public class UserOperationServiceImpl implements UserOperationService {
37 private UserTvService userTvService; 40 private UserTvService userTvService;
38 @Autowired 41 @Autowired
39 private UserWeixinService userWeixinService; 42 private UserWeixinService userWeixinService;
43 @Autowired
44 private MemberProfileService memberProfileService;
40 45
41 @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) 46 @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class)
42 public void asyncMemberAndUserWeixin4Iptv(MemberAndWeixinUserDTO memberAndWeixinUserDTO) { 47 public void asyncMemberAndUserWeixin4Iptv(MemberAndWeixinUserDTO memberAndWeixinUserDTO) {
...@@ -75,7 +80,7 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -75,7 +80,7 @@ public class UserOperationServiceImpl implements UserOperationService {
75 80
76 } 81 }
77 82
78 // 无会员 83 // 无会员
79 } else { 84 } else {
80 85
81 MemberDTO memberDTO = memberAndWeixinUserDTO.getMemberDTO(); 86 MemberDTO memberDTO = memberAndWeixinUserDTO.getMemberDTO();
...@@ -139,13 +144,18 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -139,13 +144,18 @@ public class UserOperationServiceImpl implements UserOperationService {
139 144
140 @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) 145 @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class)
141 public void asyncMemberAndUserTv4Iptv(MemberAndUserTvDTO memberAndUserTvDTO) { 146 public void asyncMemberAndUserTv4Iptv(MemberAndUserTvDTO memberAndUserTvDTO) {
147 log.info("同步小屏侧过来的大屏账号和会员, memberAndUserTvDTO ==>> {}", memberAndUserTvDTO);
148
142 UserTvDTO userTvDTO = memberAndUserTvDTO.getUserTvDTO(); 149 UserTvDTO userTvDTO = memberAndUserTvDTO.getUserTvDTO();
143 MemberDTO memberDTO = memberAndUserTvDTO.getMemberDTO(); 150 MemberDTO memberDTO = memberAndUserTvDTO.getMemberDTO();
144 151
145 String platformAccount = userTvDTO.getPlatformAccount(); 152 String platformAccount = userTvDTO.getPlatformAccount();
153 log.info("同步小屏侧过来的大屏账号, platformAccount ==>> {}", platformAccount);
146 UserTvDTO _userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); 154 UserTvDTO _userTvDTO = this.userTvService.findByPlatformAccount(platformAccount);
147 if (Objects.isNull(_userTvDTO)) { 155 // log.info("查询数据对应的大屏账号信息, _userTvDTO ==>> {}", _userTvDTO);
148 156
157 if (Objects.isNull(_userTvDTO)) {
158 log.info("大屏账号不存在, 创建会员并新增账号");
149 memberDTO.setId(null); 159 memberDTO.setId(null);
150 // 创建大屏会员 160 // 创建大屏会员
151 MemberDTO _memberDTO = this.createMember(memberDTO); 161 MemberDTO _memberDTO = this.createMember(memberDTO);
...@@ -155,46 +165,72 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -155,46 +165,72 @@ public class UserOperationServiceImpl implements UserOperationService {
155 165
156 } else { 166 } else {
157 167
158 String code = memberDTO.getCode(); 168 Long memberId = _userTvDTO.getMemberId();
159 MemberDTO _memberDTO = this.memberService.findByCode(code); 169 if (Objects.isNull(memberId)) {
160 if (Objects.nonNull(_memberDTO.getId())) {
161 this.updateMember(_memberDTO, memberDTO);
162 } else {
163 memberDTO.setId(null); 170 memberDTO.setId(null);
164 MemberDTO _memberDTO0 = this.createMember(memberDTO); 171 // 创建大屏会员
165 userTvDTO.setMemberId(_memberDTO0.getId()); 172 MemberDTO _memberDTO = this.createMember(memberDTO);
173 userTvDTO.setMemberId(_memberDTO.getId());
174
175 log.info("大屏账号存在, 但无会员信息,新增会员信息并修改大屏账号");
176 // this.userTvService.updateMemberId(platformAccount, _memberDTO.getId());
177
178 } else {
179
180 MemberProfileDTO memberProfileDTO = this.memberProfileService.findByMemberId(memberId);
181 if (Objects.isNull(memberProfileDTO)) {
182 MemberDTO memberDTO1 = this.memberService.findById(memberId);
183 Member member = new Member();
184 BeanUtils.copyProperties(memberDTO1, member);
185 this.memberProfileService.createDefault(member);
186 }
187
166 } 188 }
167 189
168 this.updateUserTv(_userTvDTO, userTvDTO); 190
191 UserTv userTv = new UserTv();
192 BeanUtils.copyProperties(_userTvDTO, userTv);
193 this.userTvService.updateUserTvByPlatformAccount(userTv);
194
169 } 195 }
170 } 196 }
171 197
172 @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) 198 @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class)
173 public void asyncAppletBind(MemberAndUserTvDTO memberAndUserTvDTO) { 199 public void asyncAppletBind(MemberAndUserTvDTO memberAndUserTvDTO) {
200 log.info("asyncAppletBind ==>> 小程序绑定大屏,参数 memberAndUserTvDTO ==>> {}", memberAndUserTvDTO);
174 UserTvDTO userTvDTO = memberAndUserTvDTO.getUserTvDTO(); 201 UserTvDTO userTvDTO = memberAndUserTvDTO.getUserTvDTO();
175 MemberDTO memberDTO = memberAndUserTvDTO.getMemberDTO(); 202 MemberDTO memberDTO = memberAndUserTvDTO.getMemberDTO();
176 203
177 String platformAccount = userTvDTO.getPlatformAccount(); 204 String platformAccount = userTvDTO.getPlatformAccount();
178 UserTvDTO _userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); 205 UserTvDTO _userTvDTO = this.userTvService.findByPlatformAccount(platformAccount);
179 if (Objects.nonNull(_userTvDTO)) { 206 if (Objects.nonNull(_userTvDTO.getId())) {
180 207
181 // 208 //
182 this.updateUserTv(_userTvDTO, userTvDTO); 209 // userTvDTO.getPriorityMemberCode();
210 // this.updateUserTv(_userTvDTO, userTvDTO);
211 // 修改大屏账号的主会员
212 String priorityMemberCode = userTvDTO.getPriorityMemberCode();
213 log.info("修改大屏账号的主会员, 主会员priorityMemberCode ==>> {}", priorityMemberCode);
214 if (StringUtils.isNotBlank(priorityMemberCode)) {
215 this.userTvService.updatePriorityMemberCode(platformAccount, priorityMemberCode);
216 }
183 217
184 String code = memberDTO.getCode(); 218 String code = memberDTO.getCode();
185 MemberDTO _memberDTO = this.memberService.findByCode(code); 219 MemberDTO _memberDTO = this.memberService.findByCode(code);
186 220
187 memberDTO.setUserIptvId(_userTvDTO.getId()); 221 memberDTO.setUserIptvId(_userTvDTO.getId());
222 log.info("修改会员对应绑定的大屏账号id, memberId ==>> {} || userTvId ==>> {}", _memberDTO.getId(), _userTvDTO.getId());
188 this.memberService.updateUserIptvIdById(_memberDTO.getId(), _userTvDTO.getId(), LocalDateTime.now()); 223 this.memberService.updateUserIptvIdById(_memberDTO.getId(), _userTvDTO.getId(), LocalDateTime.now());
189 //this.updateMember(_memberDTO, memberDTO);
190 224
191 } else { 225 } else {
192 226
193 throw new EntityNotFoundException(UserTvDTO.class, "id", GlobeExceptionMsg.IPTV_IS_NULL); 227 log.error("asyncAppletBind ==>> 小程序绑定大屏异常,大屏账号不存在, platformAccount ==>> {}", platformAccount);
194 228
195 } 229 }
230
196 } 231 }
197 232
233
198 @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) 234 @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class)
199 public void asyncUnbind(MemberAndUserTvDTO memberAndUserTvDTO) { 235 public void asyncUnbind(MemberAndUserTvDTO memberAndUserTvDTO) {
200 UserTvDTO userTvDTO = memberAndUserTvDTO.getUserTvDTO(); 236 UserTvDTO userTvDTO = memberAndUserTvDTO.getUserTvDTO();
...@@ -318,7 +354,11 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -318,7 +354,11 @@ public class UserOperationServiceImpl implements UserOperationService {
318 String platformAccount = userTvDTO.getPlatformAccount(); 354 String platformAccount = userTvDTO.getPlatformAccount();
319 UserTvDTO _userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); 355 UserTvDTO _userTvDTO = this.userTvService.findByPlatformAccount(platformAccount);
320 log.info("db result ==>> _userTvDTO ==>> {}", _userTvDTO); 356 log.info("db result ==>> _userTvDTO ==>> {}", _userTvDTO);
321 this.updateUserTv(_userTvDTO, userTvDTO); 357 // this.updateUserTv(_userTvDTO, userTvDTO);
358
359 UserTv userTv = new UserTv();
360 BeanUtils.copyProperties(userTvDTO, userTv);
361 this.userTvService.updateUserTvByPlatformAccount(userTv);
322 } 362 }
323 363
324 @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) 364 @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class)
...@@ -336,56 +376,70 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -336,56 +376,70 @@ public class UserOperationServiceImpl implements UserOperationService {
336 376
337 @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) 377 @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class)
338 public void asyncSubscribe(MemberAndWeixinUserDTO memberAndWeixinUserDTO) { 378 public void asyncSubscribe(MemberAndWeixinUserDTO memberAndWeixinUserDTO) {
379 log.info("微信关注业务开始");
339 UserWeixinDTO userWeixinDTO = memberAndWeixinUserDTO.getUserWeixinDTO(); 380 UserWeixinDTO userWeixinDTO = memberAndWeixinUserDTO.getUserWeixinDTO();
381 log.info("小屏侧传过来的微信账号信息 ==>> userWeixinDTO ==>> {}", userWeixinDTO);
340 String openid = userWeixinDTO.getOpenid(); 382 String openid = userWeixinDTO.getOpenid();
341 String unionid = userWeixinDTO.getUnionid(); 383 String unionid = userWeixinDTO.getUnionid();
342 String appid = userWeixinDTO.getAppid(); 384 String appid = userWeixinDTO.getAppid();
343 MemberDTO memberDTO = memberAndWeixinUserDTO.getMemberDTO(); 385 MemberDTO memberDTO = memberAndWeixinUserDTO.getMemberDTO();
386 log.info("小屏侧传过来的会员信息 ==>> memberDTO ==>> {}", memberDTO);
344 387
345 UserWeixinDTO _userWeixinDTO = this.userWeixinService.findFirstByUnionIdAndAppIdAndOpenId(unionid, appid, openid); 388 UserWeixinDTO _userWeixinDTO = this.userWeixinService.findFirstByUnionIdAndAppIdAndOpenId(unionid, appid, openid);
346 // 有账号 389 // 有账号
347 if (Objects.nonNull(_userWeixinDTO.getId())) { 390 if (Objects.nonNull(_userWeixinDTO.getId())) {
348 391 log.info("账号存在,检查会员是否存在");
349 UserWeixinDTO _userWeixinDTO0 = this.userWeixinService.findFirstByAppIdAndOpenId(appid, openid); 392 UserWeixinDTO _userWeixinDTO0 = this.userWeixinService.findFirstByAppIdAndOpenId(appid, openid);
350 // 会员存在 393 // 会员存在
351 if(Objects.nonNull(_userWeixinDTO0.getMemberId())) { 394 if(Objects.nonNull(_userWeixinDTO0.getMemberId())) {
395 log.info("会员存在,修改账号的关注状态, 关注状态 status ==>> {}", userWeixinDTO.getStatus());
352 // 账号存在,修改账号和会员 396 // 账号存在,修改账号和会员
353 this.updateWeixin(_userWeixinDTO, userWeixinDTO); 397 this.updateWeixin(_userWeixinDTO, userWeixinDTO);
354 MemberDTO _memberDTO = this.memberService.findById(_userWeixinDTO.getMemberId()); 398 MemberDTO _memberDTO = this.memberService.findById(_userWeixinDTO.getMemberId());
355 399
356 MemberDTO memberDTO0 = memberAndWeixinUserDTO.getMemberDTO(); 400 MemberDTO memberDTO0 = memberAndWeixinUserDTO.getMemberDTO();
357 memberDTO0.setUserIptvId(_memberDTO.getUserIptvId()); 401 memberDTO0.setUserIptvId(_memberDTO.getUserIptvId());
402
403 log.info("会员存在,修改会员的绑定和vip标识", userWeixinDTO.getStatus());
358 this.updateMember(_memberDTO, memberDTO0); 404 this.updateMember(_memberDTO, memberDTO0);
359 405
360 // 有账号无会员 406 // 有账号无会员
361 } else { 407 } else {
362 408
409 log.info("当前账号会员不存在");
363 // 是否存在会员 410 // 是否存在会员
364 UserWeixinDTO userWeixinDTO1 = this.userWeixinService.findFirstByUnionId(unionid); 411 UserWeixinDTO userWeixinDTO1 = this.userWeixinService.findFirstByUnionId(unionid);
365 412 log.info("检查是否有其他账号存在, 其他账号信息 ==>> {}", userWeixinDTO1);
366 // 有其他账号 413 // 有其他账号
367 if (Objects.nonNull(userWeixinDTO1.getId())) { 414 if (Objects.nonNull(userWeixinDTO1.getId())) {
368 415 log.info("存在其他账号,检查其他账号是否有会员");
369 Long memberId = userWeixinDTO1.getMemberId(); 416 Long memberId = userWeixinDTO1.getMemberId();
370 if (Objects.nonNull(memberId)) { 417 if (Objects.nonNull(memberId)) {
371 418
372 userWeixinDTO.setMemberId(memberId); 419 userWeixinDTO.setMemberId(memberId);
373 MemberDTO memberDTO0 = this.memberService.findById(memberId); 420 MemberDTO memberDTO0 = this.memberService.findById(memberId);
421 log.info("其他账号有会员,会员信息 ==>> {}", memberDTO0);
422
374 MemberDTO memberDTO1 = memberAndWeixinUserDTO.getMemberDTO(); 423 MemberDTO memberDTO1 = memberAndWeixinUserDTO.getMemberDTO();
424
425 log.info("开始同步会员信息");
375 this.updateMember(memberDTO0, memberDTO1); 426 this.updateMember(memberDTO0, memberDTO1);
376 427
377 } else { 428 } else {
378 429 log.info("其他账号无会员");
379 MemberDTO memberDTO1 = memberAndWeixinUserDTO.getMemberDTO(); 430 MemberDTO memberDTO1 = memberAndWeixinUserDTO.getMemberDTO();
380 Member member = new Member(); 431 Member member = new Member();
381 BeanUtils.copyProperties(memberDTO1, member); 432 BeanUtils.copyProperties(memberDTO1, member);
382 member.setId(null); 433 member.setId(null);
434
435 log.info("为当前账号创建会员,会员信息 ==>> {}", member);
383 MemberDTO _memberDTO1 = this.memberService.create(member); 436 MemberDTO _memberDTO1 = this.memberService.create(member);
384 userWeixinDTO.setMemberId(_memberDTO1.getId()); 437 userWeixinDTO.setMemberId(_memberDTO1.getId());
385 438
386 } 439 }
387 } 440 }
388 441
442 log.info("开始修改账号信息");
389 this.updateWeixin(_userWeixinDTO, userWeixinDTO); 443 this.updateWeixin(_userWeixinDTO, userWeixinDTO);
390 444
391 } 445 }
...@@ -393,41 +447,56 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -393,41 +447,56 @@ public class UserOperationServiceImpl implements UserOperationService {
393 // 无账号 447 // 无账号
394 } else { 448 } else {
395 449
450 log.info("当前账号不存在,检查其他账号是否存在");
396 // 是否存在会员 451 // 是否存在会员
397 UserWeixinDTO userWeixinDTO1 = this.userWeixinService.findFirstByUnionId(unionid); 452 UserWeixinDTO userWeixinDTO1 = this.userWeixinService.findFirstByUnionId(unionid);
398 453
399 // 有其他账号 454 // 有其他账号
400 if (Objects.nonNull(userWeixinDTO1.getId())) { 455 if (Objects.nonNull(userWeixinDTO1.getId())) {
401 456
457 log.info("其他账号存在, 其他账号信息 ==>> {}", userWeixinDTO1);
458
459 log.info("检查其他账号是否有会员");
402 Long memberId = userWeixinDTO1.getMemberId(); 460 Long memberId = userWeixinDTO1.getMemberId();
403 if (Objects.nonNull(memberId)) { 461 if (Objects.nonNull(memberId)) {
404 462
405 userWeixinDTO.setMemberId(memberId); 463 userWeixinDTO.setMemberId(memberId);
406 MemberDTO memberDTO0 = this.memberService.findById(memberId); 464 MemberDTO memberDTO0 = this.memberService.findById(memberId);
465 log.info("其他账号有会员,会员信息 ==>> {}", memberDTO0);
466
407 MemberDTO memberDTO1 = memberAndWeixinUserDTO.getMemberDTO(); 467 MemberDTO memberDTO1 = memberAndWeixinUserDTO.getMemberDTO();
468
469 log.info("开始同步会员信息");
408 this.updateMember(memberDTO0, memberDTO1); 470 this.updateMember(memberDTO0, memberDTO1);
409 471
410 } else { 472 } else {
411 473 log.info("其他账号无会员");
412 MemberDTO memberDTO1 = memberAndWeixinUserDTO.getMemberDTO(); 474 MemberDTO memberDTO1 = memberAndWeixinUserDTO.getMemberDTO();
413 Member member = new Member(); 475 Member member = new Member();
414 BeanUtils.copyProperties(memberDTO1, member); 476 BeanUtils.copyProperties(memberDTO1, member);
415 member.setId(null); 477 member.setId(null);
478
479 log.info("为当前账号创建会员,会员信息 ==>> {}", member);
416 MemberDTO _memberDTO1 = this.memberService.create(member); 480 MemberDTO _memberDTO1 = this.memberService.create(member);
417 userWeixinDTO.setMemberId(_memberDTO1.getId()); 481 userWeixinDTO.setMemberId(_memberDTO1.getId());
418 482
419 } 483 }
484
420 } else { 485 } else {
421 486
487 log.info("无其他账号存在");
422 MemberDTO memberDTO1 = memberAndWeixinUserDTO.getMemberDTO(); 488 MemberDTO memberDTO1 = memberAndWeixinUserDTO.getMemberDTO();
423 Member member = new Member(); 489 Member member = new Member();
424 BeanUtils.copyProperties(memberDTO1, member); 490 BeanUtils.copyProperties(memberDTO1, member);
425 member.setId(null); 491 member.setId(null);
492
493 log.info("为当前账号创建会员,会员信息 ==>> {}", member);
426 MemberDTO _memberDTO1 = this.memberService.create(member); 494 MemberDTO _memberDTO1 = this.memberService.create(member);
427 userWeixinDTO.setMemberId(_memberDTO1.getId()); 495 userWeixinDTO.setMemberId(_memberDTO1.getId());
428 496
429 } 497 }
430 498
499 log.info("开始创建微信账号");
431 this.createWeixin(userWeixinDTO); 500 this.createWeixin(userWeixinDTO);
432 501
433 } 502 }
...@@ -480,6 +549,7 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -480,6 +549,7 @@ public class UserOperationServiceImpl implements UserOperationService {
480 549
481 Member member = new Member(); 550 Member member = new Member();
482 BeanUtils.copyProperties(memberDTO, member); 551 BeanUtils.copyProperties(memberDTO, member);
552 log.info("会员入库结果 ==>> member ==>> {}", member);
483 return this.memberService.update(member); 553 return this.memberService.update(member);
484 } 554 }
485 555
...@@ -506,6 +576,8 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -506,6 +576,8 @@ public class UserOperationServiceImpl implements UserOperationService {
506 576
507 UserWeixin userWeixin = new UserWeixin(); 577 UserWeixin userWeixin = new UserWeixin();
508 BeanUtils.copyProperties(weixinDTO, userWeixin); 578 BeanUtils.copyProperties(weixinDTO, userWeixin);
579
580 log.info("账号入库结果 ==>> userWeixin ==>> {}", userWeixin);
509 this.userWeixinService.update(userWeixin); 581 this.userWeixinService.update(userWeixin);
510 } 582 }
511 583
...@@ -514,27 +586,4 @@ public class UserOperationServiceImpl implements UserOperationService { ...@@ -514,27 +586,4 @@ public class UserOperationServiceImpl implements UserOperationService {
514 BeanUtils.copyProperties(userTvDTO, userTv); 586 BeanUtils.copyProperties(userTvDTO, userTv);
515 this.userTvService.create(userTv); 587 this.userTvService.create(userTv);
516 } 588 }
517
518 private void updateUserTv(UserTvDTO _userTvDTO, UserTvDTO userTvDTO){
519 userTvDTO.setId(_userTvDTO.getId());
520
521 Long memberId = _userTvDTO.getMemberId();
522 if (Objects.isNull(memberId)){
523 String memberCode = userTvDTO.getMemberCode();
524 if (StringUtils.isNotBlank(memberCode)) {
525 MemberDTO memberDTO = this.memberService.findByCode(memberCode);
526 userTvDTO.setMemberId(memberDTO.getId());
527 }
528 } else {
529 userTvDTO.setMemberId(memberId);
530 }
531
532 userTvDTO.setPlatformAccount(_userTvDTO.getPlatformAccount());
533 userTvDTO.setCreateTime(_userTvDTO.getCreateTime());
534
535 UserTv userTv = new UserTv();
536 BeanUtils.copyProperties(userTvDTO, userTv);
537 log.info("updateUserTv ==>> userTv ==>> {}" , userTv);
538 this.userTvService.update(userTv);
539 }
540 } 589 }
......