|
@@ -1,51 +1,520 @@
|
|
|
-//package com.gyee.generation.processors;
|
|
|
-//
|
|
|
-//import com.alibaba.fastjson.JSON;
|
|
|
-//import com.alibaba.fastjson.TypeReference;
|
|
|
-//import lombok.extern.slf4j.Slf4j;
|
|
|
-//import org.springframework.stereotype.Component;
|
|
|
-//import tech.powerjob.official.processors.CommonBasicProcessor;
|
|
|
-//import tech.powerjob.worker.core.processor.ProcessResult;
|
|
|
-//import tech.powerjob.worker.core.processor.TaskContext;
|
|
|
-//import tech.powerjob.worker.core.processor.WorkflowContext;
|
|
|
-//import tech.powerjob.worker.log.OmsLogger;
|
|
|
-//
|
|
|
-//import java.util.HashMap;
|
|
|
-//import java.util.Map;
|
|
|
-//
|
|
|
-///**
|
|
|
-// * @description: 工作流调度任务测试
|
|
|
-// * @author: shilin
|
|
|
-// * @date: 2024/5/29 9:19
|
|
|
-// * @param:
|
|
|
-// * @return:
|
|
|
-// **/
|
|
|
-//@Slf4j
|
|
|
-//@Component("testBaseProcessor")
|
|
|
-//public class StandaloneProcessorDemo extends CommonBasicProcessor {
|
|
|
-//
|
|
|
-// @Override
|
|
|
-// protected ProcessResult process0(TaskContext taskContext) {
|
|
|
-//
|
|
|
-// String jobParams = taskContext.getJobParams();
|
|
|
-// OmsLogger omsLogger = taskContext.getOmsLogger();
|
|
|
-// try {
|
|
|
-// HashMap<String, Object> data = JSON.parseObject(jobParams, new TypeReference<HashMap<String, Object>>() {
|
|
|
-// });
|
|
|
-// WorkflowContext workflowContext = taskContext.getWorkflowContext();
|
|
|
-// for (Map.Entry<String, Object> entry : data.entrySet()) {
|
|
|
-// workflowContext.appendData2WfContext(entry.getKey(), entry.getValue());
|
|
|
-// omsLogger.info("inject context, {}:{}", entry.getKey(), entry.getValue());
|
|
|
-// }
|
|
|
-//
|
|
|
-// workflowContext.appendData2WfContext("test1", 1);
|
|
|
-//// workflowContext.appendData2WfContext("test2", "2");
|
|
|
-//// workflowContext.appendData2WfContext("test3", new Date());
|
|
|
-//// workflowContext.appendData2WfContext("test4", true);
|
|
|
-// } catch (Exception e) {
|
|
|
-// omsLogger.error("Fail to parse job params:{},it is not a valid json string!", jobParams, e);
|
|
|
-// return new ProcessResult(false);
|
|
|
-// }
|
|
|
-// return new ProcessResult(true);
|
|
|
-// }
|
|
|
-//}
|
|
|
+package com.gyee.generation.processors;
|
|
|
+
|
|
|
+import cn.hutool.core.util.ObjectUtil;
|
|
|
+import cn.hutool.core.util.RandomUtil;
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.TypeReference;
|
|
|
+import com.gyee.generation.init.CacheContext;
|
|
|
+import com.gyee.generation.model.auto.*;
|
|
|
+import com.gyee.generation.util.realtimesource.TaosUtil;
|
|
|
+import com.gyee.generation.util.rule.AlarmFunction;
|
|
|
+import com.gyee.generation.util.rule.expression.*;
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.springframework.stereotype.Component;
|
|
|
+import tech.powerjob.official.processors.CommonBasicProcessor;
|
|
|
+import tech.powerjob.worker.core.processor.ProcessResult;
|
|
|
+import tech.powerjob.worker.core.processor.TaskContext;
|
|
|
+import tech.powerjob.worker.core.processor.WorkflowContext;
|
|
|
+import tech.powerjob.worker.log.OmsLogger;
|
|
|
+
|
|
|
+import java.sql.Timestamp;
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+
|
|
|
+/**
|
|
|
+ * @description: 工作流调度任务测试
|
|
|
+ * @author: shilin
|
|
|
+ * @date: 2024/5/29 9:19
|
|
|
+ * @param:
|
|
|
+ * @return:
|
|
|
+ **/
|
|
|
+@Slf4j
|
|
|
+@Component("testBaseProcessor")
|
|
|
+public class StandaloneProcessorDemo extends CommonBasicProcessor {
|
|
|
+
|
|
|
+ @Resource
|
|
|
+ private TaosUtil taosUtil;
|
|
|
+ @Override
|
|
|
+ protected ProcessResult process0(TaskContext taskContext) {
|
|
|
+
|
|
|
+ String jobParams = taskContext.getJobParams();
|
|
|
+ OmsLogger omsLogger = taskContext.getOmsLogger();
|
|
|
+ try {
|
|
|
+ HashMap<String, Object> data = JSON.parseObject(jobParams, new TypeReference<HashMap<String, Object>>() {
|
|
|
+ });
|
|
|
+
|
|
|
+ String formula=null;
|
|
|
+ String range=null;
|
|
|
+ String type=null;
|
|
|
+ String result=null;
|
|
|
+ String points=null;
|
|
|
+ String value=null;
|
|
|
+
|
|
|
+ WorkflowContext workflowContext = taskContext.getWorkflowContext();
|
|
|
+
|
|
|
+ for (Map.Entry<String, Object> entry : data.entrySet()) {
|
|
|
+
|
|
|
+ if(entry.getKey().equals("formula"))
|
|
|
+ {
|
|
|
+ formula=(String)entry.getValue();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(entry.getKey().equals("range"))
|
|
|
+ {
|
|
|
+ range=(String)entry.getValue();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(entry.getKey().equals("type"))
|
|
|
+ {
|
|
|
+ type=(String)entry.getValue();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(entry.getKey().equals("result"))
|
|
|
+ {
|
|
|
+ result=(String)entry.getValue();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(entry.getKey().equals("points"))
|
|
|
+ {
|
|
|
+ points=(String)entry.getValue();
|
|
|
+ }
|
|
|
+
|
|
|
+ if(entry.getKey().equals("value"))
|
|
|
+ {
|
|
|
+ value=(String)entry.getValue();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ List<PointDataTaos> pointDataTaosLs=new ArrayList();
|
|
|
+
|
|
|
+ if(ObjectUtil.isNotEmpty(type) && StrUtil.isNotEmpty(type))
|
|
|
+ {
|
|
|
+ if(TypeValue.ASSIGN.getCode().equals(type))
|
|
|
+ {
|
|
|
+ assign(points,range, result,value, pointDataTaosLs);
|
|
|
+ }else if(TypeValue.BASIC.getCode().equals(type))
|
|
|
+ {
|
|
|
+ if(FunctionValue.RFDL.getCode().equals(result))
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
+ }else if(TypeValue.CUSTOM.getCode().equals(type))
|
|
|
+ {
|
|
|
+ AlarmExpression alarmExpression = Analyzer.getAlarmExpression(formula);
|
|
|
+ custom(range, result, alarmExpression, pointDataTaosLs);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ workflowContext.appendData2WfContext("resultValue", "ok!");
|
|
|
+
|
|
|
+
|
|
|
+ } catch (Exception e) {
|
|
|
+ omsLogger.error("Fail to parse job params:{},it is not a valid json string!", jobParams, e,"error!");
|
|
|
+ return new ProcessResult(false);
|
|
|
+ }
|
|
|
+ return new ProcessResult(true);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void assign(String points,String range, String result,String value, List<PointDataTaos> pointDataTaosLs) {
|
|
|
+
|
|
|
+
|
|
|
+ if(ObjectUtil.isNotEmpty(points) && StrUtil.isNotEmpty(points) && ObjectUtil.isNotEmpty(value) && StrUtil.isNotEmpty(value))
|
|
|
+ {
|
|
|
+ String[] pointids= points.split(",");
|
|
|
+ List<String> ls = Arrays.asList(pointids);
|
|
|
+
|
|
|
+ for(String id:ls)
|
|
|
+ {
|
|
|
+
|
|
|
+ PointDataTaos pt=new PointDataTaos();
|
|
|
+ pt.setId(id);
|
|
|
+ pt.setTs(new Timestamp(System.currentTimeMillis()));
|
|
|
+ pt.setVal(Double.valueOf(value));
|
|
|
+ pt.setMetric(1);
|
|
|
+ pointDataTaosLs.add(pt);
|
|
|
+ }
|
|
|
+ }else if(ObjectUtil.isNotEmpty(range) && StrUtil.isNotEmpty(range))
|
|
|
+ {
|
|
|
+ String[] ranges= range.split(",");
|
|
|
+ List<String> ls = Arrays.asList(ranges);
|
|
|
+
|
|
|
+ if(!ls.isEmpty())
|
|
|
+ {
|
|
|
+ if(ls.contains("WT"))
|
|
|
+ {
|
|
|
+ List<ProBasicEquipment> wtls= CacheContext.wtls;
|
|
|
+ for(ProBasicEquipment wt:wtls)
|
|
|
+ {
|
|
|
+ if(CacheContext.eqpointmap.containsKey(wt.getNemCode()))
|
|
|
+ {
|
|
|
+ Map<String, ProBasicEquipmentPoint> map=CacheContext.eqpointmap.get(wt.getNemCode());
|
|
|
+
|
|
|
+ equipmentCal(result, pointDataTaosLs, map,value);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }else if(ls.contains("LN"))
|
|
|
+ {
|
|
|
+ List<ProBasicLine> lnls= CacheContext.lnls;
|
|
|
+ for(ProBasicLine ln:lnls)
|
|
|
+ {
|
|
|
+
|
|
|
+ if(CacheContext.linepointmap.containsKey(ln.getNemCode()))
|
|
|
+ {
|
|
|
+ Map<String, ProBasicPowerstationPoint> map=CacheContext.linepointmap.get(ln.getNemCode());
|
|
|
+
|
|
|
+ powerstationCal(result, pointDataTaosLs, map,value);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }else if(ls.contains("PJ"))
|
|
|
+ {
|
|
|
+ List<ProBasicProject> pjls= CacheContext.pjls;
|
|
|
+ for(ProBasicProject pj:pjls)
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ if(CacheContext.propointmap.containsKey(pj.getNemCode()))
|
|
|
+ {
|
|
|
+ Map<String, ProBasicPowerstationPoint> map=CacheContext.propointmap.get(pj.getNemCode());
|
|
|
+
|
|
|
+ powerstationCal(result, pointDataTaosLs, map,value);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(ls.contains("WP"))
|
|
|
+ {
|
|
|
+ List<ProBasicPowerstation> wpls= CacheContext.wpls;
|
|
|
+ for(ProBasicPowerstation wp:wpls)
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ if(CacheContext.wppointmap.containsKey(wp.getNemCode()))
|
|
|
+ {
|
|
|
+ Map<String, ProBasicPowerstationPoint> map=CacheContext.wppointmap.get(wp.getNemCode());
|
|
|
+
|
|
|
+ powerstationCal(result, pointDataTaosLs, map,value);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }else if(ls.contains("CP"))
|
|
|
+ {
|
|
|
+ List<ProBasicCompany> cpls= CacheContext.cpls;
|
|
|
+ for(ProBasicCompany cp:cpls)
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ if(CacheContext.companypointmap.containsKey(cp.getNemCode()))
|
|
|
+ {
|
|
|
+ Map<String, ProBasicPowerstationPoint> map=CacheContext.companypointmap.get(cp.getNemCode());
|
|
|
+
|
|
|
+ powerstationCal(result, pointDataTaosLs, map,value);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }else if(ls.contains("RG"))
|
|
|
+ {
|
|
|
+ List<ProBasicRegion> rgls= CacheContext.rgls;
|
|
|
+ for(ProBasicRegion rg:rgls)
|
|
|
+ {
|
|
|
+
|
|
|
+
|
|
|
+ if(CacheContext.regionpointmap.containsKey(rg.getNemCode()))
|
|
|
+ {
|
|
|
+ Map<String, ProBasicPowerstationPoint> map=CacheContext.regionpointmap.get(rg.getNemCode());
|
|
|
+
|
|
|
+ powerstationCal(result, pointDataTaosLs, map,value);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }else if(ls.contains("EG"))
|
|
|
+ {
|
|
|
+ List<ProBasicEnergyGroup> egls= CacheContext.egls;
|
|
|
+ for(ProBasicEnergyGroup eg:egls)
|
|
|
+ {
|
|
|
+
|
|
|
+ if(CacheContext.grouppointmap.containsKey(eg.getNemCode()))
|
|
|
+ {
|
|
|
+ Map<String, ProBasicPowerstationPoint> map=CacheContext.grouppointmap.get(eg.getNemCode());
|
|
|
+
|
|
|
+ powerstationCal(result, pointDataTaosLs, map,value);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if(!pointDataTaosLs.isEmpty())
|
|
|
+ {
|
|
|
+ taosUtil.sendSinglePoint(pointDataTaosLs);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ private void custom(String range, String result, AlarmExpression alarmExpression, List<PointDataTaos> pointDataTaosLs) {
|
|
|
+
|
|
|
+ AlarmFunction alarmFunction = null;
|
|
|
+
|
|
|
+ if(ObjectUtil.isNotEmpty(range) && StrUtil.isNotEmpty(range))
|
|
|
+ {
|
|
|
+ String[] ranges= range.split(",");
|
|
|
+ List<String> ls = Arrays.asList(ranges);
|
|
|
+
|
|
|
+ if(!ls.isEmpty())
|
|
|
+ {
|
|
|
+ if(ls.contains("WT"))
|
|
|
+ {
|
|
|
+ List<ProBasicEquipment> wtls= CacheContext.wtls;
|
|
|
+ for(ProBasicEquipment wt:wtls)
|
|
|
+ {
|
|
|
+ alarmFunction = new AlarmFunction(alarmExpression, DeviceTypeValue.WT, wt.getNemCode());
|
|
|
+ try {
|
|
|
+
|
|
|
+ Object obj = alarmFunction.explain();
|
|
|
+ double value = 0;
|
|
|
+ if (obj instanceof Double) {
|
|
|
+
|
|
|
+ value =(Double)obj;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(CacheContext.eqpointmap.containsKey(wt.getNemCode()))
|
|
|
+ {
|
|
|
+ Map<String, ProBasicEquipmentPoint> map=CacheContext.eqpointmap.get(wt.getNemCode());
|
|
|
+
|
|
|
+ equipmentCal(result, pointDataTaosLs, map,String.valueOf(value));
|
|
|
+ }
|
|
|
+ }catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }else if(ls.contains("LN"))
|
|
|
+ {
|
|
|
+ List<ProBasicLine> lnls= CacheContext.lnls;
|
|
|
+ for(ProBasicLine ln:lnls)
|
|
|
+ {
|
|
|
+ alarmFunction = new AlarmFunction(alarmExpression, DeviceTypeValue.LN, ln.getNemCode());
|
|
|
+ try {
|
|
|
+
|
|
|
+ Object obj = alarmFunction.explain();
|
|
|
+ double value = 0;
|
|
|
+ if (obj instanceof Double) {
|
|
|
+
|
|
|
+ value =(Double)obj;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(CacheContext.linepointmap.containsKey(ln.getNemCode()))
|
|
|
+ {
|
|
|
+ Map<String, ProBasicPowerstationPoint> map=CacheContext.linepointmap.get(ln.getNemCode());
|
|
|
+
|
|
|
+ powerstationCal(result, pointDataTaosLs, map,String.valueOf(value));
|
|
|
+ }
|
|
|
+ }catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }else if(ls.contains("PJ"))
|
|
|
+ {
|
|
|
+ List<ProBasicProject> pjls= CacheContext.pjls;
|
|
|
+ for(ProBasicProject pj:pjls)
|
|
|
+ {
|
|
|
+ alarmFunction = new AlarmFunction(alarmExpression, DeviceTypeValue.PJ, pj.getNemCode());
|
|
|
+ try {
|
|
|
+
|
|
|
+ Object obj = alarmFunction.explain();
|
|
|
+ double value = 0;
|
|
|
+ if (obj instanceof Double) {
|
|
|
+
|
|
|
+ value =(Double)obj;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(CacheContext.propointmap.containsKey(pj.getNemCode()))
|
|
|
+ {
|
|
|
+ Map<String, ProBasicPowerstationPoint> map=CacheContext.propointmap.get(pj.getNemCode());
|
|
|
+
|
|
|
+ powerstationCal(result, pointDataTaosLs, map,String.valueOf(value));
|
|
|
+ }
|
|
|
+ }catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else if(ls.contains("WP"))
|
|
|
+ {
|
|
|
+ List<ProBasicPowerstation> wpls= CacheContext.wpls;
|
|
|
+ for(ProBasicPowerstation wp:wpls)
|
|
|
+ {
|
|
|
+ alarmFunction = new AlarmFunction(alarmExpression, DeviceTypeValue.WP, wp.getNemCode());
|
|
|
+ try {
|
|
|
+
|
|
|
+ Object obj = alarmFunction.explain();
|
|
|
+ double value = 0;
|
|
|
+ if (obj instanceof Double) {
|
|
|
+
|
|
|
+ value =(Double)obj;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(CacheContext.wppointmap.containsKey(wp.getNemCode()))
|
|
|
+ {
|
|
|
+ Map<String, ProBasicPowerstationPoint> map=CacheContext.wppointmap.get(wp.getNemCode());
|
|
|
+
|
|
|
+ powerstationCal(result, pointDataTaosLs, map,String.valueOf(value));
|
|
|
+ }
|
|
|
+ }catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }else if(ls.contains("CP"))
|
|
|
+ {
|
|
|
+ List<ProBasicCompany> cpls= CacheContext.cpls;
|
|
|
+ for(ProBasicCompany cp:cpls)
|
|
|
+ {
|
|
|
+ alarmFunction = new AlarmFunction(alarmExpression, DeviceTypeValue.CP, cp.getNemCode());
|
|
|
+ try {
|
|
|
+
|
|
|
+ Object obj = alarmFunction.explain();
|
|
|
+ double value = 0;
|
|
|
+ if (obj instanceof Double) {
|
|
|
+
|
|
|
+ value =(Double)obj;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(CacheContext.companypointmap.containsKey(cp.getNemCode()))
|
|
|
+ {
|
|
|
+ Map<String, ProBasicPowerstationPoint> map=CacheContext.companypointmap.get(cp.getNemCode());
|
|
|
+
|
|
|
+ powerstationCal(result, pointDataTaosLs, map,String.valueOf(value));
|
|
|
+ }
|
|
|
+ }catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }else if(ls.contains("RG"))
|
|
|
+ {
|
|
|
+ List<ProBasicRegion> rgls= CacheContext.rgls;
|
|
|
+ for(ProBasicRegion rg:rgls)
|
|
|
+ {
|
|
|
+ alarmFunction = new AlarmFunction(alarmExpression, DeviceTypeValue.RG, rg.getNemCode());
|
|
|
+ try {
|
|
|
+
|
|
|
+ Object obj = alarmFunction.explain();
|
|
|
+ double value = 0;
|
|
|
+ if (obj instanceof Double) {
|
|
|
+
|
|
|
+ value =(Double)obj;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(CacheContext.regionpointmap.containsKey(rg.getNemCode()))
|
|
|
+ {
|
|
|
+ Map<String, ProBasicPowerstationPoint> map=CacheContext.regionpointmap.get(rg.getNemCode());
|
|
|
+
|
|
|
+ powerstationCal(result, pointDataTaosLs, map,String.valueOf(value));
|
|
|
+ }
|
|
|
+ }catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }else if(ls.contains("EG"))
|
|
|
+ {
|
|
|
+ List<ProBasicEnergyGroup> egls= CacheContext.egls;
|
|
|
+ for(ProBasicEnergyGroup eg:egls)
|
|
|
+ {
|
|
|
+ alarmFunction = new AlarmFunction(alarmExpression, DeviceTypeValue.EG, eg.getNemCode());
|
|
|
+ try {
|
|
|
+
|
|
|
+ Object obj = alarmFunction.explain();
|
|
|
+ double value = 0;
|
|
|
+ if (obj instanceof Double) {
|
|
|
+
|
|
|
+ value =(Double)obj;
|
|
|
+ }
|
|
|
+
|
|
|
+ if(CacheContext.grouppointmap.containsKey(eg.getNemCode()))
|
|
|
+ {
|
|
|
+ Map<String, ProBasicPowerstationPoint> map=CacheContext.grouppointmap.get(eg.getNemCode());
|
|
|
+
|
|
|
+ powerstationCal(result, pointDataTaosLs, map,String.valueOf(value));
|
|
|
+ }
|
|
|
+ }catch (Exception ex) {
|
|
|
+ ex.printStackTrace();
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ if(!pointDataTaosLs.isEmpty())
|
|
|
+ {
|
|
|
+ taosUtil.sendSinglePoint(pointDataTaosLs);
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ private void powerstationCal(String result, List<PointDataTaos> pointDataTaosLs, Map<String, ProBasicPowerstationPoint> map,String value) {
|
|
|
+ if(map.containsKey(result) && ObjectUtil.isNotEmpty(value) && StrUtil.isNotEmpty(value) )
|
|
|
+ {
|
|
|
+ ProBasicPowerstationPoint point= map.get(result);
|
|
|
+
|
|
|
+ PointDataTaos pt=new PointDataTaos();
|
|
|
+ pt.setId(point.getNemCode());
|
|
|
+ pt.setTs(new Timestamp(System.currentTimeMillis()));
|
|
|
+ pt.setVal(Double.valueOf(value));
|
|
|
+ pt.setMetric(1);
|
|
|
+ pointDataTaosLs.add(pt);
|
|
|
+ if(pointDataTaosLs.size()==100)
|
|
|
+ {
|
|
|
+ taosUtil.sendSinglePoint(pointDataTaosLs);
|
|
|
+ pointDataTaosLs.clear();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void equipmentCal(String result, List<PointDataTaos> pointDataTaosLs, Map<String, ProBasicEquipmentPoint> map,String value) {
|
|
|
+
|
|
|
+
|
|
|
+ if(map.containsKey(result) && ObjectUtil.isNotEmpty(value) && StrUtil.isNotEmpty(value) )
|
|
|
+ {
|
|
|
+
|
|
|
+ ProBasicEquipmentPoint point= map.get(result);
|
|
|
+
|
|
|
+ PointDataTaos pt=new PointDataTaos();
|
|
|
+ pt.setId(point.getNemCode());
|
|
|
+ pt.setTs(new Timestamp(System.currentTimeMillis()));
|
|
|
+ pt.setVal(Double.valueOf(value));
|
|
|
+ pt.setMetric(1);
|
|
|
+ pointDataTaosLs.add(pt);
|
|
|
+
|
|
|
+ if(pointDataTaosLs.size()==100)
|
|
|
+ {
|
|
|
+ taosUtil.sendSinglePoint(pointDataTaosLs);
|
|
|
+ pointDataTaosLs.clear();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+}
|