|
|
|
@ -4,10 +4,12 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
|
|
|
import com.biutag.supervisiondata.common.interfaces.CompletableFutureUtil; |
|
|
|
import com.biutag.supervisiondata.common.interfaces.CompletableFutureUtil; |
|
|
|
import com.biutag.supervisiondata.pojo.constants.Default; |
|
|
|
import com.biutag.supervisiondata.pojo.constants.Default; |
|
|
|
import com.biutag.supervisiondata.pojo.database.Contradiction; |
|
|
|
import com.biutag.supervisiondata.pojo.database.Contradiction; |
|
|
|
|
|
|
|
import com.biutag.supervisiondata.pojo.database.PointOrg; |
|
|
|
import com.biutag.supervisiondata.pojo.entity.ads.GBaseSYRKXX; |
|
|
|
import com.biutag.supervisiondata.pojo.entity.ads.GBaseSYRKXX; |
|
|
|
import com.biutag.supervisiondata.pojo.entity.dwd.GBaseJJD; |
|
|
|
import com.biutag.supervisiondata.pojo.entity.dwd.GBaseJJD; |
|
|
|
import com.biutag.supervisiondata.pojo.entity.dwd.GBaseZDRY; |
|
|
|
import com.biutag.supervisiondata.pojo.entity.dwd.GBaseZDRY; |
|
|
|
import com.biutag.supervisiondata.pojo.entity.mine.*; |
|
|
|
import com.biutag.supervisiondata.pojo.entity.mine.*; |
|
|
|
|
|
|
|
import com.biutag.supervisiondata.pojo.entity.wdpc.WdpcGrjdJsbry; |
|
|
|
import com.biutag.supervisiondata.pojo.entity.wdpc.WdpcGrjdXfsj; |
|
|
|
import com.biutag.supervisiondata.pojo.entity.wdpc.WdpcGrjdXfsj; |
|
|
|
import com.biutag.supervisiondata.pojo.entity.wdpc.WdpcGrjdXfsjCs; |
|
|
|
import com.biutag.supervisiondata.pojo.entity.wdpc.WdpcGrjdXfsjCs; |
|
|
|
import com.biutag.supervisiondata.pojo.entity.wdpc.WdpcRyLgXX; |
|
|
|
import com.biutag.supervisiondata.pojo.entity.wdpc.WdpcRyLgXX; |
|
|
|
@ -16,6 +18,7 @@ import com.biutag.supervisiondata.repository.*; |
|
|
|
import com.biutag.supervisiondata.service.PersonalService; |
|
|
|
import com.biutag.supervisiondata.service.PersonalService; |
|
|
|
import com.biutag.supervisiondata.service.RiskPersonalService; |
|
|
|
import com.biutag.supervisiondata.service.RiskPersonalService; |
|
|
|
import com.biutag.supervisiondata.util.IdCodeUtil; |
|
|
|
import com.biutag.supervisiondata.util.IdCodeUtil; |
|
|
|
|
|
|
|
import com.biutag.supervisiondata.util.OrgUtil; |
|
|
|
import com.biutag.supervisiondata.util.PatternUtil; |
|
|
|
import com.biutag.supervisiondata.util.PatternUtil; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.AllArgsConstructor; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
@ -187,7 +190,8 @@ public class PersonalServiceImpl implements PersonalService { |
|
|
|
personal.setControlDepartType(DepartType.POINT.getType()); |
|
|
|
personal.setControlDepartType(DepartType.POINT.getType()); |
|
|
|
try { |
|
|
|
try { |
|
|
|
personal.setControlTime(LocalDateTime.parse(ry.getJlbgsj(), DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
|
|
|
personal.setControlTime(LocalDateTime.parse(ry.getJlbgsj(), DateTimeFormatter.ofPattern("yyyyMMddHHmmss"))); |
|
|
|
} catch (Exception e) { |
|
|
|
} catch (Exception ignored) { |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
// 基本信息
|
|
|
|
// 基本信息
|
|
|
|
personal.setAge(IdCodeUtil.idCard2Age(personal.getIdCode(), now)); |
|
|
|
personal.setAge(IdCodeUtil.idCard2Age(personal.getIdCode(), now)); |
|
|
|
@ -312,31 +316,57 @@ public class PersonalServiceImpl implements PersonalService { |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public void pullPetitionAgain() { |
|
|
|
public void pullPetitionAgain() { |
|
|
|
List<String> idCodes = new ArrayList<>(); |
|
|
|
List<String> idCodes = new ArrayList<>(); |
|
|
|
CompletableFuture.allOf(CompletableFutureUtil.runSyncObject(() -> { |
|
|
|
CompletableFuture.allOf(CompletableFutureUtil.runSyncObject(() -> idCodes.addAll(xfsjRepository.list(new LambdaQueryWrapper<WdpcGrjdXfsj>().select(WdpcGrjdXfsj::getIdCode, WdpcGrjdXfsj::getName)).stream().map(WdpcGrjdXfsj::getIdCode).toList())), CompletableFutureUtil.runSyncObject(() -> idCodes.addAll(xfsjCsRepository.list(new LambdaQueryWrapper<WdpcGrjdXfsjCs>().select(WdpcGrjdXfsjCs::getIdCode, WdpcGrjdXfsjCs::getName)).stream().map(WdpcGrjdXfsjCs::getIdCode).toList()))).join(); |
|
|
|
idCodes.addAll(xfsjRepository.list(new LambdaQueryWrapper<WdpcGrjdXfsj>().select(WdpcGrjdXfsj::getIdCode, WdpcGrjdXfsj::getName)).stream().map(WdpcGrjdXfsj::getIdCode).toList()); |
|
|
|
|
|
|
|
}), CompletableFutureUtil.runSyncObject(() -> { |
|
|
|
|
|
|
|
idCodes.addAll(xfsjCsRepository.list(new LambdaQueryWrapper<WdpcGrjdXfsjCs>().select(WdpcGrjdXfsjCs::getIdCode, WdpcGrjdXfsjCs::getName)).stream().map(WdpcGrjdXfsjCs::getIdCode).toList()); |
|
|
|
|
|
|
|
})).join(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<String> idCards = idCodes.stream().distinct().toList(); |
|
|
|
List<String> idCards = idCodes.stream().distinct().toList(); |
|
|
|
List<List<String>> idCards2 = IntStream.range(0, (idCards.size() + 9999) / 10000) |
|
|
|
List<List<String>> idCards2 = IntStream.range(0, (idCards.size() + 9999) / 10000) |
|
|
|
.mapToObj(i -> idCards.subList(i * 10000, Math.min((i + 1) * 10000, idCards.size()))) |
|
|
|
.mapToObj(i -> idCards.subList(i * 10000, Math.min((i + 1) * 10000, idCards.size()))) |
|
|
|
.toList(); |
|
|
|
.toList(); |
|
|
|
|
|
|
|
|
|
|
|
List<GBaseSYRKXX> xxList = new ArrayList<>(); |
|
|
|
List<SupExternalDepart> supDeparts = externalDepartRepository.list(new LambdaQueryWrapper<SupExternalDepart>() |
|
|
|
xxList.addAll(getByIdCode(idCards2)); |
|
|
|
.select(SupExternalDepart::getExternalId, SupExternalDepart::getInternalId, SupExternalDepart::getInternalName, SupExternalDepart::getSource) |
|
|
|
|
|
|
|
.eq(SupExternalDepart::getSource, "重点人员")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<PointOrg> orgs = zdryRepository.getBaseMapper().selectOrg(); |
|
|
|
|
|
|
|
Map<String, PointOrg> orgIdMap = new WeakHashMap<>(); |
|
|
|
|
|
|
|
Map<String, PointOrg> orgCodeMap = new WeakHashMap<>(); |
|
|
|
|
|
|
|
for (PointOrg org : orgs) { |
|
|
|
|
|
|
|
orgIdMap.put(org.getId(), org); |
|
|
|
|
|
|
|
orgCodeMap.put(org.getDm(), org); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, SupExternalDepart> supExternalDepartMap = supDeparts.stream().collect(Collectors.toMap(SupExternalDepart::getExternalId, Function.identity(), (val,old) -> val)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<GBaseSYRKXX> xxList = new ArrayList<>(getByIdCode(idCards2)); |
|
|
|
// 去重
|
|
|
|
// 去重
|
|
|
|
List<RiskPersonal> personals = new ArrayList<>(); |
|
|
|
List<RiskPersonal> personals = new ArrayList<>(); |
|
|
|
Map<String, Byte[]> map = new WeakHashMap<>(); |
|
|
|
Map<String, Byte[]> map = new WeakHashMap<>(); |
|
|
|
LocalDateTime now = LocalDateTime.now(); |
|
|
|
LocalDateTime now = LocalDateTime.now(); |
|
|
|
LocalDate today = now.toLocalDate(); |
|
|
|
LocalDate today = now.toLocalDate(); |
|
|
|
Date nowDate = new Date(); |
|
|
|
Date nowDate = new Date(); |
|
|
|
|
|
|
|
Map<String, SupExternalDepart> hope = new WeakHashMap<>(); |
|
|
|
for (GBaseSYRKXX xx : xxList) { |
|
|
|
for (GBaseSYRKXX xx : xxList) { |
|
|
|
if (map.get(xx.getGmsfhm()) == null) { |
|
|
|
if (map.get(xx.getGmsfhm()) == null) { |
|
|
|
RiskPersonal personal = createPerson(xx, nowDate, today, now, Default.BIG_TAG_PETITION); |
|
|
|
RiskPersonal personal = createPerson(xx, nowDate, today, now, Default.BIG_TAG_PETITION); |
|
|
|
if(personal == null) { |
|
|
|
if(personal == null) { |
|
|
|
continue; |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
SupExternalDepart depart = hope.get(xx.getSspcsdm()); |
|
|
|
|
|
|
|
if(depart == null) { |
|
|
|
|
|
|
|
personal.setMobileNumber(xx.getLxdh()); |
|
|
|
|
|
|
|
PointOrg org = orgCodeMap.get(xx.getSspcsdm()); |
|
|
|
|
|
|
|
org = OrgUtil.findOrg(org, orgIdMap); |
|
|
|
|
|
|
|
depart = Optional.ofNullable(org).map(PointOrg::getDm).map(supExternalDepartMap::get).orElse(null); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(depart != null) { |
|
|
|
|
|
|
|
hope.put(xx.getSspcsdm(), depart); |
|
|
|
|
|
|
|
personal.setControlDepartId(depart.getInternalId()); |
|
|
|
|
|
|
|
personal.setControlDepartName(depart.getInternalName()); |
|
|
|
|
|
|
|
personal.setControlDepartType(DepartType.HUMAN.getType()); |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
personal.setControlDepartId(null); |
|
|
|
|
|
|
|
personal.setControlDepartName(null); |
|
|
|
|
|
|
|
} |
|
|
|
personals.add(personal); |
|
|
|
personals.add(personal); |
|
|
|
map.put(xx.getGmsfhm(), new Byte[0]); |
|
|
|
map.put(xx.getGmsfhm(), new Byte[0]); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -371,6 +401,79 @@ public class PersonalServiceImpl implements PersonalService { |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final WdpcGrjdJsbryRepository jsbryRepository; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final SupExternalDepartRepository externalDepartRepository; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
|
|
|
public void pullPsychosis() { |
|
|
|
|
|
|
|
List<WdpcGrjdJsbry> jsbryList = jsbryRepository.list(new LambdaQueryWrapper<WdpcGrjdJsbry>() |
|
|
|
|
|
|
|
.select(WdpcGrjdJsbry::getName, WdpcGrjdJsbry::getIdCode, WdpcGrjdJsbry::getActaulTime)); |
|
|
|
|
|
|
|
LocalDate now = LocalDate.now(); |
|
|
|
|
|
|
|
// id去重
|
|
|
|
|
|
|
|
List<String> idCodes = jsbryList.stream().map(WdpcGrjdJsbry::getIdCode).distinct().toList(); |
|
|
|
|
|
|
|
List<List<String>> idCards2 = IntStream.range(0, (idCodes.size() + 9999) / 10000) |
|
|
|
|
|
|
|
.mapToObj(i -> idCodes.subList(i * 10000, Math.min((i + 1) * 10000, idCodes.size()))) |
|
|
|
|
|
|
|
.toList(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<GBaseSYRKXX> xxList = new ArrayList<>(getByIdCode(idCards2)); |
|
|
|
|
|
|
|
Map<String, GBaseSYRKXX> xxMap = xxList.stream().collect(Collectors.toMap(GBaseSYRKXX::getGmsfhm, Function.identity(), (val, old) -> val)); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<SupExternalDepart> supDeparts = externalDepartRepository.list(new LambdaQueryWrapper<SupExternalDepart>() |
|
|
|
|
|
|
|
.select(SupExternalDepart::getExternalId, SupExternalDepart::getInternalId, SupExternalDepart::getInternalName, SupExternalDepart::getSource) |
|
|
|
|
|
|
|
.eq(SupExternalDepart::getSource, "重点人员")); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<PointOrg> orgs = zdryRepository.getBaseMapper().selectOrg(); |
|
|
|
|
|
|
|
Map<String, PointOrg> orgIdMap = new WeakHashMap<>(); |
|
|
|
|
|
|
|
Map<String, PointOrg> orgCodeMap = new WeakHashMap<>(); |
|
|
|
|
|
|
|
for (PointOrg org : orgs) { |
|
|
|
|
|
|
|
orgIdMap.put(org.getId(), org); |
|
|
|
|
|
|
|
orgCodeMap.put(org.getDm(), org); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, SupExternalDepart> supExternalDepartMap = supDeparts.stream().collect(Collectors.toMap(SupExternalDepart::getExternalId, Function.identity(), (val,old) -> val)); |
|
|
|
|
|
|
|
Map<String, Byte[]> map = new WeakHashMap<>(); |
|
|
|
|
|
|
|
List<RiskPersonal> personals = new ArrayList<>(); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Map<String, SupExternalDepart> hope = new WeakHashMap<>(); |
|
|
|
|
|
|
|
for (WdpcGrjdJsbry ry : jsbryList) { |
|
|
|
|
|
|
|
if(map.get(ry.getIdCode()) != null) { |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
map.put(ry.getIdCode(), new Byte[0]); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GBaseSYRKXX xx = xxMap.get(ry.getIdCode()); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RiskPersonal person = new RiskPersonal(); |
|
|
|
|
|
|
|
person.setName(ry.getName()); |
|
|
|
|
|
|
|
person.setIdCode(ry.getIdCode()); |
|
|
|
|
|
|
|
person.setAge(IdCodeUtil.idCard2Age(ry.getIdCode(), now)); |
|
|
|
|
|
|
|
person.setGender(IdCodeUtil.idCard2Gender(ry.getIdCode())); |
|
|
|
|
|
|
|
person.setCreateTime(LocalDateTime.now()); |
|
|
|
|
|
|
|
person.setControlTime(LocalDateTime.now()); |
|
|
|
|
|
|
|
if(xx != null) { |
|
|
|
|
|
|
|
SupExternalDepart depart = hope.get(xx.getSspcsdm()); |
|
|
|
|
|
|
|
if(depart == null) { |
|
|
|
|
|
|
|
person.setMobileNumber(xx.getLxdh()); |
|
|
|
|
|
|
|
PointOrg org = orgCodeMap.get(xx.getSspcsdm()); |
|
|
|
|
|
|
|
org = OrgUtil.findOrg(org, orgIdMap); |
|
|
|
|
|
|
|
depart = Optional.ofNullable(org).map(PointOrg::getDm).map(supExternalDepartMap::get).orElse(null); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(depart != null) { |
|
|
|
|
|
|
|
hope.put(xx.getSspcsdm(), depart); |
|
|
|
|
|
|
|
person.setControlDepartId(depart.getInternalId()); |
|
|
|
|
|
|
|
person.setControlDepartName(depart.getInternalName()); |
|
|
|
|
|
|
|
person.setControlDepartType(DepartType.HUMAN.getType()); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
person.setTags(Default.PSYCHOSIS_TAG); |
|
|
|
|
|
|
|
personals.add(person); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
if(!personals.isEmpty()) { |
|
|
|
|
|
|
|
riskPersonalService.saveDistinct(personals); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private final RiskTestRepository riskTestRepository; |
|
|
|
private final RiskTestRepository riskTestRepository; |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@ -439,7 +542,7 @@ public class PersonalServiceImpl implements PersonalService { |
|
|
|
person.setMobileNumber(item.getLxdh()); |
|
|
|
person.setMobileNumber(item.getLxdh()); |
|
|
|
person.setControlDepartId(item.getSspcsdm()); |
|
|
|
person.setControlDepartId(item.getSspcsdm()); |
|
|
|
person.setControlDepartName(item.getSspcsmc()); |
|
|
|
person.setControlDepartName(item.getSspcsmc()); |
|
|
|
person.setControlDepartType(DepartType.HUMAN.getType()); |
|
|
|
person.setControlDepartType(DepartType.OTHER.getType()); |
|
|
|
person.setIdCode(item.getGmsfhm().toUpperCase()); |
|
|
|
person.setIdCode(item.getGmsfhm().toUpperCase()); |
|
|
|
person.setCreateTime(time); |
|
|
|
person.setCreateTime(time); |
|
|
|
person.setAge(IdCodeUtil.idCard2Age(person.getIdCode(), now)); |
|
|
|
person.setAge(IdCodeUtil.idCard2Age(person.getIdCode(), now)); |
|
|
|
|