Commit c2352660 c2352660f63e8d2617a9a60851b89dabc9d4bc77 by 鲁二龙

手动发送消息

1 parent 2dbf40c9
package com.topdraw.business.module.member.service.impl;
import com.alibaba.fastjson.JSON;
import com.topdraw.aspect.AsyncMqSend;
import com.topdraw.business.module.member.domain.Member;
import com.topdraw.business.module.member.repository.MemberRepository;
......@@ -10,6 +11,8 @@ import com.topdraw.business.module.member.service.mapper.MemberMapper;
import com.topdraw.business.module.member.viphistory.domain.MemberVipHistory;
import com.topdraw.business.module.member.viphistory.service.MemberVipHistoryService;
import com.topdraw.business.module.member.viphistory.service.impl.MemberVipHistoryBuilder;
import com.topdraw.mq.domain.TableOperationMsg;
import com.topdraw.mq.producer.MessageProducer;
import com.topdraw.util.IdWorker;
import com.topdraw.util.RedissonUtil;
import com.topdraw.utils.PageUtil;
......@@ -53,6 +56,8 @@ public class MemberServiceImpl implements MemberService {
private RedissonClient redissonClient;
@Autowired
PlatformTransactionManager platformTransactionManager;
@Autowired
MessageProducer messageProducer;
@Override
public Map<String, Object> queryAll(MemberQueryCriteria criteria, Pageable pageable) {
......@@ -122,7 +127,6 @@ public class MemberServiceImpl implements MemberService {
@Override
@Transactional(rollbackFor = Exception.class)
@AsyncMqSend()
public void update(Member resources) {
RLock rLock = this.redissonClient.getLock("member::update::id" + resources.getId().toString());
try {
......@@ -131,6 +135,15 @@ public class MemberServiceImpl implements MemberService {
ValidationUtil.isNull(member.getId(), "Member", "id", resources.getId());
member.copy(resources);
this.save(member);
TableOperationMsg tableOperationMsg = new TableOperationMsg();
tableOperationMsg.setMethodName("update");
tableOperationMsg.setEntityBody(JSON.toJSONString(resources));
tableOperationMsg.setInterfaceName("com.topdraw.business.module.member.service.impl.MemberServiceImpl");
tableOperationMsg.setEntityName("com.topdraw.business.module.member.domain.Member");
messageProducer.sendMessage(JSON.toJSONString(tableOperationMsg));
} catch (Exception e) {
e.printStackTrace();
throw e;
......