- 优化OA待办日志

s
This commit is contained in:
weiyunlong 2025-05-07 12:38:28 +08:00
parent b90b472a2e
commit cee95af175
2 changed files with 23 additions and 10 deletions

View File

@ -94,16 +94,19 @@ public class todoZyTaskServiceHandler extends AbstractMessageServiceHandler {
Map<String, Object> params = toDoInfo.getParams(); Map<String, Object> params = toDoInfo.getParams();
String subjectJson = (String) params.get("subject"); String subjectJson = (String) params.get("subject");
JSONObject subjectObj = JSONObject.parseObject(subjectJson); JSONObject subjectObj = JSONObject.parseObject(subjectJson);
String title = ""; String title = "单据编号:" + billNo;
if (null != subjectObj) { if (null != subjectObj) {
title = subjectObj.getString("zh_CN"); title = subjectObj.getString("zh_CN");
} }
// 节点名称 // 节点名称
String executionName = ""; String executionName = "";
DynamicObject execution = BusinessDataServiceHelper.loadSingle(executionId, "wf_execution"); try {
if (execution != null) { DynamicObject execution = BusinessDataServiceHelper.loadSingle(executionId, "wf_execution");
executionName = execution.getString("activityname");// 节点名称 if (execution != null) {
executionName = execution.getString("activityname");// 节点名称
}
} catch (Exception e) {
logger.error("获取节点名称失败", e);
} }
// 获取Url // 获取Url
String url = toDoInfo.getUrl(); // 链接 String url = toDoInfo.getUrl(); // 链接

View File

@ -20,7 +20,7 @@ public class OAUtils {
public static final String oaUrl = System.getProperty("oaUrl");//测试环境 public static final String oaUrl = System.getProperty("oaUrl");//测试环境
public static final String oaAPIKey = System.getProperty("oaAPIKey");//测试环境APIKey public static final String oaAPIKey = System.getProperty("oaAPIKey");//测试环境APIKey
private static final Log logger = LogFactory.getLog(OAUtils.class); private static final Log logger = LogFactory.getLog(OAUtils.class);
private static final String Apimenthod = "OA待办接口"; private static final String Apimenthod = "OA接口";
// public static final String oaUrl = "https://hipint.jahwa.com.cn:6443/gateway/HIP_ReceiveToOA/1.0/receiveToOA";//正式环境 // public static final String oaUrl = "https://hipint.jahwa.com.cn:6443/gateway/HIP_ReceiveToOA/1.0/receiveToOA";//正式环境
// public static final String oaAPIKey = "8281da80-b39b-48c4-83bd-f8e480740c6a";//测试环境APIKey // public static final String oaAPIKey = "8281da80-b39b-48c4-83bd-f8e480740c6a";//测试环境APIKey
@ -94,6 +94,16 @@ public class OAUtils {
* @param thirdPartyMap 第三方数据映射 * @param thirdPartyMap 第三方数据映射
*/ */
private static void processRequest(Map<String, String> customerHeader, JSONObject pendingsBody, Map<String, Object> thirdPartyMap) { private static void processRequest(Map<String, String> customerHeader, JSONObject pendingsBody, Map<String, Object> thirdPartyMap) {
//0:待办,2已办,4办结
String o = ""+thirdPartyMap.get("isremark");
String title = "未知:";
if ("0".equals(o)) {
title = "待办:";
}else if ("2".equals(o)) {
title = "已办:";
}else if ("4".equals(o)) {
title = "办结:";
}
String pendingPostjson = null; String pendingPostjson = null;
JSONObject jsonObject = null; JSONObject jsonObject = null;
try { try {
@ -103,10 +113,10 @@ public class OAUtils {
// 检查JSON对象是否为空 // 检查JSON对象是否为空
if (jsonObject != null && !jsonObject.isEmpty()) { if (jsonObject != null && !jsonObject.isEmpty()) {
handleResponse(jsonObject, pendingsBody, thirdPartyMap); handleResponse(jsonObject, pendingsBody, thirdPartyMap,title);
}else { }else {
logger.info("推送OA消息失败"); logger.info("推送OA消息失败");
saveLog("待办:" +(thirdPartyMap.get("billno").toString()), pendingsBody, jsonObject, false); saveLog(title +(thirdPartyMap.get("billno").toString()), pendingsBody, jsonObject, false);
} }
} catch (Exception e) { } catch (Exception e) {
handleException(e, pendingsBody, thirdPartyMap, jsonObject); handleException(e, pendingsBody, thirdPartyMap, jsonObject);
@ -133,7 +143,7 @@ public class OAUtils {
* @param pendingsBody 请求体 * @param pendingsBody 请求体
* @param thirdPartyMap 第三方数据映射 * @param thirdPartyMap 第三方数据映射
*/ */
private static void handleResponse(JSONObject jsonObject, JSONObject pendingsBody, Map<String, Object> thirdPartyMap) { private static void handleResponse(JSONObject jsonObject, JSONObject pendingsBody, Map<String, Object> thirdPartyMap,String title) {
String code = (String) jsonObject.get("code"); String code = (String) jsonObject.get("code");
boolean isSuccess = false; boolean isSuccess = false;
String logMessage = ""; String logMessage = "";
@ -152,7 +162,7 @@ public class OAUtils {
} }
logger.info(logMessage); logger.info(logMessage);
saveLog("待办:" + thirdPartyMap.get("billno").toString(), pendingsBody, jsonObject, isSuccess); saveLog(title + thirdPartyMap.get("billno").toString(), pendingsBody, jsonObject, isSuccess);
} }