diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/MaintenanceOrderController.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/MaintenanceOrderController.java index b3beee3..166aab8 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/MaintenanceOrderController.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/MaintenanceOrderController.java @@ -25,6 +25,7 @@ import com.inspur.framework.excel.core.util.ExcelUtils; import com.inspur.framework.apilog.core.annotation.ApiAccessLog; import static com.inspur.framework.apilog.core.enums.OperateTypeEnum.*; +import static com.inspur.framework.web.core.util.WebFrameworkUtils.getLoginUserId; @Tag(name = "管理后台 - 远程维修工单") @RestController @@ -72,6 +73,7 @@ public class MaintenanceOrderController { @Operation(summary = "获得远程维修工单分页") @PreAuthorize("@ss.hasPermission('imt:remote-maintenance-order:query')") public CommonResult> getRemoteMaintenanceOrderPage(@Valid MaintenanceOrderPageReqVO pageReqVO) { + pageReqVO.setUserId(getLoginUserId()); PageResult pageResult = maintenanceOrderService.getRemoteMaintenanceOrderPage(pageReqVO); return success(BeanUtils.toBean(pageResult, MaintenanceOrderRespVO.class)); } diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderPageReqVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderPageReqVO.java index 27513d3..abf7e42 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderPageReqVO.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderPageReqVO.java @@ -28,4 +28,9 @@ public class MaintenanceOrderPageReqVO extends PageParam { @Schema(description = "审批状态(bpm_process_instance_status)") private Integer approveStatus; + /** + * 用户id + */ + private Long userId; + } \ 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/controller/maintenance/vo/MaintenanceOrderRespVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderRespVO.java index 2c6a391..08d67fa 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderRespVO.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderRespVO.java @@ -98,4 +98,8 @@ public class MaintenanceOrderRespVO { @Schema(description = "点检方案") private String patrolPlan; + + @Schema(description = "当前审批任务") + private String taskName; + } \ 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/dal/dataobject/maintenance/MaintenanceOrderDO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/maintenance/MaintenanceOrderDO.java index e7f6bcf..9f04c67 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/maintenance/MaintenanceOrderDO.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/dal/dataobject/maintenance/MaintenanceOrderDO.java @@ -100,4 +100,8 @@ public class MaintenanceOrderDO extends BaseDO { private String executorName; @TableField(exist = false) private String reportId; + @TableField(exist = false) + private String taskName; + @TableField(exist = false) + private Integer flowStatus; } \ 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 c25ecce..70e19a0 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 cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; 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.EquipInfoService; 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 javax.annotation.Resource; @@ -70,6 +74,9 @@ public class MaintenanceOrderServiceImpl implements MaintenanceOrderService { @Resource private MaintenanceReportMapper maintenanceReportMapper; + @Resource + private TaskService taskService; + /** * OA 请假对应的流程定义 KEY */ @@ -159,6 +166,26 @@ public class MaintenanceOrderServiceImpl implements MaintenanceOrderService { Map customerMap = customerList.stream().collect(Collectors.toMap(CustomerInfoSelectionVO::getCustomerId, CustomerInfoSelectionVO::getCustomerName)); List userList = userService.getUserListByStatus(CommonStatusEnum.ENABLE.getStatus()); Map userMap = userList.stream().collect(Collectors.toMap(AdminUserDO::getId, AdminUserDO::getNickname)); + Set 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 taskList = taskQuery.list(); + if (CollUtil.isNotEmpty(taskList)){ + Map> taskMap = taskList.stream().collect(Collectors.groupingBy(Task::getProcessInstanceId)); + list.forEach(item->{ + List itemTaskList = taskMap.get(item.getProcessInstanceId()); + if (CollUtil.isNotEmpty(itemTaskList)){ + item.setTaskName(itemTaskList.get(0).getName()); + } + }); + } + } list.forEach(item->{ item.setEquipNo(equipMap.get(item.getEquipId())); item.setCustomerName(customerMap.get(item.getCustomerId())); diff --git a/imt-ui/src/views/system/maintenance/maintenanceInfo/index.vue b/imt-ui/src/views/system/maintenance/maintenanceInfo/index.vue index ab90aba..2eb09a9 100644 --- a/imt-ui/src/views/system/maintenance/maintenanceInfo/index.vue +++ b/imt-ui/src/views/system/maintenance/maintenanceInfo/index.vue @@ -98,6 +98,7 @@ {{ parseTime(scope.row.createTime) }} + @@ -288,6 +292,9 @@ export default { this.initSelection(); }, methods: { + openApprove(row){ + this.$router.push({ name: "BpmProcessInstanceDetail", query: { id: row.processInstanceId}}); + }, closeSubmitApprove(){ this.submitApproveOpen = false; this.$refs.startUserSelectAssigneesFormRef.resetFields(); @@ -324,7 +331,9 @@ export default { }) }, async submitApprove(maintenanceOrderId){ + this.loading = true; console.log(maintenanceOrderId); + await this.$nextTick(); if (this.startUserSelectTasks.length > 0) { await this.$refs.startUserSelectAssigneesFormRef.validate(); } @@ -333,7 +342,6 @@ export default { startUserSelectAssignees: this.startUserSelectAssignees } await RemoteMaintenanceOrderApi.submitMaintenanceApprove(data).then(res=>{ - this.loading = true; this.$modal.msgSuccess("提交审批成功"); this.submitApproveOpen = false; this.getList();