From a5fdc44dbfaf539a03fe862647bda41010b545ee Mon Sep 17 00:00:00 2001 From: ty <1577900710@qq.com> Date: Thu, 13 Jun 2024 22:39:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=EF=BC=9A=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E6=9C=88=E6=8A=A5=E4=B8=A4=E7=A5=A8=E3=80=81=E5=B7=A1=E6=A3=80?= =?UTF-8?q?=E3=80=81=E5=80=BC=E7=8F=AD=E7=BB=9F=E8=AE=A1=E9=80=BB=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzinfo/inspect/task/mapper/TaskMapper.xml | 1 + .../inspect/task/service/impl/TaskServiceImpl.java | 13 ++- .../service/impl/OperPhenomenonServiceImpl.java | 11 ++- .../duty/service/impl/ImsDutyMainServiceImpl.java | 93 +++++++++++++++++----- .../impl/OperStationMonthReportServiceImpl.java | 7 +- .../operational/report/vo/DutyRunReportVO.java | 3 +- .../impl/StandardTicketInfoServiceImpl.java | 22 ++--- .../service/impl/FirstWorkTicketServiceImpl.java | 2 +- 8 files changed, 112 insertions(+), 40 deletions(-) diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml index 2fd01a6..d86cd7d 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/mapper/TaskMapper.xml @@ -393,6 +393,7 @@ from hz_st_ex_task t,hz_st_ex_task_user u where t.id = u.task_id and t.is_deleted = 0 and u.is_deleted = 0 and u.user_id is not null + and u.CLAIM_STATUS =1 and t.CREATE_TIME >= #{startTime} diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java index 290ea22..1c96e7c 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/task/service/impl/TaskServiceImpl.java @@ -1003,9 +1003,16 @@ public class TaskServiceImpl extends BaseServiceImpl imp QueryWrapper queryWrapper = new QueryWrapper<>(); if (ObjectUtil.isNotEmpty(deptId)) { if (deptIds.contains(deptId)) { - queryWrapper.in(ObjectUtils.isNotNull(deptIds), "CREATE_DEPT", deptId); - } else { - throw new ServiceException("暂无该机构权限"); + //模糊查询,查询当前机构及其子机构 + R> childDeptListR = sysClient.getDeptChild(deptId); + if (childDeptListR.isSuccess() && CollectionUtil.isNotEmpty(childDeptListR.getData())) { + List currentDeptIdList = new ArrayList<>(); + currentDeptIdList.add(deptId); + currentDeptIdList.addAll(childDeptListR.getData().stream().map(Dept::getId).collect(Collectors.toList())); + queryWrapper.in(CollectionUtil.isNotEmpty(currentDeptIdList), "CREATE_DEPT", currentDeptIdList); + } else { + throw new ServiceException("暂无该机构权限"); + } } } else { queryWrapper.in(ObjectUtils.isNotNull(deptIds), "CREATE_DEPT", deptIds); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperPhenomenonServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperPhenomenonServiceImpl.java index bf8224d..e81dddf 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperPhenomenonServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/defect/service/impl/OperPhenomenonServiceImpl.java @@ -596,12 +596,19 @@ public class OperPhenomenonServiceImpl extends BaseServiceImpl queryWrapper = new QueryWrapper<>(); if (ObjectUtil.isNotEmpty(deptId)) { if (deptIds.contains(deptId)) { - queryWrapper.in(ObjectUtils.isNotNull(deptIds), "CREATE_DEPT", deptId); + //模糊查询,查询当前机构及其子机构 + R> childDeptListR = sysClient.getDeptChild(deptId); + if (childDeptListR.isSuccess() && CollectionUtil.isNotEmpty(childDeptListR.getData())) { + List currentDeptIdList=new ArrayList<>(); + currentDeptIdList.add(deptId); + currentDeptIdList.addAll(childDeptListR.getData().stream().map(Dept::getId).collect(Collectors.toList())); + queryWrapper.in(CollectionUtil.isNotEmpty(currentDeptIdList), "CREATE_DEPT", currentDeptIdList); + } } else { throw new ServiceException("暂无该机构权限"); } } else { - queryWrapper.in(ObjectUtils.isNotNull(deptIds), "CREATE_DEPT", deptIds); + queryWrapper.in(CollectionUtil.isNotEmpty(deptIds), "CREATE_DEPT", deptIds); } queryWrapper.ge(ObjectUtils.isNotNull(startTime), "CREATE_TIME", startTime); queryWrapper.le(ObjectUtils.isNotNull(endTime), "CREATE_TIME", endTime); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java index 4d0aba5..306d0a3 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java @@ -49,6 +49,9 @@ import java.util.concurrent.atomic.AtomicInteger; import java.util.function.Function; import java.util.stream.Collectors; +import static com.hnac.hzims.operational.duty.DutyContants.DutyRecDelayStatusEnum.CARRY_DELAY_STATUS; +import static com.hnac.hzims.operational.duty.DutyContants.DutyRecDelayStatusEnum.HAND_DELAY_STATUS; + /** * 服务实现类 * @@ -1052,7 +1055,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl delayList = imsDutyRecEntityList.stream().filter(rec -> rec.getDelayStatus() == 1).collect(Collectors.toList()); + List delayList = imsDutyRecEntityList.stream().filter(rec -> rec.getDelayStatus() != 0).collect(Collectors.toList()); //异常交接班 List exceptionList = imsDutyRecEntityList.stream().filter(rec -> DutyRecStatus.ANOMALY.getVal().equals(rec.getStatus())).collect(Collectors.toList()); if (CollectionUtil.isNotEmpty(delayList)) { @@ -1070,7 +1073,6 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl deptIdList, List imsDutyMainEntityList, List dutyReportVOList,AtomicInteger index) { - //按班组组合值班记录 Map> listByGroup = imsDutyMainEntityList.stream().filter(o -> ObjectUtil.isNotEmpty(o.getDutyGroupId())).collect(Collectors.groupingBy(ImsDutyMainEntity::getDutyGroupId)); listByGroup.forEach((k, v) -> { @@ -1079,6 +1081,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl imsDutyRecEntityList = imsDutyRecMapper.selectList(new LambdaQueryWrapper() {{ - in(ImsDutyRecEntity::getDutyId, dutyIdList); - }}); - //延迟交接班 - List delayList = imsDutyRecEntityList.stream().filter(rec -> rec.getDelayStatus() == 1).collect(Collectors.toList()); - //异常交接班 - List exceptionList = imsDutyRecEntityList.stream().filter(rec -> DutyRecStatus.ANOMALY.getVal().equals(rec.getStatus())).collect(Collectors.toList()); - if (CollectionUtil.isNotEmpty(delayList)) { - dutyReportVO.setDelayChangeShifts(delayList.size()); - List delayIdsList = delayList.stream().map(ImsDutyRecEntity::getDutyId).map(s -> String.valueOf(s)).collect(Collectors.toList()); - dutyReportVO.setDelayChangeList(delayIdsList); + } + + private void getDelayAndExceptionList(List imsDutyMainEntityList, List dutyReportVOList) { + List mainIdList= imsDutyMainEntityList.stream().filter(o -> ObjectUtil.isNotEmpty(o.getDutyGroupId())).map(ImsDutyMainEntity::getId).collect(Collectors.toList()); + //获取交接班异常记录 + List imsDutyRecEntityList = imsDutyRecMapper.selectList(new LambdaQueryWrapper() {{ + in(ImsDutyRecEntity::getDutyId, mainIdList); + }}); + //延迟交接班 + List delayList = imsDutyRecEntityList.stream().filter(rec -> rec.getDelayStatus() != 0).collect(Collectors.toList()); + //异常交接班 + List exceptionList = imsDutyRecEntityList.stream().filter(rec -> DutyRecStatus.ANOMALY.getVal().equals(rec.getStatus())).collect(Collectors.toList()); + if (CollectionUtil.isNotEmpty(delayList)) { + for (ImsDutyRecEntity rec : delayList) { + if (rec.getDelayStatus().equals(CARRY_DELAY_STATUS.getStatus())){ + //如果是接班,算接班的班组+1 + List collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList()); + List troubleRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(collect.get(0).getDutyGroupId().toString())).collect(Collectors.toList()); + DutyRunReportVO troubleRunReport = troubleRunReportList.get(0); + troubleRunReport.setDelayChangeShifts(troubleRunReport.getDelayChangeShifts()+1); + }else if (rec.getDelayStatus().equals(HAND_DELAY_STATUS.getStatus())) { + //如果是交班延迟,算当前的班组+1 + List handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList()); + List handerRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(handerCollect.get(0).getDutyGroupId().toString())).collect(Collectors.toList()); + DutyRunReportVO handerRunRepor = handerRunReportList.get(0); + handerRunRepor.setDelayChangeShifts(handerRunRepor.getDelayChangeShifts()+1); + }else { + //交接班延迟,交接班组都+1 + List collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList()); + List troubleRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(collect.get(0).getDutyGroupId().toString())).collect(Collectors.toList()); + DutyRunReportVO troubleRunReport = troubleRunReportList.get(0); + troubleRunReport.setDelayChangeShifts(troubleRunReport.getDelayChangeShifts()+1); + List handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList()); + List handerRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(handerCollect.get(0).getDutyGroupId().toString())).collect(Collectors.toList()); + DutyRunReportVO handerRunRepor = handerRunReportList.get(0); + handerRunRepor.setDelayChangeShifts(handerRunRepor.getDelayChangeShifts()+1); } - if (CollectionUtil.isNotEmpty(exceptionList)) { - dutyReportVO.setExceptionChangeShifts(exceptionList.size()); - List exceptionIdsList = exceptionList.stream().map(ImsDutyRecEntity::getDutyId).map(s -> String.valueOf(s)).collect(Collectors.toList()); - dutyReportVO.setExceptionChangeList(exceptionIdsList); + } + } + if (CollectionUtil.isNotEmpty(exceptionList)) { + for (ImsDutyRecEntity rec : exceptionList) { + if (rec.getDelayStatus().equals(CARRY_DELAY_STATUS.getStatus())){ + //如果是接班,算接班的班组+1 + List collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList()); + List troubleRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(collect.get(0).getDutyGroupId().toString())).collect(Collectors.toList()); + DutyRunReportVO troubleRunReport = troubleRunReportList.get(0); + troubleRunReport.setExceptionChangeShifts(troubleRunReport.getExceptionChangeShifts()+1); + }else if (rec.getDelayStatus().equals(HAND_DELAY_STATUS.getStatus())) { + //如果是交班延迟,算当前的班组+1 + List handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList()); + List handerRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(handerCollect.get(0).getDutyGroupId().toString())).collect(Collectors.toList()); + DutyRunReportVO handerRunRepor = handerRunReportList.get(0); + handerRunRepor.setExceptionChangeShifts(handerRunRepor.getExceptionChangeShifts()+1); + }else { + //交接班延迟,交接班组都+1 + List collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList()); + List troubleRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(collect.get(0).getDutyGroupId().toString())).collect(Collectors.toList()); + DutyRunReportVO troubleRunReport = troubleRunReportList.get(0); + troubleRunReport.setExceptionChangeShifts(troubleRunReport.getExceptionChangeShifts()+1); + List handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList()); + List handerRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(handerCollect.get(0).getDutyGroupId().toString())).collect(Collectors.toList()); + DutyRunReportVO handerRunRepor = handerRunReportList.get(0); + handerRunRepor.setExceptionChangeShifts(handerRunRepor.getExceptionChangeShifts()+1); } - dutyReportVOList.add(dutyReportVO); } - }); + } } @Override @@ -1143,6 +1194,8 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl params = new HashMap<>(); //使用预定义实例来转换 DateTimeFormatter fmt = DateTimeFormatter.ISO_LOCAL_DATE; + DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); LocalDate startDate = DateUtil.getFirstDayByYearMonth(yearAndMonth); LocalDate endDate = DateUtil.getLastDayByYearMonth(yearAndMonth); params.put("startDate", fmt.format(startDate)); params.put("endDate", fmt.format(endDate)); - List deptIdList = new ArrayList<>(); deptIdList.add(deptVO.getId()); //获取下属机构 @@ -390,7 +390,9 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor pool.execute(() -> { try { List reportVOS=new ArrayList<>(); - List inspectStatisticsByName = inspectReportClient.getInspectStatisticsByName(deptIdList, fmt.format(startDate), fmt.format(endDate)); + List inspectStatisticsByName = inspectReportClient.getInspectStatisticsByName(deptIdList, + formatter.format(LocalDateTime.of(startDate, LocalTime.MIN)), + formatter.format(LocalDateTime.of(endDate, LocalTime.MAX))); if(CollectionUtil.isNotEmpty(inspectStatisticsByName)) { for (int i = 0; i < inspectStatisticsByName.size(); i++) { TaskReportVO taskReportVO = inspectStatisticsByName.get(i); @@ -472,7 +474,6 @@ public class OperStationMonthReportServiceImpl implements IOperStationMonthRepor String[] stationIdArray = new String[stationIds.size()]; stationIds.toArray(stationIdArray); fdpFaultTableDTO.setStationIds(stationIdArray); - DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"); fdpFaultTableDTO.setCreateTimeLeft(formatter.format(LocalDateTime.of(startDate, LocalTime.MIN))); fdpFaultTableDTO.setCreateTimeRight(formatter.format(LocalDateTime.of(endDate, LocalTime.MAX))); fdpFaultTableDTO.setPageSize(-1); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/DutyRunReportVO.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/DutyRunReportVO.java index 1ebac32..e55e0e1 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/DutyRunReportVO.java +++ b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/vo/DutyRunReportVO.java @@ -12,7 +12,8 @@ public class DutyRunReportVO implements Serializable { private static final long serialVersionUID = 3273581622730234931L; private Integer index; - + @ApiModelProperty("班组名称") + private String groupId; @ApiModelProperty("班组名称") private String groupName; @ApiModelProperty("值长") diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java index 645f899..6094606 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/standardTicket/service/impl/StandardTicketInfoServiceImpl.java @@ -697,22 +697,24 @@ public class StandardTicketInfoServiceImpl extends BaseServiceImpl> typeOperateTicket : operateTicket.entrySet()) { String type = TicketConstants.TicketTypeNameEnum.getTicketNameByType(typeOperateTicket.getKey()); - //已完成数量 - int ticketInfoCompleteNum = operateTicketReportStatistic.stream().filter(item -> "结束".equals(item.getFlowTaskName())).collect(Collectors.toList()).size(); - //合格数量 - int ticketInfoQualifiedNum = operateTicketReportStatistic.stream().filter(ticket -> Func.isNotEmpty(ticket.getEvaluation()) && 1 == ticket.getEvaluation().intValue()).collect(Collectors.toList()).size(); - //废票数量 - int ticketInfoInvalidatedNum = operateTicketReportStatistic.stream().filter(item -> "作废".equals(item.getFlowTaskName())).collect(Collectors.toList()).size(); - //计算合格率 - double ticketInfoProportion = new BigDecimal(ticketInfoQualifiedNum / (double) operateTicketReportStatistic.size() * 100).setScale(2, RoundingMode.HALF_DOWN).doubleValue(); + if (CollectionUtils.isNotEmpty(typeOperateTicket.getValue())) { + //已完成数量 + int ticketInfoCompleteNum = typeOperateTicket.getValue().stream().filter(item -> "结束".equals(item.getFlowTaskName())).collect(Collectors.toList()).size(); + //合格数量 + int ticketInfoQualifiedNum = typeOperateTicket.getValue().stream().filter(ticket -> Func.isNotEmpty(ticket.getEvaluation()) && 1 == ticket.getEvaluation().intValue()).collect(Collectors.toList()).size(); + //废票数量 + int ticketInfoInvalidatedNum = typeOperateTicket.getValue().stream().filter(item -> "作废".equals(item.getFlowTaskName())).collect(Collectors.toList()).size(); + //计算合格率 + double ticketInfoProportion = new BigDecimal(ticketInfoQualifiedNum / (double) operateTicketReportStatistic.size() * 100).setScale(2, RoundingMode.HALF_DOWN).doubleValue(); TicketInfoStatisticVO ticketInfoStatisticVO = TicketInfoStatisticVO.builder().ticketInfoType(type) - .ticketInfoNumber(operateTicketReportStatistic.size()) + .ticketInfoNumber(typeOperateTicket.getValue().size()) .ticketInfoCompleteNum(ticketInfoCompleteNum) .ticketInfoQualifiedNum(ticketInfoQualifiedNum) .ticketInfoInvalidatedNum(ticketInfoInvalidatedNum) - .ticketInfoStartNum(operateTicketReportStatistic.size() - ticketInfoCompleteNum) + .ticketInfoStartNum(typeOperateTicket.getValue().size() - ticketInfoCompleteNum) .ticketInfoProportion(ticketInfoProportion).build(); res.add(ticketInfoStatisticVO); + } } } return res; diff --git a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java index 4ff1b08..c5ac658 100644 --- a/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java +++ b/hzims-service/ticket/src/main/java/com/hnac/hzims/ticket/twoTicket/service/impl/FirstWorkTicketServiceImpl.java @@ -1153,7 +1153,7 @@ public class FirstWorkTicketServiceImpl extends BaseServiceImpl