审批回调

This commit is contained in:
xusd 2024-09-12 15:53:45 +08:00
parent fbf83585ea
commit 877664f2e8
6 changed files with 142 additions and 1 deletions

View File

@ -143,6 +143,12 @@
<version>2.2.0-jdk8-snapshot</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.flowable</groupId>
<artifactId>flowable-engine</artifactId>
<version>6.8.0</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

View File

@ -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);
}

View File

@ -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<MaintenanceOrderDO> getRemoteMaintenanceOrderReportPage(MaintenanceOrderRecordsPageReqVO pageReqVO) {
pageReqVO.setStatus(4);
pageReqVO.setStatus(5);
PageResult<MaintenanceOrderDO> page = maintenanceOrderRecordMapper.selectPage(pageReqVO);
List<MaintenanceOrderDO> 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<MaintenanceOrderDO> 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<MaintenanceOrderDO> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.set(MaintenanceOrderDO::getStatus, status);
updateWrapper.eq(MaintenanceOrderDO::getMaintenanceOrderId, id);
maintenanceOrderRecordMapper.update(updateWrapper);
}
}

View File

@ -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);
}
}

View File

@ -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());
}
}

View File

@ -105,6 +105,8 @@
<el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
v-hasPermi="['imt:remote-maintenance-order:delete']">删除
</el-button>
<el-button size="mini" type="text" icon="el-icon-coordinate" @click="openApproveRecord(scope.row.processInstanceId)">审批记录
</el-button>
</template>
</el-table-column>
</el-table>
@ -113,6 +115,7 @@
@pagination="getList"/>
<!-- 对话框(添加 / 修改) -->
<!-- <RemoteMaintenanceOrderForm ref="formRef" @success="getList"/>-->
<approve-record ref="approve" />
</div>
</template>
@ -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];