Browse Source

1.修改:特殊人群跟居民信息里的特殊人群挂钩。2:修复:下载的时候下载的xls而不是xlsx

master
wxz 2 years ago
parent
commit
128f20c00e
  1. 15
      epmet-user/epmet-user-server/src/main/java/com/epmet/bean/PersonSpecialTypeBean.java
  2. 7
      epmet-user/epmet-user-server/src/main/java/com/epmet/controller/LingShanSpecialCrowdController.java
  3. 22
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcSpecialDao.java
  4. 31
      epmet-user/epmet-user-server/src/main/java/com/epmet/dao/LingshanSpecialCrowdPersonTypeDao.java
  5. 3
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcSpecialEntity.java
  6. 69
      epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdPersonTypeEntity.java
  7. 22
      epmet-user/epmet-user-server/src/main/java/com/epmet/excel/handler/AbstractLingShanSpecialCrowdExcelImportListener.java
  8. 6
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/LingShanSpecialCrowdService.java
  9. 92
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/LingShanSpecialCrowdServiceImpl.java
  10. 40
      epmet-user/epmet-user-server/src/main/resources/mapper/IcSpecialDao.xml
  11. 80
      epmet-user/epmet-user-server/src/main/resources/mapper/LingshanSpecialCrowdPersonTypeDao.xml

15
epmet-user/epmet-user-server/src/main/java/com/epmet/bean/PersonSpecialTypeBean.java

@ -0,0 +1,15 @@
package com.epmet.bean;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@AllArgsConstructor
@NoArgsConstructor
public class PersonSpecialTypeBean {
private String resiId;
private String idCard;
private String specialType;
}

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

@ -70,7 +70,8 @@ public class LingShanSpecialCrowdController {
is = this.getClass().getClassLoader().getResourceAsStream("excel/lingshan/special_crowd_" + specialType + "_import.xlsx"); is = this.getClass().getClassLoader().getResourceAsStream("excel/lingshan/special_crowd_" + specialType + "_import.xlsx");
response.setHeader("Access-Control-Expose-Headers", "Content-Disposition"); response.setHeader("Access-Control-Expose-Headers", "Content-Disposition");
response.setHeader("content-Type", "application/vnd.ms-excel"); response.setHeader("content-Type", "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
// response.setHeader("content-Type", "application/vnd.ms-excel");
response.setHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(st.getName(), "UTF-8")); response.setHeader("Content-Disposition", "attachment;fileName=" + URLEncoder.encode(st.getName(), "UTF-8"));
IOUtils.copy(is, os); IOUtils.copy(is, os);
@ -249,7 +250,7 @@ public class LingShanSpecialCrowdController {
* @author: WangXianZhang * @author: WangXianZhang
* @date: 2023/4/21 9:40 AM * @date: 2023/4/21 9:40 AM
*/ */
@PostMapping("deleteByType") @PostMapping("deleteByResi")
public Result deleteByType(@RequestBody Map<String, String> params) { public Result deleteByType(@RequestBody Map<String, String> params) {
String resiId = params.get("resiId"); String resiId = params.get("resiId");
@ -257,7 +258,7 @@ public class LingShanSpecialCrowdController {
throw new ValidateException("特殊人群类型或身份证不能为空"); throw new ValidateException("特殊人群类型或身份证不能为空");
} }
lingShanSpecialCrowdService.deleteByType(resiId); lingShanSpecialCrowdService.deleteByResi(resiId);
return new Result(); return new Result();
} }

22
epmet-user/epmet-user-server/src/main/java/com/epmet/dao/IcSpecialDao.java

@ -0,0 +1,22 @@
package com.epmet.dao;
import com.epmet.commons.mybatis.dao.BaseDao;
import com.epmet.dto.result.LingShanSpecialCrowdListResultDTO;
import com.epmet.entity.IcSpecialEntity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@Mapper
public interface IcSpecialDao extends BaseDao<IcSpecialEntity> {
public IcSpecialEntity selectByResiId(@Param("resiId") String resiId);
List<LingShanSpecialCrowdListResultDTO> listSpecialCrowd(@Param("orgIdPath") String orgIdPath,
@Param("agencyId") String agencyId,
@Param("specialType") String specialType,
@Param("name") String name,
@Param("mobile") String mobile,
@Param("idCard") String idCard);
}

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

@ -1,31 +0,0 @@
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;
import java.util.List;
/**
* 灵山-特殊人群-人员具有的特殊人群类型信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-04-18
*/
@Mapper
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("resiId") String resiId);
}

3
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/IcSpecialEntity.java

@ -17,7 +17,7 @@
package com.epmet.entity; package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName; import com.baomidou.mybatisplus.annotation.*;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity; import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.Data; import lombok.Data;
import lombok.EqualsAndHashCode; import lombok.EqualsAndHashCode;
@ -38,6 +38,7 @@ public class IcSpecialEntity extends BaseEpmetEntity {
/** /**
* 客户Id customer.id * 客户Id customer.id
*/ */
@TableField(fill = FieldFill.INSERT)
private String customerId; private String customerId;
/** /**

69
epmet-user/epmet-user-server/src/main/java/com/epmet/entity/LingshanSpecialCrowdPersonTypeEntity.java

@ -1,69 +0,0 @@
package com.epmet.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.epmet.commons.mybatis.entity.BaseEpmetEntity;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
/**
* 灵山-特殊人群-人员具有的特殊人群类型信息
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2023-04-18
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("lingshan_special_crowd_person_type")
public class LingshanSpecialCrowdPersonTypeEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户Id
*/
private String customerId;
/**
* org id路径:分割
*/
private String orgIdPath;
/**
* @description: 居民ID
* @param null:
* @return
* @author: WangXianZhang
* @date: 2023/4/23 10:26 AM
*/
private String resiId;
/**
* 证件号
*/
private String idCard;
/**
* 特殊人群类别
*/
private String specialType;
public LingshanSpecialCrowdPersonTypeEntity(String id, String customerId, String orgIdPath, String resiId, String idCard, String specialType, String delFlag,
Integer revision, Date createdTime, String createdBy, Date updatedTime, String updatedBy) {
this.resiId = resiId;
this.customerId = customerId;
this.orgIdPath = orgIdPath;
this.idCard = idCard;
this.specialType = specialType;
this.setDelFlag(delFlag);
this.setCreatedBy(createdBy);
this.setCreatedTime(createdTime);
this.setUpdatedBy(updatedBy);
this.setUpdatedTime(updatedTime);
this.setRevision(revision);
this.setId(id);
}
}

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

@ -3,6 +3,7 @@ package com.epmet.excel.handler;
import com.alibaba.excel.context.AnalysisContext; import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener; import com.alibaba.excel.event.AnalysisEventListener;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.epmet.bean.PersonSpecialTypeBean;
import com.epmet.commons.tools.distributedlock.DistributedLock; import com.epmet.commons.tools.distributedlock.DistributedLock;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.exception.EpmetErrorCode; import com.epmet.commons.tools.exception.EpmetErrorCode;
@ -15,7 +16,6 @@ import com.epmet.commons.tools.utils.PidUtils;
import com.epmet.commons.tools.utils.SpringContextUtils; import com.epmet.commons.tools.utils.SpringContextUtils;
import com.epmet.commons.tools.validator.ValidatorUtils; import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.entity.LingshanSpecialCrowdDetailBaseEntity; import com.epmet.entity.LingshanSpecialCrowdDetailBaseEntity;
import com.epmet.entity.LingshanSpecialCrowdPersonTypeEntity;
import com.epmet.enums.LingShanSpecialCrowdTypeEnums; import com.epmet.enums.LingShanSpecialCrowdTypeEnums;
import com.epmet.excel.data.LingShanSpecialCrowdDetailBaseExcelData; import com.epmet.excel.data.LingShanSpecialCrowdDetailBaseExcelData;
import com.epmet.exceptions.ReadExcelHeaderOnlyException; import com.epmet.exceptions.ReadExcelHeaderOnlyException;
@ -96,7 +96,8 @@ public abstract class AbstractLingShanSpecialCrowdExcelImportListener<T extends
// 为什么去掉了?因为需求改成了:直接用type根居民基础信息关联 // 为什么去掉了?因为需求改成了:直接用type根居民基础信息关联
// private List<LingshanSpecialCrowdPersonEntity> persons = new ArrayList<>(); // private List<LingshanSpecialCrowdPersonEntity> persons = new ArrayList<>();
private List<LingshanSpecialCrowdPersonTypeEntity> personTypes = new ArrayList<>(); // private List<LingshanSpecialCrowdPersonTypeEntity> personTypes = new ArrayList<>();
private List<PersonSpecialTypeBean> specialTypes = new ArrayList<>();
protected LingShanSpecialCrowdService lingShanSpecialCrowdService; protected LingShanSpecialCrowdService lingShanSpecialCrowdService;
@ -255,10 +256,7 @@ public abstract class AbstractLingShanSpecialCrowdExcelImportListener<T extends
errorDatas.add(row); errorDatas.add(row);
it.remove(); it.remove();
} else { } else {
// persons.add(new LingshanSpecialCrowdPersonEntity(IdWorker.getIdStr(), customerId, orgIdPath, row.getName(), row.getIdCard(), specialTypes.add(new PersonSpecialTypeBean(row.getResiId(), row.getIdCard(), specialCrowdType.getType()));
// "0", 0, now, currentStaffInfo.getStaffId(), now, currentStaffInfo.getStaffId()));
personTypes.add(new LingshanSpecialCrowdPersonTypeEntity(IdWorker.getIdStr(), customerId, orgIdPath, row.getResiId(), row.getIdCard(), specialCrowdType.getType(),
"0", 0, now, currentStaffInfo.getStaffId(), now, currentStaffInfo.getStaffId()));
E e = ConvertUtils.sourceToTarget(row, entityClass); E e = ConvertUtils.sourceToTarget(row, entityClass);
e.setCustomerId(customerId); e.setCustomerId(customerId);
@ -276,10 +274,8 @@ public abstract class AbstractLingShanSpecialCrowdExcelImportListener<T extends
} }
// 执行保存 // 执行保存
if( if(!CollectionUtils.isEmpty(specialTypes)) {
// !CollectionUtils.isEmpty(persons) && savePersonAndTypes(specialTypes);
!CollectionUtils.isEmpty(personTypes)) {
savePersonAndTypes(personTypes);
} }
// 将错误的数据处理 todo // 将错误的数据处理 todo
@ -295,7 +291,7 @@ public abstract class AbstractLingShanSpecialCrowdExcelImportListener<T extends
* @author: WangXianZhang * @author: WangXianZhang
* @date: 2023/4/19 11:06 AM * @date: 2023/4/19 11:06 AM
*/ */
private void savePersonAndTypes(List<LingshanSpecialCrowdPersonTypeEntity> personTypes) { private void savePersonAndTypes(List<PersonSpecialTypeBean> personTypes) {
lingShanSpecialCrowdService.savePersonAndTypes(personTypes); lingShanSpecialCrowdService.savePersonAndTypes(personTypes);
} }
@ -404,4 +400,8 @@ public abstract class AbstractLingShanSpecialCrowdExcelImportListener<T extends
*/ */
abstract LingShanSpecialCrowdTypeEnums getSpecialCrowdType(); abstract LingShanSpecialCrowdTypeEnums getSpecialCrowdType();
/**
* 人员类别信息bean用于导入临时存储数据
*/
} }

6
epmet-user/epmet-user-server/src/main/java/com/epmet/service/LingShanSpecialCrowdService.java

@ -1,5 +1,6 @@
package com.epmet.service; package com.epmet.service;
import com.epmet.bean.PersonSpecialTypeBean;
import com.epmet.commons.tools.page.PageData; import com.epmet.commons.tools.page.PageData;
import com.epmet.dto.form.lingshan.LingShanSpecialTypeSaveFormDTO; import com.epmet.dto.form.lingshan.LingShanSpecialTypeSaveFormDTO;
import com.epmet.dto.form.lingshan.LingShanSpecialTypeSaveResultDTO; import com.epmet.dto.form.lingshan.LingShanSpecialTypeSaveResultDTO;
@ -7,6 +8,7 @@ import com.epmet.dto.result.LingShanSpecialCrowdListResultDTO;
import com.epmet.entity.*; import com.epmet.entity.*;
import com.epmet.excel.data.LingShanSpecialCrowdDetailAzbjExcelData; import com.epmet.excel.data.LingShanSpecialCrowdDetailAzbjExcelData;
import com.epmet.excel.data.LingShanSpecialCrowdDetailBaseExcelData; import com.epmet.excel.data.LingShanSpecialCrowdDetailBaseExcelData;
import com.epmet.excel.handler.AbstractLingShanSpecialCrowdExcelImportListener;
import org.apache.poi.ss.formula.functions.T; import org.apache.poi.ss.formula.functions.T;
import java.util.List; import java.util.List;
@ -35,7 +37,7 @@ public interface LingShanSpecialCrowdService {
*/ */
String validate(LingShanSpecialCrowdDetailBaseExcelData row); String validate(LingShanSpecialCrowdDetailBaseExcelData row);
void savePersonAndTypes(List<LingshanSpecialCrowdPersonTypeEntity> personTypes); void savePersonAndTypes(List<PersonSpecialTypeBean> personTypes);
/** /**
* @description: 安置帮教-导入 * @description: 安置帮教-导入
@ -82,7 +84,7 @@ public interface LingShanSpecialCrowdService {
PageData<LingShanSpecialCrowdListResultDTO> listSpecialCrowds(String orgId, String orgType, String specialType, String name, String mobile, PageData<LingShanSpecialCrowdListResultDTO> listSpecialCrowds(String orgId, String orgType, String specialType, String name, String mobile,
String idCard, Integer pageNo, Integer pageSize); String idCard, Integer pageNo, Integer pageSize);
void deleteByType(String resiId); void deleteByResi(String resiId);
/** /**
* @description: 保存或修改 * @description: 保存或修改

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

@ -5,6 +5,7 @@ import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet; import com.alibaba.excel.write.metadata.WriteSheet;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.IdWorker; import com.baomidou.mybatisplus.core.toolkit.IdWorker;
import com.epmet.bean.PersonSpecialTypeBean;
import com.epmet.commons.tools.constant.ServiceConstant; import com.epmet.commons.tools.constant.ServiceConstant;
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult;
import com.epmet.commons.tools.dto.result.OptionResultDTO; import com.epmet.commons.tools.dto.result.OptionResultDTO;
@ -65,6 +66,7 @@ import java.util.*;
import java.util.concurrent.CompletableFuture; import java.util.concurrent.CompletableFuture;
import java.util.concurrent.ExecutorService; import java.util.concurrent.ExecutorService;
import java.util.concurrent.atomic.AtomicReference; import java.util.concurrent.atomic.AtomicReference;
import java.util.stream.Collectors;
/** /**
* 灵山特殊人群service * 灵山特殊人群service
@ -73,9 +75,6 @@ import java.util.concurrent.atomic.AtomicReference;
@Service @Service
public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdService, ResultDataResolver { public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdService, ResultDataResolver {
@Autowired
private LingshanSpecialCrowdPersonTypeDao specialCrowdPersonTypeDao;
@Autowired @Autowired
private LingshanSpecialCrowdDetailAzbjDao specialCrowdDetailAzbjDao; private LingshanSpecialCrowdDetailAzbjDao specialCrowdDetailAzbjDao;
@ -94,6 +93,9 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ
@Autowired @Autowired
private IcResiUserDao icResiUserDao; private IcResiUserDao icResiUserDao;
@Autowired
private IcSpecialDao icSpecialDao;
@Autowired @Autowired
private ExecutorService executorService; private ExecutorService executorService;
@ -257,17 +259,44 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ
} }
@Override @Override
public void savePersonAndTypes(List<LingshanSpecialCrowdPersonTypeEntity> personTypes) { public void savePersonAndTypes(List<PersonSpecialTypeBean> personTypes) {
// List<List<LingshanSpecialCrowdPersonEntity>> personParts = ListUtils.partition(persons, 50); HashMap<String, Set<String>> resiIdAndTypes = new HashMap<>();
List<List<LingshanSpecialCrowdPersonTypeEntity>> personTypeParts = ListUtils.partition(personTypes, 50);
// 将所有的人群类别信息,按照居民id归类为map
// for (List<LingshanSpecialCrowdPersonEntity> p : personParts) { for (PersonSpecialTypeBean type : personTypes) {
// specialCrowdPersonDao.saveOrUpdateManually(p); String resiId = type.getResiId();
// } Set<String> types = resiIdAndTypes.get(resiId);
for (List<LingshanSpecialCrowdPersonTypeEntity> p : personTypeParts) { if (CollectionUtils.isEmpty(types)) {
if (CollectionUtils.isNotEmpty(p)) { types = new HashSet<>();
specialCrowdPersonTypeDao.saveOrUpdateManually(p); resiIdAndTypes.put(resiId, types);
}
types.add(type.getSpecialType());
}
// 取出已有的人群类别,合并,转化为字符串,存入
for (Map.Entry<String, Set<String>> entry : resiIdAndTypes.entrySet()) {
String resiId = entry.getKey();
Set<String> typeSet = entry.getValue();
IcSpecialEntity specialTypeInDb = icSpecialDao.selectByResiId(resiId);
if (specialTypeInDb == null) {
//目前还不是特殊人群
specialTypeInDb = new IcSpecialEntity();
specialTypeInDb.setIcResiUser(resiId);
specialTypeInDb.setSpecialRqlb(String.join(",", typeSet));
icSpecialDao.insert(specialTypeInDb);
} else {
// 已经是特殊人群了,那么追加新类别
typeSet.addAll(new HashSet<>(Arrays.asList(specialTypeInDb.getSpecialRqlb().split(","))));
IcSpecialEntity icSpecialUpdate = new IcSpecialEntity();
icSpecialUpdate.setSpecialRqlb(String.join(",", typeSet));
icSpecialUpdate.setId(specialTypeInDb.getId());
icSpecialDao.updateById(icSpecialUpdate);
} }
// 设置居民的IS_SPECIAL字段为1
HashMap<String, String> updateMap = new HashMap<>();
updateMap.put("IS_SPECIAL", "1");
icResiUserDao.upTable("ic_resi_user", resiId, updateMap);
} }
} }
@ -396,7 +425,7 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ
Date now = new Date(); Date now = new Date();
ArrayList<LingshanSpecialCrowdPersonTypeEntity> types2Save = new ArrayList<>(); ArrayList<PersonSpecialTypeBean> types2Save = new ArrayList<>();
// 保存人群详情 // 保存人群详情
if (input.getSpecialCrowdDetails().getAnzhibangjiao() != null) { if (input.getSpecialCrowdDetails().getAnzhibangjiao() != null) {
@ -405,8 +434,7 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ
azbj.setIdCard(input.getIdCard()); azbj.setIdCard(input.getIdCard());
saveBatch(Arrays.asList(azbj), azbj); saveBatch(Arrays.asList(azbj), azbj);
LingshanSpecialCrowdPersonTypeEntity azbjE = new LingshanSpecialCrowdPersonTypeEntity(IdWorker.getIdStr(), customerId, orgIdPath, vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.AZBJ.getType(), PersonSpecialTypeBean azbjE = new PersonSpecialTypeBean(vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.AZBJ.getType());
"0", 0, now, staffId, now, staffId);
types2Save.add(azbjE); types2Save.add(azbjE);
} }
@ -416,9 +444,8 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ
jdry.setIdCard(input.getIdCard()); jdry.setIdCard(input.getIdCard());
saveBatch(Arrays.asList(jdry), jdry); saveBatch(Arrays.asList(jdry), jdry);
LingshanSpecialCrowdPersonTypeEntity JdryE = new LingshanSpecialCrowdPersonTypeEntity(IdWorker.getIdStr(), customerId, orgIdPath, vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.JDRY.getType(), PersonSpecialTypeBean jdryE = new PersonSpecialTypeBean(vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.JDRY.getType());
"0", 0, now, staffId, now, staffId); types2Save.add(jdryE);
types2Save.add(JdryE);
} }
if (input.getSpecialCrowdDetails().getJingzhanghuanzhe() != null) { if (input.getSpecialCrowdDetails().getJingzhanghuanzhe() != null) {
@ -427,8 +454,7 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ
jzhz.setIdCard(input.getIdCard()); jzhz.setIdCard(input.getIdCard());
saveBatch(Arrays.asList(jzhz), jzhz); saveBatch(Arrays.asList(jzhz), jzhz);
LingshanSpecialCrowdPersonTypeEntity jzhzE = new LingshanSpecialCrowdPersonTypeEntity(IdWorker.getIdStr(), customerId, orgIdPath, vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.JZHZ.getType(), PersonSpecialTypeBean jzhzE = new PersonSpecialTypeBean(vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.JZHZ.getType());
"0", 0, now, staffId, now, staffId);
types2Save.add(jzhzE); types2Save.add(jzhzE);
} }
@ -438,8 +464,7 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ
xfry.setIdCard(input.getIdCard()); xfry.setIdCard(input.getIdCard());
saveBatch(Arrays.asList(xfry), xfry); saveBatch(Arrays.asList(xfry), xfry);
LingshanSpecialCrowdPersonTypeEntity xfryE = new LingshanSpecialCrowdPersonTypeEntity(IdWorker.getIdStr(), customerId, orgIdPath, vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.XFRY.getType(), PersonSpecialTypeBean xfryE = new PersonSpecialTypeBean(vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.XFRY.getType());
"0", 0, now, staffId, now, staffId);
types2Save.add(xfryE); types2Save.add(xfryE);
} }
@ -449,8 +474,7 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ
sqjz.setIdCard(input.getIdCard()); sqjz.setIdCard(input.getIdCard());
saveBatch(Arrays.asList(sqjz), sqjz); saveBatch(Arrays.asList(sqjz), sqjz);
LingshanSpecialCrowdPersonTypeEntity sqjzE = new LingshanSpecialCrowdPersonTypeEntity(IdWorker.getIdStr(), customerId, orgIdPath, vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.SQJZ.getType(), PersonSpecialTypeBean sqjzE = new PersonSpecialTypeBean(vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.SQJZ.getType());
"0", 0, now, staffId, now, staffId);
types2Save.add(sqjzE); types2Save.add(sqjzE);
} }
@ -585,7 +609,8 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ
orgIdPath = CustomerOrgRedis.getOrgIdPath(orgId, orgType); orgIdPath = CustomerOrgRedis.getOrgIdPath(orgId, orgType);
} }
PageHelper.startPage(pageNo, pageSize); PageHelper.startPage(pageNo, pageSize);
List<LingShanSpecialCrowdListResultDTO> l = specialCrowdPersonTypeDao.listSpecialCrowds(orgIdPath, orgType, specialType, name, mobile, idCard); List<LingShanSpecialCrowdListResultDTO> l = icSpecialDao.listSpecialCrowd(orgIdPath, orgType, specialType, name, mobile, idCard);
// List<LingShanSpecialCrowdListResultDTO> l = specialCrowdPersonTypeDao.listSpecialCrowds(orgIdPath, orgType, specialType, name, mobile, idCard);
l.forEach(i -> { l.forEach(i -> {
IcResiUserDTO resi = icResiUserDao.getResiUserByIdCard(i.getIdCard(), customerId); IcResiUserDTO resi = icResiUserDao.getResiUserByIdCard(i.getIdCard(), customerId);
GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(resi.getGridId()); GridInfoCache gridInfo = CustomerOrgRedis.getGridInfo(resi.getGridId());
@ -608,13 +633,20 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ
@Transactional @Transactional
@Override @Override
public void deleteByType(String resiId) { public void deleteByResi(String resiId) {
// 先删除type // 1.先删除type
specialCrowdPersonTypeDao.deletePhysical(resiId); LambdaQueryWrapper<IcSpecialEntity> q = new LambdaQueryWrapper<>();
q.eq(IcSpecialEntity::getIcResiUser, resiId);
icSpecialDao.delete(q);
// 2.更新居民信息主表中的标记
IcResiUserEntity resiInfo = icResiUserDao.selectById(resiId); IcResiUserEntity resiInfo = icResiUserDao.selectById(resiId);
// 再删除detail HashMap<String, String> updateData = new HashMap<>();
updateData.put("IS_SPECIAL", null);
icResiUserDao.upTable("ic_resi_user", resiId, updateData);
// 3.再删除detail
specialCrowdDetailAzbjDao.deletePhysical(resiInfo.getIdCard()); specialCrowdDetailAzbjDao.deletePhysical(resiInfo.getIdCard());
specialCrowdDetailXfryDao.deletePhysical(resiInfo.getIdCard()); specialCrowdDetailXfryDao.deletePhysical(resiInfo.getIdCard());
specialCrowdDetailJdryDao.deletePhysical(resiInfo.getIdCard()); specialCrowdDetailJdryDao.deletePhysical(resiInfo.getIdCard());

40
epmet-user/epmet-user-server/src/main/resources/mapper/IcSpecialDao.xml

@ -0,0 +1,40 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.IcSpecialDao">
<select id="selectByResiId" resultType="com.epmet.entity.IcSpecialEntity">
select * from ic_special where IC_RESI_USER = #{resiId} and DEL_FLAG = 0
</select>
<select id="listSpecialCrowd"
resultType="com.epmet.dto.result.LingShanSpecialCrowdListResultDTO">
select r.ID as RESI_ID
, r.NAME
, r.MOBILE
, r.ID_CARD
, r.HOME_ID
, s.CREATED_TIME
, s.UPDATED_TIME
, s.SPECIAL_RQLB SPECIAL_TYPES_STR
from ic_resi_user r
inner join ic_special s on (r.ID = s.IC_RESI_USER and s.DEL_FLAG = 0)
where r.DEL_FLAG = 0
<if test="name != null and name != ''">
and r.NAME like CONCAT('%', #{name}, '%')
</if>
<if test="specialType != null and specialType != ''">
and s.SPECIAL_RQLB like #{specialType}
</if>
<if test="idCard != null and idCard != ''">
and r.ID_CARD like CONCAT('%', #{idCard}, '%')
</if>
<if test="orgIdPath != null and orgIdPath != ''">
and r.PIDS like CONCAT(#{orgIdPath}, '%') or r.AGENCY_ID = #{agencyId}
</if>
<if test="mobile != null and mobile != ''">
and r.MOBILE like CONCAT('%', #{mobile}, '%')
</if>
order by s.UPDATED_TIME desc
</select>
</mapper>

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

@ -1,80 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.epmet.dao.LingshanSpecialCrowdPersonTypeDao">
<resultMap type="com.epmet.entity.LingshanSpecialCrowdPersonTypeEntity" id="lingshanSpecialCrowdPersonTypeMap">
<result property="id" column="ID"/>
<result property="customerId" column="CUSTOMER_ID"/>
<result property="orgIdPath" column="ORG_ID_PATH"/>
<result property="idCard" column="ID_CARD"/>
<result property="specialType" column="SPECIAL_TYPE"/>
<result property="delFlag" column="DEL_FLAG"/>
<result property="revision" column="REVISION"/>
<result property="createdBy" column="CREATED_BY"/>
<result property="createdTime" column="CREATED_TIME"/>
<result property="updatedBy" column="UPDATED_BY"/>
<result property="updatedTime" column="UPDATED_TIME"/>
</resultMap>
<insert id="saveOrUpdateManually">
insert into lingshan_special_crowd_person_type ( ID, CUSTOMER_ID, ORG_ID_PATH, RESI_ID, ID_CARD, SPECIAL_TYPE,
DEL_FLAG, REVISION, CREATED_BY, CREATED_TIME, UPDATED_BY, UPDATED_TIME)
values
<foreach collection="types" item="type" separator=",">
(#{type.id}, #{type.customerId}, #{type.orgIdPath}, #{type.resiId}, #{type.idCard}, #{type.specialType},
#{type.delFlag}, #{type.revision}, #{type.createdBy}, #{type.createdTime}, #{type.updatedBy}, #{type.updatedTime})
</foreach>
on duplicate key update
ORG_ID_PATH=values(ORG_ID_PATH)
, SPECIAL_TYPE =values(SPECIAL_TYPE)
, UPDATED_BY =values(UPDATED_BY)
, UPDATED_TIME = values(UPDATED_TIME)
</insert>
<delete id="deletePhysical">
delete from lingshan_special_crowd_person_type where RESI_ID = #{resiId}
</delete>
<select id="listSpecialCrowds"
resultType="com.epmet.dto.result.LingShanSpecialCrowdListResultDTO">
select p.ID RESI_ID
, t.ORG_ID_PATH
, p.NAME
, p.MOBILE
, p.ID_CARD
, p.HOME_ID
, min(t.CREATED_TIME) CREATED_TIME
, max(t.UPDATED_TIME) UPDATED_TIME
, group_concat(t.SPECIAL_TYPE) SPECIAL_TYPES_STR
from ic_resi_user p
inner join lingshan_special_crowd_person_type t
on (t.DEL_FLAG = 0 and p.ID_CARD = t.ID_CARD)
<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 p.MOBILE like CONCAT('%', #{mobile}, '%')
</if>
</where>
group by p.ID
, t.ORG_ID_PATH
, p.NAME
, p.MOBILE
, p.ID_CARD
, p.HOME_ID
desc
</select>
</mapper>
Loading…
Cancel
Save