Commit 98137787 by 宋祥

1.德诚开放接口开发

parent d19747a2
......@@ -124,19 +124,20 @@ public class DcOpenApi {
* @return
* @throws IOException
*/
public static List<DcContractList> interactionAdd(String title, String content, String ords) throws IOException {
public static void interactionAdd(String title, String content, String ords) throws IOException {
JSONArray dataJsons = new JSONArray();
dataJsons.add(DcApiUtils.buildValueJson("title", title));
dataJsons.add(DcApiUtils.buildValueJson("sort2", 451)); // 451:默认分类
dataJsons.add(DcApiUtils.buildValueJson("intro", content));
dataJsons.add(DcApiUtils.buildValueJson("member", 1));
dataJsons.add(DcApiUtils.buildValueJson("member", 1)); // 0:全部,1: 不分,-1:私密
dataJsons.add(DcApiUtils.buildValueJson("share", ords));
String param = JSON.toJSONString(DcApiUtils.buildParamJson(dataJsons, "__sys_dosave"));
String result = HttpUtils.post(DeChengConst.INTERACTION_ADD, param, HttpUtils.JSON_MEDIA_TYPE);
if (StringUtils.isBlank(result)) {
throw new PlatException("【德诚】添加工作互动失败");
}
return DcApiUtils.handleResult(result, DcContractList.class);
// 异常处理
DcApiUtils.handleMessage(JSONObject.parseObject(result));
}
}
......@@ -143,8 +143,6 @@ public class DcApiUtils {
String msg = resultJson.getString("Msg");
if (DeChengConst.ApiStatus.S400.equals(code)) {
DcTokenApi.refreshToken();
} else if (DeChengConst.ApiStatus.S2.equals(code)) {
DcTokenApi.refreshToken();
}
throw new PlatException("【智邦】" + msg);
}
......@@ -209,14 +207,15 @@ public class DcApiUtils {
public static void handleMessage(JSONObject resultJson) {
JSONObject headerJson = resultJson.getJSONObject("header");
String message = headerJson.getString("message");
String status = headerJson.getString("status");
// 会话非法
Integer status = headerJson.getInteger("status");
if (status != null && status == 0) {
return;
}
// 会话超时
if (DeChengConst.ApiStatus.S400.equals(status)) {
DcTokenApi.refreshToken();
} else if (DeChengConst.ApiStatus.S2.equals(status)) {
DcTokenApi.refreshToken();
throw new PlatException("【智邦】" + message);
}
throw new PlatException("【智邦】" + message);
}
/**
......
......@@ -105,7 +105,8 @@ public class ServiceHGWD003 extends ServiceEPBase {
return results;
}
for (HGSC001 dbSc001 : dbSc001s) {
results.add(buildLeaf(parentLabel, dbSc001.getProjCode(), dbSc001.getProjName(), HgWdConstant.LeafType.P));
String text = "[" + dbSc001.getProjCode() + "]" + dbSc001.getProjName();
results.add(buildLeaf(parentLabel, dbSc001.getProjCode(), text, HgWdConstant.LeafType.P));
}
// 设置叶子节点
setTreeNodeLeaf(results);
......
......@@ -21,6 +21,20 @@ $(function () {
// 显示授权按钮
showAuthButton();
},
template: function (node) {
var item = node.item;
let icon = 'fa fa-globe'
switch (item.leafType) {
case 'P':
icon = 'fa fa-clipboard'
break;
case 'C':
icon = 'fa fa-folder'
break;
}
return '<span class="' + icon + '" style="padding-right: 8px"> </span>'
+ '<span class="titleClass" title="' + item.label + '">' + item.text + '</span>'
},
selectNode: {
treeId: '',
leaf: false,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment