From 204f5f08a07a48301472f96edf98018a335617d6 Mon Sep 17 00:00:00 2001 From: tyty Date: Tue, 11 Jul 2023 11:32:17 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=99=BA=E8=83=BD=E8=AF=8A?= =?UTF-8?q?=E6=96=AD=E7=BB=9F=E8=AE=A1=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/hnac/hzims/fdp/vo/TaskStatisticsVo.java | 2 +- .../hnac/hzims/fdp/response/FaultStateResp.java | 2 +- .../hzims/fdp/service/impl/FdpTaskServiceImpl.java | 39 ++++++++++++++++------ 3 files changed, 31 insertions(+), 12 deletions(-) diff --git a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/TaskStatisticsVo.java b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/TaskStatisticsVo.java index 9d4b4a2..0e039ec 100644 --- a/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/TaskStatisticsVo.java +++ b/hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/TaskStatisticsVo.java @@ -43,7 +43,7 @@ public class TaskStatisticsVo extends FdpTaskEntity { @ApiModelProperty(value = "几级菜单") private Integer level; @ApiModelProperty(value = "菜单名称") - private String name; + private String memuName; diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/response/FaultStateResp.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/response/FaultStateResp.java index a449dce..c10b35d 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/response/FaultStateResp.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/response/FaultStateResp.java @@ -24,7 +24,7 @@ public class FaultStateResp { // @JSONField(name = "NAME") // private String name; @ApiModelProperty("数据时间") - @JSONField(name = "NAME") + @JSONField(name = "ts") private String ts; @ApiModelProperty("状态") @JSONField(name = "STATUS") diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpTaskServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpTaskServiceImpl.java index 9db05c1..500e43c 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpTaskServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpTaskServiceImpl.java @@ -134,25 +134,25 @@ public class FdpTaskServiceImpl extends BaseServiceImpl> collectByCreateDept = fdpTaskEntities.stream().collect(Collectors.groupingBy(FdpTaskEntity::getFdpDeviceName)); - getCount("",collectByCreateDept, fdpTaskEntities, res, 1); + Map> collectByFdpDeviceName = fdpTaskEntities.stream().collect(Collectors.groupingBy(FdpTaskEntity::getFdpDeviceName)); + getCount("",collectByFdpDeviceName, fdpTaskEntities, res, 1); if (Func.isEmpty(statisticsVo.getName())) { - collectByCreateDept.entrySet().forEach(s->{ + collectByFdpDeviceName.entrySet().forEach(s->{ Map> collectByName = s.getValue().stream().collect(Collectors.groupingBy(FdpTaskEntity::getName)); getCount(s.getKey(),collectByName, s.getValue(), res, 2); }); - } else if (Func.isEmpty(statisticsVo.getFdpDeviceName())){ - collectByCreateDept.entrySet().forEach(s->{ - Map> collectByName = s.getValue().stream().collect(Collectors.groupingBy(FdpTaskEntity::getFdpDeviceName)); - getCount(s.getKey(),collectByName, s.getValue(), res, 2); + } else if (Func.isEmpty(statisticsVo.getCreateDept())){ + collectByFdpDeviceName.entrySet().forEach(s->{ + Map> collectByName = s.getValue().stream().collect(Collectors.groupingBy(FdpTaskEntity::getCreateDept)); + getCount2(s.getKey(),collectByName, s.getValue(), res, 2); }); }else if (Func.isEmpty(statisticsVo.getFdpOrd())){ - collectByCreateDept.entrySet().forEach(s->{ + collectByFdpDeviceName.entrySet().forEach(s->{ Map> collectByName = s.getValue().stream().collect(Collectors.groupingBy(FdpTaskEntity::getFdpOrd)); getCount(s.getKey(),collectByName, s.getValue(), res, 2); }); }else if (Func.isEmpty(statisticsVo.getType())){ - collectByCreateDept.entrySet().forEach(s->{ + collectByFdpDeviceName.entrySet().forEach(s->{ Map> collectByName = s.getValue().stream().collect(Collectors.groupingBy(FdpTaskEntity::getType)); getCount(s.getKey(),collectByName, s.getValue(), res, 2); }); @@ -179,7 +179,7 @@ public class FdpTaskServiceImpl extends BaseServiceImpl> collectByCreateDept, List fdpTaskEntities, ArrayList res,Integer level) { + collectByCreateDept.entrySet().forEach(s->{ + TaskStatisticsVo taskStatisticsVo = new TaskStatisticsVo(); + taskStatisticsVo.setCount(s.getValue().size()); + BigDecimal bigDecimal=BigDecimal.valueOf(s.getValue().size()).divide(BigDecimal.valueOf(fdpTaskEntities.size())); + taskStatisticsVo.setPercentage(bigDecimal.toString()); + taskStatisticsVo.setLevel(level); + R deptNameCode = sysClient.getDeptName(s.getKey()); + String deptName; + if (deptNameCode.isSuccess()){ + deptName=deptNameCode.getData(); + }else { + deptName=""; + } + taskStatisticsVo.setName(key+"-"+deptName); + res.add(taskStatisticsVo); + }); + } }