|
@@ -2,6 +2,7 @@ package com.ruoyi.project.training.bccnew.controller;
|
|
|
|
|
|
import com.deepoove.poi.XWPFTemplate;
|
|
|
import com.deepoove.poi.data.*;
|
|
|
+import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
import com.ruoyi.common.utils.file.FileUploadUtils;
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
@@ -300,6 +301,20 @@ public class TTsNewController extends BaseController {
|
|
|
return AjaxResult.success(appraisalFormWordPath);
|
|
|
}
|
|
|
|
|
|
+ @PutMapping("/regenerateWord/{newId}")
|
|
|
+ public void regenerateWord(@PathVariable Long newId) throws IOException {
|
|
|
+ TTsNew tTsNew = tTsNewService.selectTTsNewById(newId);
|
|
|
+ // 生成word - Mentor Agreement
|
|
|
+ String mentorAgreementWordPath = this.genMentorAgreementWord(tTsNew);
|
|
|
+ // 生成word - Target Plan
|
|
|
+ String targetPlanWordPath = this.genTargetPlanWord(tTsNew);
|
|
|
+ // 更新文件地址
|
|
|
+ tTsNew.setMentorAgreementWordPath(mentorAgreementWordPath);
|
|
|
+ tTsNew.setTargetPlanWordPath(targetPlanWordPath);
|
|
|
+// tTsNew.setAppraisalFormWordPath(appraisalFormWordPath);
|
|
|
+ tTsNewService.updateTTsNew(tTsNew);
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 生成word - Mentor Agreement
|
|
|
*/
|
|
@@ -542,17 +557,23 @@ public class TTsNewController extends BaseController {
|
|
|
SysUser apprentice = sysUserService.selectUserByStaffId(staffId);
|
|
|
List<TTsApprove> tTsApproves = tsApproveService.selectTTsApproveByNewId(tTsNew.getNewId());
|
|
|
if (CollectionUtils.isNotEmpty(tTsApproves)) {
|
|
|
- if (tTsApproves.get(0).getApprover() != null) {
|
|
|
- SysUser manager = sysUserService.selectUserById(Long.valueOf(tTsApproves.get(0).getApprover()));
|
|
|
- if (StringUtils.isNotEmpty(manager.getSignUrl()))
|
|
|
- params.put("mgrSign", Pictures.ofLocal(fileName(manager.getSignUrl())).size(100, 40).create());
|
|
|
- if (tTsNew.getPlanStatus() == 3) {// 模板路径
|
|
|
- String imgPath = "/static/word/training/commentImg/end2.png";
|
|
|
- params.put("mentorComments", Pictures.ofLocal(Objects.requireNonNull(getClass().getResource(imgPath)).getPath()).size(500, 80).create());
|
|
|
- }
|
|
|
- if (tTsNew.getPlanStatus() == 1) {// 模板路径
|
|
|
- String imgPath = "/static/word/training/commentImg/end1.png";
|
|
|
- params.put("mentorComments", Pictures.ofLocal(Objects.requireNonNull(getClass().getResource(imgPath)).getPath()).size(500, 80).create());
|
|
|
+ for (TTsApprove tTsApprove : tTsApproves) {
|
|
|
+ if(tTsApprove.getApprover()!=null) {
|
|
|
+ SysUser manager = sysUserService.selectUserById(Long.valueOf(tTsApprove.getApprover()));
|
|
|
+ if (StringUtils.isNotEmpty(manager.getSignUrl())) {
|
|
|
+ params.put("mgrSign", Pictures.ofLocal(fileName(manager.getSignUrl())).size(100, 40).create());
|
|
|
+ params.put("mgrTime", DateUtils.dateTime(tTsApprove.getApproveTime()));
|
|
|
+ params.put("tutorTime", DateUtils.dateTime(tTsApprove.getApplicationTime()));
|
|
|
+ params.put("traineeTime", DateUtils.dateTime(tTsApprove.getCreatedate()));
|
|
|
+ }
|
|
|
+ if (tTsNew.getPlanStatus() == 3) {// 模板路径
|
|
|
+ String imgPath = "/static/word/training/commentImg/end2.png";
|
|
|
+ params.put("mentorComments", Pictures.ofLocal(Objects.requireNonNull(getClass().getResource(imgPath)).getPath()).size(500, 80).create());
|
|
|
+ }
|
|
|
+ if (tTsNew.getPlanStatus() == 1) {// 模板路径
|
|
|
+ String imgPath = "/static/word/training/commentImg/end1.png";
|
|
|
+ params.put("mentorComments", Pictures.ofLocal(Objects.requireNonNull(getClass().getResource(imgPath)).getPath()).size(500, 80).create());
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|