diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LingShanSpecialCrowdListResultDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LingShanSpecialCrowdListResultDTO.java new file mode 100644 index 0000000000..af84a07746 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LingShanSpecialCrowdListResultDTO.java @@ -0,0 +1,25 @@ +package com.epmet.dto.result; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +@Data +public class LingShanSpecialCrowdListResultDTO { + + private String orgNamePath; + private String specialType; + private String specialTypeDisplay; + private String name; + private String mobile; + private String idCard; + private String address; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date createdTime; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date updatedTime; + +} diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/enums/LingShanSpecialCrowdTypeEnums.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/enums/LingShanSpecialCrowdTypeEnums.java index 28e0c19e7c..5728173c2f 100644 --- a/epmet-user/epmet-user-client/src/main/java/com/epmet/enums/LingShanSpecialCrowdTypeEnums.java +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/enums/LingShanSpecialCrowdTypeEnums.java @@ -17,8 +17,8 @@ public enum LingShanSpecialCrowdTypeEnums { /** * 类型。anzhibangjiao, */ - private String type; - private String name; + public final String type; + public final String name; private Integer headerRowNumber; @@ -39,4 +39,15 @@ public enum LingShanSpecialCrowdTypeEnums { public Integer getHeaderRowNumber() { return headerRowNumber; } + + public static LingShanSpecialCrowdTypeEnums getByType(String type) { + for (LingShanSpecialCrowdTypeEnums e : LingShanSpecialCrowdTypeEnums.values()) { + if (e.getType().equals(type)) { + return e; + } + } + return null; + } + + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java index 6752d0066a..8c2022865d 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java @@ -2,17 +2,18 @@ package com.epmet.controller; 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.utils.DateUtils; import com.epmet.commons.tools.utils.FileUtils; import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.dto.result.LingShanSpecialCrowdListResultDTO; +import com.epmet.excel.data.*; import com.epmet.service.LingShanSpecialCrowdService; import lombok.extern.slf4j.Slf4j; import org.apache.commons.io.IOUtils; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import java.io.FileOutputStream; @@ -20,6 +21,7 @@ import java.io.IOException; import java.nio.file.Files; import java.nio.file.Path; import java.util.Date; +import java.util.List; /** * @description: 灵山社会维稳(特殊人群) @@ -94,5 +96,96 @@ public class LingShanSpecialCrowdController { } } + /** + * @description: 安置帮教新增 + * @param azbjData: + * @return + * @author: WangXianZhang + * @date: 2023/4/20 2:50 PM + */ + @PostMapping("anzhibangjiao/create") + public Result createSpecialCrowd(@RequestBody LingShanSpecialCrowdDetailAzbjExcelData azbjData) { + ValidatorUtils.validateEntity(azbjData); + + lingShanSpecialCrowdService.createSpecialCrowd(azbjData, "anzhibangjiao"); + return new Result(); + } + + @PostMapping("xidurenyuan/create") + public Result createSpecialCrowd(@RequestBody LingshanSpecialCrowdDetailJdryExcelData jdryData) { + ValidatorUtils.validateEntity(jdryData); + + lingShanSpecialCrowdService.createSpecialCrowd(jdryData, "xidurenyuan"); + return new Result(); + } + + @PostMapping("jingzhanhuanzhe/create") + public Result createSpecialCrowd(@RequestBody LingshanSpecialCrowdDetailJzhzExcelData jzhzData) { + ValidatorUtils.validateEntity(jzhzData); + + lingShanSpecialCrowdService.createSpecialCrowd(jzhzData, "jingzhanhuanzhe"); + return new Result(); + } + + @PostMapping("shequjiaozheng/create") + public Result createSpecialCrowd(@RequestBody LingshanSpecialCrowdDetailSqjzExcelData sqjzData) { + ValidatorUtils.validateEntity(sqjzData); + + lingShanSpecialCrowdService.createSpecialCrowd(sqjzData, "shequjiaozheng"); + return new Result(); + } + + @PostMapping("xinfangrenyuan/create") + public Result createSpecialCrowd(@RequestBody LingshanSpecialCrowdDetailXfryExcelData xfryData) { + ValidatorUtils.validateEntity(xfryData); + + lingShanSpecialCrowdService.createSpecialCrowd(xfryData, "xinfangrenyuan"); + return new Result(); + } + + /** + * @description: 特殊人群详情 + * @param personId: + * @param specialType: + * @return + * @author: WangXianZhang + * @date: 2023/4/20 3:44 PM + */ + @GetMapping("getPersonSpecialTypeDetail") + public Result getPersonSpecialTypeDetail(@RequestParam("idCard") String idCard, + @RequestParam("specialType") String specialType, + @RequestParam("specialDetailId") String specialDetailId) { + + LingShanSpecialCrowdDetailBaseExcelData r = lingShanSpecialCrowdService.getPersonSpecialTypeDetail(idCard, specialType, specialDetailId); + return new Result().ok(r); + } + + /** + * @description: 列表查询 + * @param orgId: + * @param orgType: + * @param specialType: + * @param name: + * @param mobile: + * @param idCard: + * @return + * @author: WangXianZhang + * @date: 2023/4/20 5:42 PM + */ + @GetMapping("listSpecialCrowd") + public Result> listSpecialCrowds(@RequestParam(value = "orgId", required = false) String orgId, + @RequestParam(value = "orgType", required = false) String orgType, + @RequestParam(value = "specialType", required = false) String specialType, + @RequestParam(value = "name", required = false) String name, + @RequestParam(value = "mobile", required = false) String mobile, + @RequestParam(value = "idCard", required = false) String idCard, + @RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo, + @RequestParam(value = "pageSize", required = false, defaultValue = "20") Integer pageSize) { + + PageData pd = lingShanSpecialCrowdService.listSpecialCrowds(orgId, orgType, specialType, name, mobile, + idCard, pageNo, pageSize); + return new Result>().ok(pd); + } + } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonTypeDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonTypeDao.java index 5dbb31709b..507a766cf6 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonTypeDao.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonTypeDao.java @@ -1,6 +1,7 @@ package com.epmet.dao; import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.dto.result.LingShanSpecialCrowdListResultDTO; import com.epmet.entity.LingshanSpecialCrowdPersonTypeEntity; import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Param; @@ -17,4 +18,11 @@ import java.util.List; public interface LingshanSpecialCrowdPersonTypeDao extends BaseDao { void saveOrUpdateManually(@Param("types") List types); + + List listSpecialCrowds(@Param("orgIdPath") String orgIdPath, + @Param("orgType") String orgType, + @Param("specialType") String specialType, + @Param("name") String name, + @Param("mobile") String mobile, + @Param("idCard") String idCard); } \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailBaseExcelData.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailBaseExcelData.java index 27c97a9d0e..21a731cfc9 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailBaseExcelData.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailBaseExcelData.java @@ -9,7 +9,7 @@ import javax.validation.constraints.NotBlank; * */ @Data -public class LingShanSpecialCrowdDetailBaseExcelData { +public class LingShanSpecialCrowdDetailBaseExcelData extends LingShanSpecialCrowdDetailResultExtraInfo { /** * 姓名 */ diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailResultExtraInfo.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailResultExtraInfo.java new file mode 100644 index 0000000000..6a746798b2 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailResultExtraInfo.java @@ -0,0 +1,32 @@ +package com.epmet.excel.data; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Data; + +import java.util.Date; + +/** + * @description: 灵山特殊人群扩展字段 + * @param null: + * @return + * @author: WangXianZhang + * @date: 2023/4/20 4:21 PM + */ +@Data +public class LingShanSpecialCrowdDetailResultExtraInfo { + + private String gender; + private String genderZh; + private String nation; + private String birthday; + /** + * 户籍地 + */ + private String domicilePlace; + private String mobile; + /** + * 住址 + */ + private String address; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/LingShanSpecialCrowdService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/LingShanSpecialCrowdService.java index 766318b93d..dd812582e7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/LingShanSpecialCrowdService.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/LingShanSpecialCrowdService.java @@ -1,5 +1,7 @@ package com.epmet.service; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.result.LingShanSpecialCrowdListResultDTO; import com.epmet.entity.*; import com.epmet.excel.data.LingShanSpecialCrowdDetailAzbjExcelData; import com.epmet.excel.data.LingShanSpecialCrowdDetailBaseExcelData; @@ -44,4 +46,38 @@ public interface LingShanSpecialCrowdService { void saveBatch(List entities, LingshanSpecialCrowdDetailJzhzEntity e); void saveBatch(List entities, LingshanSpecialCrowdDetailSqjzEntity e); void saveBatch(List entities, LingshanSpecialCrowdDetailXfryEntity e); + + /** + * @description: 新增-安置帮教 + * @param azbjData: + * @return + * @author: WangXianZhang + * @date: 2023/4/20 2:51 PM + */ + void createSpecialCrowd(LingShanSpecialCrowdDetailBaseExcelData azbjData, String specialType); + + /** + * @description: 特殊人群详情 + * @param idCard: + * @param specialType: + * @return + * @author: WangXianZhang + * @date: 2023/4/20 3:45 PM + */ + LingShanSpecialCrowdDetailBaseExcelData getPersonSpecialTypeDetail(String idCard, String specialType, String specialDetailId); + + /** + * @description: 列表查询 + * @param orgId: + * @param orgType: + * @param specialType: + * @param name: + * @param mobile: + * @param idCard: + * @return + * @author: WangXianZhang + * @date: 2023/4/20 5:44 PM + */ + PageData listSpecialCrowds(String orgId, String orgType, String specialType, String name, String mobile, + String idCard, Integer pageNo, Integer pageSize); } diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanSpecialCrowdServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanSpecialCrowdServiceImpl.java index 9f8830f13d..10597262e7 100644 --- a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanSpecialCrowdServiceImpl.java +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanSpecialCrowdServiceImpl.java @@ -2,53 +2,68 @@ package com.epmet.service.impl; import com.alibaba.excel.EasyExcel; import com.alibaba.excel.ExcelWriter; -import com.alibaba.excel.converters.Converter; -import com.alibaba.excel.converters.ReadConverterContext; -import com.alibaba.excel.enums.CellDataTypeEnum; -import com.alibaba.excel.read.metadata.ReadSheet; -import com.alibaba.excel.write.builder.ExcelWriterBuilder; import com.alibaba.excel.write.metadata.WriteSheet; +import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; +import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.epmet.commons.tools.constant.ServiceConstant; +import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; +import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.enums.BizTypeEnum; import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetException; import com.epmet.commons.tools.exception.ExceptionUtils; -import com.epmet.commons.tools.exception.ValidateException; import com.epmet.commons.tools.feign.ResultDataResolver; -import com.epmet.commons.tools.utils.DateUtils; -import com.epmet.commons.tools.utils.EpmetRequestHolder; -import com.epmet.commons.tools.utils.ExcelUtils; -import com.epmet.commons.tools.utils.FileUtils; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.redis.common.CustomerOrgRedis; +import com.epmet.commons.tools.redis.common.CustomerResiUserRedis; +import com.epmet.commons.tools.redis.common.CustomerStaffRedis; +import com.epmet.commons.tools.redis.common.bean.AgencyInfoCache; +import com.epmet.commons.tools.redis.common.bean.GridInfoCache; +import com.epmet.commons.tools.redis.common.bean.IcResiUserInfoCache; +import com.epmet.commons.tools.utils.*; import com.epmet.constants.ImportTaskConstants; import com.epmet.dao.*; +import com.epmet.dto.IcBuildingDTO; +import com.epmet.dto.IcBuildingUnitDTO; +import com.epmet.dto.IcNeighborHoodDTO; +import com.epmet.dto.IcResiUserDTO; +import com.epmet.dto.result.HouseAgencyInfoResultDTO; import com.epmet.dto.result.ImportTaskCommonResultDTO; +import com.epmet.dto.result.LingShanSpecialCrowdListResultDTO; import com.epmet.dto.result.UploadImgResultDTO; import com.epmet.entity.*; import com.epmet.enums.LingShanSpecialCrowdTypeEnums; import com.epmet.excel.data.*; import com.epmet.excel.handler.*; import com.epmet.exceptions.ReadExcelHeaderOnlyException; +import com.epmet.feign.EpmetAdminOpenFeignClient; +import com.epmet.feign.GovOrgOpenFeignClient; import com.epmet.feign.OssFeignClient; import com.epmet.service.LingShanSpecialCrowdService; import com.epmet.utils.ImportTaskUtils; +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.collections4.ListUtils; import org.apache.commons.fileupload.FileItem; import org.apache.commons.fileupload.disk.DiskFileItemFactory; +import org.apache.commons.lang3.StringUtils; import org.apache.http.entity.ContentType; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import org.springframework.web.multipart.commons.CommonsMultipartFile; -import java.io.File; import java.io.IOException; import java.io.InputStream; import java.io.OutputStream; +import java.util.Arrays; import java.util.Date; import java.util.List; +import java.util.Optional; import java.util.concurrent.CompletableFuture; import java.util.concurrent.ExecutorService; +import java.util.concurrent.atomic.AtomicReference; /** * 灵山特殊人群service @@ -87,6 +102,11 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ @Autowired private OssFeignClient ossFeignClient; + @Autowired + private EpmetAdminOpenFeignClient adminOpenFeignClient; + @Autowired + private GovOrgOpenFeignClient govOrgOpenFeignClient; + @Override public String importSpecialCrowd(String crowdCategory, String fileSavePath, String originFilename) { Class excelDataClass; @@ -229,7 +249,7 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ return "居民信息不存在,请先维护居民基础信息。"; } if (!resiEntity.getName().equals(name)) { - return String.format("姓名信息与居民基础信息不一致。(在居民哭华总根据身份证号找到的居民姓名为:{})", name); + return String.format("姓名信息与居民基础信息不一致。(在居民库中根据身份证号找到的居民姓名为:%s)", name); } return null; @@ -287,4 +307,196 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ specialCrowdDetailXfryDao.saveBatchManually(l); } } + + @Override + public void createSpecialCrowd(LingShanSpecialCrowdDetailBaseExcelData specialData, String specialType) { + String customerId = EpmetRequestHolder.getLoginUserCustomerId(); + String staffId = EpmetRequestHolder.getLoginUserId(); + CustomerStaffInfoCacheResult staffInfo = CustomerStaffRedis.getStaffInfo(customerId, staffId); + String orgIdPath = PidUtils.convertPid2OrgIdPath(staffInfo.getAgencyId(), staffInfo.getAgencyPIds()); + + Date now = new Date(); + + // 检查 + String validateRst = validate(specialData); + if (StringUtils.isNotBlank(validateRst)) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, validateRst); + } + + // 保存人员和类型信息 + LingshanSpecialCrowdPersonEntity person = new LingshanSpecialCrowdPersonEntity(IdWorker.getIdStr(), customerId, orgIdPath, specialData.getName(), specialData.getIdCard(), + "0", 0, now, staffId, now, staffId); + // + LingshanSpecialCrowdPersonTypeEntity personType = new LingshanSpecialCrowdPersonTypeEntity(IdWorker.getIdStr(), customerId, orgIdPath, specialData.getIdCard(), specialType, + "0", 0, now, staffId, now, staffId); + + savePersonAndTypes(Arrays.asList(person), Arrays.asList(personType)); + + // Class clazz; + + switch (specialType) { + case "anzhibangjiao": + LingshanSpecialCrowdDetailAzbjEntity e1 = ConvertUtils.sourceToTarget(specialData, LingshanSpecialCrowdDetailAzbjEntity.class); + setCommonFields(e1, customerId, orgIdPath, now, staffId); + saveBatch(Arrays.asList(e1), e1); + break; + case "xinfangrenyuan": + LingshanSpecialCrowdDetailAzbjEntity e2 = ConvertUtils.sourceToTarget(specialData, LingshanSpecialCrowdDetailAzbjEntity.class); + setCommonFields(e2, customerId, orgIdPath, now, staffId); + saveBatch(Arrays.asList(e2), e2); + break; + case "xidurenyuan": + LingshanSpecialCrowdDetailAzbjEntity e3 = ConvertUtils.sourceToTarget(specialData, LingshanSpecialCrowdDetailAzbjEntity.class); + setCommonFields(e3, customerId, orgIdPath, now, staffId); + saveBatch(Arrays.asList(e3), e3); + break; + case "shequjiaozheng": + LingshanSpecialCrowdDetailAzbjEntity e4 = ConvertUtils.sourceToTarget(specialData, LingshanSpecialCrowdDetailAzbjEntity.class); + setCommonFields(e4, customerId, orgIdPath, now, staffId); + saveBatch(Arrays.asList(e4), e4); + break; + case "jingzhanghuanzhe": + LingshanSpecialCrowdDetailAzbjEntity e5 = ConvertUtils.sourceToTarget(specialData, LingshanSpecialCrowdDetailAzbjEntity.class); + setCommonFields(e5, customerId, orgIdPath, now, staffId); + saveBatch(Arrays.asList(e5), e5); + break; + } + + } + + void setCommonFields(LingshanSpecialCrowdDetailBaseEntity e, String customerId, String orgIdPath, Date now, String staffId) { + e.setCustomerId(customerId); + e.setOrgIdPath(orgIdPath); + e.setId(IdWorker.getIdStr()); + e.setRevision(0); + e.setCreatedTime(now); + e.setUpdatedTime(now); + e.setCreatedBy(staffId); + e.setUpdatedBy(staffId); + e.setDelFlag("0"); + } + + @Override + public LingShanSpecialCrowdDetailBaseExcelData getPersonSpecialTypeDetail(String idCard, String specialType, String specialDetailId) { + // 查询人员基础信息 + LambdaQueryWrapper personQ = new LambdaQueryWrapper<>(); + personQ.eq(LingshanSpecialCrowdPersonEntity::getIdCard, idCard); + LingshanSpecialCrowdPersonEntity person = specialCrowdPersonDao.selectOne(personQ); + + if (person == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "未找到该人员信息"); + } + + // 查询人员类别详情 + LingShanSpecialCrowdDetailBaseExcelData d; + switch (specialType) { + case "anzhibangjiao": + LingshanSpecialCrowdDetailAzbjEntity e1 = specialCrowdDetailAzbjDao.selectById(specialDetailId); + d = ConvertUtils.sourceToTarget(e1, LingShanSpecialCrowdDetailAzbjExcelData.class); + break; + case "xinfangrenyuan": + LingshanSpecialCrowdDetailXfryEntity e2 = specialCrowdDetailXfryDao.selectById(specialDetailId); + d = ConvertUtils.sourceToTarget(e2, LingshanSpecialCrowdDetailXfryExcelData.class); + break; + case "xidurenyuan": + LingshanSpecialCrowdDetailJdryEntity e3 = specialCrowdDetailJdryDao.selectById(specialDetailId); + d = ConvertUtils.sourceToTarget(e3, LingshanSpecialCrowdDetailJdryExcelData.class); + break; + case "shequjiaozheng": + LingshanSpecialCrowdDetailSqjzEntity e4 = specialCrowdDetailSqjzDao.selectById(specialDetailId); + d = ConvertUtils.sourceToTarget(e4, LingshanSpecialCrowdDetailSqjzExcelData.class); + break; + case "jingzhanghuanzhe": + LingshanSpecialCrowdDetailJzhzEntity e5 = specialCrowdDetailJzhzDao.selectById(specialDetailId); + d = ConvertUtils.sourceToTarget(e5, LingshanSpecialCrowdDetailJzhzExcelData.class); + break; + default: + d = new LingShanSpecialCrowdDetailBaseExcelData(); + } + + if (d == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "未找到该人员的类别详细信息"); + } + + d.setName(person.getName()); + + // 查询居民信息 + IcResiUserEntity resiBaseEntity = icResiUserDao.selectResiUserEntityByIdCard(idCard, EpmetRequestHolder.getLoginUserCustomerId()); + if (resiBaseEntity == null) { + throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, "未找到该人员信息"); + } + + // 户籍地 + d.setDomicilePlace(resiBaseEntity.getHjszd()); + + // 住址 + d.setAddress(getAddressOfResi(resiBaseEntity.getGridId(), resiBaseEntity.getHomeId())); + + // 生日 + d.setBirthday(resiBaseEntity.getBirthday()); + + // 性别 + String gender = resiBaseEntity.getGender(); + String genderStr; + if (gender == null) { + genderStr = "保密"; + } else if (gender.equals("0")) { + genderStr = "男"; + } else if (gender.equals("1")) { + genderStr = "女"; + } else { + genderStr = "未知"; + } + d.setGender(resiBaseEntity.getGender()); + d.setGenderZh(genderStr); + d.setMobile(resiBaseEntity.getMobile()); + + // 民族 + AtomicReference nationZh = new AtomicReference(); + List nationDict = getResultDataOrReturnNull(adminOpenFeignClient.getNationOption(), ServiceConstant.EPMET_ADMIN_SERVER); + if (CollectionUtils.isNotEmpty(nationDict)) { + nationDict.stream().forEach(n -> { + if (n.getValue().equals(resiBaseEntity.getMz())) { + nationZh.set(n.getLabel()); + } + }); + } + + d.setNation(nationZh.get()); + return d; + } + + private String getAddressOfResi(String gridId, String homeId) { + + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(gridId); + String allParentName = gridInfo.getAllParentName(); + String gridNamePath = gridInfo.getGridNamePath(); + + // IcNeighborHoodDTO nei = getResultDataOrReturnNull(govOrgOpenFeignClient.getIcNeighbordhoodById(villageId), ServiceConstant.GOV_ORG_SERVER); + // IcBuildingDTO buildingDTO = getResultDataOrReturnNull(govOrgOpenFeignClient.getBuildingById(buildId), ServiceConstant.GOV_ORG_SERVER); + // IcBuildingUnitDTO unit = getResultDataOrReturnNull(govOrgOpenFeignClient.getUnitById(unitId), ServiceConstant.GOV_ORG_SERVER); + HouseAgencyInfoResultDTO houseInfo = getResultDataOrReturnNull(govOrgOpenFeignClient.getHouseAgencyInfo(homeId), ServiceConstant.GOV_ORG_SERVER); + return String.format("%s-%s-%s", allParentName, gridNamePath, houseInfo.getFullName()); + } + + @Override + public PageData listSpecialCrowds(String orgId, String orgType, String specialType, String name, String mobile, + String idCard, Integer pageNo, Integer pageSize) { + String customerId = EpmetRequestHolder.getLoginUserCustomerId(); + + String orgIdPath = null; + if (StringUtils.isNotBlank(orgId)) { + orgIdPath = CustomerOrgRedis.getOrgIdPath(orgId, orgType); + } + PageHelper.startPage(pageNo, pageSize); + List l = specialCrowdPersonTypeDao.listSpecialCrowds(orgIdPath, orgType, specialType, name, mobile, idCard); + l.forEach(i -> { + IcResiUserDTO resi = icResiUserDao.getResiUserByIdCard(i.getIdCard(), customerId); + GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(resi.getGridId()); + i.setOrgNamePath(gridInfo.getAgencyName().concat("-").concat(gridInfo.getGridName())); + i.setAddress(getAddressOfResi(resi.getGridId(), resi.getHomeId())); + i.setSpecialTypeDisplay(LingShanSpecialCrowdTypeEnums.getByType(i.getSpecialType()).getName()); + }); + return new PageData<>(l, new PageInfo<>(l).getTotal()); + } } diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonTypeDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonTypeDao.xml index 1fc8a8b92b..ecf6ea72c3 100644 --- a/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonTypeDao.xml +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonTypeDao.xml @@ -32,5 +32,39 @@ , UPDATED_TIME = values(UPDATED_TIME) + + \ No newline at end of file