Forráskód Böngészése

修改维保计划接口逻辑更正

别傲 5 éve
szülő
commit
8cf34aa2ca

+ 7 - 4
lift-business-service/src/main/java/cn/com/ty/lift/business/maintenance/service/MaintenancePlanService.java

@@ -164,14 +164,20 @@ public class MaintenancePlanService extends ServiceImpl<MaintenancePlanMapper, M
         //返回维保计划列表
         List<MaintenancePlan> planList = new ArrayList<>();
         int times = getTimes(interval, beginTime, endTime);
+        int length = maintenanceType.length;
         for (int i = 0; i <= times; i++) {
             MaintenancePlan entry = new MaintenancePlan();
             entry.setWorkerId(plan.getWorkerId());
             entry.setLiftId(plan.getLiftId());
             entry.setProjectId(plan.getProjectId());
             entry.setMtCompanyId(plan.getMtCompanyId());
+            int mod = periods % length;
             //设置维保类型
-            entry.setType(maintenanceType[periods - 1]);
+            if (mod == 0) {
+                entry.setType(maintenanceType[length - 1]);
+            } else {
+                entry.setType(maintenanceType[mod - 1]);
+            }
             if (i == 0) {
                 entry.setPlanDate(beginTime);
             } else {
@@ -182,9 +188,6 @@ public class MaintenancePlanService extends ServiceImpl<MaintenancePlanMapper, M
             }
             System.out.printf("i:%s,期数:%s,类型:%s,计划时间:%s,%s", (i + 1), periods, entry.getType(), entry.getPlanDate(), "\n");
             periods++;
-            if (periods == 25) {
-                periods = 1;
-            }
             planList.add(entry);
         }
         return planList;