808917fd 张雷

数据同步问题修复

1 个父辈 2f319ed0
...@@ -8,6 +8,7 @@ import com.skua.modules.system.datestandard.entity.SysMonitorMetricInfo; ...@@ -8,6 +8,7 @@ import com.skua.modules.system.datestandard.entity.SysMonitorMetricInfo;
8 import com.skua.modules.system.datestandard.service.ISysMonitorMetricInfoService; 8 import com.skua.modules.system.datestandard.service.ISysMonitorMetricInfoService;
9 import com.skua.modules.system.service.IPgService; 9 import com.skua.modules.system.service.IPgService;
10 import lombok.extern.slf4j.Slf4j; 10 import lombok.extern.slf4j.Slf4j;
11 import org.apache.commons.lang.StringUtils;
11 import org.quartz.Job; 12 import org.quartz.Job;
12 import org.quartz.JobExecutionContext; 13 import org.quartz.JobExecutionContext;
13 import org.springframework.beans.factory.annotation.Autowired; 14 import org.springframework.beans.factory.annotation.Autowired;
...@@ -35,10 +36,22 @@ public class DayDataSyncJob implements Job { ...@@ -35,10 +36,22 @@ public class DayDataSyncJob implements Job {
35 @Autowired 36 @Autowired
36 private IReportDataService reportDataService; 37 private IReportDataService reportDataService;
37 38
39 /**
40 * 若参数变量名修改 QuartzJobController中也需对应修改
41 */
42 private String parameter;
43
44 public void setParameter(String parameter) {
45 this.parameter = parameter;
46 }
47
38 @Override 48 @Override
39 public void execute(JobExecutionContext jobExecutionContext) { 49 public void execute(JobExecutionContext jobExecutionContext) {
40 log.info("开始同步昨天的数据入报表"); 50 log.info("开始同步昨天的数据入报表");
41 String yesterday = DateUtils.getYesterday(); 51 String yesterday = DateUtils.getYesterday();
52 if(StringUtils.isNotEmpty(this.parameter)){
53 yesterday = this.parameter;
54 }
42 DecimalFormat df = new DecimalFormat("######0.0000"); 55 DecimalFormat df = new DecimalFormat("######0.0000");
43 List<SysFactoryDevice> deviceList = sysFactoryDeviceService.getList(); 56 List<SysFactoryDevice> deviceList = sysFactoryDeviceService.getList();
44 if(deviceList.size() > 0){ 57 if(deviceList.size() > 0){
...@@ -57,7 +70,12 @@ public class DayDataSyncJob implements Job { ...@@ -57,7 +70,12 @@ public class DayDataSyncJob implements Job {
57 } 70 }
58 } 71 }
59 if(!"".equals(fields)){ 72 if(!"".equals(fields)){
60 Map<String, Object> dataMap = pgService.queryDayData(fields, deviceId, yesterday); 73 Map<String, Object> dataMap = new HashMap<>();
74 try{
75 dataMap = pgService.queryDayData(fields, deviceId, yesterday);
76 }catch (Exception e){
77 dataMap = new HashMap<>();
78 }
61 Map<String, String> data = new HashMap<>(); 79 Map<String, String> data = new HashMap<>();
62 if(dataMap.size() != 0){ 80 if(dataMap.size() != 0){
63 if(tagMap.get("CSLL-"+departId)!=null){ 81 if(tagMap.get("CSLL-"+departId)!=null){
......
支持 Markdown 格式
你添加了 0 到此讨论。请谨慎行事。
Finish editing this message first!