Browse Source

SAI - 整改负责人/验证人下拉添加人员字典配置
生产日报 - 上传生产日报时,如果上传的文件是当天的,邮件提醒相关人员日报已更新
EOEG SAI - 移除台账搜索栏“不安全状态”/“不安全行为”下拉列表

wangggziwen 1 tháng trước cách đây
mục cha
commit
25ee5a131b

+ 71 - 0
master/src/main/java/com/ruoyi/common/thread/dailyProductionReport/DailyProductionReportMailThread.java

@@ -0,0 +1,71 @@
+package com.ruoyi.common.thread.dailyProductionReport;
+
+import com.github.stuxuhai.jpinyin.PinyinException;
+import com.github.stuxuhai.jpinyin.PinyinFormat;
+import com.github.stuxuhai.jpinyin.PinyinHelper;
+import com.ruoyi.common.sendEmail.IMailService;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+/**
+ * 生产日报邮件通知线程
+ *
+ */
+public class DailyProductionReportMailThread implements Runnable {
+
+    private IMailService mailService;
+    private String email;
+    private String staffName;
+    private String staffNameEN;
+    private String loginName;
+
+    public DailyProductionReportMailThread() {}
+
+    public DailyProductionReportMailThread(IMailService mailService, String email, String staffName, String loginName) throws PinyinException {
+        this.mailService = mailService;
+        this.email = email;
+        this.staffName = staffName;
+        this.staffNameEN = PinyinHelper.convertToPinyinString(staffName.trim(), " ", PinyinFormat.WITHOUT_TONE);
+        this.loginName =  loginName;
+    }
+
+    @Override
+    public void run() {
+        this.sendMail();
+    }
+
+    private void sendMail() {
+        String jumpUrl = "/production/daily";
+        //写html开始内容
+        String start = "<!DOCTYPE html><html><head><meta charset=\"utf-8\"><title></title></head><body><div style=\"background-color:#ECECEC; padding: 35px;\">" +
+                "<table cellpadding=\"0\" align=\"center\"" +
+                "style=\"width: 600px; margin: 0px auto; text-align: left; position: relative; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 5px; border-bottom-left-radius: 5px; font-size: 14px; font-family:微软雅黑, 黑体; line-height: 1.5; box-shadow: rgb(153, 153, 153) 0px 0px 5px; border-collapse: collapse; background-position: initial initial; background-repeat: initial initial;background:#fff;\">" +
+                "<tbody><tr><th valign=\"middle\" style=\"height: 25px; line-height: 25px; padding: 15px 35px; border-bottom-width: 1px; border-bottom-style: solid; border-bottom-color: #42a3d3; background-color: #49bcff; border-top-left-radius: 5px; border-top-right-radius: 5px; border-bottom-right-radius: 0px; border-bottom-left-radius: 0px;\">" +
+                "<font face=\"微软雅黑\" size=\"5\" style=\"color: rgb(255, 255, 255); \">CPMS管理系统 </font><font face=\"微软雅黑\" size=\"3\" style=\"color: rgb(255, 255, 255); \">CPMS System</font></th></tr>";
+        //表html中间内容
+        String prime = "";
+        String center = "<tr><td><div style=\"padding:25px 35px 40px; background-color:#fff;\"><h2 style=\"margin: 5px 0px; \">" +
+                "<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>当日生产日报已上传。<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>" +
+                "<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;\">" +
+                "<p>此为系统邮件,请勿回复<br>This e-Mail is an automatic reminder sent by CPMS, please do not reply</p>" +
+                "</div></div></div></td></tr>";
+        String one = center.replaceFirst("staffName", staffName);
+        String two = one.replaceFirst("staffNameEN", staffNameEN);
+        String three = two.replaceFirst("loginName", loginName);
+        String result = three.replaceFirst("date", String.valueOf(new Date())).replaceFirst("jumpUrl",jumpUrl).replaceFirst("jumpUrl",jumpUrl);
+        prime = prime + result;
+        //写html结尾内容
+        String end = "</tbody></table></div></body></html>";
+        //拼接html
+        String html = start + prime + end;
+        mailService.sendHtmlMail(email, "CPMS:当日生产日报已上传", html);
+    }
+}

+ 16 - 2
master/src/main/java/com/ruoyi/project/plant/controller/TStaffmgrController.java

@@ -140,7 +140,14 @@ public class TStaffmgrController extends BaseController {
     @PreAuthorize("@ss.hasPermi('plant:staffmgr:list')")
     @GetMapping("/listSaiExecutors")
     public AjaxResult listSaiExecutors() {
-        return AjaxResult.success(tStaffmgrService.selectSaiExecutors());
+        List<TStaffmgr> tStaffmgrs = tStaffmgrService.selectSaiExecutors();
+        // 添加字典配置的人员
+        List<SysDictData> dictDataList = iSysDictTypeService.selectDictDataByType("SAI_EXECUTOR_INSPECTOR");
+        for (SysDictData sysDictData : dictDataList) {
+            TStaffmgr staffmgr = tStaffmgrService.selectTStaffmgrByStaffId(sysDictData.getDictValue());
+            tStaffmgrs.add(staffmgr);
+        }
+        return AjaxResult.success(tStaffmgrs);
     }
 
     @GetMapping("/listStaffmgrByActualposts")
@@ -154,7 +161,14 @@ public class TStaffmgrController extends BaseController {
     @PreAuthorize("@ss.hasPermi('plant:staffmgr:list')")
     @GetMapping("/listSaiInspectors")
     public AjaxResult listSaiInspectors() {
-        return AjaxResult.success(tStaffmgrService.selectSaiInspectors());
+        List<TStaffmgr> tStaffmgrs = tStaffmgrService.selectSaiInspectors();
+        // 添加字典配置的人员
+        List<SysDictData> dictDataList = iSysDictTypeService.selectDictDataByType("SAI_EXECUTOR_INSPECTOR");
+        for (SysDictData sysDictData : dictDataList) {
+            TStaffmgr staffmgr = tStaffmgrService.selectTStaffmgrByStaffId(sysDictData.getDictValue());
+            tStaffmgrs.add(staffmgr);
+        }
+        return AjaxResult.success(tStaffmgrs);
     }
 
     /**

+ 43 - 0
master/src/main/java/com/ruoyi/project/production/service/impl/TDailyProductionReportServiceImpl.java

@@ -3,12 +3,22 @@ package com.ruoyi.project.production.service.impl;
 import java.io.IOException;
 import java.math.BigDecimal;
 import java.math.RoundingMode;
+import java.text.SimpleDateFormat;
 import java.util.Date;
 import java.util.List;
 
+import com.ruoyi.common.sendEmail.IMailService;
+import com.ruoyi.common.thread.dailyProductionReport.DailyProductionReportMailThread;
+import com.ruoyi.project.plant.domain.TStaffmgr;
+import com.ruoyi.project.plant.service.ITStaffmgrService;
 import com.ruoyi.project.production.controller.vo.DailyAnalysisDataVO;
 import com.ruoyi.project.production.mapper.TMonthlyProductionReportMapper;
 import com.ruoyi.project.production.service.impl.thread.SyncAfterDailyUpdateThread;
+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.ISysMessageService;
+import com.ruoyi.project.system.service.ISysUserService;
 import org.apache.poi.ss.usermodel.*;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
@@ -32,6 +42,18 @@ public class TDailyProductionReportServiceImpl implements ITDailyProductionRepor
     @Autowired
     private TMonthlyProductionReportMapper tMonthlyProductionReportMapper;
 
+    @Autowired
+    private ISysDictTypeService iSysDictTypeService;
+
+    @Autowired
+    private ITStaffmgrService staffmgrService;
+
+    @Autowired
+    private ISysUserService userService;
+
+    @Autowired
+    private IMailService mailService;
+
     /**
      * 查询日期最新的每日生产报告
      *
@@ -829,6 +851,27 @@ public class TDailyProductionReportServiceImpl implements ITDailyProductionRepor
                         this.tMonthlyProductionReportMapper
                 );
                 syncAfterDailyUpdateThread.run();
+
+                SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+                if (sdf.format(new Date()).equals(sdf.format(reportDate))) {// 如果上传的文件是当天的
+                    // 邮件提醒相关人员日报已更新
+                    List<SysDictData> dictDataList = iSysDictTypeService.selectDictDataByType("DAILY_PRODUCTION_MAIL");
+                    for (SysDictData sysDictData : dictDataList) {
+                        String userId = sysDictData.getDictValue();
+                        SysUser sysUser = userService.selectUserById(Long.parseLong(userId));
+                        String staffId = sysUser.getStaffId();
+                        String loginName = sysUser.getUserName();
+                        TStaffmgr staffmgr = staffmgrService.selectTStaffmgrByStaffId(staffId);
+                        String staffName = staffmgr.getName();
+                        String email = sysUser.getEmail();
+                        if (email != null) {
+                            // 发送邮件
+                            DailyProductionReportMailThread mailThread = new DailyProductionReportMailThread(mailService, email, staffName, loginName);
+                            Thread thread = new Thread(mailThread);
+                            thread.start();
+                        }
+                    }
+                }
             }
         } catch (Exception e) {
             message = "导入失败,请联系管理员!";

+ 20 - 20
ui/src/views/production/eoegapply/all/index.vue

@@ -51,26 +51,26 @@
           </el-select>
         </el-form-item>
       </el-form-item>
-      <el-form-item label="不安全状态" prop="unsafeStatus">
-        <el-select v-model="queryParams.unsafeStatus" placeholder="请选择不安全状态" clearable>
-          <el-option
-            v-for="dict in unsafeStatusOptions"
-            :key="dict.dictValue"
-            :label="dict.dictLabel"
-            :value="dict.dictValue"
-          ></el-option>
-        </el-select>
-      </el-form-item>
-      <el-form-item label="不安全行为" prop="unsafeAction">
-        <el-select v-model="queryParams.unsafeAction" placeholder="请选择不安全行为" clearable>
-          <el-option
-            v-for="dict in unsafeActionOptions"
-            :key="dict.dictValue"
-            :label="dict.dictLabel"
-            :value="dict.dictValue"
-          ></el-option>
-        </el-select>
-      </el-form-item>
+      <!--<el-form-item label="不安全状态" prop="unsafeStatus">-->
+        <!--<el-select v-model="queryParams.unsafeStatus" placeholder="请选择不安全状态" clearable>-->
+          <!--<el-option-->
+            <!--v-for="dict in unsafeStatusOptions"-->
+            <!--:key="dict.dictValue"-->
+            <!--:label="dict.dictLabel"-->
+            <!--:value="dict.dictValue"-->
+          <!--&gt;</el-option>-->
+        <!--</el-select>-->
+      <!--</el-form-item>-->
+      <!--<el-form-item label="不安全行为" prop="unsafeAction">-->
+        <!--<el-select v-model="queryParams.unsafeAction" placeholder="请选择不安全行为" clearable>-->
+          <!--<el-option-->
+            <!--v-for="dict in unsafeActionOptions"-->
+            <!--:key="dict.dictValue"-->
+            <!--:label="dict.dictLabel"-->
+            <!--:value="dict.dictValue"-->
+          <!--&gt;</el-option>-->
+        <!--</el-select>-->
+      <!--</el-form-item>-->
       <el-form-item label="申请状态" prop="applyStatus">
         <el-select v-model="applyStatusString" placeholder="请选择申请状态" multiple>
           <el-option

+ 20 - 20
ui/src/views/production/eoegapply/mine/index.vue

@@ -51,26 +51,26 @@
           </el-select>
         </el-form-item>
       </el-form-item>
-      <el-form-item label="不安全状态" prop="unsafeStatus">
-        <el-select v-model="queryParams.unsafeStatus" placeholder="请选择不安全状态" clearable>
-          <el-option
-            v-for="dict in unsafeStatusOptions"
-            :key="dict.dictValue"
-            :label="dict.dictLabel"
-            :value="dict.dictValue"
-          ></el-option>
-        </el-select>
-      </el-form-item>
-      <el-form-item label="不安全行为" prop="unsafeAction">
-        <el-select v-model="queryParams.unsafeAction" placeholder="请选择不安全行为" clearable>
-          <el-option
-            v-for="dict in unsafeActionOptions"
-            :key="dict.dictValue"
-            :label="dict.dictLabel"
-            :value="dict.dictValue"
-          ></el-option>
-        </el-select>
-      </el-form-item>
+      <!--<el-form-item label="不安全状态" prop="unsafeStatus">-->
+        <!--<el-select v-model="queryParams.unsafeStatus" placeholder="请选择不安全状态" clearable>-->
+          <!--<el-option-->
+            <!--v-for="dict in unsafeStatusOptions"-->
+            <!--:key="dict.dictValue"-->
+            <!--:label="dict.dictLabel"-->
+            <!--:value="dict.dictValue"-->
+          <!--&gt;</el-option>-->
+        <!--</el-select>-->
+      <!--</el-form-item>-->
+      <!--<el-form-item label="不安全行为" prop="unsafeAction">-->
+        <!--<el-select v-model="queryParams.unsafeAction" placeholder="请选择不安全行为" clearable>-->
+          <!--<el-option-->
+            <!--v-for="dict in unsafeActionOptions"-->
+            <!--:key="dict.dictValue"-->
+            <!--:label="dict.dictLabel"-->
+            <!--:value="dict.dictValue"-->
+          <!--&gt;</el-option>-->
+        <!--</el-select>-->
+      <!--</el-form-item>-->
       <el-form-item label="申请状态" prop="applyStatus">
         <el-select v-model="queryParams.applyStatus" placeholder="请选择申请状态">
           <el-option

+ 20 - 20
ui/src/views/production/eoegapply/pending/index.vue

@@ -51,26 +51,26 @@
           </el-select>
         </el-form-item>
       </el-form-item>
-      <el-form-item label="不安全状态" prop="unsafeStatus">
-        <el-select v-model="queryParams.unsafeStatus" placeholder="请选择不安全状态" clearable>
-          <el-option
-            v-for="dict in unsafeStatusOptions"
-            :key="dict.dictValue"
-            :label="dict.dictLabel"
-            :value="dict.dictValue"
-          ></el-option>
-        </el-select>
-      </el-form-item>
-      <el-form-item label="不安全行为" prop="unsafeAction">
-        <el-select v-model="queryParams.unsafeAction" placeholder="请选择不安全行为" clearable>
-          <el-option
-            v-for="dict in unsafeActionOptions"
-            :key="dict.dictValue"
-            :label="dict.dictLabel"
-            :value="dict.dictValue"
-          ></el-option>
-        </el-select>
-      </el-form-item>
+      <!--<el-form-item label="不安全状态" prop="unsafeStatus">-->
+        <!--<el-select v-model="queryParams.unsafeStatus" placeholder="请选择不安全状态" clearable>-->
+          <!--<el-option-->
+            <!--v-for="dict in unsafeStatusOptions"-->
+            <!--:key="dict.dictValue"-->
+            <!--:label="dict.dictLabel"-->
+            <!--:value="dict.dictValue"-->
+          <!--&gt;</el-option>-->
+        <!--</el-select>-->
+      <!--</el-form-item>-->
+      <!--<el-form-item label="不安全行为" prop="unsafeAction">-->
+        <!--<el-select v-model="queryParams.unsafeAction" placeholder="请选择不安全行为" clearable>-->
+          <!--<el-option-->
+            <!--v-for="dict in unsafeActionOptions"-->
+            <!--:key="dict.dictValue"-->
+            <!--:label="dict.dictLabel"-->
+            <!--:value="dict.dictValue"-->
+          <!--&gt;</el-option>-->
+        <!--</el-select>-->
+      <!--</el-form-item>-->
       <el-form-item label="申请状态" prop="applyStatus">
         <el-select v-model="queryParams.applyStatus" placeholder="请选择申请状态">
           <el-option