|
|
@ -263,7 +263,7 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public void savePersonAndTypes(List<PersonSpecialTypeBean> personTypes) { |
|
|
|
public void savePersonAndTypes(List<PersonSpecialTypeBean> personTypes, Boolean hard) { |
|
|
|
HashMap<String, Set<String>> resiIdAndTypes = new HashMap<>(); |
|
|
|
|
|
|
|
// 将所有的人群类别信息,按照居民id归类为map
|
|
|
@ -283,14 +283,16 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ |
|
|
|
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(",")))); |
|
|
|
if (! hard) { |
|
|
|
// 已经是特殊人群了,但不是硬性写入,就需要合并数据库中已存在的数据。否则直接将最新提交的数据覆盖进去
|
|
|
|
typeSet.addAll(new HashSet<>(Arrays.asList(specialTypeInDb.getSpecialRqlb().split(",")))); |
|
|
|
} |
|
|
|
IcSpecialEntity icSpecialUpdate = new IcSpecialEntity(); |
|
|
|
icSpecialUpdate.setSpecialRqlb(String.join(",", typeSet)); |
|
|
|
icSpecialUpdate.setId(specialTypeInDb.getId()); |
|
|
@ -440,6 +442,9 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ |
|
|
|
|
|
|
|
PersonSpecialTypeBean azbjE = new PersonSpecialTypeBean(vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.AZBJ.getType()); |
|
|
|
types2Save.add(azbjE); |
|
|
|
} else { |
|
|
|
// 修改的时候,前端提交过来是空的,那就需要将现有的删掉
|
|
|
|
deleteSpecialCrowdDetail(input.getIdCard(), LingshanSpecialCrowdDetailAzbjEntity.class); |
|
|
|
} |
|
|
|
|
|
|
|
if (input.getSpecialCrowdDetails().getJiedurenyuan() != null) { |
|
|
@ -450,6 +455,8 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ |
|
|
|
|
|
|
|
PersonSpecialTypeBean jdryE = new PersonSpecialTypeBean(vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.JDRY.getType()); |
|
|
|
types2Save.add(jdryE); |
|
|
|
} else { |
|
|
|
deleteSpecialCrowdDetail(input.getIdCard(), LingshanSpecialCrowdDetailJdryEntity.class); |
|
|
|
} |
|
|
|
|
|
|
|
if (input.getSpecialCrowdDetails().getJingzhanghuanzhe() != null) { |
|
|
@ -460,6 +467,8 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ |
|
|
|
|
|
|
|
PersonSpecialTypeBean jzhzE = new PersonSpecialTypeBean(vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.JZHZ.getType()); |
|
|
|
types2Save.add(jzhzE); |
|
|
|
} else { |
|
|
|
deleteSpecialCrowdDetail(input.getIdCard(), LingshanSpecialCrowdDetailJzhzEntity.class); |
|
|
|
} |
|
|
|
|
|
|
|
if (input.getSpecialCrowdDetails().getXinfangrenyuan() != null) { |
|
|
@ -470,6 +479,8 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ |
|
|
|
|
|
|
|
PersonSpecialTypeBean xfryE = new PersonSpecialTypeBean(vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.XFRY.getType()); |
|
|
|
types2Save.add(xfryE); |
|
|
|
} else { |
|
|
|
deleteSpecialCrowdDetail(input.getIdCard(), LingshanSpecialCrowdDetailXfryEntity.class); |
|
|
|
} |
|
|
|
|
|
|
|
if (input.getSpecialCrowdDetails().getShequjiaozheng() != null) { |
|
|
@ -480,12 +491,36 @@ public class LingShanSpecialCrowdServiceImpl implements LingShanSpecialCrowdServ |
|
|
|
|
|
|
|
PersonSpecialTypeBean sqjzE = new PersonSpecialTypeBean(vt.getResiId(), input.getIdCard(), LingShanSpecialCrowdTypeEnums.SQJZ.getType()); |
|
|
|
types2Save.add(sqjzE); |
|
|
|
} else { |
|
|
|
deleteSpecialCrowdDetail(input.getIdCard(), LingshanSpecialCrowdDetailSqjzEntity.class); |
|
|
|
} |
|
|
|
|
|
|
|
// 保存人员类型
|
|
|
|
savePersonAndTypes(types2Save); |
|
|
|
savePersonAndTypes(types2Save, true); |
|
|
|
} |
|
|
|
|
|
|
|
/** |
|
|
|
* @description: 删除特殊人群详情表 |
|
|
|
* @param idCard: |
|
|
|
* @return |
|
|
|
* @author: WangXianZhang |
|
|
|
* @date: 2023/4/24 3:33 PM |
|
|
|
*/ |
|
|
|
private void deleteSpecialCrowdDetail(String idCard, Class<? extends LingshanSpecialCrowdDetailBaseEntity> e) { |
|
|
|
if (LingshanSpecialCrowdDetailAzbjEntity.class == e) { |
|
|
|
specialCrowdDetailAzbjDao.deletePhysical(idCard); |
|
|
|
} else if (LingshanSpecialCrowdDetailXfryEntity.class == e) { |
|
|
|
specialCrowdDetailXfryDao.deletePhysical(idCard); |
|
|
|
} else if (LingshanSpecialCrowdDetailSqjzEntity.class == e) { |
|
|
|
specialCrowdDetailSqjzDao.deletePhysical(idCard); |
|
|
|
} else if (LingshanSpecialCrowdDetailJzhzEntity.class == e) { |
|
|
|
specialCrowdDetailJzhzDao.deletePhysical(idCard); |
|
|
|
} else if (LingshanSpecialCrowdDetailJdryEntity.class == e) { |
|
|
|
specialCrowdDetailJdryDao.deletePhysical(idCard); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
void setCommonFields(LingshanSpecialCrowdDetailBaseEntity e, String customerId, String orgIdPath, Date now, String staffId) { |
|
|
|
e.setCustomerId(customerId); |
|
|
|
e.setOrgIdPath(orgIdPath); |
|
|
|