|
@@ -0,0 +1,785 @@
|
|
|
+package com.ruoyi.project.pssr.controller;
|
|
|
+
|
|
|
+import com.ruoyi.common.utils.StringUtils;
|
|
|
+import com.ruoyi.framework.aspectj.lang.annotation.Log;
|
|
|
+import com.ruoyi.framework.aspectj.lang.enums.BusinessType;
|
|
|
+import com.ruoyi.framework.web.controller.BaseController;
|
|
|
+import com.ruoyi.framework.web.domain.AjaxResult;
|
|
|
+import com.ruoyi.project.pssr.domain.*;
|
|
|
+import com.ruoyi.project.pssr.service.*;
|
|
|
+import org.activiti.engine.*;
|
|
|
+import org.activiti.engine.impl.identity.Authentication;
|
|
|
+import org.activiti.engine.runtime.ProcessInstance;
|
|
|
+import org.activiti.engine.task.Task;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
+import org.springframework.web.bind.annotation.PutMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.*;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/pssr/safety")
|
|
|
+public class TPssrSafetyController extends BaseController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private RuntimeService runtimeService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private HistoryService historyService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ITPssrSafetyBleedService tPssrSafetyBleedService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ITPssrSafetyBreathService tPssrSafetyBreathService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ITPssrSafetyBrustService tPssrSafetyBrustService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ITPssrSafetyFlamearresterService tPssrSafetyFlamearresterService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ITPssrSafetyValveService tPssrSafetyValveService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ITPssrApproveService tPssrApproveService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ITPssrSubcontentService tPssrSubcontentService;
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 确认安全设施-泄放阀
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('pssr:safetyBleed:edit')")
|
|
|
+ @Log(title = "安全设施-泄放阀", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping("/confirmBleed")
|
|
|
+ public AjaxResult confirmBleed(@RequestBody TPssrSafetyBleed tPssrSafetyBleed) {
|
|
|
+ long queryStatus = 0;
|
|
|
+ long approveStatus = 0;
|
|
|
+ Date date = null;
|
|
|
+ TPssrSafetyBleed bleed = new TPssrSafetyBleed();
|
|
|
+ if (tPssrSafetyBleed.getTaskType() == 4) {
|
|
|
+ //确认人1确认
|
|
|
+ queryStatus = 1;
|
|
|
+ approveStatus = 3;
|
|
|
+ bleed.setConfirmer1(getUserId().toString());
|
|
|
+ date = new Date();
|
|
|
+ } else if (tPssrSafetyBleed.getTaskType() == 5) {
|
|
|
+ //确认人2确认
|
|
|
+ queryStatus = 3;
|
|
|
+ approveStatus = 2;
|
|
|
+ bleed.setConfirmer2(getUserId().toString());
|
|
|
+ date = new Date();
|
|
|
+ }
|
|
|
+ if (tPssrSafetyBleed.getIds() != null && tPssrSafetyBleed.getIds().length > 0) {
|
|
|
+ for (Long id : tPssrSafetyBleed.getIds()) {
|
|
|
+ bleed = tPssrSafetyBleedService.selectTPssrSafetyBleedById(id);
|
|
|
+ if (bleed.getConfirmationTime() == null) {
|
|
|
+ bleed.setConfirmationTime(new Date());
|
|
|
+ }
|
|
|
+ bleed.setApproveStatus(approveStatus);
|
|
|
+ bleed.setUpdatedate(new Date());
|
|
|
+ bleed.setUpdaterCode(String.valueOf(getUserId()));
|
|
|
+ tPssrSafetyBleedService.updateTPssrSafetyBleed(bleed);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ bleed.setSubId(tPssrSafetyBleed.getSubId());
|
|
|
+ bleed.setApproveStatus(queryStatus);
|
|
|
+ for (TPssrSafetyBleed safetyBleed : tPssrSafetyBleedService.selectTPssrSafetyBleedList(bleed)) {
|
|
|
+ if (safetyBleed.getConfirmationTime() == null) {
|
|
|
+ safetyBleed.setConfirmationTime(new Date());
|
|
|
+ }
|
|
|
+ safetyBleed.setApproveStatus(2L);
|
|
|
+ safetyBleed.setUpdatedate(new Date());
|
|
|
+ safetyBleed.setUpdaterCode(String.valueOf(getUserId()));
|
|
|
+ tPssrSafetyBleedService.updateTPssrSafetyBleed(safetyBleed);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询当前待审批的确认人
|
|
|
+ TPssrSafetyBleed entity = new TPssrSafetyBleed();
|
|
|
+ entity.setSubId(tPssrSafetyBleed.getSubId());
|
|
|
+ entity.setApproveStatus(queryStatus);
|
|
|
+ TPssrSafetyBleed safetyBleed = tPssrSafetyBleedService.selectAllConfirmedPersonBySubId(entity);
|
|
|
+ if (safetyBleed != null) {
|
|
|
+ //如果当前用户还有待审批任务
|
|
|
+ if (tPssrSafetyBleed.getTaskType() == 4 && StringUtils.isNotEmpty(safetyBleed.getConfirmer1())) {
|
|
|
+ if (safetyBleed.getConfirmer1().contains(getUserId().toString())) {
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (tPssrSafetyBleed.getTaskType() == 5 && StringUtils.isNotEmpty(safetyBleed.getConfirmer2())) {
|
|
|
+ if (safetyBleed.getConfirmer2().contains(getUserId().toString())) {
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //无待审批任务结束当前用户流程
|
|
|
+ TPssrApprove approve = new TPssrApprove();
|
|
|
+ approve.setSubId(tPssrSafetyBleed.getSubId());
|
|
|
+ // 因为流程关系所以approve一定会有且只有一条数据
|
|
|
+ TPssrApprove tPssrApprove = tPssrApproveService.selectTPssrApproveList(approve).get(0);
|
|
|
+ TPssrApproveController.handleConfirmApprove(tPssrApprove, getUserId().toString());
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 确认安全设施-呼吸阀
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('pssr:safetyBleed:edit')")
|
|
|
+ @Log(title = "安全设施-呼吸阀", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping("/confirmBreath")
|
|
|
+ public AjaxResult confirmBreath(@RequestBody TPssrSafetyBreath tPssrSafetyBreath) {
|
|
|
+ long queryStatus = 0;
|
|
|
+ long approveStatus = 0;
|
|
|
+ Date date = null;
|
|
|
+ TPssrSafetyBreath breath = new TPssrSafetyBreath();
|
|
|
+ if (tPssrSafetyBreath.getTaskType() == 4) {
|
|
|
+ //确认人1确认
|
|
|
+ queryStatus = 1;
|
|
|
+ approveStatus = 3;
|
|
|
+ breath.setConfirmer1(getUserId().toString());
|
|
|
+ date = new Date();
|
|
|
+ } else if (tPssrSafetyBreath.getTaskType() == 5) {
|
|
|
+ //确认人2确认
|
|
|
+ queryStatus = 3;
|
|
|
+ approveStatus = 2;
|
|
|
+ breath.setConfirmer2(getUserId().toString());
|
|
|
+ date = new Date();
|
|
|
+ }
|
|
|
+ if (tPssrSafetyBreath.getIds() != null && tPssrSafetyBreath.getIds().length > 0) {
|
|
|
+ for (Long id : tPssrSafetyBreath.getIds()) {
|
|
|
+ breath = tPssrSafetyBreathService.selectTPssrSafetyBreathById(id);
|
|
|
+ if (breath.getConfirmationTime() == null) {
|
|
|
+ breath.setConfirmationTime(new Date());
|
|
|
+ }
|
|
|
+ breath.setApproveStatus(approveStatus);
|
|
|
+ breath.setUpdatedate(new Date());
|
|
|
+ breath.setUpdaterCode(String.valueOf(getUserId()));
|
|
|
+ tPssrSafetyBreathService.updateTPssrSafetyBreath(breath);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ breath.setSubId(tPssrSafetyBreath.getSubId());
|
|
|
+ breath.setApproveStatus(queryStatus);
|
|
|
+ for (TPssrSafetyBreath safetyBreath : tPssrSafetyBreathService.selectTPssrSafetyBreathList(breath)) {
|
|
|
+ if (safetyBreath.getConfirmationTime() == null) {
|
|
|
+ safetyBreath.setConfirmationTime(new Date());
|
|
|
+ }
|
|
|
+ safetyBreath.setApproveStatus(2L);
|
|
|
+ safetyBreath.setUpdatedate(new Date());
|
|
|
+ safetyBreath.setUpdaterCode(String.valueOf(getUserId()));
|
|
|
+ tPssrSafetyBreathService.updateTPssrSafetyBreath(safetyBreath);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询当前待审批的确认人
|
|
|
+ TPssrSafetyBleed entity = new TPssrSafetyBleed();
|
|
|
+ entity.setSubId(tPssrSafetyBreath.getSubId());
|
|
|
+ entity.setApproveStatus(queryStatus);
|
|
|
+ TPssrSafetyBleed safetyBreath = tPssrSafetyBleedService.selectAllConfirmedPersonBySubId(entity);
|
|
|
+ if (safetyBreath != null) {
|
|
|
+ //如果当前用户还有待审批任务
|
|
|
+ if (tPssrSafetyBreath.getTaskType() == 4 && StringUtils.isNotEmpty(safetyBreath.getConfirmer1())) {
|
|
|
+ if (safetyBreath.getConfirmer1().contains(getUserId().toString())) {
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (tPssrSafetyBreath.getTaskType() == 5 && StringUtils.isNotEmpty(safetyBreath.getConfirmer2())) {
|
|
|
+ if (safetyBreath.getConfirmer2().contains(getUserId().toString())) {
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //无待审批任务结束当前用户流程
|
|
|
+ TPssrApprove approve = new TPssrApprove();
|
|
|
+ approve.setSubId(tPssrSafetyBreath.getSubId());
|
|
|
+ // 因为流程关系所以approve一定会有且只有一条数据
|
|
|
+ TPssrApprove tPssrApprove = tPssrApproveService.selectTPssrApproveList(approve).get(0);
|
|
|
+ TPssrApproveController.handleConfirmApprove(tPssrApprove, getUserId().toString());
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 确认安全设施-爆破片
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('pssr:safetyBleed:edit')")
|
|
|
+ @Log(title = "安全设施-爆破片", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping("/confirmBrust")
|
|
|
+ public AjaxResult confirmBrust(@RequestBody TPssrSafetyBrust tPssrSafetyBrust) {
|
|
|
+ long queryStatus = 0;
|
|
|
+ long approveStatus = 0;
|
|
|
+ Date date = null;
|
|
|
+ TPssrSafetyBrust brust = new TPssrSafetyBrust();
|
|
|
+ if (tPssrSafetyBrust.getTaskType() == 4) {
|
|
|
+ //确认人1确认
|
|
|
+ queryStatus = 1;
|
|
|
+ approveStatus = 3;
|
|
|
+ brust.setConfirmer1(getUserId().toString());
|
|
|
+ date = new Date();
|
|
|
+ } else if (tPssrSafetyBrust.getTaskType() == 5) {
|
|
|
+ //确认人2确认
|
|
|
+ queryStatus = 3;
|
|
|
+ approveStatus = 2;
|
|
|
+ brust.setConfirmer2(getUserId().toString());
|
|
|
+ date = new Date();
|
|
|
+ }
|
|
|
+ if (tPssrSafetyBrust.getIds() != null && tPssrSafetyBrust.getIds().length > 0) {
|
|
|
+ for (Long id : tPssrSafetyBrust.getIds()) {
|
|
|
+ brust = tPssrSafetyBrustService.selectTPssrSafetyBrustById(id);
|
|
|
+ if (brust.getConfirmationTime() == null) {
|
|
|
+ brust.setConfirmationTime(new Date());
|
|
|
+ }
|
|
|
+ brust.setApproveStatus(approveStatus);
|
|
|
+ brust.setUpdatedate(new Date());
|
|
|
+ brust.setUpdaterCode(String.valueOf(getUserId()));
|
|
|
+ tPssrSafetyBrustService.updateTPssrSafetyBrust(brust);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ brust.setSubId(tPssrSafetyBrust.getSubId());
|
|
|
+ brust.setApproveStatus(queryStatus);
|
|
|
+ for (TPssrSafetyBrust safetyBrust : tPssrSafetyBrustService.selectTPssrSafetyBrustList(brust)) {
|
|
|
+ if (safetyBrust.getConfirmationTime() == null) {
|
|
|
+ safetyBrust.setConfirmationTime(new Date());
|
|
|
+ }
|
|
|
+ safetyBrust.setApproveStatus(2L);
|
|
|
+ safetyBrust.setUpdatedate(new Date());
|
|
|
+ safetyBrust.setUpdaterCode(String.valueOf(getUserId()));
|
|
|
+ tPssrSafetyBrustService.updateTPssrSafetyBrust(safetyBrust);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询当前待审批的确认人
|
|
|
+ TPssrSafetyBleed entity = new TPssrSafetyBleed();
|
|
|
+ entity.setSubId(tPssrSafetyBrust.getSubId());
|
|
|
+ entity.setApproveStatus(queryStatus);
|
|
|
+ TPssrSafetyBleed safetyBrust = tPssrSafetyBleedService.selectAllConfirmedPersonBySubId(entity);
|
|
|
+ if (safetyBrust != null) {
|
|
|
+ //如果当前用户还有待审批任务
|
|
|
+ if (tPssrSafetyBrust.getTaskType() == 4 && StringUtils.isNotEmpty(safetyBrust.getConfirmer1())) {
|
|
|
+ if (safetyBrust.getConfirmer1().contains(getUserId().toString())) {
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (tPssrSafetyBrust.getTaskType() == 5 && StringUtils.isNotEmpty(safetyBrust.getConfirmer2())) {
|
|
|
+ if (safetyBrust.getConfirmer2().contains(getUserId().toString())) {
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //无待审批任务结束当前用户流程
|
|
|
+ TPssrApprove approve = new TPssrApprove();
|
|
|
+ approve.setSubId(tPssrSafetyBrust.getSubId());
|
|
|
+ // 因为流程关系所以approve一定会有且只有一条数据
|
|
|
+ TPssrApprove tPssrApprove = tPssrApproveService.selectTPssrApproveList(approve).get(0);
|
|
|
+ TPssrApproveController.handleConfirmApprove(tPssrApprove, getUserId().toString());
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 确认安全设施-阻火器
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('pssr:safetyBleed:edit')")
|
|
|
+ @Log(title = "安全设施-阻火器", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping("/confirmFlamearrester")
|
|
|
+ public AjaxResult confirmFlamearrester(@RequestBody TPssrSafetyFlamearrester tPssrSafetyFlamearrester) {
|
|
|
+ long queryStatus = 0;
|
|
|
+ long approveStatus = 0;
|
|
|
+ Date date = null;
|
|
|
+ TPssrSafetyFlamearrester flamearrester = new TPssrSafetyFlamearrester();
|
|
|
+ if (tPssrSafetyFlamearrester.getTaskType() == 4) {
|
|
|
+ //确认人1确认
|
|
|
+ queryStatus = 1;
|
|
|
+ approveStatus = 3;
|
|
|
+ flamearrester.setConfirmer1(getUserId().toString());
|
|
|
+ date = new Date();
|
|
|
+ } else if (tPssrSafetyFlamearrester.getTaskType() == 5) {
|
|
|
+ //确认人2确认
|
|
|
+ queryStatus = 3;
|
|
|
+ approveStatus = 2;
|
|
|
+ flamearrester.setConfirmer2(getUserId().toString());
|
|
|
+ date = new Date();
|
|
|
+ }
|
|
|
+ if (tPssrSafetyFlamearrester.getIds() != null && tPssrSafetyFlamearrester.getIds().length > 0) {
|
|
|
+ for (Long id : tPssrSafetyFlamearrester.getIds()) {
|
|
|
+ flamearrester = tPssrSafetyFlamearresterService.selectTPssrSafetyFlamearresterById(id);
|
|
|
+ if (flamearrester.getConfirmationTime() == null) {
|
|
|
+ flamearrester.setConfirmationTime(new Date());
|
|
|
+ }
|
|
|
+ flamearrester.setApproveStatus(approveStatus);
|
|
|
+ flamearrester.setUpdatedate(new Date());
|
|
|
+ flamearrester.setUpdaterCode(String.valueOf(getUserId()));
|
|
|
+ tPssrSafetyFlamearresterService.updateTPssrSafetyFlamearrester(flamearrester);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ flamearrester.setSubId(tPssrSafetyFlamearrester.getSubId());
|
|
|
+ flamearrester.setApproveStatus(queryStatus);
|
|
|
+ for (TPssrSafetyFlamearrester safetyFlamearrester : tPssrSafetyFlamearresterService.selectTPssrSafetyFlamearresterList(flamearrester)) {
|
|
|
+ if (safetyFlamearrester.getConfirmationTime() == null) {
|
|
|
+ safetyFlamearrester.setConfirmationTime(new Date());
|
|
|
+ }
|
|
|
+ safetyFlamearrester.setApproveStatus(2L);
|
|
|
+ safetyFlamearrester.setUpdatedate(new Date());
|
|
|
+ safetyFlamearrester.setUpdaterCode(String.valueOf(getUserId()));
|
|
|
+ tPssrSafetyFlamearresterService.updateTPssrSafetyFlamearrester(safetyFlamearrester);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询当前待审批的确认人
|
|
|
+ TPssrSafetyBleed entity = new TPssrSafetyBleed();
|
|
|
+ entity.setSubId(tPssrSafetyFlamearrester.getSubId());
|
|
|
+ entity.setApproveStatus(queryStatus);
|
|
|
+ TPssrSafetyBleed safetyFlamearrester = tPssrSafetyBleedService.selectAllConfirmedPersonBySubId(entity);
|
|
|
+ if (safetyFlamearrester != null) {
|
|
|
+ //如果当前用户还有待审批任务
|
|
|
+ if (tPssrSafetyFlamearrester.getTaskType() == 4 && StringUtils.isNotEmpty(safetyFlamearrester.getConfirmer1())) {
|
|
|
+ if (safetyFlamearrester.getConfirmer1().contains(getUserId().toString())) {
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (tPssrSafetyFlamearrester.getTaskType() == 5 && StringUtils.isNotEmpty(safetyFlamearrester.getConfirmer2())) {
|
|
|
+ if (safetyFlamearrester.getConfirmer2().contains(getUserId().toString())) {
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //无待审批任务结束当前用户流程
|
|
|
+ TPssrApprove approve = new TPssrApprove();
|
|
|
+ approve.setSubId(tPssrSafetyFlamearrester.getSubId());
|
|
|
+ // 因为流程关系所以approve一定会有且只有一条数据
|
|
|
+ TPssrApprove tPssrApprove = tPssrApproveService.selectTPssrApproveList(approve).get(0);
|
|
|
+ TPssrApproveController.handleConfirmApprove(tPssrApprove, getUserId().toString());
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ /**
|
|
|
+ * 确认安全设施-安全阀
|
|
|
+ */
|
|
|
+ @PreAuthorize("@ss.hasPermi('pssr:safetyBleed:edit')")
|
|
|
+ @Log(title = "安全设施-安全阀", businessType = BusinessType.UPDATE)
|
|
|
+ @PutMapping("/confirmValve")
|
|
|
+ public AjaxResult confirmValve(@RequestBody TPssrSafetyValve tPssrSafetyValve) {
|
|
|
+ long queryStatus = 0;
|
|
|
+ long approveStatus = 0;
|
|
|
+ Date date = null;
|
|
|
+ TPssrSafetyValve valve = new TPssrSafetyValve();
|
|
|
+ if (tPssrSafetyValve.getTaskType() == 4) {
|
|
|
+ //确认人1确认
|
|
|
+ queryStatus = 1;
|
|
|
+ approveStatus = 3;
|
|
|
+ valve.setConfirmer1(getUserId().toString());
|
|
|
+ date = new Date();
|
|
|
+ } else if (tPssrSafetyValve.getTaskType() == 5) {
|
|
|
+ //确认人2确认
|
|
|
+ queryStatus = 3;
|
|
|
+ approveStatus = 2;
|
|
|
+ valve.setConfirmer2(getUserId().toString());
|
|
|
+ date = new Date();
|
|
|
+ }
|
|
|
+ if (tPssrSafetyValve.getIds() != null && tPssrSafetyValve.getIds().length > 0) {
|
|
|
+ for (Long id : tPssrSafetyValve.getIds()) {
|
|
|
+ valve = tPssrSafetyValveService.selectTPssrSafetyValveById(id);
|
|
|
+ if (valve.getConfirmationTime() == null) {
|
|
|
+ valve.setConfirmationTime(new Date());
|
|
|
+ }
|
|
|
+ valve.setApproveStatus(approveStatus);
|
|
|
+ valve.setUpdatedate(new Date());
|
|
|
+ valve.setUpdaterCode(String.valueOf(getUserId()));
|
|
|
+ tPssrSafetyValveService.updateTPssrSafetyValve(valve);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ valve.setSubId(tPssrSafetyValve.getSubId());
|
|
|
+ valve.setApproveStatus(queryStatus);
|
|
|
+ for (TPssrSafetyValve safetyValve : tPssrSafetyValveService.selectTPssrSafetyValveList(valve)) {
|
|
|
+ if (safetyValve.getConfirmationTime() == null) {
|
|
|
+ safetyValve.setConfirmationTime(new Date());
|
|
|
+ }
|
|
|
+ safetyValve.setApproveStatus(2L);
|
|
|
+ safetyValve.setUpdatedate(new Date());
|
|
|
+ safetyValve.setUpdaterCode(String.valueOf(getUserId()));
|
|
|
+ tPssrSafetyValveService.updateTPssrSafetyValve(safetyValve);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //查询当前待审批的确认人
|
|
|
+ TPssrSafetyBleed entity = new TPssrSafetyBleed();
|
|
|
+ entity.setSubId(tPssrSafetyValve.getSubId());
|
|
|
+ entity.setApproveStatus(queryStatus);
|
|
|
+ TPssrSafetyBleed safetyBleed = tPssrSafetyBleedService.selectAllConfirmedPersonBySubId(entity);
|
|
|
+ if (safetyBleed != null) {
|
|
|
+ //如果当前用户还有待审批任务
|
|
|
+ if (tPssrSafetyValve.getTaskType() == 4 && StringUtils.isNotEmpty(safetyBleed.getConfirmer1())) {
|
|
|
+ if (safetyBleed.getConfirmer1().contains(getUserId().toString())) {
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ if (tPssrSafetyValve.getTaskType() == 5 && StringUtils.isNotEmpty(safetyBleed.getConfirmer2())) {
|
|
|
+ if (safetyBleed.getConfirmer2().contains(getUserId().toString())) {
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ //无待审批任务结束当前用户流程
|
|
|
+ TPssrApprove approve = new TPssrApprove();
|
|
|
+ approve.setSubId(tPssrSafetyValve.getSubId());
|
|
|
+ // 因为流程关系所以approve一定会有且只有一条数据
|
|
|
+ TPssrApprove tPssrApprove = tPssrApproveService.selectTPssrApproveList(approve).get(0);
|
|
|
+ TPssrApproveController.handleConfirmApprove(tPssrApprove, getUserId().toString());
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 驳回泄放阀
|
|
|
+ */
|
|
|
+ @PutMapping("/turnDownBleed")
|
|
|
+ public AjaxResult turnDownBleed(@RequestBody TPssrSafetyBleed tPssrSafetyBleed) {
|
|
|
+ if (tPssrSafetyBleed.getIds() != null) {
|
|
|
+ String userId = getUserId().toString();
|
|
|
+ // 修改已选择数据的状态
|
|
|
+ for (Long id : tPssrSafetyBleed.getIds()) {
|
|
|
+ TPssrSafetyBleed blind = new TPssrSafetyBleed();
|
|
|
+ blind.setId(id);
|
|
|
+ blind.setApproveStatus(1L);
|
|
|
+ blind.setUpdatedate(new Date());
|
|
|
+ blind.setUpdaterCode(getUserId().toString());
|
|
|
+ tPssrSafetyBleedService.updateTPssrSafetyBleed(blind);
|
|
|
+ }
|
|
|
+ // 查询当前流程
|
|
|
+ TPssrApprove approve = tPssrApproveService.selectTPssrApproveBySubId(tPssrSafetyBleed.getSubId());
|
|
|
+
|
|
|
+ try {
|
|
|
+ runtimeService.deleteProcessInstance(approve.getProcessId(), "pssr2confirm");
|
|
|
+ historyService.deleteHistoricProcessInstance(approve.getProcessId());
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.info("无运行时流程");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 驳回 查询所有待审批的人员
|
|
|
+ TPssrSafetyBleed blind = new TPssrSafetyBleed();
|
|
|
+ blind.setSubId(tPssrSafetyBleed.getSubId());
|
|
|
+ blind.setApproveStatus(1L);
|
|
|
+ Set<String> confirmUsers1 = new HashSet<>();
|
|
|
+ Set<String> confirmUsers2 = new HashSet<>();
|
|
|
+ for (TPssrSafetyBleed item : tPssrSafetyBleedService.selectTPssrSafetyBleedList(blind)) {
|
|
|
+
|
|
|
+ // 确认人1
|
|
|
+ confirmUsers1.add(item.getConfirmer1());
|
|
|
+
|
|
|
+ //确认人2
|
|
|
+ confirmUsers2.add(item.getConfirmer2());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 开始申请流程
|
|
|
+ long businessKey = approve.getApproveId();
|
|
|
+ //开始工作流、监听
|
|
|
+ Authentication.setAuthenticatedUserId(userId);//设置当前申请人
|
|
|
+ Map<String, Object> variables = new HashMap<>();
|
|
|
+ variables.put("applyUser", userId);
|
|
|
+ variables.put("confirmUsers1", confirmUsers1);
|
|
|
+ variables.put("confirmUsers2", confirmUsers2);
|
|
|
+ variables.put("chargePerson", approve.getSubCharge());
|
|
|
+ //采用key来启动流程定义并设置流程变量,返回流程实例
|
|
|
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("pssr2confirm", String.valueOf(businessKey), variables);
|
|
|
+
|
|
|
+ // 修改审批表和sub表
|
|
|
+ approve.setProcessId(pi.getProcessInstanceId());
|
|
|
+ approve.setApproveStatus(1L);
|
|
|
+ approve.setUpdatedate(new Date());
|
|
|
+ approve.setUpdaterCode(getUserId().toString());
|
|
|
+ tPssrApproveService.updateTPssrApprove(approve);
|
|
|
+
|
|
|
+ TPssrSubcontent subcontent = new TPssrSubcontent();
|
|
|
+ subcontent.setId(approve.getSubId());
|
|
|
+ subcontent.setApproveStatus(1L);
|
|
|
+ subcontent.setUpdatedate(new Date());
|
|
|
+ subcontent.setUpdaterCode(getUserId().toString());
|
|
|
+ tPssrSubcontentService.updateTPssrSubcontent(subcontent);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ return AjaxResult.error();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 驳回呼吸阀
|
|
|
+ */
|
|
|
+ @PutMapping("/turnDownBreath")
|
|
|
+ public AjaxResult turnDownBreath(@RequestBody TPssrSafetyBreath tPssrSafetyBreath) {
|
|
|
+ if (tPssrSafetyBreath.getIds() != null) {
|
|
|
+ String userId = getUserId().toString();
|
|
|
+ // 修改已选择数据的状态
|
|
|
+ for (Long id : tPssrSafetyBreath.getIds()) {
|
|
|
+ TPssrSafetyBreath blind = new TPssrSafetyBreath();
|
|
|
+ blind.setId(id);
|
|
|
+ blind.setApproveStatus(1L);
|
|
|
+ blind.setUpdatedate(new Date());
|
|
|
+ blind.setUpdaterCode(getUserId().toString());
|
|
|
+ tPssrSafetyBreathService.updateTPssrSafetyBreath(blind);
|
|
|
+ }
|
|
|
+ // 查询当前流程
|
|
|
+ TPssrApprove approve = tPssrApproveService.selectTPssrApproveBySubId(tPssrSafetyBreath.getSubId());
|
|
|
+
|
|
|
+ try {
|
|
|
+ runtimeService.deleteProcessInstance(approve.getProcessId(), "pssr2confirm");
|
|
|
+ historyService.deleteHistoricProcessInstance(approve.getProcessId());
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.info("无运行时流程");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 驳回 查询所有待审批的人员
|
|
|
+ TPssrSafetyBreath blind = new TPssrSafetyBreath();
|
|
|
+ blind.setSubId(tPssrSafetyBreath.getSubId());
|
|
|
+ blind.setApproveStatus(1L);
|
|
|
+ Set<String> confirmUsers1 = new HashSet<>();
|
|
|
+ Set<String> confirmUsers2 = new HashSet<>();
|
|
|
+ for (TPssrSafetyBreath item : tPssrSafetyBreathService.selectTPssrSafetyBreathList(blind)) {
|
|
|
+
|
|
|
+ // 确认人1
|
|
|
+ confirmUsers1.add(item.getConfirmer1());
|
|
|
+
|
|
|
+ //确认人2
|
|
|
+ confirmUsers2.add(item.getConfirmer2());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 开始申请流程
|
|
|
+ long businessKey = approve.getApproveId();
|
|
|
+ //开始工作流、监听
|
|
|
+ Authentication.setAuthenticatedUserId(userId);//设置当前申请人
|
|
|
+ Map<String, Object> variables = new HashMap<>();
|
|
|
+ variables.put("applyUser", userId);
|
|
|
+ variables.put("confirmUsers1", confirmUsers1);
|
|
|
+ variables.put("confirmUsers2", confirmUsers2);
|
|
|
+ variables.put("chargePerson", approve.getSubCharge());
|
|
|
+ //采用key来启动流程定义并设置流程变量,返回流程实例
|
|
|
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("pssr2confirm", String.valueOf(businessKey), variables);
|
|
|
+
|
|
|
+ // 修改审批表和sub表
|
|
|
+ approve.setProcessId(pi.getProcessInstanceId());
|
|
|
+ approve.setApproveStatus(1L);
|
|
|
+ approve.setUpdatedate(new Date());
|
|
|
+ approve.setUpdaterCode(getUserId().toString());
|
|
|
+ tPssrApproveService.updateTPssrApprove(approve);
|
|
|
+
|
|
|
+ TPssrSubcontent subcontent = new TPssrSubcontent();
|
|
|
+ subcontent.setId(approve.getSubId());
|
|
|
+ subcontent.setApproveStatus(1L);
|
|
|
+ subcontent.setUpdatedate(new Date());
|
|
|
+ subcontent.setUpdaterCode(getUserId().toString());
|
|
|
+ tPssrSubcontentService.updateTPssrSubcontent(subcontent);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ return AjaxResult.error();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 驳回爆破片
|
|
|
+ */
|
|
|
+ @PutMapping("/turnDownBrust")
|
|
|
+ public AjaxResult turnDownBrust(@RequestBody TPssrSafetyBrust tPssrSafetyBrust) {
|
|
|
+ if (tPssrSafetyBrust.getIds() != null) {
|
|
|
+ String userId = getUserId().toString();
|
|
|
+ // 修改已选择数据的状态
|
|
|
+ for (Long id : tPssrSafetyBrust.getIds()) {
|
|
|
+ TPssrSafetyBrust blind = new TPssrSafetyBrust();
|
|
|
+ blind.setId(id);
|
|
|
+ blind.setApproveStatus(1L);
|
|
|
+ blind.setUpdatedate(new Date());
|
|
|
+ blind.setUpdaterCode(getUserId().toString());
|
|
|
+ tPssrSafetyBrustService.updateTPssrSafetyBrust(blind);
|
|
|
+ }
|
|
|
+ // 查询当前流程
|
|
|
+ TPssrApprove approve = tPssrApproveService.selectTPssrApproveBySubId(tPssrSafetyBrust.getSubId());
|
|
|
+
|
|
|
+ try {
|
|
|
+ runtimeService.deleteProcessInstance(approve.getProcessId(), "pssr2confirm");
|
|
|
+ historyService.deleteHistoricProcessInstance(approve.getProcessId());
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.info("无运行时流程");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 驳回 查询所有待审批的人员
|
|
|
+ TPssrSafetyBrust blind = new TPssrSafetyBrust();
|
|
|
+ blind.setSubId(tPssrSafetyBrust.getSubId());
|
|
|
+ blind.setApproveStatus(1L);
|
|
|
+ Set<String> confirmUsers1 = new HashSet<>();
|
|
|
+ Set<String> confirmUsers2 = new HashSet<>();
|
|
|
+ for (TPssrSafetyBrust item : tPssrSafetyBrustService.selectTPssrSafetyBrustList(blind)) {
|
|
|
+
|
|
|
+ // 确认人1
|
|
|
+ confirmUsers1.add(item.getConfirmer1());
|
|
|
+
|
|
|
+ //确认人2
|
|
|
+ confirmUsers2.add(item.getConfirmer2());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 开始申请流程
|
|
|
+ long businessKey = approve.getApproveId();
|
|
|
+ //开始工作流、监听
|
|
|
+ Authentication.setAuthenticatedUserId(userId);//设置当前申请人
|
|
|
+ Map<String, Object> variables = new HashMap<>();
|
|
|
+ variables.put("applyUser", userId);
|
|
|
+ variables.put("confirmUsers1", confirmUsers1);
|
|
|
+ variables.put("confirmUsers2", confirmUsers2);
|
|
|
+ variables.put("chargePerson", approve.getSubCharge());
|
|
|
+ //采用key来启动流程定义并设置流程变量,返回流程实例
|
|
|
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("pssr2confirm", String.valueOf(businessKey), variables);
|
|
|
+
|
|
|
+ // 修改审批表和sub表
|
|
|
+ approve.setProcessId(pi.getProcessInstanceId());
|
|
|
+ approve.setApproveStatus(1L);
|
|
|
+ approve.setUpdatedate(new Date());
|
|
|
+ approve.setUpdaterCode(getUserId().toString());
|
|
|
+ tPssrApproveService.updateTPssrApprove(approve);
|
|
|
+
|
|
|
+ TPssrSubcontent subcontent = new TPssrSubcontent();
|
|
|
+ subcontent.setId(approve.getSubId());
|
|
|
+ subcontent.setApproveStatus(1L);
|
|
|
+ subcontent.setUpdatedate(new Date());
|
|
|
+ subcontent.setUpdaterCode(getUserId().toString());
|
|
|
+ tPssrSubcontentService.updateTPssrSubcontent(subcontent);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ return AjaxResult.error();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 驳回阻火器
|
|
|
+ */
|
|
|
+ @PutMapping("/turnDownFlamearrester")
|
|
|
+ public AjaxResult turnDownFlamearrester(@RequestBody TPssrSafetyFlamearrester tPssrSafetyFlamearrester) {
|
|
|
+ if (tPssrSafetyFlamearrester.getIds() != null) {
|
|
|
+ String userId = getUserId().toString();
|
|
|
+ // 修改已选择数据的状态
|
|
|
+ for (Long id : tPssrSafetyFlamearrester.getIds()) {
|
|
|
+ TPssrSafetyFlamearrester blind = new TPssrSafetyFlamearrester();
|
|
|
+ blind.setId(id);
|
|
|
+ blind.setApproveStatus(1L);
|
|
|
+ blind.setUpdatedate(new Date());
|
|
|
+ blind.setUpdaterCode(getUserId().toString());
|
|
|
+ tPssrSafetyFlamearresterService.updateTPssrSafetyFlamearrester(blind);
|
|
|
+ }
|
|
|
+ // 查询当前流程
|
|
|
+ TPssrApprove approve = tPssrApproveService.selectTPssrApproveBySubId(tPssrSafetyFlamearrester.getSubId());
|
|
|
+
|
|
|
+ try {
|
|
|
+ runtimeService.deleteProcessInstance(approve.getProcessId(), "pssr2confirm");
|
|
|
+ historyService.deleteHistoricProcessInstance(approve.getProcessId());
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.info("无运行时流程");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 驳回 查询所有待审批的人员
|
|
|
+ TPssrSafetyFlamearrester blind = new TPssrSafetyFlamearrester();
|
|
|
+ blind.setSubId(tPssrSafetyFlamearrester.getSubId());
|
|
|
+ blind.setApproveStatus(1L);
|
|
|
+ Set<String> confirmUsers1 = new HashSet<>();
|
|
|
+ Set<String> confirmUsers2 = new HashSet<>();
|
|
|
+ for (TPssrSafetyFlamearrester item : tPssrSafetyFlamearresterService.selectTPssrSafetyFlamearresterList(blind)) {
|
|
|
+
|
|
|
+ // 确认人1
|
|
|
+ confirmUsers1.add(item.getConfirmer1());
|
|
|
+
|
|
|
+ //确认人2
|
|
|
+ confirmUsers2.add(item.getConfirmer2());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 开始申请流程
|
|
|
+ long businessKey = approve.getApproveId();
|
|
|
+ //开始工作流、监听
|
|
|
+ Authentication.setAuthenticatedUserId(userId);//设置当前申请人
|
|
|
+ Map<String, Object> variables = new HashMap<>();
|
|
|
+ variables.put("applyUser", userId);
|
|
|
+ variables.put("confirmUsers1", confirmUsers1);
|
|
|
+ variables.put("confirmUsers2", confirmUsers2);
|
|
|
+ variables.put("chargePerson", approve.getSubCharge());
|
|
|
+ //采用key来启动流程定义并设置流程变量,返回流程实例
|
|
|
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("pssr2confirm", String.valueOf(businessKey), variables);
|
|
|
+
|
|
|
+ // 修改审批表和sub表
|
|
|
+ approve.setProcessId(pi.getProcessInstanceId());
|
|
|
+ approve.setApproveStatus(1L);
|
|
|
+ approve.setUpdatedate(new Date());
|
|
|
+ approve.setUpdaterCode(getUserId().toString());
|
|
|
+ tPssrApproveService.updateTPssrApprove(approve);
|
|
|
+
|
|
|
+ TPssrSubcontent subcontent = new TPssrSubcontent();
|
|
|
+ subcontent.setId(approve.getSubId());
|
|
|
+ subcontent.setApproveStatus(1L);
|
|
|
+ subcontent.setUpdatedate(new Date());
|
|
|
+ subcontent.setUpdaterCode(getUserId().toString());
|
|
|
+ tPssrSubcontentService.updateTPssrSubcontent(subcontent);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ return AjaxResult.error();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 驳回安全阀
|
|
|
+ */
|
|
|
+ @PutMapping("/turnDownValve")
|
|
|
+ public AjaxResult turnDownValve(@RequestBody TPssrSafetyValve tPssrSafetyValve) {
|
|
|
+ if (tPssrSafetyValve.getIds() != null) {
|
|
|
+ String userId = getUserId().toString();
|
|
|
+ // 修改已选择数据的状态
|
|
|
+ for (Long id : tPssrSafetyValve.getIds()) {
|
|
|
+ TPssrSafetyValve blind = new TPssrSafetyValve();
|
|
|
+ blind.setId(id);
|
|
|
+ blind.setApproveStatus(1L);
|
|
|
+ blind.setUpdatedate(new Date());
|
|
|
+ blind.setUpdaterCode(getUserId().toString());
|
|
|
+ tPssrSafetyValveService.updateTPssrSafetyValve(blind);
|
|
|
+ }
|
|
|
+ // 查询当前流程
|
|
|
+ TPssrApprove approve = tPssrApproveService.selectTPssrApproveBySubId(tPssrSafetyValve.getSubId());
|
|
|
+
|
|
|
+ try {
|
|
|
+ runtimeService.deleteProcessInstance(approve.getProcessId(), "pssr2confirm");
|
|
|
+ historyService.deleteHistoricProcessInstance(approve.getProcessId());
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.info("无运行时流程");
|
|
|
+ }
|
|
|
+
|
|
|
+ // 驳回 查询所有待审批的人员
|
|
|
+ TPssrSafetyValve blind = new TPssrSafetyValve();
|
|
|
+ blind.setSubId(tPssrSafetyValve.getSubId());
|
|
|
+ blind.setApproveStatus(1L);
|
|
|
+ Set<String> confirmUsers1 = new HashSet<>();
|
|
|
+ Set<String> confirmUsers2 = new HashSet<>();
|
|
|
+ for (TPssrSafetyValve item : tPssrSafetyValveService.selectTPssrSafetyValveList(blind)) {
|
|
|
+
|
|
|
+ // 确认人1
|
|
|
+ confirmUsers1.add(item.getConfirmer1());
|
|
|
+
|
|
|
+ //确认人2
|
|
|
+ confirmUsers2.add(item.getConfirmer2());
|
|
|
+ }
|
|
|
+
|
|
|
+ // 开始申请流程
|
|
|
+ long businessKey = approve.getApproveId();
|
|
|
+ //开始工作流、监听
|
|
|
+ Authentication.setAuthenticatedUserId(userId);//设置当前申请人
|
|
|
+ Map<String, Object> variables = new HashMap<>();
|
|
|
+ variables.put("applyUser", userId);
|
|
|
+ variables.put("confirmUsers1", confirmUsers1);
|
|
|
+ variables.put("confirmUsers2", confirmUsers2);
|
|
|
+ variables.put("chargePerson", approve.getSubCharge());
|
|
|
+ //采用key来启动流程定义并设置流程变量,返回流程实例
|
|
|
+ ProcessInstance pi = runtimeService.startProcessInstanceByKey("pssr2confirm", String.valueOf(businessKey), variables);
|
|
|
+
|
|
|
+ // 修改审批表和sub表
|
|
|
+ approve.setProcessId(pi.getProcessInstanceId());
|
|
|
+ approve.setApproveStatus(1L);
|
|
|
+ approve.setUpdatedate(new Date());
|
|
|
+ approve.setUpdaterCode(getUserId().toString());
|
|
|
+ tPssrApproveService.updateTPssrApprove(approve);
|
|
|
+
|
|
|
+ TPssrSubcontent subcontent = new TPssrSubcontent();
|
|
|
+ subcontent.setId(approve.getSubId());
|
|
|
+ subcontent.setApproveStatus(1L);
|
|
|
+ subcontent.setUpdatedate(new Date());
|
|
|
+ subcontent.setUpdaterCode(getUserId().toString());
|
|
|
+ tPssrSubcontentService.updateTPssrSubcontent(subcontent);
|
|
|
+ return AjaxResult.success();
|
|
|
+ }
|
|
|
+ return AjaxResult.error();
|
|
|
+ }
|
|
|
+}
|