diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderSaveReqVO.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderSaveReqVO.java index 54309ce..5d1b237 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderSaveReqVO.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/maintenance/vo/MaintenanceOrderSaveReqVO.java @@ -43,6 +43,7 @@ public class MaintenanceOrderSaveReqVO { private Date completeTime; @Schema(description = "状态") + @NotNull(message = "状态不能为空") private Integer status; @Schema(description = "维修人id") 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 8e8699b..14e58fe 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 @@ -75,22 +75,29 @@ public class MaintenanceOrderServiceImpl implements MaintenanceOrderService { // 插入 MaintenanceOrderDO remoteMaintenanceOrder = BeanUtils.toBean(createReqVO, MaintenanceOrderDO.class); remoteMaintenanceOrder.setMaintenanceOrderNo("WXGD" + DateUtil.format(new Date(),"yyyyMMddHHmmss") + RandomUtil.randomInt(1, 10)); - //设置为审批中 - remoteMaintenanceOrder.setStatus(1); - //设置为审批中 - remoteMaintenanceOrder.setApproveStatus(1); + //等于1的时候是在审批流程那边提交的 + if (createReqVO.getStatus() == 1){ + //设置为审批中 + remoteMaintenanceOrder.setApproveStatus(1); + }else { + //设置为待审批 + remoteMaintenanceOrder.setApproveStatus(0); + } maintenanceOrderMapper.insert(remoteMaintenanceOrder); - // 发起 BPM 流程 + //等于1的时候是在审批流程那边提交的 + if (createReqVO.getStatus() == 1){ + // 发起 BPM 流程 // Map processInstanceVariables = new HashMap<>(); // processInstanceVariables.put("day", day); - String processInstanceId = processInstanceApi.createProcessInstance(getLoginUserId(), - new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY) + String processInstanceId = processInstanceApi.createProcessInstance(getLoginUserId(), + new BpmProcessInstanceCreateReqDTO().setProcessDefinitionKey(PROCESS_KEY) // .setVariables(processInstanceVariables) - .setBusinessKey(String.valueOf(remoteMaintenanceOrder.getMaintenanceOrderId())) - .setStartUserSelectAssignees(createReqVO.getStartUserSelectAssignees())); + .setBusinessKey(String.valueOf(remoteMaintenanceOrder.getMaintenanceOrderId())) + .setStartUserSelectAssignees(createReqVO.getStartUserSelectAssignees())); - // 将工作流的编号,更新到 业务表 中 - maintenanceOrderMapper.updateById(new MaintenanceOrderDO().setMaintenanceOrderId(remoteMaintenanceOrder.getMaintenanceOrderId()).setProcessInstanceId(processInstanceId)); + // 将工作流的编号,更新到 业务表 中 + maintenanceOrderMapper.updateById(new MaintenanceOrderDO().setMaintenanceOrderId(remoteMaintenanceOrder.getMaintenanceOrderId()).setProcessInstanceId(processInstanceId)); + } // 返回 return remoteMaintenanceOrder.getMaintenanceOrderId(); } 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 index b5cda1a..cbdb83c 100644 --- 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 @@ -2,6 +2,7 @@ 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.dal.dataobject.maintenance.MaintenanceOrderDO; import com.inspur.module.system.service.maintenance.MaintenanceOrderService; import com.inspur.module.system.service.maintenance.MaintenanceOrderServiceImpl; import org.springframework.stereotype.Component; @@ -27,6 +28,13 @@ public class MaintenanceStatusListener extends BpmProcessInstanceStatusEventList protected void onEvent(BpmProcessInstanceStatusEvent event) { System.out.println("MaintenanceStatusListener~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~"); System.out.println(event); + //如果是取消,把业务表的状态改为待提交 + if (event.getStatus() == 3 || event.getStatus() == 4){ + MaintenanceOrderDO maintenanceOrderDO = new MaintenanceOrderDO(); + maintenanceOrderDO.setMaintenanceOrderId(event.getBusinessKey()); + maintenanceOrderDO.setStatus(0); + maintenanceOrderService.updateStatus(maintenanceOrderDO); + } maintenanceOrderService.updateApproveStatus(event.getBusinessKey(),event.getStatus()); } } diff --git a/imt-ui/src/views/system/maintenance/maintenanceInfo/RemoteMaintenanceOrderForm.vue b/imt-ui/src/views/system/maintenance/maintenanceInfo/RemoteMaintenanceOrderForm.vue new file mode 100644 index 0000000..dfad6ce --- /dev/null +++ b/imt-ui/src/views/system/maintenance/maintenanceInfo/RemoteMaintenanceOrderForm.vue @@ -0,0 +1,234 @@ + + + diff --git a/imt-ui/src/views/system/maintenance/maintenanceInfo/create.vue b/imt-ui/src/views/system/maintenance/maintenanceInfo/create.vue index 4ca2cca..f63187c 100644 --- a/imt-ui/src/views/system/maintenance/maintenanceInfo/create.vue +++ b/imt-ui/src/views/system/maintenance/maintenanceInfo/create.vue @@ -208,6 +208,7 @@ export default { async submitForm() { // 校验主表 await this.$refs["formRef"].validate(); + this.formData.status = 1; await RemoteMaintenanceOrderApi.createRemoteMaintenanceOrder(this.formData) this.$modal.msgSuccess("提交成功"); this.$tab.closeOpenPage({ path: "/maintenance/remote-maintenance-order" }); diff --git a/imt-ui/src/views/system/maintenance/maintenanceInfo/index.vue b/imt-ui/src/views/system/maintenance/maintenanceInfo/index.vue index 39c1291..b4df858 100644 --- a/imt-ui/src/views/system/maintenance/maintenanceInfo/index.vue +++ b/imt-ui/src/views/system/maintenance/maintenanceInfo/index.vue @@ -46,17 +46,17 @@ - - - - - - 导出 + 新增 + + + + + + @@ -99,13 +99,13 @@ @@ -114,7 +114,7 @@ - + @@ -124,7 +124,7 @@ import * as RemoteMaintenanceOrderApi from '@/api/system/maintenance/maintenance import {getEquipCascader} from '@/api/system/equip/equipInfo' import {getComponentSelection} from '@/api/system/equip/componentInfo' import {getCustomerSelection} from '@/api/system/baseData/customerInfo' -import RemoteMaintenanceOrderForm from './create.vue'; +import RemoteMaintenanceOrderForm from './RemoteMaintenanceOrderForm.vue'; import {DICT_TYPE} from "@/utils/dict"; import ApproveRecord from "@/views/bpm/processInstance/approveRecord.vue";