| | |
| | | |
| | | @Autowired |
| | | private PowerMaxdemandMainService powerMaxDemandMainService; |
| | | |
| | | @Autowired |
| | | private PowerMaxdemandDetService powerMaxdemandDetService; |
| | | |
| | |
| | | @GetMapping("/capacitor-status/list") |
| | | @Operation(summary = "功率因数-电容器投退状态") |
| | | public CommonResult<List<PowerCapacitorStatusDTO>> getPowerCapacitorStatusList(@RequestParam Map<String, Object> params) { |
| | | List<PowerCapacitorStatusDTO> result = new ArrayList<>(); |
| | | List<PowerCapacitorStatusEntity> list = powerCapacitorStatusService.list(params); |
| | | return success(ConvertUtils.sourceToTarget(list, PowerCapacitorStatusDTO.class)); |
| | | for (PowerCapacitorStatusEntity entity : list) { |
| | | PowerCapacitorStatusDTO dto = new PowerCapacitorStatusDTO(); |
| | | dto.setId(entity.getId()); |
| | | dto.setName(entity.getName()); |
| | | dto.setRemark(entity.getRemark()); |
| | | dto.setMainCount(DecimalUtil.toBigDecimal(entity.getMainCount()).intValue()); |
| | | dto.setChildCount(DecimalUtil.toBigDecimal(entity.getChildCount()).intValue()); |
| | | int onCount = 0; |
| | | Map<String, Object> params1 = new HashMap<>(); |
| | | params1.put("statusId", entity.getId()); |
| | | List<PowerCapacitorDetEntity> detList = powerCapacitorDetService.list(params1); |
| | | if (CollectionUtils.isEmpty(detList)) { |
| | | dto.setOnCount(onCount); |
| | | continue; |
| | | } |
| | | List<String> points = new ArrayList<>(); |
| | | Map<String, Object> pointsRealValue = new HashMap<>(); |
| | | for (PowerCapacitorDetEntity det : detList) { |
| | | if (StringUtils.isNotBlank(det.getPointNo())) { |
| | | points.add(det.getPointNo()); |
| | | } |
| | | } |
| | | if (!CollectionUtils.isEmpty(points)) { |
| | | pointsRealValue = dataPointApi.queryPointsRealValue(points); |
| | | } |
| | | for (PowerCapacitorDetEntity det : detList) { |
| | | if (StringUtils.isBlank(det.getId())) { |
| | | continue; |
| | | } |
| | | Object obj = pointsRealValue.get(det.getPointNo()); |
| | | if (obj == null) { |
| | | continue; |
| | | } |
| | | BigDecimal pv = new BigDecimal(obj.toString()); |
| | | if (pv.compareTo(BigDecimal.ZERO) <= 0) { |
| | | continue; |
| | | } |
| | | onCount ++; |
| | | } |
| | | dto.setOnCount(onCount); |
| | | result.add(dto); |
| | | } |
| | | return success(result); |
| | | } |
| | | |
| | | @GetMapping("/capacitor-det/list") |
| | |
| | | public CommonResult<List<PowerCapacitorDetDTO>> getPowerCapacitorDetList(@RequestParam Map<String, Object> params) { |
| | | List<PowerCapacitorDetEntity> list = powerCapacitorDetService.list(params); |
| | | log.info("list.size=" + list.size()); |
| | | List<String> points = list.stream().map(item -> { |
| | | return item.getPointNo(); |
| | | }).collect(Collectors.toList()); |
| | | List<String> points = new ArrayList<>(); |
| | | Map<String, Object> pointsRealValue = new HashMap<>(); |
| | | for (PowerCapacitorDetEntity det : list) { |
| | | if (StringUtils.isNotBlank(det.getPointNo())) { |
| | | points.add(det.getPointNo()); |
| | | } |
| | | } |
| | | if (!CollectionUtils.isEmpty(points)) { |
| | | pointsRealValue = dataPointApi.queryPointsRealValue(points); |
| | | } |