浏览代码

添加获取数据异常日志

wangchenghong 3 年之前
父节点
当前提交
5893f25252

+ 3 - 1
src/main/java/com/persagy/apm/energy/report/common/service/impl/BianSunDataAnalysisPlatformServiceImpl.java

@@ -9,6 +9,7 @@ import com.persagy.apm.energy.report.common.utils.DateUtils;
 import com.persagy.apm.energy.report.common.utils.HttpUtils;
 import com.persagy.apm.energy.report.common.vo.PlatformAreaInfoVO;
 import com.persagy.apm.energy.report.monthly.config.statisticsitems.model.StatisticItems;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
@@ -18,6 +19,7 @@ import java.util.*;
 import java.util.stream.Collectors;
 
 @Service("bianSunRateDataAnalysisWebService")
+@Slf4j
 public class BianSunDataAnalysisPlatformServiceImpl implements PlatformService {
     @Value("${iot.data.analysis.url}")
     private String iotDataAnalysisUrl;
@@ -68,7 +70,7 @@ public class BianSunDataAnalysisPlatformServiceImpl implements PlatformService {
                 }
             }
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error("获取数据质量服务变损数据异常", e);
         }
         return rate;
     }

+ 3 - 1
src/main/java/com/persagy/apm/energy/report/common/service/impl/EnvironmentPlatformServiceImpl.java

@@ -12,6 +12,7 @@ import com.persagy.apm.energy.report.environment.model.dto.QueryEnvListByParamDT
 import com.persagy.apm.energy.report.environment.model.vo.EnvAvgRateVO;
 import com.persagy.apm.energy.report.environment.service.impl.EnvironmentWebClientWrapper;
 import com.persagy.apm.energy.report.monthly.config.statisticsitems.model.StatisticItems;
+import lombok.extern.slf4j.Slf4j;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
@@ -24,6 +25,7 @@ import java.util.TreeMap;
 import java.util.stream.Collectors;
 
 @Service("TemperatureRateEnvironmentWebService")
+@Slf4j
 public class EnvironmentPlatformServiceImpl implements PlatformService {
 
     @Autowired
@@ -66,7 +68,7 @@ public class EnvironmentPlatformServiceImpl implements PlatformService {
                 }
             }
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error("获取环境健康服务温度达标率数据异常", e);
         }
         return avgRate;
     }

+ 6 - 4
src/main/java/com/persagy/apm/energy/report/common/service/impl/WorkOrderPlatformServiceImpl.java

@@ -9,6 +9,7 @@ import com.persagy.apm.energy.report.common.vo.PlatformAreaInfoVO;
 import com.persagy.apm.energy.report.monthly.config.statisticsitems.model.StatisticItems;
 import com.persagy.apm.energy.report.workorder.model.WorkOrder;
 import com.persagy.apm.energy.report.workorder.repository.WorkOrderRepository;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.lang.StringUtils;
 import org.elasticsearch.index.query.BoolQueryBuilder;
 import org.elasticsearch.index.query.QueryBuilders;
@@ -27,6 +28,7 @@ import java.util.TreeMap;
 import java.util.stream.Collectors;
 
 @Service("OrderCompleteRateWorkOrderWebService")
+@Slf4j
 public class WorkOrderPlatformServiceImpl implements PlatformService {
 
     @Resource
@@ -56,12 +58,12 @@ public class WorkOrderPlatformServiceImpl implements PlatformService {
         try {
             Integer workCount = getWorkOrderNumByParam(projectId, reportDate, "ask_end_time");
             Integer dealCount = getWorkOrderNumByParam(projectId, reportDate, "create_time");
-            if (null != workCount && workCount != 0) {
-                completeRate = Double.valueOf(dealCount) / workCount * 100;
+            if (null != workCount && workCount != 0 && null != dealCount) {
+                completeRate = DataUtils.parseDouble(dealCount) / workCount * 100;
             }
             return completeRate;
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error("计算工单完成率异常", e);
         }
         return completeRate;
     }
@@ -79,7 +81,7 @@ public class WorkOrderPlatformServiceImpl implements PlatformService {
                 return resultList.getSize();
             }
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error("获取工单数据异常", e);
         }
         return null;
     }

+ 4 - 1
src/main/java/com/persagy/apm/energy/report/common/service/impl/ZongZhiDataAnalysisPlatformServiceImpl.java

@@ -9,6 +9,7 @@ import com.persagy.apm.energy.report.common.utils.DateUtils;
 import com.persagy.apm.energy.report.common.utils.HttpUtils;
 import com.persagy.apm.energy.report.common.vo.PlatformAreaInfoVO;
 import com.persagy.apm.energy.report.monthly.config.statisticsitems.model.StatisticItems;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
 import org.springframework.beans.factory.annotation.Value;
 import org.springframework.stereotype.Service;
@@ -18,7 +19,9 @@ import java.util.*;
 import java.util.stream.Collectors;
 
 @Service("zongZhiRateDataAnalysisWebService")
+@Slf4j
 public class ZongZhiDataAnalysisPlatformServiceImpl implements PlatformService {
+
     @Value("${iot.data.analysis.url}")
     private String iotDataAnalysisUrl;
 
@@ -68,7 +71,7 @@ public class ZongZhiDataAnalysisPlatformServiceImpl implements PlatformService {
                 }
             }
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error("获取数据质量服务总支不平衡数据异常", e);
         }
         return rate;
     }

+ 4 - 2
src/main/java/com/persagy/apm/energy/report/manualfilling/service/impl/IEnergyItemDataServiceImpl.java

@@ -18,6 +18,7 @@ import com.persagy.apm.energy.report.monthly.functionvalue.model.dto.QueryFuncti
 import com.persagy.apm.energy.report.monthly.functionvalue.service.IFunctionValueService;
 import com.persagy.apm.energy.report.saasweb.model.vo.ReportProjectVO;
 import com.persagy.apm.energy.report.saasweb.service.ISaasWebService;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.lang.StringUtils;
 import org.assertj.core.util.Lists;
@@ -28,6 +29,7 @@ import org.springframework.stereotype.Service;
 import java.util.*;
 
 @Service
+@Slf4j
 public class IEnergyItemDataServiceImpl implements IEnergyItemDataService {
 
     @Autowired
@@ -106,7 +108,7 @@ public class IEnergyItemDataServiceImpl implements IEnergyItemDataService {
             }
             return resultList;
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error("查询分项数据异常",e);
         }
         return Lists.newArrayList();
     }
@@ -149,7 +151,7 @@ public class IEnergyItemDataServiceImpl implements IEnergyItemDataService {
                 functionValueService.batchCreateFunctionValue(functionValues);
             }
         } catch (Exception e) {
-            e.printStackTrace();
+            log.error("保存分项录入数据异常",e);
         }
     }