fix:错误代码修复

This commit is contained in:
FCL
2025-10-21 08:37:58 +08:00
parent 3128dc4219
commit bdd5636a47

View File

@@ -91,44 +91,43 @@ public class ReportDocumentMainController extends AbstractFileUploadController i
return success(reportDocumentMainService.createReportDocumentMain(vo));
}
@Resource private BpmProcessInstanceApi bpmProcessInstanceApi;
@Override
@Transactional(rollbackFor = Exception.class)
public CommonResult<ReportDocumentMainRespVO> createProcessInstance(ReportDocumentMainSaveReqVO entity) {
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
Long id = entity.getId();
DataFormDO dataForm = getDataForm(id);
Long dataCollectionId = dataForm.getDataCollectionId();
DataCollectionDO dataCollection = dataCollectionService.getDataCollection(dataCollectionId);
if(dataCollection == null)
throw exception(ErrorCodeConstants.DATA_FORM_EMPTY_COLLECTION_ID);
if(ObjectUtils.isEmpty(dataCollection.getFlowKey()))
throw exception(ErrorCodeConstants.DATA_COLLECTION_EMPTY_WF_KEY);
JSONObject formData = new JSONObject();
if(dataForm.getFormData() != null)
formData = JSONObject.parseObject(dataForm.getFormData());
formData.put("mainId", id);
formData.put("applyUser", dataForm.getApplyUser());
formData.put("applyUserId", dataForm.getApplyUserId());
formData.put("applyDepartment", dataForm.getApplyDepartment());
formData.put("applyDepartmentId", dataForm.getApplyDepartmentId());
formData.put("applyTime", dataForm.getApplyTime());
Map<String, Object> variables = formData.toJavaObject(Map.class);
variables.put(BPM_CALLBACK_BEAN_NAME, "dataFormService");
BpmProcessInstanceCreateReqDTO reqDTO = new BpmProcessInstanceCreateReqDTO();
reqDTO.setBusinessKey(String.valueOf(id));
reqDTO.setProcessDefinitionKey(dataCollection.getFlowKey());
reqDTO.setVariables(variables);
CommonResult<String> result = bpmProcessInstanceApi.createProcessInstance(loginUser.getId(), reqDTO);
if(!result.isSuccess()){
throw exception0(ERROR_CODE_MODULE_COMMON, result.getMsg());
}
String wfInsId = result.getData();
dataForm.setFlowInstanceId(wfInsId);
dataFormMapper.updateById(dataForm);
return BeanUtils.toBean(dataForm, DataFormRespVO.class);
}
// @Resource private BpmProcessInstanceApi bpmProcessInstanceApi;
// @Override
// @Transactional(rollbackFor = Exception.class)
// public CommonResult<ReportDocumentMainRespVO> createProcessInstance(ReportDocumentMainSaveReqVO entity) {
// LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
// Long id = entity.getId();
// DataFormDO dataForm = getDataForm(id);
// Long dataCollectionId = dataForm.getDataCollectionId();
// DataCollectionDO dataCollection = dataCollectionService.getDataCollection(dataCollectionId);
// if(dataCollection == null)
// throw exception(ErrorCodeConstants.DATA_FORM_EMPTY_COLLECTION_ID);
// if(ObjectUtils.isEmpty(dataCollection.getFlowKey()))
// throw exception(ErrorCodeConstants.DATA_COLLECTION_EMPTY_WF_KEY);
// JSONObject formData = new JSONObject();
// if(dataForm.getFormData() != null)
// formData = JSONObject.parseObject(dataForm.getFormData());
// formData.put("mainId", id);
// formData.put("applyUser", dataForm.getApplyUser());
// formData.put("applyUserId", dataForm.getApplyUserId());
// formData.put("applyDepartment", dataForm.getApplyDepartment());
// formData.put("applyDepartmentId", dataForm.getApplyDepartmentId());
// formData.put("applyTime", dataForm.getApplyTime());
// Map<String, Object> variables = formData.toJavaObject(Map.class);
// variables.put(BPM_CALLBACK_BEAN_NAME, "dataFormService");
// BpmProcessInstanceCreateReqDTO reqDTO = new BpmProcessInstanceCreateReqDTO();
// reqDTO.setBusinessKey(String.valueOf(id));
// reqDTO.setProcessDefinitionKey(dataCollection.getFlowKey());
// reqDTO.setVariables(variables);
// CommonResult<String> result = bpmProcessInstanceApi.createProcessInstance(loginUser.getId(), reqDTO);
// if(!result.isSuccess()){
// throw exception0(ERROR_CODE_MODULE_COMMON, result.getMsg());
// }
// String wfInsId = result.getData();
// dataForm.setFlowInstanceId(wfInsId);
// dataFormMapper.updateById(dataForm);
// return BeanUtils.toBean(dataForm, DataFormRespVO.class);
// }
@PostMapping("/execAddData")