Browse Source

Merge branch 'yantai_zhengwu_master'

master
lichao 2 years ago
parent
commit
65723c90b1
  1. 247
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncConfigServiceImpl.java

247
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/DataSyncConfigServiceImpl.java

@ -1,4 +1,9 @@
package com.epmet.service.impl;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.Period;
import java.time.ZoneId;
import java.time.format.DateTimeFormatter;
import java.util.Date;
import com.alibaba.fastjson.JSON;
@ -667,145 +672,157 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao
}
private void siWang(List<NatUserInfoResultDTO> dbResiList) {
try {
List<DataSyncRecordDeathEntity> list = new ArrayList<>();
for (NatUserInfoResultDTO dbResi : dbResiList) {
YtDataSyncResDTO thirdResult = YtHsResUtils.siWang(dbResi.getIdCard(), dbResi.getName());
if (200 != thirdResult.getCode()) {
log.warn("canJi 调用蓝图接口失败了 继续处理下一个人");
continue;
}
// List<DataSyncRecordDeathEntity> list = new ArrayList<>();
for (NatUserInfoResultDTO dbResi : dbResiList) {
try {
YtDataSyncResDTO thirdResult = YtHsResUtils.siWang(dbResi.getIdCard(), dbResi.getName());
if (200 != thirdResult.getCode()) {
log.warn("canJi 调用蓝图接口失败了 继续处理下一个人");
continue;
}
String thirdResultData = thirdResult.getData();
if(StringUtils.isBlank(thirdResultData)){
continue;
}
JSONObject thirdResultObject = JSON.parseObject(thirdResultData);
String thirdResultData = thirdResult.getData();
if(StringUtils.isBlank(thirdResultData)){
continue;
}
JSONObject thirdResultObject = JSON.parseObject(thirdResultData);
LambdaQueryWrapper<DataSyncRecordDeathEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DataSyncRecordDeathEntity::getIdCard, dbResi.getIdCard());
//获取数据库里的记录
DataSyncRecordDeathDTO dbDeathEntity = dataSyncRecordDeathService.selectOne(queryWrapper);
LambdaQueryWrapper<DataSyncRecordDeathEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DataSyncRecordDeathEntity::getIdCard, dbResi.getIdCard());
//获取数据库里的记录
DataSyncRecordDeathDTO dbDeathEntity = dataSyncRecordDeathService.selectOne(queryWrapper);
JudgeDealStatus judgeDealStatus = new JudgeDealStatus(thirdResultObject, dbDeathEntity).invokeDeath();
if (judgeDealStatus.isStop()) {
continue;
}
JudgeDealStatus judgeDealStatus = new JudgeDealStatus(thirdResultObject, dbDeathEntity).invokeDeath();
if (judgeDealStatus.isStop()) {
continue;
}
DataSyncRecordDeathEntity entity = new DataSyncRecordDeathEntity();
if (dbDeathEntity != null && StringUtils.isNotBlank(dbDeathEntity.getId())) {
entity.setId(dbDeathEntity.getId());
}
entity.setCustomerId(dbResi.getCustomerId());
entity.setAgencyId(dbResi.getAgencyId());
entity.setPids(dbResi.getPids());
entity.setGridId(dbResi.getGridId());
entity.setName(dbResi.getName());
entity.setIdCard(dbResi.getIdCard());
entity.setIcResiUserId(dbResi.getUserId());
//死亡未获取到数据
if (thirdResultObject != null) {
// entity.setAge(thirdResultObject.getString("AGE"));
// entity.setAddress(thirdResultObject.getString("FAMILY_ADD"));
entity.setDeathDate(thirdResultObject.getString("issueDate"));
// entity.setCremationTime(thirdResultObject.getString("CREMATION_TIME"));
// entity.setMz(thirdResultObject.getString("FAMILY_ADD"));
// entity.setOrganName(thirdResultObject.getString("CREATE_ORGAN_NAME"));
// entity.setNation(thirdResultObject.getString("NATION"));
entity.setThirdRecordId(thirdResultObject.getString("certificateID"));
JSONArray jsonArray = thirdResultObject.getJSONArray("surface");
if (jsonArray!=null && jsonArray.size()>0){
jsonArray.forEach(json->{
JSONObject jsonObject = JSON.parseObject(json.toString());
if (jsonObject.get("name").equals("户籍地址")){
entity.setAddress(jsonObject.get("value").toString());
DataSyncRecordDeathEntity entity = new DataSyncRecordDeathEntity();
if (dbDeathEntity != null && StringUtils.isNotBlank(dbDeathEntity.getId())) {
entity.setId(dbDeathEntity.getId());
}
entity.setCustomerId(dbResi.getCustomerId());
entity.setAgencyId(dbResi.getAgencyId());
entity.setPids(dbResi.getPids());
entity.setGridId(dbResi.getGridId());
entity.setName(dbResi.getName());
entity.setIdCard(dbResi.getIdCard());
entity.setIcResiUserId(dbResi.getUserId());
//死亡未获取到数据
if (thirdResultObject != null) {
// entity.setAge(thirdResultObject.getString("AGE"));
// entity.setAddress(thirdResultObject.getString("FAMILY_ADD"));
entity.setDeathDate(thirdResultObject.getString("issueDate"));
// entity.setCremationTime(thirdResultObject.getString("CREMATION_TIME"));
// entity.setMz(thirdResultObject.getString("FAMILY_ADD"));
// entity.setOrganName(thirdResultObject.getString("CREATE_ORGAN_NAME"));
// entity.setNation(thirdResultObject.getString("NATION"));
entity.setThirdRecordId(thirdResultObject.getString("certificateID"));
JSONArray jsonArray = thirdResultObject.getJSONArray("surface");
if (jsonArray!=null && jsonArray.size()>0){
jsonArray.forEach(json->{
JSONObject jsonObject = JSON.parseObject(json.toString());
if (jsonObject.get("name").equals("户籍地址")){
entity.setAddress(jsonObject.get("value").toString());
}
if (jsonObject.get("name").equals("年龄")){
if (jsonObject.get("value")!=null && !jsonObject.get("value").equals("")){
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss.S");
LocalDateTime localBirthDate = LocalDateTime.parse(jsonObject.get("value").toString(), formatter);
LocalDateTime dateTime = LocalDateTime.parse(thirdResultObject.getString("issueDate"), formatter);
LocalDate localDate = dateTime.toLocalDate();
Period period = Period.between(localBirthDate.toLocalDate(), localDate);
entity.setAge(String.valueOf(period.getYears()));
}
});
}
});
}
}
}
entity.setDealStatus(NumConstant.ZERO);
entity.setDealResult(StrConstant.EPMETY_STR);
if (judgeDealStatus.isNeedSetStatus) {
entity.setDealResult(judgeDealStatus.dealResult);
entity.setDealStatus(judgeDealStatus.dealStatus);
}
entity.setUpdatedTime(new Date());
// list.add(entity);
dataSyncRecordDeathService.saveOrUpdate(entity);
entity.setDealStatus(NumConstant.ZERO);
entity.setDealResult(StrConstant.EPMETY_STR);
if (judgeDealStatus.isNeedSetStatus) {
entity.setDealResult(judgeDealStatus.dealResult);
entity.setDealStatus(judgeDealStatus.dealStatus);
}
if (list.size() == NumConstant.ZERO) {
return;
entity.setUpdatedTime(new Date());
// list.add(entity);
dataSyncRecordDeathService.saveOrUpdate(entity);
} catch (Exception e) {
log.error("siwang exception", e);
}
// dataSyncRecordDeathService.saveOrUpdateBatch(list, NumConstant.TWO_HUNDRED);
} catch (Exception e) {
log.error("siwang exception", e);
}
/* if (list.size() == NumConstant.ZERO) {
return;
}*/
// dataSyncRecordDeathService.saveOrUpdateBatch(list, NumConstant.TWO_HUNDRED);
}
private void hunYin(List<NatUserInfoResultDTO> dbResiList) {
try {
List<DataSyncRecordMaritalEntity> list = new ArrayList<>();
for (NatUserInfoResultDTO dbResi : dbResiList) {
YtDataSyncResDTO thirdResult = YtHsResUtils.hunYin(dbResi.getIdCard(), dbResi.getName());
if (200 != thirdResult.getCode()) {
log.warn("hunyin 调用蓝图接口失败了 继续处理下一个人");
continue;
}
String thirdResultData = thirdResult.getData();
if(StringUtils.isBlank(thirdResultData)){
continue;
}
if (thirdResultData.equals("INR:匹配不成功") || thirdResultData.equals("null:null")){
continue;
}
// List<DataSyncRecordMaritalEntity> list = new ArrayList<>();
for (NatUserInfoResultDTO dbResi : dbResiList) {
try {
YtDataSyncResDTO thirdResult = YtHsResUtils.hunYin(dbResi.getIdCard(), dbResi.getName());
if (200 != thirdResult.getCode()) {
log.warn("hunyin 调用蓝图接口失败了 继续处理下一个人");
continue;
}
String thirdResultData = thirdResult.getData();
if(StringUtils.isBlank(thirdResultData)){
continue;
}
if (thirdResultData.equals("INR:匹配不成功") || thirdResultData.equals("null:null")){
continue;
}
// JSONObject thirdResultObject = JSON.parseObject(thirdResultData);
LambdaQueryWrapper<DataSyncRecordMaritalEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DataSyncRecordMaritalEntity::getIdCard, dbResi.getIdCard());
//获取数据库里的记录
DataSyncRecordMaritalDTO dbMaritaEntity = dataSyncRecordMaritalService.selectOne(queryWrapper);
LambdaQueryWrapper<DataSyncRecordMaritalEntity> queryWrapper = new LambdaQueryWrapper<>();
queryWrapper.eq(DataSyncRecordMaritalEntity::getIdCard, dbResi.getIdCard());
//获取数据库里的记录
DataSyncRecordMaritalDTO dbMaritaEntity = dataSyncRecordMaritalService.selectOne(queryWrapper);
JudgeDealStatus judgeDealStatus = new JudgeDealStatus(thirdResultData, dbMaritaEntity).invokeMarital();
if (judgeDealStatus.isStop()) {
continue;
}
JudgeDealStatus judgeDealStatus = new JudgeDealStatus(thirdResultData, dbMaritaEntity).invokeMarital();
if (judgeDealStatus.isStop()) {
continue;
}
DataSyncRecordMaritalEntity entity = new DataSyncRecordMaritalEntity();
if (dbMaritaEntity != null && StringUtils.isNotBlank(dbMaritaEntity.getId())) {
entity.setId(dbMaritaEntity.getId());
}
entity.setCustomerId(dbResi.getCustomerId());
entity.setAgencyId(dbResi.getAgencyId());
entity.setPids(dbResi.getPids());
entity.setGridId(dbResi.getGridId());
entity.setName(dbResi.getName());
entity.setIdCard(dbResi.getIdCard());
entity.setIcResiUserId(dbResi.getUserId());
//死亡未获取到数据
if (thirdResultData != null) {
entity.setMaritalStatusName(thirdResultData);
}
DataSyncRecordMaritalEntity entity = new DataSyncRecordMaritalEntity();
if (dbMaritaEntity != null && StringUtils.isNotBlank(dbMaritaEntity.getId())) {
entity.setId(dbMaritaEntity.getId());
}
entity.setCustomerId(dbResi.getCustomerId());
entity.setAgencyId(dbResi.getAgencyId());
entity.setPids(dbResi.getPids());
entity.setGridId(dbResi.getGridId());
entity.setName(dbResi.getName());
entity.setIdCard(dbResi.getIdCard());
entity.setIcResiUserId(dbResi.getUserId());
//死亡未获取到数据
if (thirdResultData != null) {
entity.setMaritalStatusName(thirdResultData);
}
entity.setDealStatus(NumConstant.ZERO);
entity.setDealResult(StrConstant.EPMETY_STR);
if (judgeDealStatus.isNeedSetStatus) {
entity.setDealResult(judgeDealStatus.dealResult);
entity.setDealStatus(judgeDealStatus.dealStatus);
}
entity.setUpdatedTime(new Date());
entity.setDealStatus(NumConstant.ZERO);
entity.setDealResult(StrConstant.EPMETY_STR);
if (judgeDealStatus.isNeedSetStatus) {
entity.setDealResult(judgeDealStatus.dealResult);
entity.setDealStatus(judgeDealStatus.dealStatus);
}
entity.setUpdatedTime(new Date());
// list.add(entity);
dataSyncRecordMaritalService.saveOrUpdate(entity);
dataSyncRecordMaritalService.saveOrUpdate(entity);
} catch (Exception e) {
log.error("hunyin exception", e);
}
if (list.size() == NumConstant.ZERO) {
}
/* if (list.size() == NumConstant.ZERO) {
return;
}
}*/
// dataSyncRecordMaritalService.saveOrUpdateBatch(list, NumConstant.TWO_HUNDRED);
} catch (Exception e) {
log.error("hunyin exception", e);
}
}
/**

Loading…
Cancel
Save