|
@@ -1,6 +1,7 @@
|
|
|
package cn.iocoder.yudao.module.pms.controller.admin.stat;
|
|
package cn.iocoder.yudao.module.pms.controller.admin.stat;
|
|
|
|
|
|
|
|
import cn.hutool.core.collection.CollUtil;
|
|
import cn.hutool.core.collection.CollUtil;
|
|
|
|
|
+import cn.hutool.core.util.StrUtil;
|
|
|
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
|
import cn.iocoder.yudao.framework.common.exception.ErrorCode;
|
|
|
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
|
import cn.iocoder.yudao.framework.common.exception.ServiceException;
|
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
@@ -19,6 +20,8 @@ import cn.iocoder.yudao.module.pms.controller.admin.iotmainworkorder.vo.IotMainW
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotoutbound.vo.IotOutboundPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotoutbound.vo.IotOutboundPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotrhdailyreport.vo.IotRhDailyReportPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotrhdailyreport.vo.IotRhDailyReportPageReqVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotrydailyreport.vo.IotRyDailyReportPageReqVO;
|
|
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotrydailyreport.vo.IotRyDailyReportTaskCountVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.maintain.vo.IotMaintainPageReqVO;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.maintain.vo.IotMaintainPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.stat.vo.OrderVo;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.stat.vo.OrderVo;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.stat.vo.YearTotalGas;
|
|
import cn.iocoder.yudao.module.pms.controller.admin.stat.vo.YearTotalGas;
|
|
@@ -47,14 +50,17 @@ import cn.iocoder.yudao.module.pms.dal.mysql.iotmainworkorder.IotMainWorkOrderMa
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotopeationfill.IotOpeationFillMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotopeationfill.IotOpeationFillMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotoutbound.IotOutboundMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotoutbound.IotOutboundMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotrhdailyreport.IotRhDailyReportMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotrhdailyreport.IotRhDailyReportMapper;
|
|
|
|
|
+import cn.iocoder.yudao.module.pms.dal.mysql.iotrydailyreport.IotRyDailyReportMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotsapstock.IotSapStockMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotsapstock.IotSapStockMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.maintain.IotMaintainMapper;
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.maintain.IotMaintainMapper;
|
|
|
import cn.iocoder.yudao.module.pms.service.DeviceServiceImpl;
|
|
import cn.iocoder.yudao.module.pms.service.DeviceServiceImpl;
|
|
|
import cn.iocoder.yudao.module.pms.service.inspect.IotInspectOrderService;
|
|
import cn.iocoder.yudao.module.pms.service.inspect.IotInspectOrderService;
|
|
|
|
|
+import cn.iocoder.yudao.module.pms.service.iotrydailyreport.IotRyDailyReportService;
|
|
|
import cn.iocoder.yudao.module.pms.service.maintain.IotMaintainService;
|
|
import cn.iocoder.yudao.module.pms.service.maintain.IotMaintainService;
|
|
|
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
|
import cn.iocoder.yudao.module.system.api.dept.DeptApi;
|
|
|
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
|
import cn.iocoder.yudao.module.system.api.dept.dto.DeptRespDTO;
|
|
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
|
|
|
|
+import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
|
|
|
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
|
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
|
|
import cn.iocoder.yudao.module.system.service.dict.DictDataService;
|
|
import cn.iocoder.yudao.module.system.service.dict.DictDataService;
|
|
@@ -138,6 +144,10 @@ public class IotStaticController {
|
|
|
private IotInspectPlanMapper iotInspectPlanMapper;
|
|
private IotInspectPlanMapper iotInspectPlanMapper;
|
|
|
@Autowired
|
|
@Autowired
|
|
|
private IotRhDailyReportMapper iotRhDailyReportMapper;
|
|
private IotRhDailyReportMapper iotRhDailyReportMapper;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IotRyDailyReportService iotRyDailyReportService;
|
|
|
|
|
+ @Autowired
|
|
|
|
|
+ private IotRyDailyReportMapper iotRyDailyReportMapper;
|
|
|
|
|
|
|
|
@GetMapping("/main/day")
|
|
@GetMapping("/main/day")
|
|
|
public CommonResult<Map<String, Object>> getMaintainDay() {
|
|
public CommonResult<Map<String, Object>> getMaintainDay() {
|
|
@@ -1145,5 +1155,185 @@ public class IotStaticController {
|
|
|
|
|
|
|
|
return success(ImmutableMap.of("瑞恒", rhcount.get(),"瑞都",rdcount.get(),"瑞鹰",rycount.get()));
|
|
return success(ImmutableMap.of("瑞恒", rhcount.get(),"瑞都",rdcount.get(),"瑞鹰",rycount.get()));
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 统计 瑞鹰 158 的 钻井 修井工作量
|
|
|
|
|
+ * @param type drill钻井 repair修井
|
|
|
|
|
+ * @return
|
|
|
|
|
+ */
|
|
|
|
|
+ @GetMapping("/ry/dailyReport/{type}")
|
|
|
|
|
+ @PermitAll
|
|
|
|
|
+ public CommonResult<Map<String, Object>> getRyDailyReportStat(@PathVariable("type") String type) {
|
|
|
|
|
+ if (StrUtil.isBlank(type)) {
|
|
|
|
|
+ return success(new HashMap<>());
|
|
|
|
|
+ }
|
|
|
|
|
+ // 查询瑞鹰所有 队伍 项目部
|
|
|
|
|
+ Set<Long> rdChildDeptIds = deptService.getChildDeptIdListFromCache(158l);
|
|
|
|
|
+ List<DeptDO> depts =deptService.getDeptList(rdChildDeptIds);
|
|
|
|
|
+ // key队伍id value队伍所属项目部id 包含队伍的项目部
|
|
|
|
|
+ Map<Long, Long> teamProjectPair = 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());
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ IotRyDailyReportPageReqVO reqVO = new IotRyDailyReportPageReqVO();
|
|
|
|
|
+ List<IotRyDailyReportTaskCountVO> repairTaskCounts = new ArrayList<>();
|
|
|
|
|
+ if ("repair".equals(type)) {
|
|
|
|
|
+ // 修井
|
|
|
|
|
+ reqVO.setProjectClassification("2");
|
|
|
|
|
+ // 修井日报统计 月完井数 年完井数
|
|
|
|
|
+ List<IotRyDailyReportTaskCountVO> repairReports = iotRyDailyReportService.countDateRepairTasksByDept();
|
|
|
|
|
+ Map<String, Integer> projectDeptMonthCountPair = new HashMap<>();
|
|
|
|
|
+ Map<String, Integer> projectDeptYearCountPair = new HashMap<>();
|
|
|
|
|
+ // 遍历 集合 repairReports 找到队伍对应的项目部
|
|
|
|
|
+ if (CollUtil.isNotEmpty(repairReports)) {
|
|
|
|
|
+ repairReports.forEach(report -> {
|
|
|
|
|
+ if (teamProjectPair.containsKey(report.getDeptId())) {
|
|
|
|
|
+ Long projectDeptId = teamProjectPair.get(report.getDeptId());
|
|
|
|
|
+ if (projectDeptPair.containsKey(projectDeptId)) {
|
|
|
|
|
+ // 项目部id 对应的项目部名称
|
|
|
|
|
+ String projectDeptName = projectDeptPair.get(projectDeptId);
|
|
|
|
|
+ // 设置月完井数
|
|
|
|
|
+ if (projectDeptMonthCountPair.containsKey(projectDeptName)) {
|
|
|
|
|
+ Integer tempCount = projectDeptMonthCountPair.get(projectDeptName);
|
|
|
|
|
+ Integer monthCompletedTaskCount = report.getMonthCompletedTaskCount();
|
|
|
|
|
+ projectDeptMonthCountPair.put(projectDeptName, tempCount+monthCompletedTaskCount);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Integer monthCompletedTaskCount = report.getMonthCompletedTaskCount();
|
|
|
|
|
+ projectDeptMonthCountPair.put(projectDeptName, monthCompletedTaskCount);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 设置年完井数
|
|
|
|
|
+ if (projectDeptYearCountPair.containsKey(projectDeptName)) {
|
|
|
|
|
+ Integer tempCount = projectDeptYearCountPair.get(projectDeptName);
|
|
|
|
|
+ Integer yearCompletedTaskCount = report.getYearCompletedTaskCount();
|
|
|
|
|
+ projectDeptYearCountPair.put(projectDeptName, tempCount+yearCompletedTaskCount);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ Integer yearCompletedTaskCount = report.getYearCompletedTaskCount();
|
|
|
|
|
+ projectDeptYearCountPair.put(projectDeptName, yearCompletedTaskCount);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ // 遍历所有项目部 没有产生运行数据的项目部 赋值 0
|
|
|
|
|
+ projectDeptPair.forEach((projectDeptId, projectDeptName) -> {
|
|
|
|
|
+ if (!projectDeptMonthCountPair.containsKey(projectDeptName)) {
|
|
|
|
|
+ projectDeptMonthCountPair.put(projectDeptName, 0);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!projectDeptYearCountPair.containsKey(projectDeptName)) {
|
|
|
|
|
+ projectDeptYearCountPair.put(projectDeptName, 0);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ LinkedList<Object> xAxis = new LinkedList<>();
|
|
|
|
|
+ LinkedList<Object> monthData = new LinkedList<>();
|
|
|
|
|
+ LinkedList<Object> yearData = new LinkedList<>();
|
|
|
|
|
+
|
|
|
|
|
+ projectDeptMonthCountPair.forEach( (k,v)->{
|
|
|
|
|
+ xAxis.add(k);
|
|
|
|
|
+ monthData.add(v);
|
|
|
|
|
+ if (projectDeptYearCountPair.containsKey(k)) {
|
|
|
|
|
+ Integer yearCount = projectDeptYearCountPair.get(k);
|
|
|
|
|
+ yearData.add(yearCount);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ ImmutableMap<String, Serializable> monthResult = ImmutableMap.of("name", "月完井数~~en**monthWell", "data", monthData);
|
|
|
|
|
+ ImmutableMap<String, Serializable> yearResult = ImmutableMap.of("name", "年完井数~~en**YearWell", "data", yearData);
|
|
|
|
|
+ return success(ImmutableMap.of("xAxis", xAxis, "series", ImmutableList.of(monthResult, yearResult)));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 钻井
|
|
|
|
|
+ reqVO.setProjectClassification("1");
|
|
|
|
|
+ // 查询钻井的日报统计 日进尺 月累计进尺 年累计进尺
|
|
|
|
|
+ List<IotRyDailyReportTaskCountVO> repairReports = iotRyDailyReportService.countDateDrillTasksByDept();
|
|
|
|
|
+ Map<String, BigDecimal> projectDeptDailyFootagePair = new HashMap<>();
|
|
|
|
|
+ Map<String, BigDecimal> projectDeptMonthFootagePair = new HashMap<>();
|
|
|
|
|
+ Map<String, BigDecimal> projectDeptYearFootagePair = new HashMap<>();
|
|
|
|
|
+ if (CollUtil.isNotEmpty(repairReports)) {
|
|
|
|
|
+ repairReports.forEach(report -> {
|
|
|
|
|
+ if (teamProjectPair.containsKey(report.getDeptId())) {
|
|
|
|
|
+ Long projectDeptId = teamProjectPair.get(report.getDeptId());
|
|
|
|
|
+ if (projectDeptPair.containsKey(projectDeptId)) {
|
|
|
|
|
+ // 项目部id 对应的项目部名称
|
|
|
|
|
+ String projectDeptName = projectDeptPair.get(projectDeptId);
|
|
|
|
|
+ // 设置日进尺
|
|
|
|
|
+ if (projectDeptDailyFootagePair.containsKey(projectDeptName)) {
|
|
|
|
|
+ BigDecimal tempFootage = projectDeptDailyFootagePair.get(projectDeptName);
|
|
|
|
|
+ BigDecimal existFootage = report.getDailyFootage();
|
|
|
|
|
+ projectDeptDailyFootagePair.put(projectDeptName, tempFootage.add(existFootage));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ BigDecimal tempFootage = report.getDailyFootage();
|
|
|
|
|
+ projectDeptDailyFootagePair.put(projectDeptName, tempFootage);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 设置月累计进尺
|
|
|
|
|
+ if (projectDeptMonthFootagePair.containsKey(projectDeptName)) {
|
|
|
|
|
+ BigDecimal tempFootage = projectDeptMonthFootagePair.get(projectDeptName);
|
|
|
|
|
+ BigDecimal existFootage = report.getMonthlyFootage();
|
|
|
|
|
+ projectDeptMonthFootagePair.put(projectDeptName, tempFootage.add(existFootage));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ BigDecimal tempFootage = report.getMonthlyFootage();
|
|
|
|
|
+ projectDeptMonthFootagePair.put(projectDeptName, tempFootage);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 设置年累计进尺
|
|
|
|
|
+ if (projectDeptYearFootagePair.containsKey(projectDeptName)) {
|
|
|
|
|
+ BigDecimal tempFootage = projectDeptYearFootagePair.get(projectDeptName);
|
|
|
|
|
+ BigDecimal existFootage = report.getAnnualFootage();
|
|
|
|
|
+ projectDeptYearFootagePair.put(projectDeptName, tempFootage.add(existFootage));
|
|
|
|
|
+ } else {
|
|
|
|
|
+ BigDecimal tempFootage = report.getAnnualFootage();
|
|
|
|
|
+ projectDeptYearFootagePair.put(projectDeptName, tempFootage);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ // 遍历所有项目部 没有产生运行数据的项目部 进尺 赋值 0
|
|
|
|
|
+ projectDeptPair.forEach((projectDeptId, projectDeptName) -> {
|
|
|
|
|
+ if (!projectDeptDailyFootagePair.containsKey(projectDeptName)) {
|
|
|
|
|
+ projectDeptDailyFootagePair.put(projectDeptName, BigDecimal.ZERO);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!projectDeptMonthFootagePair.containsKey(projectDeptName)) {
|
|
|
|
|
+ projectDeptMonthFootagePair.put(projectDeptName, BigDecimal.ZERO);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (!projectDeptYearFootagePair.containsKey(projectDeptName)) {
|
|
|
|
|
+ projectDeptYearFootagePair.put(projectDeptName, BigDecimal.ZERO);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ LinkedList<Object> xAxis = new LinkedList<>();
|
|
|
|
|
+ LinkedList<Object> dailyData = new LinkedList<>();
|
|
|
|
|
+ LinkedList<Object> monthData = new LinkedList<>();
|
|
|
|
|
+ LinkedList<Object> yearData = new LinkedList<>();
|
|
|
|
|
+
|
|
|
|
|
+ projectDeptDailyFootagePair.forEach( (k,v)->{
|
|
|
|
|
+ xAxis.add(k);
|
|
|
|
|
+ dailyData.add(v);
|
|
|
|
|
+ if (projectDeptMonthFootagePair.containsKey(k)) {
|
|
|
|
|
+ BigDecimal monthlyFootage = projectDeptMonthFootagePair.get(k);
|
|
|
|
|
+ monthData.add(monthlyFootage);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (projectDeptYearFootagePair.containsKey(k)) {
|
|
|
|
|
+ BigDecimal annualFootage = projectDeptYearFootagePair.get(k);
|
|
|
|
|
+ yearData.add(annualFootage);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ ImmutableMap<String, Serializable> dailyResult = ImmutableMap.of("name", "日进尺~~en**dailyFootage", "data", dailyData);
|
|
|
|
|
+ ImmutableMap<String, Serializable> monthResult = ImmutableMap.of("name", "月累进尺~~en**monthlyFootage", "data", monthData);
|
|
|
|
|
+ ImmutableMap<String, Serializable> yearResult = ImmutableMap.of("name", "年累进尺~~en**annualFootage", "data", yearData);
|
|
|
|
|
+ return success(ImmutableMap.of("xAxis", xAxis, "series", ImmutableList.of(dailyResult, monthResult, yearResult)));
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|