提交 1ffc538b authored 作者: 000516's avatar 000516

飞书日志形式修改

上级 77548800
...@@ -31,7 +31,6 @@ import org.springframework.stereotype.Component; ...@@ -31,7 +31,6 @@ import org.springframework.stereotype.Component;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Objects;
/** /**
* @author : liqiulin * @author : liqiulin
...@@ -106,8 +105,7 @@ public class FeiShuUtil { ...@@ -106,8 +105,7 @@ public class FeiShuUtil {
.userAccessToken(userAccessToken) .userAccessToken(userAccessToken)
.build()); .build());
if (!resp.success()) { if (!resp.success()) {
log.error(String.format("code:%s,msg:%s,reqId:%s, resp:%s", log.error("根据userAccessToken获取用户信息失败:code:{},msg:{},body{}",resp.getCode(),resp.getMsg(),new String(resp.getRawResponse().getBody(), UTF_8));
resp.getCode(), resp.getMsg(), resp.getRequestId(), Jsons.createGSON(true, false).toJson(JsonParser.parseString(new String(resp.getRawResponse().getBody(), "UTF-8")))));
return null; return null;
} }
return resp.getData(); return resp.getData();
...@@ -151,8 +149,7 @@ public class FeiShuUtil { ...@@ -151,8 +149,7 @@ public class FeiShuUtil {
BatchGetDepartmentResp resp = client.corehr().v2().department().batchGet(req); BatchGetDepartmentResp resp = client.corehr().v2().department().batchGet(req);
// 处理服务端错误 // 处理服务端错误
if (!resp.success()) { if (!resp.success()) {
log.error(String.format("code:%s,msg:%s,reqId:%s, resp:%s", log.error("获取飞书部门信息失败:code:{},msg:{},body{}",resp.getCode(),resp.getMsg(),new String(resp.getRawResponse().getBody(), UTF_8));
resp.getCode(), resp.getMsg(), resp.getRequestId(), Jsons.createGSON(true, false).toJson(JsonParser.parseString(new String(resp.getRawResponse().getBody(), UTF_8)))));
return null; return null;
} }
Department[] items = resp.getData().getItems(); Department[] items = resp.getData().getItems();
...@@ -177,8 +174,7 @@ public class FeiShuUtil { ...@@ -177,8 +174,7 @@ public class FeiShuUtil {
.build(); .build();
ChildrenDepartmentResp resp = client.contact().department().children(req); ChildrenDepartmentResp resp = client.contact().department().children(req);
if (!resp.success()) { if (!resp.success()) {
log.error(String.format("%s,code:%s,msg:%s,reqId:%s, resp:%s", "根据部门父编码获取子部门失败", log.error("根据部门父编码获取子部门失败:code:{},msg:{},body{}",resp.getCode(),resp.getMsg(),new String(resp.getRawResponse().getBody(), UTF_8));
resp.getCode(), resp.getMsg(), resp.getRequestId(), Jsons.createGSON(true, false).toJson(JsonParser.parseString(new String(resp.getRawResponse().getBody(), UTF_8)))));
return null; return null;
} }
JSONArray items = JSONObject.parse(Jsons.DEFAULT.toJson(resp.getData())).getJSONArray("items"); JSONArray items = JSONObject.parse(Jsons.DEFAULT.toJson(resp.getData())).getJSONArray("items");
...@@ -203,8 +199,7 @@ public class FeiShuUtil { ...@@ -203,8 +199,7 @@ public class FeiShuUtil {
.build(); .build();
FindByDepartmentUserResp resp = client.contact().user().findByDepartment(req); FindByDepartmentUserResp resp = client.contact().user().findByDepartment(req);
if (!resp.success()) { if (!resp.success()) {
log.error(String.format("%s,code:%s,msg:%s,reqId:%s, resp:%s", "获取部门用户", log.error("获取部门用户:code:{},msg:{},body{}",resp.getCode(),resp.getMsg(),new String(resp.getRawResponse().getBody(), UTF_8));
resp.getCode(), resp.getMsg(), resp.getRequestId(), Jsons.createGSON(true, false).toJson(JsonParser.parseString(new String(resp.getRawResponse().getBody(), UTF_8)))));
return null; return null;
} }
JSONArray items = JSONObject.parse(Jsons.DEFAULT.toJson(resp.getData())).getJSONArray("items"); JSONArray items = JSONObject.parse(Jsons.DEFAULT.toJson(resp.getData())).getJSONArray("items");
...@@ -291,8 +286,8 @@ public class FeiShuUtil { ...@@ -291,8 +286,8 @@ public class FeiShuUtil {
GetInstanceResp resp = client.approval().v4().instance().get(req); GetInstanceResp resp = client.approval().v4().instance().get(req);
// 处理服务端错误 // 处理服务端错误
if (!resp.success()) { if (!resp.success()) {
throw new RuntimeException(String.format("%s,code:%s,msg:%s,reqId:%s, resp:%s", "创建飞书审批失败", log.error("创建飞书审批失败:code:{},msg:{},body{}",resp.getCode(),resp.getMsg(),new String(resp.getRawResponse().getBody(), UTF_8));
resp.getCode(), resp.getMsg(), resp.getRequestId(), Jsons.createGSON(true, false).toJson(JsonParser.parseString(new String(resp.getRawResponse().getBody(), UTF_8))))); return null;
} }
return JSONObject.toJSONString(resp.getData()); return JSONObject.toJSONString(resp.getData());
} catch (Exception e) { } catch (Exception e) {
...@@ -378,8 +373,7 @@ public class FeiShuUtil { ...@@ -378,8 +373,7 @@ public class FeiShuUtil {
BatchGetEmployeeResp resp = client.corehr().v2().employee().batchGet(req); BatchGetEmployeeResp resp = client.corehr().v2().employee().batchGet(req);
// 处理服务端错误 // 处理服务端错误
if (!resp.success()) { if (!resp.success()) {
log.error(String.format("code:%s,msg:%s,reqId:%s, resp:%s", log.error("批量查询员工信息:code:{},msg:{},body{}",resp.getCode(),resp.getMsg(),new String(resp.getRawResponse().getBody(), UTF_8));
resp.getCode(), resp.getMsg(), resp.getRequestId(), Jsons.createGSON(true, false).toJson(JsonParser.parseString(new String(resp.getRawResponse().getBody(), UTF_8)))));
return null; return null;
} }
// 只查询一个员工 // 只查询一个员工
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论