|
@@ -3,6 +3,7 @@ package com.ruoyi.project.training.controller;
|
|
|
import java.time.LocalDate;
|
|
|
import java.util.*;
|
|
|
|
|
|
+import com.ruoyi.framework.interceptor.annotation.RepeatSubmit;
|
|
|
import com.ruoyi.project.plant.domain.TStaffmgr;
|
|
|
import com.ruoyi.project.plant.service.ITStaffmgrService;
|
|
|
import com.ruoyi.project.system.domain.SysDictData;
|
|
@@ -249,6 +250,7 @@ public class TTrainingbccRegularController extends BaseController
|
|
|
@PreAuthorize("@ss.hasPermi('training:bccregular:add')")
|
|
|
@Log(title = "装置培训计划", businessType = BusinessType.INSERT)
|
|
|
@GetMapping("batchAddTraining")
|
|
|
+ @RepeatSubmit
|
|
|
public AjaxResult addBatch() {
|
|
|
TTrainingbccRegular tr =new TTrainingbccRegular();
|
|
|
TTrainingMatrix tTrainingMatrix = new TTrainingMatrix();
|
|
@@ -257,6 +259,7 @@ public class TTrainingbccRegularController extends BaseController
|
|
|
List<TTrainingMatrix> list = tTrainingMatrixService.selectTTrainingMatrixList(tTrainingMatrix);
|
|
|
logger.info("===========" + list.size() + "");
|
|
|
int currentYear = LocalDate.now().getYear();
|
|
|
+ int resNum = 0;
|
|
|
for (TTrainingMatrix matrix: list
|
|
|
) {
|
|
|
int addFlag = 0;
|
|
@@ -279,11 +282,15 @@ public class TTrainingbccRegularController extends BaseController
|
|
|
if ("每月一次".equals(matrix.getFrequency()) ) {
|
|
|
tr.setYear(String.valueOf(currentYear));
|
|
|
tr.setItem(matrix.getItem());
|
|
|
+ List<TTrainingbccRegular> regulars0 = tTrainingbccRegularService.selectTTrainingbccRegularList(tr);
|
|
|
tr.setPlanTrainingdate(new Date());
|
|
|
List<TTrainingbccRegular> regulars = tTrainingbccRegularService.selectTTrainingbccRegularList(tr);
|
|
|
if (regulars.size() == 0) {
|
|
|
addFlag = 1;
|
|
|
}
|
|
|
+ if (regulars0.size() >= LocalDate.now().getMonthValue()) { //数量够了不需要增加了
|
|
|
+ addFlag = 0;
|
|
|
+ }
|
|
|
}
|
|
|
if (addFlag == 1) {
|
|
|
TTrainingbccRegular tTrainingRegular = new TTrainingbccRegular();
|
|
@@ -393,9 +400,10 @@ public class TTrainingbccRegularController extends BaseController
|
|
|
trainingbccDeviceService.insertTTrainingbccDevice(tTrainingDevice);
|
|
|
}
|
|
|
}
|
|
|
+ resNum ++;
|
|
|
}
|
|
|
}
|
|
|
- return AjaxResult.success();
|
|
|
+ return AjaxResult.success("成功添加" + resNum + "条培训");
|
|
|
}
|
|
|
|
|
|
/**
|