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

Loading…
Cancel
Save