| 
					
				 | 
			
			
				@@ -2,10 +2,10 @@ package com.zfire.jiasm.syncdata.download.basedata; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.zfire.jiasm.syncdata.data.Token; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.zfire.jiasm.syncdata.plus.entity.Brand; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.zfire.jiasm.syncdata.plus.entity.ItfGreeToFaDownloadTask; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-import com.zfire.jiasm.syncdata.plus.service.BrandService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.zfire.jiasm.syncdata.plus.entity.ItfGreeToFaSynTaskList; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.zfire.jiasm.syncdata.plus.service.ItfGreeToFaDownloadTaskService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import com.zfire.jiasm.syncdata.plus.service.ItfGreeToFaSynTaskListService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.zfire.jiasm.syncdata.service.MasterDownloadService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.zfire.jiasm.syncdata.utils.TokenCenter; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import lombok.extern.slf4j.Slf4j; 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -29,19 +29,13 @@ public class MasterDownloadTask { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     ItfGreeToFaDownloadTaskService itfGreeToFaDownloadTaskService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Resource 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-    BrandService brandService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    ItfGreeToFaSynTaskListService itfGreeToFaSynTaskListService; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     @Scheduled(fixedDelayString = "${masterdownloadrate}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     public void process() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				         try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            // 提取品牌信息 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            Brand brandRec = brandService.lambdaQuery().eq(Brand::getBrand,"格力").one(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            if (brandRec == null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                log.info("格力品牌信息不存在【brand】"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                return; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             Token token = tokenCenter.getCurrentToken(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             List<ItfGreeToFaDownloadTask> recs = new ArrayList<>(); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -53,13 +47,14 @@ public class MasterDownloadTask { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 int reqId =item.getId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 log.info("开始下载基础资料信息: \uF0B7{}",sdf.format(new Date())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    Integer downloadTaskType = item.getDownloadTaskType(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     String srcTabNames =item.getSrcTabName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     String destTabNames =item.getDestTabName(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     String belongCompany=item.getBelongCompany(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     String[] arySrcTabName = srcTabNames.split("\\Q|\\E"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     String[] aryDestTabName = destTabNames.split("\\Q|\\E"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    masterDownloadService.batchDownload(token, arySrcTabName, aryDestTabName,belongCompany,reqId,brandRec); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    masterDownloadService.batchDownload(token, arySrcTabName, aryDestTabName,belongCompany,reqId,downloadTaskType); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     log.info("格力品牌基础资料信息处理完成: \uF0B7{}",sdf.format(new Date())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } catch (Exception ex) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     log.error("执行基础资料下载任务[" + reqId + "]发生错误:"+ex.getMessage()); 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -71,4 +66,43 @@ public class MasterDownloadTask { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @Scheduled(fixedDelayString = "${masterrate}") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public void processData() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            List<ItfGreeToFaSynTaskList> recs =  itfGreeToFaSynTaskListService.lambdaQuery() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .eq(ItfGreeToFaSynTaskList::getSynTaskType,9002) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    .eq(ItfGreeToFaSynTaskList::getSynStatus,0).list(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            for (ItfGreeToFaSynTaskList item : recs) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                int reqId =item.getId(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                log.info("开始处理基础资料信息: \uF0B7{}",sdf.format(new Date())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                try { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    masterDownloadService.masterProcessData(item.getSynTaskNo(),item.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    log.info("格力品牌基础资料信息处理完成: \uF0B7{}",sdf.format(new Date())); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } catch (Exception ex) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    log.error("执行基础资料处理任务[" + reqId + "]发生错误:"+ex.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    processError(item, ex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } catch (Exception ex) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            log.error("ִ执行基础资料处理发生错误", ex); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    private void processError(ItfGreeToFaSynTaskList item, Exception ex) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        item.setSynTime(new Date()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        item.setSynErrMsg("数据处理失败"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        if (ex.getMessage() !=null){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            if (ex.getMessage().length()>255){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                item.setSynErrMsg(ex.getMessage().substring(0,255)); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } else { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                item.setSynErrMsg(ex.getMessage()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+            } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        itfGreeToFaSynTaskListService.updateById(item); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |