| | |
| | | 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; |
| | |
| | | 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; |
| | | |
| | | /** |
| | |
| | | @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)); |