| | |
| | | import com.java110.core.event.cmd.CmdEvent; |
| | | import com.java110.core.factory.GenerateCodeFactory; |
| | | import com.java110.doc.annotation.*; |
| | | import com.java110.dto.itemReleaseType.ItemReleaseTypeDto; |
| | | import com.java110.dto.itemRelease.ItemReleaseDto; |
| | | import com.java110.dto.itemRelease.ItemReleaseTypeDto; |
| | | import com.java110.dto.oaWorkflow.OaWorkflowDto; |
| | | import com.java110.dto.user.UserDto; |
| | | import com.java110.intf.common.IItemReleaseResV1InnerServiceSMO; |
| | | import com.java110.intf.common.IItemReleaseTypeV1InnerServiceSMO; |
| | | import com.java110.intf.common.IItemReleaseV1InnerServiceSMO; |
| | | import com.java110.intf.common.IOaWorkflowUserInnerServiceSMO; |
| | | import com.java110.intf.common.IOaWorkflowActivitiInnerServiceSMO; |
| | | import com.java110.intf.oa.IOaWorkflowInnerServiceSMO; |
| | | import com.java110.intf.user.IUserInnerServiceSMO; |
| | | import com.java110.po.itemRelease.ItemReleasePo; |
| | | import com.java110.po.itemReleaseRes.ItemReleaseResPo; |
| | | import com.java110.po.itemRelease.ItemReleaseResPo; |
| | | import com.java110.utils.exception.CmdException; |
| | | import com.java110.utils.util.Assert; |
| | | import com.java110.utils.util.BeanConvertUtil; |
| | |
| | | private IUserInnerServiceSMO userInnerServiceSMOImpl; |
| | | |
| | | @Autowired |
| | | private IOaWorkflowUserInnerServiceSMO oaWorkflowUserInnerServiceSMOImpl; |
| | | private IOaWorkflowActivitiInnerServiceSMO oaWorkflowActivitiInnerServiceSMOImpl; |
| | | |
| | | |
| | | @Override |
| | |
| | | @Java110Transactional |
| | | public void doCmd(CmdEvent event, ICmdDataFlowContext cmdDataFlowContext, JSONObject reqJson) throws CmdException { |
| | | |
| | | String storeId = cmdDataFlowContext.getReqHeaders().get("store-id"); |
| | | String userId = cmdDataFlowContext.getReqHeaders().get("user-id"); |
| | | |
| | | ItemReleaseTypeDto itemReleaseTypeDto = new ItemReleaseTypeDto(); |
| | |
| | | Assert.listOnlyOne(itemReleaseTypeDtos,"未包含放行类型"); |
| | | |
| | | OaWorkflowDto oaWorkflowDto = new OaWorkflowDto(); |
| | | oaWorkflowDto.setStoreId(storeId); |
| | | oaWorkflowDto.setStoreId(itemReleaseTypeDtos.get(0).getStoreId()); |
| | | oaWorkflowDto.setFlowId(itemReleaseTypeDtos.get(0).getFlowId()); |
| | | List<OaWorkflowDto> oaWorkflowDtos = oaWorkflowInnerServiceSMOImpl.queryOaWorkflows(oaWorkflowDto); |
| | | Assert.listOnlyOne(oaWorkflowDtos, "流程不存在"); |
| | |
| | | |
| | | ItemReleasePo itemReleasePo = BeanConvertUtil.covertBean(reqJson, ItemReleasePo.class); |
| | | itemReleasePo.setIrId(GenerateCodeFactory.getGeneratorId(CODE_PREFIX_ID)); |
| | | itemReleasePo.setState(ItemReleaseDto.STATE_WAIT); |
| | | itemReleasePo.setCreateUserId(userId); |
| | | int flag = itemReleaseV1InnerServiceSMOImpl.saveItemRelease(itemReleasePo); |
| | | |
| | | if (flag < 1) { |
| | |
| | | throw new CmdException("保存数据失败"); |
| | | } |
| | | |
| | | |
| | | |
| | | //启动任务 |
| | | JSONObject flowJson = new JSONObject(); |
| | | flowJson.put("processDefinitionKey", oaWorkflowDtos.get(0).getProcessDefinitionKey()); |
| | |
| | | flowJson.put("flowId",oaWorkflowDtos.get(0).getFlowId()); |
| | | flowJson.put("id",itemReleasePo.getIrId()); |
| | | flowJson.put("auditMessage","提交审核"); |
| | | flowJson.put("storeId",storeId); |
| | | flowJson.put("storeId",itemReleaseTypeDtos.get(0).getStoreId()); |
| | | reqJson.put("processDefinitionKey", oaWorkflowDtos.get(0).getProcessDefinitionKey()); |
| | | JSONObject result = oaWorkflowUserInnerServiceSMOImpl.startProcess(flowJson); |
| | | JSONObject result = oaWorkflowActivitiInnerServiceSMOImpl.startProcess(flowJson); |
| | | |
| | | //提交者提交 |
| | | flowJson = new JSONObject(); |
| | | flowJson.put("processInstanceId",result.getString("processInstanceId")); |
| | | flowJson.put("createUserId",userId); |
| | | flowJson.put("nextUserId",reqJson.getJSONObject("audit").getString("staffId")); |
| | | flowJson.put("storeId",storeId); |
| | | oaWorkflowUserInnerServiceSMOImpl.autoFinishFirstTask(flowJson); |
| | | flowJson.put("storeId",itemReleaseTypeDtos.get(0).getStoreId()); |
| | | flowJson.put("id",itemReleasePo.getIrId()); |
| | | flowJson.put("flowId",oaWorkflowDtos.get(0).getFlowId()); |
| | | |
| | | |
| | | oaWorkflowActivitiInnerServiceSMOImpl.autoFinishFirstTask(flowJson); |
| | | |
| | | |
| | | cmdDataFlowContext.setResponseEntity(ResultVo.success()); |