|
|
@ -49,6 +49,9 @@ import java.util.concurrent.atomic.AtomicInteger; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.function.Function; |
|
|
|
import java.util.stream.Collectors; |
|
|
|
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<ImsDutyMainMapper, I |
|
|
|
in(ImsDutyRecEntity::getDutyId, dutyIdList); |
|
|
|
in(ImsDutyRecEntity::getDutyId, dutyIdList); |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
//延迟交接班
|
|
|
|
//延迟交接班
|
|
|
|
List<ImsDutyRecEntity> delayList = imsDutyRecEntityList.stream().filter(rec -> rec.getDelayStatus() == 1).collect(Collectors.toList()); |
|
|
|
List<ImsDutyRecEntity> delayList = imsDutyRecEntityList.stream().filter(rec -> rec.getDelayStatus() != 0).collect(Collectors.toList()); |
|
|
|
//异常交接班
|
|
|
|
//异常交接班
|
|
|
|
List<ImsDutyRecEntity> exceptionList = imsDutyRecEntityList.stream().filter(rec -> DutyRecStatus.ANOMALY.getVal().equals(rec.getStatus())).collect(Collectors.toList()); |
|
|
|
List<ImsDutyRecEntity> exceptionList = imsDutyRecEntityList.stream().filter(rec -> DutyRecStatus.ANOMALY.getVal().equals(rec.getStatus())).collect(Collectors.toList()); |
|
|
|
if (CollectionUtil.isNotEmpty(delayList)) { |
|
|
|
if (CollectionUtil.isNotEmpty(delayList)) { |
|
|
@ -1070,7 +1073,6 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
private void getDutyRunReportByGroup(LocalDate startDate, LocalDate endDate, List<Long> deptIdList, List<ImsDutyMainEntity> imsDutyMainEntityList, List<DutyRunReportVO> dutyReportVOList,AtomicInteger index) { |
|
|
|
private void getDutyRunReportByGroup(LocalDate startDate, LocalDate endDate, List<Long> deptIdList, List<ImsDutyMainEntity> imsDutyMainEntityList, List<DutyRunReportVO> dutyReportVOList,AtomicInteger index) { |
|
|
|
|
|
|
|
|
|
|
|
//按班组组合值班记录
|
|
|
|
//按班组组合值班记录
|
|
|
|
Map<Long, List<ImsDutyMainEntity>> listByGroup = imsDutyMainEntityList.stream().filter(o -> ObjectUtil.isNotEmpty(o.getDutyGroupId())).collect(Collectors.groupingBy(ImsDutyMainEntity::getDutyGroupId)); |
|
|
|
Map<Long, List<ImsDutyMainEntity>> listByGroup = imsDutyMainEntityList.stream().filter(o -> ObjectUtil.isNotEmpty(o.getDutyGroupId())).collect(Collectors.groupingBy(ImsDutyMainEntity::getDutyGroupId)); |
|
|
|
listByGroup.forEach((k, v) -> { |
|
|
|
listByGroup.forEach((k, v) -> { |
|
|
@ -1079,6 +1081,7 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
if (ObjectUtil.isNotEmpty(imsDutyGroupEntity)) { |
|
|
|
if (ObjectUtil.isNotEmpty(imsDutyGroupEntity)) { |
|
|
|
DutyRunReportVO dutyReportVO = new DutyRunReportVO(); |
|
|
|
DutyRunReportVO dutyReportVO = new DutyRunReportVO(); |
|
|
|
dutyReportVO.setIndex(index.get()); |
|
|
|
dutyReportVO.setIndex(index.get()); |
|
|
|
|
|
|
|
dutyReportVO.setGroupId(k.toString()); |
|
|
|
index.getAndIncrement(); |
|
|
|
index.getAndIncrement(); |
|
|
|
dutyReportVO.setGroupName(imsDutyGroupEntity.getGroupName()); |
|
|
|
dutyReportVO.setGroupName(imsDutyGroupEntity.getGroupName()); |
|
|
|
User user = UserCache.getUser(imsDutyGroupEntity.getManagerId()); |
|
|
|
User user = UserCache.getUser(imsDutyGroupEntity.getManagerId()); |
|
|
@ -1101,28 +1104,76 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
eq(OperPhenomenonEntity::getIsDeleted, 0); |
|
|
|
eq(OperPhenomenonEntity::getIsDeleted, 0); |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
dutyReportVO.setFindProblemNum(operPhenomenonEntityList.size()); |
|
|
|
dutyReportVO.setFindProblemNum(operPhenomenonEntityList.size()); |
|
|
|
|
|
|
|
dutyReportVOList.add(dutyReportVO); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
//获取交接班异常记录
|
|
|
|
} |
|
|
|
List<ImsDutyRecEntity> imsDutyRecEntityList = imsDutyRecMapper.selectList(new LambdaQueryWrapper<ImsDutyRecEntity>() {{ |
|
|
|
|
|
|
|
in(ImsDutyRecEntity::getDutyId, dutyIdList); |
|
|
|
private void getDelayAndExceptionList(List<ImsDutyMainEntity> imsDutyMainEntityList, List<DutyRunReportVO> dutyReportVOList) { |
|
|
|
}}); |
|
|
|
List<Long> mainIdList= imsDutyMainEntityList.stream().filter(o -> ObjectUtil.isNotEmpty(o.getDutyGroupId())).map(ImsDutyMainEntity::getId).collect(Collectors.toList()); |
|
|
|
//延迟交接班
|
|
|
|
//获取交接班异常记录
|
|
|
|
List<ImsDutyRecEntity> delayList = imsDutyRecEntityList.stream().filter(rec -> rec.getDelayStatus() == 1).collect(Collectors.toList()); |
|
|
|
List<ImsDutyRecEntity> imsDutyRecEntityList = imsDutyRecMapper.selectList(new LambdaQueryWrapper<ImsDutyRecEntity>() {{ |
|
|
|
//异常交接班
|
|
|
|
in(ImsDutyRecEntity::getDutyId, mainIdList); |
|
|
|
List<ImsDutyRecEntity> exceptionList = imsDutyRecEntityList.stream().filter(rec -> DutyRecStatus.ANOMALY.getVal().equals(rec.getStatus())).collect(Collectors.toList()); |
|
|
|
}}); |
|
|
|
if (CollectionUtil.isNotEmpty(delayList)) { |
|
|
|
//延迟交接班
|
|
|
|
dutyReportVO.setDelayChangeShifts(delayList.size()); |
|
|
|
List<ImsDutyRecEntity> delayList = imsDutyRecEntityList.stream().filter(rec -> rec.getDelayStatus() != 0).collect(Collectors.toList()); |
|
|
|
List<String> delayIdsList = delayList.stream().map(ImsDutyRecEntity::getDutyId).map(s -> String.valueOf(s)).collect(Collectors.toList()); |
|
|
|
//异常交接班
|
|
|
|
dutyReportVO.setDelayChangeList(delayIdsList); |
|
|
|
List<ImsDutyRecEntity> 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<ImsDutyMainEntity> collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<DutyRunReportVO> 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<ImsDutyMainEntity> handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<DutyRunReportVO> 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<ImsDutyMainEntity> collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<DutyRunReportVO> 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<ImsDutyMainEntity> handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<DutyRunReportVO> 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<String> exceptionIdsList = exceptionList.stream().map(ImsDutyRecEntity::getDutyId).map(s -> String.valueOf(s)).collect(Collectors.toList()); |
|
|
|
if (CollectionUtil.isNotEmpty(exceptionList)) { |
|
|
|
dutyReportVO.setExceptionChangeList(exceptionIdsList); |
|
|
|
for (ImsDutyRecEntity rec : exceptionList) { |
|
|
|
|
|
|
|
if (rec.getDelayStatus().equals(CARRY_DELAY_STATUS.getStatus())){ |
|
|
|
|
|
|
|
//如果是接班,算接班的班组+1
|
|
|
|
|
|
|
|
List<ImsDutyMainEntity> collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<DutyRunReportVO> 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<ImsDutyMainEntity> handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<DutyRunReportVO> 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<ImsDutyMainEntity> collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<DutyRunReportVO> 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<ImsDutyMainEntity> handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList()); |
|
|
|
|
|
|
|
List<DutyRunReportVO> 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 |
|
|
|
@Override |
|
|
@ -1143,6 +1194,8 @@ public class ImsDutyMainServiceImpl extends BaseServiceImpl<ImsDutyMainMapper, I |
|
|
|
if(CollectionUtil.isNotEmpty(imsDutyMainEntityList)) { |
|
|
|
if(CollectionUtil.isNotEmpty(imsDutyMainEntityList)) { |
|
|
|
//带班组的值班数据
|
|
|
|
//带班组的值班数据
|
|
|
|
this.getDutyRunReportByGroup(startDate, endDate, deptIdList, imsDutyMainEntityList, dutyReportVOList,index); |
|
|
|
this.getDutyRunReportByGroup(startDate, endDate, deptIdList, imsDutyMainEntityList, dutyReportVOList,index); |
|
|
|
|
|
|
|
//带班组的交接班异常数据处理
|
|
|
|
|
|
|
|
getDelayAndExceptionList(imsDutyMainEntityList, dutyReportVOList); |
|
|
|
//灵活排班的值班数据
|
|
|
|
//灵活排班的值班数据
|
|
|
|
this.getDutyRunReportByPerson(startDate, endDate, deptIdList, imsDutyMainEntityList, dutyReportVOList,index); |
|
|
|
this.getDutyRunReportByPerson(startDate, endDate, deptIdList, imsDutyMainEntityList, dutyReportVOList,index); |
|
|
|
} |
|
|
|
} |
|
|
|