|  |  | @ -15,6 +15,7 @@ import com.glxp.api.entity.purchase.*; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.entity.sync.BasicExportStatusEntity; |  |  |  | import com.glxp.api.entity.sync.BasicExportStatusEntity; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.entity.sync.BasicExportStatusTimeEntity; |  |  |  | import com.glxp.api.entity.sync.BasicExportStatusTimeEntity; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.entity.sync.SyncDataBustypeEntity; |  |  |  | import com.glxp.api.entity.sync.SyncDataBustypeEntity; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.glxp.api.entity.thrsys.ThrBusTypeOriginEntity; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.req.basic.ProductInfoFilterRequest; |  |  |  | import com.glxp.api.req.basic.ProductInfoFilterRequest; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.req.basic.UdiCompanyRequest; |  |  |  | import com.glxp.api.req.basic.UdiCompanyRequest; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.req.inout.FilterOrderRequest; |  |  |  | import com.glxp.api.req.inout.FilterOrderRequest; | 
			
		
	
	
		
		
			
				
					|  |  | @ -25,6 +26,7 @@ import com.glxp.api.res.system.SyncDataSetResponse; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.basic.*; |  |  |  | import com.glxp.api.service.basic.*; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.inout.*; |  |  |  | import com.glxp.api.service.inout.*; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.service.purchase.*; |  |  |  | import com.glxp.api.service.purchase.*; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | import com.glxp.api.service.thrsys.IThrBusTypeOriginService; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.util.CustomUtil; |  |  |  | import com.glxp.api.util.CustomUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.util.DateUtil; |  |  |  | import com.glxp.api.util.DateUtil; | 
			
		
	
		
		
			
				
					
					|  |  |  | import com.glxp.api.util.JsonUtils; |  |  |  | import com.glxp.api.util.JsonUtils; | 
			
		
	
	
		
		
			
				
					|  |  | @ -174,6 +176,13 @@ public class SpsSyncDownloadService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                             , x -> x.generateOtherDataFile(info, now, true)); |  |  |  |                             , x -> x.generateOtherDataFile(info, now, true)); | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 break; |  |  |  |                 break; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             case DOCUMENT_TYPE_DATA: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (needExec(info.getTypeBus(), info.getTypeScan(), info.getTypeThird())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     basicExportInfoCreate(exportType, now | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             , x -> x.generateDocumentTypeDataFile(info, now, false) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             , x -> x.generateDocumentTypeDataFile(info, now, true)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 break; | 
			
		
	
		
		
			
				
					
					|  |  |  |             case COUNTRY_DI_DATA: |  |  |  |             case COUNTRY_DI_DATA: | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
	
		
		
			
				
					|  |  | @ -291,6 +300,7 @@ public class SpsSyncDownloadService { | 
			
		
	
		
		
			
				
					
					|  |  |  |      * @return 是否有数据 true/false  有新数据/无新数据 |  |  |  |      * @return 是否有数据 true/false  有新数据/无新数据 | 
			
		
	
		
		
			
				
					
					|  |  |  |      */ |  |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |  |     protected boolean generateBasicDataFile(SyncDataSetResponse info, Date now, boolean createFile) { |  |  |  |     protected boolean generateBasicDataFile(SyncDataSetResponse info, Date now, boolean createFile) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         BasicExportTypeEnum exportType = BasicExportTypeEnum.BASIC_DATA; | 
			
		
	
		
		
			
				
					
					|  |  |  |         //文件数据
 |  |  |  |         //文件数据
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         Map<String, List> jsonMap = new WeakHashMap<>(4); |  |  |  |         Map<String, List> jsonMap = new WeakHashMap<>(4); | 
			
		
	
		
		
			
				
					
					|  |  |  |         Map<BasicExportStatusTimeEnum, Map<String, Object>> totalTimeMap = new WeakHashMap<>(10); |  |  |  |         Map<BasicExportStatusTimeEnum, Map<String, Object>> totalTimeMap = new WeakHashMap<>(10); | 
			
		
	
	
		
		
			
				
					|  |  | @ -398,7 +408,7 @@ public class SpsSyncDownloadService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     return true; |  |  |  |                     return true; | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 try { |  |  |  |                 try { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     String fileFullPath = writeFile(filePath, BasicExportTypeEnum.BASIC_DATA.getRemark(), JsonUtils.toJsonString(jsonMap)); |  |  |  |                     String fileFullPath = writeFile(filePath, exportType.getRemark(), JsonUtils.toJsonString(jsonMap)); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     //计算总数
 |  |  |  |                     //计算总数
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                     int total = 0; |  |  |  |                     int total = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |                     for (List l : jsonMap.values()) { |  |  |  |                     for (List l : jsonMap.values()) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -406,25 +416,17 @@ public class SpsSyncDownloadService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |                     try { |  |  |  |                     try { | 
			
		
	
		
		
			
				
					
					|  |  |  |                         //修改任务数据
 |  |  |  |                         //修改任务数据
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                         boolean update = basicExportService.update(Wrappers.lambdaUpdate(BasicExportStatusEntity.class) |  |  |  |                         boolean update = updateExportStatus(exportType, fileFullPath, total); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 .set(BasicExportStatusEntity::getStatus, BasicExportStatusEnum.WAIT_SYNC.getCode()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 .set(BasicExportStatusEntity::getUpdateTime, new Date()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 .set(BasicExportStatusEntity::getCacheFilePath, fileFullPath) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 .set(BasicExportStatusEntity::getRemark, String.format("%s: %s条", BasicExportTypeEnum.BASIC_DATA.getRemark(), total)) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 .eq(BasicExportStatusEntity::getType, BasicExportTypeEnum.BASIC_DATA.getRemark()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 .eq(BasicExportStatusEntity::getStatus, BasicExportStatusEnum.WAIT_BUILT.getCode()) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                                 .isNull(BasicExportStatusEntity::getCacheFilePath) |  |  |  |  | 
			
		
	
		
		
			
				
					
					|  |  |  |                         ); |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     } catch (Exception e) { |  |  |  |                     } catch (Exception e) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                         // 异常回滚
 |  |  |  |                         // 异常回滚
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                         this.exportTimeRollback(totalTimeMap, BasicExportTypeEnum.BASIC_DATA, fileFullPath); |  |  |  |                         this.exportTimeRollback(totalTimeMap, exportType, fileFullPath); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |                     return true; |  |  |  |                     return true; | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } catch (IOException e) { |  |  |  |                 } catch (IOException e) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     logger.error(String.format("syncIdcSps----process------------生成[%s]文件及更改库操作异常,异常信息<%s>" |  |  |  |                     logger.error(String.format("syncIdcSps----process------------生成[%s]文件及更改库操作异常,异常信息<%s>" | 
			
		
	
		
		
			
				
					
					|  |  |  |                             , BasicExportTypeEnum.BASIC_DATA.getRemark(), e.getMessage())); |  |  |  |                             , exportType.getRemark(), e.getMessage())); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     // 异常回滚
 |  |  |  |                     // 异常回滚
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                     this.exportTimeRollback(totalTimeMap, BasicExportTypeEnum.BASIC_DATA, null); |  |  |  |                     this.exportTimeRollback(totalTimeMap, exportType, null); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             return false; |  |  |  |             return false; | 
			
		
	
	
		
		
			
				
					|  |  | @ -448,6 +450,7 @@ public class SpsSyncDownloadService { | 
			
		
	
		
		
			
				
					
					|  |  |  |      * @return 是否有数据 true/false  有新数据/无新数据 |  |  |  |      * @return 是否有数据 true/false  有新数据/无新数据 | 
			
		
	
		
		
			
				
					
					|  |  |  |      */ |  |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |  |     protected boolean generateOtherDataFile(SyncDataSetResponse info, Date now, boolean createFile) { |  |  |  |     protected boolean generateOtherDataFile(SyncDataSetResponse info, Date now, boolean createFile) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         BasicExportTypeEnum exportType = BasicExportTypeEnum.OTHER_DATA; | 
			
		
	
		
		
			
				
					
					|  |  |  |         //文件数据
 |  |  |  |         //文件数据
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         Map<String, List> jsonMap = new WeakHashMap<>(4); |  |  |  |         Map<String, List> jsonMap = new WeakHashMap<>(4); | 
			
		
	
		
		
			
				
					
					|  |  |  |         Map<BasicExportStatusTimeEnum, Map<String, Object>> totalTimeMap = new WeakHashMap<>(10); |  |  |  |         Map<BasicExportStatusTimeEnum, Map<String, Object>> totalTimeMap = new WeakHashMap<>(10); | 
			
		
	
	
		
		
			
				
					|  |  | @ -485,7 +488,7 @@ public class SpsSyncDownloadService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     return true; |  |  |  |                     return true; | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |                 try { |  |  |  |                 try { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     String fileFullPath = writeFile(filePath, BasicExportTypeEnum.OTHER_DATA.getRemark(), JsonUtils.toJsonString(jsonMap)); |  |  |  |                     String fileFullPath = writeFile(filePath, exportType.getRemark(), JsonUtils.toJsonString(jsonMap)); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     //计算总数
 |  |  |  |                     //计算总数
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                     int total = 0; |  |  |  |                     int total = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |                     for (List l : jsonMap.values()) { |  |  |  |                     for (List l : jsonMap.values()) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -493,25 +496,110 @@ public class SpsSyncDownloadService { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |                     try { |  |  |  |                     try { | 
			
		
	
		
		
			
				
					
					|  |  |  |                         //修改任务数据
 |  |  |  |                         //修改任务数据
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                         boolean update = basicExportService.update(Wrappers.lambdaUpdate(BasicExportStatusEntity.class) |  |  |  |                         boolean update = updateExportStatus(exportType, fileFullPath, total); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 .set(BasicExportStatusEntity::getStatus, BasicExportStatusEnum.WAIT_SYNC.getCode()) |  |  |  |                     } catch (Exception e) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 .set(BasicExportStatusEntity::getUpdateTime, new Date()) |  |  |  |                         // 异常回滚
 | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 .set(BasicExportStatusEntity::getCacheFilePath, fileFullPath) |  |  |  |                         this.exportTimeRollback(totalTimeMap, exportType, fileFullPath); | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 .set(BasicExportStatusEntity::getRemark, String.format("%s: %s条", BasicExportTypeEnum.OTHER_DATA.getRemark(), total)) |  |  |  |                     } | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 .eq(BasicExportStatusEntity::getType, BasicExportTypeEnum.OTHER_DATA.getRemark()) |  |  |  |                     return true; | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 .eq(BasicExportStatusEntity::getStatus, BasicExportStatusEnum.WAIT_BUILT.getCode()) |  |  |  |                 } catch (IOException e) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |                                 .isNull(BasicExportStatusEntity::getCacheFilePath) |  |  |  |                     logger.error(String.format("syncIdcSps----process------------生成[%s]文件及更改库操作异常,异常信息<%s>" | 
			
				
				
			
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             , exportType.getRemark(), e.getMessage())); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     // 异常回滚
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     this.exportTimeRollback(totalTimeMap, exportType, null); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return false; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } catch (Exception e) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             logger.error(e.getMessage()); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             return false; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private final IBasicBussinessTypeService bussinessTypeService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private final IBasicBusTypeChangeService busTypeChangeService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private final IThrBusTypeOriginService thrBusTypeOriginService; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * 读取单据类型数据,创建文件 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * @param info       同步设置信息 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * @param now        当前时间 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * @param createFile 是否创建文件 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * @return 是否有数据 true/false  有新数据/无新数据 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     protected boolean generateDocumentTypeDataFile(SyncDataSetResponse info, Date now, boolean createFile) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         BasicExportTypeEnum exportType = BasicExportTypeEnum.DOCUMENT_TYPE_DATA; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         //文件数据
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Map<String, List> jsonMap = new WeakHashMap<>(4); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Map<BasicExportStatusTimeEnum, Map<String, Object>> totalTimeMap = new WeakHashMap<>(10); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         try { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             //确认有开启业务单据类型同步
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (needExec(info.getTypeBus())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.BASIC_BUSSINESS_TYPE, createFile); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 totalTimeMap.put(BasicExportStatusTimeEnum.BASIC_BUSSINESS_TYPE, map); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 List<BasicBussinessTypeEntity> ioCodeLostList = bussinessTypeService.list(Wrappers.lambdaQuery(BasicBussinessTypeEntity.class) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         .le((boolean) map.get("isNew"), BasicBussinessTypeEntity::getUpdateTime, now) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         .between(!(boolean) map.get("isNew"), BasicBussinessTypeEntity::getUpdateTime | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 , map.get("oldDate"), now) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 ); |  |  |  |                 ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (CollectionUtil.isNotEmpty(ioCodeLostList)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     jsonMap.put(BasicBussinessTypeEntity.class.getSimpleName(), ioCodeLostList); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             //确认有开启扫码单据类型同步
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (needExec(info.getTypeScan())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.BASIC_BUSTYPE_CHANGE, createFile); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 totalTimeMap.put(BasicExportStatusTimeEnum.BASIC_BUSTYPE_CHANGE, map); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 List<BasicBusTypeChangeEntity> ioCodeRelList = busTypeChangeService.list(Wrappers.lambdaQuery(BasicBusTypeChangeEntity.class) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         .le((boolean) map.get("isNew"), BasicBusTypeChangeEntity::getUpdateTime, now) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         .between(!(boolean) map.get("isNew"), BasicBusTypeChangeEntity::getUpdateTime | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 , map.get("oldDate"), now) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (CollectionUtil.isNotEmpty(ioCodeRelList)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     jsonMap.put(BasicBusTypeChangeEntity.class.getSimpleName(), ioCodeRelList); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             //确认有开启第三方单据类型同步
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (needExec(info.getTypeThird())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 Map<String, Object> map = basicExportStatusTimeInfo(now, BasicExportStatusTimeEnum.THR_BUSTYPE_ORIGIN, createFile); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 totalTimeMap.put(BasicExportStatusTimeEnum.THR_BUSTYPE_ORIGIN, map); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 List<ThrBusTypeOriginEntity> ioCodeRelList = thrBusTypeOriginService.list(Wrappers.lambdaQuery(ThrBusTypeOriginEntity.class) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         .le((boolean) map.get("isNew"), ThrBusTypeOriginEntity::getUpdateTime, now) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         .between(!(boolean) map.get("isNew"), ThrBusTypeOriginEntity::getUpdateTime | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                                 , map.get("oldDate"), now) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (CollectionUtil.isNotEmpty(ioCodeRelList)) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     jsonMap.put(ThrBusTypeOriginEntity.class.getSimpleName(), ioCodeRelList); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             if (jsonMap.size() > 0) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (!createFile) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     return true; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 try { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     String fileFullPath = writeFile(filePath, exportType.getRemark(), JsonUtils.toJsonString(jsonMap)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     //计算总数
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     int total = 0; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     for (List l : jsonMap.values()) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         total += l.size(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     try { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         //修改任务数据
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                         boolean update = updateExportStatus(exportType, fileFullPath, total); | 
			
		
	
		
		
			
				
					
					|  |  |  |                     } catch (Exception e) { |  |  |  |                     } catch (Exception e) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                         // 异常回滚
 |  |  |  |                         // 异常回滚
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                         this.exportTimeRollback(totalTimeMap, BasicExportTypeEnum.OTHER_DATA, fileFullPath); |  |  |  |                         this.exportTimeRollback(totalTimeMap, exportType, fileFullPath); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     } |  |  |  |                     } | 
			
		
	
		
		
			
				
					
					|  |  |  |                     return true; |  |  |  |                     return true; | 
			
		
	
		
		
			
				
					
					|  |  |  |                 } catch (IOException e) { |  |  |  |                 } catch (IOException e) { | 
			
		
	
		
		
			
				
					
					|  |  |  |                     logger.error(String.format("syncIdcSps----process------------生成[%s]文件及更改库操作异常,异常信息<%s>" |  |  |  |                     logger.error(String.format("syncIdcSps----process------------生成[%s]文件及更改库操作异常,异常信息<%s>" | 
			
		
	
		
		
			
				
					
					|  |  |  |                             , BasicExportTypeEnum.OTHER_DATA.getRemark(), e.getMessage())); |  |  |  |                             , exportType.getRemark(), e.getMessage())); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     // 异常回滚
 |  |  |  |                     // 异常回滚
 | 
			
		
	
		
		
			
				
					
					|  |  |  |                     this.exportTimeRollback(totalTimeMap, BasicExportTypeEnum.OTHER_DATA, null); |  |  |  |                     this.exportTimeRollback(totalTimeMap, exportType, null); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                 } |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |             } |  |  |  |             } | 
			
		
	
		
		
			
				
					
					|  |  |  |             return false; |  |  |  |             return false; | 
			
		
	
	
		
		
			
				
					|  |  | @ -571,6 +659,27 @@ public class SpsSyncDownloadService { | 
			
		
	
		
		
			
				
					
					|  |  |  |         return returnMap; |  |  |  |         return returnMap; | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * 修改任务数据 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * @param exportType 任务类型 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * @param fileFullPath 文件地址 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * @param total 总条数 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * @return 更新结果 true/false | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private boolean updateExportStatus(BasicExportTypeEnum exportType, String fileFullPath, Integer total) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return basicExportService.update(Wrappers.lambdaUpdate(BasicExportStatusEntity.class) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .set(BasicExportStatusEntity::getStatus, BasicExportStatusEnum.WAIT_SYNC.getCode()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .set(BasicExportStatusEntity::getUpdateTime, new Date()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .set(BasicExportStatusEntity::getCacheFilePath, fileFullPath) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .set(total != null, BasicExportStatusEntity::getRemark, String.format("%s: %s条", exportType.getRemark(), total)) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .eq(BasicExportStatusEntity::getType, exportType.getRemark()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .eq(BasicExportStatusEntity::getStatus, BasicExportStatusEnum.WAIT_BUILT.getCode()) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 .isNull(BasicExportStatusEntity::getCacheFilePath) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         ); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     /** |  |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |  |      * 异常回滚操作 |  |  |  |      * 异常回滚操作 | 
			
		
	
		
		
			
				
					
					|  |  |  |      * |  |  |  |      * | 
			
		
	
	
		
		
			
				
					|  |  | 
 |