手动发送消息
Showing
1 changed file
with
14 additions
and
1 deletions
| 1 | package com.topdraw.business.module.member.service.impl; | 1 | package com.topdraw.business.module.member.service.impl; |
| 2 | 2 | ||
| 3 | import com.alibaba.fastjson.JSON; | ||
| 3 | import com.topdraw.aspect.AsyncMqSend; | 4 | import com.topdraw.aspect.AsyncMqSend; |
| 4 | import com.topdraw.business.module.member.domain.Member; | 5 | import com.topdraw.business.module.member.domain.Member; |
| 5 | import com.topdraw.business.module.member.repository.MemberRepository; | 6 | import com.topdraw.business.module.member.repository.MemberRepository; |
| ... | @@ -10,6 +11,8 @@ import com.topdraw.business.module.member.service.mapper.MemberMapper; | ... | @@ -10,6 +11,8 @@ import com.topdraw.business.module.member.service.mapper.MemberMapper; |
| 10 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; | 11 | import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory; |
| 11 | import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService; | 12 | import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService; |
| 12 | import com.topdraw.business.module.member.viphistory.service.impl.MemberVipHistoryBuilder; | 13 | import com.topdraw.business.module.member.viphistory.service.impl.MemberVipHistoryBuilder; |
| 14 | import com.topdraw.mq.domain.TableOperationMsg; | ||
| 15 | import com.topdraw.mq.producer.MessageProducer; | ||
| 13 | import com.topdraw.util.IdWorker; | 16 | import com.topdraw.util.IdWorker; |
| 14 | import com.topdraw.util.RedissonUtil; | 17 | import com.topdraw.util.RedissonUtil; |
| 15 | import com.topdraw.utils.PageUtil; | 18 | import com.topdraw.utils.PageUtil; |
| ... | @@ -53,6 +56,8 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -53,6 +56,8 @@ public class MemberServiceImpl implements MemberService { |
| 53 | private RedissonClient redissonClient; | 56 | private RedissonClient redissonClient; |
| 54 | @Autowired | 57 | @Autowired |
| 55 | PlatformTransactionManager platformTransactionManager; | 58 | PlatformTransactionManager platformTransactionManager; |
| 59 | @Autowired | ||
| 60 | MessageProducer messageProducer; | ||
| 56 | 61 | ||
| 57 | @Override | 62 | @Override |
| 58 | public Map<String, Object> queryAll(MemberQueryCriteria criteria, Pageable pageable) { | 63 | public Map<String, Object> queryAll(MemberQueryCriteria criteria, Pageable pageable) { |
| ... | @@ -122,7 +127,6 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -122,7 +127,6 @@ public class MemberServiceImpl implements MemberService { |
| 122 | 127 | ||
| 123 | @Override | 128 | @Override |
| 124 | @Transactional(rollbackFor = Exception.class) | 129 | @Transactional(rollbackFor = Exception.class) |
| 125 | @AsyncMqSend() | ||
| 126 | public void update(Member resources) { | 130 | public void update(Member resources) { |
| 127 | RLock rLock = this.redissonClient.getLock("member::update::id" + resources.getId().toString()); | 131 | RLock rLock = this.redissonClient.getLock("member::update::id" + resources.getId().toString()); |
| 128 | try { | 132 | try { |
| ... | @@ -131,6 +135,15 @@ public class MemberServiceImpl implements MemberService { | ... | @@ -131,6 +135,15 @@ public class MemberServiceImpl implements MemberService { |
| 131 | ValidationUtil.isNull(member.getId(), "Member", "id", resources.getId()); | 135 | ValidationUtil.isNull(member.getId(), "Member", "id", resources.getId()); |
| 132 | member.copy(resources); | 136 | member.copy(resources); |
| 133 | this.save(member); | 137 | this.save(member); |
| 138 | |||
| 139 | |||
| 140 | TableOperationMsg tableOperationMsg = new TableOperationMsg(); | ||
| 141 | tableOperationMsg.setMethodName("update"); | ||
| 142 | tableOperationMsg.setEntityBody(JSON.toJSONString(resources)); | ||
| 143 | tableOperationMsg.setInterfaceName("com.topdraw.business.module.member.service.impl.MemberServiceImpl"); | ||
| 144 | tableOperationMsg.setEntityName("com.topdraw.business.module.member.domain.Member"); | ||
| 145 | |||
| 146 | messageProducer.sendMessage(JSON.toJSONString(tableOperationMsg)); | ||
| 134 | } catch (Exception e) { | 147 | } catch (Exception e) { |
| 135 | e.printStackTrace(); | 148 | e.printStackTrace(); |
| 136 | throw e; | 149 | throw e; | ... | ... |
-
Please register or sign in to post a comment