Browse Source

迁入管理

master
sunyuchao 3 years ago
parent
commit
0221ea8524
  1. 7
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcMoveInRecordDTO.java
  2. 136
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcMoveInAddEditFormDTO.java
  3. 77
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcMoveInListFormDTO.java
  4. 154
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcMoveInListResultDTO.java
  5. 40
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcMoveInRecordController.java
  6. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcMoveInRecordDao.java
  7. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcMoveInRecordEntity.java
  8. 73
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcMoveInRecordExcel.java
  9. 14
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcMoveInRecordService.java
  10. 222
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcMoveInRecordServiceImpl.java
  11. 67
      epmet-user/epmet-user-server/src/main/resources/mapper/IcMoveInRecordDao.xml

7
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcMoveInRecordDTO.java

@ -69,7 +69,12 @@ public class IcMoveInRecordDTO implements Serializable {
/**
* 是否享受福利:0 :1
*/
private String isWeifare;
private String isWelfare;
/**
* 是否勾选补充居民信息0否 1是
*/
private String isCheck;
/**
* 手机号

136
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcMoveInAddEditFormDTO.java

@ -0,0 +1,136 @@
package com.epmet.dto.form;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import lombok.Data;
import org.hibernate.validator.constraints.Length;
import org.springframework.format.annotation.DateTimeFormat;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
import java.util.Date;
/**
* @Description 迁入管理新增/修改
* @Author sun
*/
@Data
public class IcMoveInAddEditFormDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 迁入Id
*/
@NotBlank(message = "姓名不能为空", groups = {UpdateGroup.class})
private String moveInId;
/**
* 网格ID
*/
@NotBlank(message = "网格ID不能为空", groups = {AddGroup.class})
private String gridId;
/**
* 所属小区ID
*/
@NotBlank(message = "所属小区ID不能为空", groups = {AddGroup.class})
private String villageId;
/**
* 所属楼宇Id
*/
@NotBlank(message = "所属楼宇ID不能为空", groups = {AddGroup.class})
private String buildId;
/**
* 单元id
*/
@NotBlank(message = "单元ID不能为空", groups = {AddGroup.class})
private String unitId;
/**
* 所属家庭Id
*/
@NotBlank(message = "所属家庭ID不能为空", groups = {AddGroup.class})
private String homeId;
/**
* 姓名
*/
@NotBlank(message = "姓名不能为空", groups = {AddGroup.class})
private String name;
/**
* 是否享受福利:0 :1
*/
private String isWelfare;
/**
* 是否勾选补充居民信息0否 1是
*/
private String isCheck;
/**
* 手机号
*/
@Length(max = 11, message = "手机号位数不能超过11位", groups = AddGroup.class)
private String mobile;
/**
* 身份证号
*/
@NotBlank(message = "身份证号不能为空", groups = {AddGroup.class})
@Length(min = 15, max = 18, message = "身份证号位数不正确", groups = AddGroup.class)
private String idCard;
/**
* 性别1男2女0未知
*/
private String gender;
/**
* 年龄
*/
private Integer age;
/**
* 迁入时间
*/
@NotNull(message = "迁入时间不能为空", groups = {AddGroup.class})
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date inTime;
/**
* 迁入原因
*/
@NotBlank(message = "迁入原因不能为空", groups = {AddGroup.class})
private String inReason;
/**
* 来源地区编码
*/
//@NotBlank(message = "来源地区编码不能为空", groups = {AddGroup.class})
private String sourceAddressCode;
/**
* 来源地区编码全路径
*/
//@NotBlank(message = "来源地区编码全路径不能为空", groups = {AddGroup.class})
private String sourceAddressPathCode;
/**
* 来源地区地址
*/
@NotBlank(message = "来源地区地址不能为空", groups = {AddGroup.class})
private String sourceAddress;
/**
* 详细地址
*/
@NotBlank(message = "详细地址不能为空", groups = {AddGroup.class})
private String address;
/**
* 迁移证号码
*/
private String moveNumber;
/**
* 户主姓名
*/
private String householderName;
/**
* 与户主关系[字典表]
*/
private String householderRelation;
/**
* 是否更新0否 1是
*/
private String isReplace;
private String customerId;
private String userId;
}

77
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcMoveInListFormDTO.java

@ -0,0 +1,77 @@
package com.epmet.dto.form;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
/**
* @Description 迁入管理列表--接口入参
* @Author sun
*/
@Data
public class IcMoveInListFormDTO implements Serializable {
private static final long serialVersionUID = 9156247659994638103L;
/**
* 网格ID
*/
private String gridId;
/**
* 所属小区ID
*/
private String villageId;
/**
* 所属楼宇Id
*/
private String buildId;
/**
* 单元id
*/
private String unitId;
/**
* 所属家庭Id
*/
private String homeId;
/**
* 姓名
*/
private String name;
/**
* 是否享受福利:0 :1
*/
private String isWeifare;
/**
* 手机号
*/
private String mobile;
/**
* 身份证号
*/
private String idCard;
/**
* 起始迁入时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date startTime;
/**
* 终止迁入时间
*/
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date endTime;
/**
* 页码
*/
private Integer pageNo = 1;
/**
* 每页显示数量
*/
private Integer pageSize = 20;
private Boolean isPage = false;
private String customerId;
private String moveInId;
}

154
epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcMoveInListResultDTO.java

@ -0,0 +1,154 @@
package com.epmet.dto.result;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* @Description 迁入管理列表--接口返参
* @Author sun
*/
@Data
public class IcMoveInListResultDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 议题总数
*/
private Integer total;
/**
* 议题列表
*/
private List<IcMoveInList> list;
@Data
public static class IcMoveInList {
/**
* 迁入Id
*/
private String moveInId;
/**
* 网格ID
*/
private String gridId;
/**
* 网格名称
*/
private String gridName;
/**
* 所属小区ID
*/
private String villageId;
/**
* 所属小区名称
*/
private String villageName;
/**
* 所属楼宇Id
*/
private String buildId;
/**
* 所属楼宇名称
*/
private String buildName;
/**
* 单元id
*/
private String unitId;
/**
* 单元名称
*/
private String unitName;
/**
* 所属家庭Id
*/
private String homeId;
/**
* 所属家庭名称
*/
private String homeName;
/**
* 所属家庭Id
*/
private String allName;
/**
* 姓名
*/
private String name;
/**
* 是否享受福利:0 :1
*/
private String isWeifare;
/**
* 是否勾选补充居民信息0否 1是
*/
private String isCheck;
/**
* 手机号
*/
private String mobile;
/**
* 身份证号
*/
private String idCard;
/**
* 性别1男2女0未知
*/
private String gender;
/**
* 性别1男2女0未知
*/
private String genderName;
/**
* 年龄
*/
private Integer age;
/**
* 迁入时间
*/
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private String inTime;
/**
* 迁入原因
*/
private String inReason;
/**
* 来源地区地址
*/
private String sourceAddress;
/**
* 迁移证号码
*/
private String moveNumber;
/**
* 户主姓名
*/
private String householderName;
/**
* 与户主关系[字典表]
*/
private String householderRelation;
/**
* 与户主关系[字典表]
*/
private String householderRelationName;
}
}

40
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcMoveInRecordController.java

@ -1,7 +1,10 @@
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.page.PageData;
import com.epmet.commons.tools.security.dto.TokenDto;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
@ -10,6 +13,9 @@ import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.dto.IcMoveInRecordDTO;
import com.epmet.dto.form.IcMoveInAddEditFormDTO;
import com.epmet.dto.form.IcMoveInListFormDTO;
import com.epmet.dto.result.IcMoveInListResultDTO;
import com.epmet.excel.IcMoveInRecordExcel;
import com.epmet.service.IcMoveInRecordService;
import org.springframework.beans.factory.annotation.Autowired;
@ -17,7 +23,6 @@ import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import java.util.List;
import java.util.Map;
/**
@ -41,23 +46,24 @@ public class IcMoveInRecordController {
}
@RequestMapping("list")
public Result<PageData<IcMoveInRecordDTO>> page(@RequestParam Map<String, Object> params){
PageData<IcMoveInRecordDTO> page = icMoveInRecordService.page(params);
return new Result<PageData<IcMoveInRecordDTO>>().ok(page);
@MaskResponse(fieldNames = { "mobile", "idCard" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD })
public Result<IcMoveInListResultDTO> list(@LoginUser TokenDto tokenDto, @RequestBody IcMoveInListFormDTO formDTO){
formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<IcMoveInListResultDTO>().ok(icMoveInRecordService.list(formDTO));
}
@NoRepeatSubmit
@PostMapping("add")
public Result save(@RequestBody IcMoveInRecordDTO dto){
//效验数据
public Result save(@LoginUser TokenDto tokenDto, @RequestBody IcMoveInAddEditFormDTO dto){
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
dto.setCustomerId(tokenDto.getCustomerId());
dto.setUserId(tokenDto.getUserId());
icMoveInRecordService.save(dto);
return new Result();
}
@NoRepeatSubmit
@PostMapping("edit")
public Result update(@RequestBody IcMoveInRecordDTO dto){
public Result update(@RequestBody IcMoveInAddEditFormDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
icMoveInRecordService.update(dto);
@ -72,12 +78,22 @@ public class IcMoveInRecordController {
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<IcMoveInRecordDTO> list = icMoveInRecordService.list(params);
@PostMapping("export")
public void export(@LoginUser TokenDto tokenDto, @RequestBody IcMoveInListFormDTO formDTO, HttpServletResponse response) throws Exception {
formDTO.setCustomerId(tokenDto.getCustomerId());
formDTO.setIsPage(true);
IcMoveInListResultDTO resultDTO = icMoveInRecordService.list(formDTO);
List<IcMoveInRecordExcel> list = ConvertUtils.sourceToTarget(resultDTO.getList(), IcMoveInRecordExcel.class);
ExcelUtils.exportExcelToTarget(response, null, list, IcMoveInRecordExcel.class);
}
@RequestMapping("detail")
public Result<IcMoveInListResultDTO.IcMoveInList> detail(@LoginUser TokenDto tokenDto, @RequestBody IcMoveInListFormDTO formDTO){
ValidatorUtils.validateEntity(formDTO, UpdateGroup.class, DefaultGroup.class);
formDTO.setCustomerId(tokenDto.getCustomerId());
return new Result<IcMoveInListResultDTO.IcMoveInList>().ok(icMoveInRecordService.detail(formDTO));
}
}

11
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcMoveInRecordDao.java

@ -1,9 +1,13 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.form.IcMoveInListFormDTO;
import com.epmet.dto.result.IcMoveInListResultDTO;
import com.epmet.entity.IcMoveInRecordEntity;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* 迁入管理记录
*
@ -12,5 +16,10 @@ import org.apache.ibatis.annotations.Mapper;
*/
@Mapper
public interface IcMoveInRecordDao extends BaseDao<IcMoveInRecordEntity> {
/**
* @Author sun
* @Description 迁入管理列表查询
**/
List<IcMoveInListResultDTO.IcMoveInList> selectMoveInList(IcMoveInListFormDTO formDTO);
}

7
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcMoveInRecordEntity.java

@ -68,7 +68,12 @@ public class IcMoveInRecordEntity extends BaseEpmetEntity {
/**
* 是否享受福利:0 :1
*/
private String isWeifare;
private String isWelfare;
/**
* 是否勾选补充居民信息0否 1是
*/
private String isCheck;
/**
* 手机号

73
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcMoveInRecordExcel.java

@ -1,6 +1,7 @@
package com.epmet.excel;
import cn.afterturn.easypoi.excel.annotation.Excel;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;
import java.util.Date;
@ -14,38 +15,14 @@ import java.util.Date;
@Data
public class IcMoveInRecordExcel {
@Excel(name = "唯一标识")
private String id;
@Excel(name = "客户Id customer.id")
private String customerId;
@Excel(name = "组织Id")
private String agencyId;
@Excel(name = "组织的pids")
private String pids;
@Excel(name = "网格ID")
private String gridId;
@Excel(name = "所属小区ID")
private String villageId;
@Excel(name = "所属楼宇Id")
private String buildId;
@Excel(name = "单元id")
private String unitId;
@Excel(name = "所属家庭Id")
private String homeId;
@Excel(name = "姓名")
private String name;
@Excel(name = "是否享受福利【否:0 是:1】")
private String isWeifare;
@Excel(name = "所属网格")
private String gridName;
@Excel(name = "所属房屋")
private String allName;
@Excel(name = "手机号")
private String mobile;
@ -53,50 +30,30 @@ public class IcMoveInRecordExcel {
@Excel(name = "身份证号")
private String idCard;
@Excel(name = "性别(1男2女0未知)")
private String gender;
@Excel(name = "性别")
private String genderName;
@Excel(name = "年龄")
private Integer age;
@Excel(name = "迁入时间")
private Date inTime;
//@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
private String inTime;
@Excel(name = "迁入原因")
private String inReason;
@Excel(name = "来源地")
private String source;
@Excel(name = "详细地址")
private String address;
@Excel(name = "由何地迁入")
private String sourceAddress;
@Excel(name = "迁移证号码")
private String moveNumber;
@Excel(name = "户主姓名")
private String houseName;
@Excel(name = "与户主关系[字典表]")
private String houseRelation;
@Excel(name = "删除标识 0.未删除 1.已删除")
private Integer delFlag;
@Excel(name = "乐观锁")
private Integer revision;
@Excel(name = "创建人")
private String createdBy;
@Excel(name = "创建时间")
private Date createdTime;
@Excel(name = "更新人")
private String updatedBy;
private String householderName;
@Excel(name = "更新时间")
private Date updatedTime;
@Excel(name = "与户主关系")
private String householderRelationName;
}

14
epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcMoveInRecordService.java

@ -3,9 +3,11 @@ package com.epmet.service;
import com.epmet.commons.mybatis.service.BaseService;
import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.IcMoveInRecordDTO;
import com.epmet.dto.form.IcMoveInAddEditFormDTO;
import com.epmet.dto.form.IcMoveInListFormDTO;
import com.epmet.dto.result.IcMoveInListResultDTO;
import com.epmet.entity.IcMoveInRecordEntity;
import java.util.List;
import java.util.Map;
/**
@ -29,12 +31,12 @@ public interface IcMoveInRecordService extends BaseService<IcMoveInRecordEntity>
/**
* 默认查询
*
* @param params
* @param formDTO
* @return java.util.List<IcMoveInRecordDTO>
* @author generator
* @date 2022-05-09
*/
List<IcMoveInRecordDTO> list(Map<String, Object> params);
IcMoveInListResultDTO list(IcMoveInListFormDTO formDTO);
/**
* 单条查询
@ -54,7 +56,7 @@ public interface IcMoveInRecordService extends BaseService<IcMoveInRecordEntity>
* @author generator
* @date 2022-05-09
*/
void save(IcMoveInRecordDTO dto);
void save(IcMoveInAddEditFormDTO dto);
/**
* 默认更新
@ -64,7 +66,7 @@ public interface IcMoveInRecordService extends BaseService<IcMoveInRecordEntity>
* @author generator
* @date 2022-05-09
*/
void update(IcMoveInRecordDTO dto);
void update(IcMoveInAddEditFormDTO dto);
/**
* 批量删除
@ -75,4 +77,6 @@ public interface IcMoveInRecordService extends BaseService<IcMoveInRecordEntity>
* @date 2022-05-09
*/
void delete(String[] ids);
IcMoveInListResultDTO.IcMoveInList detail(IcMoveInListFormDTO formDTO);
}

222
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcMoveInRecordServiceImpl.java

@ -4,19 +4,47 @@ 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.FieldConstant;
import com.epmet.commons.tools.constant.NumConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.enums.DictTypeEnum;
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.CustomerOrgRedis;
import com.epmet.commons.tools.redis.common.CustomerStaffRedis;
import com.epmet.commons.tools.redis.common.bean.GridInfoCache;
import com.epmet.commons.tools.utils.ConvertUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.dao.IcMoveInRecordDao;
import com.epmet.dto.ChangeWelfareDTO;
import com.epmet.dto.IcMoveInRecordDTO;
import com.epmet.dto.form.IcMoveInAddEditFormDTO;
import com.epmet.dto.form.IcMoveInListFormDTO;
import com.epmet.dto.form.IcResiUserTransferFormDTO;
import com.epmet.dto.result.HouseInfoDTO;
import com.epmet.dto.result.IcMoveInListResultDTO;
import com.epmet.dto.result.SyncResiResDTO;
import com.epmet.entity.IcMoveInRecordEntity;
import com.epmet.entity.IcResiUserEntity;
import com.epmet.feign.EpmetAdminOpenFeignClient;
import com.epmet.feign.GovOrgOpenFeignClient;
import com.epmet.service.ChangeWelfareService;
import com.epmet.service.IcMoveInRecordService;
import com.epmet.service.IcResiUserService;
import com.epmet.service.IcUserTransferRecordService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.MapUtils;
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 org.springframework.util.CollectionUtils;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.*;
import java.util.function.Function;
import java.util.stream.Collectors;
/**
* 迁入管理记录
@ -25,7 +53,18 @@ import java.util.Map;
* @since v1.0.0 2022-05-09
*/
@Service
@Slf4j
public class IcMoveInRecordServiceImpl extends BaseServiceImpl<IcMoveInRecordDao, IcMoveInRecordEntity> implements IcMoveInRecordService {
@Autowired
private GovOrgOpenFeignClient govOrgOpenFeignClient;
@Autowired
private IcResiUserService icResiUserService;
@Autowired
private IcUserTransferRecordService icUserTransferRecordService;
@Autowired
private EpmetAdminOpenFeignClient adminOpenFeignClient;
@Autowired
private ChangeWelfareService changeWelfareService;
@Override
@ -38,10 +77,53 @@ public class IcMoveInRecordServiceImpl extends BaseServiceImpl<IcMoveInRecordDao
}
@Override
public List<IcMoveInRecordDTO> list(Map<String, Object> params) {
List<IcMoveInRecordEntity> entityList = baseDao.selectList(getWrapper(params));
public IcMoveInListResultDTO list(IcMoveInListFormDTO formDTO) {
IcMoveInListResultDTO resultDTO = new IcMoveInListResultDTO();
//导出查询
if (formDTO.getIsPage()) {
List<IcMoveInListResultDTO.IcMoveInList> list = baseDao.selectMoveInList(formDTO);
resultDTO.setList(list);
} else {
//列表查询
PageInfo<IcMoveInListResultDTO.IcMoveInList> data = PageHelper.startPage(formDTO.getPageNo(), formDTO.getPageSize())
.doSelectPageInfo(() -> baseDao.selectMoveInList(formDTO));
resultDTO.setTotal((int) data.getTotal());
resultDTO.setList(data.getList());
}
//查询封装房屋信息
if (!CollectionUtils.isEmpty(resultDTO.getList())) {
Map<String, String> map = new HashMap<>();
//查询房屋信息
Set<String> houseIds = resultDTO.getList().stream().filter(l -> StringUtils.isNotBlank(l.getHomeId())).map(m -> m.getHomeId()).collect(Collectors.toSet());
Result<List<HouseInfoDTO>> houseInfoRes = govOrgOpenFeignClient.queryListHouseInfo(houseIds, formDTO.getCustomerId());
List<HouseInfoDTO> houseInfoDTOList = houseInfoRes.success() && !org.apache.commons.collections4.CollectionUtils.isEmpty(houseInfoRes.getData()) ? houseInfoRes.getData() : new ArrayList<>();
Map<String, HouseInfoDTO> houseInfoMap = houseInfoDTOList.stream().collect(Collectors.toMap(HouseInfoDTO::getHomeId, Function.identity()));
//与户主关系字典表数据
Result<Map<String, String>> statusRes = adminOpenFeignClient.dictMap(DictTypeEnum.RELATIONSHIP.getCode());
Map<String, String> statusMap = statusRes.success() && MapUtils.isNotEmpty(statusRes.getData()) ? statusRes.getData() : new HashMap<>();
return ConvertUtils.sourceToTarget(entityList, IcMoveInRecordDTO.class);
//封装数据
for (IcMoveInListResultDTO.IcMoveInList v : resultDTO.getList()) {
if (!map.containsKey(v.getGridId())) {
//获取网格缓存信息
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(v.getGridId());
map.put(v.getGridId(), (null == gridInfo || StringUtils.isEmpty(gridInfo.getGridName()) ? "" : gridInfo.getGridName()));
}
v.setGridName(map.get(v.getGridId()));
if (null != houseInfoMap && houseInfoMap.containsKey(v.getHomeId())) {
v.setVillageName(houseInfoMap.get(v.getHomeId()).getNeighborHoodName());
v.setBuildName(houseInfoMap.get(v.getHomeId()).getBuildingName());
v.setUnitName(houseInfoMap.get(v.getHomeId()).getUnitName());
v.setHomeName(houseInfoMap.get(v.getHomeId()).getDoorName());
v.setAllName(houseInfoMap.get(v.getHomeId()).getAllName());
}
if (StringUtils.isNotBlank(v.getHouseholderRelation())) {
v.setHouseholderRelationName(statusMap.get(v.getHouseholderRelation()));
}
}
}
return resultDTO;
}
private QueryWrapper<IcMoveInRecordEntity> getWrapper(Map<String, Object> params){
@ -59,17 +141,108 @@ public class IcMoveInRecordServiceImpl extends BaseServiceImpl<IcMoveInRecordDao
return ConvertUtils.sourceToTarget(entity, IcMoveInRecordDTO.class);
}
/**
* @Author sun
* @Description 迁入管理新增迁入记录
* 1.判断是否本社区居民是的在判断是正常还是游离正常的判断房屋跟之前是否一样不一样的给提示是否更新一样的直接更新居民信息生成迁入记录
* 游离的直接更新居民信息生成迁入记录
* 2.判断不是本社区居民的在判断是正常还是游离正常的直接停止程序操作游离的直接更新居民信息生成迁入记录
* 3.不是本社区居民的在客户下不存在的直接新增居民新增迁入记录
**/
@Override
@Transactional(rollbackFor = Exception.class)
public void save(IcMoveInRecordDTO dto) {
IcMoveInRecordEntity entity = ConvertUtils.sourceToTarget(dto, IcMoveInRecordEntity.class);
public void save(IcMoveInAddEditFormDTO formDTO) {
//1.获取当前工作人员缓存信息
CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(formDTO.getCustomerId(), formDTO.getUserId());
if (null == staffInfo) {
throw new EpmetException(String.format("查询工作人员%s缓存信息失败...", formDTO.getUserId()));
}
//2.校验是否允许迁入
SyncResiResDTO resiDTO = icResiUserService.checkUser(formDTO.getCustomerId(), formDTO.getIdCard(), staffInfo.getAgencyId());
if (!resiDTO.getMoveInstatus()) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "当前居民不允许迁入");
}
//3.判断是否需要更新居民信息
if (StringUtils.isNotBlank(resiDTO.getResiAgencyId()) && !staffInfo.getAgencyId().equals(resiDTO.getResiAgencyId())
&& StringUtils.isNotBlank(formDTO.getIsReplace()) && !"0".equals(formDTO.getIsReplace()) && !"1".equals(formDTO.getIsReplace())) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "居民信息中房屋信息与当前选择房屋不一致,是否更新?");
}
//4.勾选了补充居民信息且选择了更新信息的
if ("1".equals(formDTO.getIsCheck()) && "1".equals(formDTO.getIsReplace())) {
IcResiUserTransferFormDTO change = new IcResiUserTransferFormDTO();
change.setType("in");
change.setNewAgencyId(staffInfo.getAgencyId());
change.setNewGridId(formDTO.getGridId());
change.setNewNeighborHoodId(formDTO.getVillageId());
change.setNewBuildingId(formDTO.getBuildId());
change.setNewBuildingUnitId(formDTO.getUnitId());
change.setNewHouseId(formDTO.getHomeId());
change.setTransferTime(new Date());
change.setReason(formDTO.getInReason());
change.setCustomerId(formDTO.getCustomerId());
change.setStaffId(formDTO.getUserId());
change.setOrigin("in");
IcResiUserEntity entity = ConvertUtils.sourceToTarget(formDTO, IcResiUserEntity.class);
//4-1.本社区下正常状态居民【只更新居民信息,不生成变更记录、变更明细】
if (StringUtils.isNotBlank(resiDTO.getResiAgencyId()) && staffInfo.getAgencyId().equals(resiDTO.getResiAgencyId()) && "0".equals(resiDTO.getStatus())) {
entity.setId(resiDTO.getIcResiUserId());
icResiUserService.updateById(entity);
} else if (StringUtils.isNotBlank(resiDTO.getResiAgencyId()) && staffInfo.getAgencyId().equals(resiDTO.getResiAgencyId()) && "1".equals(resiDTO.getStatus())) {
//4-2.本社区下游离状态居民【更新居民信息,生成变更记录、变更明细】
entity.setId(resiDTO.getIcResiUserId());
icResiUserService.updateById(entity);
change.setIcUserId(entity.getId());
icUserTransferRecordService.moveOutResi(change);
} else if (StringUtils.isNotBlank(resiDTO.getResiAgencyId()) && !staffInfo.getAgencyId().equals(resiDTO.getResiAgencyId())) {
//4-3.非本社区下游离状态居民【更新居民信息,生成变更记录、变更明细】
entity.setId(resiDTO.getIcResiUserId());
entity.setAgencyId(staffInfo.getAgencyId());
entity.setPids(staffInfo.getAgencyPIds());
icResiUserService.updateById(entity);
change.setIcUserId(entity.getId());
icUserTransferRecordService.moveOutResi(change);
} else if (StringUtils.isBlank(resiDTO.getResiAgencyId())) {
//4-4.客户下不存在的居民(新数据)【新增居民信息,不生成变更记录、变更明细(因为十八类默认都是否)】
entity.setAgencyId(staffInfo.getAgencyId());
entity.setPids(staffInfo.getAgencyPIds());
icResiUserService.insert(entity);
}
}
//5.生成迁入记录
IcMoveInRecordEntity entity = ConvertUtils.sourceToTarget(formDTO, IcMoveInRecordEntity.class);
entity.setAgencyId(staffInfo.getAgencyId());
entity.setPids(staffInfo.getAgencyPIds());
insert(entity);
//6.判断调用是否享受福利接口
if("1".equals(formDTO.getIsWelfare())){
ChangeWelfareDTO formDto = new ChangeWelfareDTO();
formDto.setUserId(resiDTO.getIcResiUserId());
formDto.setName(formDTO.getName());
formDto.setIdCard(formDTO.getIdCard());
formDto.setMobile(formDTO.getMobile());
formDto.setGridId(formDTO.getGridId());
formDto.setGender(formDTO.getGender());
formDto.setJoinReason(formDTO.getInReason());
formDto.setCustomerId(formDTO.getCustomerId());
changeWelfareService.saveWelfareInfo(formDto);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(IcMoveInRecordDTO dto) {
public void update(IcMoveInAddEditFormDTO dto) {
if (null == baseDao.selectById(dto.getMoveInId())) {
log.error(String.format("迁入记录信息修改失败,未查询到记录,迁入Id->%s", dto.getMoveInId()));
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "信息修改失败,未查询到迁入记录");
}
IcMoveInRecordEntity entity = ConvertUtils.sourceToTarget(dto, IcMoveInRecordEntity.class);
entity.setId(dto.getMoveInId());
updateById(entity);
}
@ -80,4 +253,35 @@ public class IcMoveInRecordServiceImpl extends BaseServiceImpl<IcMoveInRecordDao
baseDao.deleteBatchIds(Arrays.asList(ids));
}
@Override
public IcMoveInListResultDTO.IcMoveInList detail(IcMoveInListFormDTO formDTO) {
IcMoveInListResultDTO.IcMoveInList resultDTO = new IcMoveInListResultDTO.IcMoveInList();
//1.查询迁入记录信息
List<IcMoveInListResultDTO.IcMoveInList> list = baseDao.selectMoveInList(formDTO);
//2.查询网格房屋信息
if (!CollectionUtils.isEmpty(list)) {
resultDTO = list.get(NumConstant.ZERO);
//查询房屋信息
Set<String> houseIds = new HashSet<>();
houseIds.add(resultDTO.getHomeId());
Result<List<HouseInfoDTO>> houseInfoRes = govOrgOpenFeignClient.queryListHouseInfo(houseIds, formDTO.getCustomerId());
List<HouseInfoDTO> houseInfoDTOList = houseInfoRes.success() && !org.apache.commons.collections4.CollectionUtils.isEmpty(houseInfoRes.getData()) ? houseInfoRes.getData() : new ArrayList<>();
Map<String, HouseInfoDTO> houseInfoMap = houseInfoDTOList.stream().collect(Collectors.toMap(HouseInfoDTO::getHomeId, Function.identity()));
if (null != houseInfoMap && houseInfoMap.containsKey(resultDTO.getHomeId())) {
resultDTO.setVillageName(houseInfoMap.get(resultDTO.getHomeId()).getNeighborHoodName());
resultDTO.setBuildName(houseInfoMap.get(resultDTO.getHomeId()).getBuildingName());
resultDTO.setUnitName(houseInfoMap.get(resultDTO.getHomeId()).getUnitName());
resultDTO.setHomeName(houseInfoMap.get(resultDTO.getHomeId()).getDoorName());
resultDTO.setAllName(houseInfoMap.get(resultDTO.getHomeId()).getAllName());
}
//获取网格缓存信息
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(resultDTO.getGridId());
if (null != gridInfo) {
resultDTO.setGridName(gridInfo.getGridName());
}
}
return resultDTO;
}
}

67
epmet-user/epmet-user-server/src/main/resources/mapper/IcMoveInRecordDao.xml

@ -3,6 +3,71 @@
<mapper namespace="com.epmet.dao.IcMoveInRecordDao">
<select id="selectMoveInList" resultType="com.epmet.dto.result.IcMoveInListResultDTO$IcMoveInList">
SELECT
id moveInId,
grid_id gridId,
village_id villageId,
build_id buildId,
unit_id unitId,
home_id homeId,
name NAME,
is_welfare isWeifare,
is_check isCheck,
mobile mobile,
id_card idCard,
gender gender,
IF(gender='1','男',IF(gender='2','女','未知'))genderName,
age age,
in_time inTime,
in_reason inReason,
source_address_code sourceAddressCode,
source_address_path_code sourceAddressPathCode,
source_address sourceAddress,
address address,
move_number moveNumber,
householder_name householderName,
householder_relation householderRelation
FROM
ic_move_in_record
WHERE
del_flag = '0'
<if test="gridId != null and gridId != '' ">
AND grid_id = #{gridId}
</if>
<if test="villageId != null and villageId != '' ">
AND village_id = #{villageId}
</if>
<if test="buildId != null and buildId != '' ">
AND build_id = #{buildId}
</if>
<if test="unitId != null and unitId != '' ">
AND unit_id = #{unitId}
</if>
<if test="homeId != null and homeId != '' ">
AND home_id = #{homeId}
</if>
<if test="name != null and name != '' ">
AND `name` LIKE CONCAT('%', #{name}, '%')
</if>
<if test="mobile != null and mobile != '' ">
AND mobile = #{mobile}
</if>
<if test="idCard != null and idCard != '' ">
AND id_card = #{idCard}
</if>
<if test="startTime != null and startTime != '' ">
AND in_time <![CDATA[>=]]> #{startTime}
</if>
<if test="endTime != null and endTime != '' ">
AND in_time <![CDATA[<=]]> #{endTime}
</if>
<if test="isWeifare != null and isWeifare != '' ">
AND is_welfare = #{isWeifare}
</if>
<if test="moveInId != null and moveInId != '' ">
AND id = #{moveInId}
</if>
</select>
</mapper>
Loading…
Cancel
Save