Просмотр исходного кода

裂解炉炉管测温 - PASS数据提交时检查温度,<1080时,弹框提醒并邮件通知主管和四个班长

wangggziwen 1 год назад
Родитель
Сommit
8e988f60fd

+ 5 - 2
master/src/main/java/com/ruoyi/common/thread/furnance/FurnanceTemperatureThread.java

@@ -24,14 +24,17 @@ public class FurnanceTemperatureThread implements Runnable {
 
     private String loginName;
 
+    private String msg;
+
     public FurnanceTemperatureThread() {}
 
-    public FurnanceTemperatureThread(IMailService mailService, TStaffmgr staffmgr, String loginName) throws PinyinException {
+    public FurnanceTemperatureThread(IMailService mailService, TStaffmgr staffmgr, String loginName, String msg) throws PinyinException {
         this.mailService = mailService;
         this.email = staffmgr.getMail();
         this.staffName = staffmgr.getName();
         this.staffNameEN = PinyinHelper.convertToPinyinString(staffName.trim(), " ", PinyinFormat.WITHOUT_TONE);
         this.loginName =  loginName;
+        this.msg = msg;
     }
 
     @Override
@@ -53,7 +56,7 @@ public class FurnanceTemperatureThread implements Runnable {
                 "<font color=\"#333333\" style=\"line-height: 20px; \"><font style=\"line-height: 22px; \" size=\"4\">" +
                 "亲爱的staffName</font><br><font style=\"line-height: 22px; \" size=\"4\">" +
                 "Dear staffNameEN(loginName)</font></font></h2>" +
-                "<p>裂解炉炉管测温COIL数值异常,请及时查看。<br>" +
+                "<p>裂解炉炉管测温COIL数值异常," + msg + "请及时查看。<br>" +
                 "请登录<a href=\"https://cpms.basf-ypc.net.cn/cpms/index.html#jumpUrl\">CPMS管理系统</a>查看。<br>" +
                 "Please log in the <a href=\"https://cpms.basf-ypc.net.cn/cpms/index.html#jumpUrl\">CPMS</a> to handle it.</p>" +
                 "<p align=\"right\">date</p>" +

+ 1 - 1
master/src/main/java/com/ruoyi/framework/task/FurnanceTask.java

@@ -355,7 +355,7 @@ public class FurnanceTask extends BaseController {
                     String dictValue = sysDictData.getDictValue();
                     TStaffmgr staffmgr = staffmgrService.selectTStaffmgrByStaffId(dictValue);
                     SysUser sysUser = userService.selectUserByStaffId(dictValue);
-                    FurnanceTemperatureThread mailThread = new FurnanceTemperatureThread(mailService, staffmgr, sysUser.getUserName());
+                    FurnanceTemperatureThread mailThread = new FurnanceTemperatureThread(mailService, staffmgr, sysUser.getUserName(), "");
                     Thread thread = new Thread(mailThread);
                     thread.start();
                 }

+ 163 - 3
master/src/main/java/com/ruoyi/project/production/controller/TFurnanceTemperatureController.java

@@ -6,11 +6,22 @@ import java.util.ArrayList;
 import java.util.Date;
 import java.util.List;
 
+import com.github.stuxuhai.jpinyin.PinyinException;
+import com.ruoyi.common.sendEmail.IMailService;
+import com.ruoyi.common.thread.furnance.FurnancePressureThread;
+import com.ruoyi.common.thread.furnance.FurnanceTemperatureThread;
 import com.ruoyi.common.utils.StringUtils;
+import com.ruoyi.project.plant.domain.TStaffmgr;
+import com.ruoyi.project.plant.service.ITStaffmgrService;
+import com.ruoyi.project.production.controller.vo.FurnancePressureFvpVO;
 import com.ruoyi.project.production.controller.vo.FurnanceSummaryVO;
 import com.ruoyi.project.production.controller.vo.FurnanceTemperatureVO;
 import com.ruoyi.project.production.domain.TFurnanceTemperature;
 import com.ruoyi.project.production.service.ITFurnancePressureService;
+import com.ruoyi.project.system.domain.SysDictData;
+import com.ruoyi.project.system.domain.SysUser;
+import com.ruoyi.project.system.service.ISysDictTypeService;
+import com.ruoyi.project.system.service.ISysUserService;
 import org.springframework.security.access.prepost.PreAuthorize;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.web.bind.annotation.GetMapping;
@@ -45,6 +56,18 @@ public class TFurnanceTemperatureController extends BaseController
     @Autowired
     private ITFurnancePressureService tFurnancePressureService;
 
+    @Autowired
+    private ISysDictTypeService iSysDictTypeService;
+
+    @Autowired
+    private IMailService mailService;
+
+    @Autowired
+    private ITStaffmgrService staffmgrService;
+
+    @Autowired
+    private ISysUserService userService;
+
     /**
      * 裂解炉测温列表Summary(APP)
      */
@@ -1318,15 +1341,50 @@ public class TFurnanceTemperatureController extends BaseController
     @PreAuthorize("@ss.hasPermi('production:temperature:edit')")
     @Log(title = "裂解炉炉管测温", businessType = BusinessType.UPDATE)
     @PutMapping("/editWeb")
-    public AjaxResult editWeb(@RequestBody TFurnanceTemperature tFurnanceTemperature)
-    {
+    public AjaxResult editWeb(@RequestBody TFurnanceTemperature tFurnanceTemperature) throws PinyinException {
         String status = tFurnanceTemperature.getStatus();
         // 烧焦状态不检查
         if (!"2".equals(status)) {
+            String message = "";
+            String furnanceName = tFurnanceTemperature.getFurnanceName();
+            switch (furnanceName) {
+                case "H109":
+                    message = this.checkTemperature109(tFurnanceTemperature);
+                    break;
+                case "H110":
+                case "H111":
+                case "H112":
+                case "H113":
+                case "H114":
+                case "H115":
+                case "H116":
+                case "H117":
+                case "H118":
+                    message = this.checkTemperature10x(tFurnanceTemperature);
+                    break;
+                case "H130":
+                    message = this.checkTemperature130(tFurnanceTemperature);
+                    break;
+            }
+            if (!"".equals(message)) {
+                message = message.substring(0, message.length() - 1);
+                message += "温度>1080,请注意处理。";
+                // 发邮件
+            String mailMsg = furnanceName + message;
+            List<SysDictData> furnanceRecipientDict = iSysDictTypeService.selectDictDataByType("FURNANCE_RECIPIENT");
+            for (SysDictData sysDictData : furnanceRecipientDict) {
+                String dictValue = sysDictData.getDictValue();
+                TStaffmgr staffmgr = staffmgrService.selectTStaffmgrByStaffId(dictValue);
+                SysUser sysUser = userService.selectUserByStaffId(dictValue);
+                FurnanceTemperatureThread mailThread = new FurnanceTemperatureThread(mailService, staffmgr, sysUser.getUserName(), mailMsg + ",");
+                Thread thread = new Thread(mailThread);
+                thread.start();
+            }
+            }
             // 检查数据是否包含负值或为Null
             String msg = this.isNegativeOrNull(tFurnanceTemperature);
             if ("".equals(msg)) {
-                return toAjax(tFurnanceTemperatureService.updateTFurnanceTemperature(tFurnanceTemperature));
+                return AjaxResult.success(message, tFurnanceTemperatureService.updateTFurnanceTemperature(tFurnanceTemperature));
             } else {
                 return AjaxResult.error("提交失败," + msg + "数据必须>=600,并且<=1300!");
             }
@@ -1335,6 +1393,108 @@ public class TFurnanceTemperatureController extends BaseController
         }
     }
 
+    public String checkTemperature10x(TFurnanceTemperature furnanceTemperature) {
+        String msg = "";
+        String pass1 = furnanceTemperature.getPass1();
+        String pass2 = furnanceTemperature.getPass2();
+        String pass3 = furnanceTemperature.getPass3();
+        String pass4 = furnanceTemperature.getPass4();
+        String pass5 = furnanceTemperature.getPass5();
+        String pass6 = furnanceTemperature.getPass6();
+        String pass7 = furnanceTemperature.getPass7();
+        String pass8 = furnanceTemperature.getPass8();
+        if (this.isGreaterThan1080(pass1)) {msg += "PASS1、";}
+        if (this.isGreaterThan1080(pass2)) {msg += "PASS2、";}
+        if (this.isGreaterThan1080(pass3)) {msg += "PASS3、";}
+        if (this.isGreaterThan1080(pass4)) {msg += "PASS4、";}
+        if (this.isGreaterThan1080(pass5)) {msg += "PASS5、";}
+        if (this.isGreaterThan1080(pass6)) {msg += "PASS6、";}
+        if (this.isGreaterThan1080(pass7)) {msg += "PASS7、";}
+        if (this.isGreaterThan1080(pass8)) {msg += "PASS8、";}
+        return msg;
+    }
+    public String checkTemperature109(TFurnanceTemperature furnanceTemperature) {
+        String msg = "";
+        String pass1 = furnanceTemperature.getPass1();
+        String pass2 = furnanceTemperature.getPass2();
+        String pass3 = furnanceTemperature.getPass3();
+        String pass4 = furnanceTemperature.getPass4();
+        String pass5 = furnanceTemperature.getPass5();
+        String pass6 = furnanceTemperature.getPass6();
+        String pass7 = furnanceTemperature.getPass7();
+        String pass8 = furnanceTemperature.getPass8();
+        String pass9 = furnanceTemperature.getPass9();
+        String pass10 = furnanceTemperature.getPass10();
+        String pass11 = furnanceTemperature.getPass11();
+        String pass12 = furnanceTemperature.getPass12();
+        String pass13 = furnanceTemperature.getPass13();
+        String pass14 = furnanceTemperature.getPass14();
+        String pass15 = furnanceTemperature.getPass15();
+        String pass16 = furnanceTemperature.getPass16();
+        if (this.isGreaterThan1080(pass1)) {msg += "PASS1出口左、";}
+        if (this.isGreaterThan1080(pass2)) {msg += "PASS1出口右、";}
+        if (this.isGreaterThan1080(pass3)) {msg += "PASS2出口左、";}
+        if (this.isGreaterThan1080(pass4)) {msg += "PASS2出口右、";}
+        if (this.isGreaterThan1080(pass5)) {msg += "PASS3出口左、";}
+        if (this.isGreaterThan1080(pass6)) {msg += "PASS3出口右、";}
+        if (this.isGreaterThan1080(pass7)) {msg += "PASS4出口左、";}
+        if (this.isGreaterThan1080(pass8)) {msg += "PASS4出口右、";}
+        if (this.isGreaterThan1080(pass9)) {msg += "PASS5出口左、";}
+        if (this.isGreaterThan1080(pass10)) {msg += "PASS5出口右、";}
+        if (this.isGreaterThan1080(pass11)) {msg += "PASS6出口左、";}
+        if (this.isGreaterThan1080(pass12)) {msg += "PASS6出口右、";}
+        if (this.isGreaterThan1080(pass13)) {msg += "PASS7出口左、";}
+        if (this.isGreaterThan1080(pass14)) {msg += "PASS7出口右、";}
+        if (this.isGreaterThan1080(pass15)) {msg += "PASS8出口左、";}
+        if (this.isGreaterThan1080(pass16)) {msg += "PASS8出口右、";}
+        return msg;
+    }
+    public String checkTemperature130(TFurnanceTemperature furnanceTemperature) {
+        String msg = "";
+        String pass1 = furnanceTemperature.getPass1();
+        String pass2 = furnanceTemperature.getPass2();
+        String pass3 = furnanceTemperature.getPass3();
+        String pass4 = furnanceTemperature.getPass4();
+        String pass5 = furnanceTemperature.getPass5();
+        String pass6 = furnanceTemperature.getPass6();
+        String pass7 = furnanceTemperature.getPass7();
+        String pass8 = furnanceTemperature.getPass8();
+        String pass9 = furnanceTemperature.getPass9();
+        String pass10 = furnanceTemperature.getPass10();
+        String pass11 = furnanceTemperature.getPass11();
+        String pass12 = furnanceTemperature.getPass12();
+        if (this.isGreaterThan1080(pass1)) {msg += "PASS1、";}
+        if (this.isGreaterThan1080(pass2)) {msg += "PASS2、";}
+        if (this.isGreaterThan1080(pass3)) {msg += "PASS3、";}
+        if (this.isGreaterThan1080(pass4)) {msg += "PASS4、";}
+        if (this.isGreaterThan1080(pass5)) {msg += "PASS5、";}
+        if (this.isGreaterThan1080(pass6)) {msg += "PASS6、";}
+        if (this.isGreaterThan1080(pass7)) {msg += "PASS7、";}
+        if (this.isGreaterThan1080(pass8)) {msg += "PASS8、";}
+        if (this.isGreaterThan1080(pass9)) {msg += "PASS9、";}
+        if (this.isGreaterThan1080(pass10)) {msg += "PASS10、";}
+        if (this.isGreaterThan1080(pass11)) {msg += "PASS11、";}
+        if (this.isGreaterThan1080(pass12)) {msg += "PASS12、";}
+        return msg;
+    }
+
+    public boolean isGreaterThan1080(String pass) {
+        boolean flag = false;
+        if (StringUtils.isNotNull(pass) && StringUtils.isNotEmpty(pass)) {
+            String[] split = pass.split(",");
+            for (int i = 0; i < split.length; i++) {
+                if (!StringUtils.isNull(split[i]) && !StringUtils.isEmpty(split[i])) {
+                    int element = Integer.parseInt(split[i]);
+                    if (element >= 1080) {
+                        flag = true;
+                        break;
+                    }
+                }
+            }
+        }
+        return flag;
+    }
+
     public String isNegativeOrNull(TFurnanceTemperature tFurnanceTemperature) {
         String pass1 = tFurnanceTemperature.getPass1();
         String pass2 = tFurnanceTemperature.getPass2();

+ 1 - 1
ui/src/views/production/temperature/h109.vue

@@ -694,7 +694,7 @@
             if (this.form.id != null) {
               updateTemperature(this.form).then(response => {
                 if (response.code == 200) {
-                  this.msgSuccess("修改成功");
+                  this.msgSuccess("修改成功" + response.msg);
                   this.open = false;
                   this.getList();
                 } else {

+ 1 - 1
ui/src/views/production/temperature/h110.vue

@@ -566,7 +566,7 @@
             if (this.form.id != null) {
               updateTemperature(this.form).then(response => {
                 if (response.code == 200) {
-                  this.msgSuccess("修改成功");
+                  this.msgSuccess("修改成功" + response.msg);
                   this.open = false;
                   this.getList();
                 } else {

+ 1 - 1
ui/src/views/production/temperature/h111.vue

@@ -566,7 +566,7 @@
             if (this.form.id != null) {
               updateTemperature(this.form).then(response => {
                 if (response.code == 200) {
-                  this.msgSuccess("修改成功");
+                  this.msgSuccess("修改成功" + response.msg);
                   this.open = false;
                   this.getList();
                 } else {

+ 1 - 1
ui/src/views/production/temperature/h112.vue

@@ -566,7 +566,7 @@
             if (this.form.id != null) {
               updateTemperature(this.form).then(response => {
                 if (response.code == 200) {
-                  this.msgSuccess("修改成功");
+                  this.msgSuccess("修改成功" + response.msg);
                   this.open = false;
                   this.getList();
                 } else {

+ 1 - 1
ui/src/views/production/temperature/h113.vue

@@ -565,7 +565,7 @@
             if (this.form.id != null) {
               updateTemperature(this.form).then(response => {
                 if (response.code == 200) {
-                  this.msgSuccess("修改成功");
+                  this.msgSuccess("修改成功" + response.msg);
                   this.open = false;
                   this.getList();
                 } else {

+ 1 - 1
ui/src/views/production/temperature/h114.vue

@@ -566,7 +566,7 @@
             if (this.form.id != null) {
               updateTemperature(this.form).then(response => {
                 if (response.code == 200) {
-                  this.msgSuccess("修改成功");
+                  this.msgSuccess("修改成功" + response.msg);
                   this.open = false;
                   this.getList();
                 } else {

+ 1 - 1
ui/src/views/production/temperature/h115.vue

@@ -566,7 +566,7 @@
             if (this.form.id != null) {
               updateTemperature(this.form).then(response => {
                 if (response.code == 200) {
-                  this.msgSuccess("修改成功");
+                  this.msgSuccess("修改成功" + response.msg);
                   this.open = false;
                   this.getList();
                 } else {

+ 1 - 1
ui/src/views/production/temperature/h116.vue

@@ -566,7 +566,7 @@
             if (this.form.id != null) {
               updateTemperature(this.form).then(response => {
                 if (response.code == 200) {
-                  this.msgSuccess("修改成功");
+                  this.msgSuccess("修改成功" + response.msg);
                   this.open = false;
                   this.getList();
                 } else {

+ 1 - 1
ui/src/views/production/temperature/h117.vue

@@ -566,7 +566,7 @@
             if (this.form.id != null) {
               updateTemperature(this.form).then(response => {
                 if (response.code == 200) {
-                  this.msgSuccess("修改成功");
+                  this.msgSuccess("修改成功" + response.msg);
                   this.open = false;
                   this.getList();
                 } else {

+ 1 - 1
ui/src/views/production/temperature/h118.vue

@@ -566,7 +566,7 @@
             if (this.form.id != null) {
               updateTemperature(this.form).then(response => {
                 if (response.code == 200) {
-                  this.msgSuccess("修改成功");
+                  this.msgSuccess("修改成功" + response.msg);
                   this.open = false;
                   this.getList();
                 } else {

+ 1 - 1
ui/src/views/production/temperature/h130.vue

@@ -630,7 +630,7 @@
             if (this.form.id != null) {
               updateTemperature(this.form).then(response => {
                 if (response.code == 200) {
-                  this.msgSuccess("修改成功");
+                  this.msgSuccess("修改成功" + response.msg);
                   this.open = false;
                   this.getList();
                 } else {