|
|
@@ -5,7 +5,6 @@ import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.ServletUtils;
|
|
|
import com.ruoyi.common.utils.file.ExcelUtils;
|
|
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
|
|
-import com.ruoyi.common.utils.file.OfficeConvertUtils;
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
|
import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
|
|
import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
|
|
@@ -116,8 +115,25 @@ public class TStaffmgrController extends BaseController {
|
|
|
private ITPlantproglistService tPlantproglistService;
|
|
|
@Autowired
|
|
|
private ITCommonfileService tCommonfileService;
|
|
|
- @Autowired
|
|
|
- private OfficeConvertUtils officeConvertUtils;
|
|
|
+
|
|
|
+ @PreAuthorize("@ss.hasPermi('plant:staffmgr:list')")
|
|
|
+ @GetMapping("/listEoegSaiInspectors")
|
|
|
+ public AjaxResult listEoegSaiInspectors() {
|
|
|
+ return AjaxResult.success(tStaffmgrService.selectEoegSaiInspectors());
|
|
|
+ }
|
|
|
+
|
|
|
+ @PreAuthorize("@ss.hasPermi('plant:staffmgr:list')")
|
|
|
+ @GetMapping("/listEoegSaiExecutors")
|
|
|
+ public AjaxResult listEoegSaiExecutors() {
|
|
|
+ return AjaxResult.success(tStaffmgrService.selectEoegSaiExecutors());
|
|
|
+ }
|
|
|
+
|
|
|
+ @PreAuthorize("@ss.hasPermi('plant:staffmgr:list')")
|
|
|
+ @GetMapping("/listEoegSaiAssessors")
|
|
|
+ public AjaxResult listEoegSaiAssessors() {
|
|
|
+ return AjaxResult.success(tStaffmgrService.selectEoegSaiAssessors());
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取SAI整改负责人列表
|
|
|
*/
|
|
|
@@ -291,8 +307,14 @@ public class TStaffmgrController extends BaseController {
|
|
|
Iterator<TStaffmgr> iterator = list.iterator();
|
|
|
while (iterator.hasNext()) {
|
|
|
TStaffmgr t = iterator.next();
|
|
|
- if (t.getDelFlag() == 9) {
|
|
|
- iterator.remove();
|
|
|
+ if (t.getLeftDate() != null && t.getDelFlag() == 9) {
|
|
|
+ Calendar cal = Calendar.getInstance();
|
|
|
+ cal.setTime(t.getLeftDate());
|
|
|
+ Integer year = cal.get(Calendar.YEAR);//获取年
|
|
|
+ if (year < Integer.parseInt(tStaffmgr.getLeftYear())) {
|
|
|
+ logger.debug(t.getName() + "离职年份小于数据");
|
|
|
+ iterator.remove();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
@@ -576,7 +598,7 @@ public class TStaffmgrController extends BaseController {
|
|
|
int currentYear = LocalDate.now().getYear();
|
|
|
for (TTrainingMatrix matrix: list
|
|
|
) {
|
|
|
- //计划
|
|
|
+ //矩阵
|
|
|
TTrainingbccRegular tTrainingRegular = new TTrainingbccRegular();
|
|
|
tTrainingRegular.setDeptId(matrix.getDeptId());
|
|
|
tTrainingRegular.setActualpostId(matrix.getActualpostId());
|
|
|
@@ -663,33 +685,12 @@ public class TStaffmgrController extends BaseController {
|
|
|
|
|
|
// 设置培训人和文件信息
|
|
|
tTraining.setTrainer(trainer);
|
|
|
-
|
|
|
- // 检查文件是否为PPT格式,如果是则转换为PDF
|
|
|
- String finalFileUrl = fileUrl;
|
|
|
- String finalFileName = fileName;
|
|
|
- if (OfficeConvertUtils.isPptFile(fileName)) {
|
|
|
- try {
|
|
|
- logger.info("检测到PPT文件,开始转换为PDF: {}", fileName);
|
|
|
- String pdfUrl = officeConvertUtils.convertPptToPdf(fileUrl);
|
|
|
- if (pdfUrl != null && !pdfUrl.isEmpty()) {
|
|
|
- finalFileUrl = pdfUrl;
|
|
|
- finalFileName = OfficeConvertUtils.changeFileNameToPdf(fileName);
|
|
|
- logger.info("PPT文件转换成功,PDF文件路径: {}", pdfUrl);
|
|
|
- } else {
|
|
|
- logger.warn("PPT转PDF失败,使用原始文件");
|
|
|
- }
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error("PPT转PDF过程中发生错误,使用原始文件: {}", e.getMessage());
|
|
|
- e.printStackTrace();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- tTraining.setFileUrl(finalFileUrl);
|
|
|
- tTraining.setFileName(finalFileName);
|
|
|
+ tTraining.setFileUrl(fileUrl);
|
|
|
+ tTraining.setFileName(fileName);
|
|
|
// 培训内容:去掉文件后缀
|
|
|
- String content = finalFileName;
|
|
|
- if (StringUtils.isNotEmpty(finalFileName) && finalFileName.contains(".")) {
|
|
|
- content = finalFileName.substring(0, finalFileName.lastIndexOf("."));
|
|
|
+ String content = fileName;
|
|
|
+ if (StringUtils.isNotEmpty(fileName) && fileName.contains(".")) {
|
|
|
+ content = fileName.substring(0, fileName.lastIndexOf("."));
|
|
|
}
|
|
|
tTraining.setContent(content);
|
|
|
//添加学习时间
|
|
|
@@ -837,7 +838,7 @@ public class TStaffmgrController extends BaseController {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 人员管理转岗
|
|
|
+ * 修改人员管理
|
|
|
*/
|
|
|
@PreAuthorize("@ss.hasPermi('plant:staffmgr:edit')")
|
|
|
@Log(title = "人员管理转岗", businessType = BusinessType.UPDATE)
|
|
|
@@ -893,50 +894,6 @@ public class TStaffmgrController extends BaseController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- // 删除老岗位需要但新岗位不需要的未开始培训
|
|
|
- TTrainingbccDevice queryDevice = new TTrainingbccDevice();
|
|
|
- queryDevice.setStaffId(old.getStaffid());
|
|
|
- List<TTrainingbccDevice> allDevices = trainingbccDeviceService.selectTTrainingbccDeviceList(queryDevice);
|
|
|
- List<Long> toDeleteDeviceIds = new ArrayList<>();
|
|
|
-
|
|
|
- for (TTrainingbccDevice device : allDevices) {
|
|
|
- // 只处理未完成的培训
|
|
|
- if (device.getExamState() != 1) {
|
|
|
- // 通过regularId查找对应的TTrainingbcc
|
|
|
- TTrainingbcc trainingBcc = trainingbccService.selectTTrainingbccById(device.getRegularId());
|
|
|
- if (trainingBcc != null && trainingBcc.getRegularId() != null) {
|
|
|
- // 通过TTrainingbcc的regularId查找TTrainingbccRegular
|
|
|
- TTrainingbccRegular trainingRegular = tTrainingbccRegularService.selectTTrainingbccRegularById(trainingBcc.getRegularId());
|
|
|
- if (trainingRegular != null && trainingRegular.getActualpostId() != null) {
|
|
|
- String[] requiredPosts = trainingRegular.getActualpostId().split(",");
|
|
|
- boolean oldPostRequired = false;
|
|
|
- boolean newPostRequired = false;
|
|
|
-
|
|
|
- // 判断老岗位和新岗位是否需要此培训
|
|
|
- for (String post : requiredPosts) {
|
|
|
- if (post.trim().equals(old.getActualpost())) {
|
|
|
- oldPostRequired = true;
|
|
|
- }
|
|
|
- if (post.trim().equals(tStaffmgr.getActualpost())) {
|
|
|
- newPostRequired = true;
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 如果老岗位需要但新岗位不需要,则标记删除
|
|
|
- if (oldPostRequired && !newPostRequired) {
|
|
|
- toDeleteDeviceIds.add(device.getId());
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- // 批量删除不需要的培训
|
|
|
- if (toDeleteDeviceIds.size() > 0) {
|
|
|
- Long[] deleteIds = toDeleteDeviceIds.toArray(new Long[0]);
|
|
|
- trainingbccDeviceService.deleteTTrainingbccDeviceByIds(deleteIds);
|
|
|
- }
|
|
|
-
|
|
|
return toAjax(tStaffmgrService.updateTStaffmgr(tStaffmgr));
|
|
|
}
|
|
|
|
|
|
@@ -985,76 +942,17 @@ public class TStaffmgrController extends BaseController {
|
|
|
@Log(title = "人员管理", businessType = BusinessType.DELETE)
|
|
|
@GetMapping("/left/{id}")
|
|
|
public AjaxResult removeLeft(@PathVariable Long id) {
|
|
|
- logger.info("======== 开始执行删除离职人员操作 ========");
|
|
|
- logger.info("传入参数 - 人员ID: {}", id);
|
|
|
-
|
|
|
- try {
|
|
|
- // 处理培训记录
|
|
|
- logger.info("步骤1: 查询培训记录");
|
|
|
- TTrainingrecords tTrainingrecords = tTrainingrecordsService.selectTTrainingrecordsBystaffId(id);
|
|
|
- if (tTrainingrecords != null) {
|
|
|
- logger.info("找到培训记录,ID: {},准备更新删除标志为9", tTrainingrecords.getId());
|
|
|
- tTrainingrecords.setDelFlag(9l);
|
|
|
- tTrainingrecordsService.updateTTrainingrecords(tTrainingrecords);
|
|
|
- logger.info("培训记录删除标志更新成功");
|
|
|
- } else {
|
|
|
- logger.info("未找到培训记录,跳过此步骤");
|
|
|
- }
|
|
|
-
|
|
|
- // 获取人员信息
|
|
|
- logger.info("步骤2: 查询人员信息");
|
|
|
- TStaffmgr staffmgr = tStaffmgrService.selectTStaffmgrById(id);
|
|
|
- if (staffmgr == null) {
|
|
|
- logger.error("未找到ID为{}的人员信息", id);
|
|
|
- return AjaxResult.error("未找到人员信息");
|
|
|
- }
|
|
|
- logger.info("查询到人员信息 - 员工号: {}, 姓名: {}, 部门ID: {}",
|
|
|
- staffmgr.getStaffid(), staffmgr.getName(), staffmgr.getDeptId());
|
|
|
-
|
|
|
- // 删除该人员所有的Trainingbccdevice培训
|
|
|
- logger.info("步骤3: 删除BCC培训设备记录(使用简单查询)");
|
|
|
- List<TTrainingbccDevice> bccDevices = tTrainingbccDeviceMapper.selectTTrainingbccDeviceListByStaffId(staffmgr.getStaffid());
|
|
|
- logger.info("查询到BCC培训设备记录数量: {}", bccDevices.size());
|
|
|
-
|
|
|
- if (bccDevices.size() != 0) {
|
|
|
- Long[] bccDeviceIds = new Long[bccDevices.size()];
|
|
|
- for (int m = 0; m < bccDevices.size(); m++) {
|
|
|
- bccDeviceIds[m] = bccDevices.get(m).getId();
|
|
|
- }
|
|
|
- logger.info("准备删除BCC培训设备记录(设置del_flag=9),ID列表: {}", Arrays.toString(bccDeviceIds));
|
|
|
- int deletedCount = tTrainingbccDeviceMapper.deleteTTrainingbccDeviceByIdsForStaffLeft(bccDeviceIds);
|
|
|
- logger.info("BCC培训设备记录删除成功,受影响行数: {}", deletedCount);
|
|
|
- } else {
|
|
|
- logger.info("该人员没有BCC培训设备记录,跳过删除");
|
|
|
- }
|
|
|
-
|
|
|
- // 王子文 2022年6月27日 添加
|
|
|
- // 离职时修改继任者清单状态、培养计划状态
|
|
|
- logger.info("步骤4: 更新继任者清单状态和培养计划状态");
|
|
|
- Long staffId = Long.parseLong(staffmgr.getStaffid());
|
|
|
- logger.info("员工号转换为Long: {}", staffId);
|
|
|
-
|
|
|
- logger.info("更新继任者清单状态...");
|
|
|
- stSuccessorService.updateStateByStaffId(staffId);
|
|
|
- logger.info("继任者清单状态更新完成");
|
|
|
-
|
|
|
- logger.info("更新培养计划状态...");
|
|
|
- tStPlanService.updateStudyStateByStaffId(staffId);
|
|
|
- logger.info("培养计划状态更新完成");
|
|
|
-
|
|
|
- // 最终删除人员
|
|
|
- logger.info("步骤5: 执行人员离职删除操作");
|
|
|
- int result = tStaffmgrService.deleteLeftTStaffmgrByIds(id);
|
|
|
- logger.info("人员离职删除操作完成,受影响行数: {}", result);
|
|
|
-
|
|
|
- logger.info("======== 删除离职人员操作成功完成 ========");
|
|
|
- return toAjax(result);
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error("======== 删除离职人员操作失败 ========");
|
|
|
- logger.error("异常信息: {}", e.getMessage(), e);
|
|
|
- return AjaxResult.error("删除离职人员失败: " + e.getMessage());
|
|
|
+ TTrainingrecords tTrainingrecords = tTrainingrecordsService.selectTTrainingrecordsBystaffId(id);
|
|
|
+ if (tTrainingrecords != null) {
|
|
|
+ tTrainingrecords.setDelFlag(9l);
|
|
|
+ tTrainingrecordsService.updateTTrainingrecords(tTrainingrecords);
|
|
|
}
|
|
|
+ // 王子文 2022年6月27日 添加
|
|
|
+ // 离职时修改继任者清单状态、培养计划状态
|
|
|
+ Long staffId = Long.parseLong(tStaffmgrService.selectTStaffmgrById(id).getStaffid());
|
|
|
+ stSuccessorService.updateStateByStaffId(staffId);
|
|
|
+ tStPlanService.updateStudyStateByStaffId(staffId);
|
|
|
+ return toAjax(tStaffmgrService.deleteLeftTStaffmgrByIds(id));
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -1064,76 +962,17 @@ public class TStaffmgrController extends BaseController {
|
|
|
@Log(title = "人员管理", businessType = BusinessType.DELETE)
|
|
|
@GetMapping("/retire/{id}")
|
|
|
public AjaxResult removeRetire(@PathVariable Long id) {
|
|
|
- logger.info("======== 开始执行删除退休人员操作 ========");
|
|
|
- logger.info("传入参数 - 人员ID: {}", id);
|
|
|
-
|
|
|
- try {
|
|
|
- // 处理培训记录
|
|
|
- logger.info("步骤1: 查询培训记录");
|
|
|
- TTrainingrecords tTrainingrecords = tTrainingrecordsService.selectTTrainingrecordsBystaffId(id);
|
|
|
- if (tTrainingrecords != null) {
|
|
|
- logger.info("找到培训记录,ID: {},准备更新删除标志为9", tTrainingrecords.getId());
|
|
|
- tTrainingrecords.setDelFlag(9l);
|
|
|
- tTrainingrecordsService.updateTTrainingrecords(tTrainingrecords);
|
|
|
- logger.info("培训记录删除标志更新成功");
|
|
|
- } else {
|
|
|
- logger.info("未找到培训记录,跳过此步骤");
|
|
|
- }
|
|
|
-
|
|
|
- // 获取人员信息
|
|
|
- logger.info("步骤2: 查询人员信息");
|
|
|
- TStaffmgr staffmgr = tStaffmgrService.selectTStaffmgrById(id);
|
|
|
- if (staffmgr == null) {
|
|
|
- logger.error("未找到ID为{}的人员信息", id);
|
|
|
- return AjaxResult.error("未找到人员信息");
|
|
|
- }
|
|
|
- logger.info("查询到人员信息 - 员工号: {}, 姓名: {}, 部门ID: {}",
|
|
|
- staffmgr.getStaffid(), staffmgr.getName(), staffmgr.getDeptId());
|
|
|
-
|
|
|
- // 删除该人员所有的Trainingbccdevice培训
|
|
|
- logger.info("步骤3: 删除BCC培训设备记录(使用简单查询)");
|
|
|
- List<TTrainingbccDevice> bccDevices = tTrainingbccDeviceMapper.selectTTrainingbccDeviceListByStaffId(staffmgr.getStaffid());
|
|
|
- logger.info("查询到BCC培训设备记录数量: {}", bccDevices.size());
|
|
|
-
|
|
|
- if (bccDevices.size() != 0) {
|
|
|
- Long[] bccDeviceIds = new Long[bccDevices.size()];
|
|
|
- for (int m = 0; m < bccDevices.size(); m++) {
|
|
|
- bccDeviceIds[m] = bccDevices.get(m).getId();
|
|
|
- }
|
|
|
- logger.info("准备删除BCC培训设备记录(设置del_flag=9),ID列表: {}", Arrays.toString(bccDeviceIds));
|
|
|
- int deletedCount = tTrainingbccDeviceMapper.deleteTTrainingbccDeviceByIdsForStaffLeft(bccDeviceIds);
|
|
|
- logger.info("BCC培训设备记录删除成功,受影响行数: {}", deletedCount);
|
|
|
- } else {
|
|
|
- logger.info("该人员没有BCC培训设备记录,跳过删除");
|
|
|
- }
|
|
|
-
|
|
|
- // 王子文 2022年6月27日 添加
|
|
|
- // 离职时修改继任者清单状态、培养计划状态
|
|
|
- logger.info("步骤4: 更新继任者清单状态和培养计划状态");
|
|
|
- Long staffId = Long.parseLong(staffmgr.getStaffid());
|
|
|
- logger.info("员工号转换为Long: {}", staffId);
|
|
|
-
|
|
|
- logger.info("更新继任者清单状态...");
|
|
|
- stSuccessorService.updateStateByStaffId(staffId);
|
|
|
- logger.info("继任者清单状态更新完成");
|
|
|
-
|
|
|
- logger.info("更新培养计划状态...");
|
|
|
- tStPlanService.updateStudyStateByStaffId(staffId);
|
|
|
- logger.info("培养计划状态更新完成");
|
|
|
-
|
|
|
- // 最终删除人员
|
|
|
- logger.info("步骤5: 执行人员退休删除操作");
|
|
|
- int result = tStaffmgrService.deleteRetireTStaffmgrByIds(id);
|
|
|
- logger.info("人员退休删除操作完成,受影响行数: {}", result);
|
|
|
-
|
|
|
- logger.info("======== 删除退休人员操作成功完成 ========");
|
|
|
- return toAjax(result);
|
|
|
-
|
|
|
- } catch (Exception e) {
|
|
|
- logger.error("======== 删除退休人员操作失败 ========");
|
|
|
- logger.error("异常信息: {}", e.getMessage(), e);
|
|
|
- return AjaxResult.error("删除退休人员失败: " + e.getMessage());
|
|
|
+ TTrainingrecords tTrainingrecords = tTrainingrecordsService.selectTTrainingrecordsBystaffId(id);
|
|
|
+ if (tTrainingrecords != null) {
|
|
|
+ tTrainingrecords.setDelFlag(9l);
|
|
|
+ tTrainingrecordsService.updateTTrainingrecords(tTrainingrecords);
|
|
|
}
|
|
|
+ // 王子文 2022年6月27日 添加
|
|
|
+ // 离职时修改继任者清单状态、培养计划状态
|
|
|
+ Long staffId = Long.parseLong(tStaffmgrService.selectTStaffmgrById(id).getStaffid());
|
|
|
+ stSuccessorService.updateStateByStaffId(staffId);
|
|
|
+ tStPlanService.updateStudyStateByStaffId(staffId);
|
|
|
+ return toAjax(tStaffmgrService.deleteRetireTStaffmgrByIds(id));
|
|
|
}
|
|
|
|
|
|
/**
|