|
@@ -1335,5 +1335,91 @@ public class IotStaticController {
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 按队伍 统计 瑞鹰 158 的 钻井 完井情况
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/ry/dailyReport/rigFinished")
|
|
|
|
|
+ @PermitAll
|
|
|
|
|
+ public CommonResult<Map<String, Object>> getRyDailyReportRigFinished() {
|
|
|
|
|
+ // 查询瑞鹰所有 队伍 项目部
|
|
|
|
|
+ Set<Long> rdChildDeptIds = deptService.getChildDeptIdListFromCache(158l);
|
|
|
|
|
+ List<DeptDO> depts =deptService.getDeptList(rdChildDeptIds);
|
|
|
|
|
+ // key队伍id value队伍所属项目部id 包含队伍的项目部
|
|
|
|
|
+ Map<Long, Long> teamProjectPair = new HashMap<>();
|
|
|
|
|
+ // key队伍id value队伍名称
|
|
|
|
|
+ Map<Long, String> teamPair = new HashMap<>();
|
|
|
|
|
+ // 项目部id集合
|
|
|
|
|
+ Set<Long> projectDeptIds = new HashSet<>();
|
|
|
|
|
+ // key项目部id value项目部名称
|
|
|
|
|
+ Map<Long, String> projectDeptPair = new HashMap<>();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(depts)) {
|
|
|
|
|
+ depts.forEach(dept -> {
|
|
|
|
|
+ if (dept.getName().contains("项目部")) {
|
|
|
|
|
+ projectDeptIds.add(dept.getId());
|
|
|
|
|
+ projectDeptPair.put(dept.getId(), dept.getName());
|
|
|
|
|
+ } else {
|
|
|
|
|
+ teamProjectPair.put(dept.getId(), dept.getParentId());
|
|
|
|
|
+ teamPair.put(dept.getId(), dept.getName());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ IotRyDailyReportPageReqVO reqVO = new IotRyDailyReportPageReqVO();
|
|
|
|
|
+ // 钻井
|
|
|
|
|
+ reqVO.setProjectClassification("2");
|
|
|
|
|
+ // 钻井 日报统计 月完井数 年完井数
|
|
|
|
|
+ List<IotRyDailyReportTaskCountVO> repairReports = iotRyDailyReportService.countDateRigTasksByDepartment();
|
|
|
|
|
+ Map<String, Integer> deptDailyPair = new HashMap<>();
|
|
|
|
|
+ Map<String, Integer> deptMonthlyPair = new HashMap<>();
|
|
|
|
|
+ Map<String, Integer> deptAnnualPair = new HashMap<>();
|
|
|
|
|
+ // 遍历集合 repairReports 找到对应的队伍
|
|
|
|
|
+ if (CollUtil.isNotEmpty(repairReports)) {
|
|
|
|
|
+ repairReports.forEach(report -> {
|
|
|
|
|
+ if (teamPair.containsKey(report.getDeptId())) {
|
|
|
|
|
+ String deptName = teamPair.get(report.getDeptId());
|
|
|
|
|
+ // 设置日完井数
|
|
|
|
|
+ deptDailyPair.put(deptName, report.getCompletedTaskCount());
|
|
|
|
|
+ // 设置月完井数
|
|
|
|
|
+ deptMonthlyPair.put(deptName, report.getMonthCompletedTaskCount());
|
|
|
|
|
+ deptAnnualPair.put(deptName, report.getYearCompletedTaskCount());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ // 遍历所有队伍 没有产生运行数据的队伍 赋值 0
|
|
|
|
|
+ teamPair.forEach((deptId, deptName) -> {
|
|
|
|
|
+ if (!deptDailyPair.containsKey(deptName)) {
|
|
|
|
|
+ deptDailyPair.put(deptName, 0);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!deptMonthlyPair.containsKey(deptName)) {
|
|
|
|
|
+ deptMonthlyPair.put(deptName, 0);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!deptAnnualPair.containsKey(deptName)) {
|
|
|
|
|
+ deptAnnualPair.put(deptName, 0);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ LinkedList<Object> xAxis = new LinkedList<>();
|
|
|
|
|
+ LinkedList<Object> dailyData = new LinkedList<>();
|
|
|
|
|
+ LinkedList<Object> monthData = new LinkedList<>();
|
|
|
|
|
+ LinkedList<Object> yearData = new LinkedList<>();
|
|
|
|
|
+
|
|
|
|
|
+ deptDailyPair.forEach( (k,v)->{
|
|
|
|
|
+ xAxis.add(k);
|
|
|
|
|
+ dailyData.add(v);
|
|
|
|
|
+ if (deptMonthlyPair.containsKey(k)) {
|
|
|
|
|
+ Integer monthCount = deptMonthlyPair.get(k);
|
|
|
|
|
+ monthData.add(monthCount);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (deptAnnualPair.containsKey(k)) {
|
|
|
|
|
+ Integer yearCount = deptAnnualPair.get(k);
|
|
|
|
|
+ yearData.add(yearCount);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ ImmutableMap<String, Serializable> dailyResult = ImmutableMap.of("name", "日累完成井数~~en**dailyFinished", "data", dailyData);
|
|
|
|
|
+ ImmutableMap<String, Serializable> monthResult = ImmutableMap.of("name", "月累完成井数~~en**monthlyFinished", "data", monthData);
|
|
|
|
|
+ ImmutableMap<String, Serializable> yearResult = ImmutableMap.of("name", "年累完井数~~en**annualFinished", "data", yearData);
|
|
|
|
|
+ return success(ImmutableMap.of("xAxis", xAxis, "series", ImmutableList.of(dailyResult, monthResult, yearResult)));
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|