Browse Source

Merge branch 'lingshan_master' into dev

master
wxz 2 years ago
parent
commit
d36d9869a2
  1. 25
      epmet-user/epmet-user-client/src/main/java/com/epmet/dto/result/LingShanSpecialCrowdListResultDTO.java
  2. 15
      epmet-user/epmet-user-client/src/main/java/com/epmet/enums/LingShanSpecialCrowdTypeEnums.java
  3. 166
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java
  4. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailAzbjDao.java
  5. 1
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailJdryDao.java
  6. 1
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailJzhzDao.java
  7. 1
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailSqjzDao.java
  8. 1
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailXfryDao.java
  9. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonDao.java
  10. 11
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonTypeDao.java
  11. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailBaseExcelData.java
  12. 32
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/data/LingShanSpecialCrowdDetailResultExtraInfo.java
  13. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/AbstractLingShanSpecialCrowdExcelImportListener.java
  14. 38
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/LingShanSpecialCrowdService.java
  15. 271
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanSpecialCrowdServiceImpl.java
  16. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_anzhibangjiao_import.xlsx
  17. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_jingzhanghuanzhe_import.xlsx
  18. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_shequjiaozheng_import.xlsx
  19. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_xidurenyuan_import.xlsx
  20. BIN
      epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_xinfangrenyuan_import.xlsx
  21. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailAzbjDao.xml
  22. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailJdryDao.xml
  23. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailJzhzDao.xml
  24. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailSqjzDao.xml
  25. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdDetailXfryDao.xml
  26. 3
      epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonDao.xml
  27. 38
      epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonTypeDao.xml

25
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")
private Date createdTime;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date updatedTime;
}

15
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;
}
}

166
epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java

@ -1,25 +1,36 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.MaskResponse;
import com.epmet.commons.tools.exception.EpmetErrorCode;
import com.epmet.commons.tools.exception.EpmetException;
import com.epmet.commons.tools.exception.ValidateException;
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.enums.LingShanSpecialCrowdTypeEnums;
import com.epmet.excel.data.*;
import com.epmet.service.LingShanSpecialCrowdService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.io.IOUtils;
import org.apache.commons.lang3.StringUtils;
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 javax.servlet.ServletOutputStream;
import javax.servlet.http.HttpServletResponse;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.net.URLEncoder;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* @description: 灵山社会维稳特殊人群
@ -36,6 +47,41 @@ public class LingShanSpecialCrowdController {
@Autowired
private LingShanSpecialCrowdService lingShanSpecialCrowdService;
/**
* @description: 下载导入模板
* @param specialType:
* @return
* @author: WangXianZhang
* @date: 2023/4/21 10:16 AM
*/
@GetMapping("downloadTemplate")
public void downloadTemplate(@RequestParam("specialType") String specialType, HttpServletResponse response) {
InputStream is = null;
LingShanSpecialCrowdTypeEnums st = LingShanSpecialCrowdTypeEnums.getByType(specialType);
if (st == null) {
log.error("【灵山街道-下载特殊人群导入模板】传入的特殊人群类型错误:{}", specialType);
return;
}
try (ServletOutputStream os = response.getOutputStream()) {
is = this.getClass().getClassLoader().getResourceAsStream("excel/lingshan/special_crowd_" + specialType + "_import.xlsx");
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(st.getName(), "UTF-8"));
IOUtils.copy(is, os);
} catch (IOException e) {
throw new RuntimeException(e);
} finally {
org.apache.poi.util.IOUtils.closeQuietly(is);
}
}
/**
* @description: 特殊人群导入
* @param file:
@ -94,5 +140,117 @@ public class LingShanSpecialCrowdController {
}
}
/**
* @description: 安置帮教新增
* @param azbjData:
* @return
* @author: WangXianZhang
* @date: 2023/4/20 2:50 PM
*/
@PostMapping("anzhibangjiao/save")
public Result saveSpecialCrowd(@RequestBody LingShanSpecialCrowdDetailAzbjExcelData azbjData) {
ValidatorUtils.validateEntity(azbjData);
lingShanSpecialCrowdService.createSpecialCrowd(azbjData, "anzhibangjiao");
return new Result();
}
@PostMapping("xidurenyuan/save")
public Result saveSpecialCrowd(@RequestBody LingshanSpecialCrowdDetailJdryExcelData jdryData) {
ValidatorUtils.validateEntity(jdryData);
lingShanSpecialCrowdService.createSpecialCrowd(jdryData, "xidurenyuan");
return new Result();
}
@PostMapping("jingzhanhuanzhe/save")
public Result saveSpecialCrowd(@RequestBody LingshanSpecialCrowdDetailJzhzExcelData jzhzData) {
ValidatorUtils.validateEntity(jzhzData);
lingShanSpecialCrowdService.createSpecialCrowd(jzhzData, "jingzhanhuanzhe");
return new Result();
}
@PostMapping("shequjiaozheng/save")
public Result saveSpecialCrowd(@RequestBody LingshanSpecialCrowdDetailSqjzExcelData sqjzData) {
ValidatorUtils.validateEntity(sqjzData);
lingShanSpecialCrowdService.createSpecialCrowd(sqjzData, "shequjiaozheng");
return new Result();
}
@PostMapping("xinfangrenyuan/save")
public Result saveSpecialCrowd(@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<LingShanSpecialCrowdDetailBaseExcelData> getPersonSpecialTypeDetail(@RequestParam("idCard") String idCard,
@RequestParam("specialType") String specialType,
@RequestParam("specialDetailId") String specialDetailId) {
LingShanSpecialCrowdDetailBaseExcelData r = lingShanSpecialCrowdService.getPersonSpecialTypeDetail(idCard, specialType, specialDetailId);
return new Result<LingShanSpecialCrowdDetailBaseExcelData>().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")
@MaskResponse(fieldNames = {"name", "mobile", "idCard"},
fieldsMaskType = { MaskResponse.MASK_TYPE_CHINESE_NAME, MaskResponse.MASK_TYPE_MOBILE, MaskResponse.MASK_TYPE_ID_CARD })
public Result<PageData<LingShanSpecialCrowdListResultDTO>> 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<LingShanSpecialCrowdListResultDTO> pd = lingShanSpecialCrowdService.listSpecialCrowds(orgId, orgType, specialType, name, mobile,
idCard, pageNo, pageSize);
return new Result<PageData<LingShanSpecialCrowdListResultDTO>>().ok(pd);
}
/**
* @description: 删除
* @param params:
* @return
* @author: WangXianZhang
* @date: 2023/4/21 9:40 AM
*/
@PostMapping("deleteByType")
public Result deleteByType(@RequestBody Map<String, String> params) {
String specialType = params.get("specialType");
String idCard = params.get("idCard");
if (StringUtils.isAnyBlank(specialType, idCard)) {
throw new ValidateException("特殊人群类型或身份证不能为空");
}
lingShanSpecialCrowdService.deleteByType(specialType, idCard);
return new Result();
}
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailAzbjDao.java

@ -17,4 +17,6 @@ import java.util.List;
public interface LingshanSpecialCrowdDetailAzbjDao extends BaseDao<LingshanSpecialCrowdDetailAzbjEntity> {
void saveBatchManually(@Param("asbjList") List<LingshanSpecialCrowdDetailAzbjEntity> l);
void deletePhysical(@Param("idCard") String idCard);
}

1
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailJdryDao.java

@ -17,4 +17,5 @@ import java.util.List;
public interface LingshanSpecialCrowdDetailJdryDao extends BaseDao<LingshanSpecialCrowdDetailJdryEntity> {
void saveBatchManually(@Param("list") List<LingshanSpecialCrowdDetailJdryEntity> l);
void deletePhysical(@Param("idCard") String idCard);
}

1
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailJzhzDao.java

@ -17,4 +17,5 @@ import java.util.List;
public interface LingshanSpecialCrowdDetailJzhzDao extends BaseDao<LingshanSpecialCrowdDetailJzhzEntity> {
void saveBatchManually(@Param("list") List<LingshanSpecialCrowdDetailJzhzEntity> l);
void deletePhysical(@Param("idCard") String idCard);
}

1
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailSqjzDao.java

@ -17,4 +17,5 @@ import java.util.List;
public interface LingshanSpecialCrowdDetailSqjzDao extends BaseDao<LingshanSpecialCrowdDetailSqjzEntity> {
void saveBatchManually(@Param("list") List<LingshanSpecialCrowdDetailSqjzEntity> l);
void deletePhysical(@Param("idCard") String idCard);
}

1
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdDetailXfryDao.java

@ -17,4 +17,5 @@ import java.util.List;
public interface LingshanSpecialCrowdDetailXfryDao extends BaseDao<LingshanSpecialCrowdDetailXfryEntity> {
void saveBatchManually(@Param("list") List<LingshanSpecialCrowdDetailXfryEntity> l);
void deletePhysical(@Param("idCard") String idCard);
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonDao.java

@ -18,4 +18,6 @@ import java.util.List;
public interface LingshanSpecialCrowdPersonDao extends BaseDao<LingshanSpecialCrowdPersonEntity> {
void saveOrUpdateManually(@Param("list") List<LingshanSpecialCrowdPersonEntity> list);
void deletePhysical(@Param("idCard") String idCard);
}

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

@ -1,6 +1,8 @@
package com.epmet.dao;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
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 +19,13 @@ import java.util.List;
public interface LingshanSpecialCrowdPersonTypeDao extends BaseDao<LingshanSpecialCrowdPersonTypeEntity> {
void saveOrUpdateManually(@Param("types") List<LingshanSpecialCrowdPersonTypeEntity> types);
List<LingShanSpecialCrowdListResultDTO> 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);
void deletePhysical(@Param("specialType") String specialType, @Param("idCard") String idCard);
}

2
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 {
/**
* 姓名
*/

32
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;
}

2
epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/AbstractLingShanSpecialCrowdExcelImportListener.java

@ -250,7 +250,7 @@ public abstract class AbstractLingShanSpecialCrowdExcelImportListener<T extends
* @date: 2023/4/18 3:42 PM
*/
protected void saveBatch() {
String orgIdPath = PidUtils.convertPid2OrgIdPath(currentStaffInfo.getFromOrgId(), currentStaffInfo.getAgencyPIds());
String orgIdPath = PidUtils.convertPid2OrgIdPath(currentStaffInfo.getAgencyId(), currentStaffInfo.getAgencyPIds());
String customerId = EpmetRequestHolder.getLoginUserCustomerId();
Date now = new Date();
Iterator<T> it = getOriginDatas().iterator();

38
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,40 @@ public interface LingShanSpecialCrowdService {
void saveBatch(List<LingshanSpecialCrowdDetailJzhzEntity> entities, LingshanSpecialCrowdDetailJzhzEntity e);
void saveBatch(List<LingshanSpecialCrowdDetailSqjzEntity> entities, LingshanSpecialCrowdDetailSqjzEntity e);
void saveBatch(List<LingshanSpecialCrowdDetailXfryEntity> 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<LingShanSpecialCrowdListResultDTO> listSpecialCrowds(String orgId, String orgType, String specialType, String name, String mobile,
String idCard, Integer pageNo, Integer pageSize);
void deleteByType(String specialType, String idCard);
}

271
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanSpecialCrowdServiceImpl.java

@ -2,53 +2,70 @@ 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 com.github.pagehelper.dialect.helper.SqlServer2012Dialect;
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.transaction.annotation.Transactional;
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 +104,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<? extends LingShanSpecialCrowdDetailBaseExcelData> excelDataClass;
@ -229,7 +251,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 +309,229 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ
specialCrowdDetailXfryDao.saveBatchManually(l);
}
}
@Override
public void createSpecialCrowd(LingShanSpecialCrowdDetailBaseExcelData specialData, String specialType) {
// 检查
String validateRst = validate(specialData);
if (StringUtils.isNotBlank(validateRst)) {
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), null, validateRst);
}
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();
// 保存人员和类型信息
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<LingshanSpecialCrowdPersonEntity> 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<String> nationZh = new AtomicReference();
List<OptionResultDTO> 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<LingShanSpecialCrowdListResultDTO> 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<LingShanSpecialCrowdListResultDTO> 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());
}
@Transactional
@Override
public void deleteByType(String specialType, String idCard) {
// 先删除type
specialCrowdPersonTypeDao.deletePhysical(specialType, idCard);
// 再删除detail
switch (specialType) {
case "anzhibangjiao":
specialCrowdDetailAzbjDao.deletePhysical(idCard);
break;
case "xinfangrenyuan":
specialCrowdDetailXfryDao.deletePhysical(idCard);
break;
case "xidurenyuan":
specialCrowdDetailJdryDao.deletePhysical(idCard);
break;
case "shequjiaozheng":
specialCrowdDetailSqjzDao.deletePhysical(idCard);
break;
case "jingzhanghuanzhe":
specialCrowdDetailJzhzDao.deletePhysical(idCard);
break;
}
LambdaQueryWrapper<LingshanSpecialCrowdPersonTypeEntity> q = new LambdaQueryWrapper<>();
q.eq(LingshanSpecialCrowdPersonTypeEntity::getIdCard, idCard);
if (specialCrowdPersonTypeDao.selectCount(q) == 0) {
// 没有type了,那就吧person也删了
specialCrowdPersonDao.deletePhysical(idCard);
}
}
}

BIN
epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_anzhibangjiao_import.xlsx

Binary file not shown.

BIN
epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_jingzhanghuanzhe_import.xlsx

Binary file not shown.

BIN
epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_shequjiaozheng_import.xlsx

Binary file not shown.

BIN
epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_xidurenyuan_import.xlsx

Binary file not shown.

BIN
epmet-user/epmet-user-server/src/main/resources/excel/lingshan/special_crowd_xinfangrenyuan_import.xlsx

Binary file not shown.

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

@ -52,6 +52,9 @@
, UPDATED_BY = values(UPDATED_BY)
, UPDATED_TIME = values(UPDATED_TIME)
</update>
<delete id="deletePhysical">
delete from lingshan_special_crowd_detail_azbj where ID_CARD=#{idCard}
</delete>
</mapper>

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

@ -31,6 +31,9 @@
UPDATED_BY = values(UPDATED_BY),
UPDATED_TIME = values(UPDATED_TIME)
</insert>
<delete id="deletePhysical">
delete from lingshan_special_crowd_detail_jdry where ID_CARD=#{idCard}
</delete>
</mapper>

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

@ -56,6 +56,9 @@
, UPDATED_TIME = values(UPDATED_TIME)
</insert>
<delete id="deletePhysical">
delete from lingshan_special_crowd_detail_jzhz where ID_CARD=#{idCard}
</delete>
</mapper>

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

@ -54,6 +54,9 @@
, UPDATED_BY = values(UPDATED_BY)
, UPDATED_TIME = values(UPDATED_TIME)
</insert>
<delete id="deletePhysical">
delete from lingshan_special_crowd_detail_sqjz where ID_CARD=#{idCard}
</delete>
</mapper>

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

@ -55,6 +55,9 @@
, UPDATED_BY = values(UPDATED_BY)
, UPDATED_TIME = values(UPDATED_TIME)
</insert>
<delete id="deletePhysical">
delete from lingshan_special_crowd_detail_xfry where ID_CARD=#{idCard}
</delete>
</mapper>

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

@ -40,6 +40,9 @@
, UPDATED_BY=values(UPDATED_BY)
, UPDATED_TIME=values(UPDATED_TIME)
</insert>
<delete id="deletePhysical">
delete from lingshan_special_crowd_person where ID_CARD = #{idCard}
</delete>
</mapper>

38
epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonTypeDao.xml

@ -31,6 +31,44 @@
, UPDATED_BY =values(UPDATED_BY)
, UPDATED_TIME = values(UPDATED_TIME)
</insert>
<delete id="deletePhysical">
delete from lingshan_special_crowd_person_type where ID_CARD = #{idCard} and SPECIAL_TYPE = #{specialType}
</delete>
<select id="listSpecialCrowds"
resultType="com.epmet.dto.result.LingShanSpecialCrowdListResultDTO">
select t.ORG_ID_PATH
, t.SPECIAL_TYPE
, p.NAME
, r.MOBILE
, t.ID_CARD
, r.HOME_ID
, t.CREATED_TIME
, t.UPDATED_TIME
from lingshan_special_crowd_person p
inner join lingshan_special_crowd_person_type t
on (t.DEL_FLAG = 0 and p.ID_CARD = t.ID_CARD)
inner join ic_resi_user r on (r.ID_CARD = t.ID_CARD and r.DEL_FLAG = 0)
<where>
p.DEL_FLAG=0
<if test="name != null and name != ''">
and p.NAME like CONCAT('%', #{name}, '%')
</if>
<if test="specialType != null and specialType != ''">
and t.SPECIAL_TYPE = #{specialType}
</if>
<if test="idCard != null and idCard != ''">
and t.ID_CARD like CONCAT('%', #{idCard}, '%')
</if>
<if test="orgIdPath != null and orgIdPath != ''">
and t.ORG_ID_PATH like CONCAT(#{orgIdPath}, '%')
</if>
<if test="mobile != null and mobile != ''">
and r.MOBILE like CONCAT('%', mobile, '%')
</if>
</where>
order by t.UPDATED_TIME desc
</select>
</mapper>
Loading…
Cancel
Save