From b23f8cd1438c2b3c6f7e334502de619ffbb7fdc7 Mon Sep 17 00:00:00 2001 From: linzhijie <19970921lzj> Date: 星期三, 24 三月 2021 19:24:01 +0800 Subject: [PATCH] 报告邮件标题跟随语言变换 --- src/main/java/com/ots/project/exam/controller/EntTestPackageController.java | 113 +++++++++++++++++++++++++++++++++++++------------------- 1 files changed, 74 insertions(+), 39 deletions(-) diff --git a/src/main/java/com/ots/project/exam/controller/EntTestPackageController.java b/src/main/java/com/ots/project/exam/controller/EntTestPackageController.java index cb71242..b8b107b 100644 --- a/src/main/java/com/ots/project/exam/controller/EntTestPackageController.java +++ b/src/main/java/com/ots/project/exam/controller/EntTestPackageController.java @@ -1,4 +1,5 @@ package com.ots.project.exam.controller; + import com.ots.common.enums.UserTypeEnum; import com.ots.common.utils.MessageUtils; import com.ots.common.utils.StringUtils; @@ -10,7 +11,6 @@ import com.ots.framework.web.domain.AjaxResult; import com.ots.framework.web.page.TableDataInfo; import com.ots.project.exam.domain.EntDemographyParam; -import com.ots.project.exam.domain.EntTestMember; import com.ots.project.exam.domain.EntTestPackage; import com.ots.project.exam.domain.SysUserExtend; import com.ots.project.exam.service.IEntDemographyParamService; @@ -28,31 +28,46 @@ import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.ResponseBody; -import java.util.ArrayList; + import java.util.Arrays; import java.util.List; import java.util.Objects; import java.util.stream.Collectors; + import static com.ots.common.enums.UserTypeEnum.SYS_USER; +/** + * 娴嬭瘯鍖呯鐞咰ontroller + * + * @author ots + * @date 2019-11-27 + */ @Controller @RequestMapping("/exam/test_package") public class EntTestPackageController extends BaseController { private String prefix = "exam/test_package"; + @Autowired private IEntTestPackageService entTestPackageService; + @Autowired private IEntDemographyParamService entDemographyParamService; + @Autowired private ISysUserExtendService sysUserExtendService; + @Autowired private ITReportTemplateService reportTemplateService; + @RequiresPermissions("exam:test_package:view") @GetMapping() public String test_package() { return prefix + "/test_package"; } - + + /** + * 鏌ヨ娴嬭瘯鍖呯鐞嗗垪琛� + */ @RequiresPermissions("exam:test_package:list") @PostMapping("/list") @ResponseBody @@ -64,7 +79,7 @@ if (UserTypeEnum.ENT_USER.getUserType().equals(userType)) { entTestPackage.setUserId(sysUser.getUserId()); } - + //鍒嗛攢鍟嗗彲浠ョ湅鍒板垎閿�鍟嗕笅鐨勪紒涓氫俊鎭� if (UserTypeEnum.DIS_USER.getUserType().equals(userType)) { SysUserExtend sysUserExtend = new SysUserExtend(); sysUserExtend.setParentUserId(sysUser.getUserId()); @@ -76,7 +91,11 @@ } return getDataTable(entTestPackageService.selectEntTestPackageList(entTestPackage)); } - + + + /** + * 鏌ヨ娴嬭瘯鍖呯鐞嗗垪琛� + */ @PostMapping("/listTopTestPackage") @ResponseBody public TableDataInfo listTopTestPackage(EntTestPackage entTestPackage) { @@ -85,53 +104,43 @@ if (!SYS_USER.getUserType().equals(sysUser.getUserType())) { entTestPackage.setUserId(sysUser.getUserId()); } - - return getDataTable(entTestPackageService.selectEntTestPackageList(entTestPackage)); + return getDataTable(entTestPackageService.selectEntTestPackageMainList(entTestPackage)); } - + + /** + * 瀵煎嚭娴嬭瘯鍖呯鐞嗗垪琛� + */ @RequiresPermissions("exam:test_package:export") @PostMapping("/export") @ResponseBody public AjaxResult export(EntTestPackage entTestPackage) { - User sysUser = ShiroUtils.getSysUser(); - String userType = sysUser.getUserType(); - List<Long> userIds = new ArrayList<>(); - userIds.add(sysUser.getUserId()); - - if (UserTypeEnum.DIS_USER.getUserType().equals(userType)) { - SysUserExtend sysUserExtend = new SysUserExtend(); - sysUserExtend.setParentUserId(sysUser.getUserId()); - List<SysUserExtend> sysUserExtends = sysUserExtendService.selectSysUserExtendList(sysUserExtend); - for (int i = 0; i < sysUserExtends.size(); i++) { - SysUserExtend extend = sysUserExtends.get(i); - userIds.add(extend.getUserId()); - } - } List<EntTestPackage> list = entTestPackageService.selectEntTestPackageList(entTestPackage); - if (!SYS_USER.getUserType().equals(userType)) { - - list = list.stream().filter(p -> userIds.contains(p.getUserId())).collect(Collectors.toList()); - } ExcelUtil<EntTestPackage> util = new ExcelUtil<EntTestPackage>(EntTestPackage.class); return util.exportExcel(list, "test_package"); } - + + /** + * 鍥炴敹浜烘锛堝洖鏀跺瘑鐮侊級 + */ @RequiresPermissions("exam:test_package:recover") @PostMapping("/recover/{testId}") @ResponseBody public AjaxResult recover(@PathVariable Long testId) { return toAjax(entTestPackageService.recover(testId)); } - + + /** + * 鏂板娴嬭瘯鍖呯鐞� + */ @GetMapping("/add") public String add(ModelMap mmap) { - + //澶氳瑷�閫夋嫨 EntDemographyParam entDemographyParam = new EntDemographyParam(); entDemographyParam.setParamStatus("1"); List<EntDemographyParam> list = entDemographyParamService.selectEntDemographyParamList(entDemographyParam); mmap.put("roles", list); - - + //鎶ュ憡妯℃澘缂栫爜 t_report_template +// mmap.put("templateList", reportTemplateService.getReportTemplates(ShiroUtils.getSysUser())); mmap.put("template", getTemplate()); SysUserExtend sysUserExtend = sysUserExtendService.selectSysUserExtendById(ShiroUtils.getUserId()); String mailContent = sysUserExtend.getMailContent(); @@ -141,6 +150,7 @@ mmap.put("hrTemplate", mailContent); return prefix + "/add"; } + @NotNull private String getHrTemplate() { String template = "浜茬埍鐨剓Company}浜哄姏璧勬簮閮紝\n" + @@ -166,6 +176,7 @@ "喔澿箞喔侧涪喔氞福喔脆竵喔侧福喔ム腹喔佮竸喙夃覆喔副喔∴笧喔编笝喔樴箤喔氞福喔脆俯喔� TAI"; return template; } + @NotNull private String getTemplate() { String template = "浜茬埍鐨剓FullName},\n" + @@ -192,13 +203,19 @@ "<br>"; return template; } - + + /** + * 鏍规嵁浜у搧鍖匢D鑾峰彇妯℃澘缂栫爜 + */ @PostMapping("/prodTemplate") @ResponseBody public AjaxResult changeTemplate(Long prodId) { return AjaxResult.success(MessageUtils.message("basis.successfulOperation"), reportTemplateService.getReportTemplates(ShiroUtils.getSysUser(), prodId)); } - + + /** + * 鏂板淇濆瓨娴嬭瘯鍖呯鐞� + */ @RequiresPermissions("exam:test_package:add") @Log(title = "娴嬭瘯鍖呯鐞�", businessType = BusinessType.INSERT) @PostMapping("/add") @@ -206,15 +223,22 @@ public AjaxResult addSave(EntTestPackage entTestPackage) { return toAjax(entTestPackageService.insertEntTestPackage(entTestPackage)); } - + + /** + * 淇敼娴嬭瘯鍖呯鐞� + */ @GetMapping("/edit/{id}") public String edit(@PathVariable("id") Long id, ModelMap mmap) { EntTestPackage entTestPackage = entTestPackageService.selectEntTestPackageById(id); mmap.put("entTestPackage", entTestPackage); + EntDemographyParam entDemographyParam = new EntDemographyParam(); List<EntDemographyParam> list = entDemographyParamService.selectEntDemographyParamList(entDemographyParam); + String paramCodes = entTestPackage.getParamCodes(); - + /** + * 榛樿鍏ㄩ儴涓篺alse + */ if (Objects.nonNull(paramCodes)) { String[] split = paramCodes.split(","); list.forEach(p -> { @@ -223,7 +247,9 @@ }); }); } - + /** + * 瀛樺湪鏁版嵁鍒欐洿鏂颁负true + */ if (Objects.nonNull(paramCodes)) { String[] split = paramCodes.split(","); list.forEach(p -> { @@ -235,11 +261,15 @@ }); } mmap.put("roles", list); - + + //鎶ュ憡妯℃澘缂栫爜 t_report_template mmap.put("templateList", reportTemplateService.getReportTemplates(ShiroUtils.getSysUser(), entTestPackage.getProdId())); return prefix + "/edit"; } - + + /** + * 淇敼淇濆瓨娴嬭瘯鍖呯鐞� + */ @RequiresPermissions("exam:test_package:edit") @Log(title = "娴嬭瘯鍖呯鐞�", businessType = BusinessType.UPDATE) @PostMapping("/edit") @@ -247,7 +277,10 @@ public AjaxResult editSave(EntTestPackage entTestPackage) { return toAjax(entTestPackageService.updateEntTestPackage(entTestPackage)); } - + + /** + * 鍒犻櫎娴嬭瘯鍖呯鐞� + */ @RequiresPermissions("exam:test_package:remove") @Log(title = "娴嬭瘯鍖呯鐞�", businessType = BusinessType.DELETE) @PostMapping("/remove") @@ -255,4 +288,6 @@ public AjaxResult remove(String ids) { return toAjax(entTestPackageService.deleteEntTestPackageByIds(ids)); } + + } -- Gitblit v1.9.1