|
|
@@ -17,6 +17,7 @@ import cn.iocoder.yudao.module.pms.controller.admin.depttype.vo.IotDeptTypePageR
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotprojectinfo.vo.IotProjectInfoPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotprojecttask.vo.IotProjectTaskPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotrydailyreport.vo.*;
|
|
|
+import cn.iocoder.yudao.module.pms.controller.admin.iotrydailyreportdetail.vo.IotRyDailyReportDetailComboRespVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotrydailyreportdetail.vo.IotRyDailyReportDetailPageReqVO;
|
|
|
import cn.iocoder.yudao.module.pms.controller.admin.iotrydailyreportdetail.vo.IotRyDailyReportDetailRespVO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.depttype.IotDeptTypeDO;
|
|
|
@@ -658,6 +659,298 @@ public class IotRyDailyReportController {
|
|
|
});
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 瑞恒日报分页 设置关联查询信息
|
|
|
+ * @param reports
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private List<IotRyDailyReportDetailComboRespVO> buildRyDailyReportDetails(List<IotRyDailyReportDO> reports, IotRyDailyReportPageReqVO pageReqVO, String type) {
|
|
|
+ if (CollUtil.isEmpty(reports)) {
|
|
|
+ return Collections.emptyList();
|
|
|
+ }
|
|
|
+ // 设备部门信息
|
|
|
+ Map<Long, DeptDO> deptMap = deptService.getDeptMap(convertList(reports, IotRyDailyReportDO::getDeptId));
|
|
|
+ // key项目id value项目合同号
|
|
|
+ Map<Long, String> projectPair = new HashMap<>();
|
|
|
+ // key任务id value任务井号
|
|
|
+ Map<Long, String> taskPair = new HashMap<>();
|
|
|
+ // key任务id value任务施工区域
|
|
|
+ Map<Long, String> taskLocationPair = new HashMap<>();
|
|
|
+ // key任务id value设计井深
|
|
|
+ Map<Long, BigDecimal> taskExtPropertyPair = new HashMap<>();
|
|
|
+ // key任务id value额定生产时间
|
|
|
+ Map<Long, BigDecimal> taskRatedProductionTimePair = new HashMap<>();
|
|
|
+ // key任务id value套生段产管尺寸
|
|
|
+ Map<Long, String> taskCasingPipeSizePair = new HashMap<>();
|
|
|
+ // key任务id value井控级别
|
|
|
+ Map<Long, String> taskWellControlLevelPair = new HashMap<>();
|
|
|
+ // key任务id value施工工艺
|
|
|
+ Map<Long, String> taskTechniquePair = new HashMap<>();
|
|
|
+ // key任务id value井别
|
|
|
+ Map<Long, String> taskWellCategoryPair = new HashMap<>();
|
|
|
+ // key任务id value设计井身结构
|
|
|
+ Map<Long, String> taskWellStructPair = new HashMap<>();
|
|
|
+ // key部门id value设备型号编号
|
|
|
+ AtomicReference<Map<Long, String>> equipmentTypePair = new AtomicReference<>(new HashMap<>());
|
|
|
+ // key施工队伍id value最近完工日期
|
|
|
+ Map<Long, LocalDateTime> latestWellDoneTimePair = new HashMap<>();
|
|
|
+ // key施工队伍id value施工井数量
|
|
|
+ Map<Long, Integer> totalTasksPair = new HashMap<>();
|
|
|
+ // key施工队伍id value完工井数量
|
|
|
+ Map<Long, Integer> completedTasksPair = new HashMap<>();
|
|
|
+ // key非生产时间原因数据字典value value非生产时间原因数据字典label
|
|
|
+ Map<String, String> nptReasonPair = new HashMap<>();
|
|
|
+ // key施工状态数据字典value value施工状态数据字典label
|
|
|
+ Map<String, String> constructStatusPair = new HashMap<>();
|
|
|
+ // key日报id value生产动态明细
|
|
|
+ Map<Long, List<IotRyDailyReportDetailRespVO>> reportDetailsPair = new HashMap<>();
|
|
|
+
|
|
|
+ // 钻井 施工状态 字典数据
|
|
|
+ List<DictDataDO> rigStatusDictData = dictDataService.getDictDataListByDictType("rigStatus");
|
|
|
+ // 修井 施工状态 字典数据
|
|
|
+ List<DictDataDO> repairStatusDictData = dictDataService.getDictDataListByDictType("repairStatus");
|
|
|
+ // 非生产时间原因 字典数据
|
|
|
+ List<DictDataDO> nptReasonDictData = dictDataService.getDictDataListByDictType("ryNptReason");
|
|
|
+
|
|
|
+ if (CollUtil.isNotEmpty(nptReasonDictData)) {
|
|
|
+ nptReasonDictData.forEach(data -> {
|
|
|
+ nptReasonPair.put(data.getValue(), data.getLabel());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 钻井施工状态
|
|
|
+ if ("1".equals(pageReqVO.getProjectClassification()) && CollUtil.isNotEmpty(rigStatusDictData)) {
|
|
|
+ rigStatusDictData.forEach(data -> {
|
|
|
+ constructStatusPair.put(data.getValue(), data.getLabel());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 修井施工状态
|
|
|
+ if ("2".equals(pageReqVO.getProjectClassification()) && CollUtil.isNotEmpty(repairStatusDictData)) {
|
|
|
+ repairStatusDictData.forEach(data -> {
|
|
|
+ constructStatusPair.put(data.getValue(), data.getLabel());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 查询每个日报的生产动态明细
|
|
|
+ IotRyDailyReportDetailPageReqVO detailReqVO = new IotRyDailyReportDetailPageReqVO();
|
|
|
+ detailReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
+ detailReqVO.setReportIds(convertList(reports, IotRyDailyReportDO::getId));
|
|
|
+ PageResult<IotRyDailyReportDetailDO> reportDetailsPage = iotRyDailyReportDetailMapper.selectPage(detailReqVO);
|
|
|
+ List<IotRyDailyReportDetailDO> reportDetails = reportDetailsPage.getList();
|
|
|
+ if (CollUtil.isNotEmpty(reportDetails)) {
|
|
|
+ // 设置每个日报的生产动态明细
|
|
|
+ reportDetails.forEach(detail -> {
|
|
|
+ if (reportDetailsPair.containsKey(detail.getReportId())) {
|
|
|
+ List<IotRyDailyReportDetailRespVO> tempDetails = reportDetailsPair.get(detail.getReportId());
|
|
|
+ tempDetails.add(BeanUtils.toBean(detail, IotRyDailyReportDetailRespVO.class));
|
|
|
+ reportDetailsPair.put(detail.getReportId(), tempDetails);
|
|
|
+ } else {
|
|
|
+ List<IotRyDailyReportDetailRespVO> tempDetails = new ArrayList<>();
|
|
|
+ tempDetails.add(BeanUtils.toBean(detail, IotRyDailyReportDetailRespVO.class));
|
|
|
+ reportDetailsPair.put(detail.getReportId(), tempDetails);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ DataPermissionUtils.executeIgnore(() -> {
|
|
|
+ // 查询日报关联的项目信息
|
|
|
+ IotProjectInfoPageReqVO reqVO = new IotProjectInfoPageReqVO();
|
|
|
+ reqVO.setProjectIds(convertList(reports, IotRyDailyReportDO::getProjectId));
|
|
|
+ List<IotProjectInfoDO> projects = iotProjectInfoService.getIotProjectInfos(reqVO);
|
|
|
+ if (CollUtil.isNotEmpty(projects)) {
|
|
|
+ projects.forEach(project -> {
|
|
|
+ projectPair.put(project.getId(), project.getContractName());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 查询日报关联的任务信息
|
|
|
+ IotProjectTaskPageReqVO taskReqVO = new IotProjectTaskPageReqVO();
|
|
|
+ taskReqVO.setTaskIds(convertList(reports, IotRyDailyReportDO::getTaskId));
|
|
|
+ List<IotProjectTaskDO> tasks = iotProjectTaskService.projectTasks(taskReqVO);
|
|
|
+ if (CollUtil.isNotEmpty(tasks)) {
|
|
|
+ tasks.forEach(task -> {
|
|
|
+ taskPair.put(task.getId(), task.getWellName());
|
|
|
+ taskLocationPair.put(task.getId(), task.getLocation());
|
|
|
+ taskTechniquePair.put(task.getId(), task.getTechnique());
|
|
|
+ if (CollUtil.isNotEmpty(task.getExtProperty())) {
|
|
|
+ List<IotTaskAttrModelProperty> taskAttrs = task.getExtProperty();
|
|
|
+ if (CollUtil.isNotEmpty(taskAttrs)) {
|
|
|
+ // 找到 设计注气量 属性 对应的值
|
|
|
+ taskAttrs.forEach(attr -> {
|
|
|
+ if ("设计井深".equals(attr.getName()) && StrUtil.isNotBlank(attr.getActualValue())) {
|
|
|
+ taskExtPropertyPair.put(task.getId(), new BigDecimal(attr.getActualValue()));
|
|
|
+ }
|
|
|
+ if ("设计井身结构".equals(attr.getName()) && StrUtil.isNotBlank(attr.getActualValue())) {
|
|
|
+ taskWellStructPair.put(task.getId(), attr.getActualValue());
|
|
|
+ }
|
|
|
+ if ("额定生产时间".equals(attr.getName()) && StrUtil.isNotBlank(attr.getActualValue())) {
|
|
|
+ taskRatedProductionTimePair.put(task.getId(), new BigDecimal(attr.getActualValue()));
|
|
|
+ }
|
|
|
+ if ("套生段产管尺寸".equals(attr.getName()) && StrUtil.isNotBlank(attr.getActualValue())) {
|
|
|
+ taskCasingPipeSizePair.put(task.getId(), attr.getActualValue());
|
|
|
+ }
|
|
|
+ if ("井控级别".equals(attr.getName()) && StrUtil.isNotBlank(attr.getActualValue())) {
|
|
|
+ taskWellControlLevelPair.put(task.getId(), attr.getActualValue());
|
|
|
+ }
|
|
|
+ if ("井别".equals(attr.getName()) && StrUtil.isNotBlank(attr.getActualValue())) {
|
|
|
+ taskWellCategoryPair.put(task.getId(), attr.getActualValue());
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 查询当前日报所属施工队伍中包含 井架 的型号
|
|
|
+ equipmentTypePair.set(iotRyDailyReportService.queryEquipmentType(convertList(reports, IotRyDailyReportDO::getDeptId)));
|
|
|
+ // 查询当前日报所属部门的 上井次完井时间 已经绑定任务的情况下
|
|
|
+ List<IotRyDailyReportDO> latestWellDoneTimes = iotRyDailyReportService.latestWellDoneTimes(null);
|
|
|
+ if (CollUtil.isNotEmpty(latestWellDoneTimes)) {
|
|
|
+ latestWellDoneTimes.forEach(time -> {
|
|
|
+ latestWellDoneTimePair.put(time.getDeptId(), time.getConstructionStartDate());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ // 按施工队伍统计 钻井日报 施工井数 完工井数
|
|
|
+ List<IotRyDailyReportTaskCountVO> deptTasks = iotRyDailyReportService.countTasksByDept();
|
|
|
+ // 修井日报 不存在既填写钻井日报 又填写修井日报的队伍
|
|
|
+ if (ObjUtil.isNotEmpty(pageReqVO.getCreateTime())) {
|
|
|
+ List<IotRyDailyReportTaskCountVO> repairDeptTasks = iotRyDailyReportService.countRepairTasksByDept(pageReqVO);
|
|
|
+ if (CollUtil.isNotEmpty(repairDeptTasks)) {
|
|
|
+ repairDeptTasks.forEach(task -> {
|
|
|
+ totalTasksPair.put(task.getDeptId(), task.getTotalTaskCount());
|
|
|
+ completedTasksPair.put(task.getDeptId(), task.getCompletedTaskCount());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (CollUtil.isNotEmpty(deptTasks)) {
|
|
|
+ deptTasks.forEach(task -> {
|
|
|
+ totalTasksPair.put(task.getDeptId(), task.getTotalTaskCount());
|
|
|
+ completedTasksPair.put(task.getDeptId(), task.getCompletedTaskCount());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ // 以生产动态明细数据为维度 追加主表数据
|
|
|
+ List<IotRyDailyReportDetailComboRespVO> reportDetailCombos = new ArrayList<>();
|
|
|
+ if (CollUtil.isNotEmpty(reports)) {
|
|
|
+ reports.forEach(report -> {
|
|
|
+ // 查询每个日报对应的明细数据,按照时间段正序排列
|
|
|
+ if (reportDetailsPair.containsKey(report.getId())) {
|
|
|
+ // 日报存在明细记录
|
|
|
+ List<IotRyDailyReportDetailRespVO> tempReportDetails = reportDetailsPair.get(report.getId());
|
|
|
+ // 将日报生产动态明细 按照 日期-时间段 正序排列
|
|
|
+ tempReportDetails.sort(Comparator.comparing(
|
|
|
+ // 处理 reportDate 为空的情况
|
|
|
+ (IotRyDailyReportDetailRespVO detail) -> {
|
|
|
+ if (detail.getReportDate() == null) {
|
|
|
+ return null; // null 值会排在前面
|
|
|
+ }
|
|
|
+ return detail.getReportDate().toLocalDate();
|
|
|
+ },
|
|
|
+ // 自定义 null 值比较器:null 排在非 null 前面
|
|
|
+ Comparator.nullsFirst(Comparator.naturalOrder())
|
|
|
+ )
|
|
|
+ .thenComparing(
|
|
|
+ // 处理 startTime 为空的情况
|
|
|
+ IotRyDailyReportDetailRespVO::getStartTime,
|
|
|
+ // 自定义 null 值比较器:null 排在非 null 前面
|
|
|
+ Comparator.nullsFirst(Comparator.naturalOrder())
|
|
|
+ ));
|
|
|
+ // 遍历明细 追加主表数据
|
|
|
+ tempReportDetails.forEach(detail -> {
|
|
|
+ IotRyDailyReportDetailComboRespVO tempDetailCombo = new IotRyDailyReportDetailComboRespVO();
|
|
|
+ BeanUtils.copyProperties(detail, tempDetailCombo);
|
|
|
+ BeanUtils.copyProperties(report, tempDetailCombo);
|
|
|
+ // 转换生产动态明细中的 开始时间 结束时间
|
|
|
+ tempDetailCombo.setReportDateStr(LocalDateTimeUtil.format(detail.getReportDate(), DatePattern.NORM_DATE_PATTERN));
|
|
|
+ tempDetailCombo.setStartTimeStr(detail.getStartTime().toString());
|
|
|
+ tempDetailCombo.setEndTimeStr(detail.getEndTime().toString());
|
|
|
+ reportDetailCombos.add(tempDetailCombo);
|
|
|
+ });
|
|
|
+ } else {
|
|
|
+ // 日报不存在明细记录 历史数据
|
|
|
+ IotRyDailyReportDetailComboRespVO tempDetailCombo = new IotRyDailyReportDetailComboRespVO();
|
|
|
+ BeanUtils.copyProperties(report, tempDetailCombo);
|
|
|
+ reportDetailCombos.add(tempDetailCombo);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ // 2. 拼接数据
|
|
|
+ return BeanUtils.toBean(reportDetailCombos, IotRyDailyReportDetailComboRespVO.class, (reportVO) -> {
|
|
|
+ // 油耗 精确到 2位小数
|
|
|
+ if (reportVO.getDailyFuel().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ BigDecimal fuel = reportVO.getDailyFuel()
|
|
|
+ .divide(BigDecimal.valueOf(1), 2, RoundingMode.HALF_UP);
|
|
|
+ reportVO.setDailyFuel(fuel);
|
|
|
+ }
|
|
|
+ // 将 ‘生产配合’ 的值赋值给 ‘其他非生产时间’
|
|
|
+ if (reportVO.getRelocationTime().compareTo(BigDecimal.ZERO) > 0) {
|
|
|
+ reportVO.setOtherProductionTime(reportVO.getRelocationTime());
|
|
|
+ }
|
|
|
+ // 计算非生产时效
|
|
|
+ BigDecimal sumNpt = calDetailNonProductTime(reportVO);
|
|
|
+ reportVO.setNonProductionRate(sumNpt.divide(BigDecimal.valueOf(24), 4, RoundingMode.HALF_UP ));
|
|
|
+
|
|
|
+ // 非生产时效 百分比格式 导出使用
|
|
|
+ if (ObjUtil.isNotEmpty(reportVO.getNonProductionRate())) {
|
|
|
+ // 获取原始小数
|
|
|
+ BigDecimal nptRate = reportVO.getNonProductionRate();
|
|
|
+ // 乘以100转换为百分比数值
|
|
|
+ BigDecimal percentage = nptRate.multiply(BigDecimal.valueOf(100));
|
|
|
+ // 格式化保留2位小数
|
|
|
+ DecimalFormat df = new DecimalFormat("0.00");
|
|
|
+ String nonProductionRate = df.format(percentage) + "%";
|
|
|
+ // 赋值
|
|
|
+ reportVO.setNonProductionRateFormat(nonProductionRate);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 日报生成日期 格式化时间为 yyyy-MM-dd
|
|
|
+ if (ObjUtil.isNotEmpty(reportVO.getCreateTime())) {
|
|
|
+ reportVO.setCreateTimeStr(LocalDateTimeUtil.format(reportVO.getCreateTime(), DatePattern.NORM_DATE_PATTERN));
|
|
|
+ }
|
|
|
+ // 上井次完井时间 格式化时间为 yyyy-MM-dd
|
|
|
+ if (ObjUtil.isNotEmpty(reportVO.getLatestWellDoneTime())) {
|
|
|
+ reportVO.setLatestWellDoneTimeStr(LocalDateTimeUtil.format(reportVO.getLatestWellDoneTime(), DatePattern.NORM_DATE_PATTERN));
|
|
|
+ }
|
|
|
+ // 2.1 拼接部门信息
|
|
|
+ findAndThen(deptMap, reportVO.getDeptId(), dept -> reportVO.setDeptName(dept.getName()));
|
|
|
+ // 2.2 日报关联的项目信息
|
|
|
+ findAndThen(projectPair, reportVO.getProjectId(), contractName -> reportVO.setContractName(contractName));
|
|
|
+ // 2.3 日报关联的任务信息
|
|
|
+ findAndThen(taskPair, reportVO.getTaskId(), taskName -> reportVO.setTaskName(taskName));
|
|
|
+ // 日报关联的任务施工地点
|
|
|
+ findAndThen(taskLocationPair, reportVO.getTaskId(), location -> reportVO.setLocation(location));
|
|
|
+ // 2.4 设计井深
|
|
|
+ findAndThen(taskExtPropertyPair, reportVO.getTaskId(), wellDepth -> reportVO.setDesignWellDepth(wellDepth));
|
|
|
+
|
|
|
+ // 额定生产时间
|
|
|
+ findAndThen(taskRatedProductionTimePair, reportVO.getTaskId(), ratedProductionTime -> reportVO.setRatedProductionTime(ratedProductionTime));
|
|
|
+ // 套生段产管尺寸
|
|
|
+ findAndThen(taskCasingPipeSizePair, reportVO.getTaskId(), casingPipeSize -> reportVO.setCasingPipeSize(casingPipeSize));
|
|
|
+ // 井控级别
|
|
|
+ findAndThen(taskWellControlLevelPair, reportVO.getTaskId(), wellControlLevel -> reportVO.setWellControlLevel(wellControlLevel));
|
|
|
+ // 2.5 设计井身结构
|
|
|
+ findAndThen(taskWellStructPair, reportVO.getTaskId(), wellStruct -> reportVO.setDesignWellStruct(wellStruct));
|
|
|
+ // 2.6 设备型号
|
|
|
+ findAndThen(equipmentTypePair.get(), reportVO.getDeptId(), equipmentType -> reportVO.setEquipmentType(equipmentType));
|
|
|
+ // 2.7 上井次完井时间
|
|
|
+ findAndThen(latestWellDoneTimePair, reportVO.getDeptId(), latestWellDoneTime -> reportVO.setLatestWellDoneTime(latestWellDoneTime));
|
|
|
+ // 2.8 总施工井数 完工井数
|
|
|
+ findAndThen(totalTasksPair, reportVO.getDeptId(), totalTaskCount -> reportVO.setTotalConstructionWells(totalTaskCount));
|
|
|
+ findAndThen(completedTasksPair, reportVO.getDeptId(), completedTaskCount -> reportVO.setCompletedWells(completedTaskCount));
|
|
|
+ // 钻井 施工状态 数据字典
|
|
|
+ findAndThen(constructStatusPair, reportVO.getRigStatus(), statusLabel -> {
|
|
|
+ if ("1".equals(pageReqVO.getProjectClassification())) {
|
|
|
+ reportVO.setConstructionStatusName(statusLabel);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 修井 施工状态 数据字典
|
|
|
+ findAndThen(constructStatusPair, reportVO.getRepairStatus(), statusLabel -> {
|
|
|
+ if ("2".equals(pageReqVO.getProjectClassification())) {
|
|
|
+ reportVO.setConstructionStatusName(statusLabel);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ // 非生产时间原因 数据字典
|
|
|
+ findAndThen(nptReasonPair, reportVO.getRyNptReason(), statusLabel -> reportVO.setRyNptReason(statusLabel));
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 计算非生产时间累加值 计算非生产时效
|
|
|
* NPT 归类 设备故障repair_time 工程质量accident_time 技术受限complexity_time 生产组织rectification_time 不可抗力waiting_stop_time
|
|
|
@@ -683,6 +976,31 @@ public class IotRyDailyReportController {
|
|
|
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 计算非生产时间累加值 计算非生产时效
|
|
|
+ * NPT 归类 设备故障repair_time 工程质量accident_time 技术受限complexity_time 生产组织rectification_time 不可抗力waiting_stop_time
|
|
|
+ * 甲方设计partya_design 甲方准备partya_prepare 甲方资源partya_resource 其他非生产时间other_npt_time
|
|
|
+ * @param dailyReport
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ private BigDecimal calDetailNonProductTime(IotRyDailyReportDetailComboRespVO dailyReport){
|
|
|
+ return Stream.of(
|
|
|
+ dailyReport.getAccidentTime(),
|
|
|
+ dailyReport.getRepairTime(),
|
|
|
+ dailyReport.getComplexityTime(),
|
|
|
+ dailyReport.getRectificationTime(),
|
|
|
+ dailyReport.getWaitingStopTime(),
|
|
|
+ dailyReport.getPartyaDesign(), // 注:字段名虽无Time但属于非生产时间,保留
|
|
|
+ dailyReport.getPartyaPrepare(),
|
|
|
+ dailyReport.getPartyaResource(),
|
|
|
+ dailyReport.getOtherNptTime()
|
|
|
+ )
|
|
|
+ // 处理null值,避免调用add()时抛出NullPointerException
|
|
|
+ .map(bd -> Objects.isNull(bd) ? BigDecimal.ZERO : bd)
|
|
|
+ // Stream.reduce:从初始值0开始,依次累加所有元素
|
|
|
+ .reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 瑞鹰日报分页 设置关联查询信息
|
|
|
* @param reports
|
|
|
@@ -1774,9 +2092,13 @@ public class IotRyDailyReportController {
|
|
|
}
|
|
|
}
|
|
|
List<IotRyDailyReportDO> list = iotRyDailyReportService.getIotRyDailyReportPage(pageReqVO).getList();
|
|
|
- // 导出 Excel
|
|
|
- ExcelUtils.write(response, "瑞鹰日报.xls", "数据", IotRyDailyReportRespVO.class,
|
|
|
- buildRyDailyReports(list, pageReqVO, "export"));
|
|
|
+ try {
|
|
|
+ // 导出 Excel
|
|
|
+ ExcelUtils.write(response, "瑞鹰日报.xls", "数据", IotRyDailyReportDetailComboRespVO.class,
|
|
|
+ buildRyDailyReportDetails(list, pageReqVO, "export"));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@GetMapping("/exportStatistics")
|