From 0221ea8524dc9c03bcac759ea75a90af40d9bf50 Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Wed, 11 May 2022 10:10:40 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=81=E5=85=A5=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/IcMoveInRecordDTO.java | 7 +- .../dto/form/IcMoveInAddEditFormDTO.java | 136 +++++++++++ .../epmet/dto/form/IcMoveInListFormDTO.java | 77 ++++++ .../dto/result/IcMoveInListResultDTO.java | 154 ++++++++++++ .../controller/IcMoveInRecordController.java | 40 +++- .../java/com/epmet/dao/IcMoveInRecordDao.java | 11 +- .../epmet/entity/IcMoveInRecordEntity.java | 7 +- .../com/epmet/excel/IcMoveInRecordExcel.java | 73 ++---- .../epmet/service/IcMoveInRecordService.java | 14 +- .../impl/IcMoveInRecordServiceImpl.java | 222 +++++++++++++++++- .../resources/mapper/IcMoveInRecordDao.xml | 67 +++++- 11 files changed, 720 insertions(+), 88 deletions(-) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcMoveInAddEditFormDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcMoveInListFormDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcMoveInListResultDTO.java diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcMoveInRecordDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcMoveInRecordDTO.java index f68c93d372..329c44314b 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/IcMoveInRecordDTO.java +++ b/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; /** * 手机号 diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcMoveInAddEditFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcMoveInAddEditFormDTO.java new file mode 100644 index 0000000000..4d0fc813dc --- /dev/null +++ b/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; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcMoveInListFormDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/form/IcMoveInListFormDTO.java new file mode 100644 index 0000000000..7dc30d24f1 --- /dev/null +++ b/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; + + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcMoveInListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/IcMoveInListResultDTO.java new file mode 100644 index 0000000000..7795b50736 --- /dev/null +++ b/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 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; + + } + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcMoveInRecordController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcMoveInRecordController.java index bc30dc17ba..876a8bea45 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/IcMoveInRecordController.java +++ b/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> page(@RequestParam Map params){ - PageData page = icMoveInRecordService.page(params); - return new Result>().ok(page); + @MaskResponse(fieldNames = { "mobile", "idCard" }, fieldsMaskType = { MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD }) + public Result list(@LoginUser TokenDto tokenDto, @RequestBody IcMoveInListFormDTO formDTO){ + formDTO.setCustomerId(tokenDto.getCustomerId()); + return new Result().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 params, HttpServletResponse response) throws Exception { - List 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 list = ConvertUtils.sourceToTarget(resultDTO.getList(), IcMoveInRecordExcel.class); ExcelUtils.exportExcelToTarget(response, null, list, IcMoveInRecordExcel.class); } + @RequestMapping("detail") + public Result detail(@LoginUser TokenDto tokenDto, @RequestBody IcMoveInListFormDTO formDTO){ + ValidatorUtils.validateEntity(formDTO, UpdateGroup.class, DefaultGroup.class); + formDTO.setCustomerId(tokenDto.getCustomerId()); + return new Result().ok(icMoveInRecordService.detail(formDTO)); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcMoveInRecordDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcMoveInRecordDao.java index 4910ea8882..9d568a8abd 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcMoveInRecordDao.java +++ b/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 { - + + /** + * @Author sun + * @Description 【迁入管理】列表查询 + **/ + List selectMoveInList(IcMoveInListFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcMoveInRecordEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcMoveInRecordEntity.java index 9ee125a348..0e9f4e76f4 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcMoveInRecordEntity.java +++ b/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; /** * 手机号 diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcMoveInRecordExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcMoveInRecordExcel.java index d1ec627c17..5eff6171b7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/IcMoveInRecordExcel.java +++ b/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; } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcMoveInRecordService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcMoveInRecordService.java index 3df4e7a2fd..14704378b5 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/IcMoveInRecordService.java +++ b/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 /** * 默认查询 * - * @param params + * @param formDTO * @return java.util.List * @author generator * @date 2022-05-09 */ - List list(Map params); + IcMoveInListResultDTO list(IcMoveInListFormDTO formDTO); /** * 单条查询 @@ -54,7 +56,7 @@ public interface IcMoveInRecordService extends BaseService * @author generator * @date 2022-05-09 */ - void save(IcMoveInRecordDTO dto); + void save(IcMoveInAddEditFormDTO dto); /** * 默认更新 @@ -64,7 +66,7 @@ public interface IcMoveInRecordService extends BaseService * @author generator * @date 2022-05-09 */ - void update(IcMoveInRecordDTO dto); + void update(IcMoveInAddEditFormDTO dto); /** * 批量删除 @@ -75,4 +77,6 @@ public interface IcMoveInRecordService extends BaseService * @date 2022-05-09 */ void delete(String[] ids); + + IcMoveInListResultDTO.IcMoveInList detail(IcMoveInListFormDTO formDTO); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcMoveInRecordServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcMoveInRecordServiceImpl.java index c2501bfed0..f8935b07c4 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcMoveInRecordServiceImpl.java +++ b/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 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 list(Map params) { - List entityList = baseDao.selectList(getWrapper(params)); + public IcMoveInListResultDTO list(IcMoveInListFormDTO formDTO) { + IcMoveInListResultDTO resultDTO = new IcMoveInListResultDTO(); + //导出查询 + if (formDTO.getIsPage()) { + List list = baseDao.selectMoveInList(formDTO); + resultDTO.setList(list); + } else { + //列表查询 + PageInfo 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 map = new HashMap<>(); + //查询房屋信息 + Set houseIds = resultDTO.getList().stream().filter(l -> StringUtils.isNotBlank(l.getHomeId())).map(m -> m.getHomeId()).collect(Collectors.toSet()); + Result> houseInfoRes = govOrgOpenFeignClient.queryListHouseInfo(houseIds, formDTO.getCustomerId()); + List houseInfoDTOList = houseInfoRes.success() && !org.apache.commons.collections4.CollectionUtils.isEmpty(houseInfoRes.getData()) ? houseInfoRes.getData() : new ArrayList<>(); + Map houseInfoMap = houseInfoDTOList.stream().collect(Collectors.toMap(HouseInfoDTO::getHomeId, Function.identity())); + //与户主关系字典表数据 + Result> statusRes = adminOpenFeignClient.dictMap(DictTypeEnum.RELATIONSHIP.getCode()); + Map 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 getWrapper(Map params){ @@ -59,17 +141,108 @@ public class IcMoveInRecordServiceImpl extends BaseServiceImpl%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 list = baseDao.selectMoveInList(formDTO); + //2.查询网格房屋信息 + if (!CollectionUtils.isEmpty(list)) { + resultDTO = list.get(NumConstant.ZERO); + //查询房屋信息 + Set houseIds = new HashSet<>(); + houseIds.add(resultDTO.getHomeId()); + Result> houseInfoRes = govOrgOpenFeignClient.queryListHouseInfo(houseIds, formDTO.getCustomerId()); + List houseInfoDTOList = houseInfoRes.success() && !org.apache.commons.collections4.CollectionUtils.isEmpty(houseInfoRes.getData()) ? houseInfoRes.getData() : new ArrayList<>(); + Map 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; + } + } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/IcMoveInRecordDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/IcMoveInRecordDao.xml index 9e8c575fdd..a4447ed6e5 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/IcMoveInRecordDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/IcMoveInRecordDao.xml @@ -3,6 +3,71 @@ - + \ No newline at end of file