鞍钢鲅鱼圈能源管控系统后端代码
潘志宝
昨天 bd97649e51a4bbfae4aa485c89fdcc52f27fe17f
ansteel-biz/src/main/java/com/iailab/module/ansteel/api/controller/admin/PowerController.java
@@ -3,6 +3,7 @@
import cn.hutool.core.util.NumberUtil;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.iailab.framework.common.exception.ErrorCode;
import com.iailab.framework.common.exception.enums.GlobalErrorCodeConstants;
import com.iailab.framework.common.pojo.CommonResult;
import com.iailab.framework.common.pojo.PageResult;
@@ -38,6 +39,7 @@
import java.util.*;
import java.util.stream.Collectors;
import static com.iailab.framework.common.pojo.CommonResult.error;
import static com.iailab.framework.common.pojo.CommonResult.success;
/**
@@ -1107,15 +1109,12 @@
    @PostMapping("/power-maxdemand/page")
    @Operation(summary = "负荷移植-最大需量发生记录分页")
    public CommonResult<PageResult<PowerMaxDemandMainDTO>> getPowerMaxDemandMainPage(@RequestBody PowerMaxDemandMainPageReqVO reqVO) {
        if (StringUtils.isBlank(reqVO.getCode())) {
            log.info("code is blank");
            return error(GlobalErrorCodeConstants.BAD_REQUEST);
        }
        PageResult<PowerMaxdemandMainEntity> page = powerMaxDemandMainService.page(reqVO);
        PageResult<PowerMaxDemandMainDTO> result = BeanUtils.toBean(page, PowerMaxDemandMainDTO.class);
        /*List<String> parentIds = result.getList()
                .stream()
                .map(PowerMaxDemandMainDTO::getId)
                .collect(Collectors.toList());
        List<PowerMaxdemandDetEntity> children = powerMaxdemandDetService.selectListByRelIds(parentIds);
        Map<String, List<PowerMaxdemandDetEntity>> childrenMap = children.stream()
                .collect(Collectors.groupingBy(PowerMaxdemandDetEntity::getRelId));*/
        result.getList().forEach(dto0 -> {
            List<PowerMaxdemandDetEntity> detList0 = powerMaxdemandDetService.selectListByRelId(dto0.getId(), dto0.getOccurTime());
            dto0.setChildren(ConvertUtils.sourceToTarget(detList0, PowerMaxdemandDetDTO.class));
@@ -1128,4 +1127,15 @@
        });
        return success(result);
    }
    @PostMapping("/power-maxdemand/det-list")
    @Operation(summary = "负荷移植-最大需量发生记录详情")
    public CommonResult<List<PowerMaxdemandDetDTO>> getPowerMaxDemandDetList(@RequestParam Map<String, Object> params) {
        String relId = (String) params.get("relId");
        if (StringUtils.isBlank(relId)) {
            return error(GlobalErrorCodeConstants.BAD_REQUEST);
        }
        List<PowerMaxdemandDetEntity> list = powerMaxdemandDetService.selectListByRelId(relId);
        return success(ConvertUtils.sourceToTarget(list, PowerMaxdemandDetDTO.class));
    }
}