| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.math.BigDecimal; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Random; |
| | | import java.util.*; |
| | | |
| | | import static com.iailab.framework.common.pojo.CommonResult.success; |
| | | |
| | |
| | | if (CollectionUtils.isEmpty(result)) { |
| | | return success(result); |
| | | } |
| | | for(PowerNetFactorDTO dto : result) { |
| | | for (PowerNetFactorDTO dto : result) { |
| | | List<String> points = new ArrayList<>(); |
| | | if (StringUtils.isNotBlank(dto.getCurP())) { |
| | | points.add(dto.getCurP()); |
| | |
| | | return success(result); |
| | | } |
| | | |
| | | /** |
| | | * 判断 curCos 是否超上下限 |
| | | * {nodeName}功率因数超上限/下限。 |
| | | * <p> |
| | | * 判断 curQ |
| | | * {nodeName}发生无功返送 |
| | | */ |
| | | @GetMapping("/net-factor/alarm") |
| | | @Operation(summary = "功率因数-电网拓扑预警信息") |
| | | public CommonResult<List<String>> getPowerNetFactorAlarm(@RequestParam Map<String, Object> params) { |
| | | List<String> result = new ArrayList<>(); |
| | | List<PowerNetFactorEntity> list = powerNetFactorService.list(params); |
| | | List<PowerNetFactorDTO> dtoList = ConvertUtils.sourceToTarget(list, PowerNetFactorDTO.class); |
| | | if (CollectionUtils.isEmpty(dtoList)) { |
| | | return success(result); |
| | | } |
| | | for (PowerNetFactorDTO dto : dtoList) { |
| | | List<String> points = new ArrayList<>(); |
| | | String message = ""; |
| | | if (StringUtils.isNotBlank(dto.getCurQ())) { |
| | | points.add(dto.getCurQ()); |
| | | } |
| | | if (StringUtils.isNotBlank(dto.getCurCos())) { |
| | | points.add(dto.getCurCos()); |
| | | } |
| | | if (CollectionUtils.isEmpty(points)) { |
| | | continue; |
| | | } |
| | | |
| | | Map<String, Object> pointsRealValue = dataPointApi.queryPointsRealValue(points); |
| | | if (pointsRealValue.get(dto.getCurQ()) != null) { |
| | | BigDecimal curQ = new BigDecimal(pointsRealValue.get(dto.getCurQ()).toString()); |
| | | if (curQ.compareTo(BigDecimal.ZERO) == dto.getCurFlag()) { |
| | | message = dto.getNodeName() + "发生无功返送;"; |
| | | } |
| | | } |
| | | if (pointsRealValue.get(dto.getCurCos()) != null) { |
| | | BigDecimal curCos = new BigDecimal(pointsRealValue.get(dto.getCurCos()).toString()); |
| | | if (curCos.compareTo(dto.getLimitH()) > 0) { |
| | | message += dto.getNodeName() + "功率因数超上限"; |
| | | } else if (curCos.compareTo(dto.getLimitL()) < 0) { |
| | | message += dto.getNodeName() + "功率因数超下限"; |
| | | } |
| | | } |
| | | if (!message.isEmpty()) { |
| | | result.add(message); |
| | | } |
| | | } |
| | | return success(result); |
| | | } |
| | | |
| | | @GetMapping("/gen-status/list") |
| | | @Operation(summary = "功率因数-发电机组实时状态") |
| | | public CommonResult<List<PowerGenStatusDTO>> getPowerGenStatusList(@RequestParam Map<String, Object> params) { |
| | |
| | | if (CollectionUtils.isEmpty(result)) { |
| | | return success(result); |
| | | } |
| | | for(PowerGenStatusDTO dto : result) { |
| | | for (PowerGenStatusDTO dto : result) { |
| | | List<String> points = new ArrayList<>(); |
| | | if (StringUtils.isNotBlank(dto.getCurP())) { |
| | | points.add(dto.getCurP()); |
| | |
| | | @Operation(summary = "功率因数-管控功率因数详情") |
| | | public CommonResult<List<PowerControlDetDTO>> getPowerControlDetList(@RequestParam Map<String, Object> params) { |
| | | List<PowerControlDetDTO> result = new ArrayList<>(); |
| | | String name = (String)params.get("name"); |
| | | String name = (String) params.get("name"); |
| | | if (StringUtils.isBlank(name)) { |
| | | return CommonResult.error(GlobalErrorCodeConstants.BAD_REQUEST); |
| | | } |