|
@@ -290,7 +290,6 @@ public class FlowOnlineOperationController {
|
|
}
|
|
}
|
|
OnlineDatasource datasource = datasourceResult.getData();
|
|
OnlineDatasource datasource = datasourceResult.getData();
|
|
OnlineTable masterTable = datasource.getMasterTable();
|
|
OnlineTable masterTable = datasource.getMasterTable();
|
|
- Long datasourceId = datasource.getDatasourceId();
|
|
|
|
ProcessInstance instance = flowApiService.getProcessInstance(processInstanceId);
|
|
ProcessInstance instance = flowApiService.getProcessInstance(processInstanceId);
|
|
String dataId = instance.getBusinessKey();
|
|
String dataId = instance.getBusinessKey();
|
|
// 这里把传阅数据放到任务变量中,是为了避免给流程数据操作方法增加额外的方法调用参数。
|
|
// 这里把传阅数据放到任务变量中,是为了避免给流程数据操作方法增加额外的方法调用参数。
|
|
@@ -303,7 +302,7 @@ public class FlowOnlineOperationController {
|
|
FlowTaskComment flowTaskComment = BeanUtil.copyProperties(flowTaskCommentDto, FlowTaskComment.class);
|
|
FlowTaskComment flowTaskComment = BeanUtil.copyProperties(flowTaskCommentDto, FlowTaskComment.class);
|
|
if (StrUtil.isBlank(dataId)) {
|
|
if (StrUtil.isBlank(dataId)) {
|
|
return this.submitNewTask(processInstanceId, taskId,
|
|
return this.submitNewTask(processInstanceId, taskId,
|
|
- flowTaskComment, taskVariableData, masterTable, masterData, slaveData, datasourceId);
|
|
|
|
|
|
+ flowTaskComment, taskVariableData, masterTable, masterData, slaveData, datasource.getDatasourceId());
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
if (StrUtil.equals(flowTaskComment.getApprovalType(), FlowApprovalType.TRANSFER)) {
|
|
if (StrUtil.equals(flowTaskComment.getApprovalType(), FlowApprovalType.TRANSFER)) {
|
|
@@ -313,7 +312,7 @@ public class FlowOnlineOperationController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
flowOnlineOperationService.updateAndTakeTask(
|
|
flowOnlineOperationService.updateAndTakeTask(
|
|
- task, flowTaskComment, taskVariableData, masterTable, masterData, dataId, slaveData, datasourceId);
|
|
|
|
|
|
+ task, flowTaskComment, taskVariableData, masterTable, masterData, dataId, slaveData, datasource.getDatasourceId());
|
|
} catch (FlowOperationException e) {
|
|
} catch (FlowOperationException e) {
|
|
log.error("Failed to call [FlowOnlineOperationService.updateAndTakeTask]", e);
|
|
log.error("Failed to call [FlowOnlineOperationService.updateAndTakeTask]", e);
|
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, e.getMessage());
|
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, e.getMessage());
|
|
@@ -350,15 +349,14 @@ public class FlowOnlineOperationController {
|
|
if (StrUtil.isBlank(flowWorkOrderExt.getDraftData())) {
|
|
if (StrUtil.isBlank(flowWorkOrderExt.getDraftData())) {
|
|
return ResponseResult.success(null);
|
|
return ResponseResult.success(null);
|
|
}
|
|
}
|
|
- Long tableId = flowWorkOrder.getOnlineTableId();
|
|
|
|
- OnlineTable masterTable = onlineTableService.getOnlineTableFromCache(tableId);
|
|
|
|
|
|
+ OnlineTable masterTable = onlineTableService.getOnlineTableFromCache(flowWorkOrder.getOnlineTableId());
|
|
JSONObject draftData = JSON.parseObject(flowWorkOrderExt.getDraftData());
|
|
JSONObject draftData = JSON.parseObject(flowWorkOrderExt.getDraftData());
|
|
JSONObject masterData = draftData.getJSONObject(FlowConstant.MASTER_DATA_KEY);
|
|
JSONObject masterData = draftData.getJSONObject(FlowConstant.MASTER_DATA_KEY);
|
|
JSONObject slaveData = draftData.getJSONObject(FlowConstant.SLAVE_DATA_KEY);
|
|
JSONObject slaveData = draftData.getJSONObject(FlowConstant.SLAVE_DATA_KEY);
|
|
List<OnlineDatasourceRelation> slaveRelationList = null;
|
|
List<OnlineDatasourceRelation> slaveRelationList = null;
|
|
if (slaveData != null) {
|
|
if (slaveData != null) {
|
|
OnlineDatasource datasource =
|
|
OnlineDatasource datasource =
|
|
- onlineDatasourceService.getOnlineDatasourceByMasterTableId(tableId);
|
|
|
|
|
|
+ onlineDatasourceService.getOnlineDatasourceByMasterTableId(flowWorkOrder.getOnlineTableId());
|
|
ResponseResult<List<OnlineDatasourceRelation>> relationListResult =
|
|
ResponseResult<List<OnlineDatasourceRelation>> relationListResult =
|
|
onlineOperationHelper.verifyAndGetRelationList(datasource.getDatasourceId(), null);
|
|
onlineOperationHelper.verifyAndGetRelationList(datasource.getDatasourceId(), null);
|
|
if (!relationListResult.isSuccess()) {
|
|
if (!relationListResult.isSuccess()) {
|
|
@@ -509,9 +507,8 @@ public class FlowOnlineOperationController {
|
|
errorMessage = "数据验证失败,当前消息为所属流程实例没有包含业务主键Id!";
|
|
errorMessage = "数据验证失败,当前消息为所属流程实例没有包含业务主键Id!";
|
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
|
return ResponseResult.error(ErrorCodeEnum.DATA_VALIDATED_FAILED, errorMessage);
|
|
}
|
|
}
|
|
- Long formId = Long.valueOf(flowMessage.getBusinessDataShot());
|
|
|
|
// 验证在线表单及其关联数据源的合法性。
|
|
// 验证在线表单及其关联数据源的合法性。
|
|
- ResponseResult<OnlineDatasource> datasourceResult = this.verifyAndGetOnlineDatasource(formId);
|
|
|
|
|
|
+ ResponseResult<OnlineDatasource> datasourceResult = this.verifyAndGetOnlineDatasource(flowMessage.getBusinessDataShot());
|
|
if (!datasourceResult.isSuccess()) {
|
|
if (!datasourceResult.isSuccess()) {
|
|
return ResponseResult.errorFrom(datasourceResult);
|
|
return ResponseResult.errorFrom(datasourceResult);
|
|
}
|
|
}
|
|
@@ -524,7 +521,7 @@ public class FlowOnlineOperationController {
|
|
JSONObject jsonData = this.buildUserTaskData(
|
|
JSONObject jsonData = this.buildUserTaskData(
|
|
instance.getBusinessKey(), datasource.getMasterTable(), relationListResult.getData());
|
|
instance.getBusinessKey(), datasource.getMasterTable(), relationListResult.getData());
|
|
// 将当前消息更新为已读
|
|
// 将当前消息更新为已读
|
|
- flowMessageService.readCopyTask(messageId);
|
|
|
|
|
|
+ flowMessageService.readCopyTask(messageId + "");
|
|
return ResponseResult.success(jsonData);
|
|
return ResponseResult.success(jsonData);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -595,7 +592,7 @@ public class FlowOnlineOperationController {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
ResponseResult<OnlineTable> verifyTableResult =
|
|
ResponseResult<OnlineTable> verifyTableResult =
|
|
- this.verifyAndGetOnlineTable(datasourceId, relationId, null, null);
|
|
|
|
|
|
+ this.verifyAndGetOnlineTable(datasourceId + "", relationId + "", null, null);
|
|
if (!verifyTableResult.isSuccess()) {
|
|
if (!verifyTableResult.isSuccess()) {
|
|
ResponseResult.output(HttpServletResponse.SC_FORBIDDEN, ResponseResult.errorFrom(verifyTableResult));
|
|
ResponseResult.output(HttpServletResponse.SC_FORBIDDEN, ResponseResult.errorFrom(verifyTableResult));
|
|
return;
|
|
return;
|
|
@@ -640,7 +637,7 @@ public class FlowOnlineOperationController {
|
|
return;
|
|
return;
|
|
}
|
|
}
|
|
ResponseResult<OnlineTable> verifyTableResult =
|
|
ResponseResult<OnlineTable> verifyTableResult =
|
|
- this.verifyAndGetOnlineTable(datasourceId, relationId, verifyResult.getData(), dataId);
|
|
|
|
|
|
+ this.verifyAndGetOnlineTable(datasourceId + "", relationId + "", verifyResult.getData(), dataId);
|
|
if (!verifyTableResult.isSuccess()) {
|
|
if (!verifyTableResult.isSuccess()) {
|
|
ResponseResult.output(HttpServletResponse.SC_FORBIDDEN, ResponseResult.errorFrom(verifyTableResult));
|
|
ResponseResult.output(HttpServletResponse.SC_FORBIDDEN, ResponseResult.errorFrom(verifyTableResult));
|
|
return;
|
|
return;
|
|
@@ -658,9 +655,9 @@ public class FlowOnlineOperationController {
|
|
List<FlowEntry> flowEntryList = flowEntryService.getAllList();
|
|
List<FlowEntry> flowEntryList = flowEntryService.getAllList();
|
|
List<FlowEntryVo> flowEntryVoList = FlowEntry.INSTANCE.fromModelList(flowEntryList);
|
|
List<FlowEntryVo> flowEntryVoList = FlowEntry.INSTANCE.fromModelList(flowEntryList);
|
|
if (CollUtil.isNotEmpty(flowEntryVoList)) {
|
|
if (CollUtil.isNotEmpty(flowEntryVoList)) {
|
|
- Set<Long> pageIdSet = flowEntryVoList.stream().map(FlowEntryVo::getPageId).collect(Collectors.toSet());
|
|
|
|
|
|
+ Set<String> pageIdSet = flowEntryVoList.stream().map(FlowEntryVo::getPageId).collect(Collectors.toSet());
|
|
List<OnlineForm> formList = onlineFormService.getOnlineFormListByPageIds(pageIdSet);
|
|
List<OnlineForm> formList = onlineFormService.getOnlineFormListByPageIds(pageIdSet);
|
|
- Map<Long, List<OnlineForm>> formMap =
|
|
|
|
|
|
+ Map<String, List<OnlineForm>> formMap =
|
|
formList.stream().collect(Collectors.groupingBy(OnlineForm::getPageId));
|
|
formList.stream().collect(Collectors.groupingBy(OnlineForm::getPageId));
|
|
for (FlowEntryVo flowEntryVo : flowEntryVoList) {
|
|
for (FlowEntryVo flowEntryVo : flowEntryVoList) {
|
|
List<OnlineForm> flowEntryFormList = formMap.get(flowEntryVo.getPageId());
|
|
List<OnlineForm> flowEntryFormList = formMap.get(flowEntryVo.getPageId());
|
|
@@ -670,7 +667,7 @@ public class FlowOnlineOperationController {
|
|
return ResponseResult.success(flowEntryVoList);
|
|
return ResponseResult.success(flowEntryVoList);
|
|
}
|
|
}
|
|
|
|
|
|
- private ResponseResult<OnlineDatasource> verifyAndGetOnlineDatasource(Long formId) {
|
|
|
|
|
|
+ private ResponseResult<OnlineDatasource> verifyAndGetOnlineDatasource(String formId) {
|
|
List<OnlineFormDatasource> formDatasourceList = onlineFormService.getFormDatasourceListFromCache(formId);
|
|
List<OnlineFormDatasource> formDatasourceList = onlineFormService.getFormDatasourceListFromCache(formId);
|
|
if (CollUtil.isEmpty(formDatasourceList)) {
|
|
if (CollUtil.isEmpty(formDatasourceList)) {
|
|
String errorMessage = "数据验证失败,流程任务绑定的在线表单Id [" + formId + "] 不存在,请修改流程图!";
|
|
String errorMessage = "数据验证失败,流程任务绑定的在线表单Id [" + formId + "] 不存在,请修改流程图!";
|
|
@@ -733,10 +730,10 @@ public class FlowOnlineOperationController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if (slaveData != null && relationList != null) {
|
|
if (slaveData != null && relationList != null) {
|
|
- Map<Long, OnlineDatasourceRelation> relationMap =
|
|
|
|
|
|
+ Map<String, OnlineDatasourceRelation> relationMap =
|
|
relationList.stream().collect(Collectors.toMap(OnlineDatasourceRelation::getRelationId, c -> c));
|
|
relationList.stream().collect(Collectors.toMap(OnlineDatasourceRelation::getRelationId, c -> c));
|
|
for (Map.Entry<String, Object> entry : slaveData.entrySet()) {
|
|
for (Map.Entry<String, Object> entry : slaveData.entrySet()) {
|
|
- OnlineDatasourceRelation relation = relationMap.get(Long.valueOf(entry.getKey()));
|
|
|
|
|
|
+ OnlineDatasourceRelation relation = relationMap.get(entry.getKey());
|
|
if (relation == null) {
|
|
if (relation == null) {
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
@@ -779,7 +776,7 @@ public class FlowOnlineOperationController {
|
|
OnlineTable masterTable,
|
|
OnlineTable masterTable,
|
|
JSONObject masterData,
|
|
JSONObject masterData,
|
|
JSONObject slaveData,
|
|
JSONObject slaveData,
|
|
- Long datasourceId) {
|
|
|
|
|
|
+ String datasourceId) {
|
|
ResponseResult<List<ColumnData>> columnDataListResult =
|
|
ResponseResult<List<ColumnData>> columnDataListResult =
|
|
onlineOperationHelper.buildTableData(masterTable, masterData, false, null);
|
|
onlineOperationHelper.buildTableData(masterTable, masterData, false, null);
|
|
if (!columnDataListResult.isSuccess()) {
|
|
if (!columnDataListResult.isSuccess()) {
|
|
@@ -814,7 +811,7 @@ public class FlowOnlineOperationController {
|
|
}
|
|
}
|
|
|
|
|
|
private ResponseResult<OnlineTable> verifyAndGetOnlineTable(
|
|
private ResponseResult<OnlineTable> verifyAndGetOnlineTable(
|
|
- Long datasourceId, Long relationId, String businessKey, String dataId) {
|
|
|
|
|
|
+ String datasourceId, String relationId, String businessKey, String dataId) {
|
|
ResponseResult<OnlineDatasource> datasourceResult =
|
|
ResponseResult<OnlineDatasource> datasourceResult =
|
|
onlineOperationHelper.verifyAndGetDatasource(datasourceId);
|
|
onlineOperationHelper.verifyAndGetDatasource(datasourceId);
|
|
if (!datasourceResult.isSuccess()) {
|
|
if (!datasourceResult.isSuccess()) {
|
|
@@ -907,7 +904,7 @@ public class FlowOnlineOperationController {
|
|
}
|
|
}
|
|
List<OnlinePageDatasource> datasourceList =
|
|
List<OnlinePageDatasource> datasourceList =
|
|
onlinePageService.getOnlinePageDatasourceListByPageId(flowEntry.getPageId());
|
|
onlinePageService.getOnlinePageDatasourceListByPageId(flowEntry.getPageId());
|
|
- Optional<Long> r = datasourceList.stream()
|
|
|
|
|
|
+ Optional<String> r = datasourceList.stream()
|
|
.map(OnlinePageDatasource::getDatasourceId).filter(c -> c.equals(datasourceId)).findFirst();
|
|
.map(OnlinePageDatasource::getDatasourceId).filter(c -> c.equals(datasourceId)).findFirst();
|
|
if (!r.isPresent()) {
|
|
if (!r.isPresent()) {
|
|
errorMessage = "数据验证失败,当前数据源Id并不属于当前流程!";
|
|
errorMessage = "数据验证失败,当前数据源Id并不属于当前流程!";
|
|
@@ -932,7 +929,7 @@ public class FlowOnlineOperationController {
|
|
Set<String> businessKeySet = flowWorkOrderVoList.stream()
|
|
Set<String> businessKeySet = flowWorkOrderVoList.stream()
|
|
.filter(c -> c.getBusinessKey() != null)
|
|
.filter(c -> c.getBusinessKey() != null)
|
|
.map(FlowWorkOrderVo::getBusinessKey).collect(Collectors.toSet());
|
|
.map(FlowWorkOrderVo::getBusinessKey).collect(Collectors.toSet());
|
|
- Long tableId = flowWorkOrderVoList.get(0).getOnlineTableId();
|
|
|
|
|
|
+ String tableId = flowWorkOrderVoList.get(0).getOnlineTableId();
|
|
OnlineTable masterTable = onlineTableService.getOnlineTableFromCache(tableId);
|
|
OnlineTable masterTable = onlineTableService.getOnlineTableFromCache(tableId);
|
|
if (CollUtil.isNotEmpty(businessKeySet)) {
|
|
if (CollUtil.isNotEmpty(businessKeySet)) {
|
|
Set<?> convertedBusinessKeySet =
|
|
Set<?> convertedBusinessKeySet =
|
|
@@ -974,11 +971,11 @@ public class FlowOnlineOperationController {
|
|
List<FlowWorkOrderVo> draftWorkOrderList = flowWorkOrderVoList.stream()
|
|
List<FlowWorkOrderVo> draftWorkOrderList = flowWorkOrderVoList.stream()
|
|
.filter(c -> c.getFlowStatus().equals(FlowTaskStatus.DRAFT)).collect(Collectors.toList());
|
|
.filter(c -> c.getFlowStatus().equals(FlowTaskStatus.DRAFT)).collect(Collectors.toList());
|
|
if (CollUtil.isNotEmpty(draftWorkOrderList)) {
|
|
if (CollUtil.isNotEmpty(draftWorkOrderList)) {
|
|
- Set<Long> workOrderIdSet = draftWorkOrderList.stream()
|
|
|
|
|
|
+ Set<String> workOrderIdSet = draftWorkOrderList.stream()
|
|
.map(FlowWorkOrderVo::getWorkOrderId).collect(Collectors.toSet());
|
|
.map(FlowWorkOrderVo::getWorkOrderId).collect(Collectors.toSet());
|
|
List<FlowWorkOrderExt> workOrderExtList =
|
|
List<FlowWorkOrderExt> workOrderExtList =
|
|
flowWorkOrderService.getFlowWorkOrderExtByWorkFlowIds(workOrderIdSet);
|
|
flowWorkOrderService.getFlowWorkOrderExtByWorkFlowIds(workOrderIdSet);
|
|
- Map<Long, FlowWorkOrderExt> workOrderExtMap = workOrderExtList.stream()
|
|
|
|
|
|
+ Map<String, FlowWorkOrderExt> workOrderExtMap = workOrderExtList.stream()
|
|
.collect(Collectors.toMap(FlowWorkOrderExt::getWorkOrderId, c -> c));
|
|
.collect(Collectors.toMap(FlowWorkOrderExt::getWorkOrderId, c -> c));
|
|
for (FlowWorkOrderVo workOrder : draftWorkOrderList) {
|
|
for (FlowWorkOrderVo workOrder : draftWorkOrderList) {
|
|
FlowWorkOrderExt workOrderExt = workOrderExtMap.get(workOrder.getWorkOrderId());
|
|
FlowWorkOrderExt workOrderExt = workOrderExtMap.get(workOrder.getWorkOrderId());
|