|
|
@@ -32,6 +32,7 @@ import cn.iocoder.yudao.module.pms.dal.dataobject.iotprojectinfo.IotProjectInfoD
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotprojecttask.IotProjectTaskDO;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotprojecttaskattrs.IotTaskAttrModelProperty;
|
|
|
import cn.iocoder.yudao.module.pms.dal.dataobject.iotrddailyreport.IotRdDailyReportDO;
|
|
|
+import cn.iocoder.yudao.module.pms.dal.mysql.iotattachment.IotAttachmentMapper;
|
|
|
import cn.iocoder.yudao.module.pms.dal.mysql.iotcarzhbd.IotCarZhbdMapper;
|
|
|
import cn.iocoder.yudao.module.pms.enums.AttachmentCategoryEnum;
|
|
|
import cn.iocoder.yudao.module.pms.enums.AttachmentTypeEnum;
|
|
|
@@ -69,6 +70,7 @@ import java.time.format.DateTimeFormatter;
|
|
|
import java.time.format.DateTimeParseException;
|
|
|
import java.time.temporal.ChronoUnit;
|
|
|
import java.util.*;
|
|
|
+import java.util.concurrent.atomic.AtomicBoolean;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
|
|
|
@@ -115,6 +117,8 @@ public class IotRdDailyReportController {
|
|
|
private ZHBDUtil zhbdUtil;
|
|
|
@Resource
|
|
|
private IotDailyReportFuelService iotDailyReportFuelService;
|
|
|
+ @Resource
|
|
|
+ private IotAttachmentMapper iotAttachmentMapper;
|
|
|
|
|
|
@PostMapping("/create")
|
|
|
@Operation(summary = "创建瑞都日报")
|
|
|
@@ -195,14 +199,46 @@ public class IotRdDailyReportController {
|
|
|
dailyReportVO.setVirtualProject(project.getContractSubject());
|
|
|
}
|
|
|
// 查询当前日报是否已经绑定了油耗信息
|
|
|
+ // 兼容主井完工 关联井 没有完工的情况 查询关联井的油耗信息
|
|
|
boolean hasFuels = false;
|
|
|
- IotDailyReportFuelPageReqVO fuelPageReqVO = new IotDailyReportFuelPageReqVO();
|
|
|
+ /* IotDailyReportFuelPageReqVO fuelPageReqVO = new IotDailyReportFuelPageReqVO();
|
|
|
fuelPageReqVO.setType("RD");
|
|
|
fuelPageReqVO.setReportId(dailyReport.getId());
|
|
|
- List<IotDailyReportFuelDO> reportFuels = iotDailyReportFuelService.getIotDailyReportFuels(fuelPageReqVO);
|
|
|
- if (CollUtil.isNotEmpty(reportFuels)) {
|
|
|
+ List<IotDailyReportFuelDO> reportFuels = iotDailyReportFuelService.getIotDailyReportFuels(fuelPageReqVO); */
|
|
|
+
|
|
|
+ // 查询所有主井 关联井 油耗
|
|
|
+ Map<Long, List<IotDailyReportFuelDO>> reportedFuelsPair = new HashMap<>();
|
|
|
+ if (1 == dailyReport.getPlatformWell()) {
|
|
|
+ // 查询相同平台井组关联的 日报
|
|
|
+ IotRdDailyReportPageReqVO reportReqVO = new IotRdDailyReportPageReqVO();
|
|
|
+ reportReqVO.setPlatformGroup(dailyReport.getPlatformGroup());
|
|
|
+ List<IotRdDailyReportDO> reports = iotRdDailyReportService.dailyReports(reportReqVO);
|
|
|
+ List<Long> reportIds = convertList(reports, IotRdDailyReportDO::getId);
|
|
|
+ // 兼容主井 完工 关联井未完工 的情况 查询关联井的油耗信息
|
|
|
+ IotDailyReportFuelPageReqVO fuelReqVO = new IotDailyReportFuelPageReqVO();
|
|
|
+ fuelReqVO.setType("RD");
|
|
|
+ fuelReqVO.setReportIds(reportIds);
|
|
|
+ List<IotDailyReportFuelDO> reportedFuels = iotDailyReportFuelService.getIotDailyReportFuels(fuelReqVO);
|
|
|
+ if (CollUtil.isNotEmpty(reportedFuels)) {
|
|
|
+ reportedFuels.forEach(fuel -> {
|
|
|
+ if (reportedFuelsPair.containsKey(fuel.getReportId())) {
|
|
|
+ List<IotDailyReportFuelDO> tempFuels = reportedFuelsPair.get(fuel.getReportId());
|
|
|
+ tempFuels.add(fuel);
|
|
|
+ reportedFuelsPair.put(fuel.getReportId(), tempFuels);
|
|
|
+ } else {
|
|
|
+ List<IotDailyReportFuelDO> tempFuels = new ArrayList<>();
|
|
|
+ tempFuels.add(fuel);
|
|
|
+ reportedFuelsPair.put(fuel.getReportId(), tempFuels);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (CollUtil.isNotEmpty(reportedFuelsPair)) {
|
|
|
hasFuels = true;
|
|
|
- dailyReportVO.setReportedFuels(reportFuels);
|
|
|
+ reportedFuelsPair.forEach((reportId, fuels) -> {
|
|
|
+ dailyReportVO.setReportedFuels(fuels);
|
|
|
+ });
|
|
|
}
|
|
|
// 查询施工工艺字典数据
|
|
|
List<DictDataDO> rdTechniquesDicts = dictDataService.getDictDataListByDictType("rq_iot_project_technology_rd");
|
|
|
@@ -501,6 +537,31 @@ public class IotRdDailyReportController {
|
|
|
IotRdDailyReportPageReqVO reportReqVO = new IotRdDailyReportPageReqVO();
|
|
|
reportReqVO.setPlatformGroup(dailyReport.getPlatformGroup());
|
|
|
List<IotRdDailyReportDO> reports = iotRdDailyReportService.dailyReports(reportReqVO);
|
|
|
+ // 查询所有主井 关联井 附件
|
|
|
+ Map<Long, List<IotAttachmentDO>> reportAttachmentsPair = new HashMap<>();
|
|
|
+
|
|
|
+ if (CollUtil.isNotEmpty(reports)) {
|
|
|
+ List<Long> reportIds = convertList(reports, IotRdDailyReportDO::getId);
|
|
|
+ // 兼容主井 完工 关联井未完工 的情况 查询关联井的附件
|
|
|
+ IotAttachmentPageReqVO attachmentReqVO = new IotAttachmentPageReqVO();
|
|
|
+ attachmentReqVO.setBizIds(reportIds);
|
|
|
+ attachmentReqVO.setCategory(AttachmentCategoryEnum.DAILY_REPORT.getCode());
|
|
|
+ attachmentReqVO.setType(AttachmentTypeEnum.EXTERNAL_RENTAL.getCode());
|
|
|
+ List<IotAttachmentDO> reportsAttachments = iotAttachmentMapper.attachments(attachmentReqVO);
|
|
|
+ if (CollUtil.isNotEmpty(reportsAttachments)) {
|
|
|
+ reportsAttachments.forEach(attachment -> {
|
|
|
+ if (reportAttachmentsPair.containsKey(attachment.getBizId())) {
|
|
|
+ List<IotAttachmentDO> tempAttachments = reportAttachmentsPair.get(attachment.getBizId());
|
|
|
+ tempAttachments.add(attachment);
|
|
|
+ reportAttachmentsPair.put(attachment.getBizId(), tempAttachments);
|
|
|
+ } else {
|
|
|
+ List<IotAttachmentDO> tempAttachments = new ArrayList<>();
|
|
|
+ tempAttachments.add(attachment);
|
|
|
+ reportAttachmentsPair.put(attachment.getBizId(), tempAttachments);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+ }
|
|
|
// key任务id value日报id
|
|
|
Map<Long, Long> reportPair = new HashMap<>();
|
|
|
// key任务id value任务井对应日报当日油耗
|
|
|
@@ -532,6 +593,14 @@ public class IotRdDailyReportController {
|
|
|
}
|
|
|
platformVO.setTechniqueIds(report.getTechniqueIds());
|
|
|
platformVO.setExtProperty(report.getExtProperty());
|
|
|
+ platformVO.setProductionStatus(report.getProductionStatus());
|
|
|
+ platformVO.setNextPlan(report.getNextPlan());
|
|
|
+ platformVO.setExternalRental(report.getExternalRental());
|
|
|
+ platformVO.setMalfunction(report.getMalfunction());
|
|
|
+ platformVO.setFaultDowntime(report.getFaultDowntime());
|
|
|
+ if (reportAttachmentsPair.containsKey(report.getId())) {
|
|
|
+ platformVO.setAttachments(reportAttachmentsPair.get(report.getId()));
|
|
|
+ }
|
|
|
platformPair.put(report.getTaskId(), platformVO);
|
|
|
});
|
|
|
}
|
|
|
@@ -554,7 +623,7 @@ public class IotRdDailyReportController {
|
|
|
}
|
|
|
});
|
|
|
}
|
|
|
- // 返回已经填报的油耗记录
|
|
|
+ // 如果主井已经 完工 则显示 首个关联井 的 生产动态 下步计划 ...
|
|
|
|
|
|
List<IotProjectTaskPlatformVO> platforms = new ArrayList<>();
|
|
|
if (CollUtil.isNotEmpty(tasks)) {
|
|
|
@@ -574,12 +643,21 @@ public class IotRdDailyReportController {
|
|
|
platform.setTechniqueIds(tempPlatform.getTechniqueIds());
|
|
|
platform.setTechniqueNames(tempPlatform.getTechniqueNames());
|
|
|
platform.setExtProperty(tempPlatform.getExtProperty());
|
|
|
+ platform.setProductionStatus(tempPlatform.getProductionStatus());
|
|
|
+ platform.setNextPlan(tempPlatform.getNextPlan());
|
|
|
+ platform.setExternalRental(tempPlatform.getExternalRental());
|
|
|
+ platform.setMalfunction(tempPlatform.getMalfunction());
|
|
|
+ platform.setFaultDowntime(tempPlatform.getFaultDowntime());
|
|
|
+ platform.setAttachments(tempPlatform.getAttachments());
|
|
|
}
|
|
|
platforms.add(platform);
|
|
|
}
|
|
|
});
|
|
|
dailyReportVO.setPlatforms(platforms);
|
|
|
}
|
|
|
+
|
|
|
+ // 如果当前井id不存在集合 platforms 中 说明 主井已完工 关联井 未完工
|
|
|
+
|
|
|
if (CollUtil.isEmpty(platforms)) {
|
|
|
List<IotProjectTaskPlatformVO> finishedPlatforms = new ArrayList<>();
|
|
|
// key任务井id value任务井名称
|
|
|
@@ -641,6 +719,25 @@ public class IotRdDailyReportController {
|
|
|
});
|
|
|
}
|
|
|
dailyReportVO.setFinishedPlatforms(finishedPlatforms);
|
|
|
+ } else {
|
|
|
+ AtomicBoolean mainExist = new AtomicBoolean(false);
|
|
|
+ // 如果当前井id不存在集合 platforms 中 说明 主井已完工 关联井 未完工
|
|
|
+ platforms.forEach(platform -> {
|
|
|
+ if (dailyReportVO.getId().equals(platform.getReportId())) {
|
|
|
+ mainExist.set(true);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ if (!mainExist.get()) {
|
|
|
+ // 主井不存在 需要显示 关联井的 主体信息 生产动态 计划 ...
|
|
|
+ platforms.forEach(platform -> {
|
|
|
+ dailyReportVO.setProductionStatus(platform.getProductionStatus());
|
|
|
+ dailyReportVO.setNextPlan(platform.getNextPlan());
|
|
|
+ dailyReportVO.setExternalRental(platform.getExternalRental());
|
|
|
+ dailyReportVO.setMalfunction(platform.getMalfunction());
|
|
|
+ dailyReportVO.setFaultDowntime(platform.getFaultDowntime());
|
|
|
+ dailyReportVO.setAttachments(platform.getAttachments());
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
return dailyReportVO;
|