|
@@ -2,11 +2,15 @@ package com.ruoyi.project.training.controller;
|
|
|
|
|
|
import java.io.IOException;
|
|
|
import java.time.LocalDate;
|
|
|
+import java.util.Iterator;
|
|
|
import java.util.List;
|
|
|
|
|
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
|
|
import com.ruoyi.framework.config.RuoYiConfig;
|
|
|
+import com.ruoyi.project.plant.domain.TStaffmgr;
|
|
|
+import com.ruoyi.project.plant.service.ITStaffmgrService;
|
|
|
import com.ruoyi.project.training.bccnew.domain.TTsFirstplanTmpl;
|
|
|
+import com.ruoyi.project.training.domain.TTrainingDevice;
|
|
|
import com.ruoyi.project.training.domain.TTrainingbccDevice;
|
|
|
import com.ruoyi.project.training.mapper.TTrainingbccDeviceMapper;
|
|
|
import com.ruoyi.project.training.mapper.TTrainingbccMapper;
|
|
@@ -41,6 +45,8 @@ public class TTrainingbccController extends BaseController
|
|
|
private TTrainingbccDeviceMapper tTrainingbccDeviceMapper;
|
|
|
@Resource
|
|
|
private TTrainingbccMapper tTrainingbccMapper;
|
|
|
+ @Autowired
|
|
|
+ private ITStaffmgrService tStaffmgrService;
|
|
|
/**
|
|
|
* 查询装置培训跟踪b列表
|
|
|
*/
|
|
@@ -122,7 +128,39 @@ public class TTrainingbccController extends BaseController
|
|
|
@PostMapping
|
|
|
public AjaxResult add(@RequestBody TTrainingbcc tTrainingbcc)
|
|
|
{
|
|
|
- return toAjax(tTrainingbccService.insertTTrainingbcc(tTrainingbcc));
|
|
|
+ tTrainingbccService.insertTTrainingbcc(tTrainingbcc);
|
|
|
+ //培训岗位人员
|
|
|
+ if (tTrainingbcc.getPosition() != null) {
|
|
|
+ TStaffmgr s = new TStaffmgr();
|
|
|
+ s.setActualposts(tTrainingbcc.getPosition());
|
|
|
+ List<TStaffmgr> trainingStaff = tStaffmgrService.selectAllTStaffmgrList(s);
|
|
|
+ try {
|
|
|
+ //判断离职
|
|
|
+ if (!org.apache.commons.lang.StringUtils.isEmpty(tTrainingbcc.getYears())) {
|
|
|
+ Iterator<TStaffmgr> iterator = trainingStaff.iterator();
|
|
|
+ while (iterator.hasNext()) {
|
|
|
+ TStaffmgr t = iterator.next();
|
|
|
+ if (t.getLeftDate() != null && t.getDelFlag() == 9) {
|
|
|
+ if (t.getLeftDate().getTime() - tTrainingbcc.getStartDate().getTime() < 0l) {
|
|
|
+ logger.debug(t.getName() + "离职时间小于培训时间");
|
|
|
+ iterator.remove();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error(e.toString());
|
|
|
+ }
|
|
|
+ for (TStaffmgr staff : trainingStaff) {
|
|
|
+ TTrainingbccDevice tTrainingDevice = new TTrainingbccDevice();
|
|
|
+ tTrainingDevice.setStaffId(staff.getStaffid());
|
|
|
+ tTrainingDevice.setRegularId(tTrainingbcc.getId());
|
|
|
+ tTrainingDevice.setStartDate(tTrainingbcc.getCourseStartdate());
|
|
|
+ tTrainingDevice.setSupplementary("0");
|
|
|
+ tTrainingbccDeviceMapper.insertTTrainingbccDevice(tTrainingDevice);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return toAjax(1);
|
|
|
}
|
|
|
|
|
|
/**
|