维修工单中心添加审批功能
This commit is contained in:
parent
93d682743d
commit
4b5c931159
@ -25,6 +25,7 @@ import com.inspur.framework.excel.core.util.ExcelUtils;
|
|||||||
|
|
||||||
import com.inspur.framework.apilog.core.annotation.ApiAccessLog;
|
import com.inspur.framework.apilog.core.annotation.ApiAccessLog;
|
||||||
import static com.inspur.framework.apilog.core.enums.OperateTypeEnum.*;
|
import static com.inspur.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||||
|
import static com.inspur.framework.web.core.util.WebFrameworkUtils.getLoginUserId;
|
||||||
|
|
||||||
@Tag(name = "管理后台 - 远程维修工单")
|
@Tag(name = "管理后台 - 远程维修工单")
|
||||||
@RestController
|
@RestController
|
||||||
@ -72,6 +73,7 @@ public class MaintenanceOrderController {
|
|||||||
@Operation(summary = "获得远程维修工单分页")
|
@Operation(summary = "获得远程维修工单分页")
|
||||||
@PreAuthorize("@ss.hasPermission('imt:remote-maintenance-order:query')")
|
@PreAuthorize("@ss.hasPermission('imt:remote-maintenance-order:query')")
|
||||||
public CommonResult<PageResult<MaintenanceOrderRespVO>> getRemoteMaintenanceOrderPage(@Valid MaintenanceOrderPageReqVO pageReqVO) {
|
public CommonResult<PageResult<MaintenanceOrderRespVO>> getRemoteMaintenanceOrderPage(@Valid MaintenanceOrderPageReqVO pageReqVO) {
|
||||||
|
pageReqVO.setUserId(getLoginUserId());
|
||||||
PageResult<MaintenanceOrderDO> pageResult = maintenanceOrderService.getRemoteMaintenanceOrderPage(pageReqVO);
|
PageResult<MaintenanceOrderDO> pageResult = maintenanceOrderService.getRemoteMaintenanceOrderPage(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, MaintenanceOrderRespVO.class));
|
return success(BeanUtils.toBean(pageResult, MaintenanceOrderRespVO.class));
|
||||||
}
|
}
|
||||||
|
@ -28,4 +28,9 @@ public class MaintenanceOrderPageReqVO extends PageParam {
|
|||||||
@Schema(description = "审批状态(bpm_process_instance_status)")
|
@Schema(description = "审批状态(bpm_process_instance_status)")
|
||||||
private Integer approveStatus;
|
private Integer approveStatus;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户id
|
||||||
|
*/
|
||||||
|
private Long userId;
|
||||||
|
|
||||||
}
|
}
|
@ -98,4 +98,8 @@ public class MaintenanceOrderRespVO {
|
|||||||
|
|
||||||
@Schema(description = "点检方案")
|
@Schema(description = "点检方案")
|
||||||
private String patrolPlan;
|
private String patrolPlan;
|
||||||
|
|
||||||
|
@Schema(description = "当前审批任务")
|
||||||
|
private String taskName;
|
||||||
|
|
||||||
}
|
}
|
@ -100,4 +100,8 @@ public class MaintenanceOrderDO extends BaseDO {
|
|||||||
private String executorName;
|
private String executorName;
|
||||||
@TableField(exist = false)
|
@TableField(exist = false)
|
||||||
private String reportId;
|
private String reportId;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private String taskName;
|
||||||
|
@TableField(exist = false)
|
||||||
|
private Integer flowStatus;
|
||||||
}
|
}
|
@ -3,6 +3,7 @@ package com.inspur.module.system.service.maintenance;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.DateUtil;
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.util.RandomUtil;
|
import cn.hutool.core.util.RandomUtil;
|
||||||
|
import cn.hutool.core.util.StrUtil;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import com.inspur.framework.common.enums.CommonStatusEnum;
|
import com.inspur.framework.common.enums.CommonStatusEnum;
|
||||||
@ -23,6 +24,9 @@ import com.inspur.module.system.service.baseData.CustomerInfoService;
|
|||||||
import com.inspur.module.system.service.equip.ComponentInfoService;
|
import com.inspur.module.system.service.equip.ComponentInfoService;
|
||||||
import com.inspur.module.system.service.equip.EquipInfoService;
|
import com.inspur.module.system.service.equip.EquipInfoService;
|
||||||
import com.inspur.module.system.service.user.AdminUserService;
|
import com.inspur.module.system.service.user.AdminUserService;
|
||||||
|
import org.flowable.engine.TaskService;
|
||||||
|
import org.flowable.task.api.Task;
|
||||||
|
import org.flowable.task.api.TaskQuery;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
|
|
||||||
@ -70,6 +74,9 @@ public class MaintenanceOrderServiceImpl implements MaintenanceOrderService {
|
|||||||
@Resource
|
@Resource
|
||||||
private MaintenanceReportMapper maintenanceReportMapper;
|
private MaintenanceReportMapper maintenanceReportMapper;
|
||||||
|
|
||||||
|
@Resource
|
||||||
|
private TaskService taskService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* OA 请假对应的流程定义 KEY
|
* OA 请假对应的流程定义 KEY
|
||||||
*/
|
*/
|
||||||
@ -159,6 +166,26 @@ public class MaintenanceOrderServiceImpl implements MaintenanceOrderService {
|
|||||||
Map<String, String> customerMap = customerList.stream().collect(Collectors.toMap(CustomerInfoSelectionVO::getCustomerId, CustomerInfoSelectionVO::getCustomerName));
|
Map<String, String> customerMap = customerList.stream().collect(Collectors.toMap(CustomerInfoSelectionVO::getCustomerId, CustomerInfoSelectionVO::getCustomerName));
|
||||||
List<AdminUserDO> userList = userService.getUserListByStatus(CommonStatusEnum.ENABLE.getStatus());
|
List<AdminUserDO> userList = userService.getUserListByStatus(CommonStatusEnum.ENABLE.getStatus());
|
||||||
Map<Long, String> userMap = userList.stream().collect(Collectors.toMap(AdminUserDO::getId, AdminUserDO::getNickname));
|
Map<Long, String> userMap = userList.stream().collect(Collectors.toMap(AdminUserDO::getId, AdminUserDO::getNickname));
|
||||||
|
Set<String> processInstanceIdSet = list.stream().map(MaintenanceOrderDO::getProcessInstanceId).filter(StrUtil::isNotBlank).collect(Collectors.toSet());
|
||||||
|
if (CollUtil.isNotEmpty(processInstanceIdSet)){
|
||||||
|
//审批流程相关信息
|
||||||
|
TaskQuery taskQuery = taskService.createTaskQuery()
|
||||||
|
.taskAssignee(String.valueOf(pageReqVO.getUserId())) // 分配给自己
|
||||||
|
.active()
|
||||||
|
.includeProcessVariables()
|
||||||
|
.orderByTaskCreateTime().desc(); // 创建时间倒序
|
||||||
|
taskQuery.processInstanceIdIn(processInstanceIdSet);
|
||||||
|
List<Task> taskList = taskQuery.list();
|
||||||
|
if (CollUtil.isNotEmpty(taskList)){
|
||||||
|
Map<String, List<Task>> taskMap = taskList.stream().collect(Collectors.groupingBy(Task::getProcessInstanceId));
|
||||||
|
list.forEach(item->{
|
||||||
|
List<Task> itemTaskList = taskMap.get(item.getProcessInstanceId());
|
||||||
|
if (CollUtil.isNotEmpty(itemTaskList)){
|
||||||
|
item.setTaskName(itemTaskList.get(0).getName());
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
list.forEach(item->{
|
list.forEach(item->{
|
||||||
item.setEquipNo(equipMap.get(item.getEquipId()));
|
item.setEquipNo(equipMap.get(item.getEquipId()));
|
||||||
item.setCustomerName(customerMap.get(item.getCustomerId()));
|
item.setCustomerName(customerMap.get(item.getCustomerId()));
|
||||||
|
@ -98,6 +98,7 @@
|
|||||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
<span>{{ parseTime(scope.row.createTime) }}</span>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
|
<el-table-column label="当前审批任务" align="center" prop="taskName"/>
|
||||||
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
<template v-slot="scope">
|
<template v-slot="scope">
|
||||||
<el-button v-if="scope.row.status === 0" size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.maintenanceOrderId)"
|
<el-button v-if="scope.row.status === 0" size="mini" type="text" icon="el-icon-edit" @click="openForm(scope.row.maintenanceOrderId)"
|
||||||
@ -111,6 +112,9 @@
|
|||||||
<el-button v-if="scope.row.status === 0" size="mini" type="text" icon="el-icon-s-promotion" @click="openSubmitApprove(scope.row)"
|
<el-button v-if="scope.row.status === 0" size="mini" type="text" icon="el-icon-s-promotion" @click="openSubmitApprove(scope.row)"
|
||||||
v-hasPermi="['imt:remote-maintenance-order:submitApprove']">提交审批
|
v-hasPermi="['imt:remote-maintenance-order:submitApprove']">提交审批
|
||||||
</el-button>
|
</el-button>
|
||||||
|
<el-button v-if="scope.row.taskName != null" size="mini" type="text" icon="el-icon-s-check" @click="openApprove(scope.row)"
|
||||||
|
>审批
|
||||||
|
</el-button>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
</el-table>
|
</el-table>
|
||||||
@ -288,6 +292,9 @@ export default {
|
|||||||
this.initSelection();
|
this.initSelection();
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
|
openApprove(row){
|
||||||
|
this.$router.push({ name: "BpmProcessInstanceDetail", query: { id: row.processInstanceId}});
|
||||||
|
},
|
||||||
closeSubmitApprove(){
|
closeSubmitApprove(){
|
||||||
this.submitApproveOpen = false;
|
this.submitApproveOpen = false;
|
||||||
this.$refs.startUserSelectAssigneesFormRef.resetFields();
|
this.$refs.startUserSelectAssigneesFormRef.resetFields();
|
||||||
@ -324,7 +331,9 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
async submitApprove(maintenanceOrderId){
|
async submitApprove(maintenanceOrderId){
|
||||||
|
this.loading = true;
|
||||||
console.log(maintenanceOrderId);
|
console.log(maintenanceOrderId);
|
||||||
|
await this.$nextTick();
|
||||||
if (this.startUserSelectTasks.length > 0) {
|
if (this.startUserSelectTasks.length > 0) {
|
||||||
await this.$refs.startUserSelectAssigneesFormRef.validate();
|
await this.$refs.startUserSelectAssigneesFormRef.validate();
|
||||||
}
|
}
|
||||||
@ -333,7 +342,6 @@ export default {
|
|||||||
startUserSelectAssignees: this.startUserSelectAssignees
|
startUserSelectAssignees: this.startUserSelectAssignees
|
||||||
}
|
}
|
||||||
await RemoteMaintenanceOrderApi.submitMaintenanceApprove(data).then(res=>{
|
await RemoteMaintenanceOrderApi.submitMaintenanceApprove(data).then(res=>{
|
||||||
this.loading = true;
|
|
||||||
this.$modal.msgSuccess("提交审批成功");
|
this.$modal.msgSuccess("提交审批成功");
|
||||||
this.submitApproveOpen = false;
|
this.submitApproveOpen = false;
|
||||||
this.getList();
|
this.getList();
|
||||||
|
Loading…
Reference in New Issue
Block a user