bug调整

This commit is contained in:
xy
2024-12-19 10:29:02 +08:00
parent 86d21f984c
commit c28724bb05
3 changed files with 144 additions and 51 deletions

View File

@@ -333,28 +333,60 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
vo.setStatMethod(temp.getValueType()); vo.setStatMethod(temp.getValueType());
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue()))); vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
if(temp.getValue()!=null) { if(temp.getValue()!=null) {
double re; double re = 0;
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) { if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
if (Objects.equals("Primary",csDataSet.getDataLevel())) { if (Objects.equals("Primary",csDataSet.getDataLevel())) {
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue()))); vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
unit = epdPqd.getUnit(); unit = epdPqd.getUnit();
} else { } else {
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) { if(Objects.nonNull(epdPqd.getPrimaryFormula())){
re = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct) / 1000; switch (epdPqd.getPrimaryFormula()) {
vo.setStatisticalData(Double.valueOf(df.format(re))); case "*PT":
re = temp.getValue() * pt / 1000;
unit = "k" + epdPqd.getUnit(); unit = "k" + epdPqd.getUnit();
} else { break;
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue()))); case "*CT":
re = temp.getValue() * ct;
unit = epdPqd.getUnit(); unit = epdPqd.getUnit();
break;
case "*PT*CT":
re = temp.getValue() * pt * ct / 1000;
unit = "k" + epdPqd.getUnit();
break;
default:
re = temp.getValue();
unit = epdPqd.getUnit();
break;
} }
vo.setStatisticalData(Double.valueOf(df.format(re)));
}else {
re = temp.getValue();
unit = epdPqd.getUnit();
vo.setStatisticalData(Double.valueOf(df.format(re)));
}
} }
} else { } else {
if (Objects.equals("Primary",csDataSet.getDataLevel())) { if (Objects.equals("Primary",csDataSet.getDataLevel())) {
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) { if(Objects.nonNull(epdPqd.getPrimaryFormula())){
re = DataChangeUtil.primaryToSecondary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct); switch (epdPqd.getPrimaryFormula()) {
case "*PT":
re = temp.getValue() / pt;
break;
case "*CT":
re = temp.getValue() / ct;
break;
case "*PT*CT":
re = temp.getValue() / pt / ct;
break;
default:
re = temp.getValue();
break;
}
vo.setStatisticalData(Double.valueOf(df.format(re)));
}else {
re = temp.getValue();
vo.setStatisticalData(Double.valueOf(df.format(re))); vo.setStatisticalData(Double.valueOf(df.format(re)));
} else {
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
} }
} else { } else {
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue()))); vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
@@ -367,9 +399,22 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
if (Objects.equals("Primary",csDataSet.getDataLevel())) { if (Objects.equals("Primary",csDataSet.getDataLevel())) {
unit = epdPqd.getUnit(); unit = epdPqd.getUnit();
} else { } else {
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) { if(Objects.nonNull(epdPqd.getPrimaryFormula())){
switch (epdPqd.getPrimaryFormula()) {
case "*PT":
unit = "k" + epdPqd.getUnit(); unit = "k" + epdPqd.getUnit();
} else { break;
case "*CT":
unit = epdPqd.getUnit();
break;
case "*PT*CT":
unit = "k" + epdPqd.getUnit();
break;
default:
unit = epdPqd.getUnit();
break;
}
}else {
unit = epdPqd.getUnit(); unit = epdPqd.getUnit();
} }
} }

View File

@@ -125,16 +125,28 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
portable.setName(DataParam.portableDev); portable.setName(DataParam.portableDev);
portable.setPid("0"); portable.setPid("0");
portable.setId(IdUtil.simpleUUID()); portable.setId(IdUtil.simpleUUID());
List<CsLedgerVO> portables = allList.stream().filter(item->Objects.equals(item.getLevel(),2) && Objects.equals(item.getPid(),"0")).collect(Collectors.toList()); //针对未启用的装置判断
for(CsLedgerVO c : portables){ List<CsLedgerVO> ledger = allList.stream()
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
.collect(Collectors.toList());
Map<String, CsEquipmentDeliveryPO> poMap2 = ledger.stream()
.collect(Collectors.toMap(
CsLedgerVO::getId,
csEquipmentDeliveryMapper::selectById,
(existing, replacement) -> existing
));
List<CsLedgerVO> portables = ledger.stream()
.peek(c -> {
CsEquipmentDeliveryPO po = poMap2.get(c.getId());
c.setPid(portable.getId()); c.setPid(portable.getId());
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId());
c.setComFlag(po.getRunStatus()); c.setComFlag(po.getRunStatus());
c.setNDId(po.getNdid()); c.setNDId(po.getNdid());
c.setType("device"); c.setType("device");
c.setName(po.getName()); c.setName(po.getName());
c.setSort(po.getSort()); c.setSort(po.getSort());
} })
.filter(c -> poMap2.get(c.getId()).getUsageStatus() == 1)
.collect(Collectors.toList());
portables = portables.stream().sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList()); portables = portables.stream().sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
portables.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList))); portables.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
checkDevSetData(portables); checkDevSetData(portables);
@@ -225,17 +237,30 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
portable.setName(DataParam.portableDev); portable.setName(DataParam.portableDev);
portable.setPid("0"); portable.setPid("0");
portable.setId(IdUtil.simpleUUID()); portable.setId(IdUtil.simpleUUID());
List<CsLedgerVO> portables = allList.stream().filter(item->Objects.equals(item.getLevel(),2) && Objects.equals(item.getPid(),"0")).collect(Collectors.toList());
checkDevSetData(portables); //针对未启用的装置判断
for(CsLedgerVO c : portables){ List<CsLedgerVO> ledger = allList.stream()
.filter(item -> Objects.equals(item.getLevel(), 2) && Objects.equals(item.getPid(), "0"))
.collect(Collectors.toList());
Map<String, CsEquipmentDeliveryPO> poMap2 = ledger.stream()
.collect(Collectors.toMap(
CsLedgerVO::getId,
csEquipmentDeliveryMapper::selectById,
(existing, replacement) -> existing
));
List<CsLedgerVO> portables = ledger.stream()
.peek(c -> {
CsEquipmentDeliveryPO po = poMap2.get(c.getId());
c.setPid(portable.getId()); c.setPid(portable.getId());
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId());
c.setComFlag(po.getRunStatus()); c.setComFlag(po.getRunStatus());
c.setNDId(po.getNdid()); c.setNDId(po.getNdid());
c.setType("device"); c.setType("device");
c.setName(po.getName()); c.setName(po.getName());
c.setSort(po.getSort()); c.setSort(po.getSort());
} })
.filter(c -> poMap2.get(c.getId()).getUsageStatus() == 1)
.collect(Collectors.toList());
portables = portables.stream().sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList()); portables = portables.stream().sorted(Comparator.comparing(CsLedgerVO::getSort)).collect(Collectors.toList());
portable.setChildren(portables); portable.setChildren(portables);

View File

@@ -205,30 +205,53 @@ public class DataServiceImpl implements IDataService {
vo.setAvgValue(Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue()))); vo.setAvgValue(Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue())));
unit = item2.getUnit(); unit = item2.getUnit();
} else { } else {
if (HarmonicConstant.POWER_LIST.contains(item2.getShowName())) { if(Objects.nonNull(item2.getPrimaryFormula())){
if (Objects.isNull(statisticalDataDTO)) { switch (item2.getPrimaryFormula()) {
vo.setAvgValue(3.14159); case "*PT":
} else { re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue() * pt / 1000;
re = DataChangeUtil.secondaryToPrimary(item2.getPrimaryFormula(), statisticalDataDTO.getValue(), pt, ct) / 1000;
vo.setAvgValue(Double.valueOf(df.format(re)));
}
unit = "k" + item2.getUnit(); unit = "k" + item2.getUnit();
} else { break;
vo.setAvgValue(Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue()))); case "*CT":
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue() * ct;
unit = item2.getUnit(); unit = item2.getUnit();
break;
case "*PT*CT":
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue() * pt * ct / 1000;
unit = "k" + item2.getUnit();
break;
default:
re = statisticalDataDTO.getValue();
unit = item2.getUnit();
break;
}
vo.setAvgValue(Double.valueOf(df.format(re)));
}else {
re = statisticalDataDTO.getValue();
unit = item2.getUnit();
vo.setAvgValue(Double.valueOf(df.format(re)));
} }
} }
} else { } else {
if (Objects.equals("Primary",csDataSetLevel)) { if (Objects.equals("Primary",csDataSetLevel)) {
if (HarmonicConstant.POWER_LIST.contains(item2.getShowName())) { if(Objects.nonNull(item2.getPrimaryFormula())) {
if (Objects.isNull(statisticalDataDTO)) { switch (item2.getPrimaryFormula()) {
vo.setAvgValue(3.14159); case "*PT":
} else { re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue() / pt;
re = DataChangeUtil.primaryToSecondary(item2.getPrimaryFormula(), statisticalDataDTO.getValue(), pt, ct); break;
vo.setAvgValue(Double.valueOf(df.format(re))); case "*CT":
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue() / ct;
break;
case "*PT*CT":
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue() / pt / ct / 1000;
break;
default:
re = statisticalDataDTO.getValue();
break;
} }
} else { vo.setAvgValue(Double.valueOf(df.format(re)));
vo.setAvgValue(Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue()))); }else {
re = statisticalDataDTO.getValue();
vo.setAvgValue(Double.valueOf(df.format(re)));
} }
} else { } else {
vo.setAvgValue(Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue()))); vo.setAvgValue(Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue())));