1.优化sql
2.添加缓存
Showing
52 changed files
with
467 additions
and
341 deletions
... | @@ -32,10 +32,8 @@ public class MemberProfileController { | ... | @@ -32,10 +32,8 @@ public class MemberProfileController { |
32 | @RequestMapping(value = "/update") | 32 | @RequestMapping(value = "/update") |
33 | @ApiOperation("修改会员属性") | 33 | @ApiOperation("修改会员属性") |
34 | @AnonymousAccess | 34 | @AnonymousAccess |
35 | @Deprecated | ||
36 | public ResultInfo update(@Validated(value = {UpdateGroup.class}) @RequestBody MemberProfile resources) { | 35 | public ResultInfo update(@Validated(value = {UpdateGroup.class}) @RequestBody MemberProfile resources) { |
37 | 36 | log.info("memberProfile ==>> update ==>> resources ===>> {}",resources); | |
38 | log.info("memberProfile ==>> update ==>> resources ===>> [{}]",resources); | ||
39 | MemberProfileDTO memberProfileDTO = this.memberProfileOperationService.updateMemberProfileAndMember(resources); | 37 | MemberProfileDTO memberProfileDTO = this.memberProfileOperationService.updateMemberProfileAndMember(resources); |
40 | return ResultInfo.success(memberProfileDTO); | 38 | return ResultInfo.success(memberProfileDTO); |
41 | } | 39 | } |
... | @@ -44,8 +42,7 @@ public class MemberProfileController { | ... | @@ -44,8 +42,7 @@ public class MemberProfileController { |
44 | @ApiOperation("修改会员属性并同步会员信息") | 42 | @ApiOperation("修改会员属性并同步会员信息") |
45 | @AnonymousAccess | 43 | @AnonymousAccess |
46 | public ResultInfo updateMemberProfileAndMember(@Validated @RequestBody MemberProfile resources) { | 44 | public ResultInfo updateMemberProfileAndMember(@Validated @RequestBody MemberProfile resources) { |
47 | log.info("MemberProfileServiceImpl ==>> update ==>> resources ===>> [{}]",resources); | 45 | log.info("MemberProfileServiceImpl ==>> update ==>> resources ===>> {}",resources); |
48 | |||
49 | MemberProfileDTO memberProfileDTO = this.memberProfileOperationService.updateMemberProfileAndMember(resources); | 46 | MemberProfileDTO memberProfileDTO = this.memberProfileOperationService.updateMemberProfileAndMember(resources); |
50 | return ResultInfo.success(memberProfileDTO); | 47 | return ResultInfo.success(memberProfileDTO); |
51 | } | 48 | } |
... | @@ -55,9 +52,7 @@ public class MemberProfileController { | ... | @@ -55,9 +52,7 @@ public class MemberProfileController { |
55 | @AnonymousAccess | 52 | @AnonymousAccess |
56 | @Deprecated | 53 | @Deprecated |
57 | public ResultInfo create(@Validated(value = {CreateGroup.class}) @RequestBody MemberProfile resources) { | 54 | public ResultInfo create(@Validated(value = {CreateGroup.class}) @RequestBody MemberProfile resources) { |
58 | 55 | log.info("memberProfile ==>> update ==>> resources ===>> {}",resources); | |
59 | log.info("memberProfile ==>> update ==>> resources ===>> [{}]",resources); | ||
60 | |||
61 | MemberProfileDTO memberProfileDTO = this.memberProfileOperationService.createMemberProfileAndSyncMember(resources); | 56 | MemberProfileDTO memberProfileDTO = this.memberProfileOperationService.createMemberProfileAndSyncMember(resources); |
62 | return ResultInfo.success(memberProfileDTO); | 57 | return ResultInfo.success(memberProfileDTO); |
63 | } | 58 | } | ... | ... |
... | @@ -175,27 +175,26 @@ public class MemberProfileServiceImpl implements MemberProfileService { | ... | @@ -175,27 +175,26 @@ public class MemberProfileServiceImpl implements MemberProfileService { |
175 | return memberProfileDTO; | 175 | return memberProfileDTO; |
176 | } | 176 | } |
177 | 177 | ||
178 | private void synchronizedMemberData(MemberProfile resources, MemberDTO memberDTO) { | 178 | private void synchronizedMemberData(MemberProfile memberProfile, MemberDTO memberDTO) { |
179 | 179 | ||
180 | log.info("updateMemberProfileAndMember ==>> resources ==>> [{}]",resources); | 180 | log.info("updateMemberProfileAndMember ==>> resources ==>> [{}]",memberProfile); |
181 | 181 | ||
182 | memberDTO.setId(resources.getMemberId()); | 182 | Member member = new Member(); |
183 | if(StringUtils.isNotBlank(resources.getRealname())) { | 183 | member.setId(memberDTO.getId()); |
184 | memberDTO.setNickname(resources.getRealname()); | 184 | member.setCode(memberDTO.getCode()); |
185 | if(StringUtils.isNotBlank(memberProfile.getRealname())) { | ||
186 | member.setNickname(memberProfile.getRealname()); | ||
185 | } | 187 | } |
186 | if(Objects.nonNull(resources.getGender()) && resources.getGender() != -1) { | 188 | if(Objects.nonNull(memberProfile.getGender()) && memberProfile.getGender() != -1) { |
187 | memberDTO.setGender(resources.getGender()); | 189 | member.setGender(memberProfile.getGender()); |
188 | } | 190 | } |
189 | if(StringUtils.isNotBlank(resources.getBirthday())) { | 191 | if(StringUtils.isNotBlank(memberProfile.getBirthday())) { |
190 | memberDTO.setBirthday(resources.getBirthday()); | 192 | member.setBirthday(memberProfile.getBirthday()); |
191 | } | 193 | } |
192 | if(StringUtils.isNotBlank(resources.getAvatarUrl())) { | 194 | if(StringUtils.isNotBlank(memberProfile.getAvatarUrl())) { |
193 | memberDTO.setAvatarUrl(resources.getAvatarUrl()); | 195 | member.setAvatarUrl(memberProfile.getAvatarUrl()); |
194 | } | 196 | } |
195 | 197 | ||
196 | Member member = new Member(); | 198 | this.memberService.doUpdateMemberAvatarUrlAndNicknameAndGender(member); |
197 | BeanUtils.copyProperties(memberDTO,member); | ||
198 | |||
199 | this.memberService.update(member); | ||
200 | } | 199 | } |
201 | } | 200 | } | ... | ... |
... | @@ -23,24 +23,48 @@ public interface MemberRepository extends JpaRepository<Member, Long>, JpaSpecif | ... | @@ -23,24 +23,48 @@ public interface MemberRepository extends JpaRepository<Member, Long>, JpaSpecif |
23 | 23 | ||
24 | Optional<Member> findByIdOrCode(Long id,String code); | 24 | Optional<Member> findByIdOrCode(Long id,String code); |
25 | 25 | ||
26 | |||
27 | @Modifying | 26 | @Modifying |
28 | @Query(value = "UPDATE `uc_member` SET `user_iptv_id` = ?2, `update_time` = ?3 , `bind_iptv_platform_type`= 0, " + | 27 | @Query(value = "UPDATE `uc_member` SET `user_iptv_id` = ?2, `update_time` = ?3 , `bind_iptv_platform_type`= 0, " + |
29 | "`bind_iptv_time`=?3 WHERE `id` = ?1", nativeQuery = true) | 28 | "`bind_iptv_time`=?3 WHERE `id` = ?1", nativeQuery = true) |
30 | void updateUserIptvIdById(Long id, Long userIptvId, LocalDateTime now); | 29 | void updateUserIptvIdById(Long id, Long userIptvId, LocalDateTime now); |
31 | 30 | ||
32 | @Modifying | 31 | @Modifying |
33 | @Query(value = "UPDATE `uc_member` SET `exp` = :#{#resources.exp}, `level` = :#{#resources.level} , `update_time`= now() " + | 32 | @Query(value = "UPDATE `uc_member` SET `exp` = :#{#resources.exp}, " + |
33 | "`level` = :#{#resources.level} , `update_time`= now() " + | ||
34 | " WHERE `id` = :#{#resources.id}", nativeQuery = true) | 34 | " WHERE `id` = :#{#resources.id}", nativeQuery = true) |
35 | void updateExpAndLevel(@Param("resources") Member member); | 35 | Integer updateExpAndLevel(@Param("resources") Member member); |
36 | 36 | ||
37 | @Modifying | 37 | @Modifying |
38 | @Query(value = "UPDATE `uc_member` SET `points` = :#{#resources.points}, `due_points` = :#{#resources.duePoints} , `update_time`= now() " + | 38 | @Query(value = "UPDATE `uc_member` SET `points` = :#{#resources.points}, " + |
39 | "`due_points` = :#{#resources.duePoints} , `update_time`= now() " + | ||
39 | " WHERE `id` = :#{#resources.id}", nativeQuery = true) | 40 | " WHERE `id` = :#{#resources.id}", nativeQuery = true) |
40 | void updatePointAndDuePoint(@Param("resources") Member resources); | 41 | Integer updatePointAndDuePoint(@Param("resources") Member resources); |
42 | |||
43 | @Modifying | ||
44 | @Query(value = "UPDATE `uc_member` SET `coupon_amount` = :#{#resources.couponAmount}, " + | ||
45 | "`due_coupon_amount` = :#{#resources.dueCouponAmount} , `update_time`= now() " + | ||
46 | " WHERE `id` = :#{#resources.id}", nativeQuery = true) | ||
47 | Integer doUpdateMemberCoupon(@Param("resources") Member member); | ||
48 | |||
49 | @Query(value = "SELECT um.* FROM uc_member um LEFT JOIN uc_user_tv tv ON um.id = tv.member_id " + | ||
50 | " WHERE tv.platform_account = ?1 ", nativeQuery = true) | ||
51 | Optional<Member> findByPlatformAccount(String platformAccount); | ||
41 | 52 | ||
42 | @Modifying | 53 | @Modifying |
43 | @Query(value = "UPDATE `uc_member` SET `coupon_amount` = :#{#resources.couponAmount}, `due_coupon_amount` = :#{#resources.dueCouponAmount} , `update_time`= now() " + | 54 | @Query(value = "UPDATE `uc_member` SET `vip` = :#{#resources.vip}, " + |
55 | "`vip_expire_time` = :#{#resources.vipExpireTime} , `update_time`= now() " + | ||
44 | " WHERE `id` = :#{#resources.id}", nativeQuery = true) | 56 | " WHERE `id` = :#{#resources.id}", nativeQuery = true) |
45 | void doUpdateMemberCoupon(@Param("resources") Member member); | 57 | Integer updateMemberVipAndVipExpireTime(@Param("resources") Member member); |
58 | |||
59 | @Modifying | ||
60 | @Query(value = "UPDATE `uc_member` SET `user_iptv_id` = :#{#resources.userIptvId}, `update_time` = now() , " + | ||
61 | " `bind_iptv_platform_type`= :#{#resources.bindIptvPlatformType}, " + | ||
62 | " `bind_iptv_time`=:#{#resources.bindIptvTime} WHERE `id` = :#{#resources.id}", nativeQuery = true) | ||
63 | Integer updateMemberUserIptvIdAndBindIptvPlatformAndBindIptvTime(@Param("resources") Member member); | ||
64 | |||
65 | @Modifying | ||
66 | @Query(value = "UPDATE `uc_member` SET `avatar_url` = :#{#resources.avatarUrl}, `update_time` = now() , " + | ||
67 | " `nickname`= :#{#resources.nickname}, " + | ||
68 | " `gender`=:#{#resources.gender} WHERE `id` = :#{#resources.id}", nativeQuery = true) | ||
69 | Integer updateMemberAvatarUrlAndNicknameAndGender(@Param("resources") Member resource); | ||
46 | } | 70 | } | ... | ... |
... | @@ -52,8 +52,8 @@ public class MemberController { | ... | @@ -52,8 +52,8 @@ public class MemberController { |
52 | @AnonymousAccess | 52 | @AnonymousAccess |
53 | @ApiOperation("手动修改vip") | 53 | @ApiOperation("手动修改vip") |
54 | public ResultInfo doUpdateVipByCode(@Validated(value = {UpdateGroup.class}) @RequestBody Member resources) { | 54 | public ResultInfo doUpdateVipByCode(@Validated(value = {UpdateGroup.class}) @RequestBody Member resources) { |
55 | log.info("member ==>> doUpdateVipByCode ==>> param ==>> [{}]",resources); | 55 | log.info("member ==>> doUpdateVipByCode ==>> param ==>> {}",resources); |
56 | this.memberOperationService.updateMemberVip(resources); | 56 | this.memberOperationService.doUpdateMemberVipAndVipExpireTime(resources); |
57 | return ResultInfo.success(); | 57 | return ResultInfo.success(); |
58 | } | 58 | } |
59 | 59 | ||
... | @@ -67,7 +67,6 @@ public class MemberController { | ... | @@ -67,7 +67,6 @@ public class MemberController { |
67 | if (StringUtils.isNotBlank(code)) { | 67 | if (StringUtils.isNotBlank(code)) { |
68 | MemberDTO memberDTO = this.memberOperationService.findByCode(code); | 68 | MemberDTO memberDTO = this.memberOperationService.findByCode(code); |
69 | resources.setId(memberDTO.getId()); | 69 | resources.setId(memberDTO.getId()); |
70 | // BeanUtils.copyProperties(resources, memberDTO); | ||
71 | } | 70 | } |
72 | 71 | ||
73 | MemberDTO memberDTO = this.memberOperationService.update(resources); | 72 | MemberDTO memberDTO = this.memberOperationService.update(resources); | ... | ... |
... | @@ -40,13 +40,6 @@ public interface MemberService { | ... | @@ -40,13 +40,6 @@ public interface MemberService { |
40 | MemberDTO create(Member resources); | 40 | MemberDTO create(Member resources); |
41 | 41 | ||
42 | /** | 42 | /** |
43 | * 创建并返回会员 | ||
44 | * @param resources 会员 | ||
45 | * @return Member | ||
46 | */ | ||
47 | MemberDTO createAndReturnMember(Member resources); | ||
48 | |||
49 | /** | ||
50 | * 修改会员 | 43 | * 修改会员 |
51 | * @param resources | 44 | * @param resources |
52 | */ | 45 | */ |
... | @@ -91,4 +84,31 @@ public interface MemberService { | ... | @@ -91,4 +84,31 @@ public interface MemberService { |
91 | * @return | 84 | * @return |
92 | */ | 85 | */ |
93 | MemberDTO doUpdateMemberCoupon(Member member); | 86 | MemberDTO doUpdateMemberCoupon(Member member); |
87 | |||
88 | /** | ||
89 | * | ||
90 | * @param platformAccount | ||
91 | * @return | ||
92 | */ | ||
93 | MemberDTO findByPlatformAccount(String platformAccount); | ||
94 | |||
95 | /** | ||
96 | * | ||
97 | * @param member | ||
98 | * @return | ||
99 | */ | ||
100 | MemberDTO doUpdateMemberVipAndVipExpireTime(Member member); | ||
101 | |||
102 | /** | ||
103 | * | ||
104 | * @param member | ||
105 | * @return | ||
106 | */ | ||
107 | MemberDTO doUpdateMemberUserIptvIdAndBindIptvPlatformAndBindIptvTime(Member member); | ||
108 | |||
109 | /** | ||
110 | * | ||
111 | * @param member | ||
112 | */ | ||
113 | MemberDTO doUpdateMemberAvatarUrlAndNicknameAndGender(Member member); | ||
94 | } | 114 | } | ... | ... |
This diff is collapsed.
Click to expand it.
... | @@ -47,7 +47,7 @@ public class Rights implements Serializable { | ... | @@ -47,7 +47,7 @@ public class Rights implements Serializable { |
47 | 47 | ||
48 | /** 权益的实体类型 1:积分;2成长值;3优惠券 */ | 48 | /** 权益的实体类型 1:积分;2成长值;3优惠券 */ |
49 | @Column(name = "entity_type", nullable = false) | 49 | @Column(name = "entity_type", nullable = false) |
50 | private String entityType; | 50 | private Integer entityType; |
51 | 51 | ||
52 | /** 实体id */ | 52 | /** 实体id */ |
53 | @Column(name = "entity_id", nullable = false) | 53 | @Column(name = "entity_id", nullable = false) | ... | ... |
... | @@ -28,7 +28,7 @@ public class RightsDTO implements Serializable { | ... | @@ -28,7 +28,7 @@ public class RightsDTO implements Serializable { |
28 | private Integer type; | 28 | private Integer type; |
29 | 29 | ||
30 | /** 权益的实体类型 1:积分;2成长值;3优惠券 */ | 30 | /** 权益的实体类型 1:积分;2成长值;3优惠券 */ |
31 | private String entityType; | 31 | private Integer entityType; |
32 | 32 | ||
33 | /** 实体id */ | 33 | /** 实体id */ |
34 | private Long entityId; | 34 | private Long entityId; | ... | ... |
... | @@ -16,5 +16,5 @@ public interface TrTaskProgressRepository extends JpaRepository<TrTaskProgress, | ... | @@ -16,5 +16,5 @@ public interface TrTaskProgressRepository extends JpaRepository<TrTaskProgress, |
16 | @Query(value = "select id, member_id, task_id , current_action_amount , \n" + | 16 | @Query(value = "select id, member_id, task_id , current_action_amount , \n" + |
17 | " target_action_amount , `status` , completion_time,create_time,update_time from uc_tr_task_progress where member_id = ?1 \n" + | 17 | " target_action_amount , `status` , completion_time,create_time,update_time from uc_tr_task_progress where member_id = ?1 \n" + |
18 | " and task_id = ?2 and Date(completion_time) = ?3 ",nativeQuery = true) | 18 | " and task_id = ?2 and Date(completion_time) = ?3 ",nativeQuery = true) |
19 | List<TrTaskProgress> findByMemberIdAndTaskIdAndCompletionTime(Long memberId, Long taskId, String time1); | 19 | TrTaskProgress findByMemberIdAndTaskIdAndCompletionTime(Long memberId, Long taskId, String time1); |
20 | } | 20 | } | ... | ... |
... | @@ -2,6 +2,8 @@ package com.topdraw.business.module.task.progress.service; | ... | @@ -2,6 +2,8 @@ package com.topdraw.business.module.task.progress.service; |
2 | 2 | ||
3 | import com.topdraw.business.module.task.progress.domain.TrTaskProgress; | 3 | import com.topdraw.business.module.task.progress.domain.TrTaskProgress; |
4 | import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressDTO; | 4 | import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressDTO; |
5 | |||
6 | import java.time.LocalDateTime; | ||
5 | import java.util.List; | 7 | import java.util.List; |
6 | 8 | ||
7 | /** | 9 | /** |
... | @@ -21,13 +23,13 @@ public interface TrTaskProgressService { | ... | @@ -21,13 +23,13 @@ public interface TrTaskProgressService { |
21 | * | 23 | * |
22 | * @param resources | 24 | * @param resources |
23 | */ | 25 | */ |
24 | void create(TrTaskProgress resources); | 26 | TrTaskProgress create(TrTaskProgress resources, String date); |
25 | 27 | ||
26 | /** | 28 | /** |
27 | * | 29 | * |
28 | * @param resources | 30 | * @param resources |
29 | */ | 31 | */ |
30 | void update(TrTaskProgress resources); | 32 | TrTaskProgress update(TrTaskProgress resources, String date); |
31 | 33 | ||
32 | /** | 34 | /** |
33 | * | 35 | * |
... | @@ -42,5 +44,6 @@ public interface TrTaskProgressService { | ... | @@ -42,5 +44,6 @@ public interface TrTaskProgressService { |
42 | * @param time1 | 44 | * @param time1 |
43 | * @return | 45 | * @return |
44 | */ | 46 | */ |
45 | List<TrTaskProgressDTO> findByMemberIdAndTaskIdAndCompletionTime(Long memberId, Long taskId, String time1); | 47 | TrTaskProgressDTO findByMemberIdAndTaskIdAndCompletionTime(Long memberId, Long taskId, String time1); |
48 | |||
46 | } | 49 | } | ... | ... |
1 | package com.topdraw.business.module.task.progress.service.impl; | 1 | package com.topdraw.business.module.task.progress.service.impl; |
2 | 2 | ||
3 | import com.topdraw.business.module.task.progress.domain.TrTaskProgress; | 3 | import com.topdraw.business.module.task.progress.domain.TrTaskProgress; |
4 | import com.topdraw.config.RedisKeyConstants; | ||
4 | import com.topdraw.utils.ValidationUtil; | 5 | import com.topdraw.utils.ValidationUtil; |
5 | import com.topdraw.business.module.task.progress.repository.TrTaskProgressRepository; | 6 | import com.topdraw.business.module.task.progress.repository.TrTaskProgressRepository; |
6 | import com.topdraw.business.module.task.progress.service.TrTaskProgressService; | 7 | import com.topdraw.business.module.task.progress.service.TrTaskProgressService; |
7 | import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressDTO; | 8 | import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressDTO; |
8 | import com.topdraw.business.module.task.progress.service.mapper.TrTaskProgressMapper; | 9 | import com.topdraw.business.module.task.progress.service.mapper.TrTaskProgressMapper; |
10 | import lombok.extern.slf4j.Slf4j; | ||
9 | import org.springframework.beans.factory.annotation.Autowired; | 11 | import org.springframework.beans.factory.annotation.Autowired; |
12 | import org.springframework.cache.annotation.CachePut; | ||
13 | import org.springframework.cache.annotation.Cacheable; | ||
10 | import org.springframework.stereotype.Service; | 14 | import org.springframework.stereotype.Service; |
11 | import org.springframework.transaction.annotation.Propagation; | 15 | import org.springframework.transaction.annotation.Propagation; |
12 | import org.springframework.transaction.annotation.Transactional; | 16 | import org.springframework.transaction.annotation.Transactional; |
13 | import org.springframework.dao.EmptyResultDataAccessException; | 17 | import org.springframework.dao.EmptyResultDataAccessException; |
14 | import org.springframework.util.Assert; | 18 | import org.springframework.util.Assert; |
15 | 19 | ||
20 | import java.time.LocalDateTime; | ||
16 | import java.util.List; | 21 | import java.util.List; |
17 | 22 | ||
18 | /** | 23 | /** |
... | @@ -21,6 +26,7 @@ import java.util.List; | ... | @@ -21,6 +26,7 @@ import java.util.List; |
21 | */ | 26 | */ |
22 | @Service | 27 | @Service |
23 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | 28 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) |
29 | @Slf4j | ||
24 | public class TrTaskProgressServiceImpl implements TrTaskProgressService { | 30 | public class TrTaskProgressServiceImpl implements TrTaskProgressService { |
25 | 31 | ||
26 | @Autowired | 32 | @Autowired |
... | @@ -38,17 +44,21 @@ public class TrTaskProgressServiceImpl implements TrTaskProgressService { | ... | @@ -38,17 +44,21 @@ public class TrTaskProgressServiceImpl implements TrTaskProgressService { |
38 | 44 | ||
39 | @Override | 45 | @Override |
40 | @Transactional(rollbackFor = Exception.class) | 46 | @Transactional(rollbackFor = Exception.class) |
41 | public void create(TrTaskProgress resources) { | 47 | @Cacheable(cacheNames = RedisKeyConstants.cacheTaskProcessByMemberId, key = "#resources.memberId+':'+#resources.taskId+':'+#date", unless = "#result == null ") |
42 | this.trTaskProgressRepository.save(resources); | 48 | public TrTaskProgress create(TrTaskProgress resources, String date) { |
49 | TrTaskProgress trTaskProgress = this.trTaskProgressRepository.save(resources); | ||
50 | return trTaskProgress; | ||
43 | } | 51 | } |
44 | 52 | ||
45 | @Override | 53 | @Override |
46 | @Transactional(rollbackFor = Exception.class) | 54 | @Transactional(rollbackFor = Exception.class) |
47 | public void update(TrTaskProgress resources) { | 55 | @Cacheable(cacheNames = RedisKeyConstants.cacheTaskProcessByMemberId, key = "#resources.memberId+':'+#resources.taskId+':'+#date", unless = "#result == null ") |
48 | TrTaskProgress TrTaskProgress = this.trTaskProgressRepository.findById(resources.getId()).orElseGet(TrTaskProgress::new); | 56 | public TrTaskProgress update(TrTaskProgress resources, String date) { |
49 | ValidationUtil.isNull( TrTaskProgress.getId(),"TrTaskProgress","id",resources.getId()); | 57 | TrTaskProgress trTaskProgress = this.trTaskProgressRepository.findById(resources.getId()).orElseGet(TrTaskProgress::new); |
50 | TrTaskProgress.copy(resources); | 58 | ValidationUtil.isNull( trTaskProgress.getId(),"TrTaskProgress","id",resources.getId()); |
51 | this.trTaskProgressRepository.save(TrTaskProgress); | 59 | trTaskProgress.copy(resources); |
60 | TrTaskProgress save = this.trTaskProgressRepository.save(trTaskProgress); | ||
61 | return save; | ||
52 | } | 62 | } |
53 | 63 | ||
54 | @Override | 64 | @Override |
... | @@ -61,9 +71,12 @@ public class TrTaskProgressServiceImpl implements TrTaskProgressService { | ... | @@ -61,9 +71,12 @@ public class TrTaskProgressServiceImpl implements TrTaskProgressService { |
61 | } | 71 | } |
62 | 72 | ||
63 | @Override | 73 | @Override |
64 | public List<TrTaskProgressDTO> findByMemberIdAndTaskIdAndCompletionTime(Long memberId, Long taskId, String time1) { | 74 | @Cacheable(cacheNames = RedisKeyConstants.cacheTaskProcessByMemberId, key = "#memberId+':'+#taskId+':'+#time1", unless = "#result == null") |
75 | public TrTaskProgressDTO findByMemberIdAndTaskIdAndCompletionTime(Long memberId, Long taskId, String time1) { | ||
76 | log.info("从数据库查询当前会员今天是否完成了此任务, memberId ==>> {} || taskId ==>> {}", memberId, taskId); | ||
65 | return this.trTaskProgressMapper.toDto(this.trTaskProgressRepository.findByMemberIdAndTaskIdAndCompletionTime(memberId,taskId,time1)); | 77 | return this.trTaskProgressMapper.toDto(this.trTaskProgressRepository.findByMemberIdAndTaskIdAndCompletionTime(memberId,taskId,time1)); |
66 | } | 78 | } |
67 | 79 | ||
68 | 80 | ||
81 | |||
69 | } | 82 | } | ... | ... |
... | @@ -21,7 +21,13 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat | ... | @@ -21,7 +21,13 @@ public interface TaskRepository extends JpaRepository<Task, Long>, JpaSpecificat |
21 | @Modifying | 21 | @Modifying |
22 | @Transactional | 22 | @Transactional |
23 | @Query(value = "UPDATE `tr_task` SET `delete_mark` = 1 , `update_time` = now() WHERE `id` = ?1", nativeQuery = true) | 23 | @Query(value = "UPDATE `tr_task` SET `delete_mark` = 1 , `update_time` = now() WHERE `id` = ?1", nativeQuery = true) |
24 | void updateDeleteMark(Long id); | 24 | Integer updateDeleteMark(Long id); |
25 | 25 | ||
26 | Optional<Task> findByCode(String code); | 26 | Optional<Task> findByCode(String code); |
27 | |||
28 | @Query(value = "SELECT ta.*, attr.attr_str AS attr FROM tr_task ta LEFT JOIN tr_task_template tm ON ta.task_template_id = tm.id " + | ||
29 | " LEFT JOIN tr_task_attr attr ON attr.task_id = ta.id " + | ||
30 | " WHERE ta.`status` = 1 AND ta.valid_time <= now() and ta.expire_time >= now() AND ta.delete_mark = 0 AND " + | ||
31 | " tm.type = ?1 ", nativeQuery = true) | ||
32 | List<Task> findByEvent(Integer event); | ||
27 | } | 33 | } | ... | ... |
1 | package com.topdraw.business.module.task.service; | 1 | package com.topdraw.business.module.task.service; |
2 | 2 | ||
3 | import com.topdraw.business.module.task.domain.Task; | 3 | import com.topdraw.business.module.task.domain.Task; |
4 | import com.topdraw.business.module.task.progress.service.dto.TrTaskProgressDTO; | ||
4 | import com.topdraw.business.module.task.service.dto.TaskDTO; | 5 | import com.topdraw.business.module.task.service.dto.TaskDTO; |
6 | |||
7 | import java.time.LocalDateTime; | ||
5 | import java.util.List; | 8 | import java.util.List; |
6 | 9 | ||
7 | /** | 10 | /** |
... | @@ -47,11 +50,19 @@ public interface TaskService { | ... | @@ -47,11 +50,19 @@ public interface TaskService { |
47 | * | 50 | * |
48 | * @param task | 51 | * @param task |
49 | */ | 52 | */ |
50 | void delete(Task task); | 53 | Integer delete(Task task); |
51 | 54 | ||
52 | /** | 55 | /** |
53 | * | 56 | * |
54 | * @param id | 57 | * @param id |
55 | */ | 58 | */ |
56 | void delete(Long id); | 59 | Integer delete(Long id); |
60 | |||
61 | /** | ||
62 | * | ||
63 | * @param event | ||
64 | * @return | ||
65 | */ | ||
66 | List<Task> findByEvent(Integer event); | ||
67 | |||
57 | } | 68 | } | ... | ... |
member-service-impl/src/main/java/com/topdraw/business/module/task/service/impl/TaskServiceImpl.java
... | @@ -5,11 +5,15 @@ import com.topdraw.business.module.task.repository.TaskRepository; | ... | @@ -5,11 +5,15 @@ import com.topdraw.business.module.task.repository.TaskRepository; |
5 | import com.topdraw.business.module.task.service.TaskService; | 5 | import com.topdraw.business.module.task.service.TaskService; |
6 | import com.topdraw.business.module.task.service.dto.TaskDTO; | 6 | import com.topdraw.business.module.task.service.dto.TaskDTO; |
7 | import com.topdraw.business.module.task.service.mapper.TaskMapper; | 7 | import com.topdraw.business.module.task.service.mapper.TaskMapper; |
8 | import com.topdraw.config.RedisKeyConstants; | ||
9 | import lombok.extern.slf4j.Slf4j; | ||
8 | import org.springframework.beans.factory.annotation.Autowired; | 10 | import org.springframework.beans.factory.annotation.Autowired; |
11 | import org.springframework.cache.annotation.Cacheable; | ||
9 | import org.springframework.stereotype.Service; | 12 | import org.springframework.stereotype.Service; |
10 | import org.springframework.transaction.annotation.Propagation; | 13 | import org.springframework.transaction.annotation.Propagation; |
11 | import org.springframework.transaction.annotation.Transactional; | 14 | import org.springframework.transaction.annotation.Transactional; |
12 | 15 | ||
16 | import java.util.ArrayList; | ||
13 | import java.util.List; | 17 | import java.util.List; |
14 | import java.util.Objects; | 18 | import java.util.Objects; |
15 | 19 | ||
... | @@ -19,6 +23,7 @@ import java.util.Objects; | ... | @@ -19,6 +23,7 @@ import java.util.Objects; |
19 | */ | 23 | */ |
20 | @Service | 24 | @Service |
21 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) | 25 | @Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) |
26 | @Slf4j | ||
22 | public class TaskServiceImpl implements TaskService { | 27 | public class TaskServiceImpl implements TaskService { |
23 | 28 | ||
24 | @Autowired | 29 | @Autowired |
... | @@ -56,14 +61,20 @@ public class TaskServiceImpl implements TaskService { | ... | @@ -56,14 +61,20 @@ public class TaskServiceImpl implements TaskService { |
56 | } | 61 | } |
57 | 62 | ||
58 | @Override | 63 | @Override |
59 | public void delete(Task task) { | 64 | public Integer delete(Task task) { |
60 | Long id = task.getId(); | 65 | Long id = task.getId(); |
61 | this.delete(id); | 66 | return this.delete(id); |
62 | } | 67 | } |
63 | 68 | ||
64 | @Override | 69 | @Override |
65 | public void delete(Long id) { | 70 | public Integer delete(Long id) { |
66 | this.taskRepository.updateDeleteMark(id); | 71 | return this.taskRepository.updateDeleteMark(id); |
67 | } | 72 | } |
68 | 73 | ||
74 | @Override | ||
75 | // @Cacheable(value = RedisKeyConstants.cacheTaskByTaskTemplateId, key = "#event" , unless = "#result.size() == 0") | ||
76 | public List<Task> findByEvent(Integer event) { | ||
77 | log.info("从数据库查询事件列表 ==>> {}", event); | ||
78 | return Objects.nonNull(event) ? this.taskRepository.findByEvent(event) : new ArrayList<>(); | ||
79 | } | ||
69 | } | 80 | } | ... | ... |
... | @@ -26,4 +26,6 @@ public interface TaskTemplateRepository extends JpaRepository<TaskTemplate, Long | ... | @@ -26,4 +26,6 @@ public interface TaskTemplateRepository extends JpaRepository<TaskTemplate, Long |
26 | @Transactional | 26 | @Transactional |
27 | @Query(value = "UPDATE `tr_task_template` SET `delete_mark` = 1 , `update_time` = now() WHERE `id` = ?1", nativeQuery = true) | 27 | @Query(value = "UPDATE `tr_task_template` SET `delete_mark` = 1 , `update_time` = now() WHERE `id` = ?1", nativeQuery = true) |
28 | void updateDeleteMark(Long id); | 28 | void updateDeleteMark(Long id); |
29 | |||
30 | Long countByCodeAndType(String code, Integer type); | ||
29 | } | 31 | } | ... | ... |
... | @@ -61,4 +61,11 @@ public interface TaskTemplateService { | ... | @@ -61,4 +61,11 @@ public interface TaskTemplateService { |
61 | * @return | 61 | * @return |
62 | */ | 62 | */ |
63 | TaskTemplateDTO findByType(Integer event); | 63 | TaskTemplateDTO findByType(Integer event); |
64 | |||
65 | /** | ||
66 | * | ||
67 | * @param taskTemplate | ||
68 | * @return | ||
69 | */ | ||
70 | Long countByCodeAndType(TaskTemplate taskTemplate); | ||
64 | } | 71 | } | ... | ... |
... | @@ -83,4 +83,10 @@ public class TaskTemplateServiceImpl implements TaskTemplateService { | ... | @@ -83,4 +83,10 @@ public class TaskTemplateServiceImpl implements TaskTemplateService { |
83 | return Objects.nonNull(event) ? this.taskTemplateMapper.toDto(this.taskTemplateRepository.findByType(event).orElseGet(TaskTemplate::new)) : new TaskTemplateDTO(); | 83 | return Objects.nonNull(event) ? this.taskTemplateMapper.toDto(this.taskTemplateRepository.findByType(event).orElseGet(TaskTemplate::new)) : new TaskTemplateDTO(); |
84 | } | 84 | } |
85 | 85 | ||
86 | @Override | ||
87 | public Long countByCodeAndType(TaskTemplate taskTemplate) { | ||
88 | Long count = this.taskTemplateRepository.countByCodeAndType(taskTemplate.getCode(), taskTemplate.getType()); | ||
89 | return count; | ||
90 | } | ||
91 | |||
86 | } | 92 | } | ... | ... |
... | @@ -5,6 +5,8 @@ import org.springframework.data.jpa.repository.JpaRepository; | ... | @@ -5,6 +5,8 @@ import org.springframework.data.jpa.repository.JpaRepository; |
5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; | 5 | import org.springframework.data.jpa.repository.JpaSpecificationExecutor; |
6 | import org.springframework.data.jpa.repository.Modifying; | 6 | import org.springframework.data.jpa.repository.Modifying; |
7 | import org.springframework.data.jpa.repository.Query; | 7 | import org.springframework.data.jpa.repository.Query; |
8 | import org.springframework.data.repository.query.Param; | ||
9 | import org.springframework.transaction.annotation.Transactional; | ||
8 | 10 | ||
9 | import java.time.LocalDateTime; | 11 | import java.time.LocalDateTime; |
10 | import java.util.Optional; | 12 | import java.util.Optional; |
... | @@ -24,4 +26,9 @@ public interface UserTvRepository extends JpaRepository<UserTv, Long>, JpaSpecif | ... | @@ -24,4 +26,9 @@ public interface UserTvRepository extends JpaRepository<UserTv, Long>, JpaSpecif |
24 | @Modifying | 26 | @Modifying |
25 | @Query(value = "UPDATE `uc_user_tv` SET `vis_user_id` = ?2, `update_time` = ?3 WHERE `id` = ?1", nativeQuery = true) | 27 | @Query(value = "UPDATE `uc_user_tv` SET `vis_user_id` = ?2, `update_time` = ?3 WHERE `id` = ?1", nativeQuery = true) |
26 | Integer updateUserTvVisUserId(Long id, Long visUserId, LocalDateTime now); | 28 | Integer updateUserTvVisUserId(Long id, Long visUserId, LocalDateTime now); |
29 | |||
30 | @Modifying | ||
31 | @Query(value = "UPDATE `uc_user_tv` SET `priority_member_code` = :#{#resources.priorityMemberCode}, `update_time` = now()" + | ||
32 | " WHERE `id` = :#{#resources.id}", nativeQuery = true) | ||
33 | Integer updatePriorityMemberCode(@Param("resources") UserTv resources); | ||
27 | } | 34 | } | ... | ... |
... | @@ -69,7 +69,7 @@ public interface UserTvService { | ... | @@ -69,7 +69,7 @@ public interface UserTvService { |
69 | * @param memberCode | 69 | * @param memberCode |
70 | * @return | 70 | * @return |
71 | */ | 71 | */ |
72 | boolean checkPriorityMemberByMemberIdOrMemberCode(Long memberId,String memberCode); | 72 | boolean checkPriorityMemberByMemberIdOrMemberCode(Long memberId, String memberCode); |
73 | 73 | ||
74 | /** | 74 | /** |
75 | * | 75 | * |
... | @@ -84,4 +84,11 @@ public interface UserTvService { | ... | @@ -84,4 +84,11 @@ public interface UserTvService { |
84 | * @return | 84 | * @return |
85 | */ | 85 | */ |
86 | UserTvDTO updateUserTvVisUserId(UserTv resources); | 86 | UserTvDTO updateUserTvVisUserId(UserTv resources); |
87 | |||
88 | /** | ||
89 | * | ||
90 | * @param resources | ||
91 | * @return | ||
92 | */ | ||
93 | UserTvDTO doUpdatePriorityMemberCode(UserTv resources); | ||
87 | } | 94 | } | ... | ... |
... | @@ -5,6 +5,7 @@ import com.topdraw.business.module.member.service.MemberService; | ... | @@ -5,6 +5,7 @@ import com.topdraw.business.module.member.service.MemberService; |
5 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 5 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
6 | import com.topdraw.business.module.user.iptv.domain.UserTv; | 6 | import com.topdraw.business.module.user.iptv.domain.UserTv; |
7 | import com.topdraw.business.process.service.impl.UserOperationServiceImpl; | 7 | import com.topdraw.business.process.service.impl.UserOperationServiceImpl; |
8 | import com.topdraw.config.RedisKeyConstants; | ||
8 | import com.topdraw.exception.EntityNotFoundException; | 9 | import com.topdraw.exception.EntityNotFoundException; |
9 | import com.topdraw.exception.GlobeExceptionMsg; | 10 | import com.topdraw.exception.GlobeExceptionMsg; |
10 | import com.topdraw.utils.ValidationUtil; | 11 | import com.topdraw.utils.ValidationUtil; |
... | @@ -16,6 +17,7 @@ import lombok.extern.slf4j.Slf4j; | ... | @@ -16,6 +17,7 @@ import lombok.extern.slf4j.Slf4j; |
16 | import org.apache.commons.lang3.StringUtils; | 17 | import org.apache.commons.lang3.StringUtils; |
17 | import org.springframework.aop.framework.AopContext; | 18 | import org.springframework.aop.framework.AopContext; |
18 | import org.springframework.beans.factory.annotation.Autowired; | 19 | import org.springframework.beans.factory.annotation.Autowired; |
20 | import org.springframework.cache.annotation.Cacheable; | ||
19 | import org.springframework.stereotype.Service; | 21 | import org.springframework.stereotype.Service; |
20 | import org.springframework.transaction.annotation.Propagation; | 22 | import org.springframework.transaction.annotation.Propagation; |
21 | import org.springframework.transaction.annotation.Transactional; | 23 | import org.springframework.transaction.annotation.Transactional; |
... | @@ -96,6 +98,16 @@ public class UserTvServiceImpl implements UserTvService { | ... | @@ -96,6 +98,16 @@ public class UserTvServiceImpl implements UserTvService { |
96 | return null; | 98 | return null; |
97 | } | 99 | } |
98 | 100 | ||
101 | @Override | ||
102 | @Transactional(rollbackFor = Exception.class) | ||
103 | public UserTvDTO doUpdatePriorityMemberCode(UserTv resources) { | ||
104 | Integer count = this.userTvRepository.updatePriorityMemberCode(resources); | ||
105 | if (Objects.nonNull(count) && count > 0) { | ||
106 | UserTv userTv = this.userTvRepository.findById(resources.getId()).orElseGet(UserTv::new); | ||
107 | return this.userTvMapper.toDto(userTv); | ||
108 | } | ||
109 | return this.userTvMapper.toDto(resources); | ||
110 | } | ||
99 | 111 | ||
100 | 112 | ||
101 | private MemberDTO findMemberByMemberCode(String memberCode) { | 113 | private MemberDTO findMemberByMemberCode(String memberCode) { |
... | @@ -157,7 +169,9 @@ public class UserTvServiceImpl implements UserTvService { | ... | @@ -157,7 +169,9 @@ public class UserTvServiceImpl implements UserTvService { |
157 | } | 169 | } |
158 | 170 | ||
159 | @Override | 171 | @Override |
172 | @Cacheable(cacheNames = RedisKeyConstants.cacheUserTvByPlatformAccount, key = "#platformAccount") | ||
160 | public UserTvDTO findByPlatformAccount(String platformAccount) { | 173 | public UserTvDTO findByPlatformAccount(String platformAccount) { |
174 | log.info("从数据库通过大屏账号检索大屏账号信息"); | ||
161 | Optional<UserTv> userTv = this.userTvRepository.findByPlatformAccount(platformAccount); | 175 | Optional<UserTv> userTv = this.userTvRepository.findByPlatformAccount(platformAccount); |
162 | if (userTv.isPresent()) { | 176 | if (userTv.isPresent()) { |
163 | ValidationUtil.isNull( userTv.get().getId(),"UserTv","id",userTv.get().getId()); | 177 | ValidationUtil.isNull( userTv.get().getId(),"UserTv","id",userTv.get().getId()); | ... | ... |
... | @@ -29,9 +29,7 @@ public interface UserWeixinRepository extends JpaRepository<UserWeixin, Long>, J | ... | @@ -29,9 +29,7 @@ public interface UserWeixinRepository extends JpaRepository<UserWeixin, Long>, J |
29 | Optional<UserWeixin> findFirstByMemberId(Long memberId); | 29 | Optional<UserWeixin> findFirstByMemberId(Long memberId); |
30 | 30 | ||
31 | @Modifying | 31 | @Modifying |
32 | @Transactional | 32 | @Query(value = "UPDATE `uc_user_weixin` SET update_time = now(), `status` = :#{#resources.status}" + |
33 | @Query(value = "update `uc_user_weixin` set update_time = :#{#resources.updateTime} " + | 33 | " WHERE `id` = :#{#resources.id}", nativeQuery = true) |
34 | "where appid = :#{#resources.appid} and openid = :#{#resources.openid}", nativeQuery = true) | 34 | Integer updateWeixinStatus(@Param("resources") UserWeixin resource); |
35 | void updateTime(@Param("resources") UserWeixin resources); | ||
36 | |||
37 | } | 35 | } | ... | ... |
... | @@ -31,12 +31,6 @@ public interface UserWeixinService { | ... | @@ -31,12 +31,6 @@ public interface UserWeixinService { |
31 | 31 | ||
32 | /** | 32 | /** |
33 | * | 33 | * |
34 | * @param resources | ||
35 | */ | ||
36 | void updateTime(UserWeixin resources); | ||
37 | |||
38 | /** | ||
39 | * | ||
40 | * @param id | 34 | * @param id |
41 | */ | 35 | */ |
42 | void delete(Long id); | 36 | void delete(Long id); |
... | @@ -87,4 +81,11 @@ public interface UserWeixinService { | ... | @@ -87,4 +81,11 @@ public interface UserWeixinService { |
87 | * @return | 81 | * @return |
88 | */ | 82 | */ |
89 | UserWeixinDTO findFirstByMemberId(Long memberId); | 83 | UserWeixinDTO findFirstByMemberId(Long memberId); |
84 | |||
85 | /** | ||
86 | * | ||
87 | * @param userWeixin | ||
88 | * @return | ||
89 | */ | ||
90 | UserWeixinDTO doUpdateWeixinStatus(UserWeixin userWeixin); | ||
90 | } | 91 | } | ... | ... |
... | @@ -14,6 +14,8 @@ import org.springframework.transaction.annotation.Transactional; | ... | @@ -14,6 +14,8 @@ import org.springframework.transaction.annotation.Transactional; |
14 | import org.springframework.dao.EmptyResultDataAccessException; | 14 | import org.springframework.dao.EmptyResultDataAccessException; |
15 | import org.springframework.util.Assert; | 15 | import org.springframework.util.Assert; |
16 | 16 | ||
17 | import java.util.Objects; | ||
18 | |||
17 | /** | 19 | /** |
18 | * @author XiangHan | 20 | * @author XiangHan |
19 | * @date 2021-12-16 | 21 | * @date 2021-12-16 |
... | @@ -54,11 +56,6 @@ public class UserWeixinServiceImpl implements UserWeixinService { | ... | @@ -54,11 +56,6 @@ public class UserWeixinServiceImpl implements UserWeixinService { |
54 | } | 56 | } |
55 | 57 | ||
56 | @Override | 58 | @Override |
57 | public void updateTime(UserWeixin resources) { | ||
58 | this.userWeixinRepository.updateTime(resources); | ||
59 | } | ||
60 | |||
61 | @Override | ||
62 | @Transactional(rollbackFor = Exception.class) | 59 | @Transactional(rollbackFor = Exception.class) |
63 | public void delete(Long id) { | 60 | public void delete(Long id) { |
64 | Assert.notNull(id, "The given id must not be null!"); | 61 | Assert.notNull(id, "The given id must not be null!"); |
... | @@ -104,4 +101,15 @@ public class UserWeixinServiceImpl implements UserWeixinService { | ... | @@ -104,4 +101,15 @@ public class UserWeixinServiceImpl implements UserWeixinService { |
104 | return this.userWeixinMapper.toDto(userWeixin); | 101 | return this.userWeixinMapper.toDto(userWeixin); |
105 | } | 102 | } |
106 | 103 | ||
104 | @Override | ||
105 | @Transactional(rollbackFor = Exception.class) | ||
106 | public UserWeixinDTO doUpdateWeixinStatus(UserWeixin resource) { | ||
107 | Integer count = this.userWeixinRepository.updateWeixinStatus(resource); | ||
108 | if (Objects.nonNull(count) && count > 0) { | ||
109 | UserWeixin userWeixin = this.userWeixinRepository.findById(resource.getId()).orElseGet(UserWeixin::new); | ||
110 | return this.userWeixinMapper.toDto(userWeixin); | ||
111 | } | ||
112 | return this.userWeixinMapper.toDto(resource); | ||
113 | } | ||
114 | |||
107 | } | 115 | } | ... | ... |
... | @@ -5,6 +5,7 @@ import com.topdraw.business.process.service.ExpOperationService; | ... | @@ -5,6 +5,7 @@ import com.topdraw.business.process.service.ExpOperationService; |
5 | import com.topdraw.common.ResultInfo; | 5 | import com.topdraw.common.ResultInfo; |
6 | import io.swagger.annotations.Api; | 6 | import io.swagger.annotations.Api; |
7 | import io.swagger.annotations.ApiOperation; | 7 | import io.swagger.annotations.ApiOperation; |
8 | import lombok.extern.slf4j.Slf4j; | ||
8 | import org.springframework.beans.factory.annotation.Autowired; | 9 | import org.springframework.beans.factory.annotation.Autowired; |
9 | import org.springframework.validation.annotation.Validated; | 10 | import org.springframework.validation.annotation.Validated; |
10 | import org.springframework.web.bind.annotation.PostMapping; | 11 | import org.springframework.web.bind.annotation.PostMapping; |
... | @@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController; | ... | @@ -14,6 +15,7 @@ import org.springframework.web.bind.annotation.RestController; |
14 | 15 | ||
15 | import java.util.Arrays; | 16 | import java.util.Arrays; |
16 | import java.util.List; | 17 | import java.util.List; |
18 | import java.util.Objects; | ||
17 | 19 | ||
18 | /** | 20 | /** |
19 | * @author XiangHan | 21 | * @author XiangHan |
... | @@ -22,14 +24,27 @@ import java.util.List; | ... | @@ -22,14 +24,27 @@ import java.util.List; |
22 | @Api(tags = "成长值管理") | 24 | @Api(tags = "成长值管理") |
23 | @RestController | 25 | @RestController |
24 | @RequestMapping("/uce/expOperation") | 26 | @RequestMapping("/uce/expOperation") |
27 | @Slf4j | ||
25 | public class ExpOperationController { | 28 | public class ExpOperationController { |
26 | 29 | ||
27 | @Autowired | 30 | @Autowired |
28 | private ExpOperationService expOperationService; | 31 | private ExpOperationService expOperationService; |
29 | 32 | ||
30 | @PostMapping(value = "/grantExpByManual") | 33 | @PostMapping(value = "/addExp") |
31 | @ApiOperation("手动发放成长值") | 34 | @ApiOperation("手动发放成长值") |
32 | public ResultInfo grantExpByManual(@Validated @RequestBody TempExp tempExp) { | 35 | public ResultInfo grantExpByManual(@Validated @RequestBody TempExp tempExp) { |
36 | log.info("手动发放成长值,参数 ==>> {}", tempExp); | ||
37 | Long memberId = tempExp.getMemberId(); | ||
38 | if (Objects.isNull(memberId)) { | ||
39 | log.error("发放成长值失败,参数错误,无会员id"); | ||
40 | return ResultInfo.failure("发放成长值失败,参数错误,无会员id"); | ||
41 | } | ||
42 | |||
43 | Long rewardExp = tempExp.getRewardExp(); | ||
44 | if (Objects.isNull(rewardExp) || rewardExp <= 0L) { | ||
45 | log.error("发放成长值失败,参数错误,成长值为空或者小于0 ==>> {}", rewardExp); | ||
46 | return ResultInfo.failure("发放成长值失败,参数错误,成长值为空或者小于0"); | ||
47 | } | ||
33 | List<TempExp> tempExpList = Arrays.asList(tempExp); | 48 | List<TempExp> tempExpList = Arrays.asList(tempExp); |
34 | this.expOperationService.grantExpByManual(tempExpList); | 49 | this.expOperationService.grantExpByManual(tempExpList); |
35 | return ResultInfo.success(); | 50 | return ResultInfo.success(); | ... | ... |
... | @@ -14,6 +14,7 @@ import com.topdraw.exception.BadRequestException; | ... | @@ -14,6 +14,7 @@ import com.topdraw.exception.BadRequestException; |
14 | import io.swagger.annotations.Api; | 14 | import io.swagger.annotations.Api; |
15 | import io.swagger.annotations.ApiOperation; | 15 | import io.swagger.annotations.ApiOperation; |
16 | import lombok.extern.slf4j.Slf4j; | 16 | import lombok.extern.slf4j.Slf4j; |
17 | import org.apache.commons.lang3.StringUtils; | ||
17 | import org.springframework.beans.BeanUtils; | 18 | import org.springframework.beans.BeanUtils; |
18 | import org.springframework.beans.factory.annotation.Autowired; | 19 | import org.springframework.beans.factory.annotation.Autowired; |
19 | import org.springframework.validation.annotation.Validated; | 20 | import org.springframework.validation.annotation.Validated; |
... | @@ -50,7 +51,7 @@ public class MemberOperationController { | ... | @@ -50,7 +51,7 @@ public class MemberOperationController { |
50 | if (Objects.nonNull(vipExpireTime)) { | 51 | if (Objects.nonNull(vipExpireTime)) { |
51 | member.setVipExpireTime(vipExpireTime); | 52 | member.setVipExpireTime(vipExpireTime); |
52 | } | 53 | } |
53 | this.memberOperationService.update(member); | 54 | this.memberOperationService.doUpdateMemberVipAndVipExpireTime(member); |
54 | return ResultInfo.success(); | 55 | return ResultInfo.success(); |
55 | } | 56 | } |
56 | 57 | ||
... | @@ -59,23 +60,28 @@ public class MemberOperationController { | ... | @@ -59,23 +60,28 @@ public class MemberOperationController { |
59 | @AnonymousAccess | 60 | @AnonymousAccess |
60 | public ResultInfo updateVipByMemberCode(@Validated(value = {UpdateGroup.class}) @RequestBody MemberOperationBean resources) { | 61 | public ResultInfo updateVipByMemberCode(@Validated(value = {UpdateGroup.class}) @RequestBody MemberOperationBean resources) { |
61 | log.info("member ==>> doUpdateVipByCode ==>> param ==>> [{}]",resources); | 62 | log.info("member ==>> doUpdateVipByCode ==>> param ==>> [{}]",resources); |
63 | String memberCode = resources.getMemberCode(); | ||
64 | if (StringUtils.isBlank(memberCode)) { | ||
65 | log.error("参数错误,memberCode 不存在"); | ||
66 | return ResultInfo.failure("参数错误,memberCode 不存在"); | ||
67 | } | ||
68 | |||
62 | Integer vip = resources.getVip(); | 69 | Integer vip = resources.getVip(); |
70 | if (Objects.isNull(vip) || vip < 0) { | ||
71 | log.error("参数错误,vip为空或者小于0 , vip ==>> {}", vip); | ||
72 | return ResultInfo.failure("参数错误,vip为空或者小于0"); | ||
73 | } | ||
63 | Timestamp vipExpireTime = resources.getVipExpireTime(); | 74 | Timestamp vipExpireTime = resources.getVipExpireTime(); |
64 | String memberCode = resources.getMemberCode(); | 75 | |
65 | MemberDTO memberDTO = this.memberOperationService.findByCode(memberCode); | ||
66 | 76 | ||
67 | Member member = new Member(); | 77 | Member member = new Member(); |
68 | BeanUtils.copyProperties(memberDTO, member); | 78 | member.setCode(memberCode); |
69 | if (Objects.nonNull(vip)) { | 79 | member.setVip(vip); |
70 | member.setVip(vip); | 80 | member.setVipExpireTime(vipExpireTime); |
71 | } | ||
72 | if (Objects.nonNull(vipExpireTime)) { | ||
73 | member.setVipExpireTime(vipExpireTime); | ||
74 | } | ||
75 | 81 | ||
82 | MemberDTO memberDTO = this.memberOperationService.doUpdateMemberVipAndVipExpireTime(member); | ||
76 | this.createVipHistory(memberDTO.getId(), memberDTO.getCode(), vip, vipExpireTime); | 83 | this.createVipHistory(memberDTO.getId(), memberDTO.getCode(), vip, vipExpireTime); |
77 | 84 | ||
78 | this.memberOperationService.updateMemberVip(member); | ||
79 | return ResultInfo.success(); | 85 | return ResultInfo.success(); |
80 | } | 86 | } |
81 | 87 | ||
... | @@ -93,6 +99,7 @@ public class MemberOperationController { | ... | @@ -93,6 +99,7 @@ public class MemberOperationController { |
93 | @GetMapping("/getMemberProfileAndCheckVip/{appId}/{memberId}") | 99 | @GetMapping("/getMemberProfileAndCheckVip/{appId}/{memberId}") |
94 | @ApiOperation("获取会员基本信息并且检查vip状态") | 100 | @ApiOperation("获取会员基本信息并且检查vip状态") |
95 | @AnonymousAccess | 101 | @AnonymousAccess |
102 | @Deprecated | ||
96 | public IResultInfo getMemberProfileAndCheckVip(@PathVariable(value = "appId") String appId, @PathVariable(value = "memberId") Long memberId) { | 103 | public IResultInfo getMemberProfileAndCheckVip(@PathVariable(value = "appId") String appId, @PathVariable(value = "memberId") Long memberId) { |
97 | MemberProfileDTO memberProfileDTO = this.memberOperationService.getMemberProfileAndCheckVip(memberId, appId); | 104 | MemberProfileDTO memberProfileDTO = this.memberOperationService.getMemberProfileAndCheckVip(memberId, appId); |
98 | return ResultInfo.success(memberProfileDTO); | 105 | return ResultInfo.success(memberProfileDTO); | ... | ... |
... | @@ -49,6 +49,7 @@ public class PointsOperationController { | ... | @@ -49,6 +49,7 @@ public class PointsOperationController { |
49 | @GetMapping(value = "/cleanInvalidPointsAndCalculateCurrentPoints/{id}") | 49 | @GetMapping(value = "/cleanInvalidPointsAndCalculateCurrentPoints/{id}") |
50 | @ApiOperation("清除过期积分并计算总积分,供客户端会员查询积分时调用") | 50 | @ApiOperation("清除过期积分并计算总积分,供客户端会员查询积分时调用") |
51 | @AnonymousAccess | 51 | @AnonymousAccess |
52 | @Deprecated | ||
52 | public ResultInfo cleanInvalidPointsAndCalculateCurrentPoints(@PathVariable("id") Long id) { | 53 | public ResultInfo cleanInvalidPointsAndCalculateCurrentPoints(@PathVariable("id") Long id) { |
53 | Long aLong = this.pointsOperationService.cleanInvalidPointsAndCalculateCurrentPoints(id); | 54 | Long aLong = this.pointsOperationService.cleanInvalidPointsAndCalculateCurrentPoints(id); |
54 | return ResultInfo.success(Objects.isNull(aLong) ? 0L : aLong); | 55 | return ResultInfo.success(Objects.isNull(aLong) ? 0L : aLong); |
... | @@ -59,15 +60,22 @@ public class PointsOperationController { | ... | @@ -59,15 +60,22 @@ public class PointsOperationController { |
59 | @ApiOperation("手动发放积分") | 60 | @ApiOperation("手动发放积分") |
60 | @AnonymousAccess | 61 | @AnonymousAccess |
61 | public ResultInfo addPoints(@Validated @RequestBody TempPoints tempPoints) { | 62 | public ResultInfo addPoints(@Validated @RequestBody TempPoints tempPoints) { |
63 | log.info("手动发放积分,参数 ==>>{} ", tempPoints); | ||
62 | Long memberId = tempPoints.getMemberId(); | 64 | Long memberId = tempPoints.getMemberId(); |
65 | if (Objects.isNull(memberId)) { | ||
66 | log.error("积分发放失败,参数错误,会员id 不存在"); | ||
67 | return ResultInfo.failure("积分发放失败,参数错误"); | ||
68 | } | ||
63 | Long points = tempPoints.getPoints(); | 69 | Long points = tempPoints.getPoints(); |
64 | Assert.notNull(memberId,"memberId can't be null!"); | 70 | if (Objects.isNull(points) || points <= 0L) { |
65 | Assert.notNull(points,"points can't be null!"); | 71 | log.error("积分发放失败,参数错误,积分不存在或者积分小于0"); |
72 | return ResultInfo.failure("积分发放失败,参数错误"); | ||
73 | } | ||
66 | MemberDTO memberDTO = this.memberService.findById(memberId); | 74 | MemberDTO memberDTO = this.memberService.findById(memberId); |
67 | if (Objects.nonNull(memberDTO)) { | 75 | if (Objects.nonNull(memberDTO)) { |
68 | String code = memberDTO.getCode(); | 76 | String code = memberDTO.getCode(); |
69 | Assert.notNull(code,"code can't be null!"); | ||
70 | tempPoints.setMemberCode(code); | 77 | tempPoints.setMemberCode(code); |
78 | tempPoints.setMemberId(memberDTO.getId()); | ||
71 | this.pointsOperationService.grantPointsByManualByTempPoints(tempPoints); | 79 | this.pointsOperationService.grantPointsByManualByTempPoints(tempPoints); |
72 | } | 80 | } |
73 | return ResultInfo.success(); | 81 | return ResultInfo.success(); |
... | @@ -176,7 +184,6 @@ public class PointsOperationController { | ... | @@ -176,7 +184,6 @@ public class PointsOperationController { |
176 | return ResultInfo.success(Arrays.asList(b),description); | 184 | return ResultInfo.success(Arrays.asList(b),description); |
177 | } | 185 | } |
178 | 186 | ||
179 | // @Log("积分兑换商品") | ||
180 | @PostMapping(value = "/consumeItemPoints") | 187 | @PostMapping(value = "/consumeItemPoints") |
181 | @ApiOperation("积分兑换商品") | 188 | @ApiOperation("积分兑换商品") |
182 | @AnonymousAccess | 189 | @AnonymousAccess | ... | ... |
... | @@ -42,11 +42,11 @@ public class TaskOperationController { | ... | @@ -42,11 +42,11 @@ public class TaskOperationController { |
42 | long l = System.currentTimeMillis(); | 42 | long l = System.currentTimeMillis(); |
43 | 43 | ||
44 | // 任务处理 | 44 | // 任务处理 |
45 | this.taskOperationService.dealTask(criteria.getContent()); | 45 | ResultInfo resultInfo = this.taskOperationService.dealTask(criteria.getContent()); |
46 | long l2 = System.currentTimeMillis(); | 46 | long l2 = System.currentTimeMillis(); |
47 | log.info("事件处理,结束,总耗时 ==>> {}", (l2-l)); | 47 | log.info("事件处理,结束,总耗时 ==>> {}", (l2-l)); |
48 | 48 | ||
49 | return ResultInfo.success(); | 49 | return resultInfo; |
50 | } | 50 | } |
51 | 51 | ||
52 | /** | 52 | /** |
... | @@ -99,12 +99,17 @@ public class TaskOperationController { | ... | @@ -99,12 +99,17 @@ public class TaskOperationController { |
99 | @PostMapping(value = "/deleteTask") | 99 | @PostMapping(value = "/deleteTask") |
100 | @ApiOperation("删除任务") | 100 | @ApiOperation("删除任务") |
101 | @AnonymousAccess | 101 | @AnonymousAccess |
102 | public void deleteTask(@RequestBody @Validated Task task) { | 102 | public ResultInfo deleteTask(@RequestBody @Validated Task task) { |
103 | log.info("taskOperation ==>> deleteTask ==>> param ==>> {}", task); | 103 | log.info("taskOperation ==>> deleteTask ==>> param ==>> {}", task); |
104 | 104 | ||
105 | Long id = task.getId(); | 105 | Long id = task.getId(); |
106 | // 删除任务 | 106 | // 删除任务 |
107 | this.taskOperationService.deleteTask(id); | 107 | Integer integer = this.taskOperationService.deleteTask(id); |
108 | if (integer > 1) { | ||
109 | return ResultInfo.success("删除成功"); | ||
110 | } else { | ||
111 | return ResultInfo.failure("删除失败"); | ||
112 | } | ||
108 | } | 113 | } |
109 | 114 | ||
110 | /** | 115 | /** | ... | ... |
... | @@ -34,9 +34,8 @@ public class TaskTemplateOperationController { | ... | @@ -34,9 +34,8 @@ public class TaskTemplateOperationController { |
34 | log.info("taskTemplateOperation ==>> create ==>> param ==>> {}", taskTemplate); | 34 | log.info("taskTemplateOperation ==>> create ==>> param ==>> {}", taskTemplate); |
35 | String code = taskTemplate.getCode(); | 35 | String code = taskTemplate.getCode(); |
36 | Integer type = taskTemplate.getType(); | 36 | Integer type = taskTemplate.getType(); |
37 | TaskTemplateDTO taskTemplateDTO_ = this.taskTemplateOperationService.findByCode(code); | 37 | Long count = this.taskTemplateOperationService.countByCodeAndType(taskTemplate); |
38 | TaskTemplateDTO taskTemplateDTO_1 = this.taskTemplateOperationService.findByType(type); | 38 | if (count < 1) { |
39 | if (Objects.isNull(taskTemplateDTO_.getId()) && Objects.isNull(taskTemplateDTO_1.getId())) { | ||
40 | // 新增任务 | 39 | // 新增任务 |
41 | this.taskTemplateOperationService.create(taskTemplate); | 40 | this.taskTemplateOperationService.create(taskTemplate); |
42 | } | 41 | } | ... | ... |
... | @@ -38,6 +38,7 @@ import org.springframework.util.Assert; | ... | @@ -38,6 +38,7 @@ import org.springframework.util.Assert; |
38 | import org.springframework.validation.annotation.Validated; | 38 | import org.springframework.validation.annotation.Validated; |
39 | import org.springframework.web.bind.annotation.*; | 39 | import org.springframework.web.bind.annotation.*; |
40 | 40 | ||
41 | import javax.validation.constraints.NotNull; | ||
41 | import java.io.IOException; | 42 | import java.io.IOException; |
42 | import java.net.URLDecoder; | 43 | import java.net.URLDecoder; |
43 | import java.sql.Timestamp; | 44 | import java.sql.Timestamp; |
... | @@ -89,7 +90,8 @@ public class UserOperationController { | ... | @@ -89,7 +90,8 @@ public class UserOperationController { |
89 | MemberDTO memberDTO = this.memberService.findById(memberId); | 90 | MemberDTO memberDTO = this.memberService.findById(memberId); |
90 | 91 | ||
91 | Member member = new Member(); | 92 | Member member = new Member(); |
92 | BeanUtils.copyProperties(memberDTO, member); | 93 | member.setId(memberDTO.getId()); |
94 | member.setCode(memberDTO.getCode()); | ||
93 | if (Objects.nonNull(vip)) { | 95 | if (Objects.nonNull(vip)) { |
94 | member.setVip(vip); | 96 | member.setVip(vip); |
95 | } | 97 | } |
... | @@ -97,9 +99,9 @@ public class UserOperationController { | ... | @@ -97,9 +99,9 @@ public class UserOperationController { |
97 | member.setVipExpireTime(vipExpireTime); | 99 | member.setVipExpireTime(vipExpireTime); |
98 | } | 100 | } |
99 | 101 | ||
100 | this.createVipHistory(userId, vip, vipExpireTime); | 102 | this.memberOperationService.doUpdateMemberVipAndVipExpireTime(member); |
101 | 103 | ||
102 | this.memberOperationService.updateMemberVip(member); | 104 | this.createVipHistory(userId, vip, vipExpireTime); |
103 | 105 | ||
104 | return ResultInfo.success(); | 106 | return ResultInfo.success(); |
105 | } | 107 | } |
... | @@ -152,8 +154,12 @@ public class UserOperationController { | ... | @@ -152,8 +154,12 @@ public class UserOperationController { |
152 | SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(data.getContent(), SubscribeBean.class); | 154 | SubscribeBean subscribeBean = JSONUtil.parseMsg2Object(data.getContent(), SubscribeBean.class); |
153 | // 解析参数 | 155 | // 解析参数 |
154 | this.parseSubscribe(subscribeBean); | 156 | this.parseSubscribe(subscribeBean); |
155 | this.userOperationService.subscribe(subscribeBean); | 157 | boolean subscribe = this.userOperationService.subscribe(subscribeBean); |
156 | return ResultInfo.success(); | 158 | if (subscribe) { |
159 | return ResultInfo.success("关注成功"); | ||
160 | } else { | ||
161 | return ResultInfo.failure("关注失败"); | ||
162 | } | ||
157 | } | 163 | } |
158 | 164 | ||
159 | /** | 165 | /** |
... | @@ -266,6 +272,16 @@ public class UserOperationController { | ... | @@ -266,6 +272,16 @@ public class UserOperationController { |
266 | public ResultInfo minaBind(@Validated(value = {BindGroup.class}) @RequestBody BindBean resources) { | 272 | public ResultInfo minaBind(@Validated(value = {BindGroup.class}) @RequestBody BindBean resources) { |
267 | log.info("UserOperationController ==> appletBind ==>> param ==> [{}]",resources); | 273 | log.info("UserOperationController ==> appletBind ==>> param ==> [{}]",resources); |
268 | 274 | ||
275 | Long memberId = resources.getMemberId(); | ||
276 | if (Objects.isNull(memberId)) { | ||
277 | return ResultInfo.failure("参数错误,memberId 不存在"); | ||
278 | } | ||
279 | |||
280 | String platformAccount = resources.getPlatformAccount(); | ||
281 | if (StringUtils.isBlank(platformAccount)) { | ||
282 | return ResultInfo.failure("参数错误,大屏账号不存在"); | ||
283 | } | ||
284 | |||
269 | boolean result = this.userOperationService.minaBind(resources); | 285 | boolean result = this.userOperationService.minaBind(resources); |
270 | return ResultInfo.success(result); | 286 | return ResultInfo.success(result); |
271 | } | 287 | } |
... | @@ -276,8 +292,17 @@ public class UserOperationController { | ... | @@ -276,8 +292,17 @@ public class UserOperationController { |
276 | public ResultInfo minaUnbind(@Validated(value = {UnbindGroup.class}) @RequestBody WeixinUnBindBean weixinUnBindBean) { | 292 | public ResultInfo minaUnbind(@Validated(value = {UnbindGroup.class}) @RequestBody WeixinUnBindBean weixinUnBindBean) { |
277 | log.info("UserOperationController ==> minaUnbind ==>> param ==> [{}]", weixinUnBindBean); | 293 | log.info("UserOperationController ==> minaUnbind ==>> param ==> [{}]", weixinUnBindBean); |
278 | 294 | ||
279 | this.userOperationService.minaUnbind(weixinUnBindBean); | 295 | Long memberId = weixinUnBindBean.getMemberId(); |
280 | return ResultInfo.success(); | 296 | if (Objects.isNull(memberId)) { |
297 | log.error("小屏解绑失败,参数错误,memberId不存在"); | ||
298 | return ResultInfo.failure("参数错误,会员id不存在"); | ||
299 | } | ||
300 | boolean b = this.userOperationService.minaUnbind(weixinUnBindBean); | ||
301 | if (b) { | ||
302 | return ResultInfo.success("解绑成功"); | ||
303 | } else { | ||
304 | return ResultInfo.failure("解绑失败"); | ||
305 | } | ||
281 | } | 306 | } |
282 | 307 | ||
283 | /** | 308 | /** |
... | @@ -293,12 +318,18 @@ public class UserOperationController { | ... | @@ -293,12 +318,18 @@ public class UserOperationController { |
293 | public ResultInfo memberPreprocess(@RequestBody String data) { | 318 | public ResultInfo memberPreprocess(@RequestBody String data) { |
294 | 319 | ||
295 | log.info("UserOperationController ==> saveUserInfo ==>> param ==>> [{}]",data); | 320 | log.info("UserOperationController ==> saveUserInfo ==>> param ==>> [{}]",data); |
296 | Assert.notNull(data, "用户数据不可为空"); | 321 | if (StringUtils.isBlank(data)) { |
322 | log.error("预存大小屏账号信息失败,无参数"); | ||
323 | return ResultInfo.failure("参数错误"); | ||
324 | } | ||
297 | 325 | ||
298 | JSONObject json = JSONObject.parseObject(data); | 326 | JSONObject json = JSONObject.parseObject(data); |
299 | 327 | ||
300 | String unionid = json.getString("unionid"); | 328 | String unionid = json.getString("unionid"); |
301 | Assert.state(StrUtil.isNotBlank(unionid), "unionid不可为空"); | 329 | if (StringUtils.isBlank(unionid)) { |
330 | log.error("预存大小屏账号信息失败,参数错误,unionid不存在"); | ||
331 | return ResultInfo.failure("参数错误,unionid不存在"); | ||
332 | } | ||
302 | 333 | ||
303 | 334 | ||
304 | List<Object> resultList = new ArrayList<>(); | 335 | List<Object> resultList = new ArrayList<>(); |
... | @@ -471,8 +502,10 @@ public class UserOperationController { | ... | @@ -471,8 +502,10 @@ public class UserOperationController { |
471 | throw new BadRequestException(GlobeExceptionMsg.IPTV_PLATFORM_ACCOUNT_IS_NULL); | 502 | throw new BadRequestException(GlobeExceptionMsg.IPTV_PLATFORM_ACCOUNT_IS_NULL); |
472 | } | 503 | } |
473 | 504 | ||
474 | this.userOperationService.tvUnbind(resources); | 505 | boolean b = this.userOperationService.tvUnbind(resources); |
475 | return ResultInfo.success(); | 506 | if (b) { |
507 | return ResultInfo.success("解绑成功"); | ||
508 | } else return ResultInfo.failure("解绑失败"); | ||
476 | } | 509 | } |
477 | 510 | ||
478 | @RequestMapping(value = "/changeMainAccount") | 511 | @RequestMapping(value = "/changeMainAccount") |
... | @@ -493,9 +526,9 @@ public class UserOperationController { | ... | @@ -493,9 +526,9 @@ public class UserOperationController { |
493 | UserTv userTv = new UserTv(); | 526 | UserTv userTv = new UserTv(); |
494 | userTv.setMemberCode(memberCode); | 527 | userTv.setMemberCode(memberCode); |
495 | userTv.setPlatformAccount(platformAccount); | 528 | userTv.setPlatformAccount(platformAccount); |
496 | this.userOperationService.changeMainAccount(userTv); | 529 | boolean b = this.userOperationService.changeMainAccount(userTv); |
497 | 530 | ||
498 | return ResultInfo.success(); | 531 | return ResultInfo.success(b); |
499 | } | 532 | } |
500 | 533 | ||
501 | @PostMapping(value = "/deleteAllCollection") | 534 | @PostMapping(value = "/deleteAllCollection") | ... | ... |
... | @@ -13,13 +13,6 @@ import java.util.List; | ... | @@ -13,13 +13,6 @@ import java.util.List; |
13 | public interface PointsOperationService { | 13 | public interface PointsOperationService { |
14 | 14 | ||
15 | /** | 15 | /** |
16 | * 手动发放积分 | ||
17 | * @param memberId 会员id | ||
18 | * @param tempPoints 积分详情 | ||
19 | */ | ||
20 | void grantPointsByManual(Long memberId , TempPoints tempPoints); | ||
21 | |||
22 | /** | ||
23 | * | 16 | * |
24 | * @param tempPoints | 17 | * @param tempPoints |
25 | */ | 18 | */ |
... | @@ -44,5 +37,6 @@ public interface PointsOperationService { | ... | @@ -44,5 +37,6 @@ public interface PointsOperationService { |
44 | * @param memberId | 37 | * @param memberId |
45 | * @return | 38 | * @return |
46 | */ | 39 | */ |
40 | @Deprecated | ||
47 | Long cleanInvalidPointsAndCalculateCurrentPoints(Long memberId); | 41 | Long cleanInvalidPointsAndCalculateCurrentPoints(Long memberId); |
48 | } | 42 | } | ... | ... |
1 | package com.topdraw.business.process.service; | 1 | package com.topdraw.business.process.service; |
2 | 2 | ||
3 | import com.topdraw.business.module.rights.history.domain.RightsHistory; | 3 | import com.topdraw.business.module.rights.history.domain.RightsHistory; |
4 | import com.topdraw.business.process.domian.constant.RightType; | 4 | import com.topdraw.business.module.rights.constant.RightType; |
5 | 5 | ||
6 | import java.util.List; | 6 | import java.util.List; |
7 | import java.util.Map; | 7 | import java.util.Map; | ... | ... |
... | @@ -11,8 +11,18 @@ import com.topdraw.common.ResultInfo; | ... | @@ -11,8 +11,18 @@ import com.topdraw.common.ResultInfo; |
11 | */ | 11 | */ |
12 | public interface TaskOperationService { | 12 | public interface TaskOperationService { |
13 | 13 | ||
14 | /** | ||
15 | * | ||
16 | * @param id | ||
17 | * @return | ||
18 | */ | ||
14 | TaskDTO findById(Long id); | 19 | TaskDTO findById(Long id); |
15 | 20 | ||
21 | /** | ||
22 | * | ||
23 | * @param code | ||
24 | * @return | ||
25 | */ | ||
16 | TaskDTO findByCode(String code); | 26 | TaskDTO findByCode(String code); |
17 | 27 | ||
18 | /** | 28 | /** |
... | @@ -26,25 +36,25 @@ public interface TaskOperationService { | ... | @@ -26,25 +36,25 @@ public interface TaskOperationService { |
26 | * | 36 | * |
27 | * @param task | 37 | * @param task |
28 | */ | 38 | */ |
29 | void createTask(Task task); | 39 | TaskDTO createTask(Task task); |
30 | 40 | ||
31 | /** | 41 | /** |
32 | * | 42 | * |
33 | * @param task | 43 | * @param task |
34 | */ | 44 | */ |
35 | void updateTask(Task task); | 45 | TaskDTO updateTask(Task task); |
36 | 46 | ||
37 | /** | 47 | /** |
38 | * | 48 | * |
39 | * @param task | 49 | * @param task |
40 | */ | 50 | */ |
41 | void deleteTask(Task task); | 51 | Integer deleteTask(Task task); |
42 | 52 | ||
43 | /** | 53 | /** |
44 | * | 54 | * |
45 | * @param id | 55 | * @param id |
46 | */ | 56 | */ |
47 | void deleteTask(Long id); | 57 | Integer deleteTask(Long id); |
48 | 58 | ||
49 | /** | 59 | /** |
50 | * | 60 | * |
... | @@ -54,6 +64,4 @@ public interface TaskOperationService { | ... | @@ -54,6 +64,4 @@ public interface TaskOperationService { |
54 | */ | 64 | */ |
55 | boolean createPoint2ChongQing(String platformAccount, Long points); | 65 | boolean createPoint2ChongQing(String platformAccount, Long points); |
56 | 66 | ||
57 | |||
58 | |||
59 | } | 67 | } | ... | ... |
... | @@ -43,6 +43,13 @@ public interface TaskTemplateOperationService { | ... | @@ -43,6 +43,13 @@ public interface TaskTemplateOperationService { |
43 | 43 | ||
44 | /** | 44 | /** |
45 | * | 45 | * |
46 | * @param taskTemplate | ||
47 | * @return | ||
48 | */ | ||
49 | Long countByCodeAndType(TaskTemplate taskTemplate); | ||
50 | |||
51 | /** | ||
52 | * | ||
46 | * @param id | 53 | * @param id |
47 | * @return | 54 | * @return |
48 | */ | 55 | */ | ... | ... |
... | @@ -52,13 +52,13 @@ public interface UserOperationService { | ... | @@ -52,13 +52,13 @@ public interface UserOperationService { |
52 | * 大屏解绑 | 52 | * 大屏解绑 |
53 | * @param userTv | 53 | * @param userTv |
54 | */ | 54 | */ |
55 | void tvUnbind(TvUnBindBean userTv); | 55 | boolean tvUnbind(TvUnBindBean userTv); |
56 | 56 | ||
57 | /** | 57 | /** |
58 | * 大屏切换主账户(会员) | 58 | * 大屏切换主账户(会员) |
59 | * @param userTv | 59 | * @param userTv |
60 | */ | 60 | */ |
61 | void changeMainAccount(UserTv userTv); | 61 | boolean changeMainAccount(UserTv userTv); |
62 | 62 | ||
63 | /** | 63 | /** |
64 | * 微信公众号关注 | 64 | * 微信公众号关注 |
... | @@ -114,20 +114,6 @@ public interface UserOperationService { | ... | @@ -114,20 +114,6 @@ public interface UserOperationService { |
114 | 114 | ||
115 | /** | 115 | /** |
116 | * | 116 | * |
117 | * @param memberCode | ||
118 | * @param platformAccount | ||
119 | */ | ||
120 | void bind(String memberCode, String platformAccount); | ||
121 | |||
122 | /** | ||
123 | * | ||
124 | * @param memberDTO | ||
125 | * @param userTvDTO | ||
126 | */ | ||
127 | void bind(MemberDTO memberDTO, UserTvDTO userTvDTO); | ||
128 | |||
129 | /** | ||
130 | * | ||
131 | * @param memberDTO | 117 | * @param memberDTO |
132 | * @param platformAccount | 118 | * @param platformAccount |
133 | * @return | 119 | * @return |
... | @@ -152,7 +138,7 @@ public interface UserOperationService { | ... | @@ -152,7 +138,7 @@ public interface UserOperationService { |
152 | * 小屏解绑 | 138 | * 小屏解绑 |
153 | * @param weixinUnBindBean | 139 | * @param weixinUnBindBean |
154 | */ | 140 | */ |
155 | void minaUnbind(WeixinUnBindBean weixinUnBindBean); | 141 | boolean minaUnbind(WeixinUnBindBean weixinUnBindBean); |
156 | 142 | ||
157 | /** | 143 | /** |
158 | * | 144 | * | ... | ... |
... | @@ -12,6 +12,7 @@ import com.topdraw.business.process.service.CouponOperationService; | ... | @@ -12,6 +12,7 @@ import com.topdraw.business.process.service.CouponOperationService; |
12 | import com.topdraw.business.process.service.member.MemberOperationService; | 12 | import com.topdraw.business.process.service.member.MemberOperationService; |
13 | import com.topdraw.business.process.domian.TempCoupon; | 13 | import com.topdraw.business.process.domian.TempCoupon; |
14 | import com.topdraw.business.process.service.RightsOperationService; | 14 | import com.topdraw.business.process.service.RightsOperationService; |
15 | import com.topdraw.config.RedisKeyConstants; | ||
15 | import com.topdraw.util.TimestampUtil; | 16 | import com.topdraw.util.TimestampUtil; |
16 | import com.topdraw.utils.RedisUtils; | 17 | import com.topdraw.utils.RedisUtils; |
17 | import lombok.extern.slf4j.Slf4j; | 18 | import lombok.extern.slf4j.Slf4j; |
... | @@ -73,7 +74,6 @@ public class CouponOperationServiceImpl implements CouponOperationService { | ... | @@ -73,7 +74,6 @@ public class CouponOperationServiceImpl implements CouponOperationService { |
73 | } | 74 | } |
74 | } | 75 | } |
75 | 76 | ||
76 | |||
77 | /** | 77 | /** |
78 | * 优惠券领取历史记录表 | 78 | * 优惠券领取历史记录表 |
79 | * | 79 | * |
... | @@ -92,11 +92,10 @@ public class CouponOperationServiceImpl implements CouponOperationService { | ... | @@ -92,11 +92,10 @@ public class CouponOperationServiceImpl implements CouponOperationService { |
92 | * @param tempCoupon 账号id | 92 | * @param tempCoupon 账号id |
93 | */ | 93 | */ |
94 | private void refreshMemberCoupon(TempCoupon tempCoupon) { | 94 | private void refreshMemberCoupon(TempCoupon tempCoupon) { |
95 | // Long userId = tempCoupon.getUserId(); | ||
96 | Long memberId = tempCoupon.getMemberId(); | 95 | Long memberId = tempCoupon.getMemberId(); |
97 | Integer rightsAmount = tempCoupon.getRightsAmount(); | 96 | Integer rightsAmount = tempCoupon.getRightsAmount(); |
98 | try { | 97 | try { |
99 | 98 | this.redisUtils.doLock(RedisKeyConstants.updateCacheCouponByMemberId + memberId.toString()); | |
100 | // 1.历史总优惠券数量 | 99 | // 1.历史总优惠券数量 |
101 | Long historyCouponCount = this.getTotalHistoryCoupon(memberId); | 100 | Long historyCouponCount = this.getTotalHistoryCoupon(memberId); |
102 | // 1.当前总优惠券数量 | 101 | // 1.当前总优惠券数量 |
... | @@ -107,15 +106,12 @@ public class CouponOperationServiceImpl implements CouponOperationService { | ... | @@ -107,15 +106,12 @@ public class CouponOperationServiceImpl implements CouponOperationService { |
107 | Long expireSoonCouponCount = this.getTotalExpireSoonCoupon(memberId, EXPIRE_FACTOR_DAY); | 106 | Long expireSoonCouponCount = this.getTotalExpireSoonCoupon(memberId, EXPIRE_FACTOR_DAY); |
108 | // 4.当前优惠券数量 = 总优惠券-已过期的优惠券 | 107 | // 4.当前优惠券数量 = 总优惠券-已过期的优惠券 |
109 | Long currentCoupon = this.getCurrentCoupon(totalCouponCount, expireCouponCount); | 108 | Long currentCoupon = this.getCurrentCoupon(totalCouponCount, expireCouponCount); |
110 | |||
111 | this.redisUtils.doLock("right::member::id::" + memberId.toString()); | ||
112 | // 5.更新用户信息(优惠券数量、即将过期的优惠券数量) | 109 | // 5.更新用户信息(优惠券数量、即将过期的优惠券数量) |
113 | this.doUpdateMemberInfo(memberId,currentCoupon,expireSoonCouponCount); | 110 | this.doUpdateMemberInfo(memberId,currentCoupon,expireSoonCouponCount); |
114 | } catch (Exception e) { | 111 | } catch (Exception e) { |
115 | e.printStackTrace(); | 112 | log.error(e.getMessage()); |
116 | throw e; | ||
117 | } finally { | 113 | } finally { |
118 | this.redisUtils.doUnLock("right::member::id::" + memberId.toString()); | 114 | this.redisUtils.doUnLock(RedisKeyConstants.updateCacheCouponByMemberId + memberId.toString()); |
119 | } | 115 | } |
120 | } | 116 | } |
121 | 117 | ||
... | @@ -134,7 +130,6 @@ public class CouponOperationServiceImpl implements CouponOperationService { | ... | @@ -134,7 +130,6 @@ public class CouponOperationServiceImpl implements CouponOperationService { |
134 | MemberDTO memberDTO = this.findMemberByMemberId(memberId); | 130 | MemberDTO memberDTO = this.findMemberByMemberId(memberId); |
135 | 131 | ||
136 | Member member = new Member(); | 132 | Member member = new Member(); |
137 | // BeanUtils.copyProperties(memberDTO,member); | ||
138 | member.setId(memberDTO.getId()); | 133 | member.setId(memberDTO.getId()); |
139 | member.setCode(memberDTO.getCode()); | 134 | member.setCode(memberDTO.getCode()); |
140 | member.setCouponAmount(currentCoupon); | 135 | member.setCouponAmount(currentCoupon); | ... | ... |
... | @@ -11,6 +11,7 @@ import com.topdraw.business.module.member.service.dto.MemberDTO; | ... | @@ -11,6 +11,7 @@ import com.topdraw.business.module.member.service.dto.MemberDTO; |
11 | import com.topdraw.business.process.service.ExpOperationService; | 11 | import com.topdraw.business.process.service.ExpOperationService; |
12 | import com.topdraw.business.process.service.member.MemberOperationService; | 12 | import com.topdraw.business.process.service.member.MemberOperationService; |
13 | import com.topdraw.business.process.domian.TempExp; | 13 | import com.topdraw.business.process.domian.TempExp; |
14 | import com.topdraw.config.RedisKeyConstants; | ||
14 | import com.topdraw.util.IdWorker; | 15 | import com.topdraw.util.IdWorker; |
15 | import com.topdraw.util.TimestampUtil; | 16 | import com.topdraw.util.TimestampUtil; |
16 | import com.topdraw.utils.RedisUtils; | 17 | import com.topdraw.utils.RedisUtils; |
... | @@ -76,6 +77,7 @@ public class ExpOperationServiceImpl implements ExpOperationService { | ... | @@ -76,6 +77,7 @@ public class ExpOperationServiceImpl implements ExpOperationService { |
76 | */ | 77 | */ |
77 | private void refresh(TempExp tempExp) { | 78 | private void refresh(TempExp tempExp) { |
78 | try { | 79 | try { |
80 | this.redisUtils.doLock(RedisKeyConstants.updateCacheExpByMemberId + tempExp.getMemberId()); | ||
79 | 81 | ||
80 | // 原始经验值 | 82 | // 原始经验值 |
81 | long originExp = this.getExpByMemberId(tempExp); | 83 | long originExp = this.getExpByMemberId(tempExp); |
... | @@ -84,7 +86,6 @@ public class ExpOperationServiceImpl implements ExpOperationService { | ... | @@ -84,7 +86,6 @@ public class ExpOperationServiceImpl implements ExpOperationService { |
84 | long totalExp = this.calculateTotalExp(originExp, tempExp); | 86 | long totalExp = this.calculateTotalExp(originExp, tempExp); |
85 | log.info("----计算总经验值 ==>> {}", totalExp); | 87 | log.info("----计算总经验值 ==>> {}", totalExp); |
86 | 88 | ||
87 | this.redisUtils.doLock("right::member::id::" + tempExp.getMemberId()); | ||
88 | // 2.更新成长值与等级 | 89 | // 2.更新成长值与等级 |
89 | log.info("----更新会员经验值与对应等级 ==>> {}", totalExp); | 90 | log.info("----更新会员经验值与对应等级 ==>> {}", totalExp); |
90 | this.refreshMemberExpAndLevel(tempExp, totalExp); | 91 | this.refreshMemberExpAndLevel(tempExp, totalExp); |
... | @@ -93,10 +94,9 @@ public class ExpOperationServiceImpl implements ExpOperationService { | ... | @@ -93,10 +94,9 @@ public class ExpOperationServiceImpl implements ExpOperationService { |
93 | this.doInsertExpDetail(tempExp, originExp, totalExp); | 94 | this.doInsertExpDetail(tempExp, originExp, totalExp); |
94 | 95 | ||
95 | } catch (Exception e) { | 96 | } catch (Exception e) { |
96 | e.printStackTrace(); | 97 | log.error("成长值发放失败,"+e.getMessage()); |
97 | throw e; | ||
98 | } finally { | 98 | } finally { |
99 | this.redisUtils.doUnLock("right::member::id::" + tempExp.getMemberId()); | 99 | this.redisUtils.doUnLock(RedisKeyConstants.updateCacheExpByMemberId + tempExp.getMemberId()); |
100 | } | 100 | } |
101 | } | 101 | } |
102 | 102 | ||
... | @@ -148,7 +148,6 @@ public class ExpOperationServiceImpl implements ExpOperationService { | ... | @@ -148,7 +148,6 @@ public class ExpOperationServiceImpl implements ExpOperationService { |
148 | MemberDTO memberDTO = this.findMemberByMemberId(memberId); | 148 | MemberDTO memberDTO = this.findMemberByMemberId(memberId); |
149 | 149 | ||
150 | Member member = new Member(); | 150 | Member member = new Member(); |
151 | // BeanUtils.copyProperties(memberDTO, member); | ||
152 | member.setId(memberDTO.getId()); | 151 | member.setId(memberDTO.getId()); |
153 | member.setCode(memberDTO.getCode()); | 152 | member.setCode(memberDTO.getCode()); |
154 | member.setExp(totalExp); | 153 | member.setExp(totalExp); | ... | ... |
... | @@ -17,6 +17,8 @@ import com.topdraw.business.process.service.dto.CustomPointsResult; | ... | @@ -17,6 +17,8 @@ import com.topdraw.business.process.service.dto.CustomPointsResult; |
17 | import com.topdraw.business.process.service.member.MemberOperationService; | 17 | import com.topdraw.business.process.service.member.MemberOperationService; |
18 | import com.topdraw.business.process.service.PointsOperationService; | 18 | import com.topdraw.business.process.service.PointsOperationService; |
19 | import com.topdraw.business.process.domian.TempPoints; | 19 | import com.topdraw.business.process.domian.TempPoints; |
20 | import com.topdraw.config.RedisKeyConstants; | ||
21 | import com.topdraw.mq.producer.MessageProducer; | ||
20 | import com.topdraw.util.DateUtil; | 22 | import com.topdraw.util.DateUtil; |
21 | import com.topdraw.util.IdWorker; | 23 | import com.topdraw.util.IdWorker; |
22 | import com.topdraw.util.TimestampUtil; | 24 | import com.topdraw.util.TimestampUtil; |
... | @@ -83,25 +85,12 @@ public class PointsOperationServiceImpl implements PointsOperationService { | ... | @@ -83,25 +85,12 @@ public class PointsOperationServiceImpl implements PointsOperationService { |
83 | public void asyncPointsDetail(PointsDetail pointsDetail) {} | 85 | public void asyncPointsDetail(PointsDetail pointsDetail) {} |
84 | 86 | ||
85 | @Override | 87 | @Override |
86 | @Transactional(rollbackFor = Exception.class) | ||
87 | public void grantPointsByManual(Long memberId, TempPoints tempPoints){ | ||
88 | if (Objects.nonNull(tempPoints) && Objects.nonNull(tempPoints.getPoints())) { | ||
89 | MemberDTO memberDTo = this.memberService.findById(memberId); | ||
90 | String memberCode = memberDTo.getCode(); | ||
91 | tempPoints.setMemberCode(memberCode); | ||
92 | this.refresh(tempPoints); | ||
93 | } | ||
94 | } | ||
95 | |||
96 | @Override | ||
97 | public void grantPointsByManualByTempPoints(TempPoints tempPoints) { | 88 | public void grantPointsByManualByTempPoints(TempPoints tempPoints) { |
98 | if (Objects.nonNull(tempPoints) && Objects.nonNull(tempPoints.getPoints())) { | 89 | Timestamp expireTime = tempPoints.getExpireTime(); |
99 | Timestamp expireTime = tempPoints.getExpireTime(); | 90 | if (Objects.isNull(expireTime)){ |
100 | if (Objects.isNull(expireTime)){ | 91 | tempPoints.setExpireTime(TimestampUtil.localDateTime2Timestamp(DateUtil.getLastDateTimeSecondYear())); |
101 | tempPoints.setExpireTime(TimestampUtil.localDateTime2Timestamp(DateUtil.getLastDateTimeSecondYear())); | ||
102 | } | ||
103 | this.refresh(tempPoints); | ||
104 | } | 92 | } |
93 | this.refresh(tempPoints); | ||
105 | } | 94 | } |
106 | 95 | ||
107 | /** | 96 | /** |
... | @@ -118,7 +107,7 @@ public class PointsOperationServiceImpl implements PointsOperationService { | ... | @@ -118,7 +107,7 @@ public class PointsOperationServiceImpl implements PointsOperationService { |
118 | Long memberId = tempPoints.getMemberId(); | 107 | Long memberId = tempPoints.getMemberId(); |
119 | 108 | ||
120 | try { | 109 | try { |
121 | this.redisUtils.doLock("member::id::" + memberId.toString()); | 110 | this.redisUtils.doLock(RedisKeyConstants.cacheMemberById + memberId.toString()); |
122 | //1.删除过期的积分 | 111 | //1.删除过期的积分 |
123 | this.cleanInvalidAvailablePointsByMemberId(memberId); | 112 | this.cleanInvalidAvailablePointsByMemberId(memberId); |
124 | log.info("删除过期的积分 ==>> cleanInvalidAvailablePointsByMemberId ==>> "); | 113 | log.info("删除过期的积分 ==>> cleanInvalidAvailablePointsByMemberId ==>> "); |
... | @@ -153,11 +142,10 @@ public class PointsOperationServiceImpl implements PointsOperationService { | ... | @@ -153,11 +142,10 @@ public class PointsOperationServiceImpl implements PointsOperationService { |
153 | customPointsResult.setPoint(currentPoints); | 142 | customPointsResult.setPoint(currentPoints); |
154 | } | 143 | } |
155 | 144 | ||
156 | }catch (Exception e) { | 145 | } catch (Exception e) { |
157 | e.printStackTrace(); | 146 | log.error("消耗积分失败,"+e.getMessage()); |
158 | throw e; | ||
159 | } finally { | 147 | } finally { |
160 | this.redisUtils.doUnLock("member::id::" + memberId.toString()); | 148 | this.redisUtils.doUnLock(RedisKeyConstants.cacheMemberById + memberId.toString()); |
161 | } | 149 | } |
162 | 150 | ||
163 | return customPointsResult; | 151 | return customPointsResult; |
... | @@ -445,7 +433,7 @@ public class PointsOperationServiceImpl implements PointsOperationService { | ... | @@ -445,7 +433,7 @@ public class PointsOperationServiceImpl implements PointsOperationService { |
445 | Long memberId = tempPoints.getMemberId(); | 433 | Long memberId = tempPoints.getMemberId(); |
446 | log.info("----------->> 会员id ===>>>>" + memberId); | 434 | log.info("----------->> 会员id ===>>>>" + memberId); |
447 | try { | 435 | try { |
448 | 436 | this.redisUtils.doLock(RedisKeyConstants.updateCachePointsByMemberId + memberId.toString()); | |
449 | // 1.可用总积分 | 437 | // 1.可用总积分 |
450 | Long currentPoints = this.findAvailablePointsByMemberId(memberId); | 438 | Long currentPoints = this.findAvailablePointsByMemberId(memberId); |
451 | log.info("----------->> 获取会员当前可用总积分 --->>>> {}", currentPoints); | 439 | log.info("----------->> 获取会员当前可用总积分 --->>>> {}", currentPoints); |
... | @@ -466,8 +454,6 @@ public class PointsOperationServiceImpl implements PointsOperationService { | ... | @@ -466,8 +454,6 @@ public class PointsOperationServiceImpl implements PointsOperationService { |
466 | long soonExpirePoints = this.getSoonExpirePoints(memberId, tempPoints); | 454 | long soonExpirePoints = this.getSoonExpirePoints(memberId, tempPoints); |
467 | log.info("----------->> 即将过期的积分 ------->>>>> {}", soonExpirePoints); | 455 | log.info("----------->> 即将过期的积分 ------->>>>> {}", soonExpirePoints); |
468 | 456 | ||
469 | this.redisUtils.doLock("right::member::id::" + memberId.toString()); | ||
470 | |||
471 | // 6.更新会员的总积分 | 457 | // 6.更新会员的总积分 |
472 | log.info("----------->> 更新会员的总积分 ------->>>>> 总积分--->>> {}", totalPoints); | 458 | log.info("----------->> 更新会员的总积分 ------->>>>> 总积分--->>> {}", totalPoints); |
473 | this.freshMemberCurrentPoints(memberId, totalPoints, soonExpirePoints); | 459 | this.freshMemberCurrentPoints(memberId, totalPoints, soonExpirePoints); |
... | @@ -476,7 +462,7 @@ public class PointsOperationServiceImpl implements PointsOperationService { | ... | @@ -476,7 +462,7 @@ public class PointsOperationServiceImpl implements PointsOperationService { |
476 | e.printStackTrace(); | 462 | e.printStackTrace(); |
477 | throw e; | 463 | throw e; |
478 | } finally { | 464 | } finally { |
479 | this.redisUtils.doUnLock("right::member::id::" + memberId.toString()); | 465 | this.redisUtils.doUnLock(RedisKeyConstants.updateCachePointsByMemberId + memberId.toString()); |
480 | } | 466 | } |
481 | } | 467 | } |
482 | 468 | ||
... | @@ -530,7 +516,6 @@ public class PointsOperationServiceImpl implements PointsOperationService { | ... | @@ -530,7 +516,6 @@ public class PointsOperationServiceImpl implements PointsOperationService { |
530 | MemberDTO memberDTO = this.findMemberByMemberId(memberId); | 516 | MemberDTO memberDTO = this.findMemberByMemberId(memberId); |
531 | 517 | ||
532 | Member member = new Member(); | 518 | Member member = new Member(); |
533 | // BeanUtils.copyProperties(memberDTO, member); | ||
534 | member.setId(memberDTO.getId()); | 519 | member.setId(memberDTO.getId()); |
535 | member.setCode(memberDTO.getCode()); | 520 | member.setCode(memberDTO.getCode()); |
536 | member.setPoints(Objects.nonNull(currentPoints) ? currentPoints:0); | 521 | member.setPoints(Objects.nonNull(currentPoints) ? currentPoints:0); |
... | @@ -541,7 +526,7 @@ public class PointsOperationServiceImpl implements PointsOperationService { | ... | @@ -541,7 +526,7 @@ public class PointsOperationServiceImpl implements PointsOperationService { |
541 | 526 | ||
542 | ((PointsOperationServiceImpl) AopContext.currentProxy()).asyncMemberPoint(member); | 527 | ((PointsOperationServiceImpl) AopContext.currentProxy()).asyncMemberPoint(member); |
543 | } catch (Exception e){ | 528 | } catch (Exception e){ |
544 | throw e; | 529 | log.error("同步会员积分异常,"+e.getMessage()); |
545 | } | 530 | } |
546 | } | 531 | } |
547 | 532 | ... | ... |
... | @@ -6,7 +6,8 @@ import com.topdraw.business.module.rights.history.domain.RightsHistory; | ... | @@ -6,7 +6,8 @@ import com.topdraw.business.module.rights.history.domain.RightsHistory; |
6 | import com.topdraw.business.module.rights.history.service.RightsHistoryService; | 6 | import com.topdraw.business.module.rights.history.service.RightsHistoryService; |
7 | import com.topdraw.business.module.rights.service.RightsService; | 7 | import com.topdraw.business.module.rights.service.RightsService; |
8 | import com.topdraw.business.module.rights.service.dto.RightsDTO; | 8 | import com.topdraw.business.module.rights.service.dto.RightsDTO; |
9 | import com.topdraw.business.process.domian.constant.RightType; | 9 | import com.topdraw.business.module.rights.constant.RightType; |
10 | import com.topdraw.business.module.rights.constant.RightTypeConstants; | ||
10 | import com.topdraw.business.process.service.CouponOperationService; | 11 | import com.topdraw.business.process.service.CouponOperationService; |
11 | import com.topdraw.business.process.service.ExpOperationService; | 12 | import com.topdraw.business.process.service.ExpOperationService; |
12 | import com.topdraw.business.process.service.PointsOperationService; | 13 | import com.topdraw.business.process.service.PointsOperationService; |
... | @@ -14,8 +15,6 @@ import com.topdraw.business.process.service.RightsOperationService; | ... | @@ -14,8 +15,6 @@ import com.topdraw.business.process.service.RightsOperationService; |
14 | import com.topdraw.business.process.domian.*; | 15 | import com.topdraw.business.process.domian.*; |
15 | import com.topdraw.util.TimestampUtil; | 16 | import com.topdraw.util.TimestampUtil; |
16 | import lombok.extern.slf4j.Slf4j; | 17 | import lombok.extern.slf4j.Slf4j; |
17 | import org.slf4j.Logger; | ||
18 | import org.slf4j.LoggerFactory; | ||
19 | import org.springframework.beans.factory.annotation.Autowired; | 18 | import org.springframework.beans.factory.annotation.Autowired; |
20 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | 19 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; |
21 | import org.springframework.stereotype.Service; | 20 | import org.springframework.stereotype.Service; |
... | @@ -24,7 +23,6 @@ import org.springframework.util.StringUtils; | ... | @@ -24,7 +23,6 @@ import org.springframework.util.StringUtils; |
24 | 23 | ||
25 | import java.sql.Timestamp; | 24 | import java.sql.Timestamp; |
26 | import java.util.*; | 25 | import java.util.*; |
27 | import java.util.concurrent.ThreadPoolExecutor; | ||
28 | 26 | ||
29 | /** | 27 | /** |
30 | * 权益处理 | 28 | * 权益处理 |
... | @@ -148,54 +146,7 @@ public class RightsOperationServiceImpl implements RightsOperationService { | ... | @@ -148,54 +146,7 @@ public class RightsOperationServiceImpl implements RightsOperationService { |
148 | * @param tempRightsMap | 146 | * @param tempRightsMap |
149 | */ | 147 | */ |
150 | private void refresh(Map<RightType, Object> tempRightsMap) { | 148 | private void refresh(Map<RightType, Object> tempRightsMap) { |
151 | /*FutureTask<Map<Long,Long>> futureTask1 = new FutureTask(()->{ | 149 | |
152 | log.info(Thread.currentThread().getName() + "=========>> start"); | ||
153 | // 积分 | ||
154 | this.grantPoint((List<TempPoints>) tempRightsMap.get(RightType.POINTS)); | ||
155 | log.info(Thread.currentThread().getName() + "=========>>grantPoint end"); | ||
156 | // 成长值 | ||
157 | // this.grantExp((List<TempExp>) tempRightsMap.get(RightType.EXP)); | ||
158 | // 优惠券 | ||
159 | // this.grantCoupon((List<TempCoupon>) tempRightsMap.get(RightType.COUPON)); | ||
160 | return null; | ||
161 | }); | ||
162 | FutureTask<Map<Long,Long>> futureTask2 = new FutureTask(()->{ | ||
163 | // 积分 | ||
164 | // this.grantPoint((List<TempPoints>) tempRightsMap.get(RightType.POINTS)); | ||
165 | // 成长值 | ||
166 | this.grantExp((List<TempExp>) tempRightsMap.get(RightType.EXP)); | ||
167 | // 优惠券 | ||
168 | // this.grantCoupon((List<TempCoupon>) tempRightsMap.get(RightType.COUPON)); | ||
169 | return null; | ||
170 | }); | ||
171 | FutureTask<Map<Long,Long>> futureTask3 = new FutureTask(()->{ | ||
172 | // 积分 | ||
173 | // this.grantPoint((List<TempPoints>) tempRightsMap.get(RightType.POINTS)); | ||
174 | // 成长值 | ||
175 | // this.grantExp((List<TempExp>) tempRightsMap.get(RightType.EXP)); | ||
176 | // 优惠券 | ||
177 | this.grantCoupon((List<TempCoupon>) tempRightsMap.get(RightType.COUPON)); | ||
178 | return null; | ||
179 | }); | ||
180 | this.threadPoolTaskExecutor.execute(futureTask1); | ||
181 | this.threadPoolTaskExecutor.execute(futureTask2); | ||
182 | this.threadPoolTaskExecutor.execute(futureTask3);*/ | ||
183 | /*this.threadPoolTaskExecutor.execute(() -> { | ||
184 | // 积分 | ||
185 | this.grantPoint((List<TempPoints>) tempRightsMap.get(RightType.POINTS)); | ||
186 | // 成长值 | ||
187 | this.grantExp((List<TempExp>) tempRightsMap.get(RightType.EXP)); | ||
188 | // 优惠券 | ||
189 | this.grantCoupon((List<TempCoupon>) tempRightsMap.get(RightType.COUPON)); | ||
190 | });*/ | ||
191 | |||
192 | |||
193 | /*this.threadPoolTaskExecutor.execute(() -> { | ||
194 | log.info(Thread.currentThread().getName() + "=========>> start"); | ||
195 | // 积分 | ||
196 | this.grantPoint((List<TempPoints>) tempRightsMap.get(RightType.POINTS)); | ||
197 | log.info(Thread.currentThread().getName() + "=========>> end"); | ||
198 | });*/ | ||
199 | this.threadPoolTaskExecutor.execute(() -> { | 150 | this.threadPoolTaskExecutor.execute(() -> { |
200 | List<TempPoints> tempPointsList = (List<TempPoints>) tempRightsMap.get(RightType.POINTS); | 151 | List<TempPoints> tempPointsList = (List<TempPoints>) tempRightsMap.get(RightType.POINTS); |
201 | if (!CollectionUtils.isEmpty(tempPointsList)) { | 152 | if (!CollectionUtils.isEmpty(tempPointsList)) { |
... | @@ -209,15 +160,15 @@ public class RightsOperationServiceImpl implements RightsOperationService { | ... | @@ -209,15 +160,15 @@ public class RightsOperationServiceImpl implements RightsOperationService { |
209 | }); | 160 | }); |
210 | 161 | ||
211 | this.threadPoolTaskExecutor.execute(()-> { | 162 | this.threadPoolTaskExecutor.execute(()-> { |
212 | List<TempExp> tempExpList = (List<TempExp>) tempRightsMap.get(RightType.EXP); | 163 | List<TempExp> tempExpList = (List<TempExp>) tempRightsMap.get(RightType.EXP); |
213 | if (!CollectionUtils.isEmpty(tempExpList)) { | 164 | if (!CollectionUtils.isEmpty(tempExpList)) { |
214 | log.info("发放成长值开始 ==>> [{}]", tempExpList); | 165 | log.info("发放成长值开始 ==>> [{}]", tempExpList); |
215 | long l = System.currentTimeMillis(); | 166 | long l = System.currentTimeMillis(); |
216 | // 成长值 | 167 | // 成长值 |
217 | this.grantExp(tempExpList); | 168 | this.grantExp(tempExpList); |
218 | long l2 = System.currentTimeMillis(); | 169 | long l2 = System.currentTimeMillis(); |
219 | log.info("发放成长值结束,总耗时 ==>> {}", (l2 - l)); | 170 | log.info("发放成长值结束,总耗时 ==>> {}", (l2 - l)); |
220 | } | 171 | } |
221 | }); | 172 | }); |
222 | 173 | ||
223 | this.threadPoolTaskExecutor.execute(()-> { | 174 | this.threadPoolTaskExecutor.execute(()-> { |
... | @@ -252,7 +203,7 @@ public class RightsOperationServiceImpl implements RightsOperationService { | ... | @@ -252,7 +203,7 @@ public class RightsOperationServiceImpl implements RightsOperationService { |
252 | 203 | ||
253 | // 活动机会 | 204 | // 活动机会 |
254 | case ACTIVITYCHANCE: | 205 | case ACTIVITYCHANCE: |
255 | 206 | // TODO MOSS 增加活动机会接口 | |
256 | break; | 207 | break; |
257 | 208 | ||
258 | // 积分商品 | 209 | // 积分商品 |
... | @@ -298,7 +249,7 @@ public class RightsOperationServiceImpl implements RightsOperationService { | ... | @@ -298,7 +249,7 @@ public class RightsOperationServiceImpl implements RightsOperationService { |
298 | // 权益类型 | 249 | // 权益类型 |
299 | RightsDTO rightsDTO = this.getRights(rightId); | 250 | RightsDTO rightsDTO = this.getRights(rightId); |
300 | // 权益的实体类型 1:积分;2成长值;3优惠券 | 251 | // 权益的实体类型 1:积分;2成长值;3优惠券 |
301 | String type = rightsDTO.getEntityType(); | 252 | Integer type = rightsDTO.getEntityType(); |
302 | Long expireTime1 = rightsDTO.getExpireTime(); | 253 | Long expireTime1 = rightsDTO.getExpireTime(); |
303 | Timestamp expireTime = null; | 254 | Timestamp expireTime = null; |
304 | if (Objects.nonNull(expireTime1)){ | 255 | if (Objects.nonNull(expireTime1)){ |
... | @@ -307,7 +258,8 @@ public class RightsOperationServiceImpl implements RightsOperationService { | ... | @@ -307,7 +258,8 @@ public class RightsOperationServiceImpl implements RightsOperationService { |
307 | 258 | ||
308 | switch (type) { | 259 | switch (type) { |
309 | // 优惠券 | 260 | // 优惠券 |
310 | case "1": | 261 | case RightTypeConstants |
262 | .DISCOUNT_COUPON: | ||
311 | Long entityId = rightsDTO.getEntityId(); | 263 | Long entityId = rightsDTO.getEntityId(); |
312 | CouponDTO couponDTO = this.findCouponById(entityId); | 264 | CouponDTO couponDTO = this.findCouponById(entityId); |
313 | if (Objects.nonNull(couponDTO)) { | 265 | if (Objects.nonNull(couponDTO)) { |
... | @@ -319,16 +271,15 @@ public class RightsOperationServiceImpl implements RightsOperationService { | ... | @@ -319,16 +271,15 @@ public class RightsOperationServiceImpl implements RightsOperationService { |
319 | tempCoupon.setRightsSendStrategy(0); | 271 | tempCoupon.setRightsSendStrategy(0); |
320 | tempCoupon.setCode(couponDTO.getCode()); | 272 | tempCoupon.setCode(couponDTO.getCode()); |
321 | if (Objects.nonNull(expireTime)) | 273 | if (Objects.nonNull(expireTime)) |
322 | // tempCoupon.setExpireTime(TimestampUtil.long2LocalDateTime(expireTime)); | ||
323 | tempCoupon.setExpireTime(expireTime); | 274 | tempCoupon.setExpireTime(expireTime); |
324 | tempCouponList.add(tempCoupon); | 275 | tempCouponList.add(tempCoupon); |
325 | } | 276 | } |
326 | break; | 277 | break; |
327 | // 观影券 | 278 | // 观影券 |
328 | case "2": | 279 | case RightTypeConstants.VIEW_COUPON: |
329 | break; | 280 | break; |
330 | // 活动参与机会 | 281 | // 活动参与机会 |
331 | case "3": | 282 | case RightTypeConstants.JOIN_ACTIVITY: |
332 | break; | 283 | break; |
333 | 284 | ||
334 | default: | 285 | default: | ... | ... |
This diff is collapsed.
Click to expand it.
... | @@ -82,6 +82,11 @@ public class TaskTemplateOperationServiceImpl implements TaskTemplateOperationSe | ... | @@ -82,6 +82,11 @@ public class TaskTemplateOperationServiceImpl implements TaskTemplateOperationSe |
82 | } | 82 | } |
83 | 83 | ||
84 | @Override | 84 | @Override |
85 | public Long countByCodeAndType(TaskTemplate taskTemplate) { | ||
86 | return this.taskTemplateService.countByCodeAndType(taskTemplate); | ||
87 | } | ||
88 | |||
89 | @Override | ||
85 | public TaskTemplateDTO findById(Long id) { | 90 | public TaskTemplateDTO findById(Long id) { |
86 | return this.taskTemplateService.findById(id); | 91 | return this.taskTemplateService.findById(id); |
87 | } | 92 | } | ... | ... |
This diff is collapsed.
Click to expand it.
... | @@ -3,58 +3,53 @@ package com.topdraw.business.process.service.impl.member; | ... | @@ -3,58 +3,53 @@ package com.topdraw.business.process.service.impl.member; |
3 | import cn.hutool.core.util.ObjectUtil; | 3 | import cn.hutool.core.util.ObjectUtil; |
4 | import com.topdraw.aspect.AsyncMqSend; | 4 | import com.topdraw.aspect.AsyncMqSend; |
5 | import com.topdraw.business.module.member.domain.Member; | 5 | import com.topdraw.business.module.member.domain.Member; |
6 | import com.topdraw.business.module.member.profile.domain.MemberProfile; | ||
7 | import com.topdraw.business.module.member.profile.service.MemberProfileService; | 6 | import com.topdraw.business.module.member.profile.service.MemberProfileService; |
8 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; | 7 | import com.topdraw.business.module.member.profile.service.dto.MemberProfileDTO; |
9 | import com.topdraw.business.module.member.service.MemberService; | 8 | import com.topdraw.business.module.member.service.MemberService; |
10 | import com.topdraw.business.module.member.service.dto.MemberDTO; | 9 | import com.topdraw.business.module.member.service.dto.MemberDTO; |
11 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; | 10 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; |
12 | import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService; | 11 | import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService; |
13 | import com.topdraw.business.module.task.domain.Task; | ||
14 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; | 12 | import com.topdraw.business.module.user.weixin.domain.UserWeixin; |
15 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; | 13 | import com.topdraw.business.module.user.weixin.service.UserWeixinService; |
16 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; | 14 | import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO; |
17 | import com.topdraw.business.process.domian.weixin.BuyVipBean; | 15 | import com.topdraw.business.process.domian.weixin.BuyVipBean; |
18 | import com.topdraw.business.process.service.member.MemberOperationService; | 16 | import com.topdraw.business.process.service.member.MemberOperationService; |
19 | import com.topdraw.business.process.service.member.MemberProfileOperationService; | 17 | import com.topdraw.config.RedisKeyConstants; |
20 | import com.topdraw.exception.EntityNotFoundException; | 18 | import com.topdraw.exception.EntityNotFoundException; |
21 | import com.topdraw.util.TimestampUtil; | 19 | import com.topdraw.util.TimestampUtil; |
20 | import lombok.extern.slf4j.Slf4j; | ||
22 | import org.springframework.aop.framework.AopContext; | 21 | import org.springframework.aop.framework.AopContext; |
23 | import org.springframework.beans.BeanUtils; | 22 | import org.springframework.beans.BeanUtils; |
24 | import org.springframework.beans.factory.annotation.Autowired; | 23 | import org.springframework.beans.factory.annotation.Autowired; |
25 | import org.springframework.cache.annotation.CacheConfig; | 24 | import org.springframework.cache.annotation.CacheConfig; |
26 | import org.springframework.cache.annotation.CacheEvict; | ||
27 | import org.springframework.cache.annotation.CachePut; | 25 | import org.springframework.cache.annotation.CachePut; |
28 | import org.springframework.cache.annotation.Cacheable; | ||
29 | import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor; | ||
30 | import org.springframework.stereotype.Service; | 26 | import org.springframework.stereotype.Service; |
31 | import org.springframework.util.Assert; | 27 | import org.springframework.util.Assert; |
32 | 28 | ||
33 | import java.sql.Timestamp; | 29 | import java.sql.Timestamp; |
34 | import java.time.LocalDateTime; | 30 | import java.time.LocalDateTime; |
35 | import java.time.ZoneOffset; | ||
36 | import java.util.Objects; | 31 | import java.util.Objects; |
37 | 32 | ||
38 | @Service | 33 | @Service |
39 | //@CacheConfig(cacheNames = "member") | 34 | @Slf4j |
35 | @CacheConfig(cacheNames = RedisKeyConstants.cacheMemberById) | ||
40 | public class MemberOperationServiceImpl implements MemberOperationService { | 36 | public class MemberOperationServiceImpl implements MemberOperationService { |
41 | 37 | ||
38 | |||
42 | @Autowired | 39 | @Autowired |
43 | private MemberService memberService; | 40 | private MemberService memberService; |
44 | @Autowired | 41 | @Autowired |
42 | private UserWeixinService userWeixinService; | ||
43 | @Autowired | ||
45 | private MemberProfileService memberProfileService; | 44 | private MemberProfileService memberProfileService; |
46 | @Autowired | 45 | @Autowired |
47 | private MemberVipHistoryService memberVipHistoryService; | 46 | private MemberVipHistoryService memberVipHistoryService; |
48 | @Autowired | 47 | |
49 | private UserWeixinService userWeixinService; | ||
50 | @Autowired | ||
51 | private ThreadPoolTaskExecutor threadPoolTaskExecutor; | ||
52 | 48 | ||
53 | 49 | ||
54 | @AsyncMqSend | 50 | @AsyncMqSend |
55 | public void asyncUpdateMemberVip(MemberDTO me) {} | 51 | public void asyncUpdateMemberVip(MemberDTO memberDTO) {} |
56 | 52 | ||
57 | // @CachePut(key = "#resources.memberId") | ||
58 | @Override | 53 | @Override |
59 | public MemberDTO buyVipByUserId(BuyVipBean resources) { | 54 | public MemberDTO buyVipByUserId(BuyVipBean resources) { |
60 | // 小程序账户id | 55 | // 小程序账户id |
... | @@ -96,12 +91,12 @@ public class MemberOperationServiceImpl implements MemberOperationService { | ... | @@ -96,12 +91,12 @@ public class MemberOperationServiceImpl implements MemberOperationService { |
96 | 91 | ||
97 | } | 92 | } |
98 | 93 | ||
99 | memberDTO.setVip(vip1); | ||
100 | memberDTO.setVipExpireTime(vipExpireTime); | ||
101 | 94 | ||
102 | Member member = new Member(); | 95 | Member member = new Member(); |
103 | BeanUtils.copyProperties(memberDTO,member); | 96 | member.setVip(vip1); |
104 | this.update(member); | 97 | member.setVipExpireTime(vipExpireTime); |
98 | |||
99 | this.doUpdateMemberVipAndVipExpireTime(member); | ||
105 | 100 | ||
106 | MemberVipHistory memberVipHistory = new MemberVipHistory(); | 101 | MemberVipHistory memberVipHistory = new MemberVipHistory(); |
107 | memberVipHistory.setMemberId(memberId).setVip(vip1).setBeforeVip(vip); | 102 | memberVipHistory.setMemberId(memberId).setVip(vip1).setBeforeVip(vip); |
... | @@ -148,7 +143,6 @@ public class MemberOperationServiceImpl implements MemberOperationService { | ... | @@ -148,7 +143,6 @@ public class MemberOperationServiceImpl implements MemberOperationService { |
148 | return this.update(resources); | 143 | return this.update(resources); |
149 | } | 144 | } |
150 | 145 | ||
151 | // @CachePut(key = "#resources.id") | ||
152 | @Override | 146 | @Override |
153 | public MemberDTO doInsertMember(Member resources) { | 147 | public MemberDTO doInsertMember(Member resources) { |
154 | return this.memberService.create(resources); | 148 | return this.memberService.create(resources); |
... | @@ -160,34 +154,39 @@ public class MemberOperationServiceImpl implements MemberOperationService { | ... | @@ -160,34 +154,39 @@ public class MemberOperationServiceImpl implements MemberOperationService { |
160 | return Objects.nonNull(memberId) ? memberDTO : null; | 154 | return Objects.nonNull(memberId) ? memberDTO : null; |
161 | } | 155 | } |
162 | 156 | ||
163 | // @CachePut(key = "#resources.id") | ||
164 | @Override | 157 | @Override |
165 | public MemberDTO doUpdateMemberExpAndLevel(Member resources) { | 158 | public MemberDTO doUpdateMemberExpAndLevel(Member resources) { |
166 | return this.memberService.doUpdateMemberExpAndLevel(resources); | 159 | return this.memberService.doUpdateMemberExpAndLevel(resources); |
167 | } | 160 | } |
168 | 161 | ||
169 | // @CachePut(key = "#resources.id") | 162 | |
170 | @Override | 163 | @Override |
171 | public MemberDTO doUpdateMemberPoints(Member resources) { | 164 | public MemberDTO doUpdateMemberPoints(Member resources) { |
172 | return this.memberService.doUpdateMemberPoints(resources); | 165 | return this.memberService.doUpdateMemberPoints(resources); |
173 | } | 166 | } |
174 | 167 | ||
175 | // @CachePut(key = "#resources.id") | 168 | |
176 | @Override | 169 | @Override |
170 | @CachePut(cacheNames = RedisKeyConstants.cacheMemberById, key = "#member.id") | ||
177 | public MemberDTO doUpdateMemberCoupon(Member member) { | 171 | public MemberDTO doUpdateMemberCoupon(Member member) { |
178 | return this.memberService.doUpdateMemberCoupon(member); | 172 | return this.memberService.doUpdateMemberCoupon(member); |
179 | } | 173 | } |
180 | 174 | ||
181 | @Override | 175 | @Override |
182 | public MemberDTO updateMemberVip(Member member) { | 176 | // @CachePut(cacheNames = RedisKeyConstants.cacheMemberById, key = "#member.id") |
177 | public MemberDTO doUpdateMemberVipAndVipExpireTime(Member member) { | ||
183 | MemberDTO memberDTO1 = this.memberService.findByCode(member.getCode()); | 178 | MemberDTO memberDTO1 = this.memberService.findByCode(member.getCode()); |
179 | |||
184 | Member member1 = new Member(); | 180 | Member member1 = new Member(); |
185 | BeanUtils.copyProperties(memberDTO1, member1); | 181 | member1.setId(memberDTO1.getId()); |
182 | member1.setCode(memberDTO1.getCode()); | ||
186 | member1.setVip(member.getVip()); | 183 | member1.setVip(member.getVip()); |
187 | member1.setVipExpireTime(member.getVipExpireTime()); | 184 | member1.setVipExpireTime(member.getVipExpireTime()); |
188 | MemberDTO memberDTO = this.update(member1); | 185 | MemberDTO memberDTO_ = this.memberService.doUpdateMemberVipAndVipExpireTime(member1); |
189 | ((MemberOperationServiceImpl) AopContext.currentProxy()).asyncUpdateMemberVip(memberDTO); | 186 | |
190 | return memberDTO; | 187 | ((MemberOperationServiceImpl) AopContext.currentProxy()).asyncUpdateMemberVip(memberDTO_); |
188 | |||
189 | return memberDTO_; | ||
191 | } | 190 | } |
192 | 191 | ||
193 | @Override | 192 | @Override |
... | @@ -225,11 +224,12 @@ public class MemberOperationServiceImpl implements MemberOperationService { | ... | @@ -225,11 +224,12 @@ public class MemberOperationServiceImpl implements MemberOperationService { |
225 | MemberDTO memberDTO1 = this.checkVipStatus(memberDTO,vipExpireTime,appid); | 224 | MemberDTO memberDTO1 = this.checkVipStatus(memberDTO,vipExpireTime,appid); |
226 | 225 | ||
227 | // 更新会员信息 | 226 | // 更新会员信息 |
228 | this.threadPoolTaskExecutor.execute(()->{ | 227 | Member member = new Member(); |
229 | Member member = new Member(); | 228 | member.setId(memberDTO1.getId()); |
230 | BeanUtils.copyProperties(memberDTO1,member); | 229 | member.setCode(memberDTO1.getCode()); |
231 | this.update(member); | 230 | member.setVip(memberDTO1.getVip()); |
232 | }); | 231 | member.setVipExpireTime(memberDTO1.getVipExpireTime()); |
232 | this.doUpdateMemberVipAndVipExpireTime(member); | ||
233 | 233 | ||
234 | vip = memberDTO1.getVip(); | 234 | vip = memberDTO1.getVip(); |
235 | Timestamp vipExpireTime1 = memberDTO1.getVipExpireTime(); | 235 | Timestamp vipExpireTime1 = memberDTO1.getVipExpireTime(); | ... | ... |
... | @@ -111,12 +111,15 @@ public class MemberProfileOperationServiceImpl implements MemberProfileOperation | ... | @@ -111,12 +111,15 @@ public class MemberProfileOperationServiceImpl implements MemberProfileOperation |
111 | } | 111 | } |
112 | 112 | ||
113 | private void syncMember(MemberProfileDTO memberProfileDTO, MemberDTO memberDTO) { | 113 | private void syncMember(MemberProfileDTO memberProfileDTO, MemberDTO memberDTO) { |
114 | memberDTO.setAvatarUrl(memberProfileDTO.getAvatarUrl()); | ||
115 | memberDTO.setNickname(memberProfileDTO.getRealname()); | ||
116 | memberDTO.setGender(memberProfileDTO.getGender()); | ||
117 | Member member = new Member(); | 114 | Member member = new Member(); |
118 | BeanUtils.copyProperties(memberDTO, member); | 115 | |
119 | this.memberService.update(member); | 116 | member.setId(memberDTO.getId()); |
117 | member.setCode(memberDTO.getCode()); | ||
118 | member.setAvatarUrl(memberProfileDTO.getAvatarUrl()); | ||
119 | member.setNickname(memberProfileDTO.getRealname()); | ||
120 | member.setGender(memberProfileDTO.getGender()); | ||
121 | // this.memberService.update(member); | ||
122 | this.memberService.doUpdateMemberAvatarUrlAndNicknameAndGender(member); | ||
120 | } | 123 | } |
121 | 124 | ||
122 | 125 | ... | ... |
... | @@ -90,5 +90,5 @@ public interface MemberOperationService { | ... | @@ -90,5 +90,5 @@ public interface MemberOperationService { |
90 | * | 90 | * |
91 | * @param member | 91 | * @param member |
92 | */ | 92 | */ |
93 | MemberDTO updateMemberVip(Member member); | 93 | MemberDTO doUpdateMemberVipAndVipExpireTime(Member member); |
94 | } | 94 | } | ... | ... |
... | @@ -28,4 +28,10 @@ public class LocalConstants { | ... | @@ -28,4 +28,10 @@ public class LocalConstants { |
28 | 28 | ||
29 | // 事件类型 3:参加活动 | 29 | // 事件类型 3:参加活动 |
30 | public static final Integer EVT_TYPE_ACTIVITY = 3; | 30 | public static final Integer EVT_TYPE_ACTIVITY = 3; |
31 | |||
32 | |||
33 | |||
34 | |||
35 | // 会员黑名单状态 | ||
36 | public static final Long BLACK_STATUS = 1L; | ||
31 | } | 37 | } | ... | ... |
1 | package com.topdraw.config; | ||
2 | |||
3 | import cn.hutool.core.util.ObjectUtil; | ||
4 | import org.springframework.beans.factory.annotation.Value; | ||
5 | import org.springframework.stereotype.Component; | ||
6 | |||
7 | @Component | ||
8 | public class ServiceEnvConfig { | ||
9 | |||
10 | // uc两侧部署,需配置位于哪一侧 mobile小屏侧 vis大屏侧 | ||
11 | public static String UC_SERVICE_TYPE; | ||
12 | |||
13 | @Value("${uc.service.type:mobile}") | ||
14 | public void setUcServiceType(String ucServiceType) { | ||
15 | UC_SERVICE_TYPE = ucServiceType; | ||
16 | } | ||
17 | |||
18 | public static boolean isMobile() { | ||
19 | return ObjectUtil.equals(UC_SERVICE_TYPE, LocalConstants.ENV_MOBILE); | ||
20 | } | ||
21 | |||
22 | public static boolean isVis() { | ||
23 | return ObjectUtil.equals(UC_SERVICE_TYPE, LocalConstants.ENV_VIS); | ||
24 | } | ||
25 | |||
26 | } |
... | @@ -23,10 +23,9 @@ public class DataSyncMsg implements Serializable { | ... | @@ -23,10 +23,9 @@ public class DataSyncMsg implements Serializable { |
23 | // 具体事件 行为事件类型 1:登录;2:观影;3:参与活动;4:订购;10:跨屏绑定;11:积分转移;30:积分兑换商品;98:系统操作;99:其他 | 23 | // 具体事件 行为事件类型 1:登录;2:观影;3:参与活动;4:订购;10:跨屏绑定;11:积分转移;30:积分兑换商品;98:系统操作;99:其他 |
24 | private Integer event; | 24 | private Integer event; |
25 | //设备类型 1:大屏;2:小屏(微信)3.小屏(xx) | 25 | //设备类型 1:大屏;2:小屏(微信)3.小屏(xx) |
26 | @NotNull | ||
27 | private Integer deviceType; | 26 | private Integer deviceType; |
28 | // 发送时间 | 27 | // 发送时间 |
29 | private LocalDateTime time; | 28 | private String time; |
30 | // 消息体 | 29 | // 消息体 |
31 | private String msgData; | 30 | private String msgData; |
32 | 31 | ||
... | @@ -37,20 +36,32 @@ public class DataSyncMsg implements Serializable { | ... | @@ -37,20 +36,32 @@ public class DataSyncMsg implements Serializable { |
37 | @AllArgsConstructor | 36 | @AllArgsConstructor |
38 | @NoArgsConstructor | 37 | @NoArgsConstructor |
39 | public static class MsgData { | 38 | public static class MsgData { |
40 | private String remarks; //备注 | 39 | /**备注*/ |
41 | @NotNull | 40 | private String remarks; |
42 | private Long memberId; // 会员id | 41 | // 会员id |
43 | private Long userId; // 账户id | 42 | private Long memberId; |
44 | @NotNull | 43 | // 账户id |
45 | private String appCode; //用户对应的应用code | 44 | private Long userId; |
45 | //用户对应的应用code | ||
46 | private String appCode; | ||
47 | // 会员code | ||
46 | private String memberCode; | 48 | private String memberCode; |
47 | private Long accountId; // 账号id | 49 | // 账号id |
50 | private Long accountId; | ||
51 | // 订单Id | ||
48 | private Long orderId; | 52 | private Long orderId; |
53 | // 活动id | ||
49 | private Long activityId; | 54 | private Long activityId; |
55 | // 节目id | ||
50 | private Long mediaId; | 56 | private Long mediaId; |
57 | // 产品id | ||
51 | private Long itemId; | 58 | private Long itemId; |
59 | // 模板参数 | ||
52 | private String param; | 60 | private String param; |
61 | // 描述 | ||
53 | private String description; | 62 | private String description; |
63 | // 大屏账号 | ||
64 | private String platformAccount; | ||
54 | } | 65 | } |
55 | 66 | ||
56 | } | 67 | } | ... | ... |
1 | package com.topdraw.mq.producer; | 1 | package com.topdraw.mq.producer; |
2 | 2 | ||
3 | import com.topdraw.business.process.service.impl.PointsOperationServiceImpl; | ||
3 | import lombok.extern.slf4j.Slf4j; | 4 | import lombok.extern.slf4j.Slf4j; |
4 | import org.springframework.amqp.core.AmqpTemplate; | 5 | import org.springframework.amqp.core.AmqpTemplate; |
6 | import org.springframework.aop.framework.AopContext; | ||
5 | import org.springframework.beans.factory.annotation.Autowired; | 7 | import org.springframework.beans.factory.annotation.Autowired; |
6 | import org.springframework.beans.factory.annotation.Value; | 8 | import org.springframework.beans.factory.annotation.Value; |
7 | import org.springframework.stereotype.Component; | 9 | import org.springframework.stereotype.Component; |
... | @@ -57,4 +59,5 @@ public class MessageProducer { | ... | @@ -57,4 +59,5 @@ public class MessageProducer { |
57 | amqpTemplate.convertAndSend(exchange, queue, msg); | 59 | amqpTemplate.convertAndSend(exchange, queue, msg); |
58 | log.info("send sendMessage msg || exchange: {} || queue: {} || msg:{} ", exchange, queue, msg); | 60 | log.info("send sendMessage msg || exchange: {} || queue: {} || msg:{} ", exchange, queue, msg); |
59 | } | 61 | } |
62 | |||
60 | } | 63 | } | ... | ... |
... | @@ -142,4 +142,8 @@ weixin: | ... | @@ -142,4 +142,8 @@ weixin: |
142 | env: dev | 142 | env: dev |
143 | 143 | ||
144 | api: | 144 | api: |
145 | uc-service: http://127.0.0.1:8446 | ||
... | \ No newline at end of file | ... | \ No newline at end of file |
145 | uc-service: http://127.0.0.1:8446 | ||
146 | |||
147 | uc: | ||
148 | # 主会员是否启用,如果启用任务获得的积分将添加至小屏会员上 | ||
149 | validPriorityMember: 0 | ||
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -179,6 +179,13 @@ public class TaskOperationControllerTest extends BaseTest { | ... | @@ -179,6 +179,13 @@ public class TaskOperationControllerTest extends BaseTest { |
179 | this.taskOperationController.deleteTask(task); | 179 | this.taskOperationController.deleteTask(task); |
180 | } | 180 | } |
181 | 181 | ||
182 | @Test | ||
183 | public void dealTask() { | ||
184 | String content = "{\"deviceType\":1,\"event\":8,\"evt\":\"PLAY\",\"msgData\":\"{\\\"description\\\":\\\"{\\\\\\\"playDuration\\\\\\\":1,\\\\\\\"time\\\\\\\":\\\\\\\"2022-05-03 23:10:09\\\\\\\",\\\\\\\"mediaId\\\\\\\":432,\\\\\\\"mediaCode\\\\\\\":\\\\\\\"media_123\\\\\\\",\\\\\\\"mediaName\\\\\\\":\\\\\\\"白宫陷落\\\\\\\"}\\\",\\\"mediaId\\\":432,\\\"platformAccount\\\":\\\"6002110106@ITVP\\\",\\\"param\\\":\\\"{\\\\\\\"playDuration\\\\\\\":1}\\\"}\",\"time\":\"2022-06-17T13:07:16.433\"}\n"; | ||
185 | TaskOperationQueryCriteria task = new TaskOperationQueryCriteria(); | ||
186 | task.setContent(content); | ||
187 | this.taskOperationController.dealTask(task); | ||
188 | } | ||
182 | 189 | ||
183 | 190 | ||
184 | } | 191 | } | ... | ... |
-
Please register or sign in to post a comment