|
@@ -1,6 +1,10 @@
|
|
|
package com.ruoyi.project.production.controller;
|
|
|
|
|
|
import com.alibaba.fastjson.JSON;
|
|
|
+import com.github.stuxuhai.jpinyin.PinyinException;
|
|
|
+import com.ruoyi.common.sendEmail.IMailService;
|
|
|
+import com.ruoyi.common.thread.Trainning.MeetingInvitationMailThread;
|
|
|
+import com.ruoyi.common.thread.sai.SaiApplyMailThread;
|
|
|
import com.ruoyi.common.utils.DateUtils;
|
|
|
import com.ruoyi.common.utils.file.ExcelUtils;
|
|
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
|
@@ -11,6 +15,8 @@ import com.ruoyi.framework.web.controller.BaseController;
|
|
|
import com.ruoyi.framework.web.domain.AjaxResult;
|
|
|
import com.ruoyi.framework.web.page.TableDataInfo;
|
|
|
import com.ruoyi.project.approve.damain.DevTask;
|
|
|
+import com.ruoyi.project.plant.domain.TStaffmgr;
|
|
|
+import com.ruoyi.project.plant.service.ITStaffmgrService;
|
|
|
import com.ruoyi.project.process.domain.TMoc;
|
|
|
import com.ruoyi.project.production.controller.vo.SaiApplyExportVO;
|
|
|
import com.ruoyi.project.production.domain.TSaiApply;
|
|
@@ -20,11 +26,13 @@ import com.ruoyi.project.production.service.ITSaiApproveFileService;
|
|
|
import com.ruoyi.project.sems.domain.TApproverFile;
|
|
|
import com.ruoyi.project.system.domain.SysDept;
|
|
|
import com.ruoyi.project.system.domain.SysDictData;
|
|
|
+import com.ruoyi.project.system.domain.SysMessage;
|
|
|
import com.ruoyi.project.system.domain.SysUser;
|
|
|
import com.ruoyi.project.system.mapper.SysDeptMapper;
|
|
|
import com.ruoyi.project.system.mapper.SysUserMapper;
|
|
|
import com.ruoyi.project.system.service.ISysDeptService;
|
|
|
import com.ruoyi.project.system.service.ISysDictTypeService;
|
|
|
+import com.ruoyi.project.system.service.ISysMessageService;
|
|
|
import com.ruoyi.project.system.service.ISysUserService;
|
|
|
import org.activiti.engine.ProcessEngine;
|
|
|
import org.activiti.engine.ProcessEngines;
|
|
@@ -42,7 +50,10 @@ import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
+import javax.validation.constraints.Email;
|
|
|
+import javax.validation.constraints.Size;
|
|
|
import java.io.IOException;
|
|
|
+import java.sql.Array;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
|
|
@@ -77,6 +88,15 @@ public class TSaiApplyController extends BaseController
|
|
|
@Autowired
|
|
|
private ITSaiApproveFileService saiApproveFileService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private ITStaffmgrService staffmgrService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ISysMessageService sysMessageService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IMailService mailService;
|
|
|
+
|
|
|
/**
|
|
|
* 查询SAI开项管理列表
|
|
|
*/
|
|
@@ -417,7 +437,7 @@ public class TSaiApplyController extends BaseController
|
|
|
@Log(title = "SAI开项管理申请处理", businessType = BusinessType.UPDATE)
|
|
|
@RepeatSubmit
|
|
|
@PutMapping("/handle")
|
|
|
- public AjaxResult handle(@RequestBody DevTask devTask) {
|
|
|
+ public AjaxResult handle(@RequestBody DevTask devTask) throws PinyinException {
|
|
|
//更新数据
|
|
|
TSaiApply form = devTask.getSaiApply();
|
|
|
//使用任务服务完成任务(提交任务)
|
|
@@ -496,6 +516,7 @@ public class TSaiApplyController extends BaseController
|
|
|
.claim(taskId, getUserId().toString());
|
|
|
taskService.addComment(taskId, processInstancesId, devTask.getComment());
|
|
|
taskService.complete(taskId, param);
|
|
|
+ Task nextHandlerTask = null;
|
|
|
// 标记taskId、TaskName
|
|
|
if (nextHandler != null) {
|
|
|
List<Task> list = processEngine.getTaskService()//获取任务service
|
|
@@ -505,6 +526,39 @@ public class TSaiApplyController extends BaseController
|
|
|
if (form.getProcessId().equals(t.getProcessInstanceId())) {
|
|
|
form.setTaskId(t.getId());
|
|
|
form.setTaskName(t.getName());
|
|
|
+ nextHandlerTask = t;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ if (nextHandler != null) {
|
|
|
+ String[] split = null;
|
|
|
+ if (nextHandler.indexOf(",") != -1) {
|
|
|
+ split = nextHandler.split(",");
|
|
|
+ } else {
|
|
|
+ split = new String[1];
|
|
|
+ split[0] = nextHandler;
|
|
|
+ }
|
|
|
+ for (int i = 0; i < split.length; i++) {
|
|
|
+ if (!split[i].equals("20276")) { // 张力飞不发邮件
|
|
|
+ SysUser sysUser = userService.selectUserById(Long.parseLong(split[i]));
|
|
|
+ String staffId = sysUser.getStaffId();
|
|
|
+ String loginName = sysUser.getUserName();
|
|
|
+ TStaffmgr staffmgr = staffmgrService.selectTStaffmgrByStaffId(staffId);
|
|
|
+ String staffName = staffmgr.getName();
|
|
|
+ String email = sysUser.getEmail();
|
|
|
+ if (email != null) {
|
|
|
+ // 系统通知
|
|
|
+ SysMessage message = new SysMessage();
|
|
|
+ message.setUserId(Long.parseLong(split[i]));
|
|
|
+ message.setMsgTitle("您有一条系统消息");
|
|
|
+ message.setMsgContent("您有一条SAI开项申请消息待查看");
|
|
|
+ // 发送邮件
|
|
|
+// email = "lihui@seashoreept.com";
|
|
|
+ SaiApplyMailThread saiApplyMailThread = new SaiApplyMailThread(
|
|
|
+ mailService, sysMessageService, message, email, nextHandlerTask, form, staffName, loginName);
|
|
|
+ Thread thread = new Thread(saiApplyMailThread);
|
|
|
+ thread.start();
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|