|
|
@ -380,7 +380,6 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi |
|
|
|
@Async |
|
|
|
public void importFile(TokenDto tokenDto, InputStream inputStream, Integer attentionType, String taskId) { |
|
|
|
List<EpidemicSpecialAttentionErrorModel> errorInfo = new ArrayList<>(); |
|
|
|
|
|
|
|
try { |
|
|
|
List<ImportEpidemicSpecialAttention> list = ExcelPoiUtils.importExcel(inputStream, 0,1,ImportEpidemicSpecialAttention.class); |
|
|
|
if (CollectionUtils.isEmpty(list)){ |
|
|
@ -414,7 +413,17 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi |
|
|
|
list.get(i).setAddStatus(true); |
|
|
|
continue; |
|
|
|
} |
|
|
|
if (attentionType.compareTo(NumConstant.TWO) == NumConstant.ZERO && StringUtils.isBlank(list.get(i).getIsolatedState()) && !list.get(i).getAddStatus()){ |
|
|
|
errorInfo.add(getErrorInfo(list.get(i), "隔离状态不能为空",i+1)); |
|
|
|
list.get(i).setAddStatus(true); |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
Result<List<SysDictDataDTO>> isolatedState = epmetAdminOpenFeignClient.dictDataList("isolatedState"); |
|
|
|
if (!isolatedState.success()){ |
|
|
|
throw new EpmetException("查询字典表数据失败..."+"isolatedState"); |
|
|
|
} |
|
|
|
Map<String, String> dictMap = isolatedState.getData().stream().collect(Collectors.toMap(SysDictDataDTO::getDictLabel, SysDictDataDTO::getDictValue)); |
|
|
|
if (list.size() > errorInfo.size()){ |
|
|
|
Map<String, Long> groupByIdCard = list.stream().collect(Collectors.groupingBy(ImportEpidemicSpecialAttention::getIdCard, Collectors.counting())); |
|
|
|
groupByIdCard.forEach((idCard,count) -> { |
|
|
@ -428,6 +437,7 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi |
|
|
|
} |
|
|
|
}); |
|
|
|
List<String> idCards = list.stream().map(m -> m.getIdCard()).collect(Collectors.toList()); |
|
|
|
List<IcEpidemicSpecialAttentionEntity> existsEntities = new ArrayList<>(); |
|
|
|
List<String> existList = baseDao.getExistList(attentionType, idCards); |
|
|
|
if (CollectionUtils.isNotEmpty(existList)){ |
|
|
|
for (String s : existList) { |
|
|
@ -436,10 +446,17 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi |
|
|
|
// 按照产品指示,去除提示错误信息,并不做操作
|
|
|
|
// errorInfo.add(getErrorInfo(list.get(i),"数据已存在",list.get(i).getNum()));
|
|
|
|
list.get(i).setAddStatus(true); |
|
|
|
if (attentionType.compareTo(NumConstant.TWO) == NumConstant.ZERO){ |
|
|
|
list.get(i).setIsolatedState(dictMap.get(list.get(i).getIsolatedState())); |
|
|
|
existsEntities.add(ConvertUtils.sourceToTarget(list.get(i),IcEpidemicSpecialAttentionEntity.class)); |
|
|
|
} |
|
|
|
continue; |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if (attentionType.compareTo(NumConstant.TWO) == NumConstant.ZERO && CollectionUtils.isNotEmpty(existsEntities)) { |
|
|
|
baseDao.addExistAttention(existsEntities, attentionType); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
Map<Boolean, List<ImportEpidemicSpecialAttention>> groupByStatus = list.stream().collect(Collectors.groupingBy(ImportEpidemicSpecialAttention::getAddStatus)); |
|
|
@ -447,6 +464,9 @@ public class IcEpidemicSpecialAttentionServiceImpl extends BaseServiceImpl<IcEpi |
|
|
|
if (CollectionUtils.isNotEmpty(needInsert)){ |
|
|
|
List<IcEpidemicSpecialAttentionEntity> entities = ConvertUtils.sourceToTarget(needInsert, IcEpidemicSpecialAttentionEntity.class); |
|
|
|
entities.forEach(e -> { |
|
|
|
if (attentionType.compareTo(NumConstant.TWO) == NumConstant.ZERO){ |
|
|
|
e.setIsolatedState(dictMap.get(e.getIsolatedState())); |
|
|
|
} |
|
|
|
e.setIsAttention(NumConstant.ONE); |
|
|
|
e.setOrgId(agencyInfo.getId()); |
|
|
|
e.setPid(agencyInfo.getPid()); |
|
|
|