|
@ -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()); |
|
|