|
@ -222,7 +222,7 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao |
|
|
if (CollectionUtils.isEmpty(dbResiList)) { |
|
|
if (CollectionUtils.isEmpty(dbResiList)) { |
|
|
break; |
|
|
break; |
|
|
} |
|
|
} |
|
|
hsjc(dbResiList, config.getCustomerId()); |
|
|
hsjc(dbResiList, config.getCustomerId(), formDTO.getIsSync()); |
|
|
break; |
|
|
break; |
|
|
case CAN_JI: |
|
|
case CAN_JI: |
|
|
//查询正常状态的居民 并回显 残疾状态
|
|
|
//查询正常状态的居民 并回显 残疾状态
|
|
@ -448,29 +448,31 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao |
|
|
* |
|
|
* |
|
|
* @param idCards |
|
|
* @param idCards |
|
|
* @param customerId |
|
|
* @param customerId |
|
|
|
|
|
* @param isSync 是否同步,1是人工点同步;0否 |
|
|
* @author zxc |
|
|
* @author zxc |
|
|
* @date 2022/9/27 11:08 |
|
|
* @date 2022/9/27 11:08 |
|
|
*/ |
|
|
*/ |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
public void hsjc(List<NatUserInfoResultDTO> idCards, String customerId) { |
|
|
public void hsjc(List<NatUserInfoResultDTO> idCards, String customerId, String isSync) { |
|
|
try { |
|
|
try { |
|
|
List<IcNatEntity> entities = new ArrayList<>(); |
|
|
List<IcNatEntity> entities = new ArrayList<>(); |
|
|
idCards.forEach(idCard -> { |
|
|
idCards.forEach(idCard -> { |
|
|
YtHscyResDTO sampleResult = YtHsResUtils.hscy(idCard.getIdCard(), NumConstant.ONE, NumConstant.ONE); |
|
|
// YtHscyResDTO sampleResult = YtHsResUtils.hscy(idCard.getIdCard(), NumConstant.ONE, NumConstant.ONE);
|
|
|
YtHsjcResDTO natInfoResult = YtHsResUtils.hsjc(idCard.getIdCard(), NumConstant.ONE, NumConstant.ONE); |
|
|
YtHsjcResDTO natInfoResult = YtHsResUtils.hsjc(idCard.getIdCard(), NumConstant.ONE, NumConstant.ONE); |
|
|
Boolean aBoolean = CollectionUtils.isEmpty(sampleResult.getData()) && CollectionUtils.isNotEmpty(natInfoResult.getData()); |
|
|
/*Boolean aBoolean = CollectionUtils.isEmpty(sampleResult.getData()) && CollectionUtils.isNotEmpty(natInfoResult.getData()); |
|
|
Boolean bBoolean = CollectionUtils.isNotEmpty(sampleResult.getData()) && CollectionUtils.isNotEmpty(natInfoResult.getData()); |
|
|
Boolean bBoolean = CollectionUtils.isNotEmpty(sampleResult.getData()) && CollectionUtils.isNotEmpty(natInfoResult.getData());*/ |
|
|
/** |
|
|
/** |
|
|
* 1.采样结果 和 检测结果 都不为空,以检测结果为准 |
|
|
* 1.采样结果 和 检测结果 都不为空,以检测结果为准 |
|
|
* 2.采样结果为空,检测结果不为空 |
|
|
* 2.采样结果为空,检测结果不为空 |
|
|
*/ |
|
|
*/ |
|
|
if (aBoolean || bBoolean) { |
|
|
// if (aBoolean || bBoolean) {
|
|
|
|
|
|
if (CollectionUtils.isNotEmpty(natInfoResult.getData())) { |
|
|
natInfoResult.getData().forEach(natInfo -> { |
|
|
natInfoResult.getData().forEach(natInfo -> { |
|
|
IcNatEntity e = new IcNatEntity(); |
|
|
IcNatEntity e = new IcNatEntity(); |
|
|
e.setCustomerId(customerId); |
|
|
e.setCustomerId(customerId); |
|
|
e.setIsResiUser(StringUtils.isBlank(idCard.getUserId()) ? NumConstant.ZERO_STR : NumConstant.ONE_STR); |
|
|
e.setIsResiUser(StringUtils.isBlank(idCard.getUserId()) ? NumConstant.ZERO_STR : NumConstant.ONE_STR); |
|
|
e.setUserId(idCard.getUserId()); |
|
|
e.setUserId(idCard.getUserId()); |
|
|
e.setUserType("sync"); |
|
|
e.setUserType(isSync.equals(NumConstant.ONE_STR) ? "manualSync" : "sync"); |
|
|
e.setName(StringUtils.isNotBlank(natInfo.getName()) ? natInfo.getName() : ""); |
|
|
e.setName(StringUtils.isNotBlank(natInfo.getName()) ? natInfo.getName() : ""); |
|
|
e.setMobile(StringUtils.isNotBlank(natInfo.getTelephone()) ? natInfo.getTelephone() : ""); |
|
|
e.setMobile(StringUtils.isNotBlank(natInfo.getTelephone()) ? natInfo.getTelephone() : ""); |
|
|
e.setIdCard(StringUtils.isNotBlank(natInfo.getCard_no()) ? natInfo.getCard_no() : ""); |
|
|
e.setIdCard(StringUtils.isNotBlank(natInfo.getCard_no()) ? natInfo.getCard_no() : ""); |
|
@ -479,7 +481,7 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao |
|
|
String resultPcr = natInfo.getSample_result_pcr(); |
|
|
String resultPcr = natInfo.getSample_result_pcr(); |
|
|
//检测结果 转换 我们 0:阴性 1:阳性, 他们 :1:阳性,2:阴性
|
|
|
//检测结果 转换 我们 0:阴性 1:阳性, 他们 :1:阳性,2:阴性
|
|
|
e.setNatResult(NumConstant.ZERO_STR); |
|
|
e.setNatResult(NumConstant.ZERO_STR); |
|
|
if (NumConstant.ONE_STR.equals(resultPcr)){ |
|
|
if (NumConstant.ONE_STR.equals(resultPcr)) { |
|
|
e.setNatResult(NumConstant.ONE_STR); |
|
|
e.setNatResult(NumConstant.ONE_STR); |
|
|
} |
|
|
} |
|
|
e.setNatAddress(natInfo.getSampling_org_pcr()); |
|
|
e.setNatAddress(natInfo.getSampling_org_pcr()); |
|
@ -490,15 +492,15 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao |
|
|
entities.add(e); |
|
|
entities.add(e); |
|
|
}); |
|
|
}); |
|
|
} |
|
|
} |
|
|
if (CollectionUtils.isNotEmpty(sampleResult.getData()) && CollectionUtils.isEmpty(natInfoResult.getData())){ |
|
|
/*if (CollectionUtils.isNotEmpty(sampleResult.getData()) && CollectionUtils.isEmpty(natInfoResult.getData())){ |
|
|
/*sampleResult.getData().forEach(sampleInfo -> { |
|
|
sampleResult.getData().forEach(sampleInfo -> { |
|
|
IcNatEntity e = new IcNatEntity(); |
|
|
IcNatEntity e = new IcNatEntity(); |
|
|
e.setCustomerId(customerId); |
|
|
e.setCustomerId(customerId); |
|
|
e.setIsResiUser(StringUtils.isBlank(idCard.getUserId()) ? NumConstant.ZERO_STR : NumConstant.ONE_STR); |
|
|
e.setIsResiUser(StringUtils.isBlank(idCard.getUserId()) ? NumConstant.ZERO_STR : NumConstant.ONE_STR); |
|
|
e.setUserId(idCard.getUserId()); |
|
|
e.setUserId(idCard.getUserId()); |
|
|
e.setUserType("sync"); |
|
|
e.setUserType(isSync.equals(NumConstant.ONE_STR) ? "manualSync" : "sync"); |
|
|
e.setName(StringUtils.isNotBlank(sampleInfo.getName()) ? sampleInfo.getName() : ""); |
|
|
e.setName(StringUtils.isNotBlank(sampleInfo.getName()) ? sampleInfo.getName() : ""); |
|
|
e.setMobile(StringUtils.isNotBlank(sampleInfo.getTelephone()) ? sampleInfo.getTelephone() : ""); |
|
|
e.setMobile(StringUtils.isNotBlank(sampleInfo.get()) ? sampleInfo.getTelephone() : ""); |
|
|
e.setIdCard(StringUtils.isNotBlank(sampleInfo.getCard_no()) ? sampleInfo.getCard_no() : ""); |
|
|
e.setIdCard(StringUtils.isNotBlank(sampleInfo.getCard_no()) ? sampleInfo.getCard_no() : ""); |
|
|
e.setNatTime(DateUtils.parseDate(sampleInfo.getTest_time(), DateUtils.DATE_TIME_PATTERN)); |
|
|
e.setNatTime(DateUtils.parseDate(sampleInfo.getTest_time(), DateUtils.DATE_TIME_PATTERN)); |
|
|
e.setSampleTime(DateUtils.parseDate(sampleInfo.getSample_time(), DateUtils.DATE_TIME_PATTERN)); |
|
|
e.setSampleTime(DateUtils.parseDate(sampleInfo.getSample_time(), DateUtils.DATE_TIME_PATTERN)); |
|
@ -514,37 +516,38 @@ public class DataSyncConfigServiceImpl extends BaseServiceImpl<DataSyncConfigDao |
|
|
e.setAttachmentType(""); |
|
|
e.setAttachmentType(""); |
|
|
e.setAttachmentUrl(""); |
|
|
e.setAttachmentUrl(""); |
|
|
entities.add(e); |
|
|
entities.add(e); |
|
|
});*/ |
|
|
}); |
|
|
} |
|
|
} |
|
|
}); |
|
|
});*/ |
|
|
if (CollectionUtils.isNotEmpty(entities)) { |
|
|
if (CollectionUtils.isNotEmpty(entities)) { |
|
|
List<NatUserInfoResultDTO> existNatInfos = icNatDao.getExistNatInfo(entities); |
|
|
List<NatUserInfoResultDTO> existNatInfos = icNatDao.getExistNatInfo(entities); |
|
|
entities.forEach(e -> existNatInfos.stream().filter(i -> i.getUserId().equals(e.getUserId()) && i.getIdCard().equals(e.getIdCard())).forEach(i -> e.setExistStatus(true))); |
|
|
entities.forEach(e -> existNatInfos.stream().filter(i -> i.getUserId().equals(e.getUserId()) && i.getIdCard().equals(e.getIdCard())).forEach(i -> e.setExistStatus(true))); |
|
|
Map<Boolean, List<IcNatEntity>> groupByStatus = entities.stream().collect(Collectors.groupingBy(IcNatEntity::getExistStatus)); |
|
|
Map<Boolean, List<IcNatEntity>> groupByStatus = entities.stream().collect(Collectors.groupingBy(IcNatEntity::getExistStatus)); |
|
|
if (CollectionUtils.isNotEmpty(groupByStatus.get(false))) { |
|
|
if (CollectionUtils.isNotEmpty(groupByStatus.get(false))) { |
|
|
for (List<IcNatEntity> icNatEntities : ListUtils.partition(groupByStatus.get(false), NumConstant.FIVE_HUNDRED)) { |
|
|
for (List<IcNatEntity> icNatEntities : ListUtils.partition(groupByStatus.get(false), NumConstant.FIVE_HUNDRED)) { |
|
|
icNatService.insertBatch(icNatEntities); |
|
|
icNatService.insertBatch(icNatEntities); |
|
|
//组织关系表
|
|
|
//组织关系表
|
|
|
List<IcNatRelationEntity> relationEntities = new ArrayList<>(); |
|
|
List<IcNatRelationEntity> relationEntities = new ArrayList<>(); |
|
|
icNatEntities.forEach(ne -> { |
|
|
icNatEntities.forEach(ne -> { |
|
|
// 不是居民的先不加关系表吧
|
|
|
// 不是居民的先不加关系表吧
|
|
|
if (ne.getIsResiUser().equals(NumConstant.ONE_STR)) { |
|
|
if (ne.getIsResiUser().equals(NumConstant.ONE_STR)) { |
|
|
IcNatRelationEntity e = new IcNatRelationEntity(); |
|
|
IcNatRelationEntity e = new IcNatRelationEntity(); |
|
|
e.setCustomerId(customerId); |
|
|
e.setCustomerId(customerId); |
|
|
e.setAgencyId(ne.getAgencyId()); |
|
|
e.setAgencyId(ne.getAgencyId()); |
|
|
e.setPids(ne.getPids()); |
|
|
e.setPids(ne.getPids()); |
|
|
e.setIcNatId(ne.getId()); |
|
|
e.setIcNatId(ne.getId()); |
|
|
e.setUserType("sync"); |
|
|
e.setUserType("sync"); |
|
|
relationEntities.add(e); |
|
|
relationEntities.add(e); |
|
|
|
|
|
} |
|
|
|
|
|
}); |
|
|
|
|
|
if (CollectionUtils.isNotEmpty(relationEntities)) { |
|
|
|
|
|
icNatRelationService.insertBatch(relationEntities); |
|
|
} |
|
|
} |
|
|
}); |
|
|
|
|
|
if (CollectionUtils.isNotEmpty(relationEntities)) { |
|
|
|
|
|
icNatRelationService.insertBatch(relationEntities); |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
}); |
|
|
} catch (Exception e) { |
|
|
} catch (Exception e) { |
|
|
log.error("hsjc exception", e); |
|
|
log.error("hsjc exception", e); |
|
|
} |
|
|
} |
|
|