Browse Source

Merge branch 'feature/dev_sunjiatan_moveout'

dev
YUJT 3 years ago
parent
commit
6f64dc05a0
  1. 5
      epmet-module/epmet-message/epmet-message-client/src/main/java/com/epmet/constant/UserMessageTypeConstant.java
  2. 34
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcResiUserConfirmDTO.java
  3. 38
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ConfirmListFormDTO.java
  4. 1
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/MoveOutMemberFormDTO.java
  5. 26
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/ConfirmListResultDTO.java
  6. 42
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MoveOutDetailResultDTO.java
  7. 19
      epmet-user/epmet-user-server/src/main/java/com/epmet/constant/MessageConstant.java
  8. 20
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/ChangeRelocationController.java
  9. 83
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/MyHomeController.java
  10. 23
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserConfirmDao.java
  11. 27
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserConfirmEntity.java
  12. 54
      epmet-user/epmet-user-server/src/main/java/com/epmet/enums/UserConfirmEnum.java
  13. 10
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/ChangeRelocationService.java
  14. 33
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserConfirmService.java
  15. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserService.java
  16. 65
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ChangeRelocationServiceImpl.java
  17. 207
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserConfirmServiceImpl.java
  18. 38
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserServiceImpl.java
  19. 13
      epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.55__ic_confirm_edit.sql
  20. 81
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserConfirmDao.xml
  21. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

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

@ -212,4 +212,9 @@ public interface UserMessageTypeConstant {
* ic_event新事件
*/
String IC_EVENT="ic_event";
/**
* 移除家庭成员
*/
String MOVE_OUT_HOME = "move_out_home";
}

34
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcResiUserConfirmDTO.java

@ -42,6 +42,33 @@ public class IcResiUserConfirmDTO implements Serializable {
*/
private String gridId;
/**
* 迁出到网格名 迁出类型为in时必填
*/
private String gridName;
/**
* 迁出到小区名 迁出类型为in时必填
*/
private String villageName;
/**
* 迁出到楼栋名 迁出类型为in时必填
*/
private String buildName;
/**
* 迁出到单元名 迁出类型为in时必填
*/
private String unitName;
/**
* 迁出到房屋名 迁出类型为in时必填
*/
private String homeName;
private String houseId;
/**
*
*/
@ -187,4 +214,11 @@ public class IcResiUserConfirmDTO implements Serializable {
*/
private String operationDescribe;
/**
* 迁出申请状态 0未审核 1已通过 2未通过 3没有迁出申请
*/
private String moveOutStatus;
private String moveOutDate;
}

38
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/ConfirmListFormDTO.java

@ -0,0 +1,38 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.dto.form.PageFormDTO;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
/**
* @Description
* @Author zhaoqifeng
* @Date 2022/6/22 14:16
*/
@NoArgsConstructor
@Data
public class ConfirmListFormDTO extends PageFormDTO implements Serializable {
private static final long serialVersionUID = -3784221830789219648L;
private String customerId;
private String agencyId;
private String staffId;
private String name;
private String mobile;
private String idCard;
/**
* 迁出类型
*/
private String submitType;
/**
* 审核状态
*/
private String confirmResult;
private String gridId;
private String villageId;
private String buildId;
private String unitId;
private String homeId;
}

1
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/MoveOutMemberFormDTO.java

@ -133,4 +133,5 @@ public class MoveOutMemberFormDTO implements Serializable {
* 与户主关系
*/
private String yhzgx;
private String moveOutDate;
}

26
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/ConfirmListResultDTO.java

@ -0,0 +1,26 @@
package com.epmet.dto.result;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @Description
* @Author zhaoqifeng
* @Date 2022/6/22 14:27
*/
@NoArgsConstructor
@Data
public class ConfirmListResultDTO {
private String id;
private String name;
private String gender;
private String mobile;
private String idCard;
private String gridId;
private String gridName;
private String homeId;
private String homeName;
private String submitType;
private String newHomeName;
private String confirmResult;
}

42
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/MoveOutDetailResultDTO.java

@ -0,0 +1,42 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.io.Serializable;
import java.util.Date;
/**
* @Description
* @Author zhaoqifeng
* @Date 2022/6/22 16:15
*/
@NoArgsConstructor
@Data
public class MoveOutDetailResultDTO implements Serializable {
private static final long serialVersionUID = -8151267925780583596L;
private String id;
private String icResiUserId;
private String name;
private String mobile;
private String idCard;
private String gridId;
private String gridName;
private String villageName;
private String buildName;
private String unitName;
private String homeId;
private String homeName;
private String outType;
private String newGridName;
private String newHomeName;
private String moveOutDate;
private String deleteReason;
private String confirmResult;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private Date createdTime;
private String reason;
private String xxdz;
private Boolean isInHome = true;
}

19
epmet-user/epmet-user-server/src/main/java/com/epmet/constant/MessageConstant.java

@ -0,0 +1,19 @@
package com.epmet.constant;
/**
* @Description
* @Author zhaoqifeng
* @Date 2022/6/27 14:23
*/
public interface MessageConstant {
/**
* 消息标题
*/
String MOVE_OUT_TITLE = "您有一条移除家庭成员消息";
/**
* 审核驳回消息模板
*/
String OVE_OUT_REJECTED_MSG = "您好,您的申请由于%s,已被驳回。";
}

20
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/ChangeRelocationController.java

@ -104,4 +104,24 @@ public class ChangeRelocationController {
return changeRelocationService.saveOutOfInfo(dto);
}
/**
* 从家庭中移除
*
* @Param tokenDto
* @Param dto
* @Return {@link Result}
* @Author zhaoqifeng
* @Date 2022/6/27 10:50
*/
@NoRepeatSubmit
@PostMapping("moveOutHome")
public Result moveOutHome(@LoginUser TokenDto tokenDto, @RequestBody ChangeRelocationDTO dto){
dto.setCustomerId(tokenDto.getCustomerId());
dto.setStaffId(tokenDto.getUserId());
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
changeRelocationService.moveOutHome(dto);
return new Result();
}
}

83
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/MyHomeController.java

@ -2,19 +2,20 @@ package com.epmet.controller;
import com.epmet.commons.tools.annotation.LoginUser;
import com.epmet.commons.tools.annotation.MaskResponse;
import com.epmet.commons.tools.aop.NoRepeatSubmit;
import com.epmet.commons.tools.enums.HomeMemberOperationEnum;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.IcResiUserConfirmDTO;
import com.epmet.dto.form.IcResiUserConfirmGetDTO;
import com.epmet.dto.form.IcResiUserConfirmSubmitDTO;
import com.epmet.dto.form.MoveOutMemberFormDTO;
import com.epmet.dto.form.RegisterAndBindFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.ConfirmListResultDTO;
import com.epmet.dto.result.HomeInfoResultDTO;
import com.epmet.dto.result.HomeUserBriefResultDTO;
import com.epmet.dto.result.MoveOutDetailResultDTO;
import com.epmet.service.IcResiUserConfirmService;
import com.epmet.service.IcResiUserService;
import com.epmet.service.MyHomeService;
@ -50,38 +51,6 @@ public class MyHomeController {
return new Result().ok(myHomeService.selectListHomeMember(houseCode, tokenDto.getCustomerId()));
}
// /**
// * @describe: 新增家庭成员
// * @author wangtong
// * @date 2022/6/1 15:50
// * @params [dto]
// * @return com.epmet.commons.tools.utils.Result
// */
// @PostMapping("addMember")
// public Result addMember(@RequestBody IcResiUserConfirmSubmitDTO dto){
// //效验数据
// ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
// dto.setSubmitType(HomeMemberOperationEnum.ADD.getCode());
// return icResiUserConfirmService.addMember(dto);
// }
//
// /**
// * @describe: 修改家庭成员
// * @author wangtong
// * @date 2022/6/1 15:27
// * @params [dto]
// * @return com.epmet.commons.tools.utils.Result
// */
// @PostMapping("editMember")
// public Result save(@RequestBody IcResiUserConfirmSubmitDTO dto){
// //效验数据
// ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
// dto.setSubmitType(HomeMemberOperationEnum.UPDATE.getCode());
// return icResiUserConfirmService.editMember(dto);
// }
//
/**
* @return com.epmet.commons.tools.utils.Result
* @describe: 删除家庭成员
@ -105,10 +74,10 @@ public class MyHomeController {
* @params [dto]
*/
@PostMapping("addMember")
public Result addMember(@RequestBody IcResiUserConfirmSubmitDTO dto) {
public Result addMember(@LoginUser TokenDto tokenDto,@RequestBody IcResiUserConfirmSubmitDTO dto) {
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
return icResiUserService.addMember(dto);
return icResiUserService.addMember(tokenDto,dto);
}
/**
@ -188,11 +157,47 @@ public class MyHomeController {
* @author LZN
* @date 2022/6/10 11:06
*/
@PostMapping("/moveOutMember")
@NoRepeatSubmit
@PostMapping("moveOutMember")
public Result moveOutMember(@RequestBody MoveOutMemberFormDTO form, @LoginUser TokenDto tokenDto) {
form.setCustomerId(tokenDto.getCustomerId());
icResiUserConfirmService.moveOutMember(form);
return new Result();
}
/**
* 迁出审核列表
*
* @Param tokenDto
* @Param form
* @Return {@link Result< PageData< ConfirmListResultDTO>>}
* @Author zhaoqifeng
* @Date 2022/6/22 16:13
*/
@PostMapping("confirmList")
public Result<PageData<ConfirmListResultDTO>> confirmList(@LoginUser TokenDto tokenDto, @RequestBody ConfirmListFormDTO form) {
form.setCustomerId(tokenDto.getCustomerId());
form.setStaffId(tokenDto.getUserId());
return new Result<PageData<ConfirmListResultDTO>>().ok(icResiUserConfirmService.confirmList(form));
}
@PostMapping("moveOutConfirmDetail")
public Result<MoveOutDetailResultDTO> moveOutConfirmDetail(@LoginUser TokenDto tokenDto, @RequestBody IcResiUserConfirmDTO formDTO) {
return new Result<MoveOutDetailResultDTO>().ok(icResiUserConfirmService.moveOutConfirmDetail(tokenDto.getCustomerId(), formDTO.getId()));
}
/**
* 迁出审核
*
* @Param formDTO
* @Return {@link Result}
* @Author zhaoqifeng
* @Date 2022/6/22 16:46
*/
@PostMapping("moveOutConfirm")
public Result moveOutConfirm( @RequestBody IcResiUserConfirmDTO formDTO) {
icResiUserConfirmService.moveOutConfirm(formDTO);
return new Result();
}
}

23
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcResiUserConfirmDao.java

@ -1,10 +1,15 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.ConfirmListFormDTO;
import com.epmet.dto.result.ConfirmListResultDTO;
import com.epmet.dto.result.MoveOutDetailResultDTO;
import com.epmet.entity.IcResiUserConfirmEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
/**
* 居民信息审核表
*
@ -48,4 +53,22 @@ public interface IcResiUserConfirmDao extends BaseDao<IcResiUserConfirmEntity> {
*/
void deleteByIdCard(@Param("idCard") String idCard, @Param("customerId") String customerId,
@Param("submitType") String submitType);
/**
* 迁出审核列表
* @Param form
* @Return {@link List< ConfirmListResultDTO>}
* @Author zhaoqifeng
* @Date 2022/6/22 16:28
*/
List<ConfirmListResultDTO> getConfirmList(ConfirmListFormDTO form);
/**
* 迁出审核详情
* @Param id
* @Return {@link MoveOutDetailResultDTO}
* @Author zhaoqifeng
* @Date 2022/6/22 16:27
*/
MoveOutDetailResultDTO getMoveOutConfirmDetail(String id);
}

27
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcResiUserConfirmEntity.java

@ -38,6 +38,31 @@ public class IcResiUserConfirmEntity extends BaseEpmetEntity {
*/
private String gridId;
/**
* 迁出到网格名 迁出类型为in时必填
*/
private String gridName;
/**
* 迁出到小区名 迁出类型为in时必填
*/
private String villageName;
/**
* 迁出到楼栋名 迁出类型为in时必填
*/
private String buildName;
/**
* 迁出到单元名 迁出类型为in时必填
*/
private String unitName;
/**
* 迁出到房屋名 迁出类型为in时必填
*/
private String homeName;
private String houseId;
/**
*
*/
@ -153,5 +178,7 @@ public class IcResiUserConfirmEntity extends BaseEpmetEntity {
*/
private String operationDescribe;
private String moveOutDate;
}

54
epmet-user/epmet-user-server/src/main/java/com/epmet/enums/UserConfirmEnum.java

@ -0,0 +1,54 @@
package com.epmet.enums;
import java.util.Objects;
/**
* @author Administrator
*/
public enum UserConfirmEnum {
//审核状态
AUDITING("0", "未审核"),
PASSED("1", "已通过"),
REJECT("2", "未通过"),
ADD("add", "新增"),
UPDATE("update", "修改"),
OUT("out", "迁至客户外"),
IN("in", "迁至客户内"),
;
private String code;
private String name;
UserConfirmEnum(String code, String name) {
this.code = code;
this.name = name;
}
public static String getName(String code) {
UserConfirmEnum[] userConfirmEnums = values();
for (UserConfirmEnum userConfirmEnum : userConfirmEnums) {
if (Objects.equals(userConfirmEnum.getCode(), code)) {
return userConfirmEnum.getName();
}
}
return null;
}
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
}

10
epmet-user/epmet-user-server/src/main/java/com/epmet/service/ChangeRelocationService.java

@ -85,4 +85,14 @@ public interface ChangeRelocationService extends BaseService<ChangeRelocationEnt
* @return com.epmet.commons.tools.utils.Result
*/
Result saveOutOfInfo(ChangeRelocationDTO dto);
/**
* 从家庭中移除
*
* @Param dto
* @Return
* @Author zhaoqifeng
* @Date 2022/6/27 10:52
*/
void moveOutHome(ChangeRelocationDTO dto);
}

33
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcResiUserConfirmService.java

@ -4,9 +4,12 @@ import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dto.IcResiUserConfirmDTO;
import com.epmet.dto.form.ConfirmListFormDTO;
import com.epmet.dto.form.IcResiUserConfirmGetDTO;
import com.epmet.dto.form.IcResiUserConfirmSubmitDTO;
import com.epmet.dto.form.MoveOutMemberFormDTO;
import com.epmet.dto.result.ConfirmListResultDTO;
import com.epmet.dto.result.MoveOutDetailResultDTO;
import com.epmet.entity.IcResiUserConfirmEntity;
import java.util.List;
@ -135,4 +138,34 @@ public interface IcResiUserConfirmService extends BaseService<IcResiUserConfirmE
* @date 2022/6/10 11:06
*/
void moveOutMember(MoveOutMemberFormDTO form);
/**
* 迁出审核列表
*
* @Param form
* @Return {@link PageData< ConfirmListResultDTO>}
* @Author zhaoqifeng
* @Date 2022/6/22 14:30
*/
PageData<ConfirmListResultDTO> confirmList(ConfirmListFormDTO form);
/**
* 迁出审核详情
*
* @Param id
* @Return {@link MoveOutDetailResultDTO}
* @Author zhaoqifeng
* @Date 2022/6/22 16:21
*/
MoveOutDetailResultDTO moveOutConfirmDetail(String customerId, String id);
/**
* 迁出审核
*
* @Param formDTO
* @Return {@link null}
* @Author zhaoqifeng
* @Date 2022/6/22 16:45
*/
void moveOutConfirm(IcResiUserConfirmDTO formDTO);
}

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

@ -406,7 +406,7 @@ public interface IcResiUserService extends BaseService<IcResiUserEntity> {
* @date 2022/6/6 10:36
* @params [dto]
*/
Result addMember(IcResiUserConfirmSubmitDTO dto);
Result addMember(TokenDto tokenDto,IcResiUserConfirmSubmitDTO dto);
/**
* @return com.epmet.commons.tools.utils.Result

65
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/ChangeRelocationServiceImpl.java

@ -7,6 +7,8 @@ import com.epmet.commons.rocketmq.messages.IcResiUserAddMQMsg;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.enums.IcResiUserSubStatusEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.security.user.LoginUserUtil;
import com.epmet.commons.tools.utils.ConvertUtils;
@ -21,6 +23,7 @@ import com.epmet.constant.SystemMessageType;
import com.epmet.dao.ChangeRelocationDao;
import com.epmet.dto.ChangeRelocationDTO;
import com.epmet.dto.ChangeWelfareDTO;
import com.epmet.dto.IcResiUserDTO;
import com.epmet.dto.form.IcResiUserTransferFormDTO;
import com.epmet.dto.form.RentTenantDataFormDTO;
import com.epmet.dto.form.SystemMsgFormDTO;
@ -39,6 +42,7 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
@ -70,6 +74,8 @@ public class ChangeRelocationServiceImpl extends BaseServiceImpl<ChangeRelocatio
@Autowired
private IcResiUserService icResiUserService;
@Resource
private IcUserTransferRecordService icUserTransferRecordService;
@Override
public PageData<ChangeRelocationDTO> page(Map<String, Object> params) {
@ -197,8 +203,10 @@ public class ChangeRelocationServiceImpl extends BaseServiceImpl<ChangeRelocatio
//更新epmet用户状态
IcResiUserEntity userEntity = new IcResiUserEntity();
userEntity.setId(dto.getIcUserId());
userEntity.setStatus(NumConstant.ONE_STR);//转出(迁出)
userEntity.setSubStatus(IcResiUserSubStatusEnum.MOVE_OUT.getSubStatus());//迁出
//转出(迁出)
userEntity.setStatus(NumConstant.ONE_STR);
//迁出
userEntity.setSubStatus(IcResiUserSubStatusEnum.MOVE_OUT.getSubStatus());
icResiUserService.updateById(userEntity);
//插入变更主表、变更明细表
IcResiUserTransferFormDTO icResiUserTransferFormDTO = ConvertUtils.sourceToTarget(dto, IcResiUserTransferFormDTO.class);
@ -217,6 +225,59 @@ public class ChangeRelocationServiceImpl extends BaseServiceImpl<ChangeRelocatio
return new Result();
}
/**
* 从家庭中移除
*
* @param dto
* @Param dto
* @Return
* @Author zhaoqifeng
* @Date 2022/6/27 10:52
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void moveOutHome(ChangeRelocationDTO dto) {
if ("in".equals(dto.getType())) {
//获取居民信息
IcResiUserDTO userInfo = icResiUserService.get(dto.getIcUserId());
if (null == userInfo) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "居民信息不存在", "居民信息不存在");
}
if (userInfo.getAgencyId().equals(dto.getAgencyId())) {
//更改房屋
IcResiUserEntity uerEntity = new IcResiUserEntity();
uerEntity.setId(dto.getIcUserId());
uerEntity.setGridId(dto.getGridId());
uerEntity.setVillageId(dto.getVillageId());
uerEntity.setBuildId(dto.getBuildId());
uerEntity.setUnitId(dto.getUnitId());
uerEntity.setHomeId(dto.getHomeId());
icResiUserService.updateById(uerEntity);
//组织内走变更流程
IcResiUserTransferFormDTO formDTO = new IcResiUserTransferFormDTO();
formDTO.setIcUserId(dto.getIcUserId());
formDTO.setType("in");
formDTO.setNewAgencyId(dto.getAgencyId());
formDTO.setNewGridId(dto.getGridId());
formDTO.setNewNeighborHoodId(dto.getVillageId());
formDTO.setNewBuildingId(dto.getBuildId());
formDTO.setNewBuildingUnitId(dto.getUnitId());
formDTO.setNewHouseId(dto.getHomeId());
formDTO.setTransferTime(dto.getTransferTime());
formDTO.setIdEdit(false);
formDTO.setCustomerId(dto.getCustomerId());
formDTO.setStaffId(dto.getStaffId());
icUserTransferRecordService.add(formDTO);
} else {
//组织外走迁出流程
this.saveOutOfInfo(dto);
}
} else {
this.saveOutOfInfo(dto);
}
}
public void editResiMq(String customerId, String userId) {
//推送MQ事件
IcResiUserAddMQMsg mqMsg = new IcResiUserAddMQMsg();

207
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserConfirmServiceImpl.java

@ -1,31 +1,50 @@
package com.epmet.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl;
import com.epmet.commons.tools.constant.AppClientConstant;
import com.epmet.commons.tools.constant.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.GenderEnum;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.page.PageData;
import com.epmet.commons.tools.redis.common.CustomerIcHouseRedis;
import com.epmet.commons.tools.redis.common.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.redis.common.bean.HouseInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.constant.MessageConstant;
import com.epmet.constant.ReadFlagConstant;
import com.epmet.constant.UserMessageTypeConstant;
import com.epmet.dao.IcResiUserConfirmDao;
import com.epmet.dao.IcResiUserDao;
import com.epmet.dto.IcResiUserConfirmDTO;
import com.epmet.dto.form.IcResiUserConfirmGetDTO;
import com.epmet.dto.form.IcResiUserConfirmSubmitDTO;
import com.epmet.dto.form.MoveOutMemberFormDTO;
import com.epmet.dto.form.*;
import com.epmet.dto.result.ConfirmListResultDTO;
import com.epmet.dto.result.MoveOutDetailResultDTO;
import com.epmet.entity.IcResiUserConfirmEntity;
import com.epmet.entity.IcResiUserEntity;
import com.epmet.enums.UserConfirmEnum;
import com.epmet.feign.EpmetMessageOpenFeignClient;
import com.epmet.redis.IcResiUserConfirmRedis;
import com.epmet.service.IcResiUserConfirmService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import java.util.*;
/**
* 居民信息审核表
@ -33,6 +52,7 @@ import java.util.Map;
* @author generator generator@elink-cn.com
* @since v1.0.0 2022-06-01
*/
@Slf4j
@Service
public class IcResiUserConfirmServiceImpl extends BaseServiceImpl<IcResiUserConfirmDao, IcResiUserConfirmEntity> implements IcResiUserConfirmService {
@ -45,6 +65,9 @@ public class IcResiUserConfirmServiceImpl extends BaseServiceImpl<IcResiUserConf
@Autowired
private IcResiUserConfirmDao icResiUserConfirmDao;
@Resource
private EpmetMessageOpenFeignClient epmetMessageOpenFeignClient;
@Override
public PageData<IcResiUserConfirmDTO> page(Map<String, Object> params) {
IPage<IcResiUserConfirmEntity> page = baseDao.selectPage(
@ -141,8 +164,20 @@ public class IcResiUserConfirmServiceImpl extends BaseServiceImpl<IcResiUserConf
@Override
public Result<IcResiUserConfirmDTO> getMemberDetail(IcResiUserConfirmGetDTO dto) {
IcResiUserConfirmDTO result = icResiUserDao.selectMemberDetail(dto.getIcResiUserId());
if (null != result && StringUtils.isBlank(result.getGender())) {
result.setGender("");
if (null != result) {
LambdaQueryWrapper<IcResiUserConfirmEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcResiUserConfirmEntity::getIcResiUserId, dto.getIcResiUserId());
wrapper.in(IcResiUserConfirmEntity::getSubmitType, Arrays.asList("in", "out"));
wrapper.orderByDesc(IcResiUserConfirmEntity::getCreatedTime);
List<IcResiUserConfirmEntity> list = baseDao.selectList(wrapper);
if (CollectionUtils.isNotEmpty(list)) {
result.setMoveOutStatus(list.get(NumConstant.ZERO).getConfirmResult());
} else {
result.setMoveOutStatus(NumConstant.THREE_STR);
}
if(StringUtils.isBlank(result.getGender())) {
result.setGender("");
}
}
return new Result().ok(result);
}
@ -189,14 +224,160 @@ public class IcResiUserConfirmServiceImpl extends BaseServiceImpl<IcResiUserConf
*/
@Override
public void moveOutMember(MoveOutMemberFormDTO form) {
form = icResiUserDao.moveOutMember(form.getIcResiUserId(), form.getCustomerId());
form.setSurname(form.getAllName().substring(0, 1));
form.setName(form.getAllName().substring(1));
if (icResiUserConfirmDao.selectByIdCard(form.getIdCard(), form.getCustomerId(), form.getSubmitType()) > 0) {
icResiUserConfirmDao.deleteByIdCard(form.getIdCard(), form.getCustomerId(), form.getSubmitType());
MoveOutMemberFormDTO userInfo = icResiUserDao.moveOutMember(form.getIcResiUserId(), form.getCustomerId());
if (null == userInfo) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "居民已迁出", "居民已迁出");
}
form.setName(userInfo.getAllName());
form.setAgencyId(userInfo.getAgencyId());
form.setPids(userInfo.getPids());
form.setHouseId(userInfo.getHouseId());
form.setGender(userInfo.getGender());
form.setIdCard(userInfo.getIdCard());
form.setBirthday(userInfo.getBirthday());
form.setHjszd(userInfo.getHjszd());
form.setXjzd(userInfo.getXjzd());
form.setMz(userInfo.getMz());
form.setYhzgx(userInfo.getYhzgx());
IcResiUserConfirmEntity entity = ConvertUtils.sourceToTarget(form, IcResiUserConfirmEntity.class);
icResiUserConfirmDao.insert(entity);
}
/**
* 迁出审核列表
*
* @param form
* @Param form
* @Return {@link PageData< ConfirmListResultDTO >}
* @Author zhaoqifeng
* @Date 2022/6/22 14:30
*/
@Override
public PageData<ConfirmListResultDTO> confirmList(ConfirmListFormDTO form) {
//获取工作人员所属组织
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(form.getCustomerId(), form.getStaffId());
if (null == staffInfo) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取用户信息失败", "获取用户信息失败");
}
form.setAgencyId(staffInfo.getAgencyId());
PageHelper.startPage(form.getPageNo(), form.getPageSize());
List<ConfirmListResultDTO> list =baseDao.getConfirmList(form);
PageInfo<ConfirmListResultDTO> pageInfo = new PageInfo<>(list);
if (CollectionUtils.isNotEmpty(list)) {
list.forEach(item -> {
//获取网格信息
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(item.getGridId());
if (null != gridInfo) {
log.warn("迁出审核列表获取网格缓存失败");
item.setGridName(gridInfo.getGridNamePath());
}
//获取房屋信息
HouseInfoCache houseInfo = CustomerIcHouseRedis.getHouseInfo(form.getCustomerId(), item.getHomeId());
if (null != houseInfo) {
log.warn("迁出审核列表获取房屋缓存失败");
item.setHomeName(houseInfo.getAllName());
}
item.setGender(GenderEnum.getName(item.getGender()));
item.setConfirmResult(UserConfirmEnum.getName(item.getConfirmResult()));
});
}
return new PageData<>(list, pageInfo.getTotal());
}
/**
* 迁出审核详情
*
* @param id
* @Param id
* @Return {@link MoveOutDetailResultDTO}
* @Author zhaoqifeng
* @Date 2022/6/22 16:21
*/
@Override
public MoveOutDetailResultDTO moveOutConfirmDetail(String customerId, String id) {
MoveOutDetailResultDTO result = baseDao.getMoveOutConfirmDetail(id);
if (null != result) {
//获取房屋信息
HouseInfoCache houseInfo = CustomerIcHouseRedis.getHouseInfo(customerId, result.getHomeId());
if (null == houseInfo) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "获取房屋信息失败", "获取房屋信息失败");
}
result.setGridName(houseInfo.getGridName());
result.setVillageName(houseInfo.getNeighborHoodName());
result.setBuildName(houseInfo.getBuildingName());
result.setUnitName(houseInfo.getUnitName());
result.setHomeName(houseInfo.getDoorName());
if (NumConstant.ZERO_STR.equals(result.getConfirmResult())) {
LambdaQueryWrapper<IcResiUserEntity> wrapper = new LambdaQueryWrapper<>();
wrapper.eq(IcResiUserEntity::getId, result.getIcResiUserId());
wrapper.eq(IcResiUserEntity::getHomeId, result.getHomeId());
wrapper.eq(IcResiUserEntity::getStatus, NumConstant.ZERO_STR);
IcResiUserEntity entity = icResiUserDao.selectOne(wrapper);
if (null == entity) {
result.setIsInHome(false);
} else {
result.setIsInHome(true);
}
}
}
return result;
}
/**
* 迁出审核
*
* @param formDTO
* @Param formDTO
* @Return {@link null}
* @Author zhaoqifeng
* @Date 2022/6/22 16:45
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void moveOutConfirm(IcResiUserConfirmDTO formDTO) {
if (NumConstant.TWO_STR.equals(formDTO.getConfirmResult())) {
if (StringUtils.isBlank(formDTO.getReason())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "驳回原因不能为空", "驳回原因不能为空");
}
}
baseDao.updateById(ConvertUtils.sourceToTarget(formDTO, IcResiUserConfirmEntity.class));
//审核不通过,发送消息
if (NumConstant.TWO_STR.equals(formDTO.getConfirmResult())) {
String msg = String.format(MessageConstant.OVE_OUT_REJECTED_MSG, formDTO.getReason());
IcResiUserConfirmEntity entity = baseDao.selectById(formDTO.getId());
sendMessage(entity.getCustomerId(),entity.getGridId(), entity.getId(), entity.getCreatedBy(), msg);
}
}
private void sendMessage(String customerId, String gridId, String targetId, String userId, String userMsg) {
UserMessageFormDTO userMessageFormDTO = new UserMessageFormDTO();
userMessageFormDTO.setCustomerId(customerId);
userMessageFormDTO.setGridId(gridId);
userMessageFormDTO.setApp(AppClientConstant.APP_RESI);
userMessageFormDTO.setTitle(MessageConstant.MOVE_OUT_TITLE);
userMessageFormDTO.setMessageType(UserMessageTypeConstant.MOVE_OUT_HOME);
userMessageFormDTO.setTargetId(targetId);
userMessageFormDTO.setMessageContent(userMsg);
userMessageFormDTO.setReadFlag(ReadFlagConstant.UN_READ);
userMessageFormDTO.setUserId(userId);
//发送微信订阅消息
WxSubscribeMessageFormDTO wxSubscribeMessageFormDTO = new WxSubscribeMessageFormDTO();
wxSubscribeMessageFormDTO.setCustomerId(customerId);
wxSubscribeMessageFormDTO.setUserId(userId);
wxSubscribeMessageFormDTO.setClientType(AppClientConstant.APP_RESI);
wxSubscribeMessageFormDTO.setGridId(gridId);
wxSubscribeMessageFormDTO.setBehaviorType(MessageConstant.MOVE_OUT_TITLE);
wxSubscribeMessageFormDTO.setMessageContent(userMsg);
wxSubscribeMessageFormDTO.setMessageTime(new Date());
List<WxSubscribeMessageFormDTO> msgList = new ArrayList<>();
msgList.add(wxSubscribeMessageFormDTO);
epmetMessageOpenFeignClient.sendWxSubscribeMessage(msgList);
//保存消息
epmetMessageOpenFeignClient.saveUserMessage(userMessageFormDTO);
}
}

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

@ -155,6 +155,10 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
private EpmetHeartOpenFeignClient epmetHeartOpenFeignClient;
@Resource
private UserBaseInfoDao userBaseInfoDao;
@Autowired
private EpmetUserOpenFeignClient epmetUserOpenFeignClient;
private QueryWrapper<IcResiUserEntity> getWrapper(Map<String, Object> params) {
String id = (String) params.get(FieldConstant.ID_HUMP);
@ -2362,7 +2366,7 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
}
@Override
public Result addMember(IcResiUserConfirmSubmitDTO dto) {
public Result addMember(TokenDto tokenDto,IcResiUserConfirmSubmitDTO dto) {
IcResiUserEntity user = icResiUserDao.selectById(dto.getIcResiUserId());
IcResiUserDTO userDTO = baseDao.getResiUserByIdCard(dto.getIdCard(), user.getCustomerId());
@ -2396,6 +2400,23 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
this.setIcResiUserPids(entity);
insert(entity);
//变更记录表
IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity();
changeRecordEntity.setCustomerId(tokenDto.getCustomerId());
changeRecordEntity.setOperatorId(tokenDto.getUserId());//userId
changeRecordEntity.setIcUserId(entity.getId());
Result<ResiUserBaseInfoResultDTO> userResult = epmetUserOpenFeignClient.selectUserBaseInfo(tokenDto);
if (!userResult.success()){
throw new EpmetException("查询用户信息失败...");
}
changeRecordEntity.setOperatorName(userResult.getData().getRealName());
changeRecordEntity.setIcUserName(entity.getName());
changeRecordEntity.setType("add");
changeRecordEntity.setTypeName("新增");
changeRecordEntity.setBeforeChangeName("-");
changeRecordEntity.setAfterChangeName("-");
changeRecordEntity.setChangeTime(new java.util.Date());
icUserChangeRecordService.insert(changeRecordEntity);
return new Result().ok("新增成功");
}
@ -2475,6 +2496,21 @@ public class IcResiUserServiceImpl extends BaseServiceImpl<IcResiUserDao, IcResi
this.setIcResiUserPids(entity);
insert(entity);
CustomerStaffInfoCacheResult staffInfoCache = CustomerStaffRedis.getStaffInfo(dto.getCustomerId(), dto.getStaffId());
//变更记录表
IcUserChangeRecordEntity changeRecordEntity = new IcUserChangeRecordEntity();
changeRecordEntity.setCustomerId(dto.getCustomerId());
changeRecordEntity.setOperatorId(dto.getStaffId());
changeRecordEntity.setIcUserId(entity.getId());
changeRecordEntity.setOperatorName(staffInfoCache.getRealName());
changeRecordEntity.setIcUserName(entity.getName());
changeRecordEntity.setType("add");
changeRecordEntity.setTypeName("新增");
changeRecordEntity.setBeforeChangeName("-");
changeRecordEntity.setAfterChangeName("-");
changeRecordEntity.setChangeTime(new java.util.Date());
icUserChangeRecordService.insert(changeRecordEntity);
return new Result().ok("新增成功");
}

13
epmet-user/epmet-user-server/src/main/resources/db/migration/V0.0.55__ic_confirm_edit.sql

@ -0,0 +1,13 @@
ALTER TABLE `epmet_user`.`ic_resi_user_confirm`
MODIFY COLUMN `IC_RESI_USER_ID` varchar(64) DEFAULT NULL COMMENT 'ic_resi_user表id' AFTER `PIDS`,
ADD COLUMN `HOUSE_ID` varchar(64) NULL COMMENT '房屋ID' AFTER `GRID_ID`,
ADD COLUMN `GRID_NAME` varchar(64) COMMENT '所属小区' AFTER `GRID_ID`,
ADD COLUMN `VILLAGE_NAME` varchar(64) COMMENT '所属小区' AFTER `GRID_NAME`,
ADD COLUMN `BUILD_NAME` varchar(64) COMMENT '所属楼宇' AFTER `VILLAGE_NAME`,
ADD COLUMN `UNIT_NAME` varchar(64) COMMENT '单元' AFTER `BUILD_NAME`,
ADD COLUMN `HOME_NAME` varchar(64) COMMENT '房屋' AFTER `UNIT_NAME`,
MODIFY COLUMN `ID_CARD` varchar(18) COMMENT '身份证号' AFTER `GENDER`,
MODIFY COLUMN `SUBMIT_TYPE` varchar(255) DEFAULT NULL COMMENT '操作类型:新增add 修改 update 迁出客户外out 迁出客户内in' AFTER `CONFIRM_RESULT`,
MODIFY COLUMN `DELETE_REASON` varchar(255) DEFAULT NULL COMMENT '删除原因' AFTER `SUBMIT_TYPE`,
MODIFY COLUMN `OPERATION_DESCRIBE` varchar(255) DEFAULT NULL COMMENT '操作说明' AFTER `DELETE_REASON`,
ADD COLUMN `MOVE_OUT_DATE` varchar(32) NULL COMMENT '迁出时间' AFTER `OPERATION_DESCRIBE`;

81
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserConfirmDao.xml

@ -59,6 +59,87 @@
AND CONFIRM_RESULT = '0'
AND SUBMIT_TYPE = #{submitType}
</select>
<select id="getConfirmList" resultType="com.epmet.dto.result.ConfirmListResultDTO">
SELECT
a.ID,
b.`NAME`,
b.GENDER,
b.ID_CARD,
b.MOBILE,
b.GRID_ID,
b.HOME_ID,
SUBMIT_TYPE,
CASE SUBMIT_TYPE
WHEN 'in' THEN CONCAT(a.VILLAGE_NAME, a.BUILD_NAME, a.UNIT_NAME, a.HOME_NAME)
ELSE a.XXDZ
END AS newHomeName,
CONFIRM_RESULT
FROM
ic_resi_user_confirm a
INNER JOIN ic_resi_user b ON a.IC_RESI_USER_ID = b.ID
AND b.DEL_FLAG = 0
WHERE
a.DEL_FLAG = 0
AND a.SUBMIT_TYPE IN ( 'in', 'out' )
AND a.AGENCY_ID = #{agencyId}
<if test="null != name and name.trim() != ''">
AND b.NAME LIKE CONCAT('%',#{name},'%')
</if>
<if test="null != idCard and idCard.trim() != ''">
AND b.ID_CARD LIKE CONCAT('%',#{idCard},'%')
</if>
<if test="null != mobile and mobile.trim() != ''">
AND b.MOBILE LIKE CONCAT('%',#{mobile},'%')
</if>
<if test="null != submitType and submitType.trim() != ''">
AND SUBMIT_TYPE = #{submitType}
</if>
<if test="null != confirmResult and confirmResult.trim() != ''">
AND CONFIRM_RESULT = #{confirmResult}
</if>
<if test="null != gridId and gridId.trim() != ''">
AND b.GRID_ID = #{gridId}
</if>
<if test="null != villageId and villageId.trim() != ''">
AND b.VILLAGE_ID = #{villageId}
</if>
<if test="null != buildId and buildId.trim() != ''">
AND b.BUILD_ID = #{buildId}
</if>
<if test="null != unitId and unitId.trim() != ''">
AND b.UNIT_ID = #{unitId}
</if>
<if test="null != homeId and homeId.trim() != ''">
AND b.HOME_ID = #{homeId}
</if>
ORDER BY a.CREATED_TIME DESC
</select>
<select id="getMoveOutConfirmDetail" resultType="com.epmet.dto.result.MoveOutDetailResultDTO">
SELECT
a.ID,
a.IC_RESI_USER_ID,
b.`NAME`,
b.ID_CARD,
b.MOBILE,
b.GRID_ID,
b.HOME_ID,
a.SUBMIT_TYPE AS outType,
a.GRID_NAME AS newGridName,
CONCAT(a.VILLAGE_NAME, a.BUILD_NAME, a.UNIT_NAME, a.HOME_NAME) AS newHomeName,
a.CONFIRM_RESULT,
a.MOVE_OUT_DATE,
a.DELETE_REASON,
a.REASON,
a.XXDZ,
a.CREATED_TIME
FROM
ic_resi_user_confirm a
INNER JOIN ic_resi_user b ON a.IC_RESI_USER_ID = b.ID
AND b.DEL_FLAG = 0
WHERE
a.DEL_FLAG = 0
AND a.ID = #{id}
</select>
</mapper>

3
epmet-user/epmet-user-server/src/main/resources/mapper/IcResiUserDao.xml

@ -1140,7 +1140,7 @@
SELECT
AGENCY_ID,
PIDS,
HOME_ID,
HOME_ID AS houseId,
NAME as allName,
MOBILE,
GENDER,
@ -1155,6 +1155,7 @@
WHERE
id = #{icResiUserId}
AND customer_id = #{customerId}
AND STATUS = '0'
AND DEL_FLAG = '0'
</select>
<select id="selectResiUserEntityByIdCard" resultType="com.epmet.entity.IcResiUserEntity">

Loading…
Cancel
Save