|
@@ -792,6 +792,64 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
iotRhDailyReportMapper.updateById(dailyReport);
|
|
iotRhDailyReportMapper.updateById(dailyReport);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ @Override
|
|
|
|
|
+ public List<IotRhDailyReportNptStatisticsRespVO> nptStatistics(IotRhDailyReportPageReqVO pageReqVO) {
|
|
|
|
|
+ List<IotRhDailyReportNptStatisticsRespVO> result = new ArrayList<>();
|
|
|
|
|
+ // 不分页统计所有数据
|
|
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
|
|
+ Set<Long> ids = new HashSet<>();
|
|
|
|
|
+ if (Objects.nonNull(pageReqVO.getDeptId())) {
|
|
|
|
|
+ ids = deptService.getChildDeptIdListFromCache(pageReqVO.getDeptId());
|
|
|
|
|
+ // 找到所有子部门对象集合
|
|
|
|
|
+ ids.add(pageReqVO.getDeptId());
|
|
|
|
|
+ pageReqVO.setDeptIds(ids);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 检查contractName不为空但projectIds为空的情况
|
|
|
|
|
+ if (StrUtil.isNotBlank(pageReqVO.getContractName()) && (CollUtil.isEmpty(pageReqVO.getProjectIds()))) {
|
|
|
|
|
+ return new ArrayList<>();
|
|
|
|
|
+ }
|
|
|
|
|
+ // 检查taskName不为空但taskIds为空的情况
|
|
|
|
|
+ if (StrUtil.isNotBlank(pageReqVO.getTaskName()) && (CollUtil.isEmpty(pageReqVO.getTaskIds()))) {
|
|
|
|
|
+ return new ArrayList<>();
|
|
|
|
|
+ }
|
|
|
|
|
+ IPage<IotRhDailyReportDO> page = iotRhDailyReportMapper.rhReportStatistics(
|
|
|
|
|
+ new Page<>(pageReqVO.getPageNo(), pageReqVO.getPageSize()), pageReqVO,
|
|
|
|
|
+ pageReqVO.getTaskIds(), pageReqVO.getProjectIds(), ids);
|
|
|
|
|
+ List<IotRhDailyReportDO> dailyReports = page.getRecords();
|
|
|
|
|
+
|
|
|
|
|
+ // 默认显示所有项目部的汇总数据(新疆分公司也展示 下属各项目部的数据)
|
|
|
|
|
+ // 点击项目部 显示 下属队伍的数据
|
|
|
|
|
+ // 首先判断点击的部门是属于 公司 还是 队伍 如果没有点击任何部门 默认查询所有项目部数据
|
|
|
|
|
+ if (ObjUtil.isEmpty(pageReqVO.getDeptId())) {
|
|
|
|
|
+ result = nptStatisticsByProjectDept(dailyReports, 157L, pageReqVO);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 判断点击的组织树中的部门类型 类型(公司级1 项目部2 队伍3)
|
|
|
|
|
+ DeptDO selectedDept = deptService.getDept(pageReqVO.getDeptId());
|
|
|
|
|
+ if ("1".equals(selectedDept.getType())) {
|
|
|
|
|
+ // 以项目部为维度汇总数据
|
|
|
|
|
+ result = nptStatisticsByProjectDept(dailyReports, pageReqVO.getDeptId(), pageReqVO);
|
|
|
|
|
+ } else if ("2".equals(selectedDept.getType())) {
|
|
|
|
|
+ // 以队伍为维度汇总数据
|
|
|
|
|
+ result = nptStatisticsByProjectDepartment(dailyReports, pageReqVO);
|
|
|
|
|
+ } else if ("3".equals(selectedDept.getType())) {
|
|
|
|
|
+ // 显示单个队伍的汇总数据
|
|
|
|
|
+ result = nptStatisticsByProjectDepartment(dailyReports, pageReqVO);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ // 点击的部门没有类型 判断部门下的是否包含 项目部类型部门 新疆分公司
|
|
|
|
|
+ // 以项目部为维度汇总数据
|
|
|
|
|
+ result = nptStatisticsByProjectDept(dailyReports, pageReqVO.getDeptId(), pageReqVO);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 根据result集合内对象的 sort 属性正序排列 sort 类型为 integer 类型
|
|
|
|
|
+ if (CollUtil.isNotEmpty(result)) {
|
|
|
|
|
+ result.sort(Comparator.comparing(
|
|
|
|
|
+ IotRhDailyReportNptStatisticsRespVO::getSort,
|
|
|
|
|
+ Comparator.nullsLast(Comparator.naturalOrder())
|
|
|
|
|
+ ));
|
|
|
|
|
+ }
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
@Override
|
|
@Override
|
|
|
public void updateIotRhDailyReport(IotRhDailyReportSaveReqVO updateReqVO) {
|
|
public void updateIotRhDailyReport(IotRhDailyReportSaveReqVO updateReqVO) {
|
|
|
// 校验存在
|
|
// 校验存在
|
|
@@ -1324,6 +1382,356 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 按项目部维度统计 非生产时效
|
|
|
|
|
+ * @param dailyReports 日报数据列表
|
|
|
|
|
+ * @param rootDeptId 根部门ID(如157L为瑞恒根部门,或其他公司级部门ID)
|
|
|
|
|
+ * @return 项目部维度统计 非生产时效
|
|
|
|
|
+ */
|
|
|
|
|
+ private List<IotRhDailyReportNptStatisticsRespVO> nptStatisticsByProjectDept(List<IotRhDailyReportDO> dailyReports,
|
|
|
|
|
+ Long rootDeptId, IotRhDailyReportPageReqVO pageReqVO) {
|
|
|
|
|
+ List<IotRhDailyReportNptStatisticsRespVO> result = new ArrayList<>();
|
|
|
|
|
+
|
|
|
|
|
+ Set<Long> projectDeptIds = new HashSet<>();
|
|
|
|
|
+ // key项目部id value项目部名称
|
|
|
|
|
+ Map<Long, DeptDO> projectDeptPair = new HashMap<>();
|
|
|
|
|
+ // key部门id value部门parentId
|
|
|
|
|
+ Map<Long, Long> teamProjectIdPair = new HashMap<>();
|
|
|
|
|
+ // 队伍id 集合
|
|
|
|
|
+ Set<Long> teamIds = new HashSet<>();
|
|
|
|
|
+
|
|
|
|
|
+ // key队伍id/项目部id value累计 工程质量npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalAccidentTimePair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计 设备故障npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalRepairTimePair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计 设备保养npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalSelfStopTimePair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计 技术受限npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalComplexityTimePair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计 生产配合npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalRelocationTimePair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计 生产组织npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalRectificationTimePair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计 不可抗力npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalWaitingStopTimePair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计 待命npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalWinterBreakTimePair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计 甲方设计npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalPartyaDesignPair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计 甲方准备npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalPartyaPreparePair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计 甲方资源npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalPartyaResourcePair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计 其它非生产时间npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalOtherNptTimePair = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ // key队伍id/项目部id value npt小计
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalNptTimePair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value npt时效%
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalNptRatePair = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ // 以项目部为维度统计数据 找到所有项目部与队伍的对应关系
|
|
|
|
|
+ // 查询指定根部门下的所有子部门
|
|
|
|
|
+ Set<Long> allRhChildDeptIds = deptService.getChildDeptIdListFromCache(rootDeptId);
|
|
|
|
|
+ DeptListReqVO reqVO = new DeptListReqVO();
|
|
|
|
|
+ reqVO.setDeptIds(allRhChildDeptIds);
|
|
|
|
|
+ List<DeptDO> depts = deptService.getDeptList(reqVO);
|
|
|
|
|
+
|
|
|
|
|
+ // 构建项目部映射和父子部门关系
|
|
|
|
|
+ depts.forEach(dept -> {
|
|
|
|
|
+ // 暂时过滤掉 欧洲项目部 克拉玛依项目部
|
|
|
|
|
+ if ("2".equals(dept.getType()) && "LY".equals(dept.getEmail())) {
|
|
|
|
|
+ // 状态为LY的项目部 才统计设备利用率
|
|
|
|
|
+ projectDeptIds.add(dept.getId());
|
|
|
|
|
+ projectDeptPair.put(dept.getId(), dept);
|
|
|
|
|
+ }
|
|
|
|
|
+ if ("3".equals(dept.getType())) {
|
|
|
|
|
+ // 队伍
|
|
|
|
|
+ teamIds.add(dept.getId());
|
|
|
|
|
+ }
|
|
|
|
|
+ teamProjectIdPair.put(dept.getId(), dept.getParentId());
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // 计算日期查询区间有多少小时
|
|
|
|
|
+ LocalDateTime[] createTimes = pageReqVO.getCreateTime();
|
|
|
|
|
+ List<Long> totalHours = new ArrayList<>();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(createTimes) && createTimes.length >= 2) {
|
|
|
|
|
+ LocalDate startDate = createTimes[0].toLocalDate();
|
|
|
|
|
+ LocalDate endDate = createTimes[1].toLocalDate();
|
|
|
|
|
+ // 核心:包含起止两天 → 天数差 +1 再 ×24
|
|
|
|
|
+ long days = ChronoUnit.DAYS.between(startDate, endDate) + 1;
|
|
|
|
|
+ Long tempTotalHours = days * 24L;
|
|
|
|
|
+ totalHours.add(tempTotalHours);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 累计计算各项 非生产时间 指标
|
|
|
|
|
+ if (CollUtil.isNotEmpty(dailyReports)) {
|
|
|
|
|
+ dailyReports.forEach(report -> {
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(report.getDeptId()) && teamProjectIdPair.containsKey(report.getDeptId())) {
|
|
|
|
|
+ // projectDeptId可能是项目部 也可能是项目的上级
|
|
|
|
|
+ Long projectDeptId = 0l;
|
|
|
|
|
+ if (teamIds.contains(report.getDeptId())) {
|
|
|
|
|
+ // 日报deptId如果是队伍 获取队伍的上级项目部
|
|
|
|
|
+ projectDeptId = teamProjectIdPair.get(report.getDeptId());
|
|
|
|
|
+ }
|
|
|
|
|
+ if (projectDeptPair.containsKey(report.getDeptId())) {
|
|
|
|
|
+ // 日报deptId如果是项目部 使用当前项目部
|
|
|
|
|
+ projectDeptId = report.getDeptId();
|
|
|
|
|
+ }
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(projectDeptId) && (projectDeptId > 0)) {
|
|
|
|
|
+ // 工程质量 npt
|
|
|
|
|
+ BigDecimal accidentTime = report.getAccidentTime();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(accidentTime)) {
|
|
|
|
|
+ if (subtotalAccidentTimePair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal existAccidentTime = subtotalAccidentTimePair.get(projectDeptId);
|
|
|
|
|
+ BigDecimal tempAccidentTime = existAccidentTime.add(accidentTime);
|
|
|
|
|
+ subtotalAccidentTimePair.put(projectDeptId, tempAccidentTime);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalAccidentTimePair.put(projectDeptId, accidentTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 设备故障 npt
|
|
|
|
|
+ BigDecimal repairTime = report.getRepairTime();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(repairTime)) {
|
|
|
|
|
+ if (subtotalRepairTimePair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal existRepairTime = subtotalRepairTimePair.get(projectDeptId);
|
|
|
|
|
+ BigDecimal tempRepairTime = existRepairTime.add(repairTime);
|
|
|
|
|
+ subtotalRepairTimePair.put(projectDeptId, tempRepairTime);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalRepairTimePair.put(projectDeptId, repairTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 设备保养 npt
|
|
|
|
|
+ BigDecimal selfStopTime = report.getSelfStopTime();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(selfStopTime)) {
|
|
|
|
|
+ if (subtotalSelfStopTimePair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal existSelfStopTime = subtotalSelfStopTimePair.get(projectDeptId);
|
|
|
|
|
+ BigDecimal tempSelfStopTime = existSelfStopTime.add(selfStopTime);
|
|
|
|
|
+ subtotalSelfStopTimePair.put(projectDeptId, tempSelfStopTime);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalSelfStopTimePair.put(projectDeptId, selfStopTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 技术受限 npt
|
|
|
|
|
+ BigDecimal complexityTime = report.getComplexityTime();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(complexityTime)) {
|
|
|
|
|
+ if (subtotalComplexityTimePair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal existComplexityTime = subtotalComplexityTimePair.get(projectDeptId);
|
|
|
|
|
+ BigDecimal tempComplexityTime = existComplexityTime.add(complexityTime);
|
|
|
|
|
+ subtotalComplexityTimePair.put(projectDeptId, tempComplexityTime);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalComplexityTimePair.put(projectDeptId, complexityTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 生产配合 npt
|
|
|
|
|
+ BigDecimal relocationTime = report.getRelocationTime();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(relocationTime)) {
|
|
|
|
|
+ if (subtotalRelocationTimePair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal existRelocationTime = subtotalRelocationTimePair.get(projectDeptId);
|
|
|
|
|
+ BigDecimal tempRelocationTime = existRelocationTime.add(relocationTime);
|
|
|
|
|
+ subtotalRelocationTimePair.put(projectDeptId, tempRelocationTime);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalRelocationTimePair.put(projectDeptId, relocationTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 生产组织 npt
|
|
|
|
|
+ BigDecimal rectificationTime = report.getRectificationTime();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(rectificationTime)) {
|
|
|
|
|
+ if (subtotalRectificationTimePair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal existRectificationTime = subtotalRectificationTimePair.get(projectDeptId);
|
|
|
|
|
+ BigDecimal tempRectificationTime = existRectificationTime.add(rectificationTime);
|
|
|
|
|
+ subtotalRectificationTimePair.put(projectDeptId, tempRectificationTime);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalRectificationTimePair.put(projectDeptId, rectificationTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 不可抗力 npt
|
|
|
|
|
+ BigDecimal waitingStopTime = report.getWaitingStopTime();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(waitingStopTime)) {
|
|
|
|
|
+ if (subtotalWaitingStopTimePair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal existWaitingStopTime = subtotalWaitingStopTimePair.get(projectDeptId);
|
|
|
|
|
+ BigDecimal tempWaitingStopTime = existWaitingStopTime.add(waitingStopTime);
|
|
|
|
|
+ subtotalWaitingStopTimePair.put(projectDeptId, tempWaitingStopTime);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalWaitingStopTimePair.put(projectDeptId, waitingStopTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 待命 npt
|
|
|
|
|
+ BigDecimal winterBreakTime = report.getWinterBreakTime();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(winterBreakTime)) {
|
|
|
|
|
+ if (subtotalWinterBreakTimePair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal existWinterBreakTime = subtotalWinterBreakTimePair.get(projectDeptId);
|
|
|
|
|
+ BigDecimal tempWinterBreakTime = existWinterBreakTime.add(winterBreakTime);
|
|
|
|
|
+ subtotalWinterBreakTimePair.put(projectDeptId, tempWinterBreakTime);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalWinterBreakTimePair.put(projectDeptId, winterBreakTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 甲方设计 npt
|
|
|
|
|
+ BigDecimal partyaDesign = report.getPartyaDesign();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(partyaDesign)) {
|
|
|
|
|
+ if (subtotalPartyaDesignPair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal existPartyaDesign = subtotalPartyaDesignPair.get(projectDeptId);
|
|
|
|
|
+ BigDecimal tempPartyaDesign = existPartyaDesign.add(partyaDesign);
|
|
|
|
|
+ subtotalPartyaDesignPair.put(projectDeptId, tempPartyaDesign);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalPartyaDesignPair.put(projectDeptId, partyaDesign);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 甲方准备 npt
|
|
|
|
|
+ BigDecimal partyaPrepare = report.getPartyaPrepare();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(partyaPrepare)) {
|
|
|
|
|
+ if (subtotalPartyaPreparePair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal existPartyaPrepare = subtotalPartyaPreparePair.get(projectDeptId);
|
|
|
|
|
+ BigDecimal tempPartyaPrepare = existPartyaPrepare.add(partyaPrepare);
|
|
|
|
|
+ subtotalPartyaPreparePair.put(projectDeptId, tempPartyaPrepare);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalPartyaPreparePair.put(projectDeptId, partyaPrepare);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 甲方资源 npt
|
|
|
|
|
+ BigDecimal partyaResource = report.getPartyaResource();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(partyaResource)) {
|
|
|
|
|
+ if (subtotalPartyaResourcePair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal existPartyaResource = subtotalPartyaResourcePair.get(projectDeptId);
|
|
|
|
|
+ BigDecimal tempPartyaResource = existPartyaResource.add(partyaResource);
|
|
|
|
|
+ subtotalPartyaResourcePair.put(projectDeptId, tempPartyaResource);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalPartyaResourcePair.put(projectDeptId, partyaResource);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 其它非生产时间 npt
|
|
|
|
|
+ BigDecimal otherNptTime = report.getOtherNptTime();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(otherNptTime)) {
|
|
|
|
|
+ if (subtotalOtherNptTimePair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal existOtherNptTime = subtotalOtherNptTimePair.get(projectDeptId);
|
|
|
|
|
+ BigDecimal tempOtherNptTime = existOtherNptTime.add(otherNptTime);
|
|
|
|
|
+ subtotalOtherNptTimePair.put(projectDeptId, tempOtherNptTime);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalOtherNptTimePair.put(projectDeptId, otherNptTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // 计算每个项目部的 npt小计 npt时效
|
|
|
|
|
+ if (CollUtil.isNotEmpty(projectDeptPair)) {
|
|
|
|
|
+ projectDeptPair.forEach((projectDeptId, dept) -> {
|
|
|
|
|
+ // 统计当前项目部所有 npt 总和、时效
|
|
|
|
|
+ BigDecimal tempSubtotalNpt = BigDecimal.ZERO;
|
|
|
|
|
+ // 计入 npt时效 的非生产时间小计
|
|
|
|
|
+ BigDecimal tempNptSum = BigDecimal.ZERO;
|
|
|
|
|
+ if (subtotalAccidentTimePair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal accidentTime = subtotalAccidentTimePair.get(projectDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(accidentTime);
|
|
|
|
|
+ tempNptSum = tempNptSum.add(accidentTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (subtotalRepairTimePair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal repairTime = subtotalRepairTimePair.get(projectDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(repairTime);
|
|
|
|
|
+ tempNptSum = tempNptSum.add(repairTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (subtotalSelfStopTimePair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal selfStopTime = subtotalSelfStopTimePair.get(projectDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(selfStopTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (subtotalComplexityTimePair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal complexityTime = subtotalComplexityTimePair.get(projectDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(complexityTime);
|
|
|
|
|
+ tempNptSum = tempNptSum.add(complexityTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (subtotalRelocationTimePair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal relocationTime = subtotalRelocationTimePair.get(projectDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(relocationTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (subtotalRectificationTimePair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal rectificationTime = subtotalRectificationTimePair.get(projectDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(rectificationTime);
|
|
|
|
|
+ tempNptSum = tempNptSum.add(rectificationTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (subtotalWaitingStopTimePair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal waitingStopTime = subtotalWaitingStopTimePair.get(projectDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(waitingStopTime);
|
|
|
|
|
+ tempNptSum = tempNptSum.add(waitingStopTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (subtotalWinterBreakTimePair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal winterBreakTime = subtotalWinterBreakTimePair.get(projectDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(winterBreakTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (subtotalPartyaDesignPair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal partyaDesign = subtotalPartyaDesignPair.get(projectDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(partyaDesign);
|
|
|
|
|
+ tempNptSum = tempNptSum.add(partyaDesign);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (subtotalPartyaPreparePair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal partyaPrepare = subtotalPartyaPreparePair.get(projectDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(partyaPrepare);
|
|
|
|
|
+ tempNptSum = tempNptSum.add(partyaPrepare);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (subtotalPartyaResourcePair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal partyaResource = subtotalPartyaResourcePair.get(projectDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(partyaResource);
|
|
|
|
|
+ tempNptSum = tempNptSum.add(partyaResource);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (subtotalOtherNptTimePair.containsKey(projectDeptId)) {
|
|
|
|
|
+ BigDecimal otherNptTime = subtotalOtherNptTimePair.get(projectDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(otherNptTime);
|
|
|
|
|
+ tempNptSum = tempNptSum.add(otherNptTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 项目部 npt 小计
|
|
|
|
|
+ subtotalNptTimePair.put(projectDeptId, tempNptSum);
|
|
|
|
|
+ // 项目部 npt 时效 以下非生产时间计入非生产时效
|
|
|
|
|
+ // 设备故障repair_time
|
|
|
|
|
+ // 工程质量accident_time
|
|
|
|
|
+ // 技术受限complexity_time
|
|
|
|
|
+ // 生产组织rectification_time
|
|
|
|
|
+ // 不可抗力waiting_stop_time
|
|
|
|
|
+ // 甲方设计partya_design
|
|
|
|
|
+ // 甲方准备partya_prepare
|
|
|
|
|
+ // 甲方资源partya_resource
|
|
|
|
|
+ // 其他非生产时间other_npt_time
|
|
|
|
|
+ if (CollUtil.isNotEmpty(totalHours)) {
|
|
|
|
|
+ Long totalHour = totalHours.get(0);
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(totalHour) && totalHour > 0) {
|
|
|
|
|
+ BigDecimal nptRate = tempNptSum.divide(new BigDecimal(totalHour), 4, RoundingMode.HALF_UP);
|
|
|
|
|
+ subtotalNptRatePair.put(projectDeptId, nptRate);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 生成返回的数据列表集合
|
|
|
|
|
+ projectDeptPair.forEach((deptId, dept) -> {
|
|
|
|
|
+ IotRhDailyReportNptStatisticsRespVO statistics = new IotRhDailyReportNptStatisticsRespVO();
|
|
|
|
|
+ statistics.setProjectDeptId(deptId);
|
|
|
|
|
+ statistics.setProjectDeptName(dept.getName());
|
|
|
|
|
+ statistics.setSort(dept.getSort());
|
|
|
|
|
+ statistics.setType("2");
|
|
|
|
|
+ statistics.setAccidentTime(subtotalAccidentTimePair.get(deptId));
|
|
|
|
|
+ statistics.setRepairTime(subtotalRepairTimePair.get(deptId));
|
|
|
|
|
+ statistics.setSelfStopTime(subtotalSelfStopTimePair.get(deptId));
|
|
|
|
|
+ statistics.setComplexityTime(subtotalComplexityTimePair.get(deptId));
|
|
|
|
|
+ statistics.setRelocationTime(subtotalRelocationTimePair.get(deptId));
|
|
|
|
|
+ statistics.setRectificationTime(subtotalRectificationTimePair.get(deptId));
|
|
|
|
|
+ statistics.setWaitingStopTime(subtotalWaitingStopTimePair.get(deptId));
|
|
|
|
|
+ statistics.setWinterBreakTime(subtotalWinterBreakTimePair.get(deptId));
|
|
|
|
|
+ statistics.setPartyaDesign(subtotalPartyaDesignPair.get(deptId));
|
|
|
|
|
+ statistics.setPartyaPrepare(subtotalPartyaPreparePair.get(deptId));
|
|
|
|
|
+ statistics.setPartyaResource(subtotalPartyaResourcePair.get(deptId));
|
|
|
|
|
+ statistics.setOtherNptTime(subtotalOtherNptTimePair.get(deptId));
|
|
|
|
|
+ statistics.setNptTotal(subtotalNptTimePair.get(deptId));
|
|
|
|
|
+ statistics.setNptRate(subtotalNptRatePair.get(deptId));
|
|
|
|
|
+ if (CollUtil.isNotEmpty(totalHours)) {
|
|
|
|
|
+ Long totalHour = totalHours.get(0);
|
|
|
|
|
+ statistics.setCalendarTime(new BigDecimal(totalHour));
|
|
|
|
|
+ }
|
|
|
|
|
+ result.add(statistics);
|
|
|
|
|
+ });
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 按项目部 日期 维度统计 折线 数据
|
|
* 按项目部 日期 维度统计 折线 数据
|
|
|
* @param dailyReports 日报数据列表
|
|
* @param dailyReports 日报数据列表
|
|
@@ -1444,8 +1852,8 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
/**
|
|
/**
|
|
|
* 按 队伍 维度统计数据
|
|
* 按 队伍 维度统计数据
|
|
|
* @param dailyReports 日报数据列表
|
|
* @param dailyReports 日报数据列表
|
|
|
- * @param pageReqVO.deptId 项目部ID 或 队伍id(塔河项目部 HY-A1)
|
|
|
|
|
- * @return 队伍 维度统计结果列表
|
|
|
|
|
|
|
+ * @param pageReqVO 查询条件 项目 或 任务井号 or deptId
|
|
|
|
|
+ * @return 队伍 维度统计 日报汇总 工作量
|
|
|
*/
|
|
*/
|
|
|
private List<IotRhDailyReportStatisticsRespVO> statisticsByProjectDepartment(List<IotRhDailyReportDO> dailyReports,
|
|
private List<IotRhDailyReportStatisticsRespVO> statisticsByProjectDepartment(List<IotRhDailyReportDO> dailyReports,
|
|
|
IotRhDailyReportPageReqVO pageReqVO) {
|
|
IotRhDailyReportPageReqVO pageReqVO) {
|
|
@@ -1660,6 +2068,357 @@ public class IotRhDailyReportServiceImpl implements IotRhDailyReportService {
|
|
|
return result;
|
|
return result;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * 按 队伍 维度统计 非生产时效
|
|
|
|
|
+ * @param dailyReports 日报数据列表
|
|
|
|
|
+ * @param pageReqVO 查询条件 项目 或 任务井号 or deptId
|
|
|
|
|
+ * @return 队伍 维度统计 非生产时效
|
|
|
|
|
+ */
|
|
|
|
|
+ private List<IotRhDailyReportNptStatisticsRespVO> nptStatisticsByProjectDepartment(List<IotRhDailyReportDO> dailyReports,
|
|
|
|
|
+ IotRhDailyReportPageReqVO pageReqVO) {
|
|
|
|
|
+ List<IotRhDailyReportNptStatisticsRespVO> result = new ArrayList<>();
|
|
|
|
|
+
|
|
|
|
|
+ Set<Long> projectDeptIds = new HashSet<>();
|
|
|
|
|
+ // key项目部id value项目部名称
|
|
|
|
|
+ Map<Long, DeptDO> projectDeptPair = new HashMap<>();
|
|
|
|
|
+ // key队伍id value队伍名称
|
|
|
|
|
+ Map<Long, DeptDO> teamDeptPair = new HashMap<>();
|
|
|
|
|
+ // key部门id value部门parentId
|
|
|
|
|
+ Map<Long, Long> teamProjectIdPair = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ // key队伍id/项目部id value累计 工程质量npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalAccidentTimePair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计 设备故障npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalRepairTimePair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计 设备保养npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalSelfStopTimePair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计 技术受限npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalComplexityTimePair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计 生产配合npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalRelocationTimePair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计 生产组织npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalRectificationTimePair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计 不可抗力npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalWaitingStopTimePair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计 待命npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalWinterBreakTimePair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计 甲方设计npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalPartyaDesignPair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计 甲方准备npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalPartyaPreparePair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计 甲方资源npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalPartyaResourcePair = new HashMap<>();
|
|
|
|
|
+ // key队伍id/项目部id value累计 其它非生产时间npt
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalOtherNptTimePair = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ // key队伍id value npt小计
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalNptTimePair = new HashMap<>();
|
|
|
|
|
+ // key队伍id value npt时效%
|
|
|
|
|
+ Map<Long, BigDecimal> subtotalNptRatePair = new HashMap<>();
|
|
|
|
|
+
|
|
|
|
|
+ // 以 队伍 为维度统计数据 找到所有项目部与队伍的对应关系
|
|
|
|
|
+ // 查询指定根部门下的所有子部门
|
|
|
|
|
+ Set<Long> allRhChildDeptIds = deptService.getChildDeptIdListFromCache(pageReqVO.getDeptId());
|
|
|
|
|
+ DeptListReqVO reqVO = new DeptListReqVO();
|
|
|
|
|
+ allRhChildDeptIds.add(pageReqVO.getDeptId()); // 查询某支队伍
|
|
|
|
|
+ reqVO.setDeptIds(allRhChildDeptIds);
|
|
|
|
|
+ List<DeptDO> depts = deptService.getDeptList(reqVO);
|
|
|
|
|
+
|
|
|
|
|
+ // 筛选出项目部
|
|
|
|
|
+ depts.forEach(dept -> {
|
|
|
|
|
+ if ("2".equals(dept.getType())) {
|
|
|
|
|
+ // 组装项目部id集合
|
|
|
|
|
+ projectDeptIds.add(dept.getId());
|
|
|
|
|
+ projectDeptPair.put(dept.getId(), dept);
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // 构建项目部映射和父子部门关系
|
|
|
|
|
+ depts.forEach(dept -> {
|
|
|
|
|
+ if ("3".equals(dept.getType())) {
|
|
|
|
|
+ teamDeptPair.put(dept.getId(), dept);
|
|
|
|
|
+ }
|
|
|
|
|
+ teamProjectIdPair.put(dept.getId(), dept.getParentId());
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // 计算日期查询区间有多少小时
|
|
|
|
|
+ LocalDateTime[] createTimes = pageReqVO.getCreateTime();
|
|
|
|
|
+ List<Long> totalHours = new ArrayList<>();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(createTimes) && createTimes.length >= 2) {
|
|
|
|
|
+ LocalDate startDate = createTimes[0].toLocalDate();
|
|
|
|
|
+ LocalDate endDate = createTimes[1].toLocalDate();
|
|
|
|
|
+ // 核心:包含起止两天 → 天数差 +1 再 ×24
|
|
|
|
|
+ long days = ChronoUnit.DAYS.between(startDate, endDate) + 1;
|
|
|
|
|
+ Long tempTotalHours = days * 24L;
|
|
|
|
|
+ totalHours.add(tempTotalHours);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 累计计算各项指标
|
|
|
|
|
+ if (CollUtil.isNotEmpty(dailyReports)) {
|
|
|
|
|
+ dailyReports.forEach(report -> {
|
|
|
|
|
+ // 统计日报 每个队伍的非生产时间集合
|
|
|
|
|
+ Long reportDeptId = report.getDeptId();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(reportDeptId) && teamDeptPair.containsKey(reportDeptId)) {
|
|
|
|
|
+ // 工程质量 npt
|
|
|
|
|
+ BigDecimal accidentTime = report.getAccidentTime();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(accidentTime)) {
|
|
|
|
|
+ if (subtotalAccidentTimePair.containsKey(reportDeptId)) {
|
|
|
|
|
+ BigDecimal existAccidentTime = subtotalAccidentTimePair.get(reportDeptId);
|
|
|
|
|
+ BigDecimal tempAccidentTime = existAccidentTime.add(accidentTime);
|
|
|
|
|
+ subtotalAccidentTimePair.put(reportDeptId, tempAccidentTime);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalAccidentTimePair.put(reportDeptId, accidentTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 设备故障 npt
|
|
|
|
|
+ BigDecimal repairTime = report.getRepairTime();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(repairTime)) {
|
|
|
|
|
+ if (subtotalRepairTimePair.containsKey(reportDeptId)) {
|
|
|
|
|
+ BigDecimal existRepairTime = subtotalRepairTimePair.get(reportDeptId);
|
|
|
|
|
+ BigDecimal tempRepairTime = existRepairTime.add(repairTime);
|
|
|
|
|
+ subtotalRepairTimePair.put(reportDeptId, tempRepairTime);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalRepairTimePair.put(reportDeptId, repairTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 设备保养 npt
|
|
|
|
|
+ BigDecimal selfStopTime = report.getSelfStopTime();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(selfStopTime)) {
|
|
|
|
|
+ if (subtotalSelfStopTimePair.containsKey(reportDeptId)) {
|
|
|
|
|
+ BigDecimal existSelfStopTime = subtotalSelfStopTimePair.get(reportDeptId);
|
|
|
|
|
+ BigDecimal tempSelfStopTime = existSelfStopTime.add(selfStopTime);
|
|
|
|
|
+ subtotalSelfStopTimePair.put(reportDeptId, tempSelfStopTime);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalSelfStopTimePair.put(reportDeptId, selfStopTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 技术受限 npt
|
|
|
|
|
+ BigDecimal complexityTime = report.getComplexityTime();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(complexityTime)) {
|
|
|
|
|
+ if (subtotalComplexityTimePair.containsKey(reportDeptId)) {
|
|
|
|
|
+ BigDecimal existComplexityTime = subtotalComplexityTimePair.get(reportDeptId);
|
|
|
|
|
+ BigDecimal tempComplexityTime = existComplexityTime.add(complexityTime);
|
|
|
|
|
+ subtotalComplexityTimePair.put(reportDeptId, tempComplexityTime);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalComplexityTimePair.put(reportDeptId, complexityTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 生产配合 npt
|
|
|
|
|
+ BigDecimal relocationTime = report.getRelocationTime();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(relocationTime)) {
|
|
|
|
|
+ if (subtotalRelocationTimePair.containsKey(reportDeptId)) {
|
|
|
|
|
+ BigDecimal existRelocationTime = subtotalRelocationTimePair.get(reportDeptId);
|
|
|
|
|
+ BigDecimal tempRelocationTime = existRelocationTime.add(relocationTime);
|
|
|
|
|
+ subtotalRelocationTimePair.put(reportDeptId, tempRelocationTime);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalRelocationTimePair.put(reportDeptId, relocationTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 生产组织 npt
|
|
|
|
|
+ BigDecimal rectificationTime = report.getRectificationTime();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(rectificationTime)) {
|
|
|
|
|
+ if (subtotalRectificationTimePair.containsKey(reportDeptId)) {
|
|
|
|
|
+ BigDecimal existRectificationTime = subtotalRectificationTimePair.get(reportDeptId);
|
|
|
|
|
+ BigDecimal tempRectificationTime = existRectificationTime.add(rectificationTime);
|
|
|
|
|
+ subtotalRectificationTimePair.put(reportDeptId, tempRectificationTime);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalRectificationTimePair.put(reportDeptId, rectificationTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 不可抗力 npt
|
|
|
|
|
+ BigDecimal waitingStopTime = report.getWaitingStopTime();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(waitingStopTime)) {
|
|
|
|
|
+ if (subtotalWaitingStopTimePair.containsKey(reportDeptId)) {
|
|
|
|
|
+ BigDecimal existWaitingStopTime = subtotalWaitingStopTimePair.get(reportDeptId);
|
|
|
|
|
+ BigDecimal tempWaitingStopTime = existWaitingStopTime.add(waitingStopTime);
|
|
|
|
|
+ subtotalWaitingStopTimePair.put(reportDeptId, tempWaitingStopTime);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalWaitingStopTimePair.put(reportDeptId, waitingStopTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 待命 npt
|
|
|
|
|
+ BigDecimal winterBreakTime = report.getWinterBreakTime();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(winterBreakTime)) {
|
|
|
|
|
+ if (subtotalWinterBreakTimePair.containsKey(reportDeptId)) {
|
|
|
|
|
+ BigDecimal existWinterBreakTime = subtotalWinterBreakTimePair.get(reportDeptId);
|
|
|
|
|
+ BigDecimal tempWinterBreakTime = existWinterBreakTime.add(winterBreakTime);
|
|
|
|
|
+ subtotalWinterBreakTimePair.put(reportDeptId, tempWinterBreakTime);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalWinterBreakTimePair.put(reportDeptId, winterBreakTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 甲方设计 npt
|
|
|
|
|
+ BigDecimal partyaDesign = report.getPartyaDesign();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(partyaDesign)) {
|
|
|
|
|
+ if (subtotalPartyaDesignPair.containsKey(reportDeptId)) {
|
|
|
|
|
+ BigDecimal existPartyaDesign = subtotalPartyaDesignPair.get(reportDeptId);
|
|
|
|
|
+ BigDecimal tempPartyaDesign = existPartyaDesign.add(partyaDesign);
|
|
|
|
|
+ subtotalPartyaDesignPair.put(reportDeptId, tempPartyaDesign);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalPartyaDesignPair.put(reportDeptId, partyaDesign);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 甲方准备 npt
|
|
|
|
|
+ BigDecimal partyaPrepare = report.getPartyaPrepare();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(partyaPrepare)) {
|
|
|
|
|
+ if (subtotalPartyaPreparePair.containsKey(reportDeptId)) {
|
|
|
|
|
+ BigDecimal existPartyaPrepare = subtotalPartyaPreparePair.get(reportDeptId);
|
|
|
|
|
+ BigDecimal tempPartyaPrepare = existPartyaPrepare.add(partyaPrepare);
|
|
|
|
|
+ subtotalPartyaPreparePair.put(reportDeptId, tempPartyaPrepare);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalPartyaPreparePair.put(reportDeptId, partyaPrepare);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 甲方资源 npt
|
|
|
|
|
+ BigDecimal partyaResource = report.getPartyaResource();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(partyaResource)) {
|
|
|
|
|
+ if (subtotalPartyaResourcePair.containsKey(reportDeptId)) {
|
|
|
|
|
+ BigDecimal existPartyaResource = subtotalPartyaResourcePair.get(reportDeptId);
|
|
|
|
|
+ BigDecimal tempPartyaResource = existPartyaResource.add(partyaResource);
|
|
|
|
|
+ subtotalPartyaResourcePair.put(reportDeptId, tempPartyaResource);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalPartyaResourcePair.put(reportDeptId, partyaResource);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ // 其它非生产时间 npt
|
|
|
|
|
+ BigDecimal otherNptTime = report.getOtherNptTime();
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(otherNptTime)) {
|
|
|
|
|
+ if (subtotalOtherNptTimePair.containsKey(reportDeptId)) {
|
|
|
|
|
+ BigDecimal existOtherNptTime = subtotalOtherNptTimePair.get(reportDeptId);
|
|
|
|
|
+ BigDecimal tempOtherNptTime = existOtherNptTime.add(otherNptTime);
|
|
|
|
|
+ subtotalOtherNptTimePair.put(reportDeptId, tempOtherNptTime);
|
|
|
|
|
+ } else {
|
|
|
|
|
+ subtotalOtherNptTimePair.put(reportDeptId, otherNptTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ // 计算每个 施工队伍 的 npt小计 npt时效
|
|
|
|
|
+ if (CollUtil.isNotEmpty(teamDeptPair)) {
|
|
|
|
|
+ teamDeptPair.forEach((teamDeptId, dept) -> {
|
|
|
|
|
+ // 统计当前 施工队伍 所有 npt总和 npt时效
|
|
|
|
|
+ BigDecimal tempSubtotalNpt = BigDecimal.ZERO;
|
|
|
|
|
+ // 计入 npt时效 的非生产时间小计
|
|
|
|
|
+ BigDecimal tempNptSum = BigDecimal.ZERO;
|
|
|
|
|
+ if (subtotalAccidentTimePair.containsKey(teamDeptId)) {
|
|
|
|
|
+ BigDecimal accidentTime = subtotalAccidentTimePair.get(teamDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(accidentTime);
|
|
|
|
|
+ tempNptSum = tempNptSum.add(accidentTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (subtotalRepairTimePair.containsKey(teamDeptId)) {
|
|
|
|
|
+ BigDecimal repairTime = subtotalRepairTimePair.get(teamDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(repairTime);
|
|
|
|
|
+ tempNptSum = tempNptSum.add(repairTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 设备保养 不计入 非生产时效
|
|
|
|
|
+ if (subtotalSelfStopTimePair.containsKey(teamDeptId)) {
|
|
|
|
|
+ BigDecimal selfStopTime = subtotalSelfStopTimePair.get(teamDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(selfStopTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (subtotalComplexityTimePair.containsKey(teamDeptId)) {
|
|
|
|
|
+ BigDecimal complexityTime = subtotalComplexityTimePair.get(teamDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(complexityTime);
|
|
|
|
|
+ tempNptSum = tempNptSum.add(complexityTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 生产配合 不计入 非生产时效
|
|
|
|
|
+ if (subtotalRelocationTimePair.containsKey(teamDeptId)) {
|
|
|
|
|
+ BigDecimal relocationTime = subtotalRelocationTimePair.get(teamDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(relocationTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (subtotalRectificationTimePair.containsKey(teamDeptId)) {
|
|
|
|
|
+ BigDecimal rectificationTime = subtotalRectificationTimePair.get(teamDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(rectificationTime);
|
|
|
|
|
+ tempNptSum = tempNptSum.add(rectificationTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (subtotalWaitingStopTimePair.containsKey(teamDeptId)) {
|
|
|
|
|
+ BigDecimal waitingStopTime = subtotalWaitingStopTimePair.get(teamDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(waitingStopTime);
|
|
|
|
|
+ tempNptSum = tempNptSum.add(waitingStopTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 待命 不计入 非生产时效
|
|
|
|
|
+ if (subtotalWinterBreakTimePair.containsKey(teamDeptId)) {
|
|
|
|
|
+ BigDecimal winterBreakTime = subtotalWinterBreakTimePair.get(teamDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(winterBreakTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (subtotalPartyaDesignPair.containsKey(teamDeptId)) {
|
|
|
|
|
+ BigDecimal partyaDesign = subtotalPartyaDesignPair.get(teamDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(partyaDesign);
|
|
|
|
|
+ tempNptSum = tempNptSum.add(partyaDesign);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (subtotalPartyaPreparePair.containsKey(teamDeptId)) {
|
|
|
|
|
+ BigDecimal partyaPrepare = subtotalPartyaPreparePair.get(teamDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(partyaPrepare);
|
|
|
|
|
+ tempNptSum = tempNptSum.add(partyaPrepare);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (subtotalPartyaResourcePair.containsKey(teamDeptId)) {
|
|
|
|
|
+ BigDecimal partyaResource = subtotalPartyaResourcePair.get(teamDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(partyaResource);
|
|
|
|
|
+ tempNptSum = tempNptSum.add(partyaResource);
|
|
|
|
|
+ }
|
|
|
|
|
+ if (subtotalOtherNptTimePair.containsKey(teamDeptId)) {
|
|
|
|
|
+ BigDecimal otherNptTime = subtotalOtherNptTimePair.get(teamDeptId);
|
|
|
|
|
+ tempSubtotalNpt = tempSubtotalNpt.add(otherNptTime);
|
|
|
|
|
+ tempNptSum = tempNptSum.add(otherNptTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 施工队伍 npt 小计
|
|
|
|
|
+ subtotalNptTimePair.put(teamDeptId, tempNptSum);
|
|
|
|
|
+ // 施工队伍 npt 时效 以下非生产时间计入非生产时效
|
|
|
|
|
+ // 设备故障repair_time
|
|
|
|
|
+ // 工程质量accident_time
|
|
|
|
|
+ // 技术受限complexity_time
|
|
|
|
|
+ // 生产组织rectification_time
|
|
|
|
|
+ // 不可抗力waiting_stop_time
|
|
|
|
|
+ // 甲方设计partya_design
|
|
|
|
|
+ // 甲方准备partya_prepare
|
|
|
|
|
+ // 甲方资源partya_resource
|
|
|
|
|
+ // 其他非生产时间other_npt_time
|
|
|
|
|
+ if (CollUtil.isNotEmpty(totalHours)) {
|
|
|
|
|
+ Long totalHour = totalHours.get(0);
|
|
|
|
|
+ if (ObjUtil.isNotEmpty(totalHour) && totalHour > 0) {
|
|
|
|
|
+ BigDecimal nptRate = tempNptSum.divide(new BigDecimal(totalHour), 4, RoundingMode.HALF_UP);
|
|
|
|
|
+ subtotalNptRatePair.put(teamDeptId, nptRate);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ });
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 生成返回的数据列表集合
|
|
|
|
|
+ teamDeptPair.forEach((teamDeptId, dept) -> {
|
|
|
|
|
+ IotRhDailyReportNptStatisticsRespVO statistics = new IotRhDailyReportNptStatisticsRespVO();
|
|
|
|
|
+ statistics.setTeamId(teamDeptId);
|
|
|
|
|
+ statistics.setTeamName(dept.getName());
|
|
|
|
|
+ statistics.setSort(dept.getSort());
|
|
|
|
|
+ if (teamDeptPair.containsKey(teamDeptId)) {
|
|
|
|
|
+ statistics.setType("3");
|
|
|
|
|
+ }
|
|
|
|
|
+ statistics.setAccidentTime(subtotalAccidentTimePair.get(teamDeptId));
|
|
|
|
|
+ statistics.setRepairTime(subtotalRepairTimePair.get(teamDeptId));
|
|
|
|
|
+ statistics.setSelfStopTime(subtotalSelfStopTimePair.get(teamDeptId));
|
|
|
|
|
+ statistics.setComplexityTime(subtotalComplexityTimePair.get(teamDeptId));
|
|
|
|
|
+ statistics.setRelocationTime(subtotalRelocationTimePair.get(teamDeptId));
|
|
|
|
|
+ statistics.setRectificationTime(subtotalRectificationTimePair.get(teamDeptId));
|
|
|
|
|
+ statistics.setWaitingStopTime(subtotalWaitingStopTimePair.get(teamDeptId));
|
|
|
|
|
+ statistics.setWinterBreakTime(subtotalWinterBreakTimePair.get(teamDeptId));
|
|
|
|
|
+ statistics.setPartyaDesign(subtotalPartyaDesignPair.get(teamDeptId));
|
|
|
|
|
+ statistics.setPartyaPrepare(subtotalPartyaPreparePair.get(teamDeptId));
|
|
|
|
|
+ statistics.setPartyaResource(subtotalPartyaResourcePair.get(teamDeptId));
|
|
|
|
|
+ statistics.setOtherNptTime(subtotalOtherNptTimePair.get(teamDeptId));
|
|
|
|
|
+ statistics.setNptTotal(subtotalNptTimePair.get(teamDeptId));
|
|
|
|
|
+ statistics.setNptRate(subtotalNptRatePair.get(teamDeptId));
|
|
|
|
|
+ if (CollUtil.isNotEmpty(totalHours)) {
|
|
|
|
|
+ Long totalHour = totalHours.get(0);
|
|
|
|
|
+ statistics.setCalendarTime(new BigDecimal(totalHour));
|
|
|
|
|
+ }
|
|
|
|
|
+ result.add(statistics);
|
|
|
|
|
+ });
|
|
|
|
|
+
|
|
|
|
|
+ return result;
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* 按 队伍 维度统计数据
|
|
* 按 队伍 维度统计数据
|
|
|
* @param dailyReports 日报数据列表
|
|
* @param dailyReports 日报数据列表
|