1.修改首次兑换积分的任务类型
Showing
4 changed files
with
67 additions
and
31 deletions
... | @@ -22,7 +22,7 @@ public interface TaskEventType { | ... | @@ -22,7 +22,7 @@ public interface TaskEventType { |
22 | int PLAY = 8; | 22 | int PLAY = 8; |
23 | int BINDING = 10; | 23 | int BINDING = 10; |
24 | int POINTS_TRANS = 11; | 24 | int POINTS_TRANS = 11; |
25 | int POINTS_EXCHANGE_GOODS = 30; | 25 | int POINTS_EXCHANGE_GOODS = 14; |
26 | int SYSTEM_OPERATE = 98; | 26 | int SYSTEM_OPERATE = 98; |
27 | int OHHER = 99; | 27 | int OHHER = 99; |
28 | 28 | ... | ... |
... | @@ -111,19 +111,19 @@ public class ExpOperationServiceImpl implements ExpOperationService { | ... | @@ -111,19 +111,19 @@ public class ExpOperationServiceImpl implements ExpOperationService { |
111 | MemberLevelDTO memberLevelDTO = this.memberLevelService.findByLevel(memberLevel + 1); | 111 | MemberLevelDTO memberLevelDTO = this.memberLevelService.findByLevel(memberLevel + 1); |
112 | // 4.成长值比较,判断是否升级 | 112 | // 4.成长值比较,判断是否升级 |
113 | Integer level = this.compareExp(totalExp, memberLevelDTO, memberLevel); | 113 | Integer level = this.compareExp(totalExp, memberLevelDTO, memberLevel); |
114 | |||
115 | // 5.更新用户信息 | ||
116 | Member member = new Member(); | ||
117 | member.setId(memberId); | ||
118 | member.setCode(memberCode); | ||
119 | member.setExp(totalExp); | ||
120 | member.setLevel(level); | ||
121 | member.setUpdateTime(TimestampUtil.now()); | ||
122 | this.memberOperationService.doUpdateMemberExpAndLevel(member); | ||
123 | |||
124 | ((ExpOperationServiceImpl) AopContext.currentProxy()).asyncMemberExpAndLevel(member); | ||
125 | |||
126 | if (level > memberLevel) { | 114 | if (level > memberLevel) { |
115 | log.info("会员等级提升,更新会员等级 refreshMemberExpAndLevel#"); | ||
116 | // 5.更新用户信息 | ||
117 | Member member = new Member(); | ||
118 | member.setId(memberId); | ||
119 | member.setCode(memberCode); | ||
120 | member.setExp(totalExp); | ||
121 | member.setLevel(level); | ||
122 | member.setUpdateTime(TimestampUtil.now()); | ||
123 | this.memberOperationService.doUpdateMemberExpAndLevel(member); | ||
124 | |||
125 | ((ExpOperationServiceImpl) AopContext.currentProxy()).asyncMemberExpAndLevel(member); | ||
126 | |||
127 | MemberSimpleDTO memberSimpleDTO = this.memberService.findSimpleById(memberId); | 127 | MemberSimpleDTO memberSimpleDTO = this.memberService.findSimpleById(memberId); |
128 | if (Objects.nonNull(memberLevelDTO.getId())) { | 128 | if (Objects.nonNull(memberLevelDTO.getId())) { |
129 | memberSimpleDTO.setLevel(level); | 129 | memberSimpleDTO.setLevel(level); |
... | @@ -132,16 +132,15 @@ public class ExpOperationServiceImpl implements ExpOperationService { | ... | @@ -132,16 +132,15 @@ public class ExpOperationServiceImpl implements ExpOperationService { |
132 | 132 | ||
133 | } | 133 | } |
134 | } | 134 | } |
135 | |||
136 | } | 135 | } |
137 | 136 | ||
138 | private Integer compareExp(long newExp, MemberLevelDTO memberLevelDTO, Integer oldMemberLevel) { | 137 | private Integer compareExp(long totalExp, MemberLevelDTO memberLevelDTO, Integer oldMemberLevel) { |
139 | if (Objects.nonNull(memberLevelDTO.getId())) { | 138 | Long nextLevelExp = memberLevelDTO.getExpValue(); |
140 | Long nextLevelExp = memberLevelDTO.getExpValue(); | 139 | log.info("当前会员经验值 ==>> {} || 下一级会员经验值 ==>> {}", totalExp, nextLevelExp); |
141 | if (Objects.nonNull(nextLevelExp) && nextLevelExp > 0) | 140 | if (Objects.nonNull(nextLevelExp) && nextLevelExp > 0) { |
142 | if(newExp - nextLevelExp >= 0){ | 141 | if (totalExp - nextLevelExp >= 0) { |
143 | return memberLevelDTO.getLevel(); | 142 | return memberLevelDTO.getLevel(); |
144 | } | 143 | } |
145 | } | 144 | } |
146 | return oldMemberLevel; | 145 | return oldMemberLevel; |
147 | } | 146 | } | ... | ... |
... | @@ -32,11 +32,11 @@ import com.topdraw.business.module.task.service.TaskService; | ... | @@ -32,11 +32,11 @@ import com.topdraw.business.module.task.service.TaskService; |
32 | import com.topdraw.business.module.task.template.service.TaskTemplateService; | 32 | import com.topdraw.business.module.task.template.service.TaskTemplateService; |
33 | import com.topdraw.business.process.domian.*; | 33 | import com.topdraw.business.process.domian.*; |
34 | import com.topdraw.business.process.service.UserOperationService; | 34 | import com.topdraw.business.process.service.UserOperationService; |
35 | import com.topdraw.common.ResultInfo; | ||
36 | import com.topdraw.business.LocalConstants; | 35 | import com.topdraw.business.LocalConstants; |
37 | import com.topdraw.business.module.rights.constant.RightTypeConstants; | 36 | import com.topdraw.business.module.rights.constant.RightTypeConstants; |
38 | import com.topdraw.business.module.task.template.constant.TaskEventType; | 37 | import com.topdraw.business.module.task.template.constant.TaskEventType; |
39 | import com.topdraw.business.RedisKeyConstants; | 38 | import com.topdraw.business.RedisKeyConstants; |
39 | import com.topdraw.common.ResultInfo; | ||
40 | import com.topdraw.mq.module.mq.DataSyncMsg; | 40 | import com.topdraw.mq.module.mq.DataSyncMsg; |
41 | import com.topdraw.util.*; | 41 | import com.topdraw.util.*; |
42 | import com.topdraw.utils.RedisUtils; | 42 | import com.topdraw.utils.RedisUtils; |
... | @@ -100,7 +100,6 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -100,7 +100,6 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
100 | private static final Integer POINTS_MIN = 1; | 100 | private static final Integer POINTS_MIN = 1; |
101 | 101 | ||
102 | @Override | 102 | @Override |
103 | // @CacheEvict(cacheNames = RedisKeyConstants.cacheTaskByEvent, key = "#task.event") | ||
104 | public TaskDTO createTask(Task task) { | 103 | public TaskDTO createTask(Task task) { |
105 | Long taskTemplateId = task.getTaskTemplateId(); | 104 | Long taskTemplateId = task.getTaskTemplateId(); |
106 | TaskTemplateDTO taskTemplateDTO = this.taskTemplateService.findById(taskTemplateId); | 105 | TaskTemplateDTO taskTemplateDTO = this.taskTemplateService.findById(taskTemplateId); |
... | @@ -115,7 +114,6 @@ public class TaskOperationServiceImpl implements TaskOperationService { | ... | @@ -115,7 +114,6 @@ public class TaskOperationServiceImpl implements TaskOperationService { |
115 | } | 114 | } |
116 | 115 | ||
117 | @Override | 116 | @Override |
118 | // @CacheEvict(cacheNames = RedisKeyConstants.cacheTaskByEventAndMemberLevelAndVip, key = "#task.event") | ||
119 | public TaskDTO updateTask(Task task) { | 117 | public TaskDTO updateTask(Task task) { |
120 | Long taskTemplateId = task.getTaskTemplateId(); | 118 | Long taskTemplateId = task.getTaskTemplateId(); |
121 | TaskTemplateDTO taskTemplateDTO = this.taskTemplateService.findById(taskTemplateId); | 119 | TaskTemplateDTO taskTemplateDTO = this.taskTemplateService.findById(taskTemplateId); | ... | ... |
... | @@ -937,6 +937,13 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -937,6 +937,13 @@ public class UserOperationServiceImpl implements UserOperationService { |
937 | // 同步至iptv | 937 | // 同步至iptv |
938 | ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUserTvChangeMainAccount(userTvDTO); | 938 | ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUserTvChangeMainAccount(userTvDTO); |
939 | 939 | ||
940 | |||
941 | UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(platformAccount); | ||
942 | if (Objects.nonNull(userTvSimpleDTO.getPlatformAccount())) { | ||
943 | userTvSimpleDTO.setPriorityMemberCode(memberCode); | ||
944 | JSONObject hashMap = JSONObject.parseObject(JSON.toJSONString(userTvSimpleDTO), JSONObject.class); | ||
945 | this.redisUtils.set(RedisKeyConstants.cacheVisUserByPlatformAccount + "::" + platformAccount, hashMap); | ||
946 | } | ||
940 | return true; | 947 | return true; |
941 | } | 948 | } |
942 | 949 | ||
... | @@ -991,7 +998,12 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -991,7 +998,12 @@ public class UserOperationServiceImpl implements UserOperationService { |
991 | log.info("大屏账号置空主会员的结果,userTvDTO ==>> {}", _userTvDTO); | 998 | log.info("大屏账号置空主会员的结果,userTvDTO ==>> {}", _userTvDTO); |
992 | ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUnbind(new MemberAndUserTvDTO(memberDTO, _userTvDTO)); | 999 | ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUnbind(new MemberAndUserTvDTO(memberDTO, _userTvDTO)); |
993 | 1000 | ||
994 | this.updateUserTvSimplePriorityMemberCodeRedis(platformAccount, ""); | 1001 | UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(platformAccount); |
1002 | if (Objects.nonNull(userTvSimpleDTO.getPlatformAccount())) { | ||
1003 | userTvSimpleDTO.setPriorityMemberCode(""); | ||
1004 | JSONObject hashMap = JSONObject.parseObject(JSON.toJSONString(userTvSimpleDTO), JSONObject.class); | ||
1005 | this.redisUtils.set(RedisKeyConstants.cacheVisUserByPlatformAccount + "::" + platformAccount, hashMap); | ||
1006 | } | ||
995 | 1007 | ||
996 | } else { | 1008 | } else { |
997 | 1009 | ||
... | @@ -1006,7 +1018,13 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -1006,7 +1018,13 @@ public class UserOperationServiceImpl implements UserOperationService { |
1006 | _userTvDTO.setPriorityMemberCode(bindMemberCode); | 1018 | _userTvDTO.setPriorityMemberCode(bindMemberCode); |
1007 | log.info("大屏账号置空主会员的结果,userTvDTO ==>> {}", userTvDTO); | 1019 | log.info("大屏账号置空主会员的结果,userTvDTO ==>> {}", userTvDTO); |
1008 | ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUnbind(new MemberAndUserTvDTO(memberDTO, _userTvDTO)); | 1020 | ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUnbind(new MemberAndUserTvDTO(memberDTO, _userTvDTO)); |
1009 | this.updateUserTvSimplePriorityMemberCodeRedis(platformAccount, bindMemberCode); | 1021 | |
1022 | UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(platformAccount); | ||
1023 | if (Objects.nonNull(userTvSimpleDTO.getPlatformAccount())) { | ||
1024 | userTvSimpleDTO.setPriorityMemberCode(bindMemberCode); | ||
1025 | JSONObject hashMap = JSONObject.parseObject(JSON.toJSONString(userTvSimpleDTO), JSONObject.class); | ||
1026 | this.redisUtils.set(RedisKeyConstants.cacheVisUserByPlatformAccount + "::" + platformAccount, hashMap); | ||
1027 | } | ||
1010 | } | 1028 | } |
1011 | 1029 | ||
1012 | return true; | 1030 | return true; |
... | @@ -1289,7 +1307,12 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -1289,7 +1307,12 @@ public class UserOperationServiceImpl implements UserOperationService { |
1289 | ((UserOperationServiceImpl)AopContext.currentProxy()) | 1307 | ((UserOperationServiceImpl)AopContext.currentProxy()) |
1290 | .asyncMinaBind(new MemberAndUserTvDTO(memberDTO, userTvDTO)); | 1308 | .asyncMinaBind(new MemberAndUserTvDTO(memberDTO, userTvDTO)); |
1291 | 1309 | ||
1292 | this.updateUserTvSimplePriorityMemberCodeRedis(platformAccount, memberDTO.getCode()); | 1310 | UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(platformAccount); |
1311 | if (Objects.nonNull(userTvSimpleDTO.getPlatformAccount()) && StringUtils.isBlank(userTvSimpleDTO.getPriorityMemberCode())) { | ||
1312 | userTvSimpleDTO.setPriorityMemberCode(priorityMemberCode); | ||
1313 | JSONObject hashMap = JSONObject.parseObject(JSON.toJSONString(userTvSimpleDTO), JSONObject.class); | ||
1314 | this.redisUtils.set(RedisKeyConstants.cacheVisUserByPlatformAccount + "::" + platformAccount, hashMap); | ||
1315 | } | ||
1293 | 1316 | ||
1294 | return true; | 1317 | return true; |
1295 | } | 1318 | } |
... | @@ -1364,7 +1387,12 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -1364,7 +1387,12 @@ public class UserOperationServiceImpl implements UserOperationService { |
1364 | // 同步至大屏侧 | 1387 | // 同步至大屏侧 |
1365 | ((UserOperationServiceImpl)AopContext.currentProxy()).asyncMinaBind(new MemberAndUserTvDTO(memberDTO, userTvDTO)); | 1388 | ((UserOperationServiceImpl)AopContext.currentProxy()).asyncMinaBind(new MemberAndUserTvDTO(memberDTO, userTvDTO)); |
1366 | 1389 | ||
1367 | this.updateUserTvSimplePriorityMemberCodeRedis(platformAccount, memberDTO.getCode()); | 1390 | UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(platformAccount); |
1391 | if (Objects.nonNull(userTvSimpleDTO.getPlatformAccount()) && StringUtils.isBlank(userTvSimpleDTO.getPriorityMemberCode())) { | ||
1392 | userTvSimpleDTO.setPriorityMemberCode(priorityMemberCode); | ||
1393 | JSONObject hashMap = JSONObject.parseObject(JSON.toJSONString(userTvSimpleDTO), JSONObject.class); | ||
1394 | this.redisUtils.set(RedisKeyConstants.cacheVisUserByPlatformAccount + "::" + platformAccount, hashMap); | ||
1395 | } | ||
1368 | 1396 | ||
1369 | return userTvDTO; | 1397 | return userTvDTO; |
1370 | } | 1398 | } |
... | @@ -1373,7 +1401,7 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -1373,7 +1401,7 @@ public class UserOperationServiceImpl implements UserOperationService { |
1373 | private void updateUserTvSimplePriorityMemberCodeRedis(String platformAccount, String priorityMemberCode){ | 1401 | private void updateUserTvSimplePriorityMemberCodeRedis(String platformAccount, String priorityMemberCode){ |
1374 | // 修改缓存中MemberSimple的大屏主账号信息,因为执行任务之前会去检查主会员d | 1402 | // 修改缓存中MemberSimple的大屏主账号信息,因为执行任务之前会去检查主会员d |
1375 | UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(platformAccount); | 1403 | UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(platformAccount); |
1376 | if (Objects.nonNull(userTvSimpleDTO)) { | 1404 | if (Objects.nonNull(userTvSimpleDTO.getPlatformAccount()) && StringUtils.isBlank(userTvSimpleDTO.getPriorityMemberCode())) { |
1377 | userTvSimpleDTO.setPriorityMemberCode(priorityMemberCode); | 1405 | userTvSimpleDTO.setPriorityMemberCode(priorityMemberCode); |
1378 | JSONObject hashMap = JSONObject.parseObject(JSON.toJSONString(userTvSimpleDTO), JSONObject.class); | 1406 | JSONObject hashMap = JSONObject.parseObject(JSON.toJSONString(userTvSimpleDTO), JSONObject.class); |
1379 | this.redisUtils.set(RedisKeyConstants.cacheVisUserByPlatformAccount + "::" + platformAccount, hashMap); | 1407 | this.redisUtils.set(RedisKeyConstants.cacheVisUserByPlatformAccount + "::" + platformAccount, hashMap); |
... | @@ -1593,7 +1621,12 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -1593,7 +1621,12 @@ public class UserOperationServiceImpl implements UserOperationService { |
1593 | log.info("同步绑定信息至大屏侧, 参数 ==>> {}", new MemberAndUserTvDTO(memberDTO, _userTvDTO)); | 1621 | log.info("同步绑定信息至大屏侧, 参数 ==>> {}", new MemberAndUserTvDTO(memberDTO, _userTvDTO)); |
1594 | ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUnbind(new MemberAndUserTvDTO(memberDTO, _userTvDTO)); | 1622 | ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUnbind(new MemberAndUserTvDTO(memberDTO, _userTvDTO)); |
1595 | 1623 | ||
1596 | this.updateUserTvSimplePriorityMemberCodeRedis(userTvDTO.getPlatformAccount(), userTv.getPriorityMemberCode()); | 1624 | UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(userTvDTO.getPlatformAccount()); |
1625 | if (Objects.nonNull(userTvSimpleDTO.getPlatformAccount())) { | ||
1626 | userTvSimpleDTO.setPriorityMemberCode(userTv.getPriorityMemberCode()); | ||
1627 | JSONObject hashMap = JSONObject.parseObject(JSON.toJSONString(userTvSimpleDTO), JSONObject.class); | ||
1628 | this.redisUtils.set(RedisKeyConstants.cacheVisUserByPlatformAccount + "::" + userTvDTO.getPlatformAccount(), hashMap); | ||
1629 | } | ||
1597 | } | 1630 | } |
1598 | 1631 | ||
1599 | } else { | 1632 | } else { |
... | @@ -1609,7 +1642,13 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -1609,7 +1642,13 @@ public class UserOperationServiceImpl implements UserOperationService { |
1609 | _userTvDTO.setPriorityMemberCode(null); | 1642 | _userTvDTO.setPriorityMemberCode(null); |
1610 | log.info("同步绑定信息至大屏侧, 参数 ==>> {}", new MemberAndUserTvDTO(memberDTO, _userTvDTO)); | 1643 | log.info("同步绑定信息至大屏侧, 参数 ==>> {}", new MemberAndUserTvDTO(memberDTO, _userTvDTO)); |
1611 | ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUnbind(new MemberAndUserTvDTO(memberDTO, _userTvDTO)); | 1644 | ((UserOperationServiceImpl)AopContext.currentProxy()).asyncUnbind(new MemberAndUserTvDTO(memberDTO, _userTvDTO)); |
1612 | this.updateUserTvSimplePriorityMemberCodeRedis(userTvDTO.getPlatformAccount(), ""); | 1645 | |
1646 | UserTvSimpleDTO userTvSimpleDTO = this.userTvService.findSimpleByPlatformAccount(userTvDTO.getPlatformAccount()); | ||
1647 | if (Objects.nonNull(userTvSimpleDTO.getPlatformAccount())) { | ||
1648 | userTvSimpleDTO.setPriorityMemberCode(""); | ||
1649 | JSONObject hashMap = JSONObject.parseObject(JSON.toJSONString(userTvSimpleDTO), JSONObject.class); | ||
1650 | this.redisUtils.set(RedisKeyConstants.cacheVisUserByPlatformAccount + "::" + userTvDTO.getPlatformAccount(), hashMap); | ||
1651 | } | ||
1613 | } | 1652 | } |
1614 | 1653 | ||
1615 | return ResultInfo.success("解绑成功"); | 1654 | return ResultInfo.success("解绑成功"); | ... | ... |
-
Please register or sign in to post a comment