1.同步master,优化任务处理过程
Showing
13 changed files
with
164 additions
and
26 deletions
| 1 | package com.topdraw.business.module.task.template.constant; | ||
| 2 | |||
| 3 | /** | ||
| 4 | * @author : | ||
| 5 | * @description: | ||
| 6 | * @function : | ||
| 7 | * @date :Created in 2022/6/18 14:30 | ||
| 8 | * @version: : | ||
| 9 | * @modified By: | ||
| 10 | * @since : modified in 2022/6/18 14:30 | ||
| 11 | */ | ||
| 12 | public interface TaskEventName { | ||
| 13 | //类型 1:登录;2:观影;3:参加活动;4:订购;5:优享会员;6:签到;7:完成设置; | ||
| 14 | // 8:播放记录;10:跨屏绑定;11:积分转移;30:积分兑换商品;98:系统操作;99:其他 | ||
| 15 | String LOGIN = "LOGIN"; | ||
| 16 | String VIEW = "VIEW"; | ||
| 17 | String ACTIVITY = "ACTIVITY"; | ||
| 18 | String ORDER = "ORDER"; | ||
| 19 | String MEMBER_PRIORITY = "MEMBER_PRIORITY"; | ||
| 20 | String SIGN = "SIGN"; | ||
| 21 | String COMPLETE_INFO = "COMPLETE_INFO"; | ||
| 22 | String PLAY = "PLAY"; | ||
| 23 | String BINDING = "BINDING"; | ||
| 24 | String POINTS_TRANS = "POINTS_TRANS"; | ||
| 25 | String POINTS_EXCHANGE_GOODS = "POINTS_EXCHANGE_GOODS"; | ||
| 26 | String SYSTEM_OPERATE = "SYSTEM_OPERATE"; | ||
| 27 | String OTHER = "OHHER"; | ||
| 28 | |||
| 29 | } |
| 1 | package com.topdraw.business.module.task.template.constant; | ||
| 2 | |||
| 3 | /** | ||
| 4 | * @author : | ||
| 5 | * @description: | ||
| 6 | * @function : | ||
| 7 | * @date :Created in 2022/6/18 14:30 | ||
| 8 | * @version: : | ||
| 9 | * @modified By: | ||
| 10 | * @since : modified in 2022/6/18 14:30 | ||
| 11 | */ | ||
| 12 | public interface TaskEventType { | ||
| 13 | //类型 1:登录;2:观影;3:参加活动;4:订购;5:优享会员;6:签到;7:完成设置; | ||
| 14 | // 8:播放记录;10:跨屏绑定;11:积分转移;30:积分兑换商品;98:系统操作;99:其他 | ||
| 15 | int LOGIN = 1; | ||
| 16 | int VIEW = 2; | ||
| 17 | int ACTIVITY = 3; | ||
| 18 | int ORDER = 4; | ||
| 19 | int MEMBER_PRIORITY = 5; | ||
| 20 | int SIGN = 6; | ||
| 21 | int COMPLETE_INFO = 7; | ||
| 22 | int PLAY = 8; | ||
| 23 | int BINDING = 10; | ||
| 24 | int POINTS_TRANS = 11; | ||
| 25 | int POINTS_EXCHANGE_GOODS = 30; | ||
| 26 | int SYSTEM_OPERATE = 98; | ||
| 27 | int OHHER = 99; | ||
| 28 | |||
| 29 | } |
| ... | @@ -56,4 +56,11 @@ public interface UserTvRepository extends JpaRepository<UserTv, Long>, JpaSpecif | ... | @@ -56,4 +56,11 @@ public interface UserTvRepository extends JpaRepository<UserTv, Long>, JpaSpecif |
| 56 | " `vis_user_id` = :#{#resources.visUserId}, " + | 56 | " `vis_user_id` = :#{#resources.visUserId}, " + |
| 57 | " `update_time` = now() WHERE `platform_account` = :#{#resources.platformAccount}", nativeQuery = true) | 57 | " `update_time` = now() WHERE `platform_account` = :#{#resources.platformAccount}", nativeQuery = true) |
| 58 | void updateUserTvByPlatformAccount(@Param("resources") UserTv userTv); | 58 | void updateUserTvByPlatformAccount(@Param("resources") UserTv userTv); |
| 59 | |||
| 60 | Long countByPlatformAccount(String platformAccount); | ||
| 61 | |||
| 62 | @Modifying | ||
| 63 | @Query(value = "UPDATE `uc_user_tv` SET `priority_member_code` = :#{#resources.priorityMemberCode}, " + | ||
| 64 | "`update_time` = now() WHERE `platform_account` = :#{#resources.platformAccount}", nativeQuery = true) | ||
| 65 | void updatePriorityMemberCode(@Param("resources") UserTv userTv); | ||
| 59 | } | 66 | } | ... | ... |
| ... | @@ -108,4 +108,17 @@ public interface UserTvService { | ... | @@ -108,4 +108,17 @@ public interface UserTvService { |
| 108 | * @param userTv | 108 | * @param userTv |
| 109 | */ | 109 | */ |
| 110 | void updateUserTvByPlatformAccount(UserTv userTv); | 110 | void updateUserTvByPlatformAccount(UserTv userTv); |
| 111 | |||
| 112 | /** | ||
| 113 | * | ||
| 114 | * @param platformAccount | ||
| 115 | * @return | ||
| 116 | */ | ||
| 117 | Long countByPlatformAccount(String platformAccount); | ||
| 118 | |||
| 119 | /** | ||
| 120 | * | ||
| 121 | * @param userTv | ||
| 122 | */ | ||
| 123 | void doUpdatePriorityMemberCode(UserTv userTv); | ||
| 111 | } | 124 | } | ... | ... |
| ... | @@ -62,6 +62,16 @@ public class UserTvServiceImpl implements UserTvService { | ... | @@ -62,6 +62,16 @@ public class UserTvServiceImpl implements UserTvService { |
| 62 | this.userTvRepository.updateUserTvByPlatformAccount(userTv); | 62 | this.userTvRepository.updateUserTvByPlatformAccount(userTv); |
| 63 | } | 63 | } |
| 64 | 64 | ||
| 65 | @Override | ||
| 66 | public Long countByPlatformAccount(String platformAccount) { | ||
| 67 | return this.userTvRepository.countByPlatformAccount(platformAccount); | ||
| 68 | } | ||
| 69 | |||
| 70 | @Override | ||
| 71 | public void doUpdatePriorityMemberCode(UserTv userTv) { | ||
| 72 | this.userTvRepository.updatePriorityMemberCode(userTv); | ||
| 73 | } | ||
| 74 | |||
| 65 | 75 | ||
| 66 | /** | 76 | /** |
| 67 | * 获取大屏账户对应的会员 | 77 | * 获取大屏账户对应的会员 | ... | ... |
| ... | @@ -21,13 +21,7 @@ public class ExpOperationServiceImpl implements ExpOperationService { | ... | @@ -21,13 +21,7 @@ public class ExpOperationServiceImpl implements ExpOperationService { |
| 21 | @Autowired | 21 | @Autowired |
| 22 | private ExpDetailService expDetailService; | 22 | private ExpDetailService expDetailService; |
| 23 | @Autowired | 23 | @Autowired |
| 24 | private MemberOperationService memberOperationService; | ||
| 25 | @Autowired | ||
| 26 | private MemberLevelService memberLevelService; | ||
| 27 | @Autowired | ||
| 28 | private MemberService memberService; | 24 | private MemberService memberService; |
| 29 | @Autowired | ||
| 30 | ThreadPoolTaskExecutor threadPoolTaskExecutor; | ||
| 31 | 25 | ||
| 32 | public void asyncMemberExpAndLevel(Member member) { | 26 | public void asyncMemberExpAndLevel(Member member) { |
| 33 | String code = member.getCode(); | 27 | String code = member.getCode(); | ... | ... |
| ... | @@ -349,6 +349,31 @@ public class UserOperationServiceImpl implements UserOperationService { | ... | @@ -349,6 +349,31 @@ public class UserOperationServiceImpl implements UserOperationService { |
| 349 | } | 349 | } |
| 350 | 350 | ||
| 351 | @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) | 351 | @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) |
| 352 | public void asyncUserTvChangeMainAccount(UserTvDTO userTvDTO) { | ||
| 353 | log.info("asyncUserTv ==>> userTvDTO ==>> {}", userTvDTO); | ||
| 354 | |||
| 355 | String priorityMemberCode = userTvDTO.getPriorityMemberCode(); | ||
| 356 | if (StringUtils.isBlank(priorityMemberCode)) { | ||
| 357 | log.error("大屏账号设置主会员异常,主会员code不存在"); | ||
| 358 | return; | ||
| 359 | } | ||
| 360 | |||
| 361 | String platformAccount = userTvDTO.getPlatformAccount(); | ||
| 362 | UserTvDTO _userTvDTO = this.userTvService.findByPlatformAccount(platformAccount); | ||
| 363 | log.info("从数据库中获取大屏信息, _userTvDTO ==>> {}", _userTvDTO); | ||
| 364 | if (Objects.isNull(_userTvDTO.getId())) { | ||
| 365 | log.error("大屏账号设置主会员异常,大屏账号不存在"); | ||
| 366 | return; | ||
| 367 | } | ||
| 368 | |||
| 369 | UserTv userTv = new UserTv(); | ||
| 370 | userTv.setId(_userTvDTO.getId()); | ||
| 371 | userTv.setPriorityMemberCode(priorityMemberCode); | ||
| 372 | log.info("开始修改大屏数据,userTv ==>>{}", userTv); | ||
| 373 | this.userTvService.doUpdatePriorityMemberCode(userTv); | ||
| 374 | } | ||
| 375 | |||
| 376 | @Transactional(propagation = Propagation.SUPPORTS, rollbackFor = Exception.class) | ||
| 352 | public void asyncUserTv(UserTvDTO userTvDTO) { | 377 | public void asyncUserTv(UserTvDTO userTvDTO) { |
| 353 | log.info("asyncUserTv ==>> userTvDTO ==>> {}", userTvDTO); | 378 | log.info("asyncUserTv ==>> userTvDTO ==>> {}", userTvDTO); |
| 354 | String platformAccount = userTvDTO.getPlatformAccount(); | 379 | String platformAccount = userTvDTO.getPlatformAccount(); | ... | ... |
| 1 | package com.topdraw.config.redis; | ||
| 2 | |||
| 3 | /** | ||
| 4 | * @author : | ||
| 5 | * @description: | ||
| 6 | * @function : | ||
| 7 | * @date :Created in 2022/6/18 17:22 | ||
| 8 | * @version: : | ||
| 9 | * @modified By: | ||
| 10 | * @since : modified in 2022/6/18 17:22 | ||
| 11 | */ | ||
| 12 | public class RedisKeyConstant { | ||
| 13 | |||
| 14 | |||
| 15 | public static final String CACHE_PLATFROMACCOUNT_PLAYDURATION = "ucc::play::playduration::"; | ||
| 16 | } |
This diff is collapsed.
Click to expand it.
| ... | @@ -42,24 +42,23 @@ public class RestTemplateClient { | ... | @@ -42,24 +42,23 @@ public class RestTemplateClient { |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | public JSONObject dealTask(DataSyncMsg dataSyncMsg) { | 44 | public JSONObject dealTask(DataSyncMsg dataSyncMsg) { |
| 45 | JSONObject resultSet = null; | ||
| 45 | String url = BASE_URL + "/uce/taskOperation/dealTask"; | 46 | String url = BASE_URL + "/uce/taskOperation/dealTask"; |
| 46 | log.info("request uc : url is " + url + ", dataSyncMsg is " + dataSyncMsg); | 47 | log.info("request uc : url is " + url + ", dataSyncMsg is " + dataSyncMsg); |
| 47 | String content = JSON.toJSONString(dataSyncMsg); | 48 | String content = JSON.toJSONString(dataSyncMsg); |
| 48 | HashMap<Object, Object> objectObjectHashMap = new HashMap<>(); | 49 | HashMap<Object, Object> objectObjectHashMap = new HashMap<>(); |
| 49 | objectObjectHashMap.put("content", content); | 50 | objectObjectHashMap.put("content", content); |
| 50 | log.info("===>>>" + content); | ||
| 51 | restTemplate.postForEntity(url, objectObjectHashMap, String.class); | 51 | restTemplate.postForEntity(url, objectObjectHashMap, String.class); |
| 52 | /* ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, objectObjectHashMap, String.class); | 52 | ResponseEntity<String> responseEntity = restTemplate.postForEntity(url, objectObjectHashMap, String.class); |
| 53 | if (responseEntity.getStatusCode().is2xxSuccessful()) { | 53 | if (responseEntity.getStatusCode().is2xxSuccessful()) { |
| 54 | String entityBody = responseEntity.getBody();444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444被44444444444444 444444 44444 44444 44444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444444 | 54 | String entityBody = responseEntity.getBody(); |
| 55 | JSONObject jsonObject = JSONObject.parseObject(entityBody); | 55 | JSONObject jsonObject = JSONObject.parseObject(entityBody); |
| 56 | if (jsonObject.getInteger("businessCode").equals(200)) { | 56 | if (jsonObject.getInteger("businessCode").equals(ResponseStatusConstant.OK)) { |
| 57 | resultSet = jsonObject.getJSONArray("resultSet").getJSONObject(0); | 57 | resultSet = jsonObject.getJSONArray("resultSet").getJSONObject(0); |
| 58 | } | 58 | } |
| 59 | } | 59 | } |
| 60 | log.info("uc response: " + resultSet.toJSONString()); | 60 | log.info("uc response: " + resultSet.toJSONString()); |
| 61 | return resultSet;*/ | 61 | return resultSet; |
| 62 | return null; | ||
| 63 | } | 62 | } |
| 64 | 63 | ||
| 65 | public JSONObject getMemberInfo(Long memberId) { | 64 | public JSONObject getMemberInfo(Long memberId) { | ... | ... |
| ... | @@ -99,12 +99,12 @@ mutil-mq: | ... | @@ -99,12 +99,12 @@ mutil-mq: |
| 99 | service: | 99 | service: |
| 100 | mq: | 100 | mq: |
| 101 | list: | 101 | list: |
| 102 | # - source: event | 102 | - source: event |
| 103 | # exchange: event.exchange | 103 | exchange: event.exchange |
| 104 | # queue: event.queue | 104 | queue: event.queue |
| 105 | # exchange-type: direct | 105 | exchange-type: direct |
| 106 | # routing-key: | 106 | routing-key: |
| 107 | # active: service | 107 | active: service |
| 108 | - source: collection | 108 | - source: collection |
| 109 | exchange: exchange.collection | 109 | exchange: exchange.collection |
| 110 | queue: collection.queue | 110 | queue: collection.queue |
| ... | @@ -136,12 +136,12 @@ service: | ... | @@ -136,12 +136,12 @@ service: |
| 136 | # exchange-type: direct | 136 | # exchange-type: direct |
| 137 | # routing-key: | 137 | # routing-key: |
| 138 | # active: service | 138 | # active: service |
| 139 | # - source: eventBus | 139 | - source: eventBus |
| 140 | # exchange: uc.eventbus | 140 | exchange: uc.eventbus |
| 141 | # queue: uc.eventbus | 141 | queue: uc.eventbus |
| 142 | # exchange-type: topic | 142 | exchange-type: topic |
| 143 | # routing-key: uc.eventbus.*.topic | 143 | routing-key: uc.eventbus.*.topic |
| 144 | # active: service | 144 | active: service |
| 145 | - source: uce | 145 | - source: uce |
| 146 | exchange: uce.exchange | 146 | exchange: uce.exchange |
| 147 | queue: uce.queue | 147 | queue: uce.queue | ... | ... |
| ... | @@ -64,12 +64,12 @@ | ... | @@ -64,12 +64,12 @@ |
| 64 | 64 | ||
| 65 | 65 | ||
| 66 | <!--监控sql日志输出 --> | 66 | <!--监控sql日志输出 --> |
| 67 | <logger name="jdbc.sqlonly" level="INFO" additivity="false"> | 67 | <logger name="jdbc.sqlonly" level="OFF" additivity="false"> |
| 68 | <appender-ref ref="console" /> | 68 | <appender-ref ref="console" /> |
| 69 | <appender-ref ref="info" /> | 69 | <appender-ref ref="info" /> |
| 70 | </logger> | 70 | </logger> |
| 71 | 71 | ||
| 72 | <logger name="jdbc.resultset" level="ERROR" additivity="false"> | 72 | <logger name="jdbc.resultset" level="OFF" additivity="false"> |
| 73 | <appender-ref ref="console" /> | 73 | <appender-ref ref="console" /> |
| 74 | <appender-ref ref="info" /> | 74 | <appender-ref ref="info" /> |
| 75 | </logger> | 75 | </logger> | ... | ... |
-
Please register or sign in to post a comment