| | |
| | | import com.iailab.module.ansteel.power.entity.*; |
| | | import com.iailab.module.ansteel.power.service.*; |
| | | import com.iailab.module.data.api.point.DataPointApi; |
| | | import com.iailab.module.data.api.point.dto.ApiPointValueDTO; |
| | | import com.iailab.module.data.api.point.dto.ApiPointValueQueryDTO; |
| | | import com.iailab.module.model.api.mcs.McsApi; |
| | | import com.iailab.module.model.api.mcs.dto.PredictLastValueReqVO; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | |
| | | |
| | | @Autowired |
| | | private PowerGenStatusDaoService powerGenStatusDaoService; |
| | | |
| | | @Autowired |
| | | private PowerDemandService powerDemandService; |
| | | |
| | | @Resource |
| | | private DataPointApi dataPointApi; |
| | |
| | | } |
| | | } |
| | | } |
| | | return success(result); |
| | | } |
| | | |
| | | @GetMapping("/net-factor-dropdown/list") |
| | | @Operation(summary = "功率因数-电网拓扑下拉列表") |
| | | public CommonResult<List<PowerNetFactorDropdownDTO>> getPowerNetFactorDropdownList(@RequestParam String nodeName) { |
| | | List<PowerNetFactorEntity> list = powerNetFactorService.listDropdown(nodeName); |
| | | List<PowerNetFactorDropdownDTO> result = ConvertUtils.sourceToTarget(list, PowerNetFactorDropdownDTO.class); |
| | | return success(result); |
| | | } |
| | | |
| | |
| | | }); |
| | | return success(result); |
| | | } |
| | | @GetMapping("/demand/list") |
| | | @Operation(summary = "负荷移植-月最大需量,实测需量,有功功率") |
| | | public CommonResult<List<PowerDemandDTO>> getPowerDemandList(@RequestParam Map<String, Object> params) { |
| | | List<PowerDemandEntity> list = powerDemandService.list(params); |
| | | List<PowerDemandDTO> result = ConvertUtils.sourceToTarget(list, PowerDemandDTO.class); |
| | | if (CollectionUtils.isEmpty(result)) { |
| | | return success(result); |
| | | } |
| | | for (PowerDemandDTO dto : result) { |
| | | List<String> points = new ArrayList<>(); |
| | | if (StringUtils.isNotBlank(dto.getCurDemand())) { |
| | | points.add(dto.getCurDemand()); |
| | | } |
| | | if (StringUtils.isNotBlank(dto.getActivePower())) { |
| | | points.add(dto.getActivePower()); |
| | | } |
| | | |
| | | if (!CollectionUtils.isEmpty(points)) { |
| | | |
| | | Map<String, Object> pointsRealValue = dataPointApi.queryPointsRealValue(points); |
| | | |
| | | if (pointsRealValue.get(dto.getCurDemand()) != null) { |
| | | dto.setCurDemand(pointsRealValue.get(dto.getCurDemand()).toString()); |
| | | } |
| | | if (pointsRealValue.get(dto.getActivePower()) != null) { |
| | | dto.setActivePower(pointsRealValue.get(dto.getActivePower()).toString()); |
| | | } |
| | | } |
| | | |
| | | if (!StringUtils.isEmpty(dto.getMaxDemand())) { |
| | | Calendar calendar = Calendar.getInstance(); |
| | | calendar.set(Calendar.DAY_OF_MONTH, 1); |
| | | calendar.set(Calendar.HOUR_OF_DAY, 0); |
| | | calendar.set(Calendar.MINUTE, 0); |
| | | calendar.set(Calendar.SECOND, 0); |
| | | calendar.set(Calendar.MILLISECOND, 0); |
| | | Date start = calendar.getTime(); |
| | | calendar.add(Calendar.MONTH, 1); |
| | | Date end = calendar.getTime(); |
| | | ApiPointValueQueryDTO apiPointValueQueryDTO = new ApiPointValueQueryDTO(); |
| | | apiPointValueQueryDTO.setStart(start); |
| | | apiPointValueQueryDTO.setEnd(end); |
| | | apiPointValueQueryDTO.setPointNo(dto.getMaxDemand()); |
| | | |
| | | List<ApiPointValueDTO> monthValues = dataPointApi.queryPointHistoryValue(apiPointValueQueryDTO); |
| | | double max = 0; |
| | | for (int i = 0; i < monthValues.size()-1; i++) { |
| | | if(max < monthValues.get(i).getV()){ |
| | | max = monthValues.get(i).getV(); |
| | | } |
| | | } |
| | | dto.setMaxDemand(String.valueOf(max)); |
| | | } |
| | | |
| | | |
| | | } |
| | | |
| | | return success(result); |
| | | } |
| | | } |