| 
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -43,6 +43,7 @@ import com.epmet.entity.IcTripReportRecordEntity; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.excel.IcPsTripReportRecordExcel; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.excel.data.IcTripReportExcelData; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.excel.error.IcPsTripReportRecordErrorExcel; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.excel.handler.IcPsTripReportExcelImportListener; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.excel.handler.IcTripReportExcelImportListener; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.feign.EpmetAdminOpenFeignClient; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import com.epmet.feign.EpmetCommonServiceOpenFeignClient; | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -76,7 +77,6 @@ import java.nio.file.Files; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.nio.file.Path; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.*; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.concurrent.atomic.AtomicBoolean; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.stream.Collector; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					import java.util.stream.Collectors; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					/** | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -125,16 +125,16 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //获取需要的字典表数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //交通方式
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Result<Map<String, String>> trafficTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.TRAFFIC_TYPE.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, String> tMap = trafficTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //Map<String, String> tMap = trafficTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //7天内旅居史情况
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Result<Map<String, String>> sojournHistoryMap = adminOpenFeignClient.dictMap(DictTypeEnum.SOJOURN_HISTORY.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, String> sMap = sojournHistoryMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //Map<String, String> sMap = sojournHistoryMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //隔离状态
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Result<Map<String, String>> isolateTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.ISOLATE_TYPE.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, String> iMap = isolateTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //Map<String, String> iMap = isolateTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //行程记录类型
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Result<Map<String, String>> tripDataTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.TRIP_DATA_TYPE.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, String> tdMap = tripDataTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //Map<String, String> tdMap = tripDataTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //3.查询最近一次通知时间、核算检测关注名单
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (CollectionUtils.isNotEmpty(list)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Map<String, Date> latestNotice = new HashMap<>(); | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
							
								
							
						
					 | 
				
				 | 
				
					@ -160,15 +160,15 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    dto.setLatestNoticeTime(latestNotice.get(dto.getIdCard())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //字典表字段、是否字段赋值对应中国字
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                dto.setTrafficTypeName(tMap.containsKey(dto.getTrafficType()) ? tMap.get(dto.getTrafficType()) : "无"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                dto.setTrafficTypeName(trafficTypeMap.getData().containsKey(dto.getTrafficType()) ? trafficTypeMap.getData().get(dto.getTrafficType()) : "无"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                dto.setVaccineNumName(StringUtils.isNotBlank(dto.getVaccineNum()) ? dto.getVaccineNum().concat("针") : ""); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                dto.setIsNatRecordName("1".equals(dto.getIsNatRecord()) ? "是" : "否"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                dto.setNatOutcomeName("1".equals(dto.getIsNatRecord()) ? "阳性" : "阴性"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                dto.setSojournHistoryName(sMap.containsKey(dto.getSojournHistory()) ? sMap.get(dto.getSojournHistory()) : "无"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                dto.setIsolateTypeName(iMap.containsKey(dto.getIsolateType()) ? iMap.get(dto.getIsolateType()) : "无"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                dto.setSojournHistoryName(sojournHistoryMap.getData().containsKey(dto.getSojournHistory()) ? sojournHistoryMap.getData().get(dto.getSojournHistory()) : "无"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                dto.setIsolateTypeName(isolateTypeMap.getData().containsKey(dto.getIsolateType()) ? isolateTypeMap.getData().get(dto.getIsolateType()) : "无"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                dto.setIsArriveCheckName("1".equals(dto.getIsArriveCheck()) ? "是" : "否"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                dto.setIsArriveName("1".equals(dto.getIsArrive()) ? "是" : "否"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                dto.setTripDataTypeName(tdMap.containsKey(dto.getTripDataType()) ? tdMap.get(dto.getTripDataType()) : "无"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                dto.setTripDataTypeName(tripDataTypeMap.getData().containsKey(dto.getTripDataType()) ? tripDataTypeMap.getData().get(dto.getTripDataType()) : "无"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return new PageData(list, data.getTotal()); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -361,27 +361,27 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //获取需要的字典表数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //交通方式
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Result<Map<String, String>> trafficTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.TRAFFIC_TYPE.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, String> tMap = trafficTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //Map<String, String> tMap = trafficTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //7天内旅居史情况
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Result<Map<String, String>> sojournHistoryMap = adminOpenFeignClient.dictMap(DictTypeEnum.SOJOURN_HISTORY.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, String> sMap = sojournHistoryMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //Map<String, String> sMap = sojournHistoryMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //隔离状态
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Result<Map<String, String>> isolateTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.ISOLATE_TYPE.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, String> iMap = isolateTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //Map<String, String> iMap = isolateTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //行程记录类型
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Result<Map<String, String>> tripDataTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.TRIP_DATA_TYPE.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Map<String, String> tdMap = tripDataTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //Map<String, String> tdMap = tripDataTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey()));
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        for (IcTripReportRecordDTO dto : result.getList()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //字典表字段、是否字段赋值对应中国字
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setTrafficTypeName(tMap.containsKey(dto.getTrafficType()) ? tMap.get(dto.getTrafficType()) : "无"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setTrafficTypeName(trafficTypeMap.getData().containsKey(dto.getTrafficType()) ? trafficTypeMap.getData().get(dto.getTrafficType()) : "无"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setVaccineNumName(StringUtils.isNotBlank(dto.getVaccineNum()) ? dto.getVaccineNum().concat("针") : ""); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setIsNatRecordName("1".equals(dto.getIsNatRecord()) ? "是" : "否"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setNatOutcomeName("1".equals(dto.getIsNatRecord()) ? "阳性" : "阴性"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setSojournHistoryName(sMap.containsKey(dto.getSojournHistory()) ? sMap.get(dto.getSojournHistory()) : "无"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setIsolateTypeName(iMap.containsKey(dto.getIsolateType()) ? iMap.get(dto.getIsolateType()) : "无"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setSojournHistoryName(sojournHistoryMap.getData().containsKey(dto.getSojournHistory()) ? sojournHistoryMap.getData().get(dto.getSojournHistory()) : "无"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setIsolateTypeName(isolateTypeMap.getData().containsKey(dto.getIsolateType()) ? isolateTypeMap.getData().get(dto.getIsolateType()) : "无"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setIsArriveCheckName("1".equals(dto.getIsArriveCheck()) ? "是" : "否"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setIsArriveName("1".equals(dto.getIsArrive()) ? "是" : "否"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setTripDataTypeName(tdMap.containsKey(dto.getTripDataType()) ? tdMap.get(dto.getTripDataType()) : "无"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            dto.setTripDataTypeName(tripDataTypeMap.getData().containsKey(dto.getTripDataType()) ? tripDataTypeMap.getData().get(dto.getTripDataType()) : "无"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return result.getList(); | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -422,8 +422,11 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //获取当前登录用户所属组织id
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            CustomerStaffInfoCacheResult staffInfo= queryCurrentStaff(customerId,userId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //交通方式
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Result<Map<String, String>> trafficTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.TRAFFIC_TYPE.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Map<String, String> tMap = trafficTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            IcTripReportExcelImportListener listener = new IcTripReportExcelImportListener(customerId,staffInfo, this); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            IcTripReportExcelImportListener listener = new IcTripReportExcelImportListener(customerId,staffInfo, this, tMap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            EasyExcel.read(filePath.toFile(), IcTripReportExcelData.class, listener).headRowNumber(2).sheet(0).doRead(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -550,139 +553,105 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     */ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Async | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    @Override | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public void psExecAsyncExcelImport(TokenDto tokenDto, HttpServletResponse response, InputStream inputStream, String taskId) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    public void psExecAsyncExcelImport(Path filePath, String importTaskId, TokenDto tokenDto) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            log.info("磐石街道行程上报导入,子线程开始执行"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //异常数据集合
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<IcPsTripReportRecordErrorExcel> fileList = new ArrayList<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            IcPsTripReportRecordErrorExcel excel = null; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //1.读取Excel数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ExcelImportResult<IcPsTripReportRecordExcel> testExcelImportResult = ExcelPoiUtils.importExcel1(inputStream, 0, 2, IcPsTripReportRecordExcel.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //2.存在错误行数据时存入错误数据集合中
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (CollectionUtils.isNotEmpty(testExcelImportResult.getFailList())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                for (IcPsTripReportRecordExcel entity : testExcelImportResult.getFailList()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    //打印失败的行 和失败的信息
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    log.warn("第{}行,{}", entity.getRowNum(), entity.getErrorMsg()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    excel = new IcPsTripReportRecordErrorExcel(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    excel.setName(entity.getName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    excel.setIdCard(entity.getIdCard()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    excel.setPresentAddress(entity.getPresentAddress()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    excel.setMobile(entity.getMobile()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    excel.setErrorInfo(entity.getErrorMsg()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    fileList.add(excel); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //获取当前登录用户所属组织id
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            CustomerStaffInfoCacheResult staffInfo= queryCurrentStaff(tokenDto.getCustomerId(), tokenDto.getUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //获取需要的字典表数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //交通方式
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Result<Map<String, String>> trafficTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.TRAFFIC_TYPE.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Map<String, String> tMap = trafficTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //7天内旅居史情况
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Result<Map<String, String>> sojournHistoryMap = adminOpenFeignClient.dictMap(DictTypeEnum.SOJOURN_HISTORY.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Map<String, String> sMap = sojournHistoryMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //隔离状态
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Result<Map<String, String>> isolateTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.ISOLATE_TYPE.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Map<String, String> iMap = isolateTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //行程记录类型
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Result<Map<String, String>> tripDataTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.TRIP_DATA_TYPE.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Map<String, String> tdMap = tripDataTypeMap.getData().entrySet().stream().collect(Collectors.toMap(entry -> entry.getValue(), entry -> entry.getKey())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //风险地区数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            LambdaQueryWrapper<IcDangerAreaEntity> wrapper = new LambdaQueryWrapper<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            wrapper.eq(IcDangerAreaEntity::getCustomerId, tokenDto.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            wrapper.eq(IcDangerAreaEntity::getDelFlag, DelFlagEnum.NORMAL.value()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<IcDangerAreaEntity> areaList = icDangerAreaDao.selectList(wrapper); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Map<String, String> areaMap = new HashMap<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            areaList.forEach(a->{ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                if(StringUtils.isNotBlank(a.getDistrict())){ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    areaMap.put(a.getDistrict(), a.getDangerLevel()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //3.正确行数据集合
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<IcPsTripReportRecordExcel> list = testExcelImportResult.getList(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (CollectionUtils.isNotEmpty(list)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //3-1.校验数据值,把填写不对的数据剔除
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                Iterator<IcPsTripReportRecordExcel> iterator = list.iterator(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                while (iterator.hasNext()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    AtomicBoolean bl = new AtomicBoolean(false); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    StringBuffer errMsg = new StringBuffer(""); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    IcPsTripReportRecordExcel obj = iterator.next(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    //返回方式为其他时需要填写"其他返回方式"
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if ("其他".equals(obj.getTrafficType()) && StringUtils.isBlank(obj.getTrafficTypeExplain())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        errMsg.append("返回方式为其他时,请补充“其他返回方式”;"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        bl.set(true); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            IcPsTripReportExcelImportListener listener = new IcPsTripReportExcelImportListener(tokenDto.getCustomerId(), staffInfo, this, | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    tMap, sMap, iMap, tdMap, areaMap); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            EasyExcel.read(filePath.toFile(), IcPsTripReportRecordExcel.class, listener).headRowNumber(2).sheet(0).doRead(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Path errorDescFile = null; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String errorDesFileUrl = null; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            List<IcPsTripReportRecordErrorExcel> errorRows = listener.getErrorRows(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            boolean failed = errorRows.size() > 0; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (failed) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                // 生成并上传错误文件
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    // 文件生成
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    Path errorDescDir = FileUtils.getAndCreateDirUnderEpmetFilesDir("ic_trip_preport", "import", "error_des"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    String fileName = UUID.randomUUID().toString().concat(".xlsx"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    errorDescFile = errorDescDir.resolve(fileName); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    FileItemFactory factory = new DiskFileItemFactory(16, errorDescDir.toFile()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    FileItem fileItem = factory.createItem("file", ContentType.APPLICATION_OCTET_STREAM.toString(), true, fileName); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    OutputStream os = fileItem.getOutputStream(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    EasyExcel.write(os, IcPsTripReportRecordErrorExcel.class).sheet("导入失败列表").doWrite(errorRows); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    // 文件上传oss
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    Result<UploadImgResultDTO> errorDesFileUploadResult = ossFeignClient.uploadImportTaskDescFile(new CommonsMultipartFile(fileItem)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (errorDesFileUploadResult.success()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        errorDesFileUrl = errorDesFileUploadResult.getData().getUrl(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (bl.get()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        excel = new IcPsTripReportRecordErrorExcel(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        excel.setName(obj.getName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        excel.setIdCard(obj.getIdCard()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        excel.setPresentAddress(obj.getPresentAddress()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        excel.setMobile(obj.getMobile()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        excel.setErrorInfo(errMsg.toString()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        fileList.add(excel); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        iterator.remove(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } finally { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (Files.exists(errorDescFile)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        Files.delete(errorDescFile); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //3-2.获取需要的字典表数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //交通方式
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                Result<Map<String, String>> trafficTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.TRAFFIC_TYPE.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //7天内旅居史情况
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                Result<Map<String, String>> sojournHistoryMap = adminOpenFeignClient.dictMap(DictTypeEnum.SOJOURN_HISTORY.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //隔离状态
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                Result<Map<String, String>> isolateTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.ISOLATE_TYPE.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //行程记录类型
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                Result<Map<String, String>> tripDataTypeMap = adminOpenFeignClient.dictMap(DictTypeEnum.TRIP_DATA_TYPE.getCode()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //获取当前登录用户所属组织id
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                CustomerStaffInfoCacheResult staffInfo = queryCurrentStaff(tokenDto.getCustomerId(), tokenDto.getUserId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                //风险地区数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                LambdaQueryWrapper<IcDangerAreaEntity> wrapper = new LambdaQueryWrapper<>(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                wrapper.eq(IcDangerAreaEntity::getCustomerId, tokenDto.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                wrapper.eq(IcDangerAreaEntity::getDelFlag, DelFlagEnum.NORMAL.value()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                List<IcDangerAreaEntity> areaList = icDangerAreaDao.selectList(wrapper); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                Map<String, String> map1 = areaList.stream().collect(Collectors.toMap(IcDangerAreaEntity::getDistrict, IcDangerAreaEntity::getDangerLevel)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                Map<String, String> map2 = areaList.stream().collect(Collectors.toMap(IcDangerAreaEntity::getCity, IcDangerAreaEntity::getDangerLevel)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                Map<String, String> map3 = areaList.stream().collect(Collectors.toMap(IcDangerAreaEntity::getProvince, IcDangerAreaEntity::getDangerLevel)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                list.forEach(l -> { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    //3-3.数据赋值
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    AtomicBoolean bl = new AtomicBoolean(false); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    StringBuffer errMsg = new StringBuffer(""); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    IcTripReportRecordEntity e = ConvertUtils.sourceToTarget(l, IcTripReportRecordEntity.class); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    e.setCustomerId(tokenDto.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    e.setAgencyId(staffInfo.getAgencyId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    e.setPids(staffInfo.getAgencyPIds()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    e.setUserType(IcResiUserConstant.USER_TYPE_IMPORT); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (trafficTypeMap.getData().containsKey(l.getTrafficType())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        e.setTrafficType(trafficTypeMap.getData().get(l.getTrafficType())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        e.setTrafficTypeExplain(l.getTrafficTypeExplain()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (StringUtils.isNotBlank(l.getSojournHistory())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        e.setSojournHistory(sojournHistoryMap.getData().get(l.getSojournHistory())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        String[] str = e.getSourceAddress().split("-"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        if (str.length < 3) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            bl.set(true); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            errMsg.append("数据不完整,‘来源地’信息填写格式错误;"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        e.setSojournHistory("3");//无风险
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        if (map1.containsKey(str[2])) {//高风险
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            e.setSojournHistory(map1.get(str[2])); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        } else if (map2.containsKey(str[1])) {//中风险
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            e.setSojournHistory(map2.get(str[1])); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        } else if (map3.containsKey(str[0])) {//低风险
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            e.setSojournHistory(map3.get(str[0])); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (StringUtils.isNotBlank(l.getIsolateType())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        e.setIsolateType(isolateTypeMap.getData().get(l.getIsolateType())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (StringUtils.isNotBlank(l.getTripDataType())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        e.setTripDataType(tripDataTypeMap.getData().get(l.getTripDataType())); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    e.setIsArriveCheck("是".equals(l.getIsArriveCheck()) ? "1" : "0"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    e.setIsArrive("是".equals(l.getIsArrive()) ? "1" : "0"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    //必要字段没值的
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (StringUtils.isEmpty(e.getSourceAddress()) || StringUtils.isEmpty(e.getPresentAddress()) | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                            || StringUtils.isEmpty(e.getTrafficType())) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        errMsg.append("数据不完整,请检查‘来源地’、‘在曹居住地点’、‘返回方式’信息是否填写完整;"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        bl.set(true); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    if (bl.get()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        IcPsTripReportRecordErrorExcel el = new IcPsTripReportRecordErrorExcel(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        el.setName(l.getName()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        el.setIdCard(l.getIdCard()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        el.setPresentAddress(l.getPresentAddress()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        el.setMobile(l.getMobile()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        el.setErrorInfo(errMsg.toString()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        fileList.add(el); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                        return; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    //3-4.保存数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    baseDao.insert(e); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                }); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            //4.错误数据生成文件,修改导入任务状态
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String url = erroeImport(fileList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            upImportTask(url, taskId, tokenDto.getUserId(), true); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            importFinishTaskForm.setTaskId(importTaskId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            importFinishTaskForm.setProcessStatus(failed ? ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL : ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            importFinishTaskForm.setOperatorId(tokenDto.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            importFinishTaskForm.setResultDesc(""); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            importFinishTaskForm.setResultDescFilePath(errorDesFileUrl); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Result result = commonServiceOpenFeignClient.finishImportTask(importFinishTaskForm); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!result.success()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                log.error("【行程上报导入】finishImportTask失败"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } catch (Exception e) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String errorMsg = ExceptionUtils.getErrorStackTrace(e); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            log.error("【行程上报数据导入】程序错误:{}", errorMsg); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            upImportTask(null, taskId, tokenDto.getUserId(), false); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            log.error("【行程上报导入】出错:{}", errorMsg); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            ImportTaskCommonFormDTO importFinishTaskForm = new ImportTaskCommonFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            importFinishTaskForm.setTaskId(importTaskId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            importFinishTaskForm.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            importFinishTaskForm.setOperatorId(tokenDto.getCustomerId()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            importFinishTaskForm.setResultDesc("导入失败"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Result result = commonServiceOpenFeignClient.finishImportTask(importFinishTaskForm); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (!result.success()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                log.error("【行程上报导入】导入记录状态修改为'完成'失败"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } finally { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // 删除临时文件
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (Files.exists(filePath)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    Files.delete(filePath); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } catch (IOException e) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    log.error("method exception", e); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
	
		
			
				
					| 
						
							
								
							
						
						
							
								
							
						
						
					 | 
				
				 | 
				
					@ -784,74 +753,5 @@ public class IcTripReportRecordServiceImpl extends BaseServiceImpl<IcTripReportR | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return result; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Author sun | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Description 行程上报数据导入,错误数据生成导入失败文件存到阿里云,修改导入任务为已结束 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     **/ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private String erroeImport(List<IcPsTripReportRecordErrorExcel> fileList) throws IOException { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        String url = ""; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //1.有错误数据则生成错误数据存放文件传到阿里云服务
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (!org.springframework.util.CollectionUtils.isEmpty(fileList)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Workbook workbook = ExcelExportUtil.exportExcel(new ExportParams("导入失败的数据列表", "导入失败的数据列表"), | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    IcPsTripReportRecordErrorExcel.class, fileList); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            // 文件名
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            String resultDescFileName = UUID.randomUUID().toString().concat(".xlsx"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            FileItemFactory factory = new DiskFileItemFactory(16, null); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            FileItem fileItem = factory.createItem("file", ContentType.APPLICATION_OCTET_STREAM.toString(), true, resultDescFileName); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            OutputStream os = fileItem.getOutputStream(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            Result<UploadImgResultDTO> uploadResult = null; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                workbook.write(os); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                uploadResult = ossFeignClient.uploadImportTaskDescFile(new CommonsMultipartFile(fileItem)); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } catch (Exception e) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                String errormsg = ExceptionUtils.getErrorStackTrace(e); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                log.error("【行程上报数据导入】上传错误描述文件:{}", errormsg); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } finally { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    os.close(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } catch (IOException e) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    String errormsg = ExceptionUtils.getErrorStackTrace(e); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    log.error("【行程上报数据导入】上传错误描述文件关闭输出流:{}", errormsg); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                try { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    fileItem.delete(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } catch (Exception e) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    String errormsg = ExceptionUtils.getErrorStackTrace(e); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                    log.error("【行程上报数据导入】上传错误描述文件删除临时文件:{}", errormsg); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            if (uploadResult == null || !uploadResult.success()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					                log.error("【行程上报数据导入】调用OSS上传结果描述文件失败"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            url = uploadResult.getData().getUrl(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        return url; | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    /** | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Author sun | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     * @Description 行程上报数据导入修改导入任务状态 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					     **/ | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    private void upImportTask(String url, String importTaskId, String staffId, Boolean status) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        //2.更新导入任务数据
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        ImportTaskCommonFormDTO importTaskForm = new ImportTaskCommonFormDTO(); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        importTaskForm.setOperatorId(staffId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        importTaskForm.setBizType(ImportTaskConstants.PS_BIZ_TYPE_IC_TRIP_REPORT); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        importTaskForm.setTaskId(importTaskId); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        importTaskForm.setResultDescFilePath(url); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (status && StringUtils.isBlank(url)) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            importTaskForm.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_SUCCESS); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } else { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            importTaskForm.setProcessStatus(ImportTaskConstants.PROCESS_STATUS_FINISHED_FAIL); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            importTaskForm.setResultDesc("行程上报数据导入存在程序错误"); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        Result result = commonServiceOpenFeignClient.finishImportTask(importTaskForm); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        if (!result.success()) { | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					            throw new RenException(result.getInternalMsg()); | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					        } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					    } | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					
 | 
				
			
			
		
	
		
			
				
					 | 
					 | 
				
				 | 
				
					} | 
				
			
			
		
	
	
		
			
				
					| 
						
						
						
					 | 
				
				 | 
				
					
  |