Commit 8bb64b86 8bb64b863f65c85e70d19f77290fee70b41b7750 by xianghan

Merge remote-tracking branch 'remotes/origin/2.2.0-release'

# Conflicts:
#	src/main/java/com/topdraw/business/module/member/repository/MemberRepository.java
#	src/main/java/com/topdraw/business/module/member/service/MemberService.java
#	src/main/java/com/topdraw/business/module/member/service/impl/MemberServiceImpl.java
#	src/main/java/com/topdraw/business/process/service/impl/UserOperationServiceImpl.java
#	src/main/java/com/topdraw/business/process/service/impl/member/MemberOperationServiceImpl.java
#	src/main/java/com/topdraw/mq/consumer/UcEventBusIptv2ManagementUcEngine.java
#	src/main/java/com/topdraw/mq/consumer/UcGatewayIptv2IptvConsumer.java
#	src/main/java/com/topdraw/mq/consumer/WeiXinEventConsumer.java
#	src/main/java/com/topdraw/mq/domain/DataSyncMsg.java
#	src/main/java/com/topdraw/resttemplate/RestTemplateClient.java
#	src/main/resources/config/application-dev.yml
2 parents 77995e43 80f8168f
Showing 109 changed files with 3756 additions and 541 deletions
1 package com.topdraw.business;
2
3 /**
4 * @author :
5 * @description:
6 * @function :
7 * @date :Created in 2022/6/13 11:22
8 * @version: :
9 * @modified By:
10 * @since : modified in 2022/6/13 11:22
11 */
12 public interface ResponseStatus {
13
14 Integer OK = 00000;
15
16 }
...@@ -42,7 +42,8 @@ public class MemberBuilder { ...@@ -42,7 +42,8 @@ public class MemberBuilder {
42 member.setCouponAmount(DEFAULT_VALUE); 42 member.setCouponAmount(DEFAULT_VALUE);
43 member.setDueCouponAmount(DEFAULT_VALUE); 43 member.setDueCouponAmount(DEFAULT_VALUE);
44 member.setBlackStatus(DEFAULT_VALUE); 44 member.setBlackStatus(DEFAULT_VALUE);
45 member.setBirthday(StringUtils.isBlank(member.getBirthday())?"1900-01-01":member.getBirthday()); 45 // member.setBirthday(StringUtils.isBlank(member.getBirthday())?"1900-01-01":member.getBirthday());
46 member.setBirthday(null);
46 String nickname = member.getNickname(); 47 String nickname = member.getNickname();
47 if (StringUtils.isNotEmpty(nickname)) { 48 if (StringUtils.isNotEmpty(nickname)) {
48 // String base64Nickname = new String(Base64.getEncoder().encode(nickname.getBytes(StandardCharsets.UTF_8))); 49 // String base64Nickname = new String(Base64.getEncoder().encode(nickname.getBytes(StandardCharsets.UTF_8)));
......
1 package com.topdraw.business.module.member.domain;
2
3 /**
4 * @author :
5 * @description:
6 * @function :
7 * @date :Created in 2022/6/27 15:38
8 * @version: :
9 * @modified By:
10 * @since : modified in 2022/6/27 15:38
11 */
12 public interface MemberTypeConstant {
13
14 // 大屏
15 Integer vis = 1;
16 // 微信
17 Integer weixin = 2;
18 // app
19 Integer app = 3;
20 }
...@@ -10,6 +10,7 @@ import org.springframework.data.repository.query.Param; ...@@ -10,6 +10,7 @@ import org.springframework.data.repository.query.Param;
10 import java.time.LocalDateTime; 10 import java.time.LocalDateTime;
11 import java.util.List; 11 import java.util.List;
12 import java.util.Optional; 12 import java.util.Optional;
13 import java.util.Set;
13 14
14 /** 15 /**
15 * @author XiangHan 16 * @author XiangHan
...@@ -43,4 +44,26 @@ public interface MemberRepository extends JpaRepository<Member, Long>, JpaSpecif ...@@ -43,4 +44,26 @@ public interface MemberRepository extends JpaRepository<Member, Long>, JpaSpecif
43 " WHERE `id` = :#{#resources.id}", nativeQuery = true) 44 " WHERE `id` = :#{#resources.id}", nativeQuery = true)
44 void doUpdateMemberCoupon(@Param("resources") Member member); 45 void doUpdateMemberCoupon(@Param("resources") Member member);
45 46
47 @Modifying
48 @Query(value = "UPDATE `uc_member` SET `avatar_url` = :#{#resources.avatarUrl}, `update_time` = now() , " +
49 " `nickname`= :#{#resources.nickname}, " +
50 " `gender`=:#{#resources.gender} WHERE `id` = :#{#resources.id}", nativeQuery = true)
51 Integer updateMemberAvatarUrlAndNicknameAndGender(@Param("resources") Member resources);
52
53 @Modifying
54 @Query(value = "UPDATE `uc_member` SET `vip` = :#{#resources.vip}, " +
55 "`vip_expire_time` = :#{#resources.vipExpireTime} , `update_time`= now() " +
56 " WHERE `id` = :#{#resources.id}", nativeQuery = true)
57 Integer updateMemberVipAndVipExpireTime(@Param("resources") Member member);
58
59 @Modifying
60 @Query(value = "UPDATE `uc_member` SET `user_iptv_id` = :#{#resources.userIptvId}, " +
61 "`bind_iptv_platform_type` = :#{#resources.bindIptvPlatformType} , `bind_iptv_time` = :#{#resources.bindIptvTime} , " +
62 " `update_time`= now() " +
63 " WHERE `id` = :#{#resources.id}", nativeQuery = true)
64 Integer doUpdateMemberUserIptvIdAndBindPlatformTypeAndBingTime(@Param("resources") Member member);
65
66 @Modifying
67 @Query(value = "UPDATE `uc_member` SET `groups` = ?1, `update_time` = now() WHERE `code` IN ?2 ", nativeQuery = true)
68 Integer doUpdateGroupsBatch(String groups, Set<String> codes);
46 } 69 }
......
...@@ -12,7 +12,12 @@ import java.util.List; ...@@ -12,7 +12,12 @@ import java.util.List;
12 */ 12 */
13 public interface MemberService { 13 public interface MemberService {
14 14
15 15 /**
16 *
17 * @param member
18 * @return
19 */
20 MemberDTO doUpdateMemberVipAndVipExpireTime(Member member);
16 21
17 /** 22 /**
18 * 根据ID查询 23 * 根据ID查询
...@@ -36,30 +41,23 @@ public interface MemberService { ...@@ -36,30 +41,23 @@ public interface MemberService {
36 MemberDTO create(Member resources); 41 MemberDTO create(Member resources);
37 42
38 /** 43 /**
39 * 创建并返回会员
40 * @param resources 会员
41 * @return Member
42 */
43 MemberDTO createAndReturnMember(Member resources);
44
45 /**
46 * 修改会员 44 * 修改会员
47 * @param resources 45 * @param resources
48 */ 46 */
49 MemberDTO update(Member resources); 47 MemberDTO update(Member resources);
50 48
51 /** 49 /**
52 * 修改会员积分 50 *
53 * @param member 会员 51 * @param resources
52 * @return
54 */ 53 */
55 MemberDTO doUpdateMemberPoints(Member member); 54 MemberDTO doUpdateMemberAvatarUrlAndNicknameAndGender(Member resources);
56 55
57 /** 56 /**
58 * 查询绑定了大屏会员列表 57 * 修改会员积分
59 * @param id 条件参数 58 * @param resources 会员
60 * @return Map<String,Object>
61 */ 59 */
62 List<MemberDTO> findByUserIptvId(Long id); 60 MemberDTO doUpdateMemberPoints(Member resources);
63 61
64 /** 62 /**
65 * 检查会员信息 63 * 检查会员信息
...@@ -88,4 +86,8 @@ public interface MemberService { ...@@ -88,4 +86,8 @@ public interface MemberService {
88 void updateUserIptvIdById(Long id, Long userIptvId, LocalDateTime now); 86 void updateUserIptvIdById(Long id, Long userIptvId, LocalDateTime now);
89 87
90 void doUpdateMemberCoupon(Member member); 88 void doUpdateMemberCoupon(Member member);
89
90 Integer doUpdateMemberUserIptvIdAndBindPlatformTypeAndBingTime(Member member);
91
92 Integer asyncDoUpdateGroupsBatch(List<Member> resources);
91 } 93 }
......
...@@ -25,6 +25,8 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -25,6 +25,8 @@ import org.springframework.transaction.annotation.Transactional;
25 import java.time.LocalDateTime; 25 import java.time.LocalDateTime;
26 import java.util.List; 26 import java.util.List;
27 import java.util.Objects; 27 import java.util.Objects;
28 import java.util.Set;
29 import java.util.stream.Collectors;
28 30
29 /** 31 /**
30 * @author XiangHan 32 * @author XiangHan
...@@ -46,38 +48,30 @@ public class MemberServiceImpl implements MemberService { ...@@ -46,38 +48,30 @@ public class MemberServiceImpl implements MemberService {
46 48
47 49
48 @Override 50 @Override
49 public MemberDTO findById(Long id) { 51 @Transactional(rollbackFor = Exception.class)
50 Member member = this.memberRepository.findById(id).orElseGet(Member::new); 52 public MemberDTO doUpdateMemberVipAndVipExpireTime(Member resource) {
51 ValidationUtil.isNull(member.getId(),"Member","id",id); 53 log.info("修改会员vip和vip过期时间 ==>> {}", resource);
52 54
53 return this.memberMapper.toDto(member); 55 Integer count = this.memberRepository.updateMemberVipAndVipExpireTime(resource);
56 if (Objects.nonNull(count) && count > 0) {
57 Member member = this.memberRepository.findById(resource.getId()).orElseGet(Member::new);
58 return this.memberMapper.toDto(member);
59 }
54 60
61 return this.memberMapper.toDto(resource);
55 } 62 }
56 63
57 @Override 64 @Override
58 public MemberDTO findByCode(String code) { 65 public MemberDTO findById(Long id) {
59 66 Member member = this.memberRepository.findById(id).orElseGet(Member::new);
60 Member member = this.memberRepository.findFirstByCode(code).orElseGet(Member::new);
61
62 return this.memberMapper.toDto(member);
63 }
64
65 private MemberDTO findByIdOrCode(Long id, String code) {
66
67 Member member = this.memberRepository.findByIdOrCode(id,code).orElseGet(Member::new);
68 ValidationUtil.isNull(member.getId(),"Member","param",code);
69
70 return this.memberMapper.toDto(member); 67 return this.memberMapper.toDto(member);
71 68
72 } 69 }
73 70
74 @Override 71 @Override
75 public List<MemberDTO> findByUserIptvId(Long id) { 72 public MemberDTO findByCode(String code) {
76 73 Member member = this.memberRepository.findFirstByCode(code).orElseGet(Member::new);
77 List<Member> memberList = this.memberRepository.findByUserIptvId(id); 74 return this.memberMapper.toDto(member);
78
79 return this.memberMapper.toDto(memberList);
80
81 } 75 }
82 76
83 @Override 77 @Override
...@@ -151,16 +145,6 @@ public class MemberServiceImpl implements MemberService { ...@@ -151,16 +145,6 @@ public class MemberServiceImpl implements MemberService {
151 145
152 @Override 146 @Override
153 @Transactional(rollbackFor = Exception.class) 147 @Transactional(rollbackFor = Exception.class)
154 public MemberDTO createAndReturnMember(Member resources) {
155
156 MemberDTO memberDTO = this.create(MemberBuilder.build(resources));
157
158 return memberDTO;
159
160 }
161
162 @Override
163 @Transactional(rollbackFor = Exception.class)
164 public void unbind(Member resources) { 148 public void unbind(Member resources) {
165 try { 149 try {
166 String code = resources.getCode(); 150 String code = resources.getCode();
...@@ -194,6 +178,18 @@ public class MemberServiceImpl implements MemberService { ...@@ -194,6 +178,18 @@ public class MemberServiceImpl implements MemberService {
194 178
195 @Override 179 @Override
196 @Transactional(rollbackFor = Exception.class) 180 @Transactional(rollbackFor = Exception.class)
181 public Integer doUpdateMemberUserIptvIdAndBindPlatformTypeAndBingTime(Member member) {
182 return this.memberRepository.doUpdateMemberUserIptvIdAndBindPlatformTypeAndBingTime(member);
183 }
184
185 @Override
186 public Integer asyncDoUpdateGroupsBatch(List<Member> resources) {
187 Set<String> codes = resources.stream().map(t -> t.getCode()).collect(Collectors.toSet());
188 return this.memberRepository.doUpdateGroupsBatch( resources.get(0).getGroups(), codes);
189 }
190
191 @Override
192 @Transactional(rollbackFor = Exception.class)
197 public MemberDTO update(Member resources) { 193 public MemberDTO update(Member resources) {
198 194
199 log.info("MemberServiceImpl ==>> update ==>> resources ==>> [{}]" , resources); 195 log.info("MemberServiceImpl ==>> update ==>> resources ==>> [{}]" , resources);
...@@ -224,6 +220,17 @@ public class MemberServiceImpl implements MemberService { ...@@ -224,6 +220,17 @@ public class MemberServiceImpl implements MemberService {
224 220
225 } 221 }
226 222
223 @Override
224 @Transactional(rollbackFor = Exception.class)
225 public MemberDTO doUpdateMemberAvatarUrlAndNicknameAndGender(Member resources) {
226 Integer count = this.memberRepository.updateMemberAvatarUrlAndNicknameAndGender(resources);
227 if (Objects.nonNull(count) && count > 0) {
228 Member member = this.memberRepository.findById(resources.getId()).orElseGet(Member::new);
229 return this.memberMapper.toDto(member);
230 }
231 return this.memberMapper.toDto(resources);
232 }
233
227 public Member save(Member member){ 234 public Member save(Member member){
228 return this.memberRepository.save(member); 235 return this.memberRepository.save(member);
229 } 236 }
......
...@@ -17,6 +17,9 @@ public class MemberVipHistoryDTO implements Serializable { ...@@ -17,6 +17,9 @@ public class MemberVipHistoryDTO implements Serializable {
17 // 主键 17 // 主键
18 private Long id; 18 private Long id;
19 19
20 //
21 private String memberCode;
22
20 // 会员id 23 // 会员id
21 private Long memberId; 24 private Long memberId;
22 25
......
...@@ -5,7 +5,6 @@ import com.topdraw.business.module.points.available.repository.PointsAvailableRe ...@@ -5,7 +5,6 @@ import com.topdraw.business.module.points.available.repository.PointsAvailableRe
5 import com.topdraw.business.module.points.available.service.PointsAvailableService; 5 import com.topdraw.business.module.points.available.service.PointsAvailableService;
6 import com.topdraw.business.module.points.available.service.dto.PointsAvailableDTO; 6 import com.topdraw.business.module.points.available.service.dto.PointsAvailableDTO;
7 import com.topdraw.business.module.points.available.service.mapper.PointsAvailableMapper; 7 import com.topdraw.business.module.points.available.service.mapper.PointsAvailableMapper;
8 import com.topdraw.utils.RedisUtils;
9 import com.topdraw.utils.StringUtils; 8 import com.topdraw.utils.StringUtils;
10 import com.topdraw.utils.ValidationUtil; 9 import com.topdraw.utils.ValidationUtil;
11 import org.springframework.beans.factory.annotation.Autowired; 10 import org.springframework.beans.factory.annotation.Autowired;
...@@ -31,8 +30,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { ...@@ -31,8 +30,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService {
31 private PointsAvailableRepository pointsAvailableRepository; 30 private PointsAvailableRepository pointsAvailableRepository;
32 @Autowired 31 @Autowired
33 private PointsAvailableMapper pointsAvailableMapper; 32 private PointsAvailableMapper pointsAvailableMapper;
34 @Autowired
35 private RedisUtils redisUtils;
36 33
37 @Override 34 @Override
38 public List<PointsAvailableDTO> findByMemberIdOrderByExpireTime(Long memberId) { 35 public List<PointsAvailableDTO> findByMemberIdOrderByExpireTime(Long memberId) {
...@@ -50,16 +47,11 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { ...@@ -50,16 +47,11 @@ public class PointsAvailableServiceImpl implements PointsAvailableService {
50 @Transactional(rollbackFor = Exception.class) 47 @Transactional(rollbackFor = Exception.class)
51 public PointsAvailableDTO create(PointsAvailable resources) { 48 public PointsAvailableDTO create(PointsAvailable resources) {
52 try { 49 try {
53
54 this.redisUtils.doLock("PointsAvailable::create::id"+resources.getMemberId().toString());
55 PointsAvailable pointsAvailable = this.pointsAvailableRepository.save(resources); 50 PointsAvailable pointsAvailable = this.pointsAvailableRepository.save(resources);
56
57 return this.pointsAvailableMapper.toDto(pointsAvailable); 51 return this.pointsAvailableMapper.toDto(pointsAvailable);
58 } catch (Exception e) { 52 } catch (Exception e) {
59 e.printStackTrace(); 53 e.printStackTrace();
60 throw e; 54 throw e;
61 } finally {
62 this.redisUtils.doUnLock("PointsAvailable::create::id"+resources.getMemberId().toString());
63 } 55 }
64 } 56 }
65 57
...@@ -67,7 +59,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { ...@@ -67,7 +59,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService {
67 @Transactional(rollbackFor = Exception.class) 59 @Transactional(rollbackFor = Exception.class)
68 public PointsAvailableDTO update(PointsAvailable resources) { 60 public PointsAvailableDTO update(PointsAvailable resources) {
69 try { 61 try {
70 this.redisUtils.doLock("PointsAvailable::update::id"+resources.getMemberId().toString());
71 PointsAvailable pointsAvailable = this.pointsAvailableRepository.findById(resources.getId()).orElseGet(PointsAvailable::new); 62 PointsAvailable pointsAvailable = this.pointsAvailableRepository.findById(resources.getId()).orElseGet(PointsAvailable::new);
72 ValidationUtil.isNull(pointsAvailable.getId(),"PointsAvailable","id",resources.getId()); 63 ValidationUtil.isNull(pointsAvailable.getId(),"PointsAvailable","id",resources.getId());
73 pointsAvailable.copy(resources); 64 pointsAvailable.copy(resources);
...@@ -77,8 +68,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { ...@@ -77,8 +68,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService {
77 } catch (Exception e) { 68 } catch (Exception e) {
78 e.printStackTrace(); 69 e.printStackTrace();
79 throw e; 70 throw e;
80 } finally {
81 this.redisUtils.doUnLock("PointsAvailable::update::id"+resources.getMemberId().toString());
82 } 71 }
83 } 72 }
84 73
...@@ -86,7 +75,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { ...@@ -86,7 +75,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService {
86 @Transactional(rollbackFor = Exception.class) 75 @Transactional(rollbackFor = Exception.class)
87 public void delete(Long id) { 76 public void delete(Long id) {
88 Assert.notNull(id, "The given id must not be null!"); 77 Assert.notNull(id, "The given id must not be null!");
89 this.redisUtils.doLock("PointsAvailable::delete::id"+id);
90 try { 78 try {
91 PointsAvailable PointsAvailable = this.pointsAvailableRepository.findById(id).orElseThrow( 79 PointsAvailable PointsAvailable = this.pointsAvailableRepository.findById(id).orElseThrow(
92 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", com.topdraw.business.module.points.available.domain.PointsAvailable.class, id), 1)); 80 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", com.topdraw.business.module.points.available.domain.PointsAvailable.class, id), 1));
...@@ -94,22 +82,17 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { ...@@ -94,22 +82,17 @@ public class PointsAvailableServiceImpl implements PointsAvailableService {
94 } catch (Exception e) { 82 } catch (Exception e) {
95 e.printStackTrace(); 83 e.printStackTrace();
96 throw e; 84 throw e;
97 } finally {
98 this.redisUtils.doLock("PointsAvailable::delete::id"+id);
99 } 85 }
100 } 86 }
101 87
102 @Override 88 @Override
103 @Transactional(rollbackFor = Exception.class) 89 @Transactional(rollbackFor = Exception.class)
104 public void deleteBatchByIds(List<Long> id) { 90 public void deleteBatchByIds(List<Long> id) {
105 this.redisUtils.doLock("PointsAvailable::create::id"+id);
106 try { 91 try {
107 this.pointsAvailableRepository.deleteBatchByIds(id); 92 this.pointsAvailableRepository.deleteBatchByIds(id);
108 } catch (Exception e) { 93 } catch (Exception e) {
109 e.printStackTrace(); 94 e.printStackTrace();
110 throw e; 95 throw e;
111 } finally {
112 this.redisUtils.doUnLock("PointsAvailable::create::id"+id);
113 } 96 }
114 } 97 }
115 98
...@@ -146,7 +129,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { ...@@ -146,7 +129,6 @@ public class PointsAvailableServiceImpl implements PointsAvailableService {
146 @Override 129 @Override
147 public void delete4Custom(Long id) { 130 public void delete4Custom(Long id) {
148 Assert.notNull(id, "The given id must not be null!"); 131 Assert.notNull(id, "The given id must not be null!");
149 this.redisUtils.doLock("PointsAvailable::delete::id"+id);
150 try { 132 try {
151 PointsAvailable PointsAvailable = this.pointsAvailableRepository.findById(id).orElseThrow( 133 PointsAvailable PointsAvailable = this.pointsAvailableRepository.findById(id).orElseThrow(
152 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", com.topdraw.business.module.points.available.domain.PointsAvailable.class, id), 1)); 134 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", com.topdraw.business.module.points.available.domain.PointsAvailable.class, id), 1));
...@@ -154,22 +136,17 @@ public class PointsAvailableServiceImpl implements PointsAvailableService { ...@@ -154,22 +136,17 @@ public class PointsAvailableServiceImpl implements PointsAvailableService {
154 } catch (Exception e) { 136 } catch (Exception e) {
155 e.printStackTrace(); 137 e.printStackTrace();
156 throw e; 138 throw e;
157 } finally {
158 this.redisUtils.doUnLock("PointsAvailable::delete::id"+id);
159 } 139 }
160 } 140 }
161 141
162 @Override 142 @Override
163 public PointsAvailableDTO create4Custom(PointsAvailable resources) { 143 public PointsAvailableDTO create4Custom(PointsAvailable resources) {
164 this.redisUtils.doLock("PointsAvailable::create::id"+resources.getMemberId().toString());
165 try { 144 try {
166 PointsAvailable pointsAvailable = this.pointsAvailableRepository.save(resources); 145 PointsAvailable pointsAvailable = this.pointsAvailableRepository.save(resources);
167 return this.pointsAvailableMapper.toDto(pointsAvailable); 146 return this.pointsAvailableMapper.toDto(pointsAvailable);
168 } catch (Exception e) { 147 } catch (Exception e) {
169 e.printStackTrace(); 148 e.printStackTrace();
170 throw e; 149 throw e;
171 } finally {
172 this.redisUtils.doUnLock("PointsAvailable::create::id"+resources.getMemberId().toString());
173 } 150 }
174 } 151 }
175 152
......
...@@ -33,6 +33,10 @@ public class Task implements Serializable { ...@@ -33,6 +33,10 @@ public class Task implements Serializable {
33 @Column(name = "task_template_id", nullable = false) 33 @Column(name = "task_template_id", nullable = false)
34 private Long taskTemplateId; 34 private Long taskTemplateId;
35 35
36 /** 关联实体id */
37 @Column(name = "entity_id", nullable = false)
38 private String entityId;
39
36 @Transient 40 @Transient
37 private String taskTemplateCode; 41 private String taskTemplateCode;
38 42
......
...@@ -19,6 +19,9 @@ public class TaskDTO implements Serializable { ...@@ -19,6 +19,9 @@ public class TaskDTO implements Serializable {
19 /** 任务模板id */ 19 /** 任务模板id */
20 private Long taskTemplateId; 20 private Long taskTemplateId;
21 21
22 /** 关联实体id */
23 private String entityId;
24
22 /** 任务重复类型,-1:不限次;1:单次;>1:多次 */ 25 /** 任务重复类型,-1:不限次;1:单次;>1:多次 */
23 private Integer taskRepeatType; 26 private Integer taskRepeatType;
24 27
......
1 package com.topdraw.business.module.task.template.constant;
2
3 /**
4 * @author :
5 * @description:
6 * @function :
7 * @date :Created in 2022/6/18 14:30
8 * @version: :
9 * @modified By:
10 * @since : modified in 2022/6/18 14:30
11 */
12 public interface TaskEventName {
13 //类型 1:登录;2:观影;3:参加活动;4:订购;5:优享会员;6:签到;7:完成设置;
14 // 8:播放记录;10:跨屏绑定;11:积分转移;30:积分兑换商品;98:系统操作;99:其他
15 String LOGIN = "LOGIN";
16 String VIEW = "VIEW";
17 String ACTIVITY = "ACTIVITY";
18 String ORDER = "ORDER";
19 String MEMBER_PRIORITY = "MEMBER_PRIORITY";
20 String SIGN = "SIGN";
21 String COMPLETE_INFO = "COMPLETE_INFO";
22 String PLAY = "PLAY";
23 String BINDING = "BINDING";
24 String POINTS_TRANS = "POINTS_TRANS";
25 String POINTS_EXCHANGE_GOODS = "POINTS_EXCHANGE_GOODS";
26 String SYSTEM_OPERATE = "SYSTEM_OPERATE";
27 String OTHER = "OHHER";
28
29 }
1 package com.topdraw.business.module.task.template.constant;
2
3 /**
4 * @author :
5 * @description:
6 * @function :
7 * @date :Created in 2022/6/18 14:30
8 * @version: :
9 * @modified By:
10 * @since : modified in 2022/6/18 14:30
11 */
12 public interface TaskEventType {
13 //类型 1:登录;2:观影;3:参加活动;4:订购;5:优享会员;6:签到;7:完成设置;
14 // 8:播放记录;10:跨屏绑定;11:积分转移;30:积分兑换商品;98:系统操作;99:其他
15 int LOGIN = 1;
16 int VIEW = 2;
17 int ACTIVITY = 3;
18 int ORDER = 4;
19 int MEMBER_PRIORITY = 5;
20 int SIGN = 6;
21 int COMPLETE_INFO = 7;
22 int PLAY = 8;
23 int BINDING = 10;
24 int POINTS_TRANS = 11;
25 int POINTS_EXCHANGE_GOODS = 30;
26 int SYSTEM_OPERATE = 98;
27 int OHHER = 99;
28
29 }
1 package com.topdraw.business.module.user.app.domain;
2
3 import cn.hutool.core.bean.BeanUtil;
4 import cn.hutool.core.bean.copier.CopyOptions;
5 import lombok.Data;
6 import lombok.experimental.Accessors;
7 import org.springframework.data.annotation.CreatedDate;
8 import org.springframework.data.annotation.LastModifiedDate;
9 import org.springframework.data.jpa.domain.support.AuditingEntityListener;
10
11 import javax.persistence.*;
12 import java.io.Serializable;
13 import java.sql.Timestamp;
14
15 /**
16 * @author XiangHan
17 * @date 2022-06-27
18 */
19 @Entity
20 @Data
21 @EntityListeners(AuditingEntityListener.class)
22 @Accessors(chain = true)
23 @Table(name="uc_user_app")
24 public class UserApp implements Serializable {
25
26 // 第三方账号类型 3:微信;4:QQ;5:微博;6:苹果账号
27 @Transient
28 private Integer accountType;
29
30 // 第三方账号
31 @Transient
32 private String account;
33
34 // ID
35 @Id
36 @GeneratedValue(strategy = GenerationType.IDENTITY)
37 @Column(name = "id")
38 private Long id;
39
40 // 会员id
41 @Column(name = "member_id")
42 private Long memberId;
43
44 // 用户名(一般为手机号)
45 @Column(name = "username", nullable = false)
46 private String username;
47
48 // 密码
49 @Column(name = "password")
50 private String password;
51
52 // 类型 0:苹果;1:安卓;-1:未知
53 @Column(name = "type", nullable = false)
54 private Integer type;
55
56 // 状态 0:禁用;1:生效;-1:注销
57 @Column(name = "status", nullable = false)
58 private Integer status;
59
60 // 昵称
61 @Column(name = "nickname")
62 private String nickname;
63
64 // 头像地址
65 @Column(name = "headimgurl")
66 private String headimgurl;
67
68 // 邮箱
69 @Column(name = "email")
70 private String email;
71
72 // 手机号
73 @Column(name = "cellphone")
74 private String cellphone;
75
76 // 性别 0:女;1:男;-1:其他
77 @Column(name = "gender")
78 private Integer gender;
79
80 // 生日
81 @Column(name = "birthday")
82 private String birthday;
83
84 // 最近活跃时间
85 @Column(name = "last_active_time")
86 private Timestamp lastActiveTime;
87
88 // 注销时间
89 @Column(name = "delete_time")
90 private Timestamp deleteTime;
91
92 // 标签
93 @Column(name = "tags")
94 private String tags;
95
96 // 描述
97 @Column(name = "description")
98 private String description;
99
100 // 创建时间
101 @CreatedDate
102 @Column(name = "create_time")
103 private Timestamp createTime;
104
105 // 更新时间
106 @LastModifiedDate
107 @Column(name = "update_time")
108 private Timestamp updateTime;
109
110 public void copy(UserApp source){
111 BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
112 }
113 }
1 package com.topdraw.business.module.user.app.domain;
2
3 import cn.hutool.core.bean.BeanUtil;
4 import cn.hutool.core.bean.copier.CopyOptions;
5 import lombok.Data;
6 import lombok.experimental.Accessors;
7 import org.springframework.data.annotation.CreatedDate;
8 import org.springframework.data.annotation.LastModifiedDate;
9 import org.springframework.data.jpa.domain.support.AuditingEntityListener;
10
11 import javax.persistence.*;
12 import java.io.Serializable;
13 import java.sql.Timestamp;
14
15 /**
16 * @author XiangHan
17 * @date 2022-06-27
18 */
19 @Entity
20 @Data
21 @EntityListeners(AuditingEntityListener.class)
22 @Accessors(chain = true)
23 @Table(name="uc_user_app_bind")
24 public class UserAppBind implements Serializable {
25
26 @Transient
27 private String username;
28
29 @Transient
30 private String password;
31 @Transient
32 private String headImgUrl;
33
34 // 主键
35 @Id
36 @GeneratedValue(strategy = GenerationType.IDENTITY)
37 @Column(name = "id")
38 private Long id;
39
40 // 第三方账号类型 3:微信;4:QQ;5:微博;6:苹果账号
41 @Column(name = "account_type", nullable = false)
42 private Integer accountType;
43
44 // 第三方账号
45 @Column(name = "account", nullable = false)
46 private String account;
47
48 // app账号id
49 @Column(name = "user_app_id", nullable = false)
50 private Long userAppId;
51
52 // 绑定状态 0:解绑;1 绑定
53 @Column(name = "status", nullable = false)
54 private Integer status;
55
56 // 昵称
57 @Column(name = "nickname", nullable = false)
58 private String nickname;
59
60 // 创建时间
61 @CreatedDate
62 @Column(name = "create_time")
63 private Timestamp createTime;
64
65 // 更新时间
66 @LastModifiedDate
67 @Column(name = "update_time")
68 private Timestamp updateTime;
69
70 public void copy(UserAppBind source){
71 BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
72 }
73 }
1 package com.topdraw.business.module.user.app.domain;
2
3 /**
4 * @author :
5 * @description:
6 * @function :
7 * @date :Created in 2022/6/30 13:18
8 * @version: :
9 * @modified By:
10 * @since : modified in 2022/6/30 13:18
11 */
12 public class UserAppBindBuilder {
13
14 public static UserAppBind build(Long userAppId, String account, Integer accountType){
15 UserAppBind userAppBind = new UserAppBind();
16 userAppBind.setAccount(account);
17 userAppBind.setUserAppId(userAppId);
18 userAppBind.setAccountType(accountType);
19 userAppBind.setStatus(UserAppStatusConstant.VALID_STATUS);
20 return userAppBind;
21 }
22
23 }
1 package com.topdraw.business.module.user.app.domain;
2
3 /**
4 * @author :
5 * @description:
6 * @function :
7 * @date :Created in 2022/6/30 11:42
8 * @version: :
9 * @modified By:
10 * @since : modified in 2022/6/30 11:42
11 */
12 public interface UserAppBindStatusConstant {
13 // 绑定状态 0:解绑;1 绑定
14 Integer VALID_STATUS = 1;
15 Integer INVALID_STATUS = 0;
16
17 }
1 package com.topdraw.business.module.user.app.domain;
2
3 import com.topdraw.util.TimestampUtil;
4 import org.apache.commons.lang3.StringUtils;
5
6 import java.util.Objects;
7
8 /**
9 * @author :
10 * @description:
11 * @function :
12 * @date :Created in 2022/6/30 11:35
13 * @version: :
14 * @modified By:
15 * @since : modified in 2022/6/30 11:35
16 */
17 public class UserAppBuilder {
18
19
20
21 public static UserApp build(Long memberId, UserApp resource){
22
23 UserApp userApp = new UserApp();
24 userApp.setId(null);
25 userApp.setMemberId(memberId);
26 userApp.setUsername(resource.getUsername());
27 userApp.setTags(resource.getTags());
28 userApp.setLastActiveTime(TimestampUtil.now());
29 userApp.setEmail(resource.getEmail());
30 userApp.setType(Objects.isNull(resource.getType()) ? resource.getType() : -1);
31 userApp.setNickname(StringUtils.isNotBlank(resource.getNickname()) ? resource.getNickname() : resource.getUsername());
32 userApp.setHeadimgurl(resource.getHeadimgurl());
33 userApp.setPassword(resource.getPassword());
34 userApp.setCellphone(StringUtils.isNotBlank(resource.getCellphone()) ? resource.getCellphone() : resource.getUsername());
35 userApp.setBirthday(StringUtils.isNotBlank(resource.getBirthday()) ? resource.getBirthday() : "1900-01-01");
36 userApp.setGender(Objects.nonNull(resource.getGender()) ? resource.getGender() : 0);
37 userApp.setStatus(UserAppStatusConstant.VALID_STATUS);
38 userApp.setCreateTime(null);
39 userApp.setUpdateTime(null);
40 return userApp;
41 }
42
43
44 }
1 package com.topdraw.business.module.user.app.domain;
2
3 import cn.hutool.core.bean.BeanUtil;
4 import cn.hutool.core.bean.copier.CopyOptions;
5 import lombok.Data;
6 import lombok.experimental.Accessors;
7 import org.springframework.data.annotation.CreatedDate;
8 import org.springframework.data.annotation.LastModifiedDate;
9 import org.springframework.data.jpa.domain.support.AuditingEntityListener;
10
11 import javax.persistence.*;
12 import java.io.Serializable;
13 import java.sql.Timestamp;
14
15 /**
16 * @author XiangHan
17 * @date 2022-06-27
18 */
19 @Entity
20 @Data
21 @EntityListeners(AuditingEntityListener.class)
22 @Accessors(chain = true)
23 @Table(name="uc_user_app")
24 public class UserAppIdManual implements Serializable {
25
26 // 第三方账号类型 3:微信;4:QQ;5:微博;6:苹果账号
27 @Transient
28 private Integer accountType;
29
30 // 第三方账号
31 @Transient
32 private String account;
33
34 @Transient
35 private String memberCode;
36
37 // ID
38 @Id
39 @GeneratedValue(strategy = GenerationType.SEQUENCE)
40 @Column(name = "id")
41 private Long id;
42
43 // 会员id
44 @Column(name = "member_id")
45 private Long memberId;
46
47 // 用户名(一般为手机号)
48 @Column(name = "username", nullable = false)
49 private String username;
50
51 // 密码
52 @Column(name = "password")
53 private String password;
54
55 // 类型 0:苹果;1:安卓;-1:未知
56 @Column(name = "type", nullable = false)
57 private Integer type;
58
59 // 状态 0:禁用;1:生效;-1:注销
60 @Column(name = "status", nullable = false)
61 private Integer status;
62
63 // 昵称
64 @Column(name = "nickname")
65 private String nickname;
66
67 // 头像地址
68 @Column(name = "headimgurl")
69 private String headimgurl;
70
71 // 邮箱
72 @Column(name = "email")
73 private String email;
74
75 // 手机号
76 @Column(name = "cellphone")
77 private String cellphone;
78
79 // 性别 0:女;1:男;-1:其他
80 @Column(name = "gender")
81 private Integer gender;
82
83 // 生日
84 @Column(name = "birthday")
85 private String birthday;
86
87 // 最近活跃时间
88 @Column(name = "last_active_time")
89 private Timestamp lastActiveTime;
90
91 // 注销时间
92 @Column(name = "delete_time")
93 private Timestamp deleteTime;
94
95 // 标签
96 @Column(name = "tags")
97 private String tags;
98
99 // 描述
100 @Column(name = "description")
101 private String description;
102
103 // 创建时间
104 @CreatedDate
105 @Column(name = "create_time")
106 private Timestamp createTime;
107
108 // 更新时间
109 @LastModifiedDate
110 @Column(name = "update_time")
111 private Timestamp updateTime;
112
113 public void copy(UserAppIdManual source){
114 BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
115 }
116 }
1 package com.topdraw.business.module.user.app.domain;
2
3 import cn.hutool.core.bean.BeanUtil;
4 import cn.hutool.core.bean.copier.CopyOptions;
5 import lombok.Data;
6 import lombok.experimental.Accessors;
7 import org.springframework.data.jpa.domain.support.AuditingEntityListener;
8
9 import javax.persistence.*;
10 import java.io.Serializable;
11
12 /**
13 * @author XiangHan
14 * @date 2022-06-27
15 */
16 @Entity
17 @Data
18 @EntityListeners(AuditingEntityListener.class)
19 @Accessors(chain = true)
20 @Table(name="uc_user_app")
21 public class UserAppSimple implements Serializable {
22
23 // ID
24 @Id
25 @GeneratedValue(strategy = GenerationType.IDENTITY)
26 @Column(name = "id")
27 private Long id;
28
29 // 会员id
30 @Column(name = "member_id")
31 private Long memberId;
32
33 // 用户名(一般为手机号)
34 @Column(name = "username", nullable = false)
35 private String username;
36
37 // 状态 0:禁用;1:生效;-1:注销
38 @Column(name = "status", nullable = false)
39 private Integer status;
40
41 // 昵称
42 @Column(name = "nickname")
43 private String nickname;
44
45 // 头像地址
46 @Column(name = "headimgurl")
47 private String headimgurl;
48
49 // 邮箱
50 @Column(name = "email")
51 private String email;
52
53 // 手机号
54 @Column(name = "cellphone")
55 private String cellphone;
56
57 // 性别 0:女;1:男;-1:其他
58 @Column(name = "gender")
59 private Integer gender;
60
61 // 生日
62 @Column(name = "birthday")
63 private String birthday;
64
65 // 标签
66 @Column(name = "tags")
67 private String tags;
68
69 // 描述
70 @Column(name = "description")
71 private String description;
72
73 public void copy(UserAppSimple source){
74 BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
75 }
76 }
1 package com.topdraw.business.module.user.app.domain;
2
3 /**
4 * @author :
5 * @description:
6 * @function :
7 * @date :Created in 2022/6/30 11:42
8 * @version: :
9 * @modified By:
10 * @since : modified in 2022/6/30 11:42
11 */
12 public interface UserAppStatusConstant {
13 // 状态 0:禁用;1:生效;-1:注销
14 Integer VALID_STATUS = 1;
15 Integer FORBID_STATUS = 0;
16 Integer INVALID_STATUS = -1;
17
18 }
1 package com.topdraw.business.module.user.app.repository;
2
3 import com.topdraw.business.module.user.app.domain.UserAppBind;
4 import org.springframework.data.jpa.repository.JpaRepository;
5 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
6 import org.springframework.data.jpa.repository.Modifying;
7 import org.springframework.data.jpa.repository.Query;
8 import org.springframework.data.repository.query.Param;
9
10 import java.util.List;
11 import java.util.Optional;
12
13 /**
14 * @author XiangHan
15 * @date 2022-06-27
16 */
17 public interface UserAppBindRepository extends JpaRepository<UserAppBind, Long>, JpaSpecificationExecutor<UserAppBind> {
18
19 Optional<UserAppBind> findFirstByAccount(String account);
20
21 @Modifying
22 @Query(value = "UPDATE `uc_user_app_bind` SET `status` = 0 , `update_time` = now() WHERE `account` = ?1 AND `account_type` = ?2", nativeQuery = true)
23 Integer cancelUserAppBind(String account, Integer accountType);
24
25 Optional<UserAppBind> findFirstByAccountAndAccountType(String account, Integer accountType);
26
27 @Modifying
28 @Query(value = "UPDATE `uc_user_app_bind` SET `status` = :#{#resources.status}, `update_time` = now(), " +
29 " `user_app_id` = :#{#resources.userAppId}, `nickname` = :#{#resources.nickname} " +
30 " WHERE `account` = :#{#resources.account} AND accountType = :#{#resources.accountType}", nativeQuery = true)
31 Integer updateThirdAccount(@Param("resources") UserAppBind resources);
32
33 @Modifying
34 @Query(value = "UPDATE `uc_user_app_bind` SET `status` = :#{#resources.status}, `update_time` = now(), " +
35 " `user_app_id` = :#{#resources.userAppId} WHERE `account` = :#{#resources.account} AND accountType = :#{#resources.accountType}",
36 nativeQuery = true)
37 Integer updateThirdAccountStatusAndUserAppId(@Param("resources") UserAppBind resources);
38
39 @Modifying
40 @Query(value = "UPDATE `uc_user_app_bind` SET `status` = 1, `update_time` = now(), " +
41 " `user_app_id` = :#{#resources.userAppId} WHERE `account` = :#{#resources.account} AND accountType = :#{#resources.accountType}",
42 nativeQuery = true)
43 Integer updateValidStatusAndUserAppId(@Param("resources") UserAppBind resources);
44
45
46 @Modifying
47 @Query(value = "UPDATE `uc_user_app_bind` SET `update_time` = now(), `nickname` = :#{#resources.nickname} " +
48 " WHERE `account` = :#{#resources.account} AND `account_type` = :#{#resources.accountType}", nativeQuery = true)
49 Integer updateThirdAccountNickname(@Param("resources") UserAppBind resources);
50
51 @Modifying
52 @Query(value = "UPDATE `uc_user_app_bind` SET `update_time` = now(), `nickname` = :#{#resources.nickname}, `status` = 1, `user_app_id` = :#{#resources.userAppId} " +
53 " WHERE `account` = :#{#resources.account} AND `account_type` = :#{#resources.accountType}", nativeQuery = true)
54 Integer updateValidStatusAndUserAppIdAndNickname(@Param("resources") UserAppBind resources);
55
56 @Modifying
57 @Query(value = "UPDATE `uc_user_app_bind` SET `update_time` = now(), `status` = 0 WHERE `id` IN ?1", nativeQuery = true)
58 Integer appCancellation(List<Long> ids);
59
60 List<UserAppBind> findByUserAppId(Long id);
61 }
62
1 package com.topdraw.business.module.user.app.repository;
2
3 import com.topdraw.business.module.user.app.domain.UserApp;
4 import com.topdraw.business.module.user.app.domain.UserAppIdManual;
5 import org.springframework.data.jpa.repository.JpaRepository;
6 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
7 import org.springframework.data.jpa.repository.Modifying;
8 import org.springframework.data.jpa.repository.Query;
9 import org.springframework.data.repository.query.Param;
10
11 import java.util.Optional;
12
13 /**
14 * @author XiangHan
15 * @date 2022-06-27
16 */
17 public interface UserAppRepository extends JpaRepository<UserApp, Long>, JpaSpecificationExecutor<UserApp> {
18
19 @Query(value = "SELECT ua.* FROM uc_user_app ua WHERE ua.`username` = ?1 and ua.`status` IN (0 , 1)", nativeQuery = true)
20 Optional<UserApp> findByUsername(String username);
21
22 Optional<UserApp> findByUsernameAndPassword(String username, String password);
23
24 @Modifying
25 @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `last_active_time` = now() WHERE `username` = ?1 AND `status` = 1 ", nativeQuery = true)
26 Integer updateLastActiveTime(String username);
27
28 @Modifying
29 @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `password` = ?2 WHERE `username` = ?1 AND `status` = 1", nativeQuery = true)
30 Integer updatePasswordByUsername(String username, String password);
31
32 @Modifying
33 @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `nickname` = :#{#resources.nickname}, " +
34 " `headimgurl` = :#{#resources.headimgurl}, `email` = :#{#resources.email}, `cellphone` = :#{#resources.cellphone}, " +
35 " `gender` = :#{#resources.gender}, `birthday` = :#{#resources.birthday}, `tags` = :#{#resources.tags}, `description` = :#{#resources.description}" +
36 " WHERE `id` = :#{#resources.id}", nativeQuery = true)
37 Integer updateAppInfo(@Param("resources") UserApp resources);
38
39 @Modifying
40 @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(), `password` = ?2 WHERE `id` = ?1", nativeQuery = true)
41 Integer updatePasswordById(Long id, String password);
42
43 @Modifying
44 @Query(value = "UPDATE `uc_user_app` SET `update_time` = now(),`delete_time` = now(), `status` = -1 WHERE `id` = ?1", nativeQuery = true)
45 Integer appCancellation(Long id);
46
47 @Modifying
48 @Query(value = "UPDATE `uc_user_app` SET `last_active_time` = now(), `nickname` = ?2, `headimgurl` = ?3 " +
49 " WHERE `username` = ?1 and `status` = 1 ", nativeQuery = true)
50 Integer updateAppLastActiveTimeAndNicknameAndHeadImg(String username, String nickname, String headimgurl);
51
52 @Modifying
53 @Query(value = "INSERT INTO `uc_user_app`(`id`, `member_id`, `username`, `password`, `type`, `status`, `nickname`, `headimgurl`, `email`, `cellphone`, `gender`, `birthday`, `last_active_time`, `delete_time`, `tags`, `description`, `create_time`, `update_time`) " +
54 " VALUES (:#{#resources.id}, :#{#resources.memberId}, :#{#resources.username}, :#{#resources.password}, :#{#resources.type}," +
55 " 1, :#{#resources.nickname}, :#{#resources.headimgurl}, :#{#resources.email}, :#{#resources.cellphone}, " +
56 " :#{#resources.gender}, NULL, now(), NULL, :#{#resources.tags}, " +
57 " :#{#resources.description}, :#{#resources.createTime}, now());", nativeQuery = true)
58 void saveByIdManual(@Param("resources") UserAppIdManual userAppIdManual);
59
60 @Modifying
61 @Query(value = "UPDATE `uc_user_app` SET `username`= :#{#resources.username},`cellphone`= :#{#resources.cellphone}, `last_active_time` = now(), `nickname` = :#{#resources.nickname}, `headimgurl` = :#{#resources.headimgurl} " +
62 " WHERE `id` = :#{#resources.id} and `status` = 1 ", nativeQuery = true)
63 Integer updateAppLastActiveTimeAndNicknameAndHeadImgById(@Param("resources") UserApp userApp);
64 }
1 package com.topdraw.business.module.user.app.repository;
2
3 import com.topdraw.business.module.user.app.domain.UserAppSimple;
4 import org.springframework.data.jpa.repository.JpaRepository;
5 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
6
7 /**
8 * @author XiangHan
9 * @date 2022-06-27
10 */
11 public interface UserAppSimpleRepository extends JpaRepository<UserAppSimple, Long>, JpaSpecificationExecutor<UserAppSimple> {
12
13 }
1 package com.topdraw.business.module.user.app.service;
2
3 import com.topdraw.business.module.user.app.domain.UserAppBind;
4 import com.topdraw.business.module.user.app.service.dto.UserAppBindDTO;
5
6 import java.util.List;
7
8 /**
9 * @author XiangHan
10 * @date 2022-06-27
11 */
12 public interface UserAppBindService {
13
14 /**
15 * 根据ID查询
16 * @param id ID
17 * @return UserAppBindDTO
18 */
19 UserAppBindDTO findById(Long id);
20
21 /**
22 *
23 * @param resources
24 */
25 UserAppBindDTO create(UserAppBind resources);
26
27 /**
28 *
29 * @param resources
30 */
31 void update(UserAppBind resources);
32
33 /**
34 *
35 * @param id
36 */
37 void delete(Long id);
38
39 /**
40 *
41 * @param account
42 * @return
43 */
44 UserAppBindDTO findFirstByAccount(String account);
45
46 /**
47 *
48 * @param account
49 * @return
50 */
51 boolean cancelUserAppBind(String account, Integer accountType);
52
53 /**
54 *
55 * @param account
56 * @param accountType
57 * @return
58 */
59 UserAppBindDTO findFirstByAccountAndAccountType(String account, Integer accountType);
60
61 /**
62 *
63 * @param resources
64 * @return
65 */
66 boolean updateThirdAccount(UserAppBind resources);
67
68 /**
69 *
70 * @param resources
71 * @return
72 */
73 boolean updateThirdAccountNickname(UserAppBind resources);
74
75 /**
76 *
77 * @param resources
78 * @return
79 */
80 boolean updateValidStatusAndUserAppIdAndNickname(UserAppBind resources);
81
82 boolean appCancellation(List<Long> ids);
83
84 List<UserAppBindDTO> findByUserAppId(Long id);
85 }
1 package com.topdraw.business.module.user.app.service;
2
3 import com.topdraw.business.module.user.app.domain.UserApp;
4 import com.topdraw.business.module.user.app.domain.UserAppBind;
5 import com.topdraw.business.module.user.app.domain.UserAppIdManual;
6 import com.topdraw.business.module.user.app.service.dto.UserAppDTO;
7 import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO;
8 import com.topdraw.business.module.vis.hainan.apple.domain.VisUserApple;
9 import com.topdraw.business.module.vis.hainan.qq.domain.VisUserQq;
10 import com.topdraw.business.module.vis.hainan.weibo.domain.VisUserWeibo;
11 import com.topdraw.business.module.vis.hainan.weixin.domain.VisUserWeixin;
12
13 /**
14 * @author XiangHan
15 * @date 2022-06-27
16 */
17 public interface UserAppService {
18
19 /**
20 * 根据ID查询
21 * @param id ID
22 * @return UserAppDTO
23 */
24 UserAppDTO findById(Long id);
25
26 /**
27 * 检查账号和秘密
28 * @param username
29 * @return
30 */
31 UserAppDTO findByUsername(String username);
32
33
34 /**
35 *
36 * @param resources
37 */
38 UserAppDTO create(UserApp resources);
39
40 /**
41 *
42 * @param resources
43 */
44 UserAppDTO update(UserApp resources);
45
46 /**
47 *
48 * @param id
49 */
50 void delete(Long id);
51
52 /**
53 *
54 * @param resources
55 * @return
56 */
57 boolean updateLastActiveTime(UserAppBind resources);
58
59 /**
60 *
61 * @param resources
62 * @return
63 */
64 boolean updatePasswordByUsername(UserApp resources);
65
66 /**
67 *
68 * @param resources
69 * @return
70 */
71 boolean updatePasswordById(UserApp resources);
72
73 /**
74 *
75 * @param resources
76 * @return
77 */
78 boolean updateAppInfo(UserApp resources);
79
80 /**
81 *
82 * @param id
83 * @return
84 */
85 boolean appCancellation(Long id);
86
87 /**
88 *
89 * @param resources
90 * @return
91 */
92 boolean updateAppLastActiveTimeAndNicknameAndHeadImg(UserApp resources);
93
94 /**
95 *
96 * @param resources
97 * @return
98 */
99 boolean asyncSaveByIdManual(UserAppIdManual resources);
100
101
102 }
1 package com.topdraw.business.module.user.app.service.dto;
2
3 import com.topdraw.business.module.member.service.dto.MemberDTO;
4 import lombok.Data;
5
6 /**
7 * @author :
8 * @description:
9 * @function :
10 * @date :Created in 2022/7/11 21:21
11 * @version: :
12 * @modified By:
13 * @since : modified in 2022/7/11 21:21
14 */
15 @Data
16 public class AppRegisterDTO {
17
18 private UserAppDTO userAppDTO;
19
20 private MemberDTO memberDTO;
21
22 }
1 package com.topdraw.business.module.user.app.service.dto;
2
3 import lombok.Data;
4
5 import java.io.Serializable;
6 import java.sql.Timestamp;
7
8
9 /**
10 * @author XiangHan
11 * @date 2022-06-27
12 */
13 @Data
14 public class UserAppBindDTO implements Serializable {
15
16 // 主键
17 private Long id;
18
19 // 第三方账号类型 3:微信;4:QQ;5:微博;6:苹果账号
20 private Integer accountType;
21
22 // 第三方账号
23 private String account;
24
25 // app账号id
26 private Long userAppId;
27
28 // 绑定状态 0:解绑;1 绑定
29 private Integer status;
30
31 // 昵称
32 private String nickname;
33
34 // 创建时间
35 private Timestamp createTime;
36
37 // 更新时间
38 private Timestamp updateTime;
39 }
1 package com.topdraw.business.module.user.app.service.dto;
2
3 import lombok.Data;
4
5 import javax.persistence.Transient;
6 import java.io.Serializable;
7 import java.sql.Timestamp;
8
9
10 /**
11 * @author XiangHan
12 * @date 2022-06-27
13 */
14 @Data
15 public class UserAppDTO implements Serializable {
16
17 // 第三方账号类型 3:微信;4:QQ;5:微博;6:苹果账号
18 private Integer accountType;
19
20 // 第三方账号
21 private String account;
22
23 // ID
24 private Long id;
25
26 // 会员id
27 private Long memberId;
28
29 // 用户名(一般为手机号)
30 private String username;
31
32 // 密码
33 private String password;
34
35 // 类型 0:苹果;1:安卓;-1:未知
36 private Integer type;
37
38 // 状态 0:禁用;1:生效;-1:注销
39 private Integer status;
40
41 // 昵称
42 private String nickname;
43
44 // 头像地址
45 private String headimgurl;
46
47 // 邮箱
48 private String email;
49
50 // 手机号
51 private String cellphone;
52
53 // 性别 0:女;1:男;-1:其他
54 private Integer gender;
55
56 // 生日
57 private String birthday;
58
59 // 最近活跃时间
60 private Timestamp lastActiveTime;
61
62 // 注销时间
63 private Timestamp deleteTime;
64
65 // 标签
66 private String tags;
67
68 // 描述
69 private String description;
70
71 // 创建时间
72 private Timestamp createTime;
73
74 // 更新时间
75 private Timestamp updateTime;
76 }
1 package com.topdraw.business.module.user.app.service.dto;
2
3 import lombok.Data;
4
5 import java.io.Serializable;
6
7 /**
8 * @author XiangHan
9 * @date 2022-06-27
10 */
11 @Data
12 public class UserAppSimpleDTO implements Serializable {
13
14 // ID
15 private Long id;
16
17 // 会员id
18 private Long memberId;
19
20 // 用户名(一般为手机号)
21 private String username;
22
23 // 状态 0:禁用;1:生效;-1:注销
24 private Integer status;
25
26 // 昵称
27 private String nickname;
28
29 // 头像地址
30 private String headimgurl;
31
32 // 邮箱
33 private String email;
34
35 // 手机号
36 private String cellphone;
37
38 // 性别 0:女;1:男;-1:其他
39 private Integer gender;
40
41 // 生日
42 private String birthday;
43
44 // 标签
45 private String tags;
46
47 // 描述
48 private String description;
49
50 }
1 package com.topdraw.business.module.user.app.service.impl;
2
3 import com.topdraw.business.module.user.app.domain.UserAppBind;
4 import com.topdraw.business.module.user.app.repository.UserAppBindRepository;
5 import com.topdraw.business.module.user.app.service.UserAppBindService;
6 import com.topdraw.business.module.user.app.service.dto.UserAppBindDTO;
7 import com.topdraw.business.module.user.app.service.mapper.UserAppBindMapper;
8 import com.topdraw.utils.ValidationUtil;
9 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.dao.EmptyResultDataAccessException;
11 import org.springframework.stereotype.Service;
12 import org.springframework.transaction.annotation.Propagation;
13 import org.springframework.transaction.annotation.Transactional;
14 import org.springframework.util.Assert;
15
16 import java.util.List;
17
18 /**
19 * @author XiangHan
20 * @date 2022-06-27
21 */
22 @Service
23 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
24 public class UserAppBindServiceImpl implements UserAppBindService {
25
26 @Autowired
27 private UserAppBindRepository userAppBindRepository;
28
29 @Autowired
30 private UserAppBindMapper userAppBindMapper;
31
32 @Override
33 public UserAppBindDTO findById(Long id) {
34 UserAppBind userAppBind = this.userAppBindRepository.findById(id).orElseGet(UserAppBind::new);
35 ValidationUtil.isNull(userAppBind.getId(),"UserAppBind","id",id);
36 return this.userAppBindMapper.toDto(userAppBind);
37 }
38
39 @Override
40 @Transactional(rollbackFor = Exception.class)
41 public UserAppBindDTO create(UserAppBind resources) {
42 UserAppBind userAppBind = this.userAppBindRepository.save(resources);
43 return this.userAppBindMapper.toDto(userAppBind);
44 }
45
46 @Override
47 @Transactional(rollbackFor = Exception.class)
48 public void update(UserAppBind resources) {
49 UserAppBind userAppBind = this.userAppBindRepository.findById(resources.getId()).orElseGet(UserAppBind::new);
50 ValidationUtil.isNull( userAppBind.getId(),"UserAppBind","id",resources.getId());
51 userAppBind.copy(resources);
52 this.userAppBindRepository.save(userAppBind);
53 }
54
55 @Override
56 @Transactional(rollbackFor = Exception.class)
57 public void delete(Long id) {
58 Assert.notNull(id, "The given id must not be null!");
59 UserAppBind UserAppBind = this.userAppBindRepository.findById(id).orElseThrow(
60 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", com.topdraw.business.module.user.app.domain.UserAppBind.class, id), 1));
61 this.userAppBindRepository.delete(UserAppBind);
62 }
63
64 @Override
65 public UserAppBindDTO findFirstByAccount(String account) {
66 UserAppBind userAppBind = this.userAppBindRepository.findFirstByAccount(account).orElseGet(UserAppBind::new);
67 return this.userAppBindMapper.toDto(userAppBind);
68 }
69
70 @Override
71 @Transactional(rollbackFor = Exception.class)
72 public boolean cancelUserAppBind(String account, Integer accountType) {
73 return this.userAppBindRepository.cancelUserAppBind(account, accountType) > 0;
74 }
75
76 @Override
77 @Transactional(readOnly = true)
78 public UserAppBindDTO findFirstByAccountAndAccountType(String account, Integer accountType) {
79 UserAppBind userAppBind = this.userAppBindRepository.findFirstByAccountAndAccountType(account, accountType).orElseGet(UserAppBind::new);
80 return this.userAppBindMapper.toDto(userAppBind);
81 }
82
83 @Override
84 @Transactional(rollbackFor = Exception.class)
85 public boolean updateThirdAccount(UserAppBind resources) {
86 return this.userAppBindRepository.updateThirdAccount(resources) > 0;
87 }
88
89 @Override
90 @Transactional(rollbackFor = Exception.class)
91 public boolean updateThirdAccountNickname(UserAppBind resources) {
92 return this.userAppBindRepository.updateThirdAccountNickname(resources) > 0;
93 }
94
95 @Override
96 @Transactional(rollbackFor = Exception.class)
97 public boolean updateValidStatusAndUserAppIdAndNickname(UserAppBind resources) {
98 return this.userAppBindRepository.updateValidStatusAndUserAppIdAndNickname(resources) > 0;
99 }
100
101 @Override
102 @Transactional(rollbackFor = Exception.class)
103 public boolean appCancellation(List<Long> ids) {
104 return this.userAppBindRepository.appCancellation(ids) > 0;
105 }
106
107 @Override
108 @Transactional(readOnly = true)
109 public List<UserAppBindDTO> findByUserAppId(Long id) {
110 List<UserAppBind> userAppBinds = this.userAppBindRepository.findByUserAppId(id);
111 return this.userAppBindMapper.toDto(userAppBinds);
112 }
113
114
115 }
1 package com.topdraw.business.module.user.app.service.impl;
2
3 import com.topdraw.business.module.member.domain.Member;
4 import com.topdraw.business.module.member.domain.MemberBuilder;
5 import com.topdraw.business.module.member.domain.MemberTypeConstant;
6 import com.topdraw.business.module.member.service.MemberService;
7 import com.topdraw.business.module.member.service.dto.MemberDTO;
8 import com.topdraw.business.module.user.app.domain.UserApp;
9 import com.topdraw.business.module.user.app.domain.UserAppBind;
10 import com.topdraw.business.module.user.app.domain.UserAppIdManual;
11 import com.topdraw.business.module.user.app.repository.UserAppRepository;
12 import com.topdraw.business.module.user.app.repository.UserAppSimpleRepository;
13 import com.topdraw.business.module.user.app.service.UserAppService;
14 import com.topdraw.business.module.user.app.service.dto.UserAppDTO;
15 import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO;
16 import com.topdraw.business.module.user.app.service.mapper.UserAppMapper;
17 import com.topdraw.business.module.vis.hainan.apple.domain.VisUserApple;
18 import com.topdraw.business.module.vis.hainan.qq.domain.VisUserQq;
19 import com.topdraw.business.module.vis.hainan.weibo.domain.VisUserWeibo;
20 import com.topdraw.business.module.vis.hainan.weixin.domain.VisUserWeixin;
21 import com.topdraw.utils.ValidationUtil;
22 import lombok.extern.slf4j.Slf4j;
23 import org.springframework.beans.factory.annotation.Autowired;
24 import org.springframework.dao.EmptyResultDataAccessException;
25 import org.springframework.stereotype.Service;
26 import org.springframework.transaction.annotation.Propagation;
27 import org.springframework.transaction.annotation.Transactional;
28 import org.springframework.util.Assert;
29
30 import java.util.Objects;
31
32 /**
33 * @author XiangHan
34 * @date 2022-06-27
35 */
36 @Service
37 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
38 @Slf4j
39 public class UserAppServiceImpl implements UserAppService {
40
41 @Autowired
42 private UserAppRepository userAppRepository;
43 @Autowired
44 private UserAppSimpleRepository userAppSimpleRepository;
45 @Autowired
46 private UserAppMapper userAppMapper;
47 @Autowired
48 private MemberService memberService;
49
50
51 @Override
52 @Transactional(readOnly = true)
53 public UserAppDTO findById(Long id) {
54 UserApp userApp = this.userAppRepository.findById(id).orElseGet(UserApp::new);
55 ValidationUtil.isNull(userApp.getId(),"UserApp","id",id);
56 return this.userAppMapper.toDto(userApp);
57 }
58
59 @Override
60 @Transactional(readOnly = true)
61 public UserAppDTO findByUsername(String username) {
62 UserApp userApp = this.userAppRepository.findByUsername(username).orElseGet(UserApp::new);
63 return this.userAppMapper.toDto(userApp);
64 }
65
66 @Override
67 @Transactional(rollbackFor = Exception.class)
68 public UserAppDTO create(UserApp resources) {
69 UserApp userApp = this.userAppRepository.save(resources);
70 return this.userAppMapper.toDto(userApp);
71 }
72
73 @Override
74 @Transactional(rollbackFor = Exception.class)
75 public UserAppDTO update(UserApp resources) {
76 UserApp userApp = this.userAppRepository.findById(resources.getId()).orElseGet(UserApp::new);
77 ValidationUtil.isNull( userApp.getId(),"UserApp","id",resources.getId());
78 userApp.copy(resources);
79 UserApp _userApp = this.userAppRepository.save(userApp);
80 if (Objects.nonNull(_userApp.getId())) {
81 return this.userAppMapper.toDto(_userApp);
82 }
83
84 return this.userAppMapper.toDto(resources);
85 }
86
87 @Override
88 @Transactional(rollbackFor = Exception.class)
89 public void delete(Long id) {
90 Assert.notNull(id, "The given id must not be null!");
91 UserApp UserApp = this.userAppRepository.findById(id).orElseThrow(
92 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", UserApp.class, id), 1));
93 this.userAppRepository.delete(UserApp);
94 }
95
96 @Override
97 @Transactional(rollbackFor = Exception.class)
98 public boolean updateLastActiveTime(UserAppBind resources) {
99 return this.userAppRepository.updateLastActiveTime(resources.getUsername()) > 0;
100 }
101
102 @Override
103 @Transactional(rollbackFor = Exception.class)
104 public boolean updatePasswordByUsername(UserApp resources) {
105 return this.userAppRepository.updatePasswordByUsername(resources.getUsername(), resources.getPassword()) > 0;
106 }
107
108 @Override
109 @Transactional(rollbackFor = Exception.class)
110 public boolean updateAppInfo(UserApp resources) {
111
112 Long id = resources.getId();
113 UserApp userApp = this.userAppRepository.findById(id).orElseGet(UserApp::new);
114 if (Objects.isNull(userApp.getId())) {
115 log.error("修改app信息失败,app账号信息不存在[updateAppInfo#]");
116 return false;
117 }
118
119 userApp.copy(resources);
120
121 this.userAppRepository.updateAppInfo(userApp);
122
123 return true;
124 }
125
126 @Override
127 @Transactional(rollbackFor = Exception.class)
128 public boolean appCancellation(Long id) {
129 return this.userAppRepository.appCancellation(id) > 0;
130 }
131
132 @Override
133 @Transactional(rollbackFor = Exception.class)
134 public boolean updateAppLastActiveTimeAndNicknameAndHeadImg(UserApp resources) {
135 return this.userAppRepository.updateAppLastActiveTimeAndNicknameAndHeadImg(resources.getUsername(),
136 resources.getNickname(), resources.getHeadimgurl()) > 0;
137 }
138
139 @Transactional(rollbackFor = Exception.class)
140 public void asyncUpdateAppLastActiveTimeAndNicknameAndHeadImgById(UserApp resources) {
141 this.userAppRepository.updateAppLastActiveTimeAndNicknameAndHeadImgById(resources);
142 }
143
144 @Override
145 @Transactional(rollbackFor = Exception.class)
146 public boolean asyncSaveByIdManual(UserAppIdManual resources) {
147 String memberCode = resources.getMemberCode();
148
149 Member member = new Member();
150 member.setVip(0);
151 member.setType(MemberTypeConstant.app);
152 member.setCode(memberCode);
153 member.setNickname(resources.getNickname());
154 member.setAvatarUrl(resources.getHeadimgurl());
155 Member _member = MemberBuilder.build(member);
156 MemberDTO memberDTO = memberService.create(_member);
157
158 resources.setMemberId(memberDTO.getId());
159
160 this.userAppRepository.saveByIdManual(resources);
161 return true;
162 }
163
164 @Override
165 @Transactional(rollbackFor = Exception.class)
166 public boolean updatePasswordById(UserApp resources) {
167 return this.userAppRepository.updatePasswordById(resources.getId(), resources.getPassword()) > 0;
168 }
169
170
171 }
1 package com.topdraw.business.module.user.app.service.mapper;
2
3 import com.topdraw.base.BaseMapper;
4 import com.topdraw.business.module.user.app.domain.UserAppBind;
5 import com.topdraw.business.module.user.app.service.dto.UserAppBindDTO;
6 import org.mapstruct.Mapper;
7 import org.mapstruct.ReportingPolicy;
8
9 /**
10 * @author XiangHan
11 * @date 2022-06-27
12 */
13 @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
14 public interface UserAppBindMapper extends BaseMapper<UserAppBindDTO, UserAppBind> {
15
16 }
1 package com.topdraw.business.module.user.app.service.mapper;
2
3 import com.topdraw.base.BaseMapper;
4 import com.topdraw.business.module.user.app.domain.UserApp;
5 import com.topdraw.business.module.user.app.service.dto.UserAppDTO;
6 import org.mapstruct.Mapper;
7 import org.mapstruct.ReportingPolicy;
8
9 /**
10 * @author XiangHan
11 * @date 2022-06-27
12 */
13 @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
14 public interface UserAppMapper extends BaseMapper<UserAppDTO, UserApp> {
15
16 }
1 package com.topdraw.business.module.user.app.service.mapper;
2
3 import com.topdraw.base.BaseMapper;
4 import com.topdraw.business.module.user.app.domain.UserAppSimple;
5 import com.topdraw.business.module.user.app.service.dto.UserAppSimpleDTO;
6 import org.mapstruct.Mapper;
7 import org.mapstruct.ReportingPolicy;
8
9 /**
10 * @author XiangHan
11 * @date 2022-06-27
12 */
13 @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
14 public interface UserAppSimpleMapper extends BaseMapper<UserAppSimpleDTO, UserAppSimple> {
15
16 }
1 package com.topdraw.business.module.user.iptv.growreport.domain;
2
3 import cn.hutool.core.bean.BeanUtil;
4 import cn.hutool.core.bean.copier.CopyOptions;
5 import lombok.Data;
6 import lombok.experimental.Accessors;
7 import org.springframework.data.annotation.CreatedDate;
8 import org.springframework.data.annotation.LastModifiedDate;
9 import org.springframework.data.jpa.domain.support.AuditingEntityListener;
10
11 import javax.persistence.*;
12 import java.io.Serializable;
13 import java.sql.Timestamp;
14
15 /**
16 * @author XiangHan
17 * @date 2022-07-07
18 */
19 @Entity
20 @Data
21 @EntityListeners(AuditingEntityListener.class)
22 @Accessors(chain = true)
23 @Table(name="uc_growth_report")
24 public class GrowthReport implements Serializable {
25
26 @Id
27 @Column(name = "id")
28 private Long id;
29
30 // 用户id
31 @Column(name = "user_id")
32 private Long userId;
33
34 // 会员id
35 @Column(name = "member_id")
36 private Long memberId;
37
38 // 会员code
39 @Column(name = "member_code")
40 private String memberCode;
41
42 // 大屏账号
43 @Column(name = "platform_account")
44 private String platformAccount;
45
46 // 开始日期
47 @Column(name = "start_date")
48 private String startDate;
49
50 // 结束时间
51 @Column(name = "end_date")
52 private String endDate;
53
54 // 栏目播放时长数据
55 @Column(name = "data")
56 private String data;
57
58 // 创建时间
59 @CreatedDate
60 @Column(name = "create_time")
61 private Timestamp createTime;
62
63 // 修改时间
64 @LastModifiedDate
65 @Column(name = "update_time")
66 private Timestamp updateTime;
67
68 public void copy(GrowthReport source){
69 BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
70 }
71 }
1 package com.topdraw.business.module.user.iptv.growreport.repository;
2
3 import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport;
4 import org.springframework.data.jpa.repository.JpaRepository;
5 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
6 import org.springframework.data.jpa.repository.Modifying;
7 import org.springframework.data.jpa.repository.Query;
8
9 import java.util.Optional;
10
11 /**
12 * @author XiangHan
13 * @date 2022-07-07
14 */
15 public interface GrowthReportRepository extends JpaRepository<GrowthReport, Long>, JpaSpecificationExecutor<GrowthReport> {
16
17 Optional<GrowthReport> findByPlatformAccountAndStartDateAndEndDate(String platformAccount, String startDate, String endDate);
18
19 @Modifying
20 @Query(value = "UPDATE `uc_growth_report` SET `data` = ?2, `update_time` = now() WHERE `id` =?1", nativeQuery = true)
21 Integer updateGrowthReportData(Long id, String data);
22 }
1 package com.topdraw.business.module.user.iptv.growreport.service;
2
3 import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport;
4 import com.topdraw.business.module.user.iptv.growreport.service.dto.GrowthReportDTO;
5
6 /**
7 * @author XiangHan
8 * @date 2022-07-07
9 */
10 public interface GrowthReportService {
11
12 /**
13 * 根据ID查询
14 * @param id ID
15 * @return GrowthReportDTO
16 */
17 GrowthReportDTO findById(Long id);
18
19 void create(GrowthReport resources);
20
21 void update(GrowthReport resources);
22
23 void delete(Long id);
24
25 GrowthReportDTO findByPlatformAccountAndStartDateAndEndDate(String platformAccount, String weekFirstDay, String weekLastDay);
26
27 Integer updateGrowthReportData(Long id, String data);
28 }
1 package com.topdraw.business.module.user.iptv.growreport.service.dto;
2
3 import com.fasterxml.jackson.databind.annotation.JsonSerialize;
4 import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
5 import lombok.Data;
6
7 import java.io.Serializable;
8 import java.sql.Timestamp;
9
10
11 /**
12 * @author XiangHan
13 * @date 2022-07-07
14 */
15 @Data
16 public class GrowthReportDTO implements Serializable {
17
18 // 处理精度丢失问题
19 @JsonSerialize(using= ToStringSerializer.class)
20 private Long id;
21
22 // 用户id
23 private Long userId;
24
25 // 会员id
26 private Long memberId;
27
28 // 会员code
29 private String memberCode;
30
31 // 大屏账号
32 private String platformAccount;
33
34 // 开始日期
35 private String startDate;
36
37 // 结束时间
38 private String endDate;
39
40 // 栏目播放时长数据
41 private String data;
42
43 // 创建时间
44 private Timestamp createTime;
45
46 // 修改时间
47 private Timestamp updateTime;
48 }
1 package com.topdraw.business.module.user.iptv.growreport.service.impl;
2
3 import cn.hutool.core.lang.Snowflake;
4 import cn.hutool.core.util.IdUtil;
5 import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport;
6 import com.topdraw.business.module.user.iptv.growreport.repository.GrowthReportRepository;
7 import com.topdraw.business.module.user.iptv.growreport.service.GrowthReportService;
8 import com.topdraw.business.module.user.iptv.growreport.service.dto.GrowthReportDTO;
9 import com.topdraw.business.module.user.iptv.growreport.service.mapper.GrowthReportMapper;
10 import com.topdraw.utils.ValidationUtil;
11 import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.dao.EmptyResultDataAccessException;
13 import org.springframework.stereotype.Service;
14 import org.springframework.transaction.annotation.Propagation;
15 import org.springframework.transaction.annotation.Transactional;
16 import org.springframework.util.Assert;
17
18 /**
19 * @author XiangHan
20 * @date 2022-07-07
21 */
22 @Service
23 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
24 public class GrowthReportServiceImpl implements GrowthReportService {
25
26 @Autowired
27 private GrowthReportRepository growthReportRepository;
28
29 @Autowired
30 private GrowthReportMapper growthReportMapper;
31
32 @Override
33 public GrowthReportDTO findById(Long id) {
34 GrowthReport growthReport = this.growthReportRepository.findById(id).orElseGet(GrowthReport::new);
35 ValidationUtil.isNull(growthReport.getId(),"GrowthReport","id",id);
36 return this.growthReportMapper.toDto(growthReport);
37 }
38
39 @Override
40 @Transactional(rollbackFor = Exception.class)
41 public void create(GrowthReport resources) {
42 Snowflake snowflake = IdUtil.createSnowflake(1, 1);
43 resources.setId(snowflake.nextId());
44 this.growthReportRepository.save(resources);
45 }
46
47 @Override
48 @Transactional(rollbackFor = Exception.class)
49 public void update(GrowthReport resources) {
50 GrowthReport growthReport = this.growthReportRepository.findById(resources.getId()).orElseGet(GrowthReport::new);
51 ValidationUtil.isNull( growthReport.getId(),"GrowthReport","id",resources.getId());
52 growthReport.copy(resources);
53 this.growthReportRepository.save(growthReport);
54 }
55
56 @Override
57 @Transactional(rollbackFor = Exception.class)
58 public void delete(Long id) {
59 Assert.notNull(id, "The given id must not be null!");
60 GrowthReport growthReport = this.growthReportRepository.findById(id).orElseThrow(
61 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", GrowthReport.class, id), 1));
62 this.growthReportRepository.delete(growthReport);
63 }
64
65 @Override
66 public GrowthReportDTO findByPlatformAccountAndStartDateAndEndDate(String platformAccount, String weekFirstDay, String weekLastDay) {
67 GrowthReport growthReport = this.growthReportRepository.findByPlatformAccountAndStartDateAndEndDate(platformAccount, weekFirstDay, weekLastDay).orElseGet(GrowthReport::new);
68 return this.growthReportMapper.toDto(growthReport);
69 }
70
71 @Override
72 @Transactional(rollbackFor = Exception.class)
73 public Integer updateGrowthReportData(Long id, String data) {
74 return this.growthReportRepository.updateGrowthReportData(id, data);
75 }
76
77
78 }
1 package com.topdraw.business.module.user.iptv.growreport.service.mapper;
2
3 import com.topdraw.base.BaseMapper;
4 import com.topdraw.business.module.user.iptv.growreport.domain.GrowthReport;
5 import com.topdraw.business.module.user.iptv.growreport.service.dto.GrowthReportDTO;
6 import org.mapstruct.Mapper;
7 import org.mapstruct.ReportingPolicy;
8
9 /**
10 * @author XiangHan
11 * @date 2022-07-07
12 */
13 @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
14 public interface GrowthReportMapper extends BaseMapper<GrowthReportDTO, GrowthReport> {
15
16 }
...@@ -3,7 +3,11 @@ package com.topdraw.business.module.user.iptv.repository; ...@@ -3,7 +3,11 @@ package com.topdraw.business.module.user.iptv.repository;
3 import com.topdraw.business.module.user.iptv.domain.UserTv; 3 import com.topdraw.business.module.user.iptv.domain.UserTv;
4 import org.springframework.data.jpa.repository.JpaRepository; 4 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;
7 import org.springframework.data.jpa.repository.Query;
8 import org.springframework.data.repository.query.Param;
6 9
10 import java.time.LocalDateTime;
7 import java.util.Optional; 11 import java.util.Optional;
8 12
9 /** 13 /**
...@@ -18,4 +22,45 @@ public interface UserTvRepository extends JpaRepository<UserTv, Long>, JpaSpecif ...@@ -18,4 +22,45 @@ public interface UserTvRepository extends JpaRepository<UserTv, Long>, JpaSpecif
18 22
19 Optional<UserTv> findByMemberId(Long memberId); 23 Optional<UserTv> findByMemberId(Long memberId);
20 24
25 @Modifying
26 @Query(value = "UPDATE `uc_user_tv` SET `vis_user_id` = ?2, `update_time` = ?3 WHERE `id` = ?1", nativeQuery = true)
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);
59
60 Long countByPlatformAccount(String platformAccount);
61
62 @Modifying
63 @Query(value = "UPDATE `uc_user_tv` SET `priority_member_code` = :#{#resources.priorityMemberCode}, " +
64 "`update_time` = now() WHERE `platform_account` = :#{#resources.platformAccount}", nativeQuery = true)
65 void updatePriorityMemberCode(@Param("resources") UserTv userTv);
21 } 66 }
......
...@@ -80,4 +80,45 @@ public interface UserTvService { ...@@ -80,4 +80,45 @@ public interface UserTvService {
80 */ 80 */
81 MemberDTO findMemberByPlatformAccount(String platformAccount); 81 MemberDTO findMemberByPlatformAccount(String platformAccount);
82 82
83
84 /**
85 *
86 * @param resources
87 * @return
88 */
89 UserTvDTO asyncUpdateUserTvVisUserId(UserTv resources);
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);
111
112 /**
113 *
114 * @param platformAccount
115 * @return
116 */
117 Long countByPlatformAccount(String platformAccount);
118
119 /**
120 *
121 * @param userTv
122 */
123 void doUpdatePriorityMemberCode(UserTv userTv);
83 } 124 }
......
...@@ -7,10 +7,13 @@ import com.topdraw.business.module.user.iptv.repository.UserTvRepository; ...@@ -7,10 +7,13 @@ import com.topdraw.business.module.user.iptv.repository.UserTvRepository;
7 import com.topdraw.business.module.user.iptv.service.UserTvService; 7 import com.topdraw.business.module.user.iptv.service.UserTvService;
8 import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO; 8 import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO;
9 import com.topdraw.business.module.user.iptv.service.mapper.UserTvMapper; 9 import com.topdraw.business.module.user.iptv.service.mapper.UserTvMapper;
10 import com.topdraw.exception.BadRequestException;
10 import com.topdraw.exception.EntityNotFoundException; 11 import com.topdraw.exception.EntityNotFoundException;
11 import com.topdraw.exception.GlobeExceptionMsg; 12 import com.topdraw.exception.GlobeExceptionMsg;
12 import com.topdraw.utils.ValidationUtil; 13 import com.topdraw.utils.ValidationUtil;
14 import lombok.extern.slf4j.Slf4j;
13 import org.apache.commons.lang3.StringUtils; 15 import org.apache.commons.lang3.StringUtils;
16 import org.springframework.aop.framework.AopContext;
14 import org.springframework.beans.BeanUtils; 17 import org.springframework.beans.BeanUtils;
15 import org.springframework.beans.factory.annotation.Autowired; 18 import org.springframework.beans.factory.annotation.Autowired;
16 import org.springframework.dao.EmptyResultDataAccessException; 19 import org.springframework.dao.EmptyResultDataAccessException;
...@@ -20,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional; ...@@ -20,6 +23,7 @@ import org.springframework.transaction.annotation.Transactional;
20 import org.springframework.util.Assert; 23 import org.springframework.util.Assert;
21 24
22 import javax.validation.constraints.NotNull; 25 import javax.validation.constraints.NotNull;
26 import java.time.LocalDateTime;
23 import java.util.Objects; 27 import java.util.Objects;
24 import java.util.Optional; 28 import java.util.Optional;
25 29
...@@ -29,6 +33,7 @@ import java.util.Optional; ...@@ -29,6 +33,7 @@ import java.util.Optional;
29 */ 33 */
30 @Service 34 @Service
31 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) 35 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
36 @Slf4j
32 public class UserTvServiceImpl implements UserTvService { 37 public class UserTvServiceImpl implements UserTvService {
33 38
34 39
...@@ -39,6 +44,36 @@ public class UserTvServiceImpl implements UserTvService { ...@@ -39,6 +44,36 @@ public class UserTvServiceImpl implements UserTvService {
39 @Autowired 44 @Autowired
40 private UserTvRepository userTvRepository; 45 private UserTvRepository userTvRepository;
41 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 @Override
66 public Long countByPlatformAccount(String platformAccount) {
67 return this.userTvRepository.countByPlatformAccount(platformAccount);
68 }
69
70 @Override
71 @Transactional(rollbackFor = Exception.class)
72 public void doUpdatePriorityMemberCode(UserTv userTv) {
73 this.userTvRepository.updatePriorityMemberCode(userTv);
74 }
75
76
42 /** 77 /**
43 * 获取大屏账户对应的会员 78 * 获取大屏账户对应的会员
44 * <Waring> 79 * <Waring>
...@@ -66,6 +101,34 @@ public class UserTvServiceImpl implements UserTvService { ...@@ -66,6 +101,34 @@ public class UserTvServiceImpl implements UserTvService {
66 throw new EntityNotFoundException(UserTvDTO.class,"platformAccount", GlobeExceptionMsg.IPTV_IS_NULL); 101 throw new EntityNotFoundException(UserTvDTO.class,"platformAccount", GlobeExceptionMsg.IPTV_IS_NULL);
67 } 102 }
68 103
104 @Override
105 @Transactional(rollbackFor = Exception.class)
106 public UserTvDTO asyncUpdateUserTvVisUserId(UserTv resources) {
107 log.info("UserTvServiceImpl ==> updateUserTvVisUserId ==>> param ==> {}",resources);
108
109 if (StringUtils.isBlank(resources.getPlatformAccount())){
110 throw new BadRequestException(GlobeExceptionMsg.IPTV_PLATFORM_ACCOUNT_IS_NULL);
111 }
112
113 if (Objects.isNull(resources.getVisUserId())){
114 throw new BadRequestException(GlobeExceptionMsg.VIS_USER_ID_IS_NULL);
115 }
116
117 UserTvDTO userTvDTO = this.findByPlatformAccount(resources.getPlatformAccount());
118
119 if (Objects.nonNull(userTvDTO.getId())) {
120
121 this.userTvRepository.updateUserTvVisUserId(userTvDTO.getId(), resources.getVisUserId(), LocalDateTime.now());
122
123 } else {
124
125 log.error("修改大屏账号vis_user_id字段异常,请检查");
126
127 }
128
129 return null;
130 }
131
69 private MemberDTO findMemberByMemberCode(String memberCode) { 132 private MemberDTO findMemberByMemberCode(String memberCode) {
70 return this.memberService.findByCode(memberCode); 133 return this.memberService.findByCode(memberCode);
71 } 134 }
...@@ -121,13 +184,6 @@ public class UserTvServiceImpl implements UserTvService { ...@@ -121,13 +184,6 @@ public class UserTvServiceImpl implements UserTvService {
121 @Override 184 @Override
122 @Transactional(rollbackFor = Exception.class) 185 @Transactional(rollbackFor = Exception.class)
123 public void unbindPriorityMemberCode(UserTv resources) { 186 public void unbindPriorityMemberCode(UserTv resources) {
124 String platformAccount = resources.getPlatformAccount();
125 if (StringUtils.isNotBlank(platformAccount)) {
126 UserTvDTO userTvDTO = this.findByPlatformAccount(platformAccount);
127 Long id = userTvDTO.getId();
128 resources.setId(id);
129 resources.setMemberId(userTvDTO.getMemberId());
130 }
131 this.userTvRepository.save(resources); 187 this.userTvRepository.save(resources);
132 } 188 }
133 189
......
...@@ -45,7 +45,7 @@ public class UserWeixinServiceImpl implements UserWeixinService { ...@@ -45,7 +45,7 @@ public class UserWeixinServiceImpl implements UserWeixinService {
45 @Transactional(rollbackFor = Exception.class) 45 @Transactional(rollbackFor = Exception.class)
46 public UserWeixin create(UserWeixin resources) { 46 public UserWeixin create(UserWeixin resources) {
47 MemberDTO memberDTO = memberService.findByCode(resources.getMemberCode()); 47 MemberDTO memberDTO = memberService.findByCode(resources.getMemberCode());
48 if (Objects.nonNull(memberDTO)) { 48 if (Objects.nonNull(memberDTO.getId())) {
49 Long id = memberDTO.getId(); 49 Long id = memberDTO.getId();
50 resources.setMemberId(id); 50 resources.setMemberId(id);
51 } 51 }
......
1 package com.topdraw.business.module.vis.hainan.app.domain;
2
3 import cn.hutool.core.bean.BeanUtil;
4 import cn.hutool.core.bean.copier.CopyOptions;
5 import lombok.Data;
6 import lombok.experimental.Accessors;
7 import org.springframework.data.annotation.CreatedDate;
8 import org.springframework.data.annotation.LastModifiedDate;
9 import org.springframework.data.jpa.domain.support.AuditingEntityListener;
10
11 import javax.persistence.*;
12 import java.io.Serializable;
13 import java.sql.Timestamp;
14
15 /**
16 * @author XiangHan
17 * @date 2022-07-14
18 */
19 @Entity
20 @Data
21 @EntityListeners(AuditingEntityListener.class)
22 @Accessors(chain = true)
23 @Table(name="vis_user")
24 public class VisUser implements Serializable {
25
26 // ID
27 @Id
28 @GeneratedValue(strategy = GenerationType.IDENTITY)
29 @Column(name = "id")
30 private Long id;
31
32 // 所有者ID
33 @Column(name = "person_id")
34 private Long personId;
35
36 // 平台
37 @Column(name = "platform")
38 private String platform;
39
40 // 平台账号
41 @Column(name = "platform_account")
42 private String platformAccount;
43
44 // 用户名
45 @Column(name = "username")
46 private String username;
47
48 // 密码
49 @Column(name = "password")
50 private String password;
51
52 // 积分
53 @Column(name = "points")
54 private Integer points;
55
56 // 昵称
57 @Column(name = "nickname")
58 private String nickname;
59
60 // 真实姓名
61 @Column(name = "realname")
62 private String realname;
63
64 // 头像
65 @Column(name = "image")
66 private String image;
67
68 // 电子邮件
69 @Column(name = "email")
70 private String email;
71
72 // 手机号
73 @Column(name = "cellphone")
74 private String cellphone;
75
76 // 0-女 1-男 2-其他
77 @Column(name = "gender")
78 private Integer gender;
79
80 // 生日
81 @Column(name = "birthday")
82 private Integer birthday;
83
84 // 登录天数(总天数)
85 @Column(name = "login_days")
86 private Integer loginDays;
87
88 // 连续天数
89 @Column(name = "continue_days")
90 private Integer continueDays;
91
92 // 活跃时间
93 @Column(name = "active_time")
94 private Timestamp activeTime;
95
96 // 标签
97 @Column(name = "tags")
98 private String tags;
99
100 // 登录类型:1-运营商隐式登录 2-手机验证登录 3-微信登录 4-QQ登录 5-微博登录 6-苹果登录
101 @Column(name = "login_type")
102 private Integer loginType;
103
104 // 用户绑定ID
105 @Column(name = "vis_user_id")
106 private Long visUserId;
107
108 // 微信绑定ID
109 @Column(name = "vis_user_weixin_id")
110 private Long visUserWeixinId;
111
112 // QQ绑定ID
113 @Column(name = "vis_user_qq_id")
114 private Long visUserQqId;
115
116 // 微博绑定ID
117 @Column(name = "vis_user_weibo_id")
118 private Long visUserWeiboId;
119
120 // 苹果绑定ID
121 @Column(name = "vis_user_apple_id")
122 private Long visUserAppleId;
123
124 // 状态:默认1-生效 2-失效
125 @Column(name = "status")
126 private Integer status;
127
128 // 创建时间
129 @CreatedDate
130 @Column(name = "create_time")
131 private Timestamp createTime;
132
133 // 更新时间
134 @LastModifiedDate
135 @Column(name = "update_time")
136 private Timestamp updateTime;
137
138 public void copy(VisUser source){
139 BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
140 }
141 }
1 package com.topdraw.business.module.vis.hainan.app.repository;
2
3
4 import com.topdraw.business.module.vis.hainan.app.domain.VisUser;
5 import org.springframework.data.jpa.repository.JpaRepository;
6 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
7
8 /**
9 * @author XiangHan
10 * @date 2022-07-14
11 */
12 public interface VisUserRepository extends JpaRepository<VisUser, Long>, JpaSpecificationExecutor<VisUser> {
13
14 }
1 package com.topdraw.business.module.vis.hainan.app.service;
2
3 import com.topdraw.business.module.vis.hainan.app.domain.VisUser;
4 import com.topdraw.business.module.vis.hainan.app.service.dto.VisUserDTO;
5
6 /**
7 * @author XiangHan
8 * @date 2022-07-14
9 */
10 public interface VisUserService {
11
12 /**
13 * 根据ID查询
14 * @param id ID
15 * @return UserDTO
16 */
17 VisUserDTO findById(Long id);
18
19 void create(VisUser resources);
20
21 void update(VisUser resources);
22
23 void delete(Long id);
24
25 }
1 package com.topdraw.business.module.vis.hainan.app.service.dto;
2
3 import lombok.Data;
4
5 import java.io.Serializable;
6 import java.sql.Timestamp;
7
8
9 /**
10 * @author XiangHan
11 * @date 2022-07-14
12 */
13 @Data
14 public class VisUserDTO implements Serializable {
15
16 // ID
17 private Long id;
18
19 // 所有者ID
20 private Long personId;
21
22 // 平台
23 private String platform;
24
25 // 平台账号
26 private String platformAccount;
27
28 // 用户名
29 private String username;
30
31 // 密码
32 private String password;
33
34 // 积分
35 private Integer points;
36
37 // 昵称
38 private String nickname;
39
40 // 真实姓名
41 private String realname;
42
43 // 头像
44 private String image;
45
46 // 电子邮件
47 private String email;
48
49 // 手机号
50 private String cellphone;
51
52 // 0-女 1-男 2-其他
53 private Integer gender;
54
55 // 生日
56 private Integer birthday;
57
58 // 登录天数(总天数)
59 private Integer loginDays;
60
61 // 连续天数
62 private Integer continueDays;
63
64 // 活跃时间
65 private Timestamp activeTime;
66
67 // 标签
68 private String tags;
69
70 // 登录类型:1-运营商隐式登录 2-手机验证登录 3-微信登录 4-QQ登录 5-微博登录 6-苹果登录
71 private Integer loginType;
72
73 // 用户绑定ID
74 private Long visUserId;
75
76 // 微信绑定ID
77 private Long visUserWeixinId;
78
79 // QQ绑定ID
80 private Long visUserQqId;
81
82 // 微博绑定ID
83 private Long visUserWeiboId;
84
85 // 苹果绑定ID
86 private Long visUserAppleId;
87
88 // 状态:默认1-生效 2-失效
89 private Integer status;
90
91 // 创建时间
92 private Timestamp createTime;
93
94 // 更新时间
95 private Timestamp updateTime;
96 }
1 package com.topdraw.business.module.vis.hainan.app.service.impl;
2
3 import com.topdraw.business.module.vis.hainan.app.domain.VisUser;
4 import com.topdraw.business.module.vis.hainan.app.repository.VisUserRepository;
5 import com.topdraw.business.module.vis.hainan.app.service.VisUserService;
6 import com.topdraw.business.module.vis.hainan.app.service.dto.VisUserDTO;
7 import com.topdraw.business.module.vis.hainan.app.service.mapper.VisUserMapper;
8 import com.topdraw.utils.ValidationUtil;
9 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.dao.EmptyResultDataAccessException;
11 import org.springframework.stereotype.Service;
12 import org.springframework.transaction.annotation.Propagation;
13 import org.springframework.transaction.annotation.Transactional;
14 import org.springframework.util.Assert;
15
16 /**
17 * @author XiangHan
18 * @date 2022-07-14
19 */
20 @Service
21 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
22 public class VisUserServiceImpl implements VisUserService {
23
24 @Autowired
25 private VisUserRepository visUserRepository;
26
27 @Autowired
28 private VisUserMapper visUserMapper;
29
30 @Override
31 public VisUserDTO findById(Long id) {
32 VisUser visUser = visUserRepository.findById(id).orElseGet(VisUser::new);
33 ValidationUtil.isNull(visUser.getId(),"User","id",id);
34 return visUserMapper.toDto(visUser);
35 }
36
37 @Override
38 @Transactional(rollbackFor = Exception.class)
39 public void create(VisUser resources) {
40 visUserRepository.save(resources);
41 }
42
43 @Override
44 @Transactional(rollbackFor = Exception.class)
45 public void update(VisUser resources) {
46 VisUser User = visUserRepository.findById(resources.getId()).orElseGet(VisUser::new);
47 ValidationUtil.isNull( User.getId(),"User","id",resources.getId());
48 User.copy(resources);
49 visUserRepository.save(User);
50 }
51
52 @Override
53 @Transactional(rollbackFor = Exception.class)
54 public void delete(Long id) {
55 Assert.notNull(id, "The given id must not be null!");
56 VisUser User = visUserRepository.findById(id).orElseThrow(
57 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", VisUser.class, id), 1));
58 visUserRepository.delete(User);
59 }
60
61
62 }
1 package com.topdraw.business.module.vis.hainan.app.service.mapper;
2
3 import com.topdraw.base.BaseMapper;
4 import com.topdraw.business.module.vis.hainan.app.domain.VisUser;
5 import com.topdraw.business.module.vis.hainan.app.service.dto.VisUserDTO;
6 import org.mapstruct.Mapper;
7 import org.mapstruct.ReportingPolicy;
8
9 /**
10 * @author XiangHan
11 * @date 2022-07-14
12 */
13 @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
14 public interface VisUserMapper extends BaseMapper<VisUserDTO, VisUser> {
15
16 }
1 package com.topdraw.business.module.vis.hainan.apple.domain;
2
3 import cn.hutool.core.bean.BeanUtil;
4 import cn.hutool.core.bean.copier.CopyOptions;
5 import lombok.Data;
6 import lombok.experimental.Accessors;
7 import org.springframework.data.annotation.CreatedDate;
8 import org.springframework.data.annotation.LastModifiedDate;
9 import org.springframework.data.jpa.domain.support.AuditingEntityListener;
10
11 import javax.persistence.*;
12 import java.io.Serializable;
13 import java.sql.Timestamp;
14
15 /**
16 * @author XiangHan
17 * @date 2022-07-14
18 */
19 @Entity
20 @Data
21 @EntityListeners(AuditingEntityListener.class)
22 @Accessors(chain = true)
23 @Table(name="vis_user_apple")
24 public class VisUserApple implements Serializable {
25
26
27 @Transient
28 private String username;
29 @Transient
30 private Integer type;
31
32 // ID
33 @Id
34 @GeneratedValue(strategy = GenerationType.IDENTITY)
35 @Column(name = "id")
36 private Long id;
37
38 // 所有者ID
39 @Column(name = "person_id")
40 private Long personId;
41
42 // 用户ID
43 @Column(name = "vis_user_id")
44 private Long visUserId;
45
46 // 苹果用户ID
47 @Column(name = "user")
48 private String user;
49
50 @Column(name = "identity_token")
51 private String identityToken;
52
53 @Column(name = "real_user_status")
54 private String realUserStatus;
55
56 @Column(name = "authorized_scopes")
57 private String authorizedScopes;
58
59 @Column(name = "authorization_code")
60 private String authorizationCode;
61
62 // 状态 0-失效 1-有效
63 @Column(name = "status")
64 private Integer status;
65
66 // 全名
67 @Column(name = "full_name")
68 private String fullName;
69
70 // E-main
71 @Column(name = "email")
72 private String email;
73
74 // 昵称
75 @Column(name = "nickname")
76 private String nickname;
77
78 // 性别
79 @Column(name = "sex")
80 private Integer sex;
81
82 // 国家
83 @Column(name = "country")
84 private String country;
85
86 // 省份
87 @Column(name = "province")
88 private String province;
89
90 // 城市
91 @Column(name = "city")
92 private String city;
93
94 // 头像地址
95 @Column(name = "icon")
96 private String icon;
97
98 // 描述
99 @Column(name = "description")
100 private String description;
101
102 // 创建时间
103 @CreatedDate
104 @Column(name = "create_time")
105 private Timestamp createTime;
106
107 // 更新时间
108 @LastModifiedDate
109 @Column(name = "update_time")
110 private Timestamp updateTime;
111
112 public void copy(VisUserApple source){
113 BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
114 }
115 }
1 package com.topdraw.business.module.vis.hainan.apple.repository;
2
3 import com.topdraw.business.module.vis.hainan.apple.domain.VisUserApple;
4 import org.springframework.data.jpa.repository.JpaRepository;
5 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
6
7 /**
8 * @author XiangHan
9 * @date 2022-07-14
10 */
11 public interface VisUserAppleRepository extends JpaRepository<VisUserApple, Long>, JpaSpecificationExecutor<VisUserApple> {
12
13 }
1 package com.topdraw.business.module.vis.hainan.apple.service;
2
3
4 import com.topdraw.business.module.vis.hainan.apple.domain.VisUserApple;
5 import com.topdraw.business.module.vis.hainan.apple.service.dto.VisUserAppleDTO;
6
7 /**
8 * @author XiangHan
9 * @date 2022-07-14
10 */
11 public interface VisUserAppleService {
12
13 /**
14 * 根据ID查询
15 * @param id ID
16 * @return VisUserAppleDTO
17 */
18 VisUserAppleDTO findById(Long id);
19
20 void create(VisUserApple resources);
21
22 void update(VisUserApple resources);
23
24 void delete(Long id);
25
26 }
1 package com.topdraw.business.module.vis.hainan.apple.service.dto;
2
3 import lombok.Data;
4
5 import java.io.Serializable;
6 import java.sql.Timestamp;
7
8
9 /**
10 * @author XiangHan
11 * @date 2022-07-14
12 */
13 @Data
14 public class VisUserAppleDTO implements Serializable {
15
16 // ID
17 private Long id;
18
19 // 所有者ID
20 private Long personId;
21
22 // 用户ID
23 private Long visUserId;
24
25 // 苹果用户ID
26 private String user;
27
28 private String identityToken;
29
30 private String realUserStatus;
31
32 private String authorizedScopes;
33
34 private String authorizationCode;
35
36 // 状态 0-失效 1-有效
37 private Integer status;
38
39 // 全名
40 private String fullName;
41
42 // E-main
43 private String email;
44
45 // 昵称
46 private String nickname;
47
48 // 性别
49 private Integer sex;
50
51 // 国家
52 private String country;
53
54 // 省份
55 private String province;
56
57 // 城市
58 private String city;
59
60 // 头像地址
61 private String icon;
62
63 // 描述
64 private String description;
65
66 // 创建时间
67 private Timestamp createTime;
68
69 // 更新时间
70 private Timestamp updateTime;
71 }
1 package com.topdraw.business.process.domian.weixin; 1 package com.topdraw.business.module.vis.hainan.apple.service.dto;
2 2
3 import com.fasterxml.jackson.annotation.JsonFormat;
4 import lombok.Data; 3 import lombok.Data;
5 4
6 import java.time.LocalDateTime;
7
8 /** 5 /**
9 * 微信账户信息
10 * @author XiangHan 6 * @author XiangHan
11 * @date 2021-01-18 7 * @date 2022-07-14
12 */ 8 */
13 @Data 9 @Data
14 public class BuyVipBean extends WeiXinUserBean { 10 public class VisUserAppleQueryCriteria{
15
16 private Integer vip;
17
18 @JsonFormat(shape = JsonFormat.Shape.STRING,pattern = "yyyy-MM-dd HH:mm:ss")
19 private LocalDateTime vipExpireTime;
20
21
22 } 11 }
......
1 package com.topdraw.business.module.vis.hainan.apple.service.impl;
2
3 import com.topdraw.business.module.vis.hainan.apple.domain.VisUserApple;
4 import com.topdraw.business.module.vis.hainan.apple.repository.VisUserAppleRepository;
5 import com.topdraw.business.module.vis.hainan.apple.service.VisUserAppleService;
6 import com.topdraw.business.module.vis.hainan.apple.service.dto.VisUserAppleDTO;
7 import com.topdraw.business.module.vis.hainan.apple.service.mapper.VisUserAppleMapper;
8 import com.topdraw.utils.ValidationUtil;
9 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.dao.EmptyResultDataAccessException;
11 import org.springframework.stereotype.Service;
12 import org.springframework.transaction.annotation.Propagation;
13 import org.springframework.transaction.annotation.Transactional;
14 import org.springframework.util.Assert;
15
16 /**
17 * @author XiangHan
18 * @date 2022-07-14
19 */
20 @Service
21 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
22 public class VisUserAppleServiceImpl implements VisUserAppleService {
23
24 @Autowired
25 private VisUserAppleRepository visUserAppleRepository;
26
27 @Autowired
28 private VisUserAppleMapper visUserAppleMapper;
29
30 @Override
31 public VisUserAppleDTO findById(Long id) {
32 VisUserApple visUserApple = visUserAppleRepository.findById(id).orElseGet(VisUserApple::new);
33 ValidationUtil.isNull(visUserApple.getId(),"VisUserApple","id",id);
34 return visUserAppleMapper.toDto(visUserApple);
35 }
36
37 @Override
38 @Transactional(rollbackFor = Exception.class)
39 public void create(VisUserApple resources) {
40 visUserAppleRepository.save(resources);
41 }
42
43 @Override
44 @Transactional(rollbackFor = Exception.class)
45 public void update(VisUserApple resources) {
46 VisUserApple visUserApple = visUserAppleRepository.findById(resources.getId()).orElseGet(VisUserApple::new);
47 ValidationUtil.isNull( visUserApple.getId(),"VisUserApple","id",resources.getId());
48 visUserApple.copy(resources);
49 visUserAppleRepository.save(visUserApple);
50 }
51
52 @Override
53 @Transactional(rollbackFor = Exception.class)
54 public void delete(Long id) {
55 Assert.notNull(id, "The given id must not be null!");
56 VisUserApple visUserApple = visUserAppleRepository.findById(id).orElseThrow(
57 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", VisUserApple.class, id), 1));
58 visUserAppleRepository.delete(visUserApple);
59 }
60
61
62 }
1 package com.topdraw.business.module.vis.hainan.apple.service.mapper;
2
3 import com.topdraw.base.BaseMapper;
4 import com.topdraw.business.module.vis.hainan.apple.domain.VisUserApple;
5 import com.topdraw.business.module.vis.hainan.apple.service.dto.VisUserAppleDTO;
6 import org.mapstruct.Mapper;
7 import org.mapstruct.ReportingPolicy;
8
9 /**
10 * @author XiangHan
11 * @date 2022-07-14
12 */
13 @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
14 public interface VisUserAppleMapper extends BaseMapper<VisUserAppleDTO, VisUserApple> {
15
16 }
1 package com.topdraw.business.module.vis.hainan.qq.domain;
2
3 import cn.hutool.core.bean.BeanUtil;
4 import cn.hutool.core.bean.copier.CopyOptions;
5 import lombok.Data;
6 import lombok.experimental.Accessors;
7 import org.springframework.data.annotation.CreatedDate;
8 import org.springframework.data.annotation.LastModifiedDate;
9 import org.springframework.data.jpa.domain.support.AuditingEntityListener;
10
11 import javax.persistence.*;
12 import java.io.Serializable;
13 import java.sql.Timestamp;
14
15 /**
16 * @author XiangHan
17 * @date 2022-07-14
18 */
19 @Entity
20 @Data
21 @EntityListeners(AuditingEntityListener.class)
22 @Accessors(chain = true)
23 @Table(name="vis_user_qq")
24 public class VisUserQq implements Serializable {
25 @Transient
26 private String username;
27 @Transient
28 private Integer type;
29 // ID
30 @Id
31 @GeneratedValue(strategy = GenerationType.IDENTITY)
32 @Column(name = "id")
33 private Long id;
34
35 // 所有者ID
36 @Column(name = "person_id")
37 private Long personId;
38
39 // 用户ID
40 @Column(name = "vis_user_id")
41 private Long visUserId;
42
43 // QQunionid,针对开发者
44 @Column(name = "unionid")
45 private String unionid;
46
47 // QQappid
48 @Column(name = "app_id")
49 private String appId;
50
51 // QQopenid
52 @Column(name = "openid")
53 private String openid;
54
55 // QQuserid
56 @Column(name = "user_id")
57 private String userId;
58
59 // 状态 0-失效 1-有效
60 @Column(name = "status")
61 private Integer status;
62
63 // 昵称
64 @Column(name = "nickname")
65 private String nickname;
66
67 // 性别
68 @Column(name = "sex")
69 private Integer sex;
70
71 // 国家
72 @Column(name = "country")
73 private String country;
74
75 // 省份
76 @Column(name = "province")
77 private String province;
78
79 // 城市
80 @Column(name = "city")
81 private String city;
82
83 // 头像地址
84 @Column(name = "icon")
85 private String icon;
86
87 @Column(name = "pay_token")
88 private String payToken;
89
90 @Column(name = "secretType")
91 private String secretType;
92
93 @Column(name = "secret")
94 private String secret;
95
96 @Column(name = "pfkey")
97 private String pfkey;
98
99 @Column(name = "pf")
100 private String pf;
101
102 // access_token
103 @Column(name = "access_token")
104 private String accessToken;
105
106 // expires_in
107 @Column(name = "expires_in")
108 private Integer expiresIn;
109
110 // expires_time
111 @Column(name = "expires_time")
112 private Timestamp expiresTime;
113
114 // 描述
115 @Column(name = "description")
116 private String description;
117
118 // 创建时间
119 @CreatedDate
120 @Column(name = "create_time")
121 private Timestamp createTime;
122
123 // 更新时间
124 @LastModifiedDate
125 @Column(name = "update_time")
126 private Timestamp updateTime;
127
128 public void copy(VisUserQq source){
129 BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
130 }
131 }
1 package com.topdraw.business.module.vis.hainan.qq.repository;
2
3 import com.topdraw.business.module.vis.hainan.qq.domain.VisUserQq;
4 import org.springframework.data.jpa.repository.JpaRepository;
5 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
6
7 /**
8 * @author XiangHan
9 * @date 2022-07-14
10 */
11 public interface VisUserQqRepository extends JpaRepository<VisUserQq, Long>, JpaSpecificationExecutor<VisUserQq> {
12
13 }
1 package com.topdraw.business.module.vis.hainan.qq.service;
2
3
4 import com.topdraw.business.module.vis.hainan.qq.domain.VisUserQq;
5 import com.topdraw.business.module.vis.hainan.qq.service.dto.VisUserQqDTO;
6
7 /**
8 * @author XiangHan
9 * @date 2022-07-14
10 */
11 public interface VisUserQqService {
12
13 /**
14 * 根据ID查询
15 * @param id ID
16 * @return VisUserQqDTO
17 */
18 VisUserQqDTO findById(Long id);
19
20 void create(VisUserQq resources);
21
22 void update(VisUserQq resources);
23
24 void delete(Long id);
25
26 VisUserQqDTO findByOpenid(String account);
27 }
1 package com.topdraw.business.module.vis.hainan.qq.service.dto;
2
3 import lombok.Data;
4
5 import java.io.Serializable;
6 import java.sql.Timestamp;
7
8
9 /**
10 * @author XiangHan
11 * @date 2022-07-14
12 */
13 @Data
14 public class VisUserQqDTO implements Serializable {
15
16 // ID
17 private Long id;
18
19 // 所有者ID
20 private Long personId;
21
22 // 用户ID
23 private Long visUserId;
24
25 // QQunionid,针对开发者
26 private String unionid;
27
28 // QQappid
29 private String appId;
30
31 // QQopenid
32 private String openid;
33
34 // QQuserid
35 private String userId;
36
37 // 状态 0-失效 1-有效
38 private Integer status;
39
40 // 昵称
41 private String nickname;
42
43 // 性别
44 private Integer sex;
45
46 // 国家
47 private String country;
48
49 // 省份
50 private String province;
51
52 // 城市
53 private String city;
54
55 // 头像地址
56 private String icon;
57
58 private String payToken;
59
60 private String secretType;
61
62 private String secret;
63
64 private String pfkey;
65
66 private String pf;
67
68 // access_token
69 private String accessToken;
70
71 // expires_in
72 private Integer expiresIn;
73
74 // expires_time
75 private Timestamp expiresTime;
76
77 // 描述
78 private String description;
79
80 // 创建时间
81 private Timestamp createTime;
82
83 // 更新时间
84 private Timestamp updateTime;
85 }
1 package com.topdraw.business.module.vis.hainan.qq.service.impl;
2
3 import com.topdraw.business.module.vis.hainan.qq.domain.VisUserQq;
4 import com.topdraw.business.module.vis.hainan.qq.repository.VisUserQqRepository;
5 import com.topdraw.business.module.vis.hainan.qq.service.VisUserQqService;
6 import com.topdraw.business.module.vis.hainan.qq.service.dto.VisUserQqDTO;
7 import com.topdraw.business.module.vis.hainan.qq.service.mapper.VisUserQqMapper;
8 import com.topdraw.utils.ValidationUtil;
9 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.dao.EmptyResultDataAccessException;
11 import org.springframework.stereotype.Service;
12 import org.springframework.transaction.annotation.Propagation;
13 import org.springframework.transaction.annotation.Transactional;
14 import org.springframework.util.Assert;
15
16 /**
17 * @author XiangHan
18 * @date 2022-07-14
19 */
20 @Service
21 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
22 public class VisUserQqServiceImpl implements VisUserQqService {
23
24 @Autowired
25 private VisUserQqRepository visUserQqRepository;
26
27 @Autowired
28 private VisUserQqMapper visUserQqMapper;
29
30 @Override
31 public VisUserQqDTO findById(Long id) {
32 VisUserQq visUserQq = visUserQqRepository.findById(id).orElseGet(VisUserQq::new);
33 ValidationUtil.isNull(visUserQq.getId(),"VisUserQq","id",id);
34 return visUserQqMapper.toDto(visUserQq);
35 }
36
37 @Override
38 @Transactional(rollbackFor = Exception.class)
39 public void create(VisUserQq resources) {
40 visUserQqRepository.save(resources);
41 }
42
43 @Override
44 @Transactional(rollbackFor = Exception.class)
45 public void update(VisUserQq resources) {
46 VisUserQq visUserQq = visUserQqRepository.findById(resources.getId()).orElseGet(VisUserQq::new);
47 ValidationUtil.isNull( visUserQq.getId(),"VisUserQq","id",resources.getId());
48 visUserQq.copy(resources);
49 visUserQqRepository.save(visUserQq);
50 }
51
52 @Override
53 @Transactional(rollbackFor = Exception.class)
54 public void delete(Long id) {
55 Assert.notNull(id, "The given id must not be null!");
56 VisUserQq visUserQq = visUserQqRepository.findById(id).orElseThrow(
57 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", VisUserQq.class, id), 1));
58 visUserQqRepository.delete(visUserQq);
59 }
60
61 @Override
62 public VisUserQqDTO findByOpenid(String account) {
63 return null;
64 }
65
66
67 }
1 package com.topdraw.business.module.vis.hainan.qq.service.mapper;
2
3 import com.topdraw.base.BaseMapper;
4 import com.topdraw.business.module.vis.hainan.qq.domain.VisUserQq;
5 import com.topdraw.business.module.vis.hainan.qq.service.dto.VisUserQqDTO;
6 import org.mapstruct.Mapper;
7 import org.mapstruct.ReportingPolicy;
8
9 /**
10 * @author XiangHan
11 * @date 2022-07-14
12 */
13 @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
14 public interface VisUserQqMapper extends BaseMapper<VisUserQqDTO, VisUserQq> {
15
16 }
1 package com.topdraw.business.module.vis.hainan.weibo.domain;
2
3 import cn.hutool.core.bean.BeanUtil;
4 import cn.hutool.core.bean.copier.CopyOptions;
5 import lombok.Data;
6 import lombok.experimental.Accessors;
7 import org.springframework.data.annotation.CreatedDate;
8 import org.springframework.data.annotation.LastModifiedDate;
9 import org.springframework.data.jpa.domain.support.AuditingEntityListener;
10
11 import javax.persistence.*;
12 import java.io.Serializable;
13 import java.sql.Timestamp;
14
15 /**
16 * @author XiangHan
17 * @date 2022-07-14
18 */
19 @Entity
20 @Data
21 @EntityListeners(AuditingEntityListener.class)
22 @Accessors(chain = true)
23 @Table(name="vis_user_weibo")
24 public class VisUserWeibo implements Serializable {
25 @Transient
26 private String username;
27 @Transient
28 private Integer type;
29 // ID
30 @Id
31 @GeneratedValue(strategy = GenerationType.IDENTITY)
32 @Column(name = "id")
33 private Long id;
34
35 // 所有者ID
36 @Column(name = "person_id")
37 private Long personId;
38
39 // 用户ID
40 @Column(name = "vis_user_id")
41 private Long visUserId;
42
43 // 微博appid
44 @Column(name = "app_id")
45 private String appId;
46
47 // 微博用户ID
48 @Column(name = "user_id")
49 private String userId;
50
51 // 状态 0-失效 1-有效
52 @Column(name = "status")
53 private Integer status;
54
55 // 昵称
56 @Column(name = "nickname")
57 private String nickname;
58
59 // 性别
60 @Column(name = "sex")
61 private Integer sex;
62
63 // 国家
64 @Column(name = "country")
65 private String country;
66
67 // 省份
68 @Column(name = "province")
69 private String province;
70
71 // 城市
72 @Column(name = "city")
73 private String city;
74
75 // 头像地址
76 @Column(name = "icon")
77 private String icon;
78
79 // secretType
80 @Column(name = "secretType")
81 private String secretType;
82
83 // secret
84 @Column(name = "secret")
85 private String secret;
86
87 // snsregat
88 @Column(name = "snsregat")
89 private String snsregat;
90
91 // snsUserUrl
92 @Column(name = "snsUserUrl")
93 private String snsUserUrl;
94
95 // shareCount
96 @Column(name = "shareCount")
97 private String shareCount;
98
99 // followerCount
100 @Column(name = "followerCount")
101 private String followerCount;
102
103 // refresh_token
104 @Column(name = "refresh_token")
105 private String refreshToken;
106
107 // access_token
108 @Column(name = "access_token")
109 private String accessToken;
110
111 // expires_in
112 @Column(name = "expires_in")
113 private Long expiresIn;
114
115 // expires_time
116 @Column(name = "expires_time")
117 private Timestamp expiresTime;
118
119 // 描述
120 @Column(name = "description")
121 private String description;
122
123 // 创建时间
124 @CreatedDate
125 @Column(name = "create_time")
126 private Timestamp createTime;
127
128 // 更新时间
129 @LastModifiedDate
130 @Column(name = "update_time")
131 private Timestamp updateTime;
132
133 public void copy(VisUserWeibo source){
134 BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
135 }
136 }
1 package com.topdraw.business.module.vis.hainan.weibo.repository;
2
3 import com.topdraw.business.module.vis.hainan.weibo.domain.VisUserWeibo;
4 import org.springframework.data.jpa.repository.JpaRepository;
5 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
6
7 /**
8 * @author XiangHan
9 * @date 2022-07-14
10 */
11 public interface VisUserWeiboRepository extends JpaRepository<VisUserWeibo, Long>, JpaSpecificationExecutor<VisUserWeibo> {
12
13 }
1 package com.topdraw.business.module.vis.hainan.weibo.service;
2
3
4 import com.topdraw.business.module.vis.hainan.weibo.domain.VisUserWeibo;
5 import com.topdraw.business.module.vis.hainan.weibo.service.dto.VisUserWeiboDTO;
6
7 /**
8 * @author XiangHan
9 * @date 2022-07-14
10 */
11 public interface VisUserWeiboService {
12
13 /**
14 * 根据ID查询
15 * @param id ID
16 * @return VisUserWeiboDTO
17 */
18 VisUserWeiboDTO findById(Long id);
19
20 void create(VisUserWeibo resources);
21
22 void update(VisUserWeibo resources);
23
24 void delete(Long id);
25
26 VisUserWeiboDTO findByUserid(String account);
27 }
1 package com.topdraw.business.module.vis.hainan.weibo.service.dto;
2
3 import lombok.Data;
4
5 import java.io.Serializable;
6 import java.sql.Timestamp;
7
8
9 /**
10 * @author XiangHan
11 * @date 2022-07-14
12 */
13 @Data
14 public class VisUserWeiboDTO implements Serializable {
15
16 // ID
17 private Long id;
18
19 // 所有者ID
20 private Long personId;
21
22 // 用户ID
23 private Long visUserId;
24
25 // 微博appid
26 private String appId;
27
28 // 微博用户ID
29 private String userId;
30
31 // 状态 0-失效 1-有效
32 private Integer status;
33
34 // 昵称
35 private String nickname;
36
37 // 性别
38 private Integer sex;
39
40 // 国家
41 private String country;
42
43 // 省份
44 private String province;
45
46 // 城市
47 private String city;
48
49 // 头像地址
50 private String icon;
51
52 // secretType
53 private String secretType;
54
55 // secret
56 private String secret;
57
58 // snsregat
59 private String snsregat;
60
61 // snsUserUrl
62 private String snsUserUrl;
63
64 // shareCount
65 private String shareCount;
66
67 // followerCount
68 private String followerCount;
69
70 // refresh_token
71 private String refreshToken;
72
73 // access_token
74 private String accessToken;
75
76 // expires_in
77 private Long expiresIn;
78
79 // expires_time
80 private Timestamp expiresTime;
81
82 // 描述
83 private String description;
84
85 // 创建时间
86 private Timestamp createTime;
87
88 // 更新时间
89 private Timestamp updateTime;
90 }
1 package com.topdraw.business.module.vis.hainan.weibo.service.impl;
2
3 import com.topdraw.business.module.vis.hainan.weibo.domain.VisUserWeibo;
4 import com.topdraw.business.module.vis.hainan.weibo.repository.VisUserWeiboRepository;
5 import com.topdraw.business.module.vis.hainan.weibo.service.VisUserWeiboService;
6 import com.topdraw.business.module.vis.hainan.weibo.service.dto.VisUserWeiboDTO;
7 import com.topdraw.business.module.vis.hainan.weibo.service.mapper.VisUserWeiboMapper;
8 import com.topdraw.utils.ValidationUtil;
9 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.dao.EmptyResultDataAccessException;
11 import org.springframework.stereotype.Service;
12 import org.springframework.transaction.annotation.Propagation;
13 import org.springframework.transaction.annotation.Transactional;
14 import org.springframework.util.Assert;
15
16 /**
17 * @author XiangHan
18 * @date 2022-07-14
19 */
20 @Service
21 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
22 public class VisUserWeiboServiceImpl implements VisUserWeiboService {
23
24 @Autowired
25 private VisUserWeiboRepository visUserWeiboRepository;
26
27 @Autowired
28 private VisUserWeiboMapper visUserWeiboMapper;
29
30 @Override
31 public VisUserWeiboDTO findById(Long id) {
32 VisUserWeibo visUserWeibo = visUserWeiboRepository.findById(id).orElseGet(VisUserWeibo::new);
33 ValidationUtil.isNull(visUserWeibo.getId(),"VisUserWeibo","id",id);
34 return visUserWeiboMapper.toDto(visUserWeibo);
35 }
36
37 @Override
38 @Transactional(rollbackFor = Exception.class)
39 public void create(VisUserWeibo resources) {
40 visUserWeiboRepository.save(resources);
41 }
42
43 @Override
44 @Transactional(rollbackFor = Exception.class)
45 public void update(VisUserWeibo resources) {
46 VisUserWeibo visUserWeibo = visUserWeiboRepository.findById(resources.getId()).orElseGet(VisUserWeibo::new);
47 ValidationUtil.isNull( visUserWeibo.getId(),"VisUserWeibo","id",resources.getId());
48 visUserWeibo.copy(resources);
49 visUserWeiboRepository.save(visUserWeibo);
50 }
51
52 @Override
53 @Transactional(rollbackFor = Exception.class)
54 public void delete(Long id) {
55 Assert.notNull(id, "The given id must not be null!");
56 VisUserWeibo visUserWeibo = visUserWeiboRepository.findById(id).orElseThrow(
57 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", VisUserWeibo.class, id), 1));
58 visUserWeiboRepository.delete(visUserWeibo);
59 }
60
61 @Override
62 public VisUserWeiboDTO findByUserid(String account) {
63 return null;
64 }
65
66
67 }
1 package com.topdraw.business.module.vis.hainan.weibo.service.mapper;
2
3 import com.topdraw.base.BaseMapper;
4 import com.topdraw.business.module.vis.hainan.weibo.domain.VisUserWeibo;
5 import com.topdraw.business.module.vis.hainan.weibo.service.dto.VisUserWeiboDTO;
6 import org.mapstruct.Mapper;
7 import org.mapstruct.ReportingPolicy;
8
9 /**
10 * @author XiangHan
11 * @date 2022-07-14
12 */
13 @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
14 public interface VisUserWeiboMapper extends BaseMapper<VisUserWeiboDTO, VisUserWeibo> {
15
16 }
1 package com.topdraw.business.module.vis.hainan.weixin.domain;
2
3 import cn.hutool.core.bean.BeanUtil;
4 import cn.hutool.core.bean.copier.CopyOptions;
5 import lombok.Data;
6 import lombok.experimental.Accessors;
7 import org.springframework.data.annotation.CreatedDate;
8 import org.springframework.data.annotation.LastModifiedDate;
9 import org.springframework.data.jpa.domain.support.AuditingEntityListener;
10
11 import javax.persistence.*;
12 import java.io.Serializable;
13 import java.sql.Timestamp;
14
15 /**
16 * @author XiangHan
17 * @date 2022-07-14
18 */
19 @Entity
20 @Data
21 @EntityListeners(AuditingEntityListener.class)
22 @Accessors(chain = true)
23 @Table(name="vis_user_weixin")
24 public class VisUserWeixin implements Serializable {
25
26
27 @Transient
28 private String username;
29 @Transient
30 private Integer type;
31
32 // ID
33 @Id
34 @GeneratedValue(strategy = GenerationType.IDENTITY)
35 @Column(name = "id")
36 private Long id;
37
38 // 所有者ID
39 @Column(name = "person_id")
40 private Long personId;
41
42 // 用户ID
43 @Column(name = "vis_user_id")
44 private Long visUserId;
45
46 // 微信unionid,针对开发者
47 @Column(name = "unionid")
48 private String unionid;
49
50 // 微信appid
51 @Column(name = "appid")
52 private String appid;
53
54 // 微信appid
55 @Column(name = "app_id")
56 private String appId;
57
58 // 微信openid,针对微信app
59 @Column(name = "openid")
60 private String openid;
61
62 // 状态 0-失效 1-有效
63 @Column(name = "status")
64 private Integer status;
65
66 // 昵称
67 @Column(name = "nickname")
68 private String nickname;
69
70 // 性别
71 @Column(name = "sex")
72 private Integer sex;
73
74 // 国家
75 @Column(name = "country")
76 private String country;
77
78 // 省份
79 @Column(name = "province")
80 private String province;
81
82 // 城市
83 @Column(name = "city")
84 private String city;
85
86 // 头像地址
87 @Column(name = "headimgurl")
88 private String headimgurl;
89
90 // 特权信息
91 @Column(name = "privilege")
92 private String privilege;
93
94 // refresh_token
95 @Column(name = "refresh_token")
96 private String refreshToken;
97
98 // access_token
99 @Column(name = "access_token")
100 private String accessToken;
101
102 // expires_in
103 @Column(name = "expires_in")
104 private Integer expiresIn;
105
106 // expires_time
107 @Column(name = "expires_time")
108 private Timestamp expiresTime;
109
110 // 描述
111 @Column(name = "description")
112 private String description;
113
114 // 创建时间
115 @CreatedDate
116 @Column(name = "create_time")
117 private Timestamp createTime;
118
119 // 更新时间
120 @LastModifiedDate
121 @Column(name = "update_time")
122 private Timestamp updateTime;
123
124 public void copy(VisUserWeixin source){
125 BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
126 }
127 }
1 package com.topdraw.business.module.vis.hainan.weixin.repository;
2
3 import com.topdraw.business.module.vis.hainan.weixin.domain.VisUserWeixin;
4 import org.springframework.data.jpa.repository.JpaRepository;
5 import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
6
7 import java.util.Optional;
8
9 /**
10 * @author XiangHan
11 * @date 2022-07-14
12 */
13 public interface VisUserWeixinRepository extends JpaRepository<VisUserWeixin, Long>, JpaSpecificationExecutor<VisUserWeixin> {
14
15
16 Optional<VisUserWeixin> findByOpenid(String account);
17 }
1 package com.topdraw.business.module.vis.hainan.weixin.service;
2
3
4 import com.topdraw.business.module.vis.hainan.weixin.domain.VisUserWeixin;
5 import com.topdraw.business.module.vis.hainan.weixin.service.dto.VisUserWeixinDTO;
6
7 /**
8 * @author XiangHan
9 * @date 2022-07-14
10 */
11 public interface VisUserWeixinService {
12
13 /**
14 * 根据ID查询
15 * @param id ID
16 * @return VisUserWeixinDTO
17 */
18 VisUserWeixinDTO findById(Long id);
19
20 void create(VisUserWeixin resources);
21
22 void update(VisUserWeixin resources);
23
24 void delete(Long id);
25
26 VisUserWeixinDTO findByOpenid(String account);
27 }
1 package com.topdraw.business.module.vis.hainan.weixin.service.dto;
2
3 import lombok.Data;
4
5 import java.io.Serializable;
6 import java.sql.Timestamp;
7
8
9 /**
10 * @author XiangHan
11 * @date 2022-07-14
12 */
13 @Data
14 public class VisUserWeixinDTO implements Serializable {
15
16
17 // ID
18 private Long id;
19
20 // 所有者ID
21 private Long personId;
22
23 // 用户ID
24 private Long visUserId;
25
26 // 微信unionid,针对开发者
27 private String unionid;
28
29 // 微信appid
30 private String appid;
31
32 // 微信appid
33 private String appId;
34
35 // 微信openid,针对微信app
36 private String openid;
37
38 // 状态 0-失效 1-有效
39 private Integer status;
40
41 // 昵称
42 private String nickname;
43
44 // 性别
45 private Integer sex;
46
47 // 国家
48 private String country;
49
50 // 省份
51 private String province;
52
53 // 城市
54 private String city;
55
56 // 头像地址
57 private String headimgurl;
58
59 // 特权信息
60 private String privilege;
61
62 // refresh_token
63 private String refreshToken;
64
65 // access_token
66 private String accessToken;
67
68 // expires_in
69 private Integer expiresIn;
70
71 // expires_time
72 private Timestamp expiresTime;
73
74 // 描述
75 private String description;
76
77 // 创建时间
78 private Timestamp createTime;
79
80 // 更新时间
81 private Timestamp updateTime;
82 }
1 package com.topdraw.business.module.vis.hainan.weixin.service.impl;
2
3 import com.topdraw.business.module.vis.hainan.weixin.domain.VisUserWeixin;
4 import com.topdraw.business.module.vis.hainan.weixin.repository.VisUserWeixinRepository;
5 import com.topdraw.business.module.vis.hainan.weixin.service.VisUserWeixinService;
6 import com.topdraw.business.module.vis.hainan.weixin.service.dto.VisUserWeixinDTO;
7 import com.topdraw.business.module.vis.hainan.weixin.service.mapper.VisUserWeixinMapper;
8 import com.topdraw.utils.ValidationUtil;
9 import org.springframework.beans.factory.annotation.Autowired;
10 import org.springframework.dao.EmptyResultDataAccessException;
11 import org.springframework.stereotype.Service;
12 import org.springframework.transaction.annotation.Propagation;
13 import org.springframework.transaction.annotation.Transactional;
14 import org.springframework.util.Assert;
15
16 /**
17 * @author XiangHan
18 * @date 2022-07-14
19 */
20 @Service
21 @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class)
22 public class VisUserWeixinServiceImpl implements VisUserWeixinService {
23
24 @Autowired
25 private VisUserWeixinRepository visUserWeixinRepository;
26
27 @Autowired
28 private VisUserWeixinMapper visUserWeixinMapper;
29
30 @Override
31 public VisUserWeixinDTO findById(Long id) {
32 VisUserWeixin visUserWeixin = visUserWeixinRepository.findById(id).orElseGet(VisUserWeixin::new);
33 ValidationUtil.isNull(visUserWeixin.getId(),"VisUserWeixin","id",id);
34 return visUserWeixinMapper.toDto(visUserWeixin);
35 }
36
37 @Override
38 @Transactional(rollbackFor = Exception.class)
39 public void create(VisUserWeixin resources) {
40 visUserWeixinRepository.save(resources);
41 }
42
43 @Override
44 @Transactional(rollbackFor = Exception.class)
45 public void update(VisUserWeixin resources) {
46 VisUserWeixin visUserWeixin = visUserWeixinRepository.findById(resources.getId()).orElseGet(VisUserWeixin::new);
47 ValidationUtil.isNull( visUserWeixin.getId(),"VisUserWeixin","id",resources.getId());
48 visUserWeixin.copy(resources);
49 visUserWeixinRepository.save(visUserWeixin);
50 }
51
52 @Override
53 @Transactional(rollbackFor = Exception.class)
54 public void delete(Long id) {
55 Assert.notNull(id, "The given id must not be null!");
56 VisUserWeixin visUserWeixin = visUserWeixinRepository.findById(id).orElseThrow(
57 () -> new EmptyResultDataAccessException(String.format("No %s entity " + "with id %s " + "exists!", VisUserWeixin.class, id), 1));
58 visUserWeixinRepository.delete(visUserWeixin);
59 }
60
61 @Override
62 public VisUserWeixinDTO findByOpenid(String account) {
63 VisUserWeixin visUserWeixin = visUserWeixinRepository.findByOpenid(account).orElseGet(VisUserWeixin::new);
64 return visUserWeixinMapper.toDto(visUserWeixin);
65 }
66
67
68 }
1 package com.topdraw.business.module.vis.hainan.weixin.service.mapper;
2
3 import com.topdraw.base.BaseMapper;
4 import com.topdraw.business.module.vis.hainan.weixin.domain.VisUserWeixin;
5 import com.topdraw.business.module.vis.hainan.weixin.service.dto.VisUserWeixinDTO;
6 import org.mapstruct.Mapper;
7 import org.mapstruct.ReportingPolicy;
8
9 /**
10 * @author XiangHan
11 * @date 2022-07-14
12 */
13 @Mapper(componentModel = "spring", unmappedTargetPolicy = ReportingPolicy.IGNORE)
14 public interface VisUserWeixinMapper extends BaseMapper<VisUserWeixinDTO, VisUserWeixin> {
15
16 }
1 package com.topdraw.business.process.domian;
2
3 public enum RightType {
4 /**积分*/
5 POINTS,
6 /**成长值*/
7 EXP,
8 /**优惠券券*/
9 COUPON,
10 /**权益统称*/
11 RIGHTS
12
13 }
1 package com.topdraw.business.process.domian.result;
2
3
4 import lombok.AllArgsConstructor;
5 import lombok.Data;
6 import lombok.NoArgsConstructor;
7
8 @Data
9 @AllArgsConstructor
10 @NoArgsConstructor
11 public class CustomPointsResult {
12 private boolean result;
13 private Long point;
14 }
1 package com.topdraw.business.process.domian.result;
2
3 public interface TaskTemplateType {
4
5 int TYPE_1 = 1;
6 int TYPE_2 = 2;
7 int TYPE_3 = 3;
8 int TYPE_4 = 4;
9
10 }
1 package com.topdraw.business.process.domian.weixin;
2
3
4 import lombok.Data;
5
6 @Data
7 public class BindBean extends WeiXinUserBean {
8
9 private Long platformUserId;
10
11 private String platformAccount;
12 }
1 package com.topdraw.business.process.domian.weixin;
2
3 import cn.hutool.core.date.DateUtil;
4 import cn.hutool.http.HttpUtil;
5 import com.alibaba.fastjson.JSONObject;
6 import com.topdraw.exception.BadRequestException;
7 import com.topdraw.utils.StringUtils;
8 import lombok.Data;
9 import org.springframework.beans.factory.annotation.Value;
10 import org.springframework.stereotype.Component;
11
12 import java.io.File;
13 import java.nio.charset.StandardCharsets;
14 import java.util.Base64;
15 import java.util.Date;
16 import java.util.UUID;
17
18 @Data
19 @Component
20 public class DefaultWeiXinBeanDefinition implements WeiXinBeanDefinition {
21
22 //
23 private String appid;
24
25 private String openId;
26
27 private String code;
28
29 private String token;
30
31 private String secret;
32
33 private String unionId;
34
35 private String nickname;
36
37 private String headImgUrl;
38
39 private JSONObject userInfo;
40
41 private String phoneNumber;
42
43 @Value("${file.upload:upload}")
44 private String filePath;
45
46 public DefaultWeiXinBeanDefinition() {
47 }
48
49 public DefaultWeiXinBeanDefinition(String appId, String code, String unionId, String openId, JSONObject userInfoWxJo, String phone) {
50
51 this.userInfo = userInfoWxJo;
52 if (userInfo != null) {
53
54 if (StringUtils.isNotBlank(userInfoWxJo.getString("unionId"))) {
55 unionId = userInfoWxJo.getString("unionId");
56 }
57
58 if (StringUtils.isNotBlank(userInfoWxJo.getString("openId"))) {
59 openId = userInfoWxJo.getString("openId");
60 }
61
62 headImgUrl = userInfoWxJo.getString("avatarUrl");
63
64 if (StringUtils.isNotBlank(userInfoWxJo.getString("nickName"))) {
65 nickname = Base64.getEncoder().encodeToString(userInfoWxJo.getString("nickName").getBytes(StandardCharsets.UTF_8));
66 }
67
68 String phoneNumber = userInfoWxJo.getString("phoneNumber");
69 if (StringUtils.isBlank(phoneNumber)) {
70 throw new BadRequestException("phoneNumber is null...");
71 }
72
73 this.phoneNumber = phoneNumber;
74
75 if (StringUtils.isNotBlank(headImgUrl)) {
76
77 new Thread(() -> {
78 String s = UUID.randomUUID().toString();
79 File file = new File(System.getProperty("user.dir") + "/" + filePath + "/icon/" + DateUtil.format(new Date(), "yyyy-MM-dd"));
80 if (!file.exists()) {
81 file.mkdirs();
82 }
83
84 HttpUtil.downloadFile(headImgUrl, new File(System.getProperty("user.dir") + "/" + filePath + "/icon/" + DateUtil.format(new Date(), "yyyy-MM-dd") + "/" + s + ".jpg"));
85
86 headImgUrl = filePath + "/icon/" + DateUtil.format(new Date(), "yyyy-MM-dd") + "/" + s + ".jpg";
87 }).start();
88
89 }
90
91 }
92
93 this.unionId = unionId;
94 this.phoneNumber = phone;
95 this.openId = openId;
96 this.appid = appId;
97 this.code = code;
98 }
99
100 @Override
101 public String getAppId() {
102 return this.appid;
103 }
104
105 @Override
106 public String getCode() {
107 return this.code;
108 }
109
110 @Override
111 public String getToken() {
112 return this.token;
113 }
114
115 @Override
116 public String getSecret() {
117 return this.secret;
118 }
119
120 @Override
121 public String getOpenId() {
122 return this.openId;
123 }
124
125 @Override
126 public String getUnionId() {
127 return this.unionId;
128 }
129
130 @Override
131 public String getNickname() {
132 return this.nickname;
133 }
134
135 @Override
136 public String getHeadImgUrl() {
137 return this.headImgUrl;
138 }
139
140 @Override
141 public JSONObject getUserInfo() {
142 return this.userInfo;
143 }
144 }
1 package com.topdraw.business.process.domian.weixin;
2
3
4 import com.alibaba.fastjson.JSONObject;
5 import lombok.Data;
6
7 @Data
8 public class SubscribeBean extends WeiXinUserBean {
9
10 private JSONObject userInfoJson;
11
12 private JSONObject iptvUserInfo;
13
14 private String msgType;
15
16 private String event;
17
18
19 /** */
20 private String openId;
21
22 /** */
23 private String appId;
24
25 /** */
26 private String eventKey;
27
28 private String unionid;
29 private String nickname;
30 private String headimgurl;
31
32 }
1 package com.topdraw.business.process.domian.weixin;
2
3 import lombok.AllArgsConstructor;
4 import lombok.Data;
5 import lombok.NoArgsConstructor;
6
7 import javax.validation.constraints.NotNull;
8
9 @Data
10 @AllArgsConstructor
11 @NoArgsConstructor
12 public class SubscribeBeanEvent {
13
14 @NotNull(message = "【content】 not be null !!!")
15 private String content;
16
17 }
1 package com.topdraw.business.process.domian.weixin;
2
3 import com.alibaba.fastjson.JSONObject;
4
5 public interface WeiXinBeanDefinition {
6
7 String getAppId();
8
9 String getCode();
10
11 String getToken();
12
13 String getSecret();
14
15 String getOpenId();
16
17 String getUnionId();
18
19 String getNickname();
20
21 String getHeadImgUrl();
22
23 JSONObject getUserInfo();
24 }
1 package com.topdraw.business.process.domian.weixin;
2
3
4 import lombok.Data;
5
6 /**
7 * 微信账户信息
8 * @author XiangHan
9 * @date 2021-01-18
10 */
11 @Data
12 public class WeiXinUserBean {
13
14 private Long id;
15
16 private String unionid;
17
18 /** */
19 private String openid;
20
21 /** */
22 private String appid;
23
24 /** 加密后的appId,参数 */
25 private String wxAppid;
26
27 /** 加密后的code,参数 */
28 private String wxCode;
29
30 /** */
31 private String userInfo;
32
33 /** 会员id */
34 private Long memberId;
35
36 /** 加密信息 */
37 private String encryptedData;
38
39 /** 解析用户电话号码时使用,参数 */
40 private String iv;
41
42 /** 资源id */
43 private String sourceId;
44
45 /** 资源类型 */
46 private String sourceType;
47
48 /** 资源描述,用来表示从哪个地方链接进来的 */
49 private String sourceDesc;
50
51 /** 资源实例 */
52 private String sourceEntity;
53
54 /** 推荐者id */
55 private Long sourceUser;
56
57 private String nikename;
58
59 private String headimgurl;
60 }
1 package com.topdraw.business.process.service.builder;
2
3 import com.topdraw.business.process.domian.TempCoupon;
4
5 public class TempCouponBuilder {
6
7
8
9 public TempCoupon build(){
10 TempCoupon tempCoupon = new TempCoupon();
11
12 return tempCoupon;
13 }
14
15 }
...@@ -12,6 +12,8 @@ import org.springframework.beans.factory.annotation.Autowired; ...@@ -12,6 +12,8 @@ import org.springframework.beans.factory.annotation.Autowired;
12 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; 12 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
13 import org.springframework.stereotype.Service; 13 import org.springframework.stereotype.Service;
14 14
15 import java.util.Objects;
16
15 /** 17 /**
16 * 18 *
17 */ 19 */
...@@ -21,13 +23,7 @@ public class ExpOperationServiceImpl implements ExpOperationService { ...@@ -21,13 +23,7 @@ public class ExpOperationServiceImpl implements ExpOperationService {
21 @Autowired 23 @Autowired
22 private ExpDetailService expDetailService; 24 private ExpDetailService expDetailService;
23 @Autowired 25 @Autowired
24 private MemberOperationService memberOperationService;
25 @Autowired
26 private MemberLevelService memberLevelService;
27 @Autowired
28 private MemberService memberService; 26 private MemberService memberService;
29 @Autowired
30 ThreadPoolTaskExecutor threadPoolTaskExecutor;
31 27
32 public void asyncMemberExpAndLevel(Member member) { 28 public void asyncMemberExpAndLevel(Member member) {
33 String code = member.getCode(); 29 String code = member.getCode();
...@@ -40,8 +36,10 @@ public class ExpOperationServiceImpl implements ExpOperationService { ...@@ -40,8 +36,10 @@ public class ExpOperationServiceImpl implements ExpOperationService {
40 public void asyncExpDetail(ExpDetail expDetail) { 36 public void asyncExpDetail(ExpDetail expDetail) {
41 String code = expDetail.getMemberCode(); 37 String code = expDetail.getMemberCode();
42 MemberDTO memberDTO = this.memberService.findByCode(code); 38 MemberDTO memberDTO = this.memberService.findByCode(code);
43 expDetail.setMemberId(memberDTO.getId()); 39 if (Objects.nonNull(memberDTO.getId())) {
40 expDetail.setMemberId(memberDTO.getId());
41 this.expDetailService.create(expDetail);
42 }
44 43
45 this.expDetailService.create(expDetail);
46 } 44 }
47 } 45 }
......
...@@ -7,29 +7,18 @@ import com.topdraw.business.module.member.service.dto.MemberDTO; ...@@ -7,29 +7,18 @@ import com.topdraw.business.module.member.service.dto.MemberDTO;
7 import com.topdraw.business.module.points.available.domain.PointsAvailable; 7 import com.topdraw.business.module.points.available.domain.PointsAvailable;
8 import com.topdraw.business.module.points.available.service.PointsAvailableService; 8 import com.topdraw.business.module.points.available.service.PointsAvailableService;
9 import com.topdraw.business.module.points.available.service.dto.PointsAvailableDTO; 9 import com.topdraw.business.module.points.available.service.dto.PointsAvailableDTO;
10 import com.topdraw.business.module.points.detail.detailhistory.service.PointsDetailHistoryService;
11 import com.topdraw.business.module.points.detail.domain.PointsDetail; 10 import com.topdraw.business.module.points.detail.domain.PointsDetail;
12 import com.topdraw.business.module.points.detail.service.PointsDetailService; 11 import com.topdraw.business.module.points.detail.service.PointsDetailService;
13 import com.topdraw.business.module.points.service.PointsService;
14 import com.topdraw.business.process.domian.TempPoints;
15 import com.topdraw.business.process.service.PointsOperationService; 12 import com.topdraw.business.process.service.PointsOperationService;
16 import com.topdraw.business.process.service.member.MemberOperationService;
17 import com.topdraw.util.IdWorker;
18 import com.topdraw.util.TimestampUtil;
19 import com.topdraw.utils.StringUtils; 13 import com.topdraw.utils.StringUtils;
20 import lombok.extern.slf4j.Slf4j; 14 import lombok.extern.slf4j.Slf4j;
21 import org.springframework.beans.BeanUtils;
22 import org.springframework.beans.factory.annotation.Autowired; 15 import org.springframework.beans.factory.annotation.Autowired;
23 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; 16 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
24 import org.springframework.stereotype.Service; 17 import org.springframework.stereotype.Service;
25 import org.springframework.transaction.annotation.Propagation; 18 import org.springframework.transaction.annotation.Propagation;
26 import org.springframework.transaction.annotation.Transactional; 19 import org.springframework.transaction.annotation.Transactional;
27 import org.springframework.util.CollectionUtils;
28 20
29 import javax.validation.constraints.NotNull;
30 import java.time.LocalDateTime;
31 import java.util.*; 21 import java.util.*;
32 import java.util.stream.Collectors;
33 22
34 /** 23 /**
35 * 24 *
...@@ -49,24 +38,35 @@ public class PointsOperationServiceImpl implements PointsOperationService { ...@@ -49,24 +38,35 @@ public class PointsOperationServiceImpl implements PointsOperationService {
49 ThreadPoolTaskExecutor threadPoolTaskExecutor; 38 ThreadPoolTaskExecutor threadPoolTaskExecutor;
50 39
51 public void asyncMemberPoint(Member member) { 40 public void asyncMemberPoint(Member member) {
41 log.info("修改会员积分,参数 =>> {}", member);
52 String code = member.getCode(); 42 String code = member.getCode();
43 if (StringUtils.isBlank(code)) {
44 log.error("修改会员积分失败,参数错误,会员code为空");
45 return;
46 }
53 MemberDTO memberDTO = this.memberService.findByCode(code); 47 MemberDTO memberDTO = this.memberService.findByCode(code);
54 member.setId(memberDTO.getId()); 48 if (Objects.nonNull(memberDTO.getId())) {
55 this.memberService.doUpdateMemberPoints(member); 49 member.setId(memberDTO.getId());
50 this.memberService.doUpdateMemberPoints(member);
51 }
56 } 52 }
57 53
58 public void asyncPointsAvailable(PointsAvailable pointsAvailable) { 54 public void asyncPointsAvailable(PointsAvailable pointsAvailable) {
59 String memberCode = pointsAvailable.getMemberCode(); 55 String memberCode = pointsAvailable.getMemberCode();
60 MemberDTO memberDTO = this.memberService.findByCode(memberCode); 56 MemberDTO memberDTO = this.memberService.findByCode(memberCode);
61 pointsAvailable.setMemberId(memberDTO.getId()); 57 if (Objects.nonNull(memberDTO.getId())) {
62 this.pointsAvailableService.create4Custom(pointsAvailable); 58 pointsAvailable.setMemberId(memberDTO.getId());
59 this.pointsAvailableService.create4Custom(pointsAvailable);
60 }
63 } 61 }
64 62
65 public void asyncPointsDetail(PointsDetail pointsDetail) { 63 public void asyncPointsDetail(PointsDetail pointsDetail) {
66 String memberCode = pointsDetail.getMemberCode(); 64 String memberCode = pointsDetail.getMemberCode();
67 MemberDTO memberDTO = this.memberService.findByCode(memberCode); 65 MemberDTO memberDTO = this.memberService.findByCode(memberCode);
68 pointsDetail.setMemberId(memberDTO.getId()); 66 if (Objects.nonNull(memberDTO.getId())) {
69 this.pointsDetailService.create4Custom(pointsDetail); 67 pointsDetail.setMemberId(memberDTO.getId());
68 this.pointsDetailService.create4Custom(pointsDetail);
69 }
70 } 70 }
71 71
72 public void asyncDeletePointsAvailable(PointsAvailable pointsAvailable) { 72 public void asyncDeletePointsAvailable(PointsAvailable pointsAvailable) {
......
1 package com.topdraw.business.process.service.impl; 1 package com.topdraw.business.process.service.impl;
2 2
3 import com.alibaba.fastjson.JSONObject;
3 import com.topdraw.business.module.task.attribute.domain.TaskAttr; 4 import com.topdraw.business.module.task.attribute.domain.TaskAttr;
4 import com.topdraw.business.module.task.attribute.service.TaskAttrService; 5 import com.topdraw.business.module.task.attribute.service.TaskAttrService;
5 import com.topdraw.business.module.task.attribute.service.dto.TaskAttrDTO; 6 import com.topdraw.business.module.task.attribute.service.dto.TaskAttrDTO;
...@@ -50,10 +51,10 @@ public class TaskOperationServiceImpl implements TaskOperationService { ...@@ -50,10 +51,10 @@ public class TaskOperationServiceImpl implements TaskOperationService {
50 TaskDTO taskDTO = this.findByCode(code); 51 TaskDTO taskDTO = this.findByCode(code);
51 if (Objects.isNull(taskDTO.getId())) { 52 if (Objects.isNull(taskDTO.getId())) {
52 TaskDTO taskDTO_ = this.taskService.create(task); 53 TaskDTO taskDTO_ = this.taskService.create(task);
53 if (Objects.nonNull(taskDTO_.getId())) { 54 /*if (Objects.nonNull(taskDTO_.getId())) {
54 task.setId(taskDTO_.getId()); 55 task.setId(taskDTO_.getId());
55 this.createTaskAttr(task); 56 this.createTaskAttr(task);
56 } 57 }*/
57 } 58 }
58 } 59 }
59 60
...@@ -72,17 +73,23 @@ public class TaskOperationServiceImpl implements TaskOperationService { ...@@ -72,17 +73,23 @@ public class TaskOperationServiceImpl implements TaskOperationService {
72 String code = task.getCode(); 73 String code = task.getCode();
73 TaskDTO taskDTO = this.findByCode(code); 74 TaskDTO taskDTO = this.findByCode(code);
74 if (Objects.nonNull(taskDTO.getId())) { 75 if (Objects.nonNull(taskDTO.getId())) {
75 Long id = taskDTO.getId(); 76 Task task1 = new Task();
76 task.setId(id); 77 BeanUtils.copyProperties(taskDTO, task1);
77 78
79 Long id = taskDTO.getId();
80 task1.setId(id);
78 String taskTemplateCode = task.getTaskTemplateCode(); 81 String taskTemplateCode = task.getTaskTemplateCode();
79 TaskTemplateDTO taskTemplateDTO = this.taskTemplateOperationService.findByCode(taskTemplateCode); 82 if (StringUtils.isNotBlank(taskTemplateCode)) {
80 Long templateId = taskTemplateDTO.getId(); 83 TaskTemplateDTO taskTemplateDTO = this.taskTemplateOperationService.findByCode(taskTemplateCode);
81 task.setTaskTemplateId(templateId); 84 Long templateId = taskTemplateDTO.getId();
82 TaskDTO update = this.update(task); 85 task1.setTaskTemplateId(templateId);
83 if (Objects.nonNull(update)) {
84 this.updateTaskAttr(task);
85 } 86 }
87
88 task1.copy(task);
89 TaskDTO update = this.update(task1);
90 /*if (Objects.nonNull(update)) {
91 this.updateTaskAttr(task);
92 }*/
86 } 93 }
87 94
88 } 95 }
...@@ -129,8 +136,7 @@ public class TaskOperationServiceImpl implements TaskOperationService { ...@@ -129,8 +136,7 @@ public class TaskOperationServiceImpl implements TaskOperationService {
129 } 136 }
130 137
131 private TaskDTO findByCode(String code){ 138 private TaskDTO findByCode(String code){
132 TaskDTO taskDTO = this.taskService.findByCode(code); 139 return this.taskService.findByCode(code);
133 return taskDTO;
134 } 140 }
135 141
136 } 142 }
......
...@@ -8,9 +8,12 @@ import com.topdraw.business.module.member.service.MemberService; ...@@ -8,9 +8,12 @@ import com.topdraw.business.module.member.service.MemberService;
8 import com.topdraw.business.module.member.service.dto.MemberDTO; 8 import com.topdraw.business.module.member.service.dto.MemberDTO;
9 import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; 9 import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory;
10 import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService; 10 import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService;
11 import com.topdraw.business.module.member.viphistory.service.dto.MemberVipHistoryDTO;
11 import com.topdraw.business.module.user.weixin.service.UserWeixinService; 12 import com.topdraw.business.module.user.weixin.service.UserWeixinService;
12 import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; 13 import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO;
13 import com.topdraw.business.process.service.member.MemberOperationService; 14 import com.topdraw.business.process.service.member.MemberOperationService;
15 import lombok.extern.slf4j.Slf4j;
16 import org.apache.commons.lang3.StringUtils;
14 import org.springframework.beans.BeanUtils; 17 import org.springframework.beans.BeanUtils;
15 import org.springframework.beans.factory.annotation.Autowired; 18 import org.springframework.beans.factory.annotation.Autowired;
16 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; 19 import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
...@@ -19,10 +22,12 @@ import org.springframework.util.Assert; ...@@ -19,10 +22,12 @@ import org.springframework.util.Assert;
19 22
20 import java.time.LocalDateTime; 23 import java.time.LocalDateTime;
21 import java.time.ZoneOffset; 24 import java.time.ZoneOffset;
25 import java.util.List;
22 import java.util.Objects; 26 import java.util.Objects;
23 27
24 @Service 28 @Service
25 //@CacheConfig(cacheNames = "member") 29 //@CacheConfig(cacheNames = "member")
30 @Slf4j
26 public class MemberOperationServiceImpl implements MemberOperationService { 31 public class MemberOperationServiceImpl implements MemberOperationService {
27 32
28 @Autowired 33 @Autowired
...@@ -36,14 +41,37 @@ public class MemberOperationServiceImpl implements MemberOperationService { ...@@ -36,14 +41,37 @@ public class MemberOperationServiceImpl implements MemberOperationService {
36 @Autowired 41 @Autowired
37 private ThreadPoolTaskExecutor threadPoolTaskExecutor; 42 private ThreadPoolTaskExecutor threadPoolTaskExecutor;
38 43
39 public void asyncUpdateMemberVip(MemberDTO memberDTO) { 44 public void asyncDoUpdateGroupsBatch(List<Member> resources) {
40 String code = memberDTO.getCode(); 45 this.memberService.asyncDoUpdateGroupsBatch(resources);
41 MemberDTO memberDTO1 = this.findByCode(code); 46 }
42 memberDTO1.setVip(memberDTO.getVip()); 47
43 memberDTO1.setVipExpireTime(memberDTO.getVipExpireTime()); 48 public void asyncUpdateMemberVipAndVipExpireTime(MemberDTO resource) {
49 log.info("修改会员vip,参数==>>{}", resource);
50
51 String code = resource.getCode();
52 if (StringUtils.isBlank(code)) {
53 log.error("修改会员vip失败,参数错误,会员code为空");
54 return;
55 }
56
57 MemberDTO memberDTO = this.findByCode(code);
58
44 Member member = new Member(); 59 Member member = new Member();
45 BeanUtils.copyProperties(memberDTO1, member); 60 member.setId(memberDTO.getId());
46 this.update(member); 61 member.setVip(resource.getVip());
62 member.setVipExpireTime(resource.getVipExpireTime());
63 this.memberService.doUpdateMemberVipAndVipExpireTime(member);
64 }
65
66 public void asyncCreateMemberVipHistory(MemberVipHistoryDTO memberVipHistoryDTO) {
67 String memberCode = memberVipHistoryDTO.getMemberCode();
68 MemberDTO memberDTO = this.findByCode(memberCode);
69 memberVipHistoryDTO.setMemberId(memberDTO.getId());
70
71 MemberVipHistory memberVipHistory = new MemberVipHistory();
72 BeanUtils.copyProperties(memberVipHistoryDTO, MemberVipHistory.class);
73 memberVipHistory.setId(null);
74 this.memberVipHistoryService.create(memberVipHistory);
47 } 75 }
48 76
49 // @Cacheable(key = "#memberId") 77 // @Cacheable(key = "#memberId")
...@@ -94,8 +122,8 @@ public class MemberOperationServiceImpl implements MemberOperationService { ...@@ -94,8 +122,8 @@ public class MemberOperationServiceImpl implements MemberOperationService {
94 // @CachePut(key = "#resources.id") 122 // @CachePut(key = "#resources.id")
95 @Override 123 @Override
96 public MemberDTO doUpdateMemberPoints(Member resources) { 124 public MemberDTO doUpdateMemberPoints(Member resources) {
97 // return this.memberService.doUpdateMemberPoints(resources);
98 MemberDTO memberDTO = this.findByCode(resources.getCode()); 125 MemberDTO memberDTO = this.findByCode(resources.getCode());
126
99 Member member = new Member(); 127 Member member = new Member();
100 member.setId(memberDTO.getId()); 128 member.setId(memberDTO.getId());
101 member.setPoints(resources.getPoints()); 129 member.setPoints(resources.getPoints());
......
...@@ -7,12 +7,12 @@ import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; ...@@ -7,12 +7,12 @@ import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO;
7 import com.topdraw.business.module.member.service.MemberService; 7 import com.topdraw.business.module.member.service.MemberService;
8 import com.topdraw.business.module.member.service.dto.MemberDTO; 8 import com.topdraw.business.module.member.service.dto.MemberDTO;
9 import com.topdraw.business.process.service.dto.MemberProfileAndMemberDTO; 9 import com.topdraw.business.process.service.dto.MemberProfileAndMemberDTO;
10 import com.topdraw.business.process.service.member.MemberOperationService;
11 import com.topdraw.business.process.service.member.MemberProfileOperationService; 10 import com.topdraw.business.process.service.member.MemberProfileOperationService;
11 import lombok.extern.slf4j.Slf4j;
12 import org.apache.commons.lang3.StringUtils;
12 import org.springframework.beans.BeanUtils; 13 import org.springframework.beans.BeanUtils;
13 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
14 import org.springframework.stereotype.Service; 15 import org.springframework.stereotype.Service;
15 import org.springframework.util.StringUtils;
16 16
17 import java.util.Objects; 17 import java.util.Objects;
18 18
...@@ -26,83 +26,100 @@ import java.util.Objects; ...@@ -26,83 +26,100 @@ import java.util.Objects;
26 * @since : modified in 2022/3/20 17:34 26 * @since : modified in 2022/3/20 17:34
27 */ 27 */
28 @Service 28 @Service
29 @Slf4j
29 public class MemberProfileOperationServiceImpl implements MemberProfileOperationService { 30 public class MemberProfileOperationServiceImpl implements MemberProfileOperationService {
30 31
31 @Autowired 32 @Autowired
32 private MemberProfileService memberProfileService;
33 @Autowired
34 private MemberOperationService memberOperationService;
35 @Autowired
36 private MemberService memberService; 33 private MemberService memberService;
34 @Autowired
35 private MemberProfileService memberProfileService;
36
37 /**
38 *
39 * @param resource
40 */
41 public void asyncCreateMemberProfileAndSyncMember(MemberProfileDTO resource) {
42 log.info("创建会员属性,参数 ==>> {}", resource);
43 String memberCode = resource.getMemberCode();
44 if (StringUtils.isBlank(memberCode)) {
45 log.error("创建会员属性失败,会员code不存在");
46 return;
47 }
37 48
38 public void asyncCreateMemberProfile(MemberProfileDTO memberProfileDTO) {
39 String memberCode = memberProfileDTO.getMemberCode();
40 MemberDTO memberDTO = this.memberService.findByCode(memberCode); 49 MemberDTO memberDTO = this.memberService.findByCode(memberCode);
50 if (Objects.isNull(memberDTO.getId())) {
51 log.error("创建会员属性失败,会员信息不存在 ==>> memberCode ==>> {}", memberCode);
52 return;
53 }
54
41 Long memberId = memberDTO.getId(); 55 Long memberId = memberDTO.getId();
42 MemberProfileDTO _memberProfileDTO = this.memberProfileService.findByMemberId(memberId); 56 MemberProfileDTO _memberProfileDTO = this.memberProfileService.findByMemberId(memberId);
57
43 if (Objects.isNull(_memberProfileDTO.getId())) { 58 if (Objects.isNull(_memberProfileDTO.getId())) {
44 memberProfileDTO.setMemberId(memberId);
45 this.createMemberProfileAndSyncMember(memberProfileDTO, memberDTO);
46 }
47 59
48 } 60 MemberProfile memberProfile = new MemberProfile();
61 BeanUtils.copyProperties(resource, memberProfile);
62 memberProfile.setId(null);
63 memberProfile.setMemberId(memberId);
64 this.memberProfileService.createDefault(memberProfile);
49 65
50 private void createMemberProfileAndSyncMember(MemberProfileDTO memberProfileDTO, MemberDTO memberDTO) { 66 Member member = new Member();
51 this.createMemberProfile(memberProfileDTO); 67 member.setId(memberDTO.getId());
52 this.syncMember(memberProfileDTO, memberDTO); 68 member.setCode(memberDTO.getCode());
53 } 69 member.setAvatarUrl(memberProfile.getAvatarUrl());
70 member.setNickname(memberProfile.getRealname());
71 member.setGender(memberProfile.getGender());
72 this.memberService.doUpdateMemberAvatarUrlAndNicknameAndGender(member);
73 }
54 74
55 private void syncMember(MemberProfileDTO memberProfileDTO, MemberDTO memberDTO) {
56 memberDTO.setAvatarUrl(memberProfileDTO.getAvatarUrl());
57 memberDTO.setNickname(memberProfileDTO.getRealname());
58 memberDTO.setGender(memberProfileDTO.getGender());
59 Member member = new Member();
60 BeanUtils.copyProperties(memberDTO, member);
61 this.memberService.update(member);
62 } 75 }
63 76
64 private void createMemberProfile(MemberProfileDTO memberProfileDTO) {
65 MemberProfile memberProfile = new MemberProfile();
66 BeanUtils.copyProperties(memberProfileDTO, memberProfile);
67 this.memberProfileService.createDefault(memberProfile);
68 }
69
70 public MemberProfileDTO asyncMemberProfile(MemberProfileDTO memberProfileDTO){
71 String memberCode = memberProfileDTO.getMemberCode();
72 MemberDTO memberDTO = this.memberService.findByCode(memberCode);
73 Long memberId = memberDTO.getId();
74 MemberProfileDTO _memberProfileDTO = this.memberProfileService.findByMemberId(memberId);
75 memberProfileDTO.setId(_memberProfileDTO.getId());
76 memberProfileDTO.setMemberId(memberId);
77 return this.updateMemberProfile(memberProfileDTO);
78 }
79
80 private MemberProfileDTO updateMemberProfile(MemberProfileDTO memberProfileDTO) {
81 MemberProfile memberProfile = new MemberProfile();
82 BeanUtils.copyProperties(memberProfileDTO, memberProfile);
83 return this.memberProfileService.update(memberProfile);
84 }
85 77
78 /**
79 *
80 * @param resources
81 */
82 public void asyncUpdateMemberProfileAndSyncMember(MemberProfileAndMemberDTO resources) {
83 log.info("修改会员属性,参数 ==>> {}", resources);
86 84
87 public void asyncMemberProfileAndMember(MemberProfileAndMemberDTO resources) {
88 MemberProfileDTO memberProfileDTO = resources.getMemberProfileDTO(); 85 MemberProfileDTO memberProfileDTO = resources.getMemberProfileDTO();
89 MemberProfileDTO _memberProfileDTO = this.asyncMemberProfile(memberProfileDTO); 86 if (Objects.isNull(memberProfileDTO)) {
87 log.error("修改会员属性异常, 会员属性参数为空");
88 return;
89 }
90 90
91 MemberDTO memberDTO = resources.getMemberDTO(); 91 MemberDTO memberDTO = resources.getMemberDTO();
92 if (Objects.isNull(memberDTO)) {
93 log.error("修改会员属性异常, 会员信息为空");
94 return;
95 }
96
97 MemberProfileDTO _memberProfileDTO = this.asyncMemberProfile(memberProfileDTO);
92 String code = memberDTO.getCode(); 98 String code = memberDTO.getCode();
93 if (!StringUtils.isEmpty(code)) { 99 if (!StringUtils.isEmpty(code)) {
94 MemberDTO memberDTO1 = this.memberService.findByCode(code); 100 MemberDTO memberDTO1 = this.memberService.findByCode(code);
95 101
96 Member member = new Member(); 102 Member member = new Member();
97 BeanUtils.copyProperties(memberDTO1, member); 103 member.setId(memberDTO1.getId());
98
99 member.setNickname(_memberProfileDTO.getRealname()); 104 member.setNickname(_memberProfileDTO.getRealname());
100 member.setBirthday(_memberProfileDTO.getBirthday()); 105 member.setBirthday(_memberProfileDTO.getBirthday());
101 member.setGender(_memberProfileDTO.getGender()); 106 member.setGender(_memberProfileDTO.getGender());
102 this.memberService.update(member); 107 this.memberService.doUpdateMemberAvatarUrlAndNicknameAndGender(member);
103 } 108 }
109 }
110
111 public MemberProfileDTO asyncMemberProfile(MemberProfileDTO memberProfileDTO){
112 String memberCode = memberProfileDTO.getMemberCode();
113 MemberDTO memberDTO = this.memberService.findByCode(memberCode);
114 Long memberId = memberDTO.getId();
104 115
116 MemberProfileDTO _memberProfileDTO = this.memberProfileService.findByMemberId(memberId);
117 memberProfileDTO.setId(_memberProfileDTO.getId());
118 memberProfileDTO.setMemberId(memberId);
105 119
120 MemberProfile memberProfile = new MemberProfile();
121 BeanUtils.copyProperties(memberProfileDTO, memberProfile);
122 return this.memberProfileService.update(memberProfile);
106 } 123 }
107 124
108 } 125 }
......
...@@ -13,12 +13,12 @@ import javax.naming.ConfigurationException; ...@@ -13,12 +13,12 @@ import javax.naming.ConfigurationException;
13 import java.util.List; 13 import java.util.List;
14 import java.util.Map; 14 import java.util.Map;
15 15
16 @Component 16 //@Component
17 public class RabbitMqBindingConfig { 17 public class RabbitMqBindingConfig {
18 18
19 /**************************************************数据源选择*************************************************************/ 19 /**************************************************数据源选择*************************************************************/
20 20
21 @Autowired 21 /*@Autowired
22 private RabbitMqSourceConfig rabbitMqSourceConfig; 22 private RabbitMqSourceConfig rabbitMqSourceConfig;
23 @Autowired 23 @Autowired
24 private RabbitMqCustomConfig rabbitMqCustomConfig; 24 private RabbitMqCustomConfig rabbitMqCustomConfig;
...@@ -33,8 +33,6 @@ public class RabbitMqBindingConfig { ...@@ -33,8 +33,6 @@ public class RabbitMqBindingConfig {
33 @PostConstruct 33 @PostConstruct
34 public void initBinding() throws ConfigurationException { 34 public void initBinding() throws ConfigurationException {
35 35
36 // String source = rabbitMqSourceConfig.getActiveSource();
37
38 List<Map<String, String>> list = rabbitMqCustomConfig.getList(); 36 List<Map<String, String>> list = rabbitMqCustomConfig.getList();
39 if (CollectionUtils.isNotEmpty(list)) { 37 if (CollectionUtils.isNotEmpty(list)) {
40 38
...@@ -86,15 +84,7 @@ public class RabbitMqBindingConfig { ...@@ -86,15 +84,7 @@ public class RabbitMqBindingConfig {
86 this.serviceRabbitAdmin.declareQueue(queue_); 84 this.serviceRabbitAdmin.declareQueue(queue_);
87 this.serviceRabbitAdmin.declareBinding(binding_); 85 this.serviceRabbitAdmin.declareBinding(binding_);
88 break; 86 break;
89 /* case "service,management":
90 this.serviceRabbitAdmin.declareExchange(exchange_);
91 this.serviceRabbitAdmin.declareQueue(queue_);
92 this.serviceRabbitAdmin.declareBinding(binding_);
93 87
94 this.managementRabbitAdmin.declareExchange(exchange_);
95 this.managementRabbitAdmin.declareQueue(queue_);
96 this.managementRabbitAdmin.declareBinding(binding_);
97 break;*/
98 default: 88 default:
99 89
100 break; 90 break;
...@@ -104,6 +94,6 @@ public class RabbitMqBindingConfig { ...@@ -104,6 +94,6 @@ public class RabbitMqBindingConfig {
104 94
105 } 95 }
106 96
107 } 97 }*/
108 98
109 } 99 }
......