Browse Source

修复:生产月报增加非空判断

zhongwei
ty 4 months ago
parent
commit
7e5a31c091
  1. 20
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java
  2. 23
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/MonthReportServiceImpl.java

20
hzims-service/operational/src/main/java/com/hnac/hzims/operational/duty/service/impl/ImsDutyMainServiceImpl.java

@ -1125,49 +1125,68 @@ public class ImsDutyMainServiceImpl extends ServiceImpl<ImsDutyMainMapper, ImsDu
if (rec.getDelayStatus().equals(CARRY_DELAY_STATUS.getStatus())){ if (rec.getDelayStatus().equals(CARRY_DELAY_STATUS.getStatus())){
//如果是接班,算接班的班组+1 //如果是接班,算接班的班组+1
List<ImsDutyMainEntity> collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList()); List<ImsDutyMainEntity> collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(collect)){
continue;
}
List<DutyRunReportVO> troubleRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(collect.get(0).getDutyGroupId().toString())).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); DutyRunReportVO troubleRunReport = troubleRunReportList.get(0);
troubleRunReport.setDelayChangeShifts(troubleRunReport.getDelayChangeShifts()+1); troubleRunReport.setDelayChangeShifts(troubleRunReport.getDelayChangeShifts()+1);
}else if (rec.getDelayStatus().equals(HAND_DELAY_STATUS.getStatus())) { }else if (rec.getDelayStatus().equals(HAND_DELAY_STATUS.getStatus())) {
//如果是交班延迟,算当前的班组+1 //如果是交班延迟,算当前的班组+1
List<ImsDutyMainEntity> handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList()); List<ImsDutyMainEntity> handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(handerCollect)){
continue;
}
List<DutyRunReportVO> handerRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(handerCollect.get(0).getDutyGroupId().toString())).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); DutyRunReportVO handerRunRepor = handerRunReportList.get(0);
handerRunRepor.setDelayChangeShifts(handerRunRepor.getDelayChangeShifts()+1); handerRunRepor.setDelayChangeShifts(handerRunRepor.getDelayChangeShifts()+1);
}else { }else {
//交接班延迟,交接班组都+1 //交接班延迟,交接班组都+1
List<ImsDutyMainEntity> collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList()); List<ImsDutyMainEntity> collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(collect)){
List<DutyRunReportVO> troubleRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(collect.get(0).getDutyGroupId().toString())).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); DutyRunReportVO troubleRunReport = troubleRunReportList.get(0);
troubleRunReport.setDelayChangeShifts(troubleRunReport.getDelayChangeShifts()+1); troubleRunReport.setDelayChangeShifts(troubleRunReport.getDelayChangeShifts()+1);
}
List<ImsDutyMainEntity> handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList()); List<ImsDutyMainEntity> handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(handerCollect)){
List<DutyRunReportVO> handerRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(handerCollect.get(0).getDutyGroupId().toString())).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); DutyRunReportVO handerRunRepor = handerRunReportList.get(0);
handerRunRepor.setDelayChangeShifts(handerRunRepor.getDelayChangeShifts()+1); handerRunRepor.setDelayChangeShifts(handerRunRepor.getDelayChangeShifts()+1);
} }
} }
} }
}
if (CollectionUtil.isNotEmpty(exceptionList)) { if (CollectionUtil.isNotEmpty(exceptionList)) {
for (ImsDutyRecEntity rec : exceptionList) { for (ImsDutyRecEntity rec : exceptionList) {
if (rec.getDelayStatus().equals(CARRY_DELAY_STATUS.getStatus())){ if (rec.getDelayStatus().equals(CARRY_DELAY_STATUS.getStatus())){
//如果是接班,算接班的班组+1 //如果是接班,算接班的班组+1
List<ImsDutyMainEntity> collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList()); List<ImsDutyMainEntity> collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(collect)){
continue;
}
List<DutyRunReportVO> troubleRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(collect.get(0).getDutyGroupId().toString())).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); DutyRunReportVO troubleRunReport = troubleRunReportList.get(0);
troubleRunReport.setExceptionChangeShifts(troubleRunReport.getExceptionChangeShifts()+1); troubleRunReport.setExceptionChangeShifts(troubleRunReport.getExceptionChangeShifts()+1);
}else if (rec.getDelayStatus().equals(HAND_DELAY_STATUS.getStatus())) { }else if (rec.getDelayStatus().equals(HAND_DELAY_STATUS.getStatus())) {
//如果是交班延迟,算当前的班组+1 //如果是交班延迟,算当前的班组+1
List<ImsDutyMainEntity> handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList()); List<ImsDutyMainEntity> handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList());
if(CollectionUtil.isEmpty(handerCollect)){
continue;
}
List<DutyRunReportVO> handerRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(handerCollect.get(0).getDutyGroupId().toString())).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); DutyRunReportVO handerRunRepor = handerRunReportList.get(0);
handerRunRepor.setExceptionChangeShifts(handerRunRepor.getExceptionChangeShifts()+1); handerRunRepor.setExceptionChangeShifts(handerRunRepor.getExceptionChangeShifts()+1);
}else { }else {
//交接班延迟,交接班组都+1 //交接班延迟,交接班组都+1
List<ImsDutyMainEntity> collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList()); List<ImsDutyMainEntity> collect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getId())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(collect)) {
List<DutyRunReportVO> troubleRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(collect.get(0).getDutyGroupId().toString())).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); DutyRunReportVO troubleRunReport = troubleRunReportList.get(0);
troubleRunReport.setExceptionChangeShifts(troubleRunReport.getExceptionChangeShifts() + 1); troubleRunReport.setExceptionChangeShifts(troubleRunReport.getExceptionChangeShifts() + 1);
}
List<ImsDutyMainEntity> handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList()); List<ImsDutyMainEntity> handerCollect = imsDutyMainEntityList.stream().filter(s -> rec.getDutyId().equals(s.getPreDutyId())).collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(handerCollect)) {
List<DutyRunReportVO> handerRunReportList = dutyReportVOList.stream().filter(s -> s.getGroupId().equals(handerCollect.get(0).getDutyGroupId().toString())).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); DutyRunReportVO handerRunRepor = handerRunReportList.get(0);
handerRunRepor.setExceptionChangeShifts(handerRunRepor.getExceptionChangeShifts() + 1); handerRunRepor.setExceptionChangeShifts(handerRunRepor.getExceptionChangeShifts() + 1);
@ -1175,6 +1194,7 @@ public class ImsDutyMainServiceImpl extends ServiceImpl<ImsDutyMainMapper, ImsDu
} }
} }
} }
}
@Override @Override
public List<DutyRunReportVO> getDutyMainRunReport(Map<String, Object> params) { public List<DutyRunReportVO> getDutyMainRunReport(Map<String, Object> params) {

23
hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/MonthReportServiceImpl.java

@ -46,12 +46,27 @@ public class MonthReportServiceImpl extends ServiceImpl<MonthReportMapper, OperM
eq(OperMonthReportEntity::getMonth, month); eq(OperMonthReportEntity::getMonth, month);
eq(OperMonthReportEntity::getStationCode, dept.getId()); eq(OperMonthReportEntity::getStationCode, dept.getId());
eq(OperMonthReportEntity::getIsDeleted, 0); eq(OperMonthReportEntity::getIsDeleted, 0);
orderByDesc(OperMonthReportEntity::getObject); orderByDesc(OperMonthReportEntity::getCreateTime);
last("limit 1;"); last("limit 1;");
}}); }});
//查询实时数据 //查询实时数据
if (ObjectUtil.isEmpty(operMonthReportEntity)) { if (ObjectUtil.isEmpty(operMonthReportEntity)) {
stationReportAllVO = operStationMonthReportService.getStationMonthReportV2(month, BeanUtil.copy(dept, DeptVO.class)); stationReportAllVO = operStationMonthReportService.getStationMonthReportV2(month, BeanUtil.copy(dept, DeptVO.class));
if (ObjectUtil.isNotEmpty(stationReportAllVO)) {
OperMonthReportEntity saved = new OperMonthReportEntity();
saved.setMonth(month);
saved.setType(DictConstant.MONTH_REPORT_STATION);
saved.setCreateDept(deptId);
saved.setStationCode(deptId.toString());
try {
saved.setObject(ObjectHelper.obj2byte(stationReportAllVO));
} catch (IOException e) {
log.error("生成统计月报失败{}", e.toString());
e.printStackTrace();
}
//修改为每运行一次,保存一次
this.save(operMonthReportEntity);
}
} }
//历史查询定时任务生成的数据 //历史查询定时任务生成的数据
else { else {
@ -73,8 +88,6 @@ public class MonthReportServiceImpl extends ServiceImpl<MonthReportMapper, OperM
eq(OperMonthReportEntity::getIsDeleted, 0); eq(OperMonthReportEntity::getIsDeleted, 0);
last("limit 1;"); last("limit 1;");
}}); }});
if (ObjectUtil.isEmpty(operMonthReportEntityByMonth)||month.equals(YearMonth.now().toString())) {
if (ObjectUtil.isNotEmpty(operMonthReportEntityByMonth)) { if (ObjectUtil.isNotEmpty(operMonthReportEntityByMonth)) {
this.removeById(operMonthReportEntityByMonth.getId()); this.removeById(operMonthReportEntityByMonth.getId());
} }
@ -89,14 +102,12 @@ public class MonthReportServiceImpl extends ServiceImpl<MonthReportMapper, OperM
try { try {
operMonthReportEntity.setObject(ObjectHelper.obj2byte(stationReportAllVO)); operMonthReportEntity.setObject(ObjectHelper.obj2byte(stationReportAllVO));
} catch (IOException e) { } catch (IOException e) {
log.error("生成统计月报失败{}", e.toString());
e.printStackTrace(); e.printStackTrace();
} }
//修改为每运行一次,保存一次 //修改为每运行一次,保存一次
this.save(operMonthReportEntity); this.save(operMonthReportEntity);
} }
} else {
log.info("该月{}已生成月报", deptVO.getDeptName());
}
} }
} }

Loading…
Cancel
Save