From c4e89e751d107b18af51336c8ef54bd3591ddab5 Mon Sep 17 00:00:00 2001 From: wangyan21 Date: Thu, 2 Nov 2023 17:36:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=B7=A5=E4=BD=9C=E8=AE=B8=E5=8F=AF=E7=94=B3?= =?UTF-8?q?=E8=AF=B7=E6=8F=90=E4=BA=A4=E5=B7=A5=E4=BD=9C=E6=B5=81=E7=AE=A1?= =?UTF-8?q?=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../operation/QyzyPermitReportController.java | 10 + God-Vue-master/god-passenger/pom.xml | 4 + .../listener/WorkPermitApplyListener.java | 41 +++ .../mapper/QyzyPermitReportMapper.java | 9 + .../service/IQyzyPermitReportService.java | 17 ++ .../impl/QyzyPermitReportServiceImpl.java | 46 ++- .../operation/QyzyPermitReportMapper.xml | 6 + god-ui/src/api/operation/report.js | 7 + .../views/operation/application/detail.vue | 274 ++++++++++++++++++ .../src/views/operation/application/index.vue | 30 +- 10 files changed, 441 insertions(+), 3 deletions(-) create mode 100644 God-Vue-master/god-passenger/src/main/java/com/god/passenger/operation/listener/WorkPermitApplyListener.java create mode 100644 god-ui/src/views/operation/application/detail.vue diff --git a/God-Vue-master/god-admin/src/main/java/com/god/web/controller/operation/QyzyPermitReportController.java b/God-Vue-master/god-admin/src/main/java/com/god/web/controller/operation/QyzyPermitReportController.java index 3cae0eb1..12234e05 100644 --- a/God-Vue-master/god-admin/src/main/java/com/god/web/controller/operation/QyzyPermitReportController.java +++ b/God-Vue-master/god-admin/src/main/java/com/god/web/controller/operation/QyzyPermitReportController.java @@ -101,4 +101,14 @@ public class QyzyPermitReportController extends BaseController { return toAjax(qyzyPermitReportService.deleteQyzyPermitReportByIds(ids)); } + + /** + * 提交流程 + * @param id + * @return + */ + @PostMapping("/subProcess/{id}") + public AjaxResult subProcess(@PathVariable("id") String id){ + return toAjax(qyzyPermitReportService.subProcess(id)); + } } diff --git a/God-Vue-master/god-passenger/pom.xml b/God-Vue-master/god-passenger/pom.xml index a46e988b..098e3a2b 100644 --- a/God-Vue-master/god-passenger/pom.xml +++ b/God-Vue-master/god-passenger/pom.xml @@ -22,6 +22,10 @@ org.projectlombok lombok + + com.god + god-system + diff --git a/God-Vue-master/god-passenger/src/main/java/com/god/passenger/operation/listener/WorkPermitApplyListener.java b/God-Vue-master/god-passenger/src/main/java/com/god/passenger/operation/listener/WorkPermitApplyListener.java new file mode 100644 index 00000000..c663f3fc --- /dev/null +++ b/God-Vue-master/god-passenger/src/main/java/com/god/passenger/operation/listener/WorkPermitApplyListener.java @@ -0,0 +1,41 @@ +package com.god.passenger.operation.listener; + +import com.god.common.utils.DateUtils; +import com.god.common.utils.ip.AddressUtils; +import com.god.common.utils.spring.SpringUtils; +import com.god.passenger.operation.service.IQyzyPermitReportService; +import org.flowable.engine.delegate.TaskListener; +import org.flowable.engine.impl.el.FixedValue; +import org.flowable.task.service.delegate.DelegateTask; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.stereotype.Component; + +/** + * 工作许可申请监听 + * + * @author wangyan21 + * @date 2023年11月2号 + * + */ +@Component("workPermitApplyListener") +public class WorkPermitApplyListener implements TaskListener { + private static final Logger LOGGER = LoggerFactory.getLogger(WorkPermitApplyListener.class); + + public FixedValue state; + public FixedValue getState() { + return state; + } + + public void setState(FixedValue state) { + this.state = state; + } + + @Override + public void notify(DelegateTask delegateTask) { + String processInstanceId = delegateTask.getProcessInstanceId(); + IQyzyPermitReportService qyzyPermitReportService= SpringUtils.getBean("qyzyPermitReportService"); + qyzyPermitReportService.updateState(processInstanceId,getState().getExpressionText()); + LOGGER.info("-->>工作许可审批时间:{},--->>审批状态:{}", DateUtils.dateTimeNow(),getState().toString()); + } +} diff --git a/God-Vue-master/god-passenger/src/main/java/com/god/passenger/operation/mapper/QyzyPermitReportMapper.java b/God-Vue-master/god-passenger/src/main/java/com/god/passenger/operation/mapper/QyzyPermitReportMapper.java index 2d58962f..293ab597 100644 --- a/God-Vue-master/god-passenger/src/main/java/com/god/passenger/operation/mapper/QyzyPermitReportMapper.java +++ b/God-Vue-master/god-passenger/src/main/java/com/god/passenger/operation/mapper/QyzyPermitReportMapper.java @@ -3,6 +3,7 @@ package com.god.passenger.operation.mapper; import java.util.List; import com.god.passenger.operation.domain.QyzyPermitReport; +import org.apache.ibatis.annotations.Param; /** * 工作许可报备Mapper接口 @@ -58,4 +59,12 @@ public interface QyzyPermitReportMapper { * @return 结果 */ public int deleteQyzyPermitReportByIds(String[] ids); + + /** + * 更新单据状态 + * @param id + * @param eventType + * @return + */ + public int updateState(@Param("id") String id, @Param("eventType") String eventType); } diff --git a/God-Vue-master/god-passenger/src/main/java/com/god/passenger/operation/service/IQyzyPermitReportService.java b/God-Vue-master/god-passenger/src/main/java/com/god/passenger/operation/service/IQyzyPermitReportService.java index f45558e0..2aa7edfd 100644 --- a/God-Vue-master/god-passenger/src/main/java/com/god/passenger/operation/service/IQyzyPermitReportService.java +++ b/God-Vue-master/god-passenger/src/main/java/com/god/passenger/operation/service/IQyzyPermitReportService.java @@ -58,4 +58,21 @@ public interface IQyzyPermitReportService * @return 结果 */ public int deleteQyzyPermitReportById(String id); + + /** + * 提交流程 + * + * @param id + * @return + */ + public int subProcess(String id); + + /** + * 更新单据状态 + * + * @param id + * @param state + * @return + */ + public int updateState(String id, String state); } diff --git a/God-Vue-master/god-passenger/src/main/java/com/god/passenger/operation/service/impl/QyzyPermitReportServiceImpl.java b/God-Vue-master/god-passenger/src/main/java/com/god/passenger/operation/service/impl/QyzyPermitReportServiceImpl.java index 487fd3c0..666fd3e9 100644 --- a/God-Vue-master/god-passenger/src/main/java/com/god/passenger/operation/service/impl/QyzyPermitReportServiceImpl.java +++ b/God-Vue-master/god-passenger/src/main/java/com/god/passenger/operation/service/impl/QyzyPermitReportServiceImpl.java @@ -1,26 +1,41 @@ package com.god.passenger.operation.service.impl; +import java.util.HashMap; import java.util.List; import com.god.common.utils.DateUtils; +import com.god.common.utils.SecurityUtils; import com.god.common.utils.StringUtils; import com.god.common.utils.uuid.IdUtils; +import com.god.passenger.operation.listener.WorkPermitApplyListener; +import org.flowable.engine.IdentityService; +import org.flowable.engine.RuntimeService; +import org.flowable.engine.runtime.ProcessInstance; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.god.passenger.operation.mapper.QyzyPermitReportMapper; import com.god.passenger.operation.domain.QyzyPermitReport; import com.god.passenger.operation.service.IQyzyPermitReportService; +import javax.annotation.Resource; + /** * 工作许可报备Service业务层处理 * * @author wangyan * @date 2023-10-30 */ -@Service +@Service("qyzyPermitReportService") public class QyzyPermitReportServiceImpl implements IQyzyPermitReportService { + private static final Logger LOGGER = LoggerFactory.getLogger(QyzyPermitReportServiceImpl.class); @Autowired private QyzyPermitReportMapper qyzyPermitReportMapper; + @Resource + private RuntimeService runtimeService; + @Resource + IdentityService identityService; /** * 查询工作许可报备 @@ -91,4 +106,33 @@ public class QyzyPermitReportServiceImpl implements IQyzyPermitReportService { public int deleteQyzyPermitReportById(String id) { return qyzyPermitReportMapper.deleteQyzyPermitReportById(id); } + + /** + * 提交流程 + * + * @param id + * @return + */ + public int subProcess(String id) { + Long userId = SecurityUtils.getLoginUser().getUserId(); + identityService.setAuthenticatedUserId(String.valueOf(userId)); + HashMap variables = new HashMap<>(); + variables.put("INITIATOR", String.valueOf(userId));//设置流程发起人 + runtimeService.startProcessInstanceByKey("work_permit_apply_two", String.valueOf(id), variables); + QyzyPermitReport qyzyPermitReport = qyzyPermitReportMapper.selectQyzyPermitReportById(id); + qyzyPermitReport.setEventType("待审批"); + return qyzyPermitReportMapper.updateQyzyPermitReport(qyzyPermitReport); + } + + /** + * 更新单据状态 + * + * @param instanceId + * @param state + * @return + */ + public int updateState(String instanceId, String state) { + ProcessInstance process = runtimeService.createProcessInstanceQuery().processInstanceId(instanceId).singleResult(); + return qyzyPermitReportMapper.updateState(process.getBusinessKey(), state); + } } diff --git a/God-Vue-master/god-passenger/src/main/resources/mapper/operation/QyzyPermitReportMapper.xml b/God-Vue-master/god-passenger/src/main/resources/mapper/operation/QyzyPermitReportMapper.xml index 6c86dab0..f24d00a5 100644 --- a/God-Vue-master/god-passenger/src/main/resources/mapper/operation/QyzyPermitReportMapper.xml +++ b/God-Vue-master/god-passenger/src/main/resources/mapper/operation/QyzyPermitReportMapper.xml @@ -126,4 +126,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" #{id} + + + update qyzy_permit_report + set event_type = #{eventType} + where id = #{id} + \ No newline at end of file diff --git a/god-ui/src/api/operation/report.js b/god-ui/src/api/operation/report.js index c520a88e..58201ac3 100644 --- a/god-ui/src/api/operation/report.js +++ b/god-ui/src/api/operation/report.js @@ -42,3 +42,10 @@ export function delReport(id) { method: 'delete' }) } + +export function subProcess(id){ + return request({ + url: '/permit/report/subProcess/'+id, + method: 'post' + }) +} diff --git a/god-ui/src/views/operation/application/detail.vue b/god-ui/src/views/operation/application/detail.vue new file mode 100644 index 00000000..df9cdee2 --- /dev/null +++ b/god-ui/src/views/operation/application/detail.vue @@ -0,0 +1,274 @@ + + + diff --git a/god-ui/src/views/operation/application/index.vue b/god-ui/src/views/operation/application/index.vue index c0773664..dc778171 100644 --- a/god-ui/src/views/operation/application/index.vue +++ b/god-ui/src/views/operation/application/index.vue @@ -159,6 +159,13 @@ @click="handleDelete(scope.row)" v-hasPermi="['system:report:remove']" >删除 + 提交审批 + @@ -250,12 +257,17 @@ 确 定 取 消 - + + + + +