|
@@ -18,9 +18,11 @@ import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.soc.IotSocSourceDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.soc.IotSocSummaryDO;
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.soc.IotSocSummaryDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.qhse.soc.IotSocSourceMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.qhse.soc.IotSocSourceMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.qhse.soc.IotSocSummaryMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.qhse.soc.IotSocSummaryMapper;
|
|
|
|
|
+import cn.iocoder.yudao.module.pms.service.qhse.soc.IotSocSourceService;
|
|
|
import cn.iocoder.yudao.module.pms.service.qhse.soc.IotSocSummaryService;
|
|
import cn.iocoder.yudao.module.pms.service.qhse.soc.IotSocSummaryService;
|
|
|
import cn.iocoder.yudao.module.pms.util.SafetyObservationCardGenerator;
|
|
import cn.iocoder.yudao.module.pms.util.SafetyObservationCardGenerator;
|
|
|
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
|
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
|
|
|
|
+import com.google.common.collect.ImmutableList;
|
|
|
import com.google.common.collect.ImmutableMap;
|
|
import com.google.common.collect.ImmutableMap;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
@@ -59,6 +61,8 @@ public class IotSocSummaryController {
|
|
|
private IotSocSummaryMapper iotSocSummaryMapper;
|
|
private IotSocSummaryMapper iotSocSummaryMapper;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private DeptService deptService;
|
|
private DeptService deptService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IotSocSourceService iotSocSourceService;
|
|
|
|
|
|
|
|
@PostMapping("/create")
|
|
@PostMapping("/create")
|
|
|
@Operation(summary = "创建SOC卡汇总")
|
|
@Operation(summary = "创建SOC卡汇总")
|
|
@@ -218,29 +222,20 @@ public class IotSocSummaryController {
|
|
|
ids = new HashSet<>();
|
|
ids = new HashSet<>();
|
|
|
}
|
|
}
|
|
|
List<ImmutableMap> results = new ArrayList<>();
|
|
List<ImmutableMap> results = new ArrayList<>();
|
|
|
- Map person = new HashMap();
|
|
|
|
|
|
|
+// Map person = new HashMap();
|
|
|
list.stream().filter(e -> "不安全".equals(e.getName())).findFirst().ifPresent(e -> {
|
|
list.stream().filter(e -> "不安全".equals(e.getName())).findFirst().ifPresent(e -> {
|
|
|
List<IotSocSourceDO> summaryDOS = iotSocSourceMapper.selectList("parent_id", e.getId());
|
|
List<IotSocSourceDO> summaryDOS = iotSocSourceMapper.selectList("parent_id", e.getId());
|
|
|
AtomicReference<Long> unsafe = new AtomicReference<>(0L);
|
|
AtomicReference<Long> unsafe = new AtomicReference<>(0L);
|
|
|
summaryDOS.forEach(item -> {
|
|
summaryDOS.forEach(item -> {
|
|
|
|
|
+ List<String> collect = iotSocSourceService.getChildSocSourceList(ImmutableList.of(item.getId())).stream().map(gg -> String.valueOf(gg.getId())).collect(Collectors.toList());
|
|
|
|
|
+ collect.add(String.valueOf(item.getId()));
|
|
|
IotSocSummaryPageReqVO pageReqVO1 = new IotSocSummaryPageReqVO();
|
|
IotSocSummaryPageReqVO pageReqVO1 = new IotSocSummaryPageReqVO();
|
|
|
- pageReqVO1.setSocClass(String.valueOf(item.getId()));
|
|
|
|
|
|
|
+// pageReqVO1.setSocClass(String.valueOf(item.getId()));
|
|
|
|
|
+ pageReqVO1.setSocClasses(collect);
|
|
|
pageReqVO1.setObservationDate(pageReqVO.getObservationDate());
|
|
pageReqVO1.setObservationDate(pageReqVO.getObservationDate());
|
|
|
Long count = iotSocSummaryMapper.selectCountBySocClassAndTime(pageReqVO1, ids);
|
|
Long count = iotSocSummaryMapper.selectCountBySocClassAndTime(pageReqVO1, ids);
|
|
|
- results.add(ImmutableMap.of(item.getName(), count));
|
|
|
|
|
|
|
+ results.add(ImmutableMap.of(item.getName(), count,"id", item.getId()));
|
|
|
unsafe.set(unsafe.get() + count);
|
|
unsafe.set(unsafe.get() + count);
|
|
|
-
|
|
|
|
|
- List<IotSocSourceDO> childIds = iotSocSourceMapper.selectList("parent_id", item.getId());
|
|
|
|
|
- List<ImmutableMap> countList = new ArrayList<>();
|
|
|
|
|
- childIds.forEach(child -> {
|
|
|
|
|
- IotSocSummaryPageReqVO pageReqVO2 = new IotSocSummaryPageReqVO();
|
|
|
|
|
- pageReqVO2.setSocClass(String.valueOf(child.getId()));
|
|
|
|
|
- pageReqVO2.setObservationDate(pageReqVO.getObservationDate());
|
|
|
|
|
- Long childCount = iotSocSummaryMapper.selectCountBySocClassAndTime(pageReqVO2, ids);
|
|
|
|
|
- countList.add(ImmutableMap.of(child.getName(), childCount));
|
|
|
|
|
- });
|
|
|
|
|
- person.put(item.getName(), countList);
|
|
|
|
|
-
|
|
|
|
|
});
|
|
});
|
|
|
results.add(ImmutableMap.of("不安全", unsafe.get()));
|
|
results.add(ImmutableMap.of("不安全", unsafe.get()));
|
|
|
});
|
|
});
|
|
@@ -252,7 +247,38 @@ public class IotSocSummaryController {
|
|
|
results.add(ImmutableMap.of(e.getName(), count));
|
|
results.add(ImmutableMap.of(e.getName(), count));
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- return success(ImmutableMap.of("total", results, "child", person));
|
|
|
|
|
|
|
+ return success(ImmutableMap.of("total", results));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ @GetMapping("/stat/child")
|
|
|
|
|
+ @PermitAll
|
|
|
|
|
+ public CommonResult<ImmutableMap> statSocChild(IotSocSummaryPageReqVO pageReqVO) {
|
|
|
|
|
+ List<IotSocSourceDO> list = iotSocSourceMapper.selectList();
|
|
|
|
|
+ Long deptId = pageReqVO.getDeptId();
|
|
|
|
|
+ if (Objects.isNull(pageReqVO.getDeptId())) {
|
|
|
|
|
+ deptId = SecurityFrameworkUtils.getLoginUserDeptId();
|
|
|
|
|
+ }
|
|
|
|
|
+ Set<Long> ids;
|
|
|
|
|
+ if (Objects.nonNull(deptId)) {
|
|
|
|
|
+ ids = deptService.getChildDeptIdListFromCache(deptId);
|
|
|
|
|
+ ids.add(pageReqVO.getDeptId());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ ids = new HashSet<>();
|
|
|
|
|
+ }
|
|
|
|
|
+ List<ImmutableMap> results = new ArrayList<>();
|
|
|
|
|
+ List<IotSocSourceDO> summaryDOS = iotSocSourceMapper.selectList("parent_id", pageReqVO.getSocClass());
|
|
|
|
|
+ summaryDOS.forEach(item -> {
|
|
|
|
|
+ List<String> collect = iotSocSourceService.getChildSocSourceList(ImmutableList.of(item.getId())).stream().map(gg -> String.valueOf(gg.getId())).collect(Collectors.toList());
|
|
|
|
|
+ collect.add(String.valueOf(item.getId()));
|
|
|
|
|
+ IotSocSummaryPageReqVO pageReqVO1 = new IotSocSummaryPageReqVO();
|
|
|
|
|
+// pageReqVO1.setSocClass(String.valueOf(item.getId()));
|
|
|
|
|
+ pageReqVO1.setSocClasses(collect);
|
|
|
|
|
+ pageReqVO1.setObservationDate(pageReqVO.getObservationDate());
|
|
|
|
|
+ Long count = iotSocSummaryMapper.selectCountBySocClassAndTime(pageReqVO1, ids);
|
|
|
|
|
+ results.add(ImmutableMap.of(item.getName(), count));
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ return success(ImmutableMap.of("total", results));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
}
|
|
}
|