|
@@ -7,11 +7,14 @@ package com.gyee.runeconomy.service.monitor;
|
|
|
|
|
|
import com.gyee.common.contant.ContantXk;
|
|
|
import com.gyee.common.model.PointData;
|
|
|
+import com.gyee.common.util.ClassUtil;
|
|
|
import com.gyee.common.util.DoubleUtils;
|
|
|
import com.gyee.runeconomy.init.CacheContext;
|
|
|
+import com.gyee.runeconomy.model.auto.ProBasicBranch;
|
|
|
import com.gyee.runeconomy.model.auto.ProBasicEquipment;
|
|
|
import com.gyee.runeconomy.model.auto.ProBasicEquipmentPoint;
|
|
|
import com.gyee.runeconomy.model.auto.ProBasicSquare;
|
|
|
+import com.gyee.runeconomy.model.vo.InverVo;
|
|
|
import com.gyee.runeconomy.model.vo.LandformsVo;
|
|
|
import com.gyee.runeconomy.util.StringUtils;
|
|
|
import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
|
|
@@ -19,6 +22,7 @@ import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
import java.util.ArrayList;
|
|
|
+import java.util.LinkedHashMap;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
import java.util.stream.Collectors;
|
|
@@ -47,7 +51,7 @@ public class LandformsService {
|
|
|
Map<String, ProBasicEquipmentPoint> equipmentPointMap = wtpAimap.get(wt.getId());
|
|
|
// ProBasicEquipmentPoint powerPoint = equipmentPointMap.get(ContantXk.CJ_SSGL);
|
|
|
// ProBasicEquipmentPoint speedPoint = equipmentPointMap.get(ContantXk.CJ_SSFS);
|
|
|
- ProBasicEquipmentPoint sbztPoint = equipmentPointMap.get(ContantXk.SBZT);
|
|
|
+ ProBasicEquipmentPoint sbztPoint = equipmentPointMap.get(ContantXk.MXZT);
|
|
|
// wtstring.add(powerPoint.getNemCode());
|
|
|
// wtstring.add(speedPoint.getNemCode());
|
|
|
wtstring.add(sbztPoint.getNemCode());
|
|
@@ -73,7 +77,7 @@ public class LandformsService {
|
|
|
Map<String, ProBasicEquipmentPoint> equipmentPointMap = wtpAimap.get(wt.getId());
|
|
|
ProBasicEquipmentPoint powerPoint = equipmentPointMap.get(ContantXk.CJ_SSGL);
|
|
|
ProBasicEquipmentPoint speedPoint = equipmentPointMap.get(ContantXk.CJ_SSFS);
|
|
|
- ProBasicEquipmentPoint sbztPoint = equipmentPointMap.get(ContantXk.SBZT);
|
|
|
+ ProBasicEquipmentPoint sbztPoint = equipmentPointMap.get(ContantXk.MXZT);
|
|
|
wtstring.add(powerPoint.getNemCode());
|
|
|
wtstring.add(speedPoint.getNemCode());
|
|
|
wtstring.add(sbztPoint.getNemCode());
|
|
@@ -101,4 +105,60 @@ public class LandformsService {
|
|
|
List<ProBasicSquare> sqls = CacheContext.sqls;
|
|
|
return sqls.stream().filter(s->s.getProjectId().equals(pjid)).collect(Collectors.toList());
|
|
|
}
|
|
|
+
|
|
|
+ public List<Object> inverData(String squareid) {
|
|
|
+
|
|
|
+ List<Object> resultList = new ArrayList<>();
|
|
|
+ Map<String, Double> modelpower = CacheContext.modelpower;
|
|
|
+ Map<String, List<ProBasicEquipment>> sqwtmap = CacheContext.sqwtmap;
|
|
|
+ Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
|
|
|
+ Map<String, List<ProBasicBranch>> wtbnmap = CacheContext.wtbnmap;
|
|
|
+ Map<String, Map<String, ProBasicEquipmentPoint>> bnAimap = CacheContext.bnAimap;
|
|
|
+ List<ProBasicEquipment> equipments = sqwtmap.get(squareid);
|
|
|
+ equipments.stream().forEach(wt->{
|
|
|
+ List<String> equipointids = new ArrayList<>();
|
|
|
+ Map<String, ProBasicEquipmentPoint> equipmentPointMap = wtpAimap.get(wt.getId());
|
|
|
+ ProBasicEquipmentPoint powerPoint = equipmentPointMap.get(ContantXk.CJ_SSGL);
|
|
|
+ equipointids.add(powerPoint.getNemCode());
|
|
|
+ List<ProBasicBranch> branches = wtbnmap.get(wt.getId());
|
|
|
+
|
|
|
+ branches.stream().forEach(bn->{
|
|
|
+ Map<String, ProBasicEquipmentPoint> pointMap = bnAimap.get(bn.getId());
|
|
|
+ ProBasicEquipmentPoint zldlPoint = pointMap.get(ContantXk.ZLDL);
|
|
|
+ equipointids.add(zldlPoint.getNemCode());
|
|
|
+ });
|
|
|
+ List<PointData> realData = null;
|
|
|
+ try {
|
|
|
+ realData = edosUtil.getRealData(equipointids);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ InverVo vo = new InverVo();
|
|
|
+ vo.setWtid(wt.getId());
|
|
|
+ vo.setWtname(wt.getAname());
|
|
|
+ vo.setZjrl(modelpower.get(wt.getId()));
|
|
|
+ if (StringUtils.isNotEmpty(realData)){
|
|
|
+
|
|
|
+ LinkedHashMap addMap = new LinkedHashMap();
|
|
|
+ LinkedHashMap addValMap = new LinkedHashMap();
|
|
|
+ vo.setPower(DoubleUtils.keepPrecision(realData.get(0).getPointValueInDouble(),2));
|
|
|
+ for (int j=1;j<realData.size();j++){
|
|
|
+ try {
|
|
|
+ addMap.put("PV"+j, Class.forName("java.lang.Double"));
|
|
|
+ addValMap.put("PV"+j, DoubleUtils.keepPrecision(realData.get(j).getPointValueInDouble(),2));
|
|
|
+
|
|
|
+ } catch (ClassNotFoundException e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ try {
|
|
|
+ Object o = new ClassUtil().dynamicClass(vo, addMap, addValMap);
|
|
|
+ resultList.add(o);
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ return resultList;
|
|
|
+ }
|
|
|
}
|