bug调整
This commit is contained in:
@@ -333,28 +333,60 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
vo.setStatMethod(temp.getValueType());
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
if(temp.getValue()!=null) {
|
||||
double re;
|
||||
double re = 0;
|
||||
if (Objects.equals("Primary",commonStatisticalQueryParam.getDataLevel())) {
|
||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
unit = epdPqd.getUnit();
|
||||
} else {
|
||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
||||
re = DataChangeUtil.secondaryToPrimary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct) / 1000;
|
||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||
if(Objects.nonNull(epdPqd.getPrimaryFormula())){
|
||||
switch (epdPqd.getPrimaryFormula()) {
|
||||
case "*PT":
|
||||
re = temp.getValue() * pt / 1000;
|
||||
unit = "k" + epdPqd.getUnit();
|
||||
} else {
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
break;
|
||||
case "*CT":
|
||||
re = temp.getValue() * ct;
|
||||
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 {
|
||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
||||
re = DataChangeUtil.primaryToSecondary(epdPqd.getPrimaryFormula(), temp.getValue(), pt, ct);
|
||||
if(Objects.nonNull(epdPqd.getPrimaryFormula())){
|
||||
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 {
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
re = temp.getValue();
|
||||
vo.setStatisticalData(Double.valueOf(df.format(re)));
|
||||
}
|
||||
} else {
|
||||
vo.setStatisticalData(Double.valueOf(df.format(temp.getValue())));
|
||||
@@ -367,8 +399,21 @@ public class CsGroupServiceImpl extends ServiceImpl<CsGroupMapper, CsGroup> impl
|
||||
if (Objects.equals("Primary",csDataSet.getDataLevel())) {
|
||||
unit = epdPqd.getUnit();
|
||||
} else {
|
||||
if (HarmonicConstant.POWER_LIST.contains(epdPqd.getShowName())) {
|
||||
if(Objects.nonNull(epdPqd.getPrimaryFormula())){
|
||||
switch (epdPqd.getPrimaryFormula()) {
|
||||
case "*PT":
|
||||
unit = "k" + epdPqd.getUnit();
|
||||
break;
|
||||
case "*CT":
|
||||
unit = epdPqd.getUnit();
|
||||
break;
|
||||
case "*PT*CT":
|
||||
unit = "k" + epdPqd.getUnit();
|
||||
break;
|
||||
default:
|
||||
unit = epdPqd.getUnit();
|
||||
break;
|
||||
}
|
||||
}else {
|
||||
unit = epdPqd.getUnit();
|
||||
}
|
||||
|
||||
@@ -125,16 +125,28 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
portable.setName(DataParam.portableDev);
|
||||
portable.setPid("0");
|
||||
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());
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId());
|
||||
c.setComFlag(po.getRunStatus());
|
||||
c.setNDId(po.getNdid());
|
||||
c.setType("device");
|
||||
c.setName(po.getName());
|
||||
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.forEach(dev -> dev.setChildren(getChildren(dev, finalLineList)));
|
||||
checkDevSetData(portables);
|
||||
@@ -225,17 +237,30 @@ public class CsLedgerServiceImpl extends ServiceImpl<CsLedgerMapper, CsLedger> i
|
||||
portable.setName(DataParam.portableDev);
|
||||
portable.setPid("0");
|
||||
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());
|
||||
CsEquipmentDeliveryPO po = csEquipmentDeliveryMapper.selectById(c.getId());
|
||||
c.setComFlag(po.getRunStatus());
|
||||
c.setNDId(po.getNdid());
|
||||
c.setType("device");
|
||||
c.setName(po.getName());
|
||||
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());
|
||||
portable.setChildren(portables);
|
||||
|
||||
|
||||
@@ -205,30 +205,53 @@ public class DataServiceImpl implements IDataService {
|
||||
vo.setAvgValue(Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue())));
|
||||
unit = item2.getUnit();
|
||||
} else {
|
||||
if (HarmonicConstant.POWER_LIST.contains(item2.getShowName())) {
|
||||
if (Objects.isNull(statisticalDataDTO)) {
|
||||
vo.setAvgValue(3.14159);
|
||||
} else {
|
||||
re = DataChangeUtil.secondaryToPrimary(item2.getPrimaryFormula(), statisticalDataDTO.getValue(), pt, ct) / 1000;
|
||||
vo.setAvgValue(Double.valueOf(df.format(re)));
|
||||
}
|
||||
if(Objects.nonNull(item2.getPrimaryFormula())){
|
||||
switch (item2.getPrimaryFormula()) {
|
||||
case "*PT":
|
||||
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue() * pt / 1000;
|
||||
unit = "k" + item2.getUnit();
|
||||
} else {
|
||||
vo.setAvgValue(Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue())));
|
||||
break;
|
||||
case "*CT":
|
||||
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue() * ct;
|
||||
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 {
|
||||
if (Objects.equals("Primary",csDataSetLevel)) {
|
||||
if (HarmonicConstant.POWER_LIST.contains(item2.getShowName())) {
|
||||
if (Objects.isNull(statisticalDataDTO)) {
|
||||
vo.setAvgValue(3.14159);
|
||||
} else {
|
||||
re = DataChangeUtil.primaryToSecondary(item2.getPrimaryFormula(), statisticalDataDTO.getValue(), pt, ct);
|
||||
vo.setAvgValue(Double.valueOf(df.format(re)));
|
||||
if(Objects.nonNull(item2.getPrimaryFormula())) {
|
||||
switch (item2.getPrimaryFormula()) {
|
||||
case "*PT":
|
||||
re = Objects.isNull(statisticalDataDTO) ? 3.14159 : statisticalDataDTO.getValue() / pt;
|
||||
break;
|
||||
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;
|
||||
}
|
||||
vo.setAvgValue(Double.valueOf(df.format(re)));
|
||||
}else {
|
||||
vo.setAvgValue(Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue())));
|
||||
re = statisticalDataDTO.getValue();
|
||||
vo.setAvgValue(Double.valueOf(df.format(re)));
|
||||
}
|
||||
} else {
|
||||
vo.setAvgValue(Objects.isNull(statisticalDataDTO) ? 3.14159 : Double.parseDouble(df.format(statisticalDataDTO.getValue())));
|
||||
|
||||
Reference in New Issue
Block a user