Преглед изворни кода

徐明浩
特种设备预警定时任务-邮件发送内容中跳转路径配置,本地、服务器

徐明浩 пре 3 година
родитељ
комит
4db8b7ff1a

+ 10 - 0
master/src/main/java/com/ruoyi/framework/config/RuoYiConfig.java

@@ -30,6 +30,16 @@ public class RuoYiConfig
     /** 获取地址开关 */
     private static boolean addressEnabled;
 
+    private String requestJumpPath;
+
+    public String getRequestJumpPath() {
+        return requestJumpPath;
+    }
+
+    public void setRequestJumpPath(String requestJumpPath) {
+        this.requestJumpPath = requestJumpPath;
+    }
+
     public String getName()
     {
         return name;

+ 20 - 15
master/src/main/java/com/ruoyi/framework/task/TSpecdevAllTask.java

@@ -3,6 +3,7 @@ package com.ruoyi.framework.task;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.ruoyi.common.sendEmail.IMailService;
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.framework.config.RuoYiConfig;
 import com.ruoyi.framework.web.controller.BaseController;
 import com.ruoyi.project.sems.domain.*;
 import com.ruoyi.project.sems.service.*;
@@ -57,6 +58,9 @@ public class TSpecdevAllTask extends BaseController {
     private ITAlarmhistoryService alarmhistoryService;
     @Autowired
     private ISysPlantService sysPlantService;
+    //系统基础配置
+    @Autowired
+    private RuoYiConfig ruoyiConfig;
 
     private final String glAlarmType = "特种设备-锅炉-在用";
     private final String glUrlSuffix = "sems/devgl/specGl";
@@ -115,13 +119,13 @@ public class TSpecdevAllTask extends BaseController {
             //根据装置权限获取数据
             List<SysPlant> plantList = sysPlantService.selectSysPlantByDeptId(o.getDeptId());
             List<String> plants = new ArrayList<>();
-            for (SysPlant s:plantList
-                 ) {
+            for (SysPlant s : plantList
+            ) {
                 plants.add(s.getName());
             }
             List<TSpecdevGl> list = this.specdevGlService.list(new QueryWrapper<TSpecdevGl>()
                     .eq("del_flag", 0).eq("status", "1")
-            .in("plant_code" ,plants)
+                    .in("plant_code", plants)
             );
             //获取动态处理预警级别
             TAlarmtype tAlarmtype = this.tAlarmtypeService.selectTAlarmtypeById(this.alarmtype);
@@ -177,12 +181,12 @@ public class TSpecdevAllTask extends BaseController {
             //根据装置权限获取数据
             List<SysPlant> plantList = sysPlantService.selectSysPlantByDeptId(o.getDeptId());
             List<String> plants = new ArrayList<>();
-            for (SysPlant s:plantList
+            for (SysPlant s : plantList
             ) {
                 plants.add(s.getName());
             }
             List<TSpecdevCc> list = this.specdevCcService.list(new QueryWrapper<TSpecdevCc>()
-                    .eq("del_flag", 0).eq("status", "1").in("plant_code" ,plants));
+                    .eq("del_flag", 0).eq("status", "1").in("plant_code", plants));
             List<TSpecdevCc> firstList = new ArrayList<>();
             List<TSpecdevCc> secondList = new ArrayList<>();
             List<TSpecdevCc> thirdList = new ArrayList<>();
@@ -235,12 +239,12 @@ public class TSpecdevAllTask extends BaseController {
             //根据装置权限获取数据
             List<SysPlant> plantList = sysPlantService.selectSysPlantByDeptId(o.getDeptId());
             List<String> plants = new ArrayList<>();
-            for (SysPlant s:plantList
+            for (SysPlant s : plantList
             ) {
                 plants.add(s.getName());
             }
             List<TSpecdevDzsb> list = this.specdevDzsbService.list(new QueryWrapper<TSpecdevDzsb>()
-                    .eq("del_flag", 0).eq("status", "1").in("plant_code" ,plants));
+                    .eq("del_flag", 0).eq("status", "1").in("plant_code", plants));
             List<TSpecdevDzsb> firstList = new ArrayList<>();
             List<TSpecdevDzsb> secondList = new ArrayList<>();
             List<TSpecdevDzsb> thirdList = new ArrayList<>();
@@ -293,12 +297,12 @@ public class TSpecdevAllTask extends BaseController {
             //根据装置权限获取数据
             List<SysPlant> plantList = sysPlantService.selectSysPlantByDeptId(o.getDeptId());
             List<String> plants = new ArrayList<>();
-            for (SysPlant s:plantList
+            for (SysPlant s : plantList
             ) {
                 plants.add(s.getName());
             }
             List<TSpecdevYlrq> list = this.specdevYlrqService.list(new QueryWrapper<TSpecdevYlrq>()
-                    .eq("del_flag", 0).eq("status", "1").in("plant_code" ,plants));
+                    .eq("del_flag", 0).eq("status", "1").in("plant_code", plants));
             List<TSpecdevYlrq> firstList = new ArrayList<>();
             List<TSpecdevYlrq> secondList = new ArrayList<>();
             List<TSpecdevYlrq> thirdList = new ArrayList<>();
@@ -351,12 +355,12 @@ public class TSpecdevAllTask extends BaseController {
             //根据装置权限获取数据
             List<SysPlant> plantList = sysPlantService.selectSysPlantByDeptId(o.getDeptId());
             List<String> plants = new ArrayList<>();
-            for (SysPlant s:plantList
+            for (SysPlant s : plantList
             ) {
                 plants.add(s.getName());
             }
             List<TSpecdevYlgd> list = this.specdevYlgdService.list(new QueryWrapper<TSpecdevYlgd>()
-                    .eq("del_flag", 0).eq("status", "1").in("plant_code" ,plants));
+                    .eq("del_flag", 0).eq("status", "1").in("plant_code", plants));
             List<TSpecdevYlgd> firstList = new ArrayList<>();
             List<TSpecdevYlgd> secondList = new ArrayList<>();
             List<TSpecdevYlgd> thirdList = new ArrayList<>();
@@ -408,12 +412,12 @@ public class TSpecdevAllTask extends BaseController {
             //根据装置权限获取数据
             List<SysPlant> plantList = sysPlantService.selectSysPlantByDeptId(o.getDeptId());
             List<String> plants = new ArrayList<>();
-            for (SysPlant s:plantList
+            for (SysPlant s : plantList
             ) {
                 plants.add(s.getName());
             }
             List<TSpecdevDt> list = this.specdevDtService.list(new QueryWrapper<TSpecdevDt>()
-                    .eq("del_flag", 0).eq("status", "1").in("plant_code" ,plants));
+                    .eq("del_flag", 0).eq("status", "1").in("plant_code", plants));
             List<TSpecdevDt> firstList = new ArrayList<>();
             List<TSpecdevDt> secondList = new ArrayList<>();
             List<TSpecdevDt> thirdList = new ArrayList<>();
@@ -700,7 +704,7 @@ public class TSpecdevAllTask extends BaseController {
                 "预警类型:<b>alarmType</b><br>" +
                 "预警等级:<b>warningLevel</b><br>" +
                 "预警内容contenFormat:<b>warningContent</b><br>" +
-                "请前往<a href=\"http://47.114.101.16:8080/cpms/index.html#/urlSuffix\">alarmType</a>查看。<br>" +
+                "请前往<a href=\"requestJumpPath/urlSuffix\">alarmType</a>查看。<br>" +
                 "<p align=\"right\">date</p>" +
                 "<div style=\"width:700px;margin:0 auto;\">" +
                 "<div style=\"padding:10px 10px 0;border-top:1px solid #ccc;color:#747474;margin-bottom:20px;line-height:1.3em;font-size:12px;\">" +
@@ -713,7 +717,8 @@ public class TSpecdevAllTask extends BaseController {
         String five = four.replaceFirst("warningContent", warningContent);
         String six = five.replaceFirst("urlSuffix", urlSuffix);
         String seven = six.replaceFirst("alarmType", alarmType);
-        String result = seven.replaceFirst("date", String.valueOf(new Date()));
+        String eight = seven.replace("requestJumpPath", this.ruoyiConfig.getRequestJumpPath());
+        String result = eight.replaceFirst("date", String.valueOf(new Date()));
         prime = prime + result;
         //拼接html
         String html = start + prime + end;

+ 3 - 1
master/src/main/resources/application.yml

@@ -10,6 +10,8 @@ ruoyi:
   demoEnabled: true
   # 文件路径 示例( Windows配置D:/ruoyi/uploadPath,Linux配置 /data/cpmsfile/uploadPath)
   profile: /data/cpmsfile/uploadPath
+  # 邮件中链接跳转路径 示例(本地:http://localhost/#,服务器:http://47.114.101.16:8080/cpms/index.html#)
+  requestJumpPath: http://47.114.101.16:8080/cpms/index.html#
   # 获取ip地址开关
   addressEnabled: false
   # 验证码类型 math 数组计算 char 字符验证
@@ -183,4 +185,4 @@ gen:
 #C:\Users\ly\.m2\repository\org\jasypt\jasypt\1.9.2>java -cp jasypt-1.9.2.jar org.jasypt.intf.cli.JasyptPBEStringEncryptionCLI input="ssy123456" password=test algorithm=PBEWithMD5AndDES
 jasypt:
   encryptor:
-    password: test
+    password: test