Browse Source

修复bug:电梯修改维保负责人问题

别傲 5 years ago
parent
commit
0573abaab8

+ 9 - 6
lift-business-service/src/main/java/cn/com/ty/lift/business/library/service/LiftService.java

@@ -34,6 +34,7 @@ import cn.com.ty.lift.common.utils.SendMessageUtil;
 import cn.com.ty.lift.common.verify.Validate;
 import cn.com.xwy.boot.web.dto.RestResponse;
 import cn.hutool.core.bean.BeanUtil;
+import cn.hutool.core.collection.CollUtil;
 import cn.hutool.core.date.DateUtil;
 import cn.hutool.core.io.FileUtil;
 import cn.hutool.core.util.ObjectUtil;
@@ -459,12 +460,14 @@ public class LiftService extends ServiceImpl<LiftMapper, Lift> {
             List<Long> liftIdList = new ArrayList<>();
             liftIdList.add(entry.getId());
             List<MaintenancePlan> planList = maintenancePlanService.getPlanList(mtCompanyId, liftIdList);
-            //修改未完成的维保计划为新的维保负责人
-            planList.forEach(plan -> plan.setWorkerId(newWorkerId));
-            boolean planResult = maintenancePlanService.updateBatchById(planList);
-            if (!planResult) {
-                TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
-                return RestResponse.fail(MessageUtils.get("msg.modify.fail"));
+            if (CollUtil.isNotEmpty(planList)) {
+                //修改未完成的维保计划为新的维保负责人
+                planList.forEach(plan -> plan.setWorkerId(newWorkerId));
+                boolean planResult = maintenancePlanService.updateBatchById(planList);
+                if (!planResult) {
+                    TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
+                    return RestResponse.fail(MessageUtils.get("msg.modify.fail"));
+                }
             }
         }
         return RestResponse.success(null, MessageUtils.get("msg.modify.success"));