From 877664f2e8bf2ee3b5246e226e54bc258040321a Mon Sep 17 00:00:00 2001 From: xusd Date: Thu, 12 Sep 2024 15:53:45 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=A1=E6=89=B9=E5=9B=9E=E8=B0=83?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../imt-module-system-biz/pom.xml | 6 ++ .../maintenance/MaintenanceOrderService.java | 20 +++++++ .../MaintenanceOrderServiceImpl.java | 20 ++++++- ...anceSpringExpressionExecutionListener.java | 57 +++++++++++++++++++ .../listener/MaintenanceStatusListener.java | 32 +++++++++++ .../maintenance/maintenanceInfo/index.vue | 8 +++ 6 files changed, 142 insertions(+), 1 deletion(-) create mode 100644 imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/listener/MaintenanceSpringExpressionExecutionListener.java create mode 100644 imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/listener/MaintenanceStatusListener.java diff --git a/imt-server/imt-module-system/imt-module-system-biz/pom.xml b/imt-server/imt-module-system/imt-module-system-biz/pom.xml index f5304c4..fe229a6 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/pom.xml +++ b/imt-server/imt-module-system/imt-module-system-biz/pom.xml @@ -143,6 +143,12 @@ 2.2.0-jdk8-snapshot compile + + org.flowable + flowable-engine + 6.8.0 + compile + diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderService.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderService.java index 8200dd3..98a9595 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderService.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderService.java @@ -73,4 +73,24 @@ public interface MaintenanceOrderService { * @return com.inspur.module.system.dal.dataobject.maintenance.MaintenanceOrderDO */ MaintenanceOrderRespVO getRemoteMaintenanceOrderRecord(String id); + + /** + * 根据id修改审批状态 + * + * @Author xusd + * @Date 14:50 2024/9/12 + * @param id + * @param status + */ + void updateApproveStatus(String id, Integer status); + + /** + * 根据id修改状态 + * + * @Author xusd + * @Date 14:50 2024/9/12 + * @param id + * @param status + */ + void updateStatus(String id, Integer status); } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderServiceImpl.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderServiceImpl.java index b43b46b..67dd087 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderServiceImpl.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/MaintenanceOrderServiceImpl.java @@ -3,6 +3,7 @@ package com.inspur.module.system.service.maintenance; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.date.DateUtil; import cn.hutool.core.util.RandomUtil; +import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; import com.inspur.framework.common.enums.CommonStatusEnum; import com.inspur.framework.common.pojo.PageResult; import com.inspur.module.bpm.api.task.BpmProcessInstanceApi; @@ -148,7 +149,7 @@ public class MaintenanceOrderServiceImpl implements MaintenanceOrderService { @Override public PageResult getRemoteMaintenanceOrderReportPage(MaintenanceOrderRecordsPageReqVO pageReqVO) { - pageReqVO.setStatus(4); + pageReqVO.setStatus(5); PageResult page = maintenanceOrderRecordMapper.selectPage(pageReqVO); List list = page.getList(); if (CollUtil.isNotEmpty(list)){ @@ -193,4 +194,21 @@ public class MaintenanceOrderServiceImpl implements MaintenanceOrderService { return null; } } + + @Override + public void updateApproveStatus(String id, Integer status) { + validateRemoteMaintenanceOrderExists(id); + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.set(MaintenanceOrderDO::getApproveStatus, status); + updateWrapper.eq(MaintenanceOrderDO::getMaintenanceOrderId, id); + maintenanceOrderRecordMapper.update(updateWrapper); + } + + @Override + public void updateStatus(String id, Integer status) { + LambdaUpdateWrapper updateWrapper = new LambdaUpdateWrapper<>(); + updateWrapper.set(MaintenanceOrderDO::getStatus, status); + updateWrapper.eq(MaintenanceOrderDO::getMaintenanceOrderId, id); + maintenanceOrderRecordMapper.update(updateWrapper); + } } \ No newline at end of file diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/listener/MaintenanceSpringExpressionExecutionListener.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/listener/MaintenanceSpringExpressionExecutionListener.java new file mode 100644 index 0000000..5265caa --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/listener/MaintenanceSpringExpressionExecutionListener.java @@ -0,0 +1,57 @@ +package com.inspur.module.system.service.maintenance.listener; + +import com.inspur.module.system.service.maintenance.MaintenanceOrderService; +import lombok.extern.slf4j.Slf4j; +import org.flowable.engine.delegate.DelegateExecution; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +/** + * @Author xusd + * @Date 2024/9/12 15:11 + **/ +@Component +@Slf4j +public class MaintenanceSpringExpressionExecutionListener { + + @Resource + private MaintenanceOrderService maintenanceOrderService; + + /** + * 派单 + */ + public void listenerDispatch(DelegateExecution execution) { + //结束时改成已派单 + maintenanceOrderService.updateStatus(execution.getProcessInstanceBusinessKey(),2); + log.info("listenerDispatch派单方法调用,参数:{}", execution); + } + + /** + * 接单 + */ + public void listenerReceiving(DelegateExecution execution) { + //结束时改成维修中 + maintenanceOrderService.updateStatus(execution.getProcessInstanceBusinessKey(),3); + log.info("listenerReceiving接单方法调用,参数:{}", execution); + } + + /** + * 维修 + */ + public void listenerMaintenance(DelegateExecution execution) { + //结束时改成评价中 + maintenanceOrderService.updateStatus(execution.getProcessInstanceBusinessKey(),4); + log.info("listenerMaintenance维修方法调用,参数:{}", execution); + } + + /** + * 评价 + */ + public void listenerEvaluate(DelegateExecution execution) { + //结束时改成已完成 + maintenanceOrderService.updateStatus(execution.getProcessInstanceBusinessKey(),5); + log.info("listenerEvaluate评价方法调用,参数:{}", execution); + } + +} diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/listener/MaintenanceStatusListener.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/listener/MaintenanceStatusListener.java new file mode 100644 index 0000000..b5cda1a --- /dev/null +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/service/maintenance/listener/MaintenanceStatusListener.java @@ -0,0 +1,32 @@ +package com.inspur.module.system.service.maintenance.listener; + +import com.inspur.module.bpm.event.BpmProcessInstanceStatusEvent; +import com.inspur.module.bpm.event.BpmProcessInstanceStatusEventListener; +import com.inspur.module.system.service.maintenance.MaintenanceOrderService; +import com.inspur.module.system.service.maintenance.MaintenanceOrderServiceImpl; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; + +/** + * @Author xusd + * @Date 2024/9/12 14:46 + **/ +@Component +public class MaintenanceStatusListener extends BpmProcessInstanceStatusEventListener { + + @Resource + private MaintenanceOrderService maintenanceOrderService; + + @Override + protected String getProcessDefinitionKey() { + return MaintenanceOrderServiceImpl.PROCESS_KEY; + } + + @Override + protected void onEvent(BpmProcessInstanceStatusEvent event) { + System.out.println("MaintenanceStatusListener~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); + System.out.println(event); + maintenanceOrderService.updateApproveStatus(event.getBusinessKey(),event.getStatus()); + } +} diff --git a/imt-ui/src/views/system/maintenance/maintenanceInfo/index.vue b/imt-ui/src/views/system/maintenance/maintenanceInfo/index.vue index c4da664..39c1291 100644 --- a/imt-ui/src/views/system/maintenance/maintenanceInfo/index.vue +++ b/imt-ui/src/views/system/maintenance/maintenanceInfo/index.vue @@ -105,6 +105,8 @@ 删除 + 审批记录 + @@ -113,6 +115,7 @@ @pagination="getList"/> + @@ -123,6 +126,7 @@ import {getComponentSelection} from '@/api/system/equip/componentInfo' import {getCustomerSelection} from '@/api/system/baseData/customerInfo' import RemoteMaintenanceOrderForm from './create.vue'; import {DICT_TYPE} from "@/utils/dict"; +import ApproveRecord from "@/views/bpm/processInstance/approveRecord.vue"; export default { name: "RemoteMaintenanceOrder", @@ -132,6 +136,7 @@ export default { } }, components: { + ApproveRecord, RemoteMaintenanceOrderForm, }, data() { @@ -172,6 +177,9 @@ export default { this.initSelection(); }, methods: { + openApproveRecord(approveId){ + this.$refs["approve"].getApproveRecord(approveId); + }, cascaderChange(value){ if (value.length > 0){ this.queryParams.equipId = value[1];