feat(REQ-3340) - 调整打印变量值的处理逻辑
This commit is contained in:
parent
df85c19673
commit
fe95eb783a
@ -22,6 +22,7 @@ import cn.axzo.workflow.server.common.util.RpcExternalUtil;
|
||||
import cn.axzo.workflow.server.controller.web.bpmn.BpmnProcessInstanceController;
|
||||
import cn.azxo.framework.common.model.CommonResponse;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.google.common.collect.Lists;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
@ -200,9 +201,29 @@ public class PrintAdminController implements PrintAdminApi {
|
||||
|
||||
// 生成系统字段的变量
|
||||
generateSystemFieldVariables(processInstanceId, result);
|
||||
|
||||
// 将所有变量都转换成 JSON 对象返回
|
||||
convertValueToObject(result);
|
||||
return success(result);
|
||||
}
|
||||
|
||||
private void convertValueToObject(Map<String, Object> result) {
|
||||
if (CollectionUtils.isEmpty(result)) {
|
||||
return;
|
||||
}
|
||||
|
||||
result.forEach((key, value) -> {
|
||||
if (!(value instanceof String)) {
|
||||
return;
|
||||
}
|
||||
if (((String) value).startsWith("[")) {
|
||||
result.put(key, JSONArray.parseArray((String) value));
|
||||
} else if (((String) value).startsWith("{")) {
|
||||
result.put(key, JSONObject.parseObject((String) value));
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void generateSystemFieldVariables(String processInstanceId, Map<String, Object> result) {
|
||||
CommandExecutor commandExecutor = processEngineConfiguration.getCommandExecutor();
|
||||
Map<String, Object> variables = commandExecutor.execute(new CustomGetProcessInstanceVariablesCmd(processInstanceId));
|
||||
@ -231,7 +252,7 @@ public class PrintAdminController implements PrintAdminApi {
|
||||
taskLogMap.put(PRINT_VAR_PROCESS_LOG_ACTIVITY_NAME, taskLog.getName());
|
||||
taskLogMap.put(PRINT_VAR_PROCESS_LOG_APPROVER_NAME, taskLog.getAssigneeSnapshot().getAssignerName());
|
||||
OrgNodeUserBriefInfoResp user = getUserInfo(taskLog.getAssigneeSnapshot());
|
||||
taskLogMap.put(PRINT_VAR_PROCESS_LOG_UNIT,user.getOrganizationalUnitName());
|
||||
taskLogMap.put(PRINT_VAR_PROCESS_LOG_UNIT, user.getOrganizationalUnitName());
|
||||
taskLogMap.put(PRINT_VAR_PROCESS_LOG_POSITION, user.getJob().getName());
|
||||
taskLogMap.put(PRINT_VAR_PROCESS_LOG_ADVICE, taskLog.getAdvice());
|
||||
taskLogMap.put(PRINT_VAR_PROCESS_LOG_OPERATION_TIME, sdf.format(taskLog.getCreateTime()));
|
||||
|
||||
Loading…
Reference in New Issue
Block a user