|
@@ -1,5 +1,6 @@
|
|
|
package com.ruoyi.project.apply.controller;
|
|
package com.ruoyi.project.apply.controller;
|
|
|
|
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
import com.deepoove.poi.XWPFTemplate;
|
|
import com.deepoove.poi.XWPFTemplate;
|
|
|
import com.deepoove.poi.data.Pictures;
|
|
import com.deepoove.poi.data.Pictures;
|
|
|
import com.deepoove.poi.data.TextRenderData;
|
|
import com.deepoove.poi.data.TextRenderData;
|
|
@@ -76,27 +77,51 @@ public class TApplySafetychangeController extends BaseController {
|
|
|
@PreAuthorize("@ss.hasPermi('apply:safetychange:list')")
|
|
@PreAuthorize("@ss.hasPermi('apply:safetychange:list')")
|
|
|
@GetMapping("/list")
|
|
@GetMapping("/list")
|
|
|
public TableDataInfo list(TApplySafetychange tApplySafetychange) {
|
|
public TableDataInfo list(TApplySafetychange tApplySafetychange) {
|
|
|
- startPage();
|
|
|
|
|
- List<TApplySafetychange> list = tApplySafetychangeService.selectTApplySafetychangeList(tApplySafetychange);
|
|
|
|
|
- return getDataTable(list);
|
|
|
|
|
|
|
+ logger.info("======================查询组织保护措施状态变更申请列表:{}", JSON.toJSONString(tApplySafetychange));
|
|
|
|
|
+ try {
|
|
|
|
|
+ startPage();
|
|
|
|
|
+ List<TApplySafetychange> list = tApplySafetychangeService.selectTApplySafetychangeList(tApplySafetychange);
|
|
|
|
|
+ return getDataTable(list);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ logger.error("查询组织保护措施状态变更申请列表异常:{}", e.getMessage());
|
|
|
|
|
+ return getDataTable(new java.util.ArrayList<>());
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/listChangeDescribe")
|
|
@GetMapping("/listChangeDescribe")
|
|
|
public AjaxResult listChangeDescribe(TApplySafetychange tApplySafetychange) {
|
|
public AjaxResult listChangeDescribe(TApplySafetychange tApplySafetychange) {
|
|
|
- List<TApplySafetychange> list = tApplySafetychangeService.selectChangeDescribe(tApplySafetychange);
|
|
|
|
|
- return AjaxResult.success(list);
|
|
|
|
|
|
|
+ logger.info("======================查询变更描述列表:{}", JSON.toJSONString(tApplySafetychange));
|
|
|
|
|
+ try {
|
|
|
|
|
+ List<TApplySafetychange> list = tApplySafetychangeService.selectChangeDescribe(tApplySafetychange);
|
|
|
|
|
+ return AjaxResult.success(list);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ logger.error("查询变更描述列表异常:{}", e.getMessage());
|
|
|
|
|
+ return AjaxResult.error("查询失败");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/listChangeReason")
|
|
@GetMapping("/listChangeReason")
|
|
|
public AjaxResult listChangeReason(TApplySafetychange tApplySafetychange) {
|
|
public AjaxResult listChangeReason(TApplySafetychange tApplySafetychange) {
|
|
|
- List<TApplySafetychange> list = tApplySafetychangeService.selectChangeReason(tApplySafetychange);
|
|
|
|
|
- return AjaxResult.success(list);
|
|
|
|
|
|
|
+ logger.info("======================查询变更原因列表:{}", JSON.toJSONString(tApplySafetychange));
|
|
|
|
|
+ try {
|
|
|
|
|
+ List<TApplySafetychange> list = tApplySafetychangeService.selectChangeReason(tApplySafetychange);
|
|
|
|
|
+ return AjaxResult.success(list);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ logger.error("查询变更原因列表异常:{}", e.getMessage());
|
|
|
|
|
+ return AjaxResult.error("查询失败");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@GetMapping("/listSAFA")
|
|
@GetMapping("/listSAFA")
|
|
|
public AjaxResult listSAFA(TApplySafetychange tApplySafetychange) {
|
|
public AjaxResult listSAFA(TApplySafetychange tApplySafetychange) {
|
|
|
- List<TApplySafetychange> list = tApplySafetychangeService.selectSAFA(tApplySafetychange);
|
|
|
|
|
- return AjaxResult.success(list);
|
|
|
|
|
|
|
+ logger.info("======================查询SAFA列表:{}", JSON.toJSONString(tApplySafetychange));
|
|
|
|
|
+ try {
|
|
|
|
|
+ List<TApplySafetychange> list = tApplySafetychangeService.selectSAFA(tApplySafetychange);
|
|
|
|
|
+ return AjaxResult.success(list);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ logger.error("查询SAFA列表异常:{}", e.getMessage());
|
|
|
|
|
+ return AjaxResult.error("查询失败");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@@ -107,9 +132,15 @@ public class TApplySafetychangeController extends BaseController {
|
|
|
@Log(title = "组织保护措施状态变更申请", businessType = BusinessType.EXPORT)
|
|
@Log(title = "组织保护措施状态变更申请", businessType = BusinessType.EXPORT)
|
|
|
@PutMapping("/export")
|
|
@PutMapping("/export")
|
|
|
public AjaxResult export(@RequestBody TApplySafetychange tApplySafetychange) {
|
|
public AjaxResult export(@RequestBody TApplySafetychange tApplySafetychange) {
|
|
|
- List<TApplySafetychange> list = tApplySafetychangeService.selectTApplySafetychangeList(tApplySafetychange);
|
|
|
|
|
- ExcelUtil<TApplySafetychange> util = new ExcelUtil<TApplySafetychange>(TApplySafetychange.class);
|
|
|
|
|
- return util.exportExcel(list, "safetychange");
|
|
|
|
|
|
|
+ logger.info("======================导出组织保护措施状态变更申请列表:{}", JSON.toJSONString(tApplySafetychange));
|
|
|
|
|
+ try {
|
|
|
|
|
+ List<TApplySafetychange> list = tApplySafetychangeService.selectTApplySafetychangeList(tApplySafetychange);
|
|
|
|
|
+ ExcelUtil<TApplySafetychange> util = new ExcelUtil<TApplySafetychange>(TApplySafetychange.class);
|
|
|
|
|
+ return util.exportExcel(list, "safetychange");
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ logger.error("导出组织保护措施状态变更申请列表异常:{}", e.getMessage());
|
|
|
|
|
+ return AjaxResult.error("导出失败");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -118,7 +149,13 @@ public class TApplySafetychangeController extends BaseController {
|
|
|
// @PreAuthorize("@ss.hasPermi('apply:safetychange:query')")
|
|
// @PreAuthorize("@ss.hasPermi('apply:safetychange:query')")
|
|
|
@GetMapping(value = "/{id}")
|
|
@GetMapping(value = "/{id}")
|
|
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
|
public AjaxResult getInfo(@PathVariable("id") Long id) {
|
|
|
- return AjaxResult.success(tApplySafetychangeService.selectTApplySafetychangeById(id));
|
|
|
|
|
|
|
+ logger.info("======================获取组织保护措施状态变更申请详细信息,id:{}", id);
|
|
|
|
|
+ try {
|
|
|
|
|
+ return AjaxResult.success(tApplySafetychangeService.selectTApplySafetychangeById(id));
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ logger.error("获取组织保护措施状态变更申请详细信息异常:{}", e.getMessage());
|
|
|
|
|
+ return AjaxResult.error("获取详细信息失败");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -129,38 +166,40 @@ public class TApplySafetychangeController extends BaseController {
|
|
|
@RepeatSubmit
|
|
@RepeatSubmit
|
|
|
@PostMapping
|
|
@PostMapping
|
|
|
public AjaxResult add(@RequestBody TApplySafetychange tApplySafetychange) {
|
|
public AjaxResult add(@RequestBody TApplySafetychange tApplySafetychange) {
|
|
|
- String userId = getUserId().toString();
|
|
|
|
|
- for (String s : tApplySafetychange.getLockNo().split(",")) {
|
|
|
|
|
- TApplyLock tApplyLock = tApplyLockService.selectTApplyLockByLockCode(s.substring(0, s.indexOf("(")));
|
|
|
|
|
- if (tApplyLock!=null) {
|
|
|
|
|
- if (tApplyLock.getStatus() == 1 || tApplyLock.getStatus() == 2) {
|
|
|
|
|
- return AjaxResult.error("该锁不可用。");
|
|
|
|
|
|
|
+ logger.info("======================新增组织保护措施状态变更申请:{}", JSON.toJSONString(tApplySafetychange));
|
|
|
|
|
+ try {
|
|
|
|
|
+ String userId = getUserId().toString();
|
|
|
|
|
+ for (String s : tApplySafetychange.getLockNo().split(",")) {
|
|
|
|
|
+ TApplyLock tApplyLock = tApplyLockService.selectTApplyLockByLockCode(s.substring(0, s.indexOf("(")));
|
|
|
|
|
+ if (tApplyLock!=null) {
|
|
|
|
|
+ if (tApplyLock.getStatus() == 1 || tApplyLock.getStatus() == 2) {
|
|
|
|
|
+ return AjaxResult.error("该锁不可用。");
|
|
|
|
|
+ }
|
|
|
|
|
+ //修改锁状态
|
|
|
|
|
+ tApplyLock.setStatus(1L);
|
|
|
|
|
+ tApplyLockService.updateTApplyLock(tApplyLock);
|
|
|
}
|
|
}
|
|
|
- //修改锁状态
|
|
|
|
|
- tApplyLock.setStatus(1L);
|
|
|
|
|
- tApplyLockService.updateTApplyLock(tApplyLock);
|
|
|
|
|
}
|
|
}
|
|
|
- }
|
|
|
|
|
- tApplySafetychange.setApplicant(userId);
|
|
|
|
|
- tApplySafetychange.setApplicantName(getNickName());
|
|
|
|
|
- tApplySafetychange.setApplicationTime(new Date());
|
|
|
|
|
- tApplySafetychange.setCreatedate(new Date());
|
|
|
|
|
- tApplySafetychange.setCreaterCode(getUserId().toString());
|
|
|
|
|
- String safaerIds = tApplySafetychange.getSafaer();
|
|
|
|
|
- tApplySafetychange.setSafaer(null);
|
|
|
|
|
- // tApplySafetychange.setConfirmer(tApplySafetychange.getSafaer());
|
|
|
|
|
|
|
+ tApplySafetychange.setApplicant(userId);
|
|
|
|
|
+ tApplySafetychange.setApplicantName(getNickName());
|
|
|
|
|
+ tApplySafetychange.setApplicationTime(new Date());
|
|
|
|
|
+ tApplySafetychange.setCreatedate(new Date());
|
|
|
|
|
+ tApplySafetychange.setCreaterCode(getUserId().toString());
|
|
|
|
|
+ String safaerIds = tApplySafetychange.getSafaer();
|
|
|
|
|
+ tApplySafetychange.setSafaer(null);
|
|
|
|
|
+ // tApplySafetychange.setConfirmer(tApplySafetychange.getSafaer());
|
|
|
// tApplySafetychange.setConfirmerName(tApplySafetychange.getSafaerName());
|
|
// tApplySafetychange.setConfirmerName(tApplySafetychange.getSafaerName());
|
|
|
- if (StringUtils.isNotEmpty(tApplySafetychange.getRemarks()) && (!tApplySafetychange.getRemarks().endsWith(";") || !tApplySafetychange.getRemarks().endsWith(";")))
|
|
|
|
|
- tApplySafetychange.setRemarks("申请人-" + getNickName() + ":" + tApplySafetychange.getRemarks() + ";");
|
|
|
|
|
- tApplySafetychangeService.insertTApplySafetychange(tApplySafetychange);
|
|
|
|
|
-
|
|
|
|
|
- // 开始申请流程
|
|
|
|
|
- tApplySafetychange.setApNo(DateUtils.dateTimeNow() + userId);
|
|
|
|
|
- long businessKey = tApplySafetychange.getId();
|
|
|
|
|
- //开始工作流、监听
|
|
|
|
|
- Authentication.setAuthenticatedUserId(userId);//设置当前申请人
|
|
|
|
|
- Map<String, Object> variables = new HashMap<>();
|
|
|
|
|
- variables.put("applyuser", userId);
|
|
|
|
|
|
|
+ if (StringUtils.isNotEmpty(tApplySafetychange.getRemarks()) && (!tApplySafetychange.getRemarks().endsWith(";") || !tApplySafetychange.getRemarks().endsWith(";")))
|
|
|
|
|
+ tApplySafetychange.setRemarks("申请人-" + getNickName() + ":" + tApplySafetychange.getRemarks() + ";");
|
|
|
|
|
+ tApplySafetychangeService.insertTApplySafetychange(tApplySafetychange);
|
|
|
|
|
+
|
|
|
|
|
+ // 开始申请流程
|
|
|
|
|
+ tApplySafetychange.setApNo(DateUtils.dateTimeNow() + userId);
|
|
|
|
|
+ long businessKey = tApplySafetychange.getId();
|
|
|
|
|
+ //开始工作流、监听
|
|
|
|
|
+ Authentication.setAuthenticatedUserId(userId);//设置当前申请人
|
|
|
|
|
+ Map<String, Object> variables = new HashMap<>();
|
|
|
|
|
+ variables.put("applyuser", userId);
|
|
|
// StringBuilder confirmer = new StringBuilder();
|
|
// StringBuilder confirmer = new StringBuilder();
|
|
|
// for (String staffId : safaerIds.split(",")) {
|
|
// for (String staffId : safaerIds.split(",")) {
|
|
|
// SysUser user = userService.selectUserByStaffId(staffId);
|
|
// SysUser user = userService.selectUserByStaffId(staffId);
|
|
@@ -169,151 +208,96 @@ public class TApplySafetychangeController extends BaseController {
|
|
|
// if (StringUtils.isNotEmpty(confirmer.toString())) {
|
|
// if (StringUtils.isNotEmpty(confirmer.toString())) {
|
|
|
// confirmer = new StringBuilder(confirmer.substring(0, confirmer.length() - 1));
|
|
// confirmer = new StringBuilder(confirmer.substring(0, confirmer.length() - 1));
|
|
|
// }
|
|
// }
|
|
|
- variables.put("confirmer", safaerIds);
|
|
|
|
|
- variables.put("resetConfirmer2", safaerIds);
|
|
|
|
|
- variables.put("executor", tApplySafetychange.getExecutor());
|
|
|
|
|
- variables.put("safaer", safaerIds);
|
|
|
|
|
- //查询经理
|
|
|
|
|
- TStaffmgr tStaffmgr = new TStaffmgr();
|
|
|
|
|
- tStaffmgr.setActualposts("24,26");
|
|
|
|
|
- StringBuilder approvers = new StringBuilder();
|
|
|
|
|
- for (SysUser user : userService.selectUserPost(tStaffmgr)) {
|
|
|
|
|
- approvers.append(user.getUserId().toString()).append(",");
|
|
|
|
|
- }
|
|
|
|
|
- if (StringUtils.isNotEmpty(approvers.toString())) {
|
|
|
|
|
- approvers = new StringBuilder(approvers.substring(0, approvers.length() - 1));
|
|
|
|
|
- }
|
|
|
|
|
- variables.put("approver", approvers.toString());
|
|
|
|
|
- tStaffmgr = new TStaffmgr();
|
|
|
|
|
- tStaffmgr.setActualposts("12");
|
|
|
|
|
- StringBuilder changeExecutors = new StringBuilder();
|
|
|
|
|
- for (SysUser user : userService.selectUserPost(tStaffmgr)) {
|
|
|
|
|
- changeExecutors.append(user.getUserId().toString()).append(",");
|
|
|
|
|
- }
|
|
|
|
|
- if (StringUtils.isNotEmpty(changeExecutors.toString())) {
|
|
|
|
|
- changeExecutors = new StringBuilder(changeExecutors.substring(0, changeExecutors.length() - 1));
|
|
|
|
|
|
|
+ variables.put("confirmer", safaerIds);
|
|
|
|
|
+ variables.put("resetConfirmer2", safaerIds);
|
|
|
|
|
+ variables.put("executor", tApplySafetychange.getExecutor());
|
|
|
|
|
+ variables.put("safaer", safaerIds);
|
|
|
|
|
+ //查询经理
|
|
|
|
|
+ TStaffmgr tStaffmgr = new TStaffmgr();
|
|
|
|
|
+ tStaffmgr.setActualposts("24,26");
|
|
|
|
|
+ StringBuilder approvers = new StringBuilder();
|
|
|
|
|
+ for (SysUser user : userService.selectUserPost(tStaffmgr)) {
|
|
|
|
|
+ approvers.append(user.getUserId().toString()).append(",");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isNotEmpty(approvers.toString())) {
|
|
|
|
|
+ approvers = new StringBuilder(approvers.substring(0, approvers.length() - 1));
|
|
|
|
|
+ }
|
|
|
|
|
+ variables.put("approver", approvers.toString());
|
|
|
|
|
+ tStaffmgr = new TStaffmgr();
|
|
|
|
|
+ tStaffmgr.setActualposts("12");
|
|
|
|
|
+ StringBuilder changeExecutors = new StringBuilder();
|
|
|
|
|
+ for (SysUser user : userService.selectUserPost(tStaffmgr)) {
|
|
|
|
|
+ changeExecutors.append(user.getUserId().toString()).append(",");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isNotEmpty(changeExecutors.toString())) {
|
|
|
|
|
+ changeExecutors = new StringBuilder(changeExecutors.substring(0, changeExecutors.length() - 1));
|
|
|
|
|
+ }
|
|
|
|
|
+ variables.put("changeExecutor", changeExecutors.toString());
|
|
|
|
|
+ variables.put("changeNextTaskListener", new ChangeNextTaskListener());
|
|
|
|
|
+ variables.put("changeMgrListener", new ChangeMgrListener());
|
|
|
|
|
+ variables.put("changeEndFailListener", new ChangeEndFailListener());
|
|
|
|
|
+ variables.put("changeEndSuccessListener", new ChangeEndSuccessListener());
|
|
|
|
|
+ variables.put("changeFlowListener", new ChangeFlowListener());
|
|
|
|
|
+ //采用key来启动流程定义并设置流程变量,返回流程实例
|
|
|
|
|
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("safetychange", String.valueOf(businessKey), variables);
|
|
|
|
|
+ logger.info("流程定义id:" + pi.getProcessDefinitionId());
|
|
|
|
|
+ logger.info("流程实例id:" + pi.getProcessInstanceId());
|
|
|
|
|
+ tApplySafetychange.setProcessId(pi.getProcessInstanceId());
|
|
|
|
|
+ tApplySafetychangeService.updateTApplySafetychange(tApplySafetychange);
|
|
|
|
|
+
|
|
|
|
|
+ // 申请人申请直接通过
|
|
|
|
|
+ ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
|
|
|
|
|
+ TaskService taskService = processEngine.getTaskService();
|
|
|
|
|
+ Task task = taskService.createTaskQuery().processInstanceId(pi.getProcessInstanceId()).active().singleResult();
|
|
|
|
|
+ String taskId = task.getId();
|
|
|
|
|
+ processEngine.getTaskService().claim(taskId, getUserId().toString());
|
|
|
|
|
+ taskService.addComment(taskId, pi.getProcessInstanceId(), "");
|
|
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
|
|
+ param.put("condition", "1");
|
|
|
|
|
+ taskService.complete(taskId, param);
|
|
|
|
|
+ return toAjax(1);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ logger.error("组织保护措施申请流程添加失败:{}", e.getMessage());
|
|
|
}
|
|
}
|
|
|
- variables.put("changeExecutor", changeExecutors.toString());
|
|
|
|
|
- variables.put("changeNextTaskListener", new ChangeNextTaskListener());
|
|
|
|
|
- variables.put("changeMgrListener", new ChangeMgrListener());
|
|
|
|
|
- variables.put("changeEndFailListener", new ChangeEndFailListener());
|
|
|
|
|
- variables.put("changeEndSuccessListener", new ChangeEndSuccessListener());
|
|
|
|
|
- variables.put("changeFlowListener", new ChangeFlowListener());
|
|
|
|
|
- //采用key来启动流程定义并设置流程变量,返回流程实例
|
|
|
|
|
- ProcessInstance pi = runtimeService.startProcessInstanceByKey("safetychange", String.valueOf(businessKey), variables);
|
|
|
|
|
- logger.info("流程定义id:" + pi.getProcessDefinitionId());
|
|
|
|
|
- logger.info("流程实例id:" + pi.getProcessInstanceId());
|
|
|
|
|
- tApplySafetychange.setProcessId(pi.getProcessInstanceId());
|
|
|
|
|
- tApplySafetychangeService.updateTApplySafetychange(tApplySafetychange);
|
|
|
|
|
-
|
|
|
|
|
- // 申请人申请直接通过
|
|
|
|
|
- ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
|
|
|
|
|
- TaskService taskService = processEngine.getTaskService();
|
|
|
|
|
- Task task = taskService.createTaskQuery().processInstanceId(pi.getProcessInstanceId()).active().singleResult();
|
|
|
|
|
- String taskId = task.getId();
|
|
|
|
|
- processEngine.getTaskService().claim(taskId, getUserId().toString());
|
|
|
|
|
- taskService.addComment(taskId, pi.getProcessInstanceId(), "");
|
|
|
|
|
- Map<String, Object> param = new HashMap<>();
|
|
|
|
|
- param.put("condition", "1");
|
|
|
|
|
- taskService.complete(taskId, param);
|
|
|
|
|
- return toAjax(1);
|
|
|
|
|
|
|
+ return AjaxResult.error("流程添加失败");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
@Log(title = "组织保护措施状态变更申请审核处理", businessType = BusinessType.UPDATE)
|
|
@Log(title = "组织保护措施状态变更申请审核处理", businessType = BusinessType.UPDATE)
|
|
|
@RepeatSubmit
|
|
@RepeatSubmit
|
|
|
@PutMapping("/handle")
|
|
@PutMapping("/handle")
|
|
|
public AjaxResult handle(@RequestBody DevTask devTask) {
|
|
public AjaxResult handle(@RequestBody DevTask devTask) {
|
|
|
- TApplySafetychange form = devTask.getSafetychange();
|
|
|
|
|
- //使用任务服务完成任务(提交任务)
|
|
|
|
|
- String taskId = devTask.getTaskId();
|
|
|
|
|
- // 使用任务id,获取任务对象,获取流程实例id
|
|
|
|
|
- Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
|
|
|
|
|
- //利用任务对象,获取流程实例id
|
|
|
|
|
- String processInstancesId = task.getProcessInstanceId();
|
|
|
|
|
- TApplySafetychange tApplySafetychange = tApplySafetychangeService.selectTApplySafetychangeById(form.getId());
|
|
|
|
|
- String taskName = task.getName();//实例名
|
|
|
|
|
- // 添加备注
|
|
|
|
|
- String remarks = StringUtils.isEmpty(tApplySafetychange.getRemarks()) ? "" : tApplySafetychange.getRemarks();
|
|
|
|
|
- if (taskName.contains("安全评估人")) {
|
|
|
|
|
- taskName = "安全评估人";
|
|
|
|
|
- }
|
|
|
|
|
- //流程审批意见
|
|
|
|
|
- String symbol = "";
|
|
|
|
|
- String text = "";
|
|
|
|
|
- if (StringUtils.isNotEmpty(form.getRemarks())) {
|
|
|
|
|
- text = form.getRemarks();
|
|
|
|
|
- symbol = ",";
|
|
|
|
|
- form.setRemarks(remarks + taskName + "-" + getNickName() + ":" + form.getRemarks() + ";");
|
|
|
|
|
- } else
|
|
|
|
|
- form.setRemarks("");
|
|
|
|
|
- // 判断流程
|
|
|
|
|
- if ("1".equals(devTask.getCondition())) {
|
|
|
|
|
- devTask.setComment("通过" + symbol + text);
|
|
|
|
|
- } else if ("0".equals(devTask.getCondition())) {
|
|
|
|
|
- devTask.setComment("拒绝" + symbol + text);
|
|
|
|
|
- form.setStatus(1L);
|
|
|
|
|
- form.setApproveStatus("3");
|
|
|
|
|
- //修改锁状态
|
|
|
|
|
- for (String lockNo : tApplySafetychange.getLockNo().split(",")) {
|
|
|
|
|
- TApplyLock tApplyLock = tApplyLockService.selectTApplyLockByLockCode(lockNo.substring(0, lockNo.indexOf("(")));
|
|
|
|
|
- if (tApplyLock != null) {
|
|
|
|
|
- tApplyLock.setStatus(0L);//将锁状态改为已拆锁
|
|
|
|
|
- tApplyLockService.updateTApplyLock(tApplyLock);
|
|
|
|
|
- }
|
|
|
|
|
|
|
+ logger.info("===========================组织保护措施状态变更申请审核处理:{}", JSON.toJSONString(devTask));
|
|
|
|
|
+ try {
|
|
|
|
|
+ TApplySafetychange form = devTask.getSafetychange();
|
|
|
|
|
+ //使用任务服务完成任务(提交任务)
|
|
|
|
|
+ String taskId = devTask.getTaskId();
|
|
|
|
|
+ // 使用任务id,获取任务对象,获取流程实例id
|
|
|
|
|
+ Task task = taskService.createTaskQuery().taskId(taskId).singleResult();
|
|
|
|
|
+ //利用任务对象,获取流程实例id
|
|
|
|
|
+ String processInstancesId = task.getProcessInstanceId();
|
|
|
|
|
+ TApplySafetychange tApplySafetychange = tApplySafetychangeService.selectTApplySafetychangeById(form.getId());
|
|
|
|
|
+ String taskName = task.getName();//实例名
|
|
|
|
|
+ // 添加备注
|
|
|
|
|
+ String remarks = StringUtils.isEmpty(tApplySafetychange.getRemarks()) ? "" : tApplySafetychange.getRemarks();
|
|
|
|
|
+ if (taskName.contains("安全评估人")) {
|
|
|
|
|
+ taskName = "安全评估人";
|
|
|
}
|
|
}
|
|
|
- } else if ("2".equals(devTask.getCondition())) {
|
|
|
|
|
- devTask.setComment("驳回" + symbol + text);
|
|
|
|
|
- }
|
|
|
|
|
- // 根据实例名判断当前流程节点
|
|
|
|
|
- Map<String, Object> param = new HashMap<>();
|
|
|
|
|
- switch (task.getName()) {
|
|
|
|
|
- case "安全评估人1":
|
|
|
|
|
- form.setSafaer(getUserId().toString());
|
|
|
|
|
- form.setSafaerName(getNickName());
|
|
|
|
|
- form.setSafaTime(new Date());
|
|
|
|
|
- break;
|
|
|
|
|
- case "批准人":
|
|
|
|
|
- form.setApprover(getUserId().toString());
|
|
|
|
|
- form.setApproverName(getNickName());
|
|
|
|
|
- form.setApproveTime(new Date());
|
|
|
|
|
- if ("1".equals(devTask.getCondition()))
|
|
|
|
|
- form.setApproveStatus("2");
|
|
|
|
|
- break;
|
|
|
|
|
- case "措施执行人":
|
|
|
|
|
- form.setExecutionTime(new Date());
|
|
|
|
|
- break;
|
|
|
|
|
- case "措施确认人":
|
|
|
|
|
- form.setConfirmerName(getNickName());
|
|
|
|
|
- form.setConfirmer(getUserId().toString());
|
|
|
|
|
- form.setConfirmTime(new Date());
|
|
|
|
|
- break;
|
|
|
|
|
- case "变更执行人":
|
|
|
|
|
- form.setChangeExecutor(getUserId().toString());
|
|
|
|
|
- form.setChangeExecutorName(getNickName());
|
|
|
|
|
- form.setChangeExecutorTime(new Date());
|
|
|
|
|
- break;
|
|
|
|
|
- case "安全评估人2":
|
|
|
|
|
- TStaffmgr tStaffmgr = new TStaffmgr();
|
|
|
|
|
- tStaffmgr.setActualposts("12");
|
|
|
|
|
- StringBuilder resetConfirmer1 = new StringBuilder();
|
|
|
|
|
- for (SysUser user : userService.selectUserPost(tStaffmgr)) {
|
|
|
|
|
- resetConfirmer1.append(user.getUserId().toString()).append(",");
|
|
|
|
|
- }
|
|
|
|
|
- if (StringUtils.isNotEmpty(resetConfirmer1.toString())) {
|
|
|
|
|
- resetConfirmer1 = new StringBuilder(resetConfirmer1.substring(0, resetConfirmer1.length() - 1));
|
|
|
|
|
- }
|
|
|
|
|
- param.put("resetConfirmer1", resetConfirmer1.toString());
|
|
|
|
|
- break;
|
|
|
|
|
- case "确认人1":
|
|
|
|
|
- form.setResetConfirmer1(getUserId().toString());
|
|
|
|
|
- form.setResetConfirmTime1(new Date());
|
|
|
|
|
- form.setResetConfirmerName1(getNickName());
|
|
|
|
|
- break;
|
|
|
|
|
- case "确认人2":
|
|
|
|
|
- form.setResetConfirmer2(getUserId().toString());
|
|
|
|
|
- form.setResetConfirmTime2(new Date());
|
|
|
|
|
- form.setResetConfirmerName2(getNickName());
|
|
|
|
|
|
|
+ //流程审批意见
|
|
|
|
|
+ String symbol = "";
|
|
|
|
|
+ String text = "";
|
|
|
|
|
+ if (StringUtils.isNotEmpty(form.getRemarks())) {
|
|
|
|
|
+ text = form.getRemarks();
|
|
|
|
|
+ symbol = ",";
|
|
|
|
|
+ form.setRemarks(remarks + taskName + "-" + getNickName() + ":" + form.getRemarks() + ";");
|
|
|
|
|
+ } else
|
|
|
|
|
+ form.setRemarks("");
|
|
|
|
|
+ // 判断流程
|
|
|
|
|
+ if ("1".equals(devTask.getCondition())) {
|
|
|
|
|
+ devTask.setComment("通过" + symbol + text);
|
|
|
|
|
+ } else if ("0".equals(devTask.getCondition())) {
|
|
|
|
|
+ devTask.setComment("拒绝" + symbol + text);
|
|
|
form.setStatus(1L);
|
|
form.setStatus(1L);
|
|
|
|
|
+ form.setApproveStatus("3");
|
|
|
//修改锁状态
|
|
//修改锁状态
|
|
|
for (String lockNo : tApplySafetychange.getLockNo().split(",")) {
|
|
for (String lockNo : tApplySafetychange.getLockNo().split(",")) {
|
|
|
TApplyLock tApplyLock = tApplyLockService.selectTApplyLockByLockCode(lockNo.substring(0, lockNo.indexOf("(")));
|
|
TApplyLock tApplyLock = tApplyLockService.selectTApplyLockByLockCode(lockNo.substring(0, lockNo.indexOf("(")));
|
|
@@ -322,18 +306,83 @@ public class TApplySafetychangeController extends BaseController {
|
|
|
tApplyLockService.updateTApplyLock(tApplyLock);
|
|
tApplyLockService.updateTApplyLock(tApplyLock);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
- break;
|
|
|
|
|
|
|
+ } else if ("2".equals(devTask.getCondition())) {
|
|
|
|
|
+ devTask.setComment("驳回" + symbol + text);
|
|
|
|
|
+ }
|
|
|
|
|
+ // 根据实例名判断当前流程节点
|
|
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
|
|
+ switch (task.getName()) {
|
|
|
|
|
+ case "安全评估人1":
|
|
|
|
|
+ form.setSafaer(getUserId().toString());
|
|
|
|
|
+ form.setSafaerName(getNickName());
|
|
|
|
|
+ form.setSafaTime(new Date());
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "批准人":
|
|
|
|
|
+ form.setApprover(getUserId().toString());
|
|
|
|
|
+ form.setApproverName(getNickName());
|
|
|
|
|
+ form.setApproveTime(new Date());
|
|
|
|
|
+ if ("1".equals(devTask.getCondition()))
|
|
|
|
|
+ form.setApproveStatus("2");
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "措施执行人":
|
|
|
|
|
+ form.setExecutionTime(new Date());
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "措施确认人":
|
|
|
|
|
+ form.setConfirmerName(getNickName());
|
|
|
|
|
+ form.setConfirmer(getUserId().toString());
|
|
|
|
|
+ form.setConfirmTime(new Date());
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "变更执行人":
|
|
|
|
|
+ form.setChangeExecutor(getUserId().toString());
|
|
|
|
|
+ form.setChangeExecutorName(getNickName());
|
|
|
|
|
+ form.setChangeExecutorTime(new Date());
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "安全评估人2":
|
|
|
|
|
+ TStaffmgr tStaffmgr = new TStaffmgr();
|
|
|
|
|
+ tStaffmgr.setActualposts("12");
|
|
|
|
|
+ StringBuilder resetConfirmer1 = new StringBuilder();
|
|
|
|
|
+ for (SysUser user : userService.selectUserPost(tStaffmgr)) {
|
|
|
|
|
+ resetConfirmer1.append(user.getUserId().toString()).append(",");
|
|
|
|
|
+ }
|
|
|
|
|
+ if (StringUtils.isNotEmpty(resetConfirmer1.toString())) {
|
|
|
|
|
+ resetConfirmer1 = new StringBuilder(resetConfirmer1.substring(0, resetConfirmer1.length() - 1));
|
|
|
|
|
+ }
|
|
|
|
|
+ param.put("resetConfirmer1", resetConfirmer1.toString());
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "确认人1":
|
|
|
|
|
+ form.setResetConfirmer1(getUserId().toString());
|
|
|
|
|
+ form.setResetConfirmTime1(new Date());
|
|
|
|
|
+ form.setResetConfirmerName1(getNickName());
|
|
|
|
|
+ break;
|
|
|
|
|
+ case "确认人2":
|
|
|
|
|
+ form.setResetConfirmer2(getUserId().toString());
|
|
|
|
|
+ form.setResetConfirmTime2(new Date());
|
|
|
|
|
+ form.setResetConfirmerName2(getNickName());
|
|
|
|
|
+ form.setStatus(1L);
|
|
|
|
|
+ //修改锁状态
|
|
|
|
|
+ for (String lockNo : tApplySafetychange.getLockNo().split(",")) {
|
|
|
|
|
+ TApplyLock tApplyLock = tApplyLockService.selectTApplyLockByLockCode(lockNo.substring(0, lockNo.indexOf("(")));
|
|
|
|
|
+ if (tApplyLock != null) {
|
|
|
|
|
+ tApplyLock.setStatus(0L);//将锁状态改为已拆锁
|
|
|
|
|
+ tApplyLockService.updateTApplyLock(tApplyLock);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ break;
|
|
|
|
|
+ }
|
|
|
|
|
+ param.put("condition", devTask.getCondition());
|
|
|
|
|
+ ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
|
|
|
|
|
+ TaskService taskService = processEngine.getTaskService();
|
|
|
|
|
+ //认领任务
|
|
|
|
|
+ processEngine.getTaskService().claim(taskId, getUserId().toString());
|
|
|
|
|
+ taskService.addComment(taskId, processInstancesId, devTask.getComment());
|
|
|
|
|
+ taskService.complete(taskId, param);
|
|
|
|
|
+ // 更新任务
|
|
|
|
|
+ tApplySafetychangeService.updateTApplySafetychange(form);
|
|
|
|
|
+ return AjaxResult.success();
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ logger.error("处理组织保护措施状态变更申请异常:{}", e.getMessage());
|
|
|
}
|
|
}
|
|
|
- param.put("condition", devTask.getCondition());
|
|
|
|
|
- ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
|
|
|
|
|
- TaskService taskService = processEngine.getTaskService();
|
|
|
|
|
- //认领任务
|
|
|
|
|
- processEngine.getTaskService().claim(taskId, getUserId().toString());
|
|
|
|
|
- taskService.addComment(taskId, processInstancesId, devTask.getComment());
|
|
|
|
|
- taskService.complete(taskId, param);
|
|
|
|
|
- // 更新任务
|
|
|
|
|
- tApplySafetychangeService.updateTApplySafetychange(form);
|
|
|
|
|
- return AjaxResult.success();
|
|
|
|
|
|
|
+ return AjaxResult.error("处理失败");
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -343,9 +392,15 @@ public class TApplySafetychangeController extends BaseController {
|
|
|
@Log(title = "组织保护措施状态变更申请", businessType = BusinessType.UPDATE)
|
|
@Log(title = "组织保护措施状态变更申请", businessType = BusinessType.UPDATE)
|
|
|
@PutMapping
|
|
@PutMapping
|
|
|
public AjaxResult edit(@RequestBody TApplySafetychange tApplySafetychange) {
|
|
public AjaxResult edit(@RequestBody TApplySafetychange tApplySafetychange) {
|
|
|
- tApplySafetychange.setUpdatedate(new Date());
|
|
|
|
|
- tApplySafetychange.setUpdaterCode(getUserId());
|
|
|
|
|
- return toAjax(tApplySafetychangeService.updateTApplySafetychange(tApplySafetychange));
|
|
|
|
|
|
|
+ logger.info("======================修改组织保护措施状态变更申请:{}", JSON.toJSONString(tApplySafetychange));
|
|
|
|
|
+ try {
|
|
|
|
|
+ tApplySafetychange.setUpdatedate(new Date());
|
|
|
|
|
+ tApplySafetychange.setUpdaterCode(getUserId());
|
|
|
|
|
+ return toAjax(tApplySafetychangeService.updateTApplySafetychange(tApplySafetychange));
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ logger.error("修改组织保护措施状态变更申请异常:{}", e.getMessage());
|
|
|
|
|
+ return AjaxResult.error("修改失败");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -355,7 +410,13 @@ public class TApplySafetychangeController extends BaseController {
|
|
|
@Log(title = "组织保护措施状态变更申请", businessType = BusinessType.DELETE)
|
|
@Log(title = "组织保护措施状态变更申请", businessType = BusinessType.DELETE)
|
|
|
@DeleteMapping("/{ids}")
|
|
@DeleteMapping("/{ids}")
|
|
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
|
public AjaxResult remove(@PathVariable Long[] ids) {
|
|
|
- return toAjax(tApplySafetychangeService.deleteTApplySafetychangeByIds(ids));
|
|
|
|
|
|
|
+ logger.info("======================删除组织保护措施状态变更申请,ids:{}", JSON.toJSONString(ids));
|
|
|
|
|
+ try {
|
|
|
|
|
+ return toAjax(tApplySafetychangeService.deleteTApplySafetychangeByIds(ids));
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ logger.error("删除组织保护措施状态变更申请异常:{}", e.getMessage());
|
|
|
|
|
+ return AjaxResult.error("删除失败");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -364,10 +425,16 @@ public class TApplySafetychangeController extends BaseController {
|
|
|
* @throws IOException
|
|
* @throws IOException
|
|
|
*/
|
|
*/
|
|
|
@GetMapping("/wordView/{id}")
|
|
@GetMapping("/wordView/{id}")
|
|
|
- public AjaxResult wordView(@PathVariable Long id) throws IOException {
|
|
|
|
|
- //根据ID查询并生成
|
|
|
|
|
- String url = PreView(id);
|
|
|
|
|
- return AjaxResult.success(url);
|
|
|
|
|
|
|
+ public AjaxResult wordView(@PathVariable Long id) {
|
|
|
|
|
+ logger.info("======================生成Word文档预览,id:{}", id);
|
|
|
|
|
+ try {
|
|
|
|
|
+ //根据ID查询并生成
|
|
|
|
|
+ String url = PreView(id);
|
|
|
|
|
+ return AjaxResult.success(url);
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ logger.error("生成Word文档预览异常:{}", e.getMessage());
|
|
|
|
|
+ return AjaxResult.error("生成Word文档失败");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|