浏览代码

修改电量(异常用功率算)计算程序

xieshengjie 2 年之前
父节点
当前提交
4b2cf3a39c

+ 7 - 4
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/monitor/ComprehensiveController.java

@@ -7,6 +7,7 @@ import com.gyee.common.model.StringUtils;
 import com.gyee.common.vo.monitor.CompreVo;
 import com.gyee.runeconomy.dto.R;
 import com.gyee.runeconomy.dto.ResultMsg;
+import com.gyee.runeconomy.init.CacheContext;
 import com.gyee.runeconomy.model.auto.ProEconTestingPoint;
 import com.gyee.runeconomy.service.monitor.ComprehensiveService;
 import io.swagger.annotations.Api;
@@ -92,11 +93,13 @@ public class ComprehensiveController {
     public R wtlisting(@RequestParam(value = "type",required = true) String type,
                      @RequestParam(value = "company",required = true) String company,
                        @RequestParam(value = "wpid",required = true) String wpid,
-                     @RequestParam(value = "targets",required = true) String targets) throws Exception {
-
-        List<CompreVo> resultList = comprehensiveService.wtlisting(company,type,targets,wpid);
+                     @RequestParam(value = "targets",required = true) String targets,
+                       @RequestParam(value = "pageSize",required = true) String pageSize,
+                       @RequestParam(value = "pageNum",required = true) String pageNum) {
+        int count = CacheContext.wpwtmap.get(wpid).size();
+        List<CompreVo> resultList = comprehensiveService.wtlisting(company,type,targets,wpid,pageSize,pageNum);
         if (StringUtils.isNotNull(resultList)) {
-            return R.data(ResultMsg.ok(resultList));
+            return R.data(ResultMsg.ok(resultList,count));
         }else{
             return R.error(ResultMsg.error());
         }

+ 1 - 1
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/model/vo/LineTreeVo.java

@@ -13,5 +13,5 @@ public class LineTreeVo {
 
     private String lnid;
     private String lnname;
-    private List<ProBasicEquipment> wts;
+    private List<WtStatusVo> wts;
 }

+ 14 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/model/vo/WtStatusVo.java

@@ -0,0 +1,14 @@
+package com.gyee.runeconomy.model.vo;/*
+@author   谢生杰
+@date   2023/4/18-15:35
+*/
+
+import lombok.Data;
+
+@Data
+public class WtStatusVo {
+
+    private String wtid;
+    private String wtname;
+    private Integer status;
+}

+ 7 - 1
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/bmk/BenchmarkingService.java

@@ -68,7 +68,13 @@ public class BenchmarkingService {
             list = list.stream().filter(wp-> wp.getId().indexOf(finalType) >= 0).collect(Collectors.toList());
         }
 
-        if (!companyids.endsWith("RGN")){
+        if (companyids.endsWith("RGN")){
+            list = list.stream().filter(wp->companyids.contains(wp.getRegionId())).collect(Collectors.toList());
+        }
+        if (companyids.endsWith("FGS")){
+            list = list.stream().filter(wp->companyids.contains(wp.getGroupId())).collect(Collectors.toList());
+        }
+        if (companyids.endsWith("ZGS")){
             list = list.stream().filter(wp->companyids.contains(wp.getCompanyId())).collect(Collectors.toList());
         }
         SortUtils.sort(list,"orderNum",SortUtils.ASC);

+ 3 - 1
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/monitor/ComprehensiveService.java

@@ -101,13 +101,15 @@ public class ComprehensiveService {
 
     }
 
-    public List<CompreVo> wtlisting(String company, String type, String targets, String wpid) {
+    public List<CompreVo> wtlisting(String company, String type, String targets, String wpid,String pageSize,String pageNum) {
         List<CompreVo> resultList = new ArrayList<>();
         Map<String, List<ProBasicEquipment>> wpwtmap = CacheContext.wpwtmap;
         Map<String, Double> modelpower = CacheContext.modelpower;
         List<ProBasicEquipment> equipments = wpwtmap.get(wpid);
         Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
         String[] targetArray = targets.split(",");
+        equipments = equipments.stream().skip((Integer.parseInt(pageNum)-1)*Integer.parseInt(pageSize)).limit(Long.parseLong(pageSize)).collect(Collectors.toList());
+//        for (int i= 0;i<equipments.size();i++){
         equipments.stream().forEach(wt->{
             CompreVo vo = new CompreVo();
             vo.setWpname(wt.getAname());

+ 27 - 3
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/monitor/DeviceDetailsService.java

@@ -6,15 +6,18 @@ package com.gyee.runeconomy.service.monitor;/*
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.gyee.common.contant.ContantXk;
 import com.gyee.common.model.PointData;
+import com.gyee.common.util.algorithm.MathUtils;
 import com.gyee.common.vo.monitor.AgcVo;
 import com.gyee.runeconomy.init.CacheContext;
 import com.gyee.runeconomy.model.auto.*;
 import com.gyee.runeconomy.model.vo.LineTreeVo;
 import com.gyee.runeconomy.model.vo.ProTreeVo;
 import com.gyee.runeconomy.model.vo.TreeVo;
+import com.gyee.runeconomy.model.vo.WtStatusVo;
 import com.gyee.runeconomy.service.auto.IProEconTestingPointService;
 import com.gyee.runeconomy.util.StringUtils;
 import com.gyee.runeconomy.util.realtimesource.IEdosUtil;
+import com.gyee.runeconomy.util.realtimesource.StringUtil;
 import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
@@ -36,12 +39,12 @@ public class DeviceDetailsService {
         Map<String, List<ProBasicProject>> wppromap = CacheContext.wppromap;
         Map<String, List<ProBasicLine>> prolinemap = CacheContext.prolinemap;
         Map<String, List<ProBasicEquipment>> lnwtmap = CacheContext.lnwtmap;
+        Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = CacheContext.wtpAimap;
         List<ProBasicProject> projects = wppromap.get(wpid);
         TreeVo vo = new TreeVo();
         List<ProTreeVo> pjvos = new ArrayList<>();
         projects.stream().forEach(p->{
             List<ProBasicLine> lines = prolinemap.get(p.getId());
-            Map<String,Object> lineMap = new HashMap<>();
             List<LineTreeVo> lnvos = new ArrayList<>();
             ProTreeVo pjvo = new ProTreeVo();
             pjvo.setPjid(p.getId());
@@ -51,7 +54,26 @@ public class DeviceDetailsService {
                 lnvo.setLnid(line.getId());
                 lnvo.setLnname(line.getAname());
                 List<ProBasicEquipment> equipments = lnwtmap.get(line.getId());
-                lnvo.setWts(equipments);
+                List<String> points = new ArrayList<>();
+                equipments.stream().forEach(e->{
+                    ProBasicEquipmentPoint proBasicEquipmentPoint = wtpAimap.get(e.getId()).get(ContantXk.SBZT);
+                    points.add(proBasicEquipmentPoint.getNemCode());
+                });
+                List<PointData> statusData = null;
+                try {
+                    statusData = edosUtil.getRealData(points);
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+                List<WtStatusVo> wtStatusVos = new ArrayList<>();
+                for (int i = 0;i<equipments.size();i++){
+                    WtStatusVo wtStatusVo = new WtStatusVo();
+                    wtStatusVo.setWtid(equipments.get(i).getId());
+                    wtStatusVo.setWtname(equipments.get(i).getAname());
+                    wtStatusVo.setStatus((int) statusData.get(i).getPointValueInDouble());
+                    wtStatusVos.add(wtStatusVo);
+                }
+                lnvo.setWts(wtStatusVos);
                 lnvos.add(lnvo);
             });
             pjvo.setLns(lnvos);
@@ -85,6 +107,7 @@ public class DeviceDetailsService {
         codes.add(equipmentPointMap.get(ContantXk.RXDJCLSSDL).getNemCode());
         codes.add(equipmentPointMap.get(ContantXk.RCWSLDWSSDL).getNemCode());
         codes.add(equipmentPointMap.get(ContantXk.RCWSLTQSSDL).getNemCode());
+        codes.add(equipmentPointMap.get(ContantXk.SBZT).getNemCode());
         List<PointData> realData = edosUtil.getRealData(codes);
         if (StringUtils.isNotEmpty(realData)){
             resultMap.put("rfdl",realData.get(0).getPointValueInDouble());
@@ -100,6 +123,7 @@ public class DeviceDetailsService {
             resultMap.put("xnss",realData.get(12).getPointValueInDouble()+realData.get(13).getPointValueInDouble()+realData.get(14).getPointValueInDouble()+realData.get(15).getPointValueInDouble());
             resultMap.put("xdss",realData.get(16).getPointValueInDouble()+realData.get(17).getPointValueInDouble());
             resultMap.put("slss",realData.get(18).getPointValueInDouble()+realData.get(19).getPointValueInDouble());
+            resultMap.put("status",realData.get(20).getPointValueInDouble());
         }
 
         return resultMap;
@@ -109,7 +133,7 @@ public class DeviceDetailsService {
         Map<String,List<ProEconTestingPoint>> resultMap = new HashMap<>();
         Map<String, ProBasicEquipment> wtmap = CacheContext.wtmap;
         QueryWrapper<ProEconTestingPoint> qw = new QueryWrapper<>();
-        qw.lambda().eq(ProEconTestingPoint::getModel,wtmap.get(wtid).getModelId()).eq(ProEconTestingPoint::getLogicalUnitId,part);
+        qw.lambda().eq(ProEconTestingPoint::getModel,wtmap.get(wtid).getModelId()).eq(ProEconTestingPoint::getLogicalUnitId,part).eq(ProEconTestingPoint::getIsDisplay,1);
         List<ProEconTestingPoint> list = proEconTestingPointService.list(qw);
         resultMap.put("AI",list.stream().filter(i->i.getUniformCode().startsWith("AI")).collect(Collectors.toList()));
         resultMap.put("DI",list.stream().filter(i->i.getUniformCode().startsWith("DI")).collect(Collectors.toList()));

+ 1 - 1
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/monitor/MatrixService.java

@@ -627,7 +627,7 @@ public class MatrixService {
                         }
                         vo.setSsqfzt(DoubleUtils.keepPrecision(wtRealdatas.get(j * index + 4).getPointValueInDouble(), 2));
                         vo.setQfdl(DoubleUtils.keepPrecision(wtRealdatas.get(j * index + 5).getPointValueInDouble(), 2));
-                        vo.setRate(DoubleUtils.keepPrecision(vo.getPower() / modelpower.get(equipments.get(j).getId()) * 100, 2));
+                        vo.setRate(modelpower.containsKey(equipments.get(j).getId())?DoubleUtils.keepPrecision(vo.getPower()/ modelpower.get(equipments.get(j).getId()) * 100, 2):0);
                         volist.add(vo);
                     }
                 }