Browse Source

养/维护计划 批量新增过滤标准库为空的子表数据

huangpeng 1 year ago
parent
commit
60e211a91f

+ 6 - 3
cx-equipment/cx-equipment-common/src/main/java/com/rongwei/bscommon/sys/service/impl/MaintenanceServiceImpl.java

@@ -164,7 +164,9 @@ public class MaintenanceServiceImpl implements MaintenanceService {
         List<EquMaintenanceScheduleDo> maintenanceScheduleList = aspCheckItems.stream().map(info -> {
             // 数据转换(设备——计划)
             EquMaintenanceScheduleDo maintenanceScheduleDo = dataShiftFacilityToPlan(info, batchCreate.getYear());
-            equMaintenancePartList.addAll(dataShiftSpareStandToPlan(standradMap.get(maintenanceScheduleDo.getEquipmentid()), maintenanceScheduleDo.getId()));
+            if(standradMap.containsKey(maintenanceScheduleDo.getEquipmentid())){
+                equMaintenancePartList.addAll(dataShiftSpareStandToPlan(standradMap.get(maintenanceScheduleDo.getEquipmentid()), maintenanceScheduleDo.getId()));
+            }
             return maintenanceScheduleDo;
         }).collect(Collectors.toList());
         maintenanceScheduleService.saveBatchList(maintenanceScheduleList);
@@ -404,8 +406,8 @@ public class MaintenanceServiceImpl implements MaintenanceService {
         Date newDate = new Date();
         final EquMaintenancePartDo[] maintenancePart = {null};
         // SysUserVo currentUser = CommonUtils.getCurrentUser();
-        return partsSetoutStandardList.stream().map(info -> {
-             maintenancePart[0] = new EquMaintenancePartDo();
+        List<EquMaintenancePartDo> collect = partsSetoutStandardList.stream().map(info -> {
+            maintenancePart[0] = new EquMaintenancePartDo();
             BeanUtils.copyProperties(info, maintenancePart[0]);
             maintenancePart[0].setId(SecurityUtil.getUUID())
                     .setCreatedate(newDate)
@@ -421,6 +423,7 @@ public class MaintenanceServiceImpl implements MaintenanceService {
                     .setMasterid(id);
             return maintenancePart[0];
         }).collect(Collectors.toList());
+        return collect;
     }