鞍钢鲅鱼圈能源管控系统后端代码
liriming
9 天以前 bd41a1f5a197ef5d1c9d65c0ba9b4e4df667cb49
ansteel-biz/src/main/java/com/iailab/module/ansteel/api/controller/admin/PowerController.java
@@ -91,41 +91,47 @@
    @GetMapping("/net-factor/alarm")
    @Operation(summary = "功率因数-电网拓扑预警信息")
    public CommonResult<String> getPowerNetFactorAlarm(@RequestParam Map<String, Object> params) {
        String result = "";
        PowerNetFactorDTO dto = powerNetFactorService.selectById(params);
        if (Objects.isNull(dto)) {
    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);
        }
        List<String> points = new ArrayList<>();
        if (StringUtils.isNotBlank(dto.getCurQ())) {
            points.add(dto.getCurQ());
        }
        if (CollectionUtils.isEmpty(points)) {
            return success(result);
        }
        Map<String, Object> pointsRealValue = dataPointApi.queryPointsRealValue(points);
        if (pointsRealValue.get(dto.getCurQ()) == null) {
            return success(result);
        }
        BigDecimal curQ = new BigDecimal(pointsRealValue.get(dto.getCurQ()).toString());
        if (dto.getCurFlag().compareTo(BigDecimal.ZERO) > 0) {
            if (curQ.compareTo(BigDecimal.ZERO) > 0) {
                result = dto.getNodeName() + "发生无功返送;";
        for (PowerNetFactorDTO dto : dtoList) {
            String message = "";
            List<String> points = new ArrayList<>();
            if (StringUtils.isNotBlank(dto.getCurQ())) {
                points.add(dto.getCurQ());
            }
        } else {
            if (curQ.compareTo(BigDecimal.ZERO) < 0) {
                result = dto.getNodeName() + "发生无功返送;";
            if (CollectionUtils.isEmpty(points)) {
                return success(result);
            }
        }
        if (dto.getStatus() > 0) {
            Map<String, Object> pointsRealValue = dataPointApi.queryPointsRealValue(points);
            if (pointsRealValue.get(dto.getCurQ()) == null) {
                return success(result);
            }
            BigDecimal curQ = new BigDecimal(pointsRealValue.get(dto.getCurQ()).toString());
            if (dto.getCurFlag().compareTo(BigDecimal.ZERO) > 0) {
                if (curQ.compareTo(BigDecimal.ZERO) > 0) {
                    message = dto.getNodeName() + "发生无功返送;";
                }
            } else {
                if (curQ.compareTo(BigDecimal.ZERO) < 0) {
                    message = dto.getNodeName() + "发生无功返送;";
                }
            }
            BigDecimal curCos = new BigDecimal(dto.getCurCos());
            if (curCos.compareTo(dto.getLimitH()) > 0) {
                result += dto.getNodeName() + "功率因数超上限";
                message += dto.getNodeName() + "功率因数超上限";
            }else if (curCos.compareTo(dto.getLimitL()) < 0) {
                result += dto.getNodeName() + "功率因数超下限";
                message += dto.getNodeName() + "功率因数超下限";
            }
            if(!"".equals(message)) {
                result.add(message);
            }
        }
        return success(result);
    }