|
|
@@ -26,6 +26,7 @@ import cn.iocoder.yudao.module.pms.controller.admin.iotdevicerunlog.vo.IotDevice
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotdevicerunlog.vo.IotDeviceRunLogRespVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotmainworkorder.vo.IotMainWorkOrderPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotopeationfill.vo.IotOpeationFillPageReqVO;
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotprojecttask.vo.IotProjectTaskPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotrddailyreport.vo.IotRdDailyReportPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotrhdailyreport.vo.IotRhDailyReportPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotrydailyreport.vo.IotRyDailyReportPageReqVO;
|
|
|
@@ -47,6 +48,7 @@ import cn.iocoder.yudao.module.pms.dal.dataobject.iotcountdata.IotCountDataDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotdeviceassociate.IotDeviceAssociateDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotmainworkorder.IotMainWorkOrderDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotoutbound.IotOutboundDO;
|
|
|
+import cn.iocoder.yudao.module.pms.dal.dataobject.iotprojecttask.IotProjectTaskDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotprojecttaskattrs.IotTaskAttrModelProperty;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotrddailyreport.IotRdDailyReportDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotrhdailyreport.IotRhDailyReportDO;
|
|
|
@@ -76,6 +78,7 @@ import cn.iocoder.yudao.module.pms.dal.mysql.tdparams.IotTdParamsMapper;
|
|
|
import cn.iocoder.yudao.module.pms.service.DeviceServiceImpl;
|
|
|
import cn.iocoder.yudao.module.pms.service.inspect.IotInspectOrderService;
|
|
|
import cn.iocoder.yudao.module.pms.service.iotmainworkorder.IotMainWorkOrderService;
|
|
|
+import cn.iocoder.yudao.module.pms.service.iotprojecttask.IotProjectTaskService;
|
|
|
import cn.iocoder.yudao.module.pms.service.iotrydailyreport.IotRyDailyReportService;
|
|
|
import cn.iocoder.yudao.module.pms.service.iotryhidailyreport.IotRyHiDailyReportService;
|
|
|
import cn.iocoder.yudao.module.pms.service.maintain.IotMaintainService;
|
|
|
@@ -120,6 +123,7 @@ import java.util.stream.Collectors;
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
|
|
|
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
|
|
+import static cn.iocoder.yudao.framework.common.util.collection.CollectionUtils.convertList;
|
|
|
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.*;
|
|
|
import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.IOT_DAILY_REPORT_DEPT_NOT_EXISTS;
|
|
|
import static cn.iocoder.yudao.module.pms.enums.ErrorCodeConstant.IOT_DAILY_REPORT_TIME_NOT_EXISTS;
|
|
|
@@ -189,6 +193,8 @@ public class IotStaticController {
|
|
|
private IotRyHiDailyReportService iotRyHiDailyReportService;
|
|
|
@Resource
|
|
|
private IotDeviceAssociateMapper iotDeviceAssociateMapper;
|
|
|
+ @Resource
|
|
|
+ private IotProjectTaskService iotProjectTaskService;
|
|
|
|
|
|
|
|
|
@GetMapping("/main/day")
|
|
|
@@ -2354,6 +2360,18 @@ public class IotStaticController {
|
|
|
// 队伍id 集合
|
|
|
Set<Long> teamDepartmentIds = new HashSet<>();
|
|
|
|
|
|
+ // key项目部id value项目部年累计注气量
|
|
|
+ Map<Long, BigDecimal> projectYearGasInjectionPair = new HashMap<>();
|
|
|
+ // key项目部id value项目部年累计注水量
|
|
|
+ Map<Long, BigDecimal> projectYearWaterInjectionPair = new HashMap<>();
|
|
|
+
|
|
|
+ // key项目部id value项目部下包含的 施工 队伍数量
|
|
|
+ Map<Long, Integer> sgTeamCountPair = new HashMap<>();
|
|
|
+ // key项目部id value项目部下包含的 施工准备 队伍数量
|
|
|
+ Map<Long, Integer> zbTeamCountPair = new HashMap<>();
|
|
|
+ // key项目部id value项目部下包含的 驻地待命 队伍数量
|
|
|
+ Map<Long, Integer> zddmTeamCountPair = new HashMap<>();
|
|
|
+
|
|
|
// 筛选瑞恒 主设备 rq_iot_rh_main_device_category
|
|
|
Set<Long> mainDeviceCategoryIds = new HashSet<>();
|
|
|
List<DictDataDO> constructionStatusDictData = dictDataService.getDictDataListByDictType("rq_iot_rh_main_device_category");
|
|
|
@@ -2418,17 +2436,107 @@ public class IotStaticController {
|
|
|
// 查询出指定时间区间内 已经填写的日报数量 存在注气时间是0 但是 注气量 不为0的情况
|
|
|
// reqVO.setStatisticFlag("Y");
|
|
|
List<IotRhDailyReportDO> dailyReports = iotRhDailyReportMapper.dailyReports(reqVO);
|
|
|
+
|
|
|
+ // 查询时间所在年份所有日报 计算年累计注气 年累计注水
|
|
|
+ IotRhDailyReportPageReqVO yearReqVO = new IotRhDailyReportPageReqVO();
|
|
|
+ LocalDateTime[] timeRange = reqVO.getCreateTime();
|
|
|
+ if (ObjUtil.isNotEmpty(timeRange) && timeRange.length >= 2) {
|
|
|
+ LocalDateTime originalStart = timeRange[0];
|
|
|
+ LocalDateTime originalEnd = timeRange[1];
|
|
|
+ // 取当年1月1日零点
|
|
|
+ LocalDateTime yearBegin = LocalDateTime.of(originalStart.getYear(), 1, 1, 0, 0);
|
|
|
+ yearReqVO.setCreateTime(new LocalDateTime[]{yearBegin, originalEnd});
|
|
|
+ }
|
|
|
+ List<IotRhDailyReportDO> yearDailyReports = iotRhDailyReportMapper.dailyReports(yearReqVO);
|
|
|
+ if (CollUtil.isNotEmpty(yearDailyReports)) {
|
|
|
+ yearDailyReports.forEach(yearReport -> {
|
|
|
+ if (CollUtil.isNotEmpty(projectTeamPair)) {
|
|
|
+ projectTeamPair.forEach((projectDeptId, teamDeptIds) -> {
|
|
|
+ if (teamDeptIds.contains(yearReport.getDeptId())) {
|
|
|
+ BigDecimal dailyGasInjection = yearReport.getDailyGasInjection();
|
|
|
+ BigDecimal dailyWaterInjection = yearReport.getDailyWaterInjection();
|
|
|
+ // 项目部 年累计注气量
|
|
|
+ if (projectYearGasInjectionPair.containsKey(projectDeptId)) {
|
|
|
+ BigDecimal tempGasInjection = projectYearGasInjectionPair.get(projectDeptId);
|
|
|
+ BigDecimal subtotal = tempGasInjection.add(dailyGasInjection);
|
|
|
+ projectYearGasInjectionPair.put(projectDeptId, subtotal);
|
|
|
+ } else {
|
|
|
+ projectYearGasInjectionPair.put(projectDeptId, dailyGasInjection);
|
|
|
+ }
|
|
|
+ // 项目部 年累计注水量
|
|
|
+ if (projectYearWaterInjectionPair.containsKey(projectDeptId)) {
|
|
|
+ BigDecimal tempWaterInjection = projectYearWaterInjectionPair.get(projectDeptId);
|
|
|
+ BigDecimal subtotal = tempWaterInjection.add(dailyWaterInjection);
|
|
|
+ projectYearWaterInjectionPair.put(projectDeptId, subtotal);
|
|
|
+ } else {
|
|
|
+ projectYearWaterInjectionPair.put(projectDeptId, dailyWaterInjection);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
// key项目部id value项目部包含的队伍指定时间区域内日报数量
|
|
|
Map<Long, Integer> projectReportPair = new HashMap<>();
|
|
|
+
|
|
|
+ // 以施工区域为维度统计 队伍总数 施工队伍数 准备队伍数
|
|
|
+ // key: 项目部ID -> key: 施工区域 -> Set<队伍ID>
|
|
|
+ Map<Long, Map<String, Set<Long>>> projectLocationTeamSet = new HashMap<>(); // 总队伍
|
|
|
+ Map<Long, Map<String, Set<Long>>> projectLocationSgTeamSet = new HashMap<>(); // 施工队伍(注气/注水>0)
|
|
|
+ Map<Long, Map<String, Set<Long>>> projectLocationZbTeamSet = new HashMap<>(); // 准备队伍(zb/dq/wg)
|
|
|
+
|
|
|
// key项目部id value项目部注气量
|
|
|
Map<Long, BigDecimal> projectGasInjectionPair = new HashMap<>();
|
|
|
+ // key项目部id value项目部注水量
|
|
|
+ Map<Long, BigDecimal> projectWaterInjectionPair = new HashMap<>();
|
|
|
+
|
|
|
+ // 查询所有日报关联的任务 井号 施工区域
|
|
|
+ Map<Long, String> taskWellNamePair = new HashMap<>();
|
|
|
+ Map<Long, String> taskLocationPair = new HashMap<>();
|
|
|
+
|
|
|
+ // 生产动态临时存储
|
|
|
+ Map<Long, Map<String, Map<String, List<String>>>> productionMap = new HashMap<>();
|
|
|
+
|
|
|
+ // key项目部id value项目部下包含设备的队伍注气时间或注水时间总和
|
|
|
+ Map<Long, BigDecimal> projectWorkTimePair = new HashMap<>();
|
|
|
+
|
|
|
if (CollUtil.isNotEmpty(dailyReports)) {
|
|
|
+ IotProjectTaskPageReqVO taskReqVO = new IotProjectTaskPageReqVO();
|
|
|
+ taskReqVO.setTaskIds(convertList(dailyReports, IotRhDailyReportDO::getTaskId));
|
|
|
+ List<IotProjectTaskDO> tasks = iotProjectTaskService.projectTasks(taskReqVO);
|
|
|
+ if (CollUtil.isNotEmpty(tasks)) {
|
|
|
+ tasks.forEach(task -> {
|
|
|
+ taskWellNamePair.put(task.getId(), task.getWellName());
|
|
|
+ taskLocationPair.put(task.getId(), task.getLocation());
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
// 整理出每个项目部下的队伍填报的日报数量
|
|
|
dailyReports.forEach(report -> {
|
|
|
if (CollUtil.isNotEmpty(projectTeamPair)) {
|
|
|
projectTeamPair.forEach((projectDeptId, teamDeptIds) -> {
|
|
|
if (teamDeptIds.contains(report.getDeptId())) {
|
|
|
- if (report.getDailyGasInjection().compareTo(BigDecimal.ZERO)>0 || report.getDailyWaterInjection().compareTo(BigDecimal.ZERO)>0) {
|
|
|
+ // 以施工区域为维度统计 队伍总数 施工队伍数 准备队伍数 待命队伍数量
|
|
|
+ Long taskId = report.getTaskId();
|
|
|
+ String taskLocation = StrUtil.EMPTY;
|
|
|
+ if (ObjUtil.isNotEmpty(taskId) && taskLocationPair.containsKey(taskId)) {
|
|
|
+ taskLocation = taskLocationPair.get(taskId);
|
|
|
+ }
|
|
|
+
|
|
|
+ BigDecimal dailyGasInjection = report.getDailyGasInjection();
|
|
|
+ BigDecimal dailyWaterInjection = report.getDailyWaterInjection();
|
|
|
+
|
|
|
+ // 项目部下 施工区域内 队伍总数量
|
|
|
+ if (StrUtil.isNotBlank(taskLocation)) {
|
|
|
+ // 总队伍(去重)
|
|
|
+ projectLocationTeamSet
|
|
|
+ .computeIfAbsent(projectDeptId, k -> new HashMap<>())
|
|
|
+ .computeIfAbsent(taskLocation, k -> new HashSet<>())
|
|
|
+ .add(report.getDeptId());
|
|
|
+ }
|
|
|
+
|
|
|
+ if (dailyGasInjection.compareTo(BigDecimal.ZERO) > 0 || dailyWaterInjection.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
// 项目部日报数量 20260608 统计 注气量 or 注水量 > 0 的日报数量
|
|
|
if (projectReportPair.containsKey(projectDeptId)) {
|
|
|
Integer tempCount = projectReportPair.get(projectDeptId);
|
|
|
@@ -2436,14 +2544,103 @@ public class IotStaticController {
|
|
|
} else {
|
|
|
projectReportPair.put(projectDeptId, 1);
|
|
|
}
|
|
|
+ // 施工队伍数量
|
|
|
+ if (haveDeviceDeptIds.contains(report.getDeptId())) {
|
|
|
+ if (sgTeamCountPair.containsKey(projectDeptId)) {
|
|
|
+ Integer tempCount = sgTeamCountPair.get(projectDeptId);
|
|
|
+ sgTeamCountPair.put(projectDeptId, ++tempCount);
|
|
|
+ } else {
|
|
|
+ sgTeamCountPair.put(projectDeptId, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 项目部下 施工区域内 施工队伍数量
|
|
|
+ if (StrUtil.isNotBlank(taskLocation)) {
|
|
|
+ projectLocationSgTeamSet
|
|
|
+ .computeIfAbsent(projectDeptId, k -> new HashMap<>())
|
|
|
+ .computeIfAbsent(taskLocation, k -> new HashSet<>())
|
|
|
+ .add(report.getDeptId());
|
|
|
+ }
|
|
|
}
|
|
|
- // 项目部 注气量
|
|
|
+
|
|
|
+ // 统计 施工 准备 待命 队伍数量
|
|
|
+ // 准备
|
|
|
+ if ("zb".equals(report.getConstructionStatus()) || "dq".equals(report.getConstructionStatus()) || "wg".equals(report.getConstructionStatus())) {
|
|
|
+ if (zbTeamCountPair.containsKey(projectDeptId)) {
|
|
|
+ Integer tempCount = zbTeamCountPair.get(projectDeptId);
|
|
|
+ zbTeamCountPair.put(projectDeptId, ++tempCount);
|
|
|
+ } else {
|
|
|
+ zbTeamCountPair.put(projectDeptId, 1);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // 项目部 指定时间的注气量
|
|
|
if (projectGasInjectionPair.containsKey(projectDeptId)) {
|
|
|
BigDecimal tempGasInjection = projectGasInjectionPair.get(projectDeptId);
|
|
|
- BigDecimal subtotal = tempGasInjection.add(report.getDailyGasInjection());
|
|
|
+ BigDecimal subtotal = tempGasInjection.add(dailyGasInjection);
|
|
|
projectGasInjectionPair.put(projectDeptId, subtotal);
|
|
|
} else {
|
|
|
- projectGasInjectionPair.put(projectDeptId, report.getDailyGasInjection());
|
|
|
+ projectGasInjectionPair.put(projectDeptId, dailyGasInjection);
|
|
|
+ }
|
|
|
+ // 项目部 指定时间的注水量
|
|
|
+ if (projectWaterInjectionPair.containsKey(projectDeptId)) {
|
|
|
+ BigDecimal tempWaterInjection = projectWaterInjectionPair.get(projectDeptId);
|
|
|
+ BigDecimal subtotal = tempWaterInjection.add(dailyWaterInjection);
|
|
|
+ projectWaterInjectionPair.put(projectDeptId, subtotal);
|
|
|
+ } else {
|
|
|
+ projectWaterInjectionPair.put(projectDeptId, dailyWaterInjection);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 项目部 年累计注气量
|
|
|
+
|
|
|
+ // 日报关联的任务井号
|
|
|
+ Long reportTaskId = report.getTaskId();
|
|
|
+ if (ObjUtil.isNotEmpty(reportTaskId)) {
|
|
|
+
|
|
|
+ }
|
|
|
+ // 提取 所有日报非生产时间和 = 24H 的队伍
|
|
|
+ List<BigDecimal> nptTimeList = Arrays.asList(
|
|
|
+ report.getAccidentTime(),
|
|
|
+ report.getRepairTime(),
|
|
|
+ report.getSelfStopTime(),
|
|
|
+ report.getComplexityTime(),
|
|
|
+ report.getRelocationTime(),
|
|
|
+ report.getRectificationTime(),
|
|
|
+ report.getWaitingStopTime(),
|
|
|
+ report.getWinterBreakTime(),
|
|
|
+ report.getPartyaDesign(),
|
|
|
+ report.getPartyaPrepare(),
|
|
|
+ report.getPartyaResource(),
|
|
|
+ report.getOtherNptTime()
|
|
|
+ );
|
|
|
+ BigDecimal totalNptTime = nptTimeList.stream()
|
|
|
+ .map(time -> Optional.ofNullable(time).orElse(BigDecimal.ZERO))
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ BigDecimal twentyFour = new BigDecimal("24");
|
|
|
+ if (totalNptTime.compareTo(twentyFour) == 0) {
|
|
|
+ // 所有非生产时间和=24H 的队伍 提取生产动态
|
|
|
+ if (ObjUtil.isNotEmpty(reportTaskId)) {
|
|
|
+ String wellName = taskWellNamePair.get(reportTaskId);
|
|
|
+ String location = taskLocationPair.get(reportTaskId);
|
|
|
+ if (StrUtil.isNotBlank(wellName) && StrUtil.isNotBlank(location)) {
|
|
|
+ String dynamic = report.getProductionStatus();
|
|
|
+ productionMap.computeIfAbsent(projectDeptId, k -> new HashMap<>())
|
|
|
+ .computeIfAbsent(location, k -> new HashMap<>())
|
|
|
+ .computeIfAbsent(wellName, k -> new ArrayList<>())
|
|
|
+ .add(dynamic);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 按小时数 统计设备利用率
|
|
|
+ BigDecimal gasInjectionTime = ObjUtil.defaultIfNull(report.getDailyInjectGasTime(), BigDecimal.ZERO);
|
|
|
+ BigDecimal waterInjectionTime = ObjUtil.defaultIfNull(report.getDailyInjectWaterTime(), BigDecimal.ZERO);
|
|
|
+ // 取 注气时间 注水时间 的较大者
|
|
|
+ BigDecimal workTime = gasInjectionTime.compareTo(BigDecimal.ZERO) > 0
|
|
|
+ ? gasInjectionTime
|
|
|
+ : waterInjectionTime.compareTo(BigDecimal.ZERO) > 0
|
|
|
+ ? waterInjectionTime
|
|
|
+ : BigDecimal.ZERO;
|
|
|
+ if (workTime.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ projectWorkTimePair.merge(projectDeptId, workTime, BigDecimal::add);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -2484,11 +2681,49 @@ public class IotStaticController {
|
|
|
// 设置每个项目部的注气量
|
|
|
if (projectGasInjectionPair.containsKey(projectDeptId)) {
|
|
|
BigDecimal gasInjection = projectGasInjectionPair.get(projectDeptId);
|
|
|
- rateVo.setGasInjection(gasInjection);
|
|
|
+ // 转换单位 万方
|
|
|
+ BigDecimal gasInjectionWanFang = gasInjection
|
|
|
+ .divide(BigDecimal.valueOf(10000), 2, RoundingMode.HALF_UP);
|
|
|
+ rateVo.setGasInjection(gasInjectionWanFang);
|
|
|
+ }
|
|
|
+ // 设置每个项目部的年累计注气量
|
|
|
+ if (projectYearGasInjectionPair.containsKey(projectDeptId)) {
|
|
|
+ BigDecimal yearGasInjection = projectYearGasInjectionPair.get(projectDeptId);
|
|
|
+ // 转换单位 万方
|
|
|
+ BigDecimal gasInjectionWanFang = yearGasInjection
|
|
|
+ .divide(BigDecimal.valueOf(10000), 2, RoundingMode.HALF_UP);
|
|
|
+ rateVo.setYearGasInjection(gasInjectionWanFang);
|
|
|
+ }
|
|
|
+ // 设置每个项目部的注水量
|
|
|
+ if (projectWaterInjectionPair.containsKey(projectDeptId)) {
|
|
|
+ BigDecimal waterInjection = projectWaterInjectionPair.get(projectDeptId);
|
|
|
+ // 转换单位 万方
|
|
|
+ BigDecimal waterInjectionWanFang = waterInjection
|
|
|
+ .divide(BigDecimal.valueOf(10000), 2, RoundingMode.HALF_UP);
|
|
|
+ rateVo.setWaterInjection(waterInjectionWanFang);
|
|
|
+ }
|
|
|
+ // 设置每个项目部的年累计注水量
|
|
|
+ if (projectYearWaterInjectionPair.containsKey(projectDeptId)) {
|
|
|
+ BigDecimal yearWaterInjection = projectYearWaterInjectionPair.get(projectDeptId);
|
|
|
+ // 转换单位 万方
|
|
|
+ BigDecimal waterInjectionWanFang = yearWaterInjection
|
|
|
+ .divide(BigDecimal.valueOf(10000), 2, RoundingMode.HALF_UP);
|
|
|
+ rateVo.setYearWaterInjection(waterInjectionWanFang);
|
|
|
}
|
|
|
// 遍历每个项目部 获取每个项目部下队伍数量
|
|
|
Integer currentTeamNum = teamIds.size();
|
|
|
rateVo.setTeamCount(currentTeamNum);
|
|
|
+ // 待命队伍数量 = 队伍总数 - 施工队伍数量 - 准备队伍数量
|
|
|
+ // 施工队伍数量
|
|
|
+ Integer sgTeamCount = sgTeamCountPair.getOrDefault(projectDeptId, 0);
|
|
|
+ // 施工准备队伍数量
|
|
|
+ Integer zbTeamCount = zbTeamCountPair.getOrDefault(projectDeptId, 0);
|
|
|
+ // 驻地待命 队伍数量 = 队伍总数 - 施工队伍 - 准备队伍
|
|
|
+ Integer dmTeamCount = Math.max(currentTeamNum - sgTeamCount - zbTeamCount, 0);
|
|
|
+ rateVo.setSgTeamCount(sgTeamCount);
|
|
|
+ rateVo.setZbTeamCount(zbTeamCount);
|
|
|
+ rateVo.setDmTeamCount(dmTeamCount);
|
|
|
+
|
|
|
rateVo.setCumulativeDays(currentTeamNum * daysCount);
|
|
|
double rate = 0.0;
|
|
|
// 匹配出当前项目部下 日报数量
|
|
|
@@ -2503,7 +2738,21 @@ public class IotStaticController {
|
|
|
.doubleValue();
|
|
|
}
|
|
|
}
|
|
|
- rateVo.setUtilizationRate(rate); // 存储计算结果
|
|
|
+ rateVo.setUtilizationRate(rate); // 设备利用率
|
|
|
+ // 计算项目部 按小时统计的设备利用率(运行时效)
|
|
|
+ if (projectWorkTimePair.containsKey(projectDeptId)) {
|
|
|
+ BigDecimal reportWorkTime = projectWorkTimePair.getOrDefault(projectDeptId, BigDecimal.ZERO);
|
|
|
+ if (currentTeamNum > 0 && daysCount > 0) {
|
|
|
+ // 分母 = 队伍数 * 天数 * 24小时
|
|
|
+ BigDecimal denominator = new BigDecimal(currentTeamNum * daysCount * 24);
|
|
|
+ // 安全计算,避免除0
|
|
|
+ BigDecimal utilization = BigDecimal.ZERO;
|
|
|
+ if (denominator.compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ utilization = reportWorkTime.divide(denominator, 4, RoundingMode.HALF_UP);
|
|
|
+ rateVo.setHourUtilizationRate(utilization);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
rates.add(rateVo);
|
|
|
}
|
|
|
});
|
|
|
@@ -2529,6 +2778,32 @@ public class IotStaticController {
|
|
|
rate.setCumulativeDays((ObjUtil.isNotEmpty(rate.getCumulativeDays()) ? rate.getCumulativeDays() : 0l) + mergeCumulativeDays.get());
|
|
|
rate.setConstructionDays((ObjUtil.isNotEmpty(rate.getConstructionDays()) ? rate.getConstructionDays() : 0) + mergeConstructionDays.get());
|
|
|
}
|
|
|
+
|
|
|
+ Map<String, Map<String, List<String>>> locationMap = productionMap.get(rate.getProjectDeptId());
|
|
|
+ // 组装各项目部 按照施工区域维度统计 的 队伍数量 生产动态明细
|
|
|
+ if (locationMap != null && !locationMap.isEmpty()) {
|
|
|
+ Map<String, Set<Long>> teamMap = projectLocationTeamSet.getOrDefault(rate.getProjectDeptId(), Collections.emptyMap());
|
|
|
+ Map<String, Set<Long>> sgTeamMap = projectLocationSgTeamSet.getOrDefault(rate.getProjectDeptId(), Collections.emptyMap());
|
|
|
+
|
|
|
+ StringBuilder sb = new StringBuilder();
|
|
|
+ List<String> sortedLocations = new ArrayList<>(locationMap.keySet());
|
|
|
+ Collections.sort(sortedLocations);
|
|
|
+ for (String location : sortedLocations) {
|
|
|
+ int total = teamMap.getOrDefault(location, Collections.emptySet()).size();
|
|
|
+ int sg = sgTeamMap.getOrDefault(location, Collections.emptySet()).size();
|
|
|
+ int zb = Math.max(total - sg, 0);
|
|
|
+ sb.append(location).append(":施工").append(sg).append("套设备,准备").append(zb).append("套设备(共").append(total).append("套设备)\n");
|
|
|
+
|
|
|
+ Map<String, List<String>> wellMap = locationMap.get(location);
|
|
|
+ List<String> sortedWells = new ArrayList<>(wellMap.keySet());
|
|
|
+ Collections.sort(sortedWells);
|
|
|
+ for (String well : sortedWells) {
|
|
|
+ String dynamicsStr = String.join(";", wellMap.get(well));
|
|
|
+ sb.append(well).append(",").append(dynamicsStr).append(";\n");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ rate.setProductionSummary(sb.toString());
|
|
|
+ }
|
|
|
});
|
|
|
// 删除projectDeptId为166的对象 克拉玛依项目部
|
|
|
rates.removeIf(rate -> rate.getProjectDeptId() == 166);
|