Explorar o código

pms 保养工单 保养时的累计里程/时长

zhangcl hai 2 semanas
pai
achega
880d109504
Modificáronse 17 ficheiros con 181 adicións e 19 borrados
  1. 16 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicerunlog/vo/IotDeviceRunLogPageReqVO.java
  2. 1 1
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmaintenancebom/IotMaintenanceBomController.java
  3. 97 1
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmainworkorderbom/IotMainWorkOrderBomController.java
  4. 2 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmainworkorderbom/vo/IotMainWorkOrderBomPageReqVO.java
  5. 8 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmainworkorderbom/vo/IotMainWorkOrderBomRespVO.java
  6. 6 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmainworkorderbom/vo/IotMainWorkOrderBomSaveReqVO.java
  7. 6 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/iotdevicerunlog/IotDeviceRunLogDO.java
  8. 8 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/iotmainworkorderbom/IotMainWorkOrderBomDO.java
  9. 2 1
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotdevicerunlog/IotDeviceRunLogMapper.java
  10. 1 1
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/job/mainworkorder/CreateMainWorkOrderJob.java
  11. 2 1
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/IotDeviceServiceImpl.java
  12. 5 4
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotdevicerunlog/IotDeviceRunLogService.java
  13. 3 2
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotdevicerunlog/IotDeviceRunLogServiceImpl.java
  14. 6 7
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotmainworkorder/IotMainWorkOrderServiceImpl.java
  15. 8 0
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotmainworkorderbom/IotMainWorkOrderBomService.java
  16. 7 1
      yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotmainworkorderbom/IotMainWorkOrderBomServiceImpl.java
  17. 3 0
      yudao-module-pms/yudao-module-pms-biz/src/main/resources/mapper/static/IotDeviceRunLogMapper.xml

+ 16 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotdevicerunlog/vo/IotDeviceRunLogPageReqVO.java

@@ -69,6 +69,22 @@ public class IotDeviceRunLogPageReqVO extends PageParam {
     @Schema(description = "创建时间")
     @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
     private LocalDateTime[] createTime;
+
+    /**
+     * 扩展字段
+     */
     @Schema(description = "部门ids")
     private List<Long> deptIds;
+
+    @Schema(description = "设备id集合")
+    private List<Long> deviceIds;
+
+    @Schema(description = "设备编码集合")
+    private List<Long> deviceCodes;
+
+    @Schema(description = "累计类型属性集合")
+    private List<String> pointNames;
+
+    @Schema(description = "保养开始时间")
+    private LocalDateTime actualStartTime;
 }

+ 1 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmaintenancebom/IotMaintenanceBomController.java

@@ -269,7 +269,7 @@ public class IotMaintenanceBomController {
         // 查询正常的累计运行时长 公里数 时需要 携带 设备分类id 方便快速定位 累计属性值
 
         Map<Long, IotDeviceRunLogRespVO> deviceRunLogMap = iotDeviceRunLogService.getDeviceRunLogMapAlone(convertListByFlatMap(BOMs,
-                bom -> Stream.of(bom.getDeviceId())), new ArrayList<>(deviceCategoryIds), deviceCategoryPair);
+                bom -> Stream.of(bom.getDeviceId())), new ArrayList<>(deviceCategoryIds), deviceCategoryPair, null);
         // 2. 转换成 VO
         return BeanUtils.toBean(BOMs, IotMaintenanceBomRespVO.class, bomVO -> {
             // 设置设备相关信息

+ 97 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmainworkorderbom/IotMainWorkOrderBomController.java

@@ -110,6 +110,15 @@ public class IotMainWorkOrderBomController {
         return success(buildMainWorkOrderBomList(workOrderBOMs));
     }
 
+    @GetMapping("/maintenanceCumulativeValue")
+    @Operation(summary = "获得PMS 保养工单明细BOM列表 保养时累计公里数 时长")
+    @PreAuthorize("@ss.hasPermission('pms:iot-main-work-order-bom:query')")
+    public CommonResult<List<IotMainWorkOrderBomRespVO>> maintenanceCumulativeValue(@Valid IotMainWorkOrderBomPageReqVO reqVO) {
+        List<IotMainWorkOrderBomDO> workOrderBOMs = iotMainWorkOrderBomService.getIotMainWorkOrderBomList(reqVO);
+        // 组装bom关联的设备 保养时累计公里数 时长
+        return success(buildMaintenanceCumulativeValue(workOrderBOMs, reqVO.getActualStartTime()));
+    }
+
     @GetMapping("/export-excel")
     @Operation(summary = "导出PMS 保养计划明细BOM Excel")
     @PreAuthorize("@ss.hasPermission('pms:iot-main-work-order-bom:export')")
@@ -165,7 +174,7 @@ public class IotMainWorkOrderBomController {
             }
         });
         Map<Long, IotDeviceRunLogRespVO> deviceRunLogMap = iotDeviceRunLogService.getDeviceRunLogMapAlone(convertListByFlatMap(BOMs,
-                bom -> Stream.of(bom.getDeviceId())), new ArrayList<>(deviceCategoryIds), deviceCategoryPair);
+                bom -> Stream.of(bom.getDeviceId())), new ArrayList<>(deviceCategoryIds), deviceCategoryPair, null);
         // 查询 运行记录模板中包含多个累计 时长 公里数 属性的集合
         List<IotDeviceRunLogRespVO> multipleAccumulatedData = new ArrayList<>();
         // key(设备id-累计时长属性名称)    value多累计时长属性运行记录填报数值
@@ -231,4 +240,91 @@ public class IotMainWorkOrderBomController {
             }
         });
     }
+
+    /**
+     * 保养工单填报 查询各保养项指定时间的累计运行里程 时长 前端根据 bomNodeId 匹配
+     * @param BOMs
+     * @return
+     */
+    private List<IotMainWorkOrderBomRespVO> buildMaintenanceCumulativeValue(List<IotMainWorkOrderBomDO> BOMs, String actualStartTime) {
+        if (CollUtil.isEmpty(BOMs) || StrUtil.isBlank(actualStartTime)) {
+            return Collections.emptyList();
+        }
+        // 组装bom关联的设备信息
+        Map<Long, IotDeviceRespVO> deviceMap = iotDeviceService.getDeviceMap(convertListByFlatMap(BOMs,
+                bom -> Stream.of(bom.getDeviceId())));
+
+        // 查询保养工单明细中继承自保养计划明细 的 code累计运行时长属性名称 type累计运行公里数属性名称
+        // 所有保养工单明细 已经 绑定了多个累计属性名称集合
+        Set<String> pointNames = new HashSet<>();
+        // 所有保养工单明细包含的设备id集合
+        Set<Long> deviceIds = new HashSet<>();
+        Set<Long> deviceCategoryIds = new HashSet<>();
+        Map<Long, Long> deviceCategoryPair = new HashMap<>();
+        // 保养j明细 保养项BOM节点id集合
+        Set<Long> bomNodeIds = new HashSet<>();
+        // 设备所属部门id集合
+        Set<Long> deptIds = new HashSet<>();
+        BOMs.forEach(bom -> {
+            if (ObjUtil.isNotEmpty(bom.getDeviceId())) {
+                deviceIds.add(bom.getDeviceId());
+            }
+            // 累计运行时长属性名称
+            if (StrUtil.isNotBlank(bom.getCode())) {
+                pointNames.add(bom.getCode());
+            }
+            // 累计运行公里数属性名称
+            if (StrUtil.isNotBlank(bom.getType())) {
+                pointNames.add(bom.getType());
+            }
+            bomNodeIds.add(bom.getBomNodeId());
+            // 组装bom关联的设备信息
+            if (CollUtil.isNotEmpty(deviceMap)) {
+                deviceMap.forEach((k,v) -> {
+                    deviceCategoryIds.add(v.getAssetClass());
+                    deviceCategoryPair.put(k, v.getAssetClass());
+                    deptIds.add(v.getDeptId());
+                });
+            }
+        });
+        Map<Long, IotDeviceRunLogRespVO> deviceRunLogMap = iotDeviceRunLogService.getDeviceRunLogMapAlone(convertListByFlatMap(BOMs,
+                bom -> Stream.of(bom.getDeviceId())), new ArrayList<>(deviceCategoryIds), deviceCategoryPair, actualStartTime);
+        // 查询 运行记录模板中包含多个累计 时长 公里数 属性的集合
+        List<IotDeviceRunLogRespVO> multipleAccumulatedData = new ArrayList<>();
+        // key(设备id-累计时长属性名称)    value多累计时长属性运行记录填报数值
+        Map<String, BigDecimal> tempTotalRunDataPair = new HashMap<>();
+        // 查询指定设备 指定 多累计属性名称 的设备运行记录数据集合数据
+        if (CollUtil.isNotEmpty(deviceIds) && CollUtil.isNotEmpty(pointNames)) {
+            multipleAccumulatedData = iotDeviceRunLogService.multipleAccumulatedData(deviceIds, pointNames);
+        }
+        if (CollUtil.isNotEmpty(multipleAccumulatedData)) {
+            multipleAccumulatedData.forEach(data -> {
+                String uniqueKey = StrUtil.join("-", data.getDeviceId(), data.getPointName());
+                tempTotalRunDataPair.put(uniqueKey, data.getTotalRunTime());
+            });
+        }
+
+        return BeanUtils.toBean(BOMs, IotMainWorkOrderBomRespVO.class, bomVO -> {
+            MapUtils.findAndThen(deviceRunLogMap, bomVO.getDeviceId(),
+                    device -> bomVO.setMainMileage(device.getTotalMileage()));
+            MapUtils.findAndThen(deviceRunLogMap, bomVO.getDeviceId(),
+                    device -> bomVO.setMainRuntime(device.getTotalRunTime()));
+
+            // 运行记录模板中包含的多个累计类型属性
+            if (StrUtil.isNotBlank(bomVO.getCode())) {
+                // code 累计运行时长属性名称
+                String uniqueKey = StrUtil.join("-", bomVO.getDeviceId(), bomVO.getCode());
+                if (tempTotalRunDataPair.containsKey(uniqueKey)) {
+                    bomVO.setTempTotalRunTime(tempTotalRunDataPair.get(uniqueKey));
+                }
+            }
+            if (StrUtil.isNotBlank(bomVO.getType())) {
+                // type 累计运行公里数属性名称
+                String uniqueKey = StrUtil.join("-", bomVO.getDeviceId(), bomVO.getType());
+                if (tempTotalRunDataPair.containsKey(uniqueKey)) {
+                    bomVO.setTempTotalMileage(tempTotalRunDataPair.get(uniqueKey));
+                }
+            }
+        });
+    }
 }

+ 2 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmainworkorderbom/vo/IotMainWorkOrderBomPageReqVO.java

@@ -155,4 +155,6 @@ public class IotMainWorkOrderBomPageReqVO extends PageParam {
     private List<Long> bomNodeIds;
     @Schema(description = "保养工单id集合")
     private List<Long> workOrderIds;
+    @Schema(description = "保养开始时间")
+    private String actualStartTime;
 }

+ 8 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmainworkorderbom/vo/IotMainWorkOrderBomRespVO.java

@@ -55,6 +55,14 @@ public class IotMainWorkOrderBomRespVO {
     @ExcelProperty("保养规则-运行时间(0启用 1停用)")
     private Integer runningTimeRule;
 
+    @Schema(description = "保养时累计运行里程KM")
+    @ExcelProperty("保养时累计运行里程KM")
+    private BigDecimal mainMileage;
+
+    @Schema(description = "保养时累计运行时长H")
+    @ExcelProperty("保养时累计运行时长H")
+    private BigDecimal mainRuntime;
+
     @Schema(description = "上次保养运行时长(小时)")
     @ExcelProperty("上次保养运行时长(小时)")
     private BigDecimal lastRunningTime;

+ 6 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/controller/admin/iotmainworkorderbom/vo/IotMainWorkOrderBomSaveReqVO.java

@@ -40,6 +40,12 @@ public class IotMainWorkOrderBomSaveReqVO {
     @Schema(description = "保养规则-运行时间(0启用 1停用)")
     private Integer runningTimeRule;
 
+    @Schema(description = "保养时累计运行里程KM")
+    private BigDecimal mainMileage;
+
+    @Schema(description = "保养时累计运行时长H")
+    private BigDecimal mainRuntime;
+
     @Schema(description = "上次保养运行时长(小时)")
     private BigDecimal lastRunningTime;
 

+ 6 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/iotdevicerunlog/IotDeviceRunLogDO.java

@@ -93,8 +93,14 @@ public class IotDeviceRunLogDO extends BaseDO {
      */
     private String remark;
 
+    /**
+     * 运行记录 日报 填写数值
+     */
     private String fillContent;
 
+    /**
+     * 累计类型字段标识 1累积值   0填报值
+     */
     private int isSum;
 
 }

+ 8 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/dataobject/iotmainworkorderbom/IotMainWorkOrderBomDO.java

@@ -65,6 +65,14 @@ public class IotMainWorkOrderBomDO extends BaseDO {
      * 保养规则-运行时间(0启用 1停用)
      */
     private Integer runningTimeRule;
+    /**
+     * 保养时累计运行里程KM
+     */
+    private BigDecimal mainMileage;
+    /**
+     * 保养时累计运行时长H
+     */
+    private BigDecimal mainRuntime;
     /**
      * 上次保养运行时长(小时)
      */

+ 2 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/dal/mysql/iotdevicerunlog/IotDeviceRunLogMapper.java

@@ -54,7 +54,8 @@ public interface IotDeviceRunLogMapper extends BaseMapperX<IotDeviceRunLogDO> {
      * @return
      */
     List<IotDeviceRunLogRespVO> distinctDevices(@Param("deviceIds") Collection<Long> deviceIds,
-                                                @Param("deviceCategoryIds") Collection<Long> deviceCategoryIds);
+                                                @Param("deviceCategoryIds") Collection<Long> deviceCategoryIds,
+                                                @Param("actualStartTime") String actualStartTime);
 
     /**
      * 查询运行记录模板中正常的累积类型属性

+ 1 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/job/mainworkorder/CreateMainWorkOrderJob.java

@@ -185,7 +185,7 @@ public class CreateMainWorkOrderJob implements JobHandler {
 
         // 查询保养计划明细中所有设备的累计运行里程、累计运行时间
         Map<Long, IotDeviceRunLogRespVO> deviceRunLogMap = iotDeviceRunLogService.getDeviceRunLogMapAlone(convertListByFlatMap(mainBomList,
-                bom -> Stream.of(bom.getDeviceId())), new ArrayList<>(deviceCategoryIds), deviceCategoryPair);
+                bom -> Stream.of(bom.getDeviceId())), new ArrayList<>(deviceCategoryIds), deviceCategoryPair, null);
         List<IotMaintenanceBomDO> tobeMaintenanceBomList = new ArrayList<>();
         // 触发保养规则的设备id 集合
         List<Long> tobeMainDeviceIds = new ArrayList<>();

+ 2 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/IotDeviceServiceImpl.java

@@ -689,7 +689,8 @@ public class IotDeviceServiceImpl implements IotDeviceService {
                     });
                 }
                 // 根据设备id集合查询正常的 累计时长 累计公里数
-                deviceRunLogMap = iotDeviceRunLogService.getDeviceRunLogMapAlone(new ArrayList<>(deviceIds), new ArrayList<>(deviceCategoryIds), deviceCategoryPair);
+                deviceRunLogMap = iotDeviceRunLogService.getDeviceRunLogMapAlone(new ArrayList<>(deviceIds),
+                        new ArrayList<>(deviceCategoryIds), deviceCategoryPair, null);
 
                 // 根据设备id 运行记录模板属性名称 查询对应的 累计运行时长 累计运行公里数
                 if (CollUtil.isNotEmpty(multipleAttrDeviceIds) && CollUtil.isNotEmpty(multipleAttrNames)) {

+ 5 - 4
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotdevicerunlog/IotDeviceRunLogService.java

@@ -61,7 +61,7 @@ public interface IotDeviceRunLogService {
      *
      * @return 设备运行数据记录
      */
-    List<IotDeviceRunLogRespVO> distinctDevices(List<Long> ids, List<Long> deviceCategoryIds, Map<Long, Long> deviceCategoryPair);
+    List<IotDeviceRunLogRespVO> distinctDevices(List<Long> ids, List<Long> deviceCategoryIds, Map<Long, Long> deviceCategoryPair, String actualStartTime);
 
     /**
      * 查询指定设备 运行记录模板属性对应的累计时长 累计里程
@@ -77,7 +77,7 @@ public interface IotDeviceRunLogService {
      * @return 设备bom 关联 列表
      */
     default Map<Long, IotDeviceRunLogRespVO> getDeviceRunLogMap(List<Long> ids){
-        List<IotDeviceRunLogRespVO> list = distinctDevices(ids, null, null);
+        List<IotDeviceRunLogRespVO> list = distinctDevices(ids, null, null, null);
         // 删除集合中的NULL元素
         list.removeIf(deviceLog -> isAllFieldsNull(deviceLog));
         // 暂时将查询出的2条记录设置为1条
@@ -110,8 +110,9 @@ public interface IotDeviceRunLogService {
      * @param ids 设备id集合
      * @return 设备bom 关联 列表
      */
-    default Map<Long, IotDeviceRunLogRespVO> getDeviceRunLogMapAlone(List<Long> ids, List<Long> deviceCategoryIds, Map<Long, Long> deviceCategoryPair){
-        List<IotDeviceRunLogRespVO> list = distinctDevices(ids, deviceCategoryIds, deviceCategoryPair);
+    default Map<Long, IotDeviceRunLogRespVO> getDeviceRunLogMapAlone(List<Long> ids, List<Long> deviceCategoryIds,
+                                                                     Map<Long, Long> deviceCategoryPair, String actualStartTime){
+        List<IotDeviceRunLogRespVO> list = distinctDevices(ids, deviceCategoryIds, deviceCategoryPair, actualStartTime);
         // 删除集合中的NULL元素
         list.removeIf(deviceLog -> isAllFieldsNull(deviceLog));
         // 暂时将查询出的2条记录设置为1条

+ 3 - 2
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotdevicerunlog/IotDeviceRunLogServiceImpl.java

@@ -73,10 +73,11 @@ public class IotDeviceRunLogServiceImpl implements IotDeviceRunLogService {
     }
 
     @Override
-    public List<IotDeviceRunLogRespVO> distinctDevices(List<Long> ids, List<Long> deviceCategoryIds, Map<Long, Long> deviceCategoryPair) {
+    public List<IotDeviceRunLogRespVO> distinctDevices(List<Long> ids, List<Long> deviceCategoryIds,
+                                                       Map<Long, Long> deviceCategoryPair, String actualStartTime) {
         // 先根据设备分类集合查询出所有正常累积的 公里数 时长
         List<IotDeviceRunLogRespVO> normalCumulativeAttrs = iotDeviceRunLogMapper.normalCumulativeAttrs(deviceCategoryIds);
-        List<IotDeviceRunLogRespVO> tempDeviceRunLogs = iotDeviceRunLogMapper.distinctDevices(ids, deviceCategoryIds);
+        List<IotDeviceRunLogRespVO> tempDeviceRunLogs = iotDeviceRunLogMapper.distinctDevices(ids, deviceCategoryIds, actualStartTime);
         Set<Long> categoryIds = new HashSet<>();
         if (CollUtil.isNotEmpty(normalCumulativeAttrs)) {
             normalCumulativeAttrs.forEach(attr -> {

+ 6 - 7
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotmainworkorder/IotMainWorkOrderServiceImpl.java

@@ -266,7 +266,7 @@ public class IotMainWorkOrderServiceImpl implements IotMainWorkOrderService {
         }
         // 查询 运行记录模板中 正常的累计时长 公里数集合
         Map<Long, IotDeviceRunLogRespVO> deviceRunLogMap = iotDeviceRunLogService.getDeviceRunLogMapAlone(new ArrayList<>(deviceIds),
-                new ArrayList<>(deviceCategoryIds), deviceCategoryPair);
+                new ArrayList<>(deviceCategoryIds), deviceCategoryPair, null);
         // 以保养工单为维度 统计每个工单相关的保养项的最近保养距离 key保养工单id    value保养工单下每个保养项的的最小保养距离集合
         Map<Long, List<Map<String, Object>>> orderDistancePair = new HashMap<>();
         // key保养工单id  value设备保养工单明细下所有保养规则数据最小值
@@ -468,9 +468,8 @@ public class IotMainWorkOrderServiceImpl implements IotMainWorkOrderService {
         }
 
         // 查询 运行记录模板中 正常的累计时长 公里数集合
-        // Map<Long, IotDeviceRunLogRespVO> deviceRunLogMap = iotDeviceRunLogService.getDeviceRunLogMap(new ArrayList<>(deviceIds));
         Map<Long, IotDeviceRunLogRespVO> deviceRunLogMap =
-                iotDeviceRunLogService.getDeviceRunLogMapAlone(new ArrayList<>(deviceIds), new ArrayList<>(deviceCategoryIds), deviceCategoryPair);
+                iotDeviceRunLogService.getDeviceRunLogMapAlone(new ArrayList<>(deviceIds), new ArrayList<>(deviceCategoryIds), deviceCategoryPair, null);
         // 以设备为维度统计每个设备相关的保养项的最近保养距离 key设备id    value设备下每个保养项的的最小保养距离集合
         Map<Long, List<Map<String, Object>>> orderDistancePair = new HashMap<>();
         // 设备保养明细 key设备id  value设备保养工单明细下所有保养规则数据最小值
@@ -781,7 +780,7 @@ public class IotMainWorkOrderServiceImpl implements IotMainWorkOrderService {
         // 查询 运行记录模板中 正常的累计时长 公里数集合
         // Map<Long, IotDeviceRunLogRespVO> deviceRunLogMap = iotDeviceRunLogService.getDeviceRunLogMap(new ArrayList<>(deviceIds));
         Map<Long, IotDeviceRunLogRespVO> deviceRunLogMap =
-                iotDeviceRunLogService.getDeviceRunLogMapAlone(new ArrayList<>(deviceIds), new ArrayList<>(deviceCategoryIds), deviceCategoryPair);
+                iotDeviceRunLogService.getDeviceRunLogMapAlone(new ArrayList<>(deviceIds), new ArrayList<>(deviceCategoryIds), deviceCategoryPair, null);
         // 以设备为维度统计每个设备相关的保养项的最近保养距离 key设备id    value设备下每个保养项的的最小保养距离集合
         Map<Long, List<Map<String, Object>>> orderDistancePair = new HashMap<>();
         // 设备保养明细 key设备id  value设备保养工单明细下所有保养规则数据最小值
@@ -1029,7 +1028,7 @@ public class IotMainWorkOrderServiceImpl implements IotMainWorkOrderService {
             // 查询 运行记录模板中 正常的累计时长 公里数集合
             // Map<Long, IotDeviceRunLogRespVO> deviceRunLogMap = iotDeviceRunLogService.getDeviceRunLogMap(new ArrayList<>(deviceIds));
             Map<Long, IotDeviceRunLogRespVO> deviceRunLogMap =
-                    iotDeviceRunLogService.getDeviceRunLogMapAlone(new ArrayList<>(deviceIds), new ArrayList<>(deviceCategoryIds), deviceCategoryPair);
+                    iotDeviceRunLogService.getDeviceRunLogMapAlone(new ArrayList<>(deviceIds), new ArrayList<>(deviceCategoryIds), deviceCategoryPair, null);
             // 以设备为维度统计每个设备相关的保养项的最近保养距离 key设备id    value设备下每个保养项的的最小保养距离集合
             Map<Long, List<Map<String, Object>>> orderDistancePair = new HashMap<>();
             // 设备保养明细 key设备id  value设备保养工单明细下所有保养规则数据最小值
@@ -1292,7 +1291,7 @@ public class IotMainWorkOrderServiceImpl implements IotMainWorkOrderService {
 
         // 查询 运行记录模板中 正常的累计时长 公里数集合
         Map<Long, IotDeviceRunLogRespVO> deviceRunLogMap = iotDeviceRunLogService.getDeviceRunLogMapAlone(new ArrayList<>(deviceIds),
-                new ArrayList<>(deviceCategoryIds), deviceCategoryPair);
+                new ArrayList<>(deviceCategoryIds), deviceCategoryPair, null);
         // 以设备为维度统计每个设备相关的保养项的最近保养距离 key设备id    value设备下每个保养项的的最小保养距离集合
         Map<Long, List<Map<String, Object>>> orderDistancePair = new HashMap<>();
         // 设备保养明细 key设备id  value设备保养工单明细下所有保养规则数据最小值
@@ -2067,7 +2066,7 @@ public class IotMainWorkOrderServiceImpl implements IotMainWorkOrderService {
 
             // 单一累计属性集合
             Map<Long, IotDeviceRunLogRespVO> deviceRunLogMap = iotDeviceRunLogService.getDeviceRunLogMapAlone(new ArrayList<>(deviceIds),
-                    new ArrayList<>(deviceCategoryIds), deviceCategoryPair);
+                    new ArrayList<>(deviceCategoryIds), deviceCategoryPair, null);
             // 查询保养工单关联的保养计划 明细
             IotMaintenanceBomPageReqVO reqVO = new IotMaintenanceBomPageReqVO();
             reqVO.setPlanId(updateObj.getPlanId());

+ 8 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotmainworkorderbom/IotMainWorkOrderBomService.java

@@ -62,6 +62,14 @@ public interface IotMainWorkOrderBomService {
      */
     List<IotMainWorkOrderBomDO> getIotMainWorkOrderBomList(IotMainWorkOrderBomPageReqVO pageReqVO);
 
+    /**
+     * 保养计划明细BOM列表
+     *
+     * @param pageReqVO 分页查询
+     * @return PMS 保养计划明细BOM分页
+     */
+    List<IotMainWorkOrderBomDO> maintenanceCumulativeValue(IotMainWorkOrderBomPageReqVO pageReqVO);
+
     /**
      * 根据保养工单id集合查询保养工单明细最近保养时间
      *

+ 7 - 1
yudao-module-pms/yudao-module-pms-biz/src/main/java/cn/iocoder/yudao/module/pms/service/iotmainworkorderbom/IotMainWorkOrderBomServiceImpl.java

@@ -111,6 +111,12 @@ public class IotMainWorkOrderBomServiceImpl implements IotMainWorkOrderBomServic
         return workOrderBomS;
     }
 
+    @Override
+    public List<IotMainWorkOrderBomDO> maintenanceCumulativeValue(IotMainWorkOrderBomPageReqVO pageReqVO) {
+        List<IotMainWorkOrderBomDO> workOrderBomS = iotMainWorkOrderBomMapper.selectList(pageReqVO);
+        return workOrderBomS;
+    }
+
     @Override
     public Map<Long, String> mainWorkOrderNearestDistance(IotMainWorkOrderBomPageReqVO pageReqVO) {
         List<IotMainWorkOrderBomDO> workOrderBomS = getIotMainWorkOrderBomList(pageReqVO);
@@ -157,7 +163,7 @@ public class IotMainWorkOrderBomServiceImpl implements IotMainWorkOrderBomServic
 
             // 查询当前所有设备的 累计运行里程 累计运行时间
             Map<Long, IotDeviceRunLogRespVO> deviceRunLogMap = iotDeviceRunLogService.getDeviceRunLogMapAlone(new ArrayList<>(deviceIds),
-                    new ArrayList<>(deviceIds), deviceCategoryPair);
+                    new ArrayList<>(deviceIds), deviceCategoryPair, null);
             Map<Long, List<Map<String, Object>>> orderDistancePair = new HashMap<>();
             workOrderBomS.forEach(bom -> {
                 BigDecimal runningTimeDistance = null;

+ 3 - 0
yudao-module-pms/yudao-module-pms-biz/src/main/resources/mapper/static/IotDeviceRunLogMapper.xml

@@ -25,6 +25,9 @@
             </foreach>
         </if>
         AND (mta.`code` = 'sc' OR mta.`code` = 'gls')
+        <if test="actualStartTime!=null and actualStartTime!=''">
+            AND DATE(drl.create_time) = #{actualStartTime}
+        </if>
         <if test="deviceCategoryIds != null and deviceCategoryIds.size &gt; 0">
             AND mta.device_category_id IN
             <foreach collection="deviceCategoryIds" index="index" item="key" open="(" separator="," close=")">