Browse Source

居民信息变动 mq推送调整

dev_shibei_match
sunyuchao 4 years ago
parent
commit
a3733f35cc
  1. 5
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java
  2. 1
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java
  3. 33
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java
  4. 4
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  5. 23
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

5
epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/SystemMessageType.java

@ -95,4 +95,9 @@ public interface SystemMessageType {
*/ */
String IC_RESI_USER_EDIT = "ic_resi_user_edit"; String IC_RESI_USER_EDIT = "ic_resi_user_edit";
/**
* 居民信息删除
*/
String IC_RESI_USER_DEL = "ic_resi_user_del";
} }

1
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/service/impl/SystemMessageServiceImpl.java

@ -189,6 +189,7 @@ public class SystemMessageServiceImpl implements SystemMessageService {
break; break;
case SystemMessageType.IC_RESI_USER_ADD: case SystemMessageType.IC_RESI_USER_ADD:
case SystemMessageType.IC_RESI_USER_EDIT: case SystemMessageType.IC_RESI_USER_EDIT:
case SystemMessageType.IC_RESI_USER_DEL:
topic = TopicConstants.IC_RESI_USER; topic = TopicConstants.IC_RESI_USER;
break; break;
} }

33
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcResiUserController.java

@ -26,6 +26,7 @@ import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.metadata.fill.FillConfig; import com.alibaba.excel.write.metadata.fill.FillConfig;
import com.alibaba.excel.write.metadata.fill.FillWrapper; import com.alibaba.excel.write.metadata.fill.FillWrapper;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.epmet.commons.rocketmq.messages.IcResiUserAddMQMsg;
import com.epmet.commons.tools.annotation.LoginUser; import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.aop.NoRepeatSubmit; import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.constant.NumConstant; import com.epmet.commons.tools.constant.NumConstant;
@ -45,11 +46,13 @@ import com.epmet.commons.tools.utils.IpUtils;
import com.epmet.commons.tools.utils.Result; import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.constant.IcResiUserConstant; import com.epmet.constant.IcResiUserConstant;
import com.epmet.constant.SystemMessageType;
import com.epmet.dto.IcResiUserDTO; import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.form.*; import com.epmet.dto.form.*;
import com.epmet.dto.result.*; import com.epmet.dto.result.*;
import com.epmet.enums.IcResiUserTableEnum; import com.epmet.enums.IcResiUserTableEnum;
import com.epmet.excel.support.ExportResiUserItemDTO; import com.epmet.excel.support.ExportResiUserItemDTO;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.feign.OperCustomizeOpenFeignClient; import com.epmet.feign.OperCustomizeOpenFeignClient;
import com.epmet.feign.OssFeignClient; import com.epmet.feign.OssFeignClient;
import com.epmet.service.IcResiUserImportService; import com.epmet.service.IcResiUserImportService;
@ -114,6 +117,8 @@ public class IcResiUserController {
private IcResiUserImportService icResiUserImportService; private IcResiUserImportService icResiUserImportService;
@Autowired @Autowired
private RedisUtils redisUtils; private RedisUtils redisUtils;
@Autowired
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
{ {
// 初始化上传目录 // 初始化上传目录
@ -144,6 +149,14 @@ public class IcResiUserController {
formDTO.setCustomerId(tokenDto.getCustomerId()); formDTO.setCustomerId(tokenDto.getCustomerId());
ValidatorUtils.validateEntity(formDTO, DelIcResiUserFormDTO.IdGroup.class); ValidatorUtils.validateEntity(formDTO, DelIcResiUserFormDTO.IdGroup.class);
icResiUserService.delete(formDTO); icResiUserService.delete(formDTO);
//推送MQ事件
IcResiUserAddMQMsg mqMsg = new IcResiUserAddMQMsg();
mqMsg.setCustomerId(tokenDto.getCustomerId());
mqMsg.setIcResiUser(formDTO.getIcResiUserId());
SystemMsgFormDTO form = new SystemMsgFormDTO();
form.setMessageType(SystemMessageType.IC_RESI_USER_DEL);
form.setContent(mqMsg);
epmetMessageOpenFeignClient.sendSystemMsgByMQ(form);
return new Result(); return new Result();
} }
@ -154,7 +167,15 @@ public class IcResiUserController {
**/ **/
@PostMapping("add") @PostMapping("add")
public Result add(@LoginUser TokenDto tokenDto, @RequestBody List<IcResiUserFormDTO> formDTO) { public Result add(@LoginUser TokenDto tokenDto, @RequestBody List<IcResiUserFormDTO> formDTO) {
icResiUserService.add(tokenDto, formDTO); String resiUserId = icResiUserService.add(tokenDto, formDTO);
//推送MQ事件
IcResiUserAddMQMsg mqMsg = new IcResiUserAddMQMsg();
mqMsg.setCustomerId(tokenDto.getCustomerId());
mqMsg.setIcResiUser(resiUserId);
SystemMsgFormDTO form = new SystemMsgFormDTO();
form.setMessageType(SystemMessageType.IC_RESI_USER_ADD);
form.setContent(mqMsg);
epmetMessageOpenFeignClient.sendSystemMsgByMQ(form);
return new Result(); return new Result();
} }
@ -164,7 +185,15 @@ public class IcResiUserController {
**/ **/
@PostMapping("edit") @PostMapping("edit")
public Result edit(@LoginUser TokenDto tokenDto, @RequestBody List<IcResiUserFormDTO> formDTO) { public Result edit(@LoginUser TokenDto tokenDto, @RequestBody List<IcResiUserFormDTO> formDTO) {
icResiUserService.edit(tokenDto, formDTO); String resiUserId = icResiUserService.edit(tokenDto, formDTO);
//推送MQ事件
IcResiUserAddMQMsg mqMsg = new IcResiUserAddMQMsg();
mqMsg.setCustomerId(tokenDto.getCustomerId());
mqMsg.setIcResiUser(resiUserId);
SystemMsgFormDTO form = new SystemMsgFormDTO();
form.setMessageType(SystemMessageType.IC_RESI_USER_EDIT);
form.setContent(mqMsg);
epmetMessageOpenFeignClient.sendSystemMsgByMQ(form);
return new Result(); return new Result();
} }

4
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java

@ -48,13 +48,13 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
* @Author sun * @Author sun
* @Description 党建互联平台--保存居民信息 * @Description 党建互联平台--保存居民信息
**/ **/
void add(TokenDto tokenDto, List<IcResiUserFormDTO> formDTO); String add(TokenDto tokenDto, List<IcResiUserFormDTO> formDTO);
/** /**
* @Author sun * @Author sun
* @Description 党建互联平台--修改居民信息 * @Description 党建互联平台--修改居民信息
**/ **/
void edit(TokenDto tokenDto, List<IcResiUserFormDTO> formDTO); String edit(TokenDto tokenDto, List<IcResiUserFormDTO> formDTO);
/** /**
* @Description 获取房间内人员 * @Description 获取房间内人员

23
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java

@ -132,7 +132,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
**/ **/
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void add(TokenDto tokenDto, List<IcResiUserFormDTO> formDTO) { public String add(TokenDto tokenDto, List<IcResiUserFormDTO> formDTO) {
//循环自动拼接sql语句,往多个表新增数据 //循环自动拼接sql语句,往多个表新增数据
//0.校验必填字段是否为空 //0.校验必填字段是否为空
Result<List<ColumnTableNameResultDTO>> resultList = operCustomizeOpenFeignClient.getMustColumn(tokenDto.getCustomerId()); Result<List<ColumnTableNameResultDTO>> resultList = operCustomizeOpenFeignClient.getMustColumn(tokenDto.getCustomerId());
@ -196,14 +196,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
} }
}); });
//推送MQ事件 return resiUserId;
IcResiUserAddMQMsg mqMsg = new IcResiUserAddMQMsg();
mqMsg.setCustomerId(tokenDto.getCustomerId());
mqMsg.setIcResiUser(resiUserId);
SystemMsgFormDTO form = new SystemMsgFormDTO();
form.setMessageType(SystemMessageType.IC_RESI_USER_ADD);
form.setContent(mqMsg);
epmetMessageOpenFeignClient.sendSystemMsgByMQ(form);
} }
@ -213,7 +206,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
**/ **/
@Override @Override
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void edit(TokenDto tokenDto, List<IcResiUserFormDTO> formDTO) { public String edit(TokenDto tokenDto, List<IcResiUserFormDTO> formDTO) {
//1.校验主表数据是否存在 //1.校验主表数据是否存在
String resiUserId = ""; String resiUserId = "";
LinkedHashMap<String, String> map = new LinkedHashMap<>(); LinkedHashMap<String, String> map = new LinkedHashMap<>();
@ -260,15 +253,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
} }
}); });
//推送MQ事件 return resiUserId;
IcResiUserAddMQMsg mqMsg = new IcResiUserAddMQMsg();
mqMsg.setCustomerId(tokenDto.getCustomerId());
mqMsg.setIcResiUser(resiUserId);
SystemMsgFormDTO form = new SystemMsgFormDTO();
form.setMessageType(SystemMessageType.IC_RESI_USER_ADD);
form.setContent(mqMsg);
epmetMessageOpenFeignClient.sendSystemMsgByMQ(form);
} }
/** /**

Loading…
Cancel
Save