Kaynağa Gözat

增加一个租户报错的日志打印并跳过报错的租户计算

luoguangyi 2 yıl önce
ebeveyn
işleme
4afe7351bb

+ 1 - 1
src/main/java/com/sagacloud/util/compute_engine/core/CoreComputeUtil.java

@@ -657,7 +657,7 @@ public class CoreComputeUtil {
             if ("expression".equals(output.mode)) {
                 if (output.expression != null) {
                     try {
-                        log.info("startExpression:{},完整信息[{}] ",output.expression, JSON.toJSONString(output));
+                        log.debug("startExpression:{},完整信息[{}] ",output.expression, JSON.toJSONString(output));
                         output.root = String2Grammar.Generate(output.expression);
                     } catch (Exception e) {
                         log.error("Error expression:" + instance.object_sign + "_" + instance.instance_name + "\t" + output.output_sign + "\t" + output.expression);

+ 7 - 1
src/main/java/com/sagacloud/util/compute_engine/fjd/TenantUtil.java

@@ -1,5 +1,6 @@
 package com.sagacloud.util.compute_engine.fjd;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
 import com.sagacloud.util.compute_engine.core.CoreInput;
@@ -7,11 +8,12 @@ import com.sagacloud.util.compute_engine.core.CoreInstance;
 import com.sagacloud.util.compute_engine.core.CoreOutput;
 import com.sagacloud.util.compute_engine.entity.*;
 import com.sagacloud.util.compute_engine.util.QueryUtil;
+import lombok.extern.slf4j.Slf4j;
 import org.zillion.util.json.FastJsonReaderUtil;
 import org.zillion.util.json.FastJsonUtil;
 
 import java.util.*;
-
+@Slf4j
 public class TenantUtil {
     public static List<Long> get_funcid(String energy_type, String price_type, Map<String, Entity_point> pointMap,
                                         Entity_tenant_energy_meter detail) {
@@ -202,6 +204,10 @@ public class TenantUtil {
                         if (inputMap.containsKey(detail.getMeter_sign() + "_" + funcid)) {
                             continue;
                         }
+                        if(!pointMap.containsKey(detail.getMeter_sign() + "_" + funcid)){
+                            log.error("[dy_pointlist]没有要计算的meter[{}] funcid[{}],Entity_tenant_energy_meter详情:[{}]",detail.getMeter_sign(),funcid, JSON.toJSONString(detail));
+                            continue;
+                        }
                         Entity_ci_instanceinput input = new Entity_ci_instanceinput();
                         input.setObject_sign(object_sign);
                         input.setInstance_name(instance_name);

+ 5 - 0
src/main/java/com/sagacloud/util/compute_engine/fjd/ThreadCompute.java

@@ -205,6 +205,7 @@ public class ThreadCompute extends Thread {
                         }
                     }
                 } catch (Exception e) {
+                    log.warn(e.getMessage(), e);
                     throw e;
                 } finally {
                     // 释放锁
@@ -290,6 +291,10 @@ public class ThreadCompute extends Thread {
             ci_instance.setOutputs(outputList.toArray(new Entity_ci_instanceoutput[0]));
         } else if (instance_name.startsWith("fjd_1")) {
             ci_instance = InstanceUtil.Get(ConstantCE.database_name, object_sign, "fjd_0" + instance_name.substring("fjd_0".length()));
+            if (ci_instance == null) {
+                log.error(name + " not exist in db!");
+                throw new Exception(name + " not exist in db!");
+            }
             ci_instance.setInstance_name(instance_name);
         }
         if (ci_instance == null) {