Commit 4df7bb5d 4df7bb5d9e6d1ac0c61ed92d88667cad030e63a8 by xianghan

1.优化

1 parent e6a0d117
......@@ -9,6 +9,7 @@ import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
import org.springframework.retry.annotation.EnableRetry;
import org.springframework.scheduling.annotation.EnableAsync;
......@@ -24,6 +25,7 @@ import org.springframework.transaction.annotation.EnableTransactionManagement;
@EnableRetry
@EnableCaching
@SpringBootApplication(exclude = {SecurityAutoConfiguration.class})
@EnableAspectJAutoProxy(proxyTargetClass = true, exposeProxy = true)
public class MemberServiceApplication extends SpringBootServletInitializer {
public static void main(String[] args) {
......
......@@ -2,6 +2,8 @@ package com.topdraw.aspect;
import com.alibaba.fastjson.JSON;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO;
import com.topdraw.mq.domain.TableOperationMsg;
import com.topdraw.mq.producer.MessageProducer;
import lombok.extern.slf4j.Slf4j;
......
package com.topdraw.business.process.service.dto;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author :
* @description:
* @function :
* @date :Created in 2022/3/23 9:48
* @version: :
* @modified By:
* @since : modified in 2022/3/23 9:48
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MemberAndUserTvDTO implements Serializable {
private MemberDTO memberDTO;
private UserTvDTO userTvDTO;
}
package com.topdraw.business.process.service.dto;
import com.topdraw.business.module.member.service.dto.MemberDTO;
import com.topdraw.business.module.user.iptv.service.dto.UserTvDTO;
import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @author :
* @description:
* @function :
* @date :Created in 2022/3/23 9:48
* @version: :
* @modified By:
* @since : modified in 2022/3/23 9:48
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
public class MemberAndWeixinUserDTO implements Serializable {
private MemberDTO memberDTO;
private UserWeixinDTO userWeixinDTO;
}
......@@ -4,6 +4,7 @@ import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.topdraw.aspect.AsyncMqSend;
import com.topdraw.business.module.member.domain.Member;
......@@ -28,18 +29,22 @@ import com.topdraw.business.module.user.weixin.service.dto.UserWeixinDTO;
import com.topdraw.business.module.user.weixin.service.dto.UserWeixinQueryCriteria;
import com.topdraw.business.process.domian.weixin.*;
import com.topdraw.business.process.service.UserOperationService;
import com.topdraw.business.process.service.dto.MemberAndUserTvDTO;
import com.topdraw.business.process.service.dto.MemberAndWeixinUserDTO;
import com.topdraw.business.process.service.mapper.CollectionMq2DetailMapper;
import com.topdraw.config.LocalConstants;
import com.topdraw.config.RedisKeyUtil;
import com.topdraw.exception.BadRequestException;
import com.topdraw.exception.EntityNotFoundException;
import com.topdraw.exception.GlobeExceptionMsg;
import com.topdraw.mq.producer.MessageProducer;
import com.topdraw.util.TimestampUtil;
import com.topdraw.utils.QueryHelp;
import com.topdraw.utils.RedisUtils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.aop.framework.AopContext;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -50,6 +55,7 @@ import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;
import javax.annotation.Resource;
import java.nio.charset.StandardCharsets;
import java.time.LocalDateTime;
import java.util.*;
......@@ -96,15 +102,29 @@ public class UserOperationServiceImpl implements UserOperationService {
@AsyncMqSend
public void asyncWeixinMemberAndUserWeixin4Iptv(MemberDTO memberDTO, UserWeixinDTO weixinDTO) {}
public void asyncMemberAndUserWeixin4Iptv(MemberAndWeixinUserDTO memberAndWeixinUserDTO) {
messageProducer.sendMessage(JSON.toJSONString(memberAndWeixinUserDTO));
}
@AsyncMqSend
public void asyncMemberAndUserTv4Iptv(MemberDTO memberDTO, UserTvDTO userTvDTO) {}
public void asyncMemberAndUserTv4Iptv(MemberAndUserTvDTO memberAndUserTv) {
//messageProducer.sendMessage(JSON.toJSONString(memberAndUserTv));
}
@AsyncMqSend
public void asyncWeixin(UserWeixinDTO weixinDTO) {}
public void asyncWeixin(UserWeixinDTO weixinDTO) {
messageProducer.sendMessage(JSON.toJSONString(weixinDTO));
}
@AsyncMqSend
public void asyncUserTv(UserTvDTO userTvDTO) {}
public void asyncUserTv(UserTvDTO userTvDTO) {
messageProducer.sendMessage(JSON.toJSONString(userTvDTO));
}
@AsyncMqSend
public void asyncMember(MemberDTO memberDTO) {}
public void asyncMember(MemberDTO memberDTO) {
messageProducer.sendMessage(JSON.toJSONString(memberDTO));
}
@Autowired
private MessageProducer messageProducer;
/**
* 创建大屏账户同时创建会员
......@@ -134,18 +154,19 @@ public class UserOperationServiceImpl implements UserOperationService {
// 创建大屏账户
UserTvDTO tvUserDTO = this.createTvUser(userTv, memberDTO.getId(), memberDTO.getCode());
this.asyncMemberAndUserTv4Iptv(memberDTO,tvUserDTO);
((UserOperationServiceImpl)AopContext.currentProxy()).asyncMemberAndUserTv4Iptv(new MemberAndUserTvDTO(memberDTO, tvUserDTO));
return tvUserDTO;
}
throw new EntityNotFoundException(MemberDTO.class,"code",GlobeExceptionMsg.MEMBER_ID_IS_NULL);
throw new EntityNotFoundException(MemberDTO.class, "code", GlobeExceptionMsg.MEMBER_ID_IS_NULL);
}
throw new BadRequestException(GlobeExceptionMsg.ENTITY_ALREADY_EXISTS);
}
/**
......@@ -182,7 +203,7 @@ public class UserOperationServiceImpl implements UserOperationService {
UserWeixinDTO weixinDTO = this.createWeixinUser(userWeixin, memberDTO.getId(), memberDTO.getCode());
// 同步至iptv
this.asyncWeixinMemberAndUserWeixin4Iptv(memberDTO,weixinDTO);
this.asyncWeixin(weixinDTO);
return weixinDTO;
}
......@@ -202,7 +223,7 @@ public class UserOperationServiceImpl implements UserOperationService {
UserWeixinDTO _userWeixinDTO1 = this.createWeixinUser(userWeixin, memberDTO.getId(), memberDTO.getCode());
// 同步至iptv
this.asyncWeixinMemberAndUserWeixin4Iptv(memberDTO,_userWeixinDTO1);
this.asyncMemberAndUserWeixin4Iptv(new MemberAndWeixinUserDTO(memberDTO, _userWeixinDTO1));
return _userWeixinDTO1;
}
......@@ -339,7 +360,7 @@ public class UserOperationServiceImpl implements UserOperationService {
MemberDTO _memberDTO = this.doUpdateMemberVip(memberDTO, 0);
// 同步至iptv
this.asyncWeixinMemberAndUserWeixin4Iptv(_memberDTO,userWeixinDTO);
this.asyncMemberAndUserWeixin4Iptv(new MemberAndWeixinUserDTO(memberDTO, userWeixinDTO));
return true;
}
......@@ -435,7 +456,7 @@ public class UserOperationServiceImpl implements UserOperationService {
UserTvDTO _userTvDTO = this.resetMainAccount(memberCode, userTvDTO.getId());
// 同步至iptv
this.asyncMemberAndUserTv4Iptv(_memberDTO, _userTvDTO);
this.asyncMemberAndUserTv4Iptv(new MemberAndUserTvDTO(_memberDTO, _userTvDTO));
}
@Override
......@@ -682,7 +703,7 @@ public class UserOperationServiceImpl implements UserOperationService {
MemberDTO _memberDTO = this.doUpdateMemberByMemberDTO(memberDTO);
// 同步至iptv
this.asyncMemberAndUserTv4Iptv(_memberDTO, _userTvDTO);
this.asyncMemberAndUserTv4Iptv(new MemberAndUserTvDTO(_memberDTO, _userTvDTO));
return true;
}
......@@ -763,7 +784,7 @@ public class UserOperationServiceImpl implements UserOperationService {
MemberDTO _memberDTO = this.doUpdateMemberByMemberDTO(memberDTO);
// 同步至iptv
this.asyncMemberAndUserTv4Iptv(_memberDTO,_userTvDTO);
this.asyncMemberAndUserTv4Iptv(new MemberAndUserTvDTO(_memberDTO, _userTvDTO));
return null;
}
......