|
|
@@ -40,7 +40,9 @@ import cn.iocoder.yudao.module.pms.service.iotrddailyreport.IotRdDailyReportServ
|
|
|
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
|
|
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
|
|
import cn.iocoder.yudao.module.system.dal.dataobject.dept.DeptDO;
|
|
|
+import cn.iocoder.yudao.module.system.dal.dataobject.dict.DictDataDO;
|
|
|
import cn.iocoder.yudao.module.system.service.dept.DeptService;
|
|
|
+import cn.iocoder.yudao.module.system.service.dict.DictDataService;
|
|
|
import io.swagger.v3.oas.annotations.Operation;
|
|
|
import io.swagger.v3.oas.annotations.Parameter;
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
@@ -91,6 +93,9 @@ public class IotRdDailyReportController {
|
|
|
@Resource
|
|
|
private AdminUserApi adminUserApi;
|
|
|
|
|
|
+ @Resource
|
|
|
+ private DictDataService dictDataService;
|
|
|
+
|
|
|
@PostMapping("/create")
|
|
|
@Operation(summary = "创建瑞都日报")
|
|
|
@PreAuthorize("@ss.hasPermission('pms:iot-rd-daily-report:create')")
|
|
|
@@ -226,14 +231,45 @@ public class IotRdDailyReportController {
|
|
|
Map<Long, Long> reportPair = new HashMap<>();
|
|
|
// key任务id value平台井日报已经设置的多种属性
|
|
|
Map<Long, IotProjectTaskPlatformVO> platformPair = new HashMap<>();
|
|
|
+ // 施工状态 key字典键值 value字典标签
|
|
|
+ Map<String, String> statusDictPair = new HashMap<>();
|
|
|
+ // 施工工艺 key字典键值 value字典标签
|
|
|
+ Map<String, String> techniqueDictPair = new HashMap<>();
|
|
|
if (CollUtil.isNotEmpty(reports)) {
|
|
|
+ // 查询施工工艺字典数据
|
|
|
+ List<DictDataDO> rdStatusDicts = dictDataService.getDictDataListByDictType("rdStatus");
|
|
|
+ // 查询施工工艺字典数据
|
|
|
+ List<DictDataDO> rdTechniquesDicts = dictDataService.getDictDataListByDictType("rq_iot_project_technology_rd");
|
|
|
+ if (CollUtil.isNotEmpty(rdStatusDicts)) {
|
|
|
+ rdStatusDicts.forEach(tech -> {
|
|
|
+ statusDictPair.put(tech.getValue(), tech.getLabel());
|
|
|
+ });
|
|
|
+ }
|
|
|
+ if (CollUtil.isNotEmpty(rdTechniquesDicts)) {
|
|
|
+ rdTechniquesDicts.forEach(tech -> {
|
|
|
+ techniqueDictPair.put(tech.getValue(), tech.getLabel());
|
|
|
+ });
|
|
|
+ }
|
|
|
reports.forEach(report -> {
|
|
|
// 保养平台井关联的多个日报使用
|
|
|
reportPair.put(report.getTaskId(), report.getId());
|
|
|
// 设置 平台关联井 已经设置的 属性 施工状态 施工工艺 工作量属性
|
|
|
// 查询 平台关联井详情使用
|
|
|
+
|
|
|
IotProjectTaskPlatformVO platformVO = new IotProjectTaskPlatformVO();
|
|
|
platformVO.setRdStatus(report.getRdStatus());
|
|
|
+ if (StrUtil.isNotBlank(report.getRdStatus()) && statusDictPair.containsKey(report.getRdStatus())) {
|
|
|
+ platformVO.setRdStatusLabel(statusDictPair.get(report.getRdStatus()));
|
|
|
+ }
|
|
|
+ if (CollUtil.isNotEmpty(report.getTechniqueIds())) {
|
|
|
+ String techniqueNames = report.getTechniqueIds().stream()
|
|
|
+ .map(lg -> ObjUtil.isNotEmpty(lg) ? lg.toString() : StrUtil.EMPTY) // 将Long转为String,匹配techniqueDictPair的key类型
|
|
|
+ .map(key -> techniqueDictPair.getOrDefault(key, key)) // 取label,无则用原key
|
|
|
+ .collect(Collectors.joining(",")); // 逗号拼接
|
|
|
+ platformVO.setTechniqueNames(techniqueNames);
|
|
|
+ } else {
|
|
|
+ platformVO.setTechniqueNames(""); // 空集合时设为空字符串(或null,根据业务需求)
|
|
|
+ }
|
|
|
platformVO.setTechniqueIds(report.getTechniqueIds());
|
|
|
platformVO.setExtProperty(report.getExtProperty());
|
|
|
platformPair.put(report.getTaskId(), platformVO);
|
|
|
@@ -252,7 +288,9 @@ public class IotRdDailyReportController {
|
|
|
if (platformPair.containsKey(task.getId())) {
|
|
|
IotProjectTaskPlatformVO tempPlatform = platformPair.get(task.getId());
|
|
|
platform.setRdStatus(tempPlatform.getRdStatus());
|
|
|
+ platform.setRdStatusLabel(tempPlatform.getRdStatusLabel());
|
|
|
platform.setTechniqueIds(tempPlatform.getTechniqueIds());
|
|
|
+ platform.setTechniqueNames(tempPlatform.getTechniqueNames());
|
|
|
platform.setExtProperty(tempPlatform.getExtProperty());
|
|
|
}
|
|
|
platforms.add(platform);
|
|
|
@@ -435,7 +473,7 @@ public class IotRdDailyReportController {
|
|
|
if ("台次".equals(unit) && "当日泵车台次".equals(attr.getName())) {
|
|
|
tempTotalPumpTrips = tempTotalPumpTrips.add(actualValue);
|
|
|
}
|
|
|
- if ("台次".equals(unit) && ("当日仪表".equals(attr.getName()) || "当日混砂".equals(attr.getName()))) {
|
|
|
+ if ("台次".equals(unit) && ("当日仪表/混砂".equals(attr.getName()))) {
|
|
|
tempTotalMixSand = tempTotalMixSand.add(actualValue);
|
|
|
}
|
|
|
}
|