|
@@ -11,12 +11,17 @@ import com.ruoyi.framework.web.domain.AjaxResult;
|
|
|
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
|
import com.ruoyi.project.plant.domain.TStaffmgr;
|
|
|
import com.ruoyi.project.plant.service.ITStaffmgrService;
|
|
|
+import com.ruoyi.project.plant.mapper.TStaffmgrMapper;
|
|
|
import com.ruoyi.project.system.domain.SysDept;
|
|
|
import com.ruoyi.project.system.domain.SysDictData;
|
|
|
import com.ruoyi.project.system.service.ISysDeptService;
|
|
|
import com.ruoyi.project.system.service.ISysDictTypeService;
|
|
|
import com.ruoyi.project.training.domain.*;
|
|
|
import com.ruoyi.project.training.service.*;
|
|
|
+import com.ruoyi.project.document.domain.TPlantproglist;
|
|
|
+import com.ruoyi.project.document.service.ITPlantproglistService;
|
|
|
+import com.ruoyi.project.common.domain.TCommonfile;
|
|
|
+import com.ruoyi.project.common.service.ITCommonfileService;
|
|
|
import org.apache.poi.ss.usermodel.Cell;
|
|
|
import org.apache.poi.ss.usermodel.Row;
|
|
|
import org.apache.poi.ss.usermodel.Sheet;
|
|
@@ -67,6 +72,12 @@ public class TTrainingMatrixController extends BaseController {
|
|
|
|
|
|
@Autowired
|
|
|
private ITTrainingService tTrainingService;
|
|
|
+ @Autowired
|
|
|
+ private ITPlantproglistService tPlantproglistService;
|
|
|
+ @Autowired
|
|
|
+ private ITCommonfileService tCommonfileService;
|
|
|
+ @Autowired
|
|
|
+ private TStaffmgrMapper tStaffmgrMapper;
|
|
|
/**
|
|
|
* 查询培训矩阵列表
|
|
|
*/
|
|
@@ -280,7 +291,63 @@ public class TTrainingMatrixController extends BaseController {
|
|
|
tTrainingRegular.setInvolvedMoc("false");
|
|
|
tTrainingRegular.setNotPlan("false");
|
|
|
tTrainingRegular.setYear(String.valueOf(LocalDate.now().getYear()));
|
|
|
-
|
|
|
+
|
|
|
+ // 通过课程代码搜索程序清单,获取培训人和培训文件(只查询一次)
|
|
|
+ String courseCode = matrix.getCourseCode();
|
|
|
+ String regularTrainer = null;
|
|
|
+ String trainer = null;
|
|
|
+ String fileUrl = "";
|
|
|
+ String fileName = "";
|
|
|
+ TPlantproglist plantproglist = null;
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(courseCode)) {
|
|
|
+ TPlantproglist plantproglistParam = new TPlantproglist();
|
|
|
+ plantproglistParam.setFileno(courseCode);
|
|
|
+ List<TPlantproglist> plantproglistList = tPlantproglistService.selectList(plantproglistParam);
|
|
|
+
|
|
|
+ if (plantproglistList != null && !plantproglistList.isEmpty()) {
|
|
|
+ plantproglist = plantproglistList.get(0);
|
|
|
+ logger.info("找到程序清单,文件编号: {}, 责任者: {}", courseCode, plantproglist.getResponsibility());
|
|
|
+
|
|
|
+ // 获取培训文件
|
|
|
+ TCommonfile fileParam = new TCommonfile();
|
|
|
+ fileParam.setpId(plantproglist.getId());
|
|
|
+ fileParam.setpType("plantproglist");
|
|
|
+ List<TCommonfile> fileList = tCommonfileService.selectAllFileList(fileParam);
|
|
|
+ if (fileList != null && !fileList.isEmpty()) {
|
|
|
+ fileUrl = fileList.get(0).getFileUrl();
|
|
|
+ fileName = fileList.get(0).getFileName();
|
|
|
+ logger.info("找到培训文件: {}", fileName);
|
|
|
+ }
|
|
|
+
|
|
|
+ // 获取培训人:通过责任者查找员工编号
|
|
|
+ String trainerName = plantproglist.getResponsibility();
|
|
|
+ regularTrainer = trainerName; // 设置给regular
|
|
|
+
|
|
|
+ if (StringUtils.isNotEmpty(trainerName)) {
|
|
|
+ TStaffmgr staffmgrParam = new TStaffmgr();
|
|
|
+ staffmgrParam.setName(trainerName);
|
|
|
+ staffmgrParam.setDeptId(tTrainingRegular.getDeptId());
|
|
|
+ staffmgrParam.setDelFlag(0L); // 未删除的员工
|
|
|
+ TStaffmgr staffmgr = tStaffmgrMapper.selectStaffmgrSingle(staffmgrParam);
|
|
|
+ if (staffmgr != null && StringUtils.isNotEmpty(staffmgr.getStaffid())) {
|
|
|
+ trainer = staffmgr.getStaffid();
|
|
|
+ logger.info("通过责任者找到培训人: {} -> {}", trainerName, trainer);
|
|
|
+ } else {
|
|
|
+ logger.warn("未找到责任者对应的员工: {}", trainerName);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ logger.warn("程序清单责任者为空");
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ logger.warn("未找到课程代码对应的程序清单: {}", courseCode);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ logger.warn("课程代码为空,无法获取程序清单培训人");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 设置regular的培训人
|
|
|
+ tTrainingRegular.setLecturer(regularTrainer);
|
|
|
int doInsert = tTrainingbccRegularService.insertTTrainingbccRegular(tTrainingRegular);
|
|
|
|
|
|
logger.info("regular:" + tTrainingRegular);
|
|
@@ -292,11 +359,16 @@ public class TTrainingMatrixController extends BaseController {
|
|
|
tTraining.setCourse(tTrainingRegular.getItem());
|
|
|
tTraining.setCourseid(tTrainingRegular.getCourseCode());
|
|
|
tTraining.setDuration(tTrainingRegular.getHour());
|
|
|
- tTraining.setTrainer(tTrainingRegular.getLecturer());
|
|
|
tTraining.setPosition(tTrainingRegular.getActualpostId());
|
|
|
tTraining.setIsfinish(Long.parseLong("0"));
|
|
|
tTraining.setDeptId(tTrainingRegular.getDeptId());
|
|
|
tTraining.setRegularId(tTrainingRegular.getId());
|
|
|
+
|
|
|
+ // 设置培训人和文件信息
|
|
|
+ tTraining.setTrainer(trainer);
|
|
|
+ tTraining.setFileUrl(fileUrl);
|
|
|
+ tTraining.setFileName(fileName);
|
|
|
+ tTraining.setContent(fileName);
|
|
|
trainingbccService.insertTTrainingbcc(tTraining);
|
|
|
Long trainingId = tTraining.getId();
|
|
|
//新增人员-装置级关系
|