Browse Source

逆变器支路列表

xieshengjie 1 year ago
parent
commit
d63ca4e490

+ 1 - 1
common/src/main/java/com/gyee/common/contant/ContantXk.java

@@ -199,7 +199,7 @@ public class ContantXk {
 
     public static final String NBQSRGL = "AIG067";   //逆变器输入功率
     public static final String NBQSCGL = "AI114";   //逆变器输出功率
-    public static final String ZLDL = "AI114";   //支路电流
+    public static final String ZLDL = "ZLDL";   //支路电流
     public static final String JLDL = "AI075";   //交流电流
     public static final String JLDY = "AIG055";   //交流电压
 

+ 20 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/ProBasicBranchController.java

@@ -0,0 +1,20 @@
+package com.gyee.runeconomy.controller;
+
+
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * <p>
+ *  前端控制器
+ * </p>
+ *
+ * @author wang
+ * @since 2023-05-13
+ */
+@RestController
+@RequestMapping("//pro-basic-branch")
+public class ProBasicBranchController {
+
+}

+ 19 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/controller/monitor/LandformsController.java

@@ -61,4 +61,23 @@ public class LandformsController {
             return R.error(ResultMsg.error());
         }
     }
+
+    /**
+     * 根据逆变器查询数据列表
+     * @return
+     */
+    @GetMapping("/inverData")
+    @ResponseBody
+    @ApiOperation(value = "逆变器数据列表", notes = "逆变器数据列表")
+    public R inverData(@RequestParam(value = "squareid",required = true) String squareid) throws Exception {
+
+        List<Object> resultList = landformsService.inverData(squareid);
+        if (StringUtils.isNotNull(resultList)) {
+            return R.data(ResultMsg.ok(resultList));
+        }else{
+            return R.error(ResultMsg.error());
+        }
+    }
+
+
 }

+ 22 - 2
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/init/CacheContext.java

@@ -62,6 +62,8 @@ public class CacheContext implements CommandLineRunner {
     @Resource
     private IProBasicEnergyGroupService proBasicEnergyGroupService;
     @Resource
+    private IProBasicBranchService proBasicBranchService;
+    @Resource
     private TheoreticalPowerService theoreticalPowerService;
 
     @Resource
@@ -72,7 +74,7 @@ public class CacheContext implements CommandLineRunner {
 
     @Resource
     private IProBasicEquipmentPointService proBasicEquipmentPointService;
-
+    public static List<ProBasicBranch> bnls = new ArrayList<>();
     public static List<ProBasicEquipment> wtls = new ArrayList<>();
     public static List<ProBasicProject> pjls = new ArrayList<>();
     public static List<ProBasicLine>  lnls = new ArrayList<>();
@@ -97,7 +99,7 @@ public class CacheContext implements CommandLineRunner {
     public static Map<String,List<ProBasicPowerstation>> cpwpmap = new HashMap<>();
     public static Map<String,List<ProBasicPowerstation>> wpmapls = new HashMap<>();
     public static Map<String,List<ProBasicPowerstation>> stationls = new HashMap<>();
-
+    public static Map<String,List<ProBasicBranch>> wtbnmap = new HashMap<>();
     public static Map<String,List<ProBasicCompany>> rgcpmap = new HashMap<>();
     public static Map<String,ProBasicSquare> sqmap = new HashMap<>();
     public static Map<String, ProBasicPowerstation> wpmap = new HashMap<>();
@@ -113,6 +115,7 @@ public class CacheContext implements CommandLineRunner {
     public static Map<String,List<ProBasicEquipment>> rgwtlsmap = new HashMap<>();
     public static Map<String,Map<String,ProBasicEquipment>> cmwtmap = new HashMap<>();
     public static Map<String,List<ProBasicEquipment>> sqwtmap = new HashMap<>();
+    public static Map<String, Map<String, ProBasicEquipmentPoint>> bnAimap = new HashMap<>();
     public static Map<String, Map<String, ProBasicEquipmentPoint>> wtpAimap = new HashMap<>();// 风电机测点AI表
     public static Map<String, Map<String, ProBasicEquipmentPoint>> wtpointmap = new HashMap<>();//风机测点
     public static Map<String,Map<String, ProBasicPowerstationPoint>> linepointmap =new HashMap<>();
@@ -151,6 +154,23 @@ public class CacheContext implements CommandLineRunner {
     public void run(String... args) throws Exception {
         logger.info("缓存开始------------------------------------------------------------");
 
+
+        bnls = proBasicBranchService.list();
+        bnls.stream().forEach(bn->{
+            String bnString = redisService.get(bn.getId());
+            Map<String, ProBasicEquipmentPoint> stringWindturbinetestingpointnewMap = JSONObject.parseObject(bnString, new TypeReference<Map<String, ProBasicEquipmentPoint>>() {
+            });
+            bnAimap.put(bn.getId(),stringWindturbinetestingpointnewMap);
+
+            if (wtbnmap.containsKey(bn.getInteverId())){
+                wtbnmap.get(bn.getInteverId()).add(bn);
+            }else {
+                List<ProBasicBranch> bns = new ArrayList<>();
+                bns.add(bn);
+                wtbnmap.put(bn.getInteverId(),bns);
+            }
+        });
+
         equipmentmodels = proEconEquipmentmodelService.list();
         equipmentmodels.stream().forEach(e->{
             modelMap.put(e.getId(),e);

+ 16 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/mapper/auto/ProBasicBranchMapper.java

@@ -0,0 +1,16 @@
+package com.gyee.runeconomy.mapper.auto;
+
+import com.gyee.runeconomy.model.auto.ProBasicBranch;
+import com.baomidou.mybatisplus.core.mapper.BaseMapper;
+
+/**
+ * <p>
+ *  Mapper 接口
+ * </p>
+ *
+ * @author wang
+ * @since 2023-05-13
+ */
+public interface ProBasicBranchMapper extends BaseMapper<ProBasicBranch> {
+
+}

+ 54 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/model/auto/ProBasicBranch.java

@@ -0,0 +1,54 @@
+package com.gyee.runeconomy.model.auto;
+
+import com.baomidou.mybatisplus.extension.activerecord.Model;
+import lombok.Data;
+import lombok.EqualsAndHashCode;
+
+/**
+ * <p>
+ * 
+ * </p>
+ *
+ * @author wang
+ * @since 2023-05-13
+ */
+@Data
+@EqualsAndHashCode(callSuper = true)
+public class ProBasicBranch extends Model {
+
+    private static final long serialVersionUID = 1L;
+
+    private String id;
+
+    private String nemCode;
+
+    private String windpowerstationId;
+
+    private String projectId;
+
+    private String lineId;
+
+    private String name;
+
+    private String aname;
+
+    private String types;
+
+    private Integer isAble;
+
+    private String spare1;
+
+    private String spare2;
+
+    private String spare3;
+
+    private String spare4;
+
+    private String inteverId;
+
+    private String combinerId;
+
+    private String squareId;
+
+
+}

+ 15 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/model/vo/InverVo.java

@@ -0,0 +1,15 @@
+package com.gyee.runeconomy.model.vo;/*
+@author   谢生杰
+@date   2023/5/13-10:27
+*/
+
+import lombok.Data;
+
+@Data
+public class InverVo {
+
+    private String wtid;
+    private String wtname;
+    private Double zjrl;
+    private Double power;
+}

+ 20 - 0
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/auto/impl/ProBasicBranchServiceImpl.java

@@ -0,0 +1,20 @@
+package com.gyee.runeconomy.service.auto.impl;
+
+import com.gyee.runeconomy.model.auto.ProBasicBranch;
+import com.gyee.runeconomy.mapper.auto.ProBasicBranchMapper;
+import com.gyee.runeconomy.service.auto.IProBasicBranchService;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import org.springframework.stereotype.Service;
+
+/**
+ * <p>
+ *  服务实现类
+ * </p>
+ *
+ * @author wang
+ * @since 2023-05-13
+ */
+@Service
+public class ProBasicBranchServiceImpl extends ServiceImpl<ProBasicBranchMapper, ProBasicBranch> implements IProBasicBranchService {
+
+}

+ 62 - 2
web/runeconomy-xk/src/main/java/com/gyee/runeconomy/service/monitor/LandformsService.java

@@ -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;
+    }
 }