学校OA待办不存在,跳过改已办并继续流程
This commit is contained in:
@@ -271,7 +271,14 @@ public class SchoolOaTodoServiceImpl implements SchoolOaTodoService {
|
||||
return;
|
||||
}
|
||||
String updateUrl = requireConfig("school-oa.todo.update-url").replace("{uniqueId}", uniqueId);
|
||||
String responseBody = sendTodoRequest(updateUrl, "学校OA待办完成失败", "学校OA待办完成异常");
|
||||
String responseBody = sendTodoRequest(updateUrl, null, "学校OA待办完成失败", "学校OA待办完成异常", true);
|
||||
JSONObject response = JSONUtil.parseObj(responseBody);
|
||||
if (response.getInt("state", 0) == 1131) {
|
||||
// 历史流程任务没有创建对应的 OA 待办时,允许 WF 继续流转并由原流程逻辑创建下一节点待办。
|
||||
log.warn("学校OA待办不存在,跳过改已办并继续流程,uniqueId={},state=1131,message={}",
|
||||
uniqueId, response.getStr("message"));
|
||||
return;
|
||||
}
|
||||
log.info("学校OA待办完成成功,uniqueId={},response={}", uniqueId, responseBody);
|
||||
}
|
||||
|
||||
@@ -319,7 +326,7 @@ public class SchoolOaTodoServiceImpl implements SchoolOaTodoService {
|
||||
|
||||
String uniqueId = task.getId() + "_" + actor.getActorId();
|
||||
completeTodoByUniqueId(uniqueId);
|
||||
log.info("学校OA待办完成成功,taskId={},receiveCode={},uniqueId={}", task.getId(), actor.getActorAccount(), uniqueId);
|
||||
log.info("学校OA待办完成处理结束,taskId={},receiveCode={},uniqueId={}", task.getId(), actor.getActorAccount(), uniqueId);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -481,6 +488,10 @@ public class SchoolOaTodoServiceImpl implements SchoolOaTodoService {
|
||||
}
|
||||
|
||||
private String sendTodoRequest(String url, JSONObject body, String failMessage, String errorMessage) {
|
||||
return sendTodoRequest(url, body, failMessage, errorMessage, false);
|
||||
}
|
||||
|
||||
private String sendTodoRequest(String url, JSONObject body, String failMessage, String errorMessage, boolean skipMissingTodo) {
|
||||
String requestBody = body == null ? "" : JSONUtil.toJsonStr(body);
|
||||
log.info("学校OA请求开始,url={},body={}", url, requestBody);
|
||||
try {
|
||||
@@ -493,7 +504,9 @@ public class SchoolOaTodoServiceImpl implements SchoolOaTodoService {
|
||||
String responseBody = request.execute().body();
|
||||
log.info("学校OA请求响应,url={},response={}", url, responseBody);
|
||||
JSONObject response = JSONUtil.parseObj(responseBody);
|
||||
if (response.getInt("state", 0) != 200) {
|
||||
int state = response.getInt("state", 0);
|
||||
// 仅完成待办接口允许 OA 返回“uniqueId 不存在”;创建、删除和其他修改仍按原规则报错。
|
||||
if (state != 200 && !(skipMissingTodo && state == 1131)) {
|
||||
log.warn("学校OA请求失败响应,url={},body={},response={}", url, requestBody, responseBody);
|
||||
throw new BaseException("{}:{}", failMessage, response.getStr("message", responseBody));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user