linzhijie
2021-04-06 8728733ad60e1698bb6cf0fa2e428c28a6bffbe7
src/main/java/com/ots/project/exam/controller/EntTestPackageController.java
@@ -11,12 +11,10 @@
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.EntEmailTemplate;
import com.ots.project.exam.domain.EntTestPackage;
import com.ots.project.exam.domain.SysUserExtend;
import com.ots.project.exam.service.IEntDemographyParamService;
import com.ots.project.exam.service.IEntTestPackageService;
import com.ots.project.exam.service.ISysUserExtendService;
import com.ots.project.exam.service.ITReportTemplateService;
import com.ots.project.exam.service.*;
import com.ots.project.system.user.domain.User;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.jetbrains.annotations.NotNull;
@@ -59,13 +57,16 @@
    @Autowired
    private ITReportTemplateService reportTemplateService;
    @Autowired
    private IEntEmailTemplateService entEmailTemplateService;
    @RequiresPermissions("exam:test_package:view")
    @GetMapping()
    public String test_package() {
        return prefix + "/test_package";
    }
    @RequiresPermissions("exam:test_package:search")
    @RequiresPermissions("exam:test_package:view")
    @GetMapping("/searchTestPackage")
    public String search(String testName, ModelMap mmap) {
        if (Objects.nonNull(testName)) {
@@ -150,67 +151,14 @@
        mmap.put("roles", list);
        //报告模板编码  t_report_template
//        mmap.put("templateList", reportTemplateService.getReportTemplates(ShiroUtils.getSysUser()));
        mmap.put("template", getTemplate());
//        mmap.put("template", getTemplate());
        //默认邮件内容模板配置
        EntEmailTemplate eet = entEmailTemplateService.getOnly();
        mmap.put("eet", eet);
        SysUserExtend sysUserExtend = sysUserExtendService.selectSysUserExtendById(ShiroUtils.getUserId());
        String mailContent = sysUserExtend.getMailContent();
        if (StringUtils.isBlank(mailContent)) {
            mailContent = getHrTemplate();
        }
        mmap.put("hrTemplate", mailContent);
        return prefix + "/add";
    }
    @NotNull
    private String getHrTemplate() {
        String template = "亲爱的{Company}人力资源部,\n" +
                "Dear HR Staff at {Company},\n" +
                "เรียนฝ่ายบุคคลของ {Company}\n" +
                "\n" +
                "附件是{FullName} 最近完成的{prodName}测评报告。\n" +
                "Attached please find the assessment report on {prodName} of {FullName}\n" +
                "กรุณาตรวจสอบเอกสารแนบ ของ {FullName} ของ {prodName}. \n" +
                "\n" +
                "如有疑问,请与客服联系,邮箱是:support@tai-online.com。\n" +
                "Should you have questions, please contact our customer service at support@tai-online.com. \n" +
                "หากมีข้อสงสัยหรือคำถามเพิ่มเติม กรุณาติดต่อฝ่ายบริการลูกค้าสัมพันธ์ ที่ support@tai-online.com\n" +
                "\n" +
                "\n" +
                "谢谢!\n" +
                "All the best,\n" +
                "ขอขอบคุณเป็นอย่างยิ่ง\n" +
                "\n" +
                "\n" +
                "TAI公司客户服务部\n" +
                "Customer Service Dept., TAI, LLC\n" +
                "ฝ่ายบริการลูกค้าสัมพันธ์บริษท TAI";
        return template;
    }
    @NotNull
    private String getTemplate() {
        String template = "亲爱的{FullName},\n" +
                "<br>Dear {FullName},\n" +
                "<br>เรียน {FullName},\n" +
                "<br>\n" +
                "<br>{Company} 邀请您完成一份测试,大概需要20-25分钟时间。您可以直接点击下面的链接开始该测试。如果不能直接访问,请复制地址到浏览器中直接打开。\n" +
                "<br>You've been invited to take an assessment by {Company}, which shall take about 20-25 minutes to complete. Please click the link below, or copy the link to your browser, to begin the assessment.\n" +
                "<br>คุณได้รับเชิญให้ทำแบบประเมินจาก {Company} กรุณาใช้ลิงค์ด้านล่างเพื่อเริ่มดำเนินการ โดยคุณสามารถคลิกที่ลิงค์ด้านล่างโดยตรง หรือจะคัดลอกแล้วนำลิงค์ไปวางบนเบราว์เซอร์ของคุณก็ได้\n" +
                "<br>链接地址是:<a href='{url}' target='_blank'>{url}</a>\n" +
                "<br>The link is: <a href='{url}' target='_blank'>{url}</a>\n" +
                "<br>ตามลิงค์นี้: <a href='{url}' target='_blank'>{url}</a>\n" +
                "<br>\n" +
                "<br>如有疑问,请与客服联系,邮箱是:support@tai-online.com。\n" +
                "<br>Should you have problem assessing the above link, please contact our customer service at support@tai-online.com.\n" +
                "<br>หากคุณมีปัญหาในการเข้าสู่ลิงค์ข้างต้น โปรดติดต่อฝ่ายบริการลูกค้าของเราที่ support@tai-online.com\n" +
                "<br>\n" +
                "<br>\n" +
                "<br>谢谢!\n" +
                "<br>All the best,\n" +
                "<br>ด้วยความเคารพ\n" +
                "<br>\n" +
                "<br>{Company}\n" +
                "<br>";
        return template;
    }
    /**
@@ -270,6 +218,12 @@
            });
        }
        mmap.put("roles", list);
        //默认邮件内容模板配置
        EntEmailTemplate eet = entEmailTemplateService.getOnly();
        mmap.put("eet", eet);
        SysUserExtend sysUserExtend = sysUserExtendService.selectSysUserExtendById(ShiroUtils.getUserId());
        String mailContent = sysUserExtend.getMailContent();
        mmap.put("hrTemplate",mailContent);
        //报告模板编码  t_report_template
        mmap.put("templateList", reportTemplateService.getReportTemplates(ShiroUtils.getSysUser(), entTestPackage.getProdId()));
@@ -298,5 +252,57 @@
        return toAjax(entTestPackageService.deleteEntTestPackageByIds(ids));
    }
    @NotNull
    private String getHrTemplate() {
        String template = "亲爱的{Company}人力资源部,\n" +
                "Dear HR Staff at {Company},\n" +
                "เรียนฝ่ายบุคคลของ {Company}\n" +
                "\n" +
                "附件是{FullName} 最近完成的{prodName}测评报告。\n" +
                "Attached please find the assessment report on {prodName} of {FullName}\n" +
                "กรุณาตรวจสอบเอกสารแนบ ของ {FullName} ของ {prodName}. \n" +
                "\n" +
                "如有疑问,请与客服联系,邮箱是:support@tai-online.com。\n" +
                "Should you have questions, please contact our customer service at support@tai-online.com. \n" +
                "หากมีข้อสงสัยหรือคำถามเพิ่มเติม กรุณาติดต่อฝ่ายบริการลูกค้าสัมพันธ์ ที่ support@tai-online.com\n" +
                "\n" +
                "\n" +
                "谢谢!\n" +
                "All the best,\n" +
                "ขอขอบคุณเป็นอย่างยิ่ง\n" +
                "\n" +
                "\n" +
                "TAI公司客户服务部\n" +
                "Customer Service Dept., TAI, LLC\n" +
                "ฝ่ายบริการลูกค้าสัมพันธ์บริษท TAI";
        return template;
    }
    @NotNull
    private String getTemplate() {
        String template = "亲爱的{FullName},\n" +
                "<br>Dear {FullName},\n" +
                "<br>เรียน {FullName},\n" +
                "<br>\n" +
                "<br>{Company} 邀请您完成一份测试,大概需要20-25分钟时间。您可以直接点击下面的链接开始该测试。如果不能直接访问,请复制地址到浏览器中直接打开。\n" +
                "<br>You've been invited to take an assessment by {Company}, which shall take about 20-25 minutes to complete. Please click the link below, or copy the link to your browser, to begin the assessment.\n" +
                "<br>คุณได้รับเชิญให้ทำแบบประเมินจาก {Company} กรุณาใช้ลิงค์ด้านล่างเพื่อเริ่มดำเนินการ โดยคุณสามารถคลิกที่ลิงค์ด้านล่างโดยตรง หรือจะคัดลอกแล้วนำลิงค์ไปวางบนเบราว์เซอร์ของคุณก็ได้\n" +
                "<br>链接地址是:<a href='{url}' target='_blank'>{url}</a>\n" +
                "<br>The link is: <a href='{url}' target='_blank'>{url}</a>\n" +
                "<br>ตามลิงค์นี้: <a href='{url}' target='_blank'>{url}</a>\n" +
                "<br>\n" +
                "<br>如有疑问,请与客服联系,邮箱是:support@tai-online.com。\n" +
                "<br>Should you have problem assessing the above link, please contact our customer service at support@tai-online.com.\n" +
                "<br>หากคุณมีปัญหาในการเข้าสู่ลิงค์ข้างต้น โปรดติดต่อฝ่ายบริการลูกค้าของเราที่ support@tai-online.com\n" +
                "<br>\n" +
                "<br>\n" +
                "<br>谢谢!\n" +
                "<br>All the best,\n" +
                "<br>ด้วยความเคารพ\n" +
                "<br>\n" +
                "<br>{Company}\n" +
                "<br>";
        return template;
    }
}