|
@@ -3,6 +3,7 @@ package com.gyee.frame.service.websocket;
|
|
|
|
|
|
import cn.hutool.core.date.DateUtil;
|
|
import cn.hutool.core.date.DateUtil;
|
|
import com.google.common.collect.Maps;
|
|
import com.google.common.collect.Maps;
|
|
|
|
+import com.gyee.frame.common.conf.V2Config;
|
|
import com.gyee.frame.common.spring.Constant;
|
|
import com.gyee.frame.common.spring.Constant;
|
|
import com.gyee.frame.common.spring.InitialRunner;
|
|
import com.gyee.frame.common.spring.InitialRunner;
|
|
import com.gyee.frame.model.agc.AgcVo;
|
|
import com.gyee.frame.model.agc.AgcVo;
|
|
@@ -18,6 +19,8 @@ import org.apache.commons.compress.utils.Lists;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
+import java.math.RoundingMode;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -1341,77 +1344,120 @@ public class WtInfoPushService {
|
|
|
|
|
|
List<InverterVo> vos=new ArrayList<>();
|
|
List<InverterVo> vos=new ArrayList<>();
|
|
if (StringUtils.notEmp(wpId) && InitialRunner.gp_nbqmap.containsKey(wpId)) {
|
|
if (StringUtils.notEmp(wpId) && InitialRunner.gp_nbqmap.containsKey(wpId)) {
|
|
- List<Inverter> wtls = InitialRunner.gp_nbqmap.get(wpId);
|
|
|
|
- for (Inverter wt : wtls) {
|
|
|
|
- double gl=0.0;
|
|
|
|
- double fdl=0.0;
|
|
|
|
- int zt=0;
|
|
|
|
|
|
|
|
- List<String> pointcodes=new ArrayList<>();
|
|
|
|
|
|
+ if (StringUtils.notEmp(wpId) && InitialRunner.gp_nbqmap.containsKey(wpId)) {
|
|
|
|
+ List<Inverter> wtls = InitialRunner.gp_nbqmap.get(wpId);
|
|
|
|
+ for (Inverter wt : wtls) {
|
|
|
|
+ double gl=0.0;
|
|
|
|
+ double fdl=0.0;
|
|
|
|
+ double zt=0;
|
|
|
|
+ double dl=0.0;
|
|
|
|
+ List<String> pointcodes=new ArrayList<>();
|
|
|
|
|
|
- String[] strs=Constant.TPOINT_Inverter_Matrix;
|
|
|
|
- for(int i=0;i<strs.length;i++)
|
|
|
|
- {
|
|
|
|
- PhotovoltaicTestingPointNew pt=photovoltaicTestingPointNewService.getPhotovoltaicTestingPointNew(wt.getId(),strs[i]);
|
|
|
|
- if(StringUtils.notEmp(pt) && StringUtils.notEmp(pt.getCode()))
|
|
|
|
|
|
+ String[] strs=Constant.TPOINT_Inverter_Matrix;
|
|
|
|
+ for(int i=0;i<strs.length;i++)
|
|
{
|
|
{
|
|
- pointcodes.add(pt.getCode());
|
|
|
|
|
|
+ PhotovoltaicTestingPointNew pt=photovoltaicTestingPointNewService.getPhotovoltaicTestingPointNew(wt.getId(),strs[i]);
|
|
|
|
+ if(StringUtils.notEmp(pt) && StringUtils.notEmp(pt.getCode()))
|
|
|
|
+ {
|
|
|
|
+ pointcodes.add(pt.getCode());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
- List<PointData> ptlist = realApiUtil.getRealData(pointcodes);
|
|
|
|
|
|
+ List<PointData> ptlist = realApiUtil.getRealData(pointcodes);
|
|
|
|
|
|
- if(!ptlist.isEmpty() && ptlist.size()==pointcodes.size())
|
|
|
|
- {
|
|
|
|
- zt=Double.valueOf(ptlist.get(0).getPointValueInDouble()).intValue();
|
|
|
|
- gl=StringUtils.round(ptlist.get(1).getPointValueInDouble(),2);
|
|
|
|
- fdl=StringUtils.round(ptlist.get(2).getPointValueInDouble(),2);
|
|
|
|
- }
|
|
|
|
- if (StringUtils.notEmp(wt.getSquareid()) && InitialRunner.sqmap.containsKey(wt.getSquareid())) {
|
|
|
|
- Square square = InitialRunner.sqmap.get(wt.getSquareid());
|
|
|
|
|
|
+ if(!ptlist.isEmpty() && ptlist.size()==pointcodes.size())
|
|
|
|
+ {
|
|
|
|
+ zt=Double.valueOf(ptlist.get(0).getPointValueInDouble()).intValue();
|
|
|
|
+ gl=StringUtils.round(ptlist.get(1).getPointValueInDouble(),2);
|
|
|
|
+ dl=StringUtils.round(ptlist.get(2).getPointValueInDouble(),2);
|
|
|
|
+ fdl=StringUtils.round(ptlist.get(3).getPointValueInDouble(),2);
|
|
|
|
+ }
|
|
|
|
|
|
- if (square.getTypes().equals(ZC)) {
|
|
|
|
|
|
+ String[] zlstrs=Constant.TPOINT_Inverter_Branch;
|
|
|
|
+ List<String> zlpointcodes=new ArrayList<>();
|
|
|
|
+ for(int i=0;i<zlstrs.length;i++)
|
|
|
|
+ {
|
|
|
|
+ PhotovoltaicTestingPointNew pt=photovoltaicTestingPointNewService.getPhotovoltaicTestingPointNew(wt.getId(),strs[i]);
|
|
|
|
+ if(StringUtils.notEmp(pt) && StringUtils.notEmp(pt.getCode()) && !pt.getCode().equals(V2Config.getInitialcode()))
|
|
|
|
+ {
|
|
|
|
+ zlpointcodes.add(pt.getCode());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- if(map.containsKey(square.getId()))
|
|
|
|
|
|
+ List<PointData> zlptlist = realApiUtil.getRealData(zlpointcodes);
|
|
|
|
+ List<Integer> zlls=new ArrayList<>();
|
|
|
|
+ if(!zlptlist.isEmpty() && zlptlist.size()==zlpointcodes.size())
|
|
|
|
+ {
|
|
|
|
+ for(PointData po:zlptlist)
|
|
{
|
|
{
|
|
- List<InverterVo> ls=map.get(square.getId());;
|
|
|
|
- InverterVo vo=new InverterVo();
|
|
|
|
- vo.setId(wt.getId());
|
|
|
|
- vo.setName(wt.getName());
|
|
|
|
- vo.setFdl(fdl);
|
|
|
|
- vo.setGl(gl);
|
|
|
|
- vo.setZt(zt);
|
|
|
|
- vo.setSqname(square.getName());
|
|
|
|
- ls.add(vo);
|
|
|
|
- map.put(square.getId(),ls);
|
|
|
|
|
|
+ int zlresult=0; //正常
|
|
|
|
+ if(StringUtils.notEmp(po))
|
|
|
|
+ {
|
|
|
|
+ double dlresult=new BigDecimal(dl).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
|
+ if(po.getPointValueInDouble()<dlresult)
|
|
|
|
+ {
|
|
|
|
+ zlresult=1;//偏低
|
|
|
|
+ }else
|
|
|
|
+ {
|
|
|
|
+ zlresult=2;//零支路
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ zlls.add(zlresult);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (StringUtils.notEmp(wt.getSquareid()) && InitialRunner.sqmap.containsKey(wt.getSquareid())) {
|
|
|
|
+ Square square = InitialRunner.sqmap.get(wt.getSquareid());
|
|
|
|
+
|
|
|
|
+ if (square.getTypes().equals(ZC)) {
|
|
|
|
+
|
|
|
|
+ if(map.containsKey(square.getId()))
|
|
|
|
+ {
|
|
|
|
+ List<InverterVo> ls=map.get(square.getId());;
|
|
|
|
+ InverterVo vo=new InverterVo();
|
|
|
|
+ vo.setId(wt.getId());
|
|
|
|
+ vo.setName(wt.getName());
|
|
|
|
+ vo.setFdl(fdl);
|
|
|
|
+ vo.setGl(gl);
|
|
|
|
+ vo.setZlls(zlls);
|
|
|
|
+ vo.setSqname(square.getName());
|
|
|
|
+ vo.setZt(zt);
|
|
|
|
+ ls.add(vo);
|
|
|
|
+ map.put(square.getId(),ls);
|
|
|
|
+ }else
|
|
|
|
+ {
|
|
|
|
+ List<InverterVo> ls=new ArrayList<>();
|
|
|
|
+ InverterVo vo=new InverterVo();
|
|
|
|
+ vo.setId(wt.getId());
|
|
|
|
+ vo.setName(wt.getName());
|
|
|
|
+ vo.setFdl(fdl);
|
|
|
|
+ vo.setGl(gl);
|
|
|
|
+ vo.setZt(zt);
|
|
|
|
+ vo.setZlls(zlls);
|
|
|
|
+ vo.setSqname(square.getName());
|
|
|
|
+ ls.add(vo);
|
|
|
|
+ map.put(square.getId(),ls);
|
|
|
|
+
|
|
|
|
+ }
|
|
}else
|
|
}else
|
|
{
|
|
{
|
|
- List<InverterVo> ls=new ArrayList<>();
|
|
|
|
InverterVo vo=new InverterVo();
|
|
InverterVo vo=new InverterVo();
|
|
vo.setId(wt.getId());
|
|
vo.setId(wt.getId());
|
|
vo.setName(wt.getName());
|
|
vo.setName(wt.getName());
|
|
|
|
+ vo.setSqname(square.getName());
|
|
vo.setFdl(fdl);
|
|
vo.setFdl(fdl);
|
|
vo.setGl(gl);
|
|
vo.setGl(gl);
|
|
vo.setZt(zt);
|
|
vo.setZt(zt);
|
|
- vo.setSqname(square.getName());
|
|
|
|
- ls.add(vo);
|
|
|
|
- map.put(square.getId(),ls);
|
|
|
|
-
|
|
|
|
|
|
+ vo.setZlls(zlls);
|
|
|
|
+ vos.add(vo);
|
|
}
|
|
}
|
|
- }else
|
|
|
|
- {
|
|
|
|
- InverterVo vo=new InverterVo();
|
|
|
|
- vo.setId(wt.getId());
|
|
|
|
- vo.setName(wt.getName());
|
|
|
|
- vo.setFdl(fdl);
|
|
|
|
- vo.setGl(gl);
|
|
|
|
- vo.setZt(zt);
|
|
|
|
- vo.setSqname(square.getName());
|
|
|
|
- vos.add(vo);
|
|
|
|
}
|
|
}
|
|
- }
|
|
|
|
|
|
|
|
|
|
+ }
|
|
|
|
+ map.put(JZ,vos);
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|
|
|
|
|
|
map.put(JZ,vos);
|
|
map.put(JZ,vos);
|
|
@@ -1441,8 +1487,8 @@ public class WtInfoPushService {
|
|
for (Inverter wt : wtls) {
|
|
for (Inverter wt : wtls) {
|
|
double gl=0.0;
|
|
double gl=0.0;
|
|
double fdl=0.0;
|
|
double fdl=0.0;
|
|
- int zt=0;
|
|
|
|
-
|
|
|
|
|
|
+ double zt=0;
|
|
|
|
+ double dl=0.0;
|
|
List<String> pointcodes=new ArrayList<>();
|
|
List<String> pointcodes=new ArrayList<>();
|
|
|
|
|
|
String[] strs=Constant.TPOINT_Inverter_Matrix;
|
|
String[] strs=Constant.TPOINT_Inverter_Matrix;
|
|
@@ -1462,7 +1508,42 @@ public class WtInfoPushService {
|
|
zt=Double.valueOf(ptlist.get(0).getPointValueInDouble()).intValue();
|
|
zt=Double.valueOf(ptlist.get(0).getPointValueInDouble()).intValue();
|
|
gl=StringUtils.round(ptlist.get(1).getPointValueInDouble(),2);
|
|
gl=StringUtils.round(ptlist.get(1).getPointValueInDouble(),2);
|
|
fdl=StringUtils.round(ptlist.get(2).getPointValueInDouble(),2);
|
|
fdl=StringUtils.round(ptlist.get(2).getPointValueInDouble(),2);
|
|
|
|
+ dl=StringUtils.round(ptlist.get(3).getPointValueInDouble(),2);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ String[] zlstrs=Constant.TPOINT_Inverter_Branch;
|
|
|
|
+ List<String> zlpointcodes=new ArrayList<>();
|
|
|
|
+ for(int i=0;i<zlstrs.length;i++)
|
|
|
|
+ {
|
|
|
|
+ PhotovoltaicTestingPointNew pt=photovoltaicTestingPointNewService.getPhotovoltaicTestingPointNew(wt.getId(),zlstrs[i]);
|
|
|
|
+ if(StringUtils.notEmp(pt) && StringUtils.notEmp(pt.getCode()) && !pt.getCode().equals(V2Config.getInitialcode()))
|
|
|
|
+ {
|
|
|
|
+ zlpointcodes.add(pt.getCode());
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ List<PointData> zlptlist = realApiUtil.getRealData(zlpointcodes);
|
|
|
|
+ List<Integer> zlls=new ArrayList<>();
|
|
|
|
+ if(!zlptlist.isEmpty() && zlptlist.size()==zlpointcodes.size())
|
|
|
|
+ {
|
|
|
|
+ for(PointData po:zlptlist)
|
|
|
|
+ {
|
|
|
|
+ int zlresult=0; //正常
|
|
|
|
+ if(StringUtils.notEmp(po))
|
|
|
|
+ {
|
|
|
|
+ double dlresult=new BigDecimal(dl).divide(new BigDecimal(2), 4, RoundingMode.HALF_EVEN).doubleValue();
|
|
|
|
+ if(po.getPointValueInDouble()<dlresult)
|
|
|
|
+ {
|
|
|
|
+ zlresult=1;//偏低
|
|
|
|
+ }else
|
|
|
|
+ {
|
|
|
|
+ zlresult=2;//零支路
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ zlls.add(zlresult);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
if (StringUtils.notEmp(wt.getSquareid()) && InitialRunner.sqmap.containsKey(wt.getSquareid())) {
|
|
if (StringUtils.notEmp(wt.getSquareid()) && InitialRunner.sqmap.containsKey(wt.getSquareid())) {
|
|
Square square = InitialRunner.sqmap.get(wt.getSquareid());
|
|
Square square = InitialRunner.sqmap.get(wt.getSquareid());
|
|
|
|
|
|
@@ -1476,6 +1557,7 @@ public class WtInfoPushService {
|
|
vo.setName(wt.getName());
|
|
vo.setName(wt.getName());
|
|
vo.setFdl(fdl);
|
|
vo.setFdl(fdl);
|
|
vo.setGl(gl);
|
|
vo.setGl(gl);
|
|
|
|
+ vo.setZlls(zlls);
|
|
vo.setSqname(square.getName());
|
|
vo.setSqname(square.getName());
|
|
vo.setZt(zt);
|
|
vo.setZt(zt);
|
|
ls.add(vo);
|
|
ls.add(vo);
|
|
@@ -1489,6 +1571,7 @@ public class WtInfoPushService {
|
|
vo.setFdl(fdl);
|
|
vo.setFdl(fdl);
|
|
vo.setGl(gl);
|
|
vo.setGl(gl);
|
|
vo.setZt(zt);
|
|
vo.setZt(zt);
|
|
|
|
+ vo.setZlls(zlls);
|
|
vo.setSqname(square.getName());
|
|
vo.setSqname(square.getName());
|
|
ls.add(vo);
|
|
ls.add(vo);
|
|
map.put(square.getId(),ls);
|
|
map.put(square.getId(),ls);
|
|
@@ -1503,6 +1586,7 @@ public class WtInfoPushService {
|
|
vo.setFdl(fdl);
|
|
vo.setFdl(fdl);
|
|
vo.setGl(gl);
|
|
vo.setGl(gl);
|
|
vo.setZt(zt);
|
|
vo.setZt(zt);
|
|
|
|
+ vo.setZlls(zlls);
|
|
vos.add(vo);
|
|
vos.add(vo);
|
|
}
|
|
}
|
|
}
|
|
}
|