diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/DutyGroupVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/DutyGroupVo.java new file mode 100644 index 0000000..3844d02 --- /dev/null +++ b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/DutyGroupVo.java @@ -0,0 +1,42 @@ +package com.hnac.hzims.operational.census.vo; + +import com.fasterxml.jackson.databind.annotation.JsonSerialize; +import com.fasterxml.jackson.databind.ser.std.NullSerializer; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author ysj + * @date 2023/03/14 15:01:17 + * @version 4.0.0 + */ +@Data +public class DutyGroupVo { + + @ApiModelProperty("区域Id") + private Long deptId; + + @ApiModelProperty("区域名称") + private String areaName; + + @ApiModelProperty("工作票数量") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Integer work; + + @ApiModelProperty("操作票数量") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Integer operateoperate; + + @ApiModelProperty("巡检任务数量") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Integer inspect; + + + @ApiModelProperty("消缺数量") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Integer defect; + + @ApiModelProperty("定期工作数量") + @JsonSerialize(nullsUsing = NullSerializer.class) + private Integer regularly; +} diff --git a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/TicketGroupVo.java b/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/TicketGroupVo.java deleted file mode 100644 index 492ba38..0000000 --- a/hzims-service-api/hzims-operational-api/src/main/java/com/hnac/hzims/operational/census/vo/TicketGroupVo.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.hnac.hzims.operational.census.vo; - -import com.fasterxml.jackson.databind.annotation.JsonSerialize; -import com.fasterxml.jackson.databind.ser.std.NullSerializer; -import io.swagger.annotations.ApiModelProperty; -import lombok.Data; - -/** - * @author ysj - * @date 2023/03/14 15:01:17 - * @version 4.0.0 - */ -@Data -public class TicketGroupVo { - - @ApiModelProperty("区域Id") - private Long deptId; - - @ApiModelProperty("区域名称") - private String areaName; - - @ApiModelProperty("票据数量") - @JsonSerialize(nullsUsing = NullSerializer.class) - private Integer count; -} diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/TargetController.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/TargetController.java index 9fc6706..d2fe088 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/TargetController.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/controller/TargetController.java @@ -140,9 +140,9 @@ public class TargetController { @ApiLog @ApiOperation("集团操作票/工作票") - @GetMapping("/ticket-group") + @GetMapping("/duty-group") @ApiOperationSupport(order = 14) - public R ticketGroup(@RequestParam(value = "areaName",required = false) String areaName,@RequestParam(value = "type") Long type) { - return R.data(service.ticketGroup(areaName,type)); + public R dutygroup(@RequestParam(value = "areaName",required = false) String areaName,@RequestParam(value = "type") Long type) { + return R.data(service.dutyGroup(areaName,type)); } } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/TargetService.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/TargetService.java index 626b59e..6009791 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/TargetService.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/TargetService.java @@ -4,7 +4,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.hnac.hzims.operational.access.dto.OperAccessTaskDTO; import com.hnac.hzims.operational.access.vo.OperAccessTaskVO; import com.hnac.hzims.operational.census.vo.*; -import com.hnac.hzims.operational.main.vo.PhotovoltaicTargetVo; import com.hnac.hzims.operational.maintenance.dto.OperMaintenanceTaskDTO; import com.hnac.hzims.operational.maintenance.vo.OperMaintenanceTaskVO; import org.springblade.core.mp.support.Query; @@ -62,6 +61,5 @@ public interface TargetService { List deviceGroup(String areaName); // 集团工作牌/操作票 - List ticketGroup(String areaName,Long type); - + List dutyGroup(String areaName, Long type); } diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java index 9e2c45a..b79e535 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/census/service/impl/TargetServiceImpl.java @@ -1009,7 +1009,7 @@ public class TargetServiceImpl implements TargetService { * @return */ @Override - public List ticketGroup(String areaName,Long type) { + public List dutyGroup(String areaName, Long type) { // 获取区域机构 Map> areas = areaService.getAuthArea(null,null,Collections.singletonList(HomePageConstant.HYDROPOWER),HomePageConstant.HYDROPOWER_SERVETYPE); if(MapUtils.isEmpty(areas)){ @@ -1017,21 +1017,31 @@ public class TargetServiceImpl implements TargetService { } // redis中取区域数据 List areaDutyVoList = (List) redisTemplate.opsForValue().get(areaDutyInfoKey); - return areas.entrySet().stream().filter(o-> StringUtil.isEmpty(areaName) || o.getKey().getDeptName().contains(areaName)).map(area->{ - TicketGroupVo ticket = new TicketGroupVo(); - ticket.setDeptId(area.getKey().getId()); - ticket.setAreaName(area.getKey().getDeptName()); - List dutys = areaDutyVoList.stream().filter(duty-> duty.getDepartId().equals(area.getKey().getId())).collect(Collectors.toList()); - if(CollectionUtil.isEmpty(dutys)){ - ticket.setCount(0); - return ticket; + return areas.keySet().stream().filter(stationEntities -> StringUtil.isEmpty(areaName) || stationEntities.getDeptName().contains(areaName)).map(stationEntities -> { + DutyGroupVo duty = new DutyGroupVo(); + duty.setDeptId(stationEntities.getId()); + duty.setAreaName(stationEntities.getDeptName()); + List dutys = areaDutyVoList.stream().filter(area -> area.getDepartId().equals(stationEntities.getId())).collect(Collectors.toList()); + if (CollectionUtil.isEmpty(dutys)) { + return duty; } - if(type == 0){ - ticket.setCount(dutys.get(0).getOperationTicketCount()); - }else{ - ticket.setCount(dutys.get(0).getWorkTicketCount()); + // 操作票 + if (type == 0) { + duty.setOperateoperate(dutys.get(0).getOperationTicketCount()); + // 工作票 + } else if (type == 1) { + duty.setWork(dutys.get(0).getWorkTicketCount()); + // 巡检 + } else if (type == 2) { + duty.setInspect(dutys.get(0).getInspectionSum()); + // 缺陷 + } else if (type == 3) { + duty.setDefect(dutys.get(0).getShortagesSum()); + // 定期工作 + } else if (type == 4) { + duty.setRegularly(dutys.get(0).getWorkRegularlySum()); } - return ticket; + return duty; }).collect(Collectors.toList()); }