Browse Source

修改智能诊断统计代码

zhongwei
tyty 1 year ago
parent
commit
204f5f08a0
  1. 2
      hzims-service-api/equipment-api/src/main/java/com/hnac/hzims/fdp/vo/TaskStatisticsVo.java
  2. 2
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/response/FaultStateResp.java
  3. 39
      hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpTaskServiceImpl.java

2
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;

2
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")

39
hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpTaskServiceImpl.java

@ -134,25 +134,25 @@ public class FdpTaskServiceImpl extends BaseServiceImpl<FdpTaskMapper, FdpTaskEn
taskStatisticsVo.setLevel(0);
taskStatisticsVo.setName("总计");
res.add(taskStatisticsVo);
Map<String, List<FdpTaskEntity>> collectByCreateDept = fdpTaskEntities.stream().collect(Collectors.groupingBy(FdpTaskEntity::getFdpDeviceName));
getCount("",collectByCreateDept, fdpTaskEntities, res, 1);
Map<String, List<FdpTaskEntity>> 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<String, List<FdpTaskEntity>> 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<String, List<FdpTaskEntity>> 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<Long, List<FdpTaskEntity>> 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<String, List<FdpTaskEntity>> 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<String, List<FdpTaskEntity>> 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<FdpTaskMapper, FdpTaskEn
le(FdpTaskEntity::getCreateTime, statisticsVo.getEndTime());
}
if (Func.isNotEmpty(statisticsVo.getCreateDept())) {
in(FdpTaskEntity::getCreateDept, statisticsVo.getCreateDept());
eq(FdpTaskEntity::getCreateDept, statisticsVo.getCreateDept());
}
if (Func.isNotEmpty(statisticsVo.getName())) {
like(FdpTaskEntity::getName, statisticsVo.getName());
@ -214,4 +214,23 @@ public class FdpTaskServiceImpl extends BaseServiceImpl<FdpTaskMapper, FdpTaskEn
res.add(taskStatisticsVo);
});
}
//机构类型需要转换ID为名称
private void getCount2(String key,Map<Long, List<FdpTaskEntity>> collectByCreateDept, List<FdpTaskEntity> fdpTaskEntities, ArrayList<TaskStatisticsVo> 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<String> deptNameCode = sysClient.getDeptName(s.getKey());
String deptName;
if (deptNameCode.isSuccess()){
deptName=deptNameCode.getData();
}else {
deptName="";
}
taskStatisticsVo.setName(key+"-"+deptName);
res.add(taskStatisticsVo);
});
}
}

Loading…
Cancel
Save