|  |  | @ -149,6 +149,34 @@ public class SpsSyncDownloadService { | 
			
		
	
		
		
			
				
					
					|  |  |  |     @Value("${file_path}") |  |  |  |     @Value("${file_path}") | 
			
		
	
		
		
			
				
					
					|  |  |  |     private String filePath; |  |  |  |     private String filePath; | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * 同步数据 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * @param info       同步设置 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * @param exportType 数据模块类型 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     public void syncData(SyncDataSetResponse info, BasicExportTypeEnum exportType) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         Date now = new Date(); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         switch (exportType) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             case BASIC_DATA: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (needExec(info.getBasicProducts(), info.getBasicCorp(), info.getSupCert())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     basicExportInfoCreate(exportType, now | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             , x -> x.generateBasicDataFile(info, now, false) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             , x -> x.generateBasicDataFile(info, now, true)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 break; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             case OTHER_DATA: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 if (needExec(info.getUdiCodeLost(), info.getUdiCodeRel())) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                     basicExportInfoCreate(exportType, now | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             , x -> x.generateOtherDataFile(info, now, false) | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                             , x -> x.generateOtherDataFile(info, now, true)); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |                 break; | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |             case COUNTRY_DI_DATA: | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     /** |  |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |  |      * 同步基础数据模块 |  |  |  |      * 同步基础数据模块 | 
			
		
	
		
		
			
				
					
					|  |  |  |      * |  |  |  |      * | 
			
		
	
	
		
		
			
				
					|  |  | @ -163,7 +191,7 @@ public class SpsSyncDownloadService { | 
			
		
	
		
		
			
				
					
					|  |  |  |             return; |  |  |  |             return; | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         try { |  |  |  |         try { | 
			
		
	
		
		
			
				
					
					|  |  |  |             basicExportInfoCreate(BasicExportTypeEnum.BASIC_DATA, now, this.getClass() |  |  |  |             basicExportInfoCreate(BasicExportTypeEnum.BASIC_DATA, now | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     , x -> x.generateBasicDataFile(info, now, false) |  |  |  |                     , x -> x.generateBasicDataFile(info, now, false) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     , x -> x.generateBasicDataFile(info, now, true)); |  |  |  |                     , x -> x.generateBasicDataFile(info, now, true)); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } catch (Exception e) { |  |  |  |         } catch (Exception e) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -173,7 +201,7 @@ public class SpsSyncDownloadService { | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     /** |  |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |  |      * TODO 同步其他模块 |  |  |  |      * 同步其他模块 | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |      * |  |  |  |      * | 
			
		
	
		
		
			
				
					
					|  |  |  |      * @param info 同步设置 |  |  |  |      * @param info 同步设置 | 
			
		
	
		
		
			
				
					
					|  |  |  |      */ |  |  |  |      */ | 
			
		
	
	
		
		
			
				
					|  |  | @ -186,7 +214,7 @@ public class SpsSyncDownloadService { | 
			
		
	
		
		
			
				
					
					|  |  |  |             return; |  |  |  |             return; | 
			
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         try { |  |  |  |         try { | 
			
		
	
		
		
			
				
					
					|  |  |  |             basicExportInfoCreate(BasicExportTypeEnum.OTHER_DATA, now, this.getClass() |  |  |  |             basicExportInfoCreate(BasicExportTypeEnum.OTHER_DATA, now | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |                     , x -> x.generateOtherDataFile(info, now, false) |  |  |  |                     , x -> x.generateOtherDataFile(info, now, false) | 
			
		
	
		
		
			
				
					
					|  |  |  |                     , x -> x.generateOtherDataFile(info, now, true)); |  |  |  |                     , x -> x.generateOtherDataFile(info, now, true)); | 
			
		
	
		
		
			
				
					
					|  |  |  |         } catch (Exception e) { |  |  |  |         } catch (Exception e) { | 
			
		
	
	
		
		
			
				
					|  |  | @ -195,6 +223,16 @@ public class SpsSyncDownloadService { | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     } |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  | 
 |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * 判断是否需要执行 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * @param set 需要判断的数据 | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      * @return | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     private boolean needExec(int... set) { | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |         return CollectionUtil.contains(Collections.singleton(set), 2); | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  |     } | 
			
		
	
		
		
			
				
					
					|  |  |  |  |  |  |  | 
 | 
			
		
	
		
		
			
				
					
					|  |  |  |     /** |  |  |  |     /** | 
			
		
	
		
		
			
				
					
					|  |  |  |      * 创建一个同步任务 |  |  |  |      * 创建一个同步任务 | 
			
		
	
		
		
			
				
					
					|  |  |  |      * |  |  |  |      * | 
			
		
	
	
		
		
			
				
					|  |  | @ -202,15 +240,14 @@ public class SpsSyncDownloadService { | 
			
		
	
		
		
			
				
					
					|  |  |  |      * @param hasDataMethod    判断时候有无数据方法 |  |  |  |      * @param hasDataMethod    判断时候有无数据方法 | 
			
		
	
		
		
			
				
					
					|  |  |  |      * @param createFileMethod 执行文件生成方法 |  |  |  |      * @param createFileMethod 执行文件生成方法 | 
			
		
	
		
		
			
				
					
					|  |  |  |      */ |  |  |  |      */ | 
			
		
	
		
		
			
				
					
					|  |  |  |     private void basicExportInfoCreate(BasicExportTypeEnum exportEnum, Date now |  |  |  |     private void basicExportInfoCreate(BasicExportTypeEnum exportEnum, Date now, Function<SpsSyncDownloadService, Boolean> hasDataMethod, Function<SpsSyncDownloadService, Boolean> createFileMethod) { | 
			
				
				
			
		
	
		
		
			
				
					
					|  |  |  |             , Class<? extends SpsSyncDownloadService> clazz, Function<SpsSyncDownloadService, Boolean> hasDataMethod, Function<SpsSyncDownloadService, Boolean> createFileMethod) throws Exception { |  |  |  |  | 
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         //防止出现同时调用问题
 |  |  |  |         //防止出现同时调用问题
 | 
			
		
	
		
		
			
				
					
					|  |  |  |         String redisKey = String.format("spsm-sync-create:%s", exportEnum.getKey()); |  |  |  |         String redisKey = String.format("spsm-sync-create:%s", exportEnum.getKey()); | 
			
		
	
		
		
			
				
					
					|  |  |  |         boolean result = redisUtil.setIfAbsent(redisKey, 1, 10); |  |  |  |         boolean result = redisUtil.setIfAbsent(redisKey, 1, 10); | 
			
		
	
		
		
			
				
					
					|  |  |  |         if (!result) { |  |  |  |         if (!result) { | 
			
		
	
		
		
			
				
					
					|  |  |  |             String errorMsg = String.format("syncIdcSps----process------------同步[%s]重复进入", exportEnum.getRemark()); |  |  |  |             String errorMsg = String.format("syncIdcSps----process------------同步[%s]重复进入", exportEnum.getRemark()); | 
			
		
	
		
		
			
				
					
					|  |  |  | //            logger.info(errorMsg);
 |  |  |  | //            logger.info(errorMsg);
 | 
			
		
	
		
		
			
				
					
					|  |  |  |             throw new Exception(errorMsg); |  |  |  |             throw new RuntimeException(errorMsg); | 
			
				
				
			
		
	
		
		
	
		
		
			
				
					
					|  |  |  |         } |  |  |  |         } | 
			
		
	
		
		
			
				
					
					|  |  |  |         BasicExportStatusEntity exportStatus = basicExportService.getOne(Wrappers.lambdaQuery(BasicExportStatusEntity.class) |  |  |  |         BasicExportStatusEntity exportStatus = basicExportService.getOne(Wrappers.lambdaQuery(BasicExportStatusEntity.class) | 
			
		
	
		
		
			
				
					
					|  |  |  |                 .eq(BasicExportStatusEntity::getType, BasicExportTypeEnum.BASIC_DATA.getRemark()) |  |  |  |                 .eq(BasicExportStatusEntity::getType, BasicExportTypeEnum.BASIC_DATA.getRemark()) | 
			
		
	
	
		
		
			
				
					|  |  | 
 |