| | |
| | | import com.iailab.module.ansteel.api.vo.PowerCapacitorHisPageReqVO; |
| | | import com.iailab.module.ansteel.api.vo.PowerMaxDemandMainPageReqVO; |
| | | import com.iailab.module.ansteel.common.utils.DecimalUtil; |
| | | import com.iailab.module.ansteel.common.utils.PowerUtil; |
| | | import com.iailab.module.ansteel.power.entity.*; |
| | | import com.iailab.module.ansteel.power.service.*; |
| | | import com.iailab.module.data.api.point.DataPointApi; |
| | |
| | | powerNetFactorDTO.setQstatus(1); |
| | | } |
| | | } |
| | | |
| | | // 日功率因数 |
| | | if (entity.getPDay() != null && entity.getQDay() != null) { |
| | | List<String> pointNos = new ArrayList<>(); |
| | | pointNos.add(entity.getPDay()); |
| | | pointNos.add(entity.getQDay()); |
| | | Map<String, Object> pointsRealValue = dataPointApi.queryPointsRealValue(pointNos); |
| | | if (!CollectionUtils.isEmpty(pointsRealValue)) { |
| | | double pValue = new BigDecimal(pointsRealValue.get(entity.getPDay()).toString()).doubleValue(); |
| | | double qValue = new BigDecimal(pointsRealValue.get(entity.getQDay()).toString()).doubleValue(); |
| | | powerNetFactorDTO.setDayCos(new BigDecimal(PowerUtil.calculateCos(pValue, qValue)).setScale(2, BigDecimal.ROUND_HALF_UP)) ; |
| | | } |
| | | } |
| | | |
| | | // 月功率因数 |
| | | if (entity.getPMon() != null && entity.getQMon() != null) { |
| | | List<String> pointNos = new ArrayList<>(); |
| | | pointNos.add(entity.getPMon()); |
| | | pointNos.add(entity.getQMon()); |
| | | Map<String, Object> pointsRealValue = dataPointApi.queryPointsRealValue(pointNos); |
| | | if (!CollectionUtils.isEmpty(pointsRealValue)) { |
| | | double pValue = new BigDecimal(pointsRealValue.get(entity.getPMon()).toString()).doubleValue(); |
| | | double qValue = new BigDecimal(pointsRealValue.get(entity.getQMon()).toString()).doubleValue(); |
| | | powerNetFactorDTO.setMonthCos(new BigDecimal(PowerUtil.calculateCos(pValue, qValue)).setScale(2, BigDecimal.ROUND_HALF_UP)) ; |
| | | } |
| | | } |
| | | result.add(powerNetFactorDTO); |
| | | } |
| | | return success(result); |