Browse Source

修改:统计月报生成逻辑

zhongwei
ty 3 months ago
parent
commit
920b6860c4
  1. 40
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/report/service/impl/MonthReportServiceImpl.java

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

@ -88,25 +88,29 @@ public class MonthReportServiceImpl extends ServiceImpl<MonthReportMapper, OperM
eq(OperMonthReportEntity::getIsDeleted, 0); eq(OperMonthReportEntity::getIsDeleted, 0);
last("limit 1;"); last("limit 1;");
}}); }});
if (ObjectUtil.isNotEmpty(operMonthReportEntityByMonth)) { if (ObjectUtil.isEmpty(operMonthReportEntityByMonth) || month.equals(YearMonth.now().toString())) {
this.removeById(operMonthReportEntityByMonth.getId()); if (ObjectUtil.isNotEmpty(operMonthReportEntityByMonth)) {
} this.removeById(operMonthReportEntityByMonth.getId());
//按站点生成各电站运维月报 }
StationRunReportAllVO stationReportAllVO = operStationMonthReportService.getStationMonthReportV2(month, BeanUtil.copy(deptVO, DeptVO.class)); //按站点生成各电站运维月报
if (ObjectUtil.isNotEmpty(stationReportAllVO)) { StationRunReportAllVO stationReportAllVO = operStationMonthReportService.getStationMonthReportV2(month, BeanUtil.copy(deptVO, DeptVO.class));
OperMonthReportEntity operMonthReportEntity = new OperMonthReportEntity(); if (ObjectUtil.isNotEmpty(stationReportAllVO)) {
operMonthReportEntity.setMonth(month); OperMonthReportEntity operMonthReportEntity = new OperMonthReportEntity();
operMonthReportEntity.setType(DictConstant.MONTH_REPORT_STATION); operMonthReportEntity.setMonth(month);
operMonthReportEntity.setCreateDept(deptVO.getId()); operMonthReportEntity.setType(DictConstant.MONTH_REPORT_STATION);
operMonthReportEntity.setStationCode(deptVO.getId().toString()); operMonthReportEntity.setCreateDept(deptVO.getId());
try { operMonthReportEntity.setStationCode(deptVO.getId().toString());
operMonthReportEntity.setObject(ObjectHelper.obj2byte(stationReportAllVO)); try {
} catch (IOException e) { operMonthReportEntity.setObject(ObjectHelper.obj2byte(stationReportAllVO));
log.error("生成统计月报失败{}", e.toString()); } catch (IOException e) {
e.printStackTrace(); log.error("生成统计月报失败{}", e.toString());
e.printStackTrace();
}
//修改为每运行一次,保存一次
this.save(operMonthReportEntity);
} }
//修改为每运行一次,保存一次 } else {
this.save(operMonthReportEntity); log.info("该月{}已生成月报", deptVO.getDeptName());
} }
} }

Loading…
Cancel
Save