需要客户提供的信息
参考:https://open.welink.huaweicloud.com/docs/#/990hh0/whokyc/eatdqi
接口调用信息
应用clientId :
应用密钥clientSecret:
第一步:结果格式配置
第二步:账号绑定
第三步:待办配置
1、新增待办设置
接口地址设置:https://open.welink.huaweicloud.com/api/todo/v3/addtask
接口类型:POST
Body参数设置:
{
"taskId": "#F012_#F001",
"taskTitle": "#F056 \n单据号:#F053 \n 提交人:#F054",
"userId": "#F001", "detailsUrl":"//www.sxgtbz.com/erp/syncdata/open/oa/authorize/common/#F028/#F037/#F015/true?code=$(code)",
"detailsUrlPc":"//www.sxgtbz.com/erp/syncdata/open/oa/authorize/common/#F028/#F037/#F015/false?code=$(code)",
"appName": "CRM",
"applicantUserId": "#F049",
"isMsg": 1,
"isShowApplicantUserName":true,
"applicantId":"#F012",
"businessCode":""
}
2、编辑待办设置
接口地址设置:https://open.welink.huaweicloud.com/api/todo/v1/deltask
接口类型:PUT
Body参数设置:
{
"taskId": "#F012_#F001",
"userId": "#F001"
}
3、删除待办设置
接口地址设置:https://open.welink.huaweicloud.com/api/todo/v1/deltask
接口类型:DELETE
Body参数设置:
{
"taskId": "#F012_#F001"
}
第四步:配置待办同步函数
代码示例(TODoAll__c)
**
* @author 纷享沈佳琪
* @codeName 集成_待办信息请求处理
* @description 集成_待办信息请求处理
* @createTime 2023-09-14
*/
log.info("syncArg:"+Fx.json.toJson(syncArg))
String requestDataStr = syncArg["requestData"] as String
Map<String,Object> requestData = Fx.json.parse(requestDataStr)
String urldata = syncArg["url"] as String //请求地址,可以返回动态的地址
if(urldata.contains("updatetask") || urldata.contains("deltask") ){
//地址拼接参数
urldata="${urldata}?"
requestData.each{
String k,Object v ->
urldata=urldata+k+"="+v+"&"
}
urldata=urldata.substring(0,urldata.length()-1)
log.info("urldata:"+urldata)
requestDataStr=null
}
Map header = [:]
String access_token = WeLinkUtils.getAccessToken(null)
header.put("Accept-Charset","UTF-8'" )
header.put("Content-Type","application/json")
header.put("x-wlk-Authorization",access_token)
return ["header":header,"url":urldata,"requestData":requestDataStr]
第五步:设置免登录鉴权URL函数
代码示例(sync_ssoFunction__c)
/**
* @author 纷享沈佳琪
* @codeName 集成_待办免登录跳转
* @description 待办免登录跳转
* @createTime 2023-09-14
*/
String url = syncArg["oaConnectParam"]["ssoAuthUrl"] as String;
log.info("url:"+url)
String code = syncArg["params"]["requestParams"]["code"] as String;
log.info("code:"+code);
String userId = WeLinkUtils.getUserid(code)
syncArg.put("oaUser",userId.trim()) //固定返回oaUser为key的第三方账号
log.info("syncArg:"+Fx.json.toJson(syncArg))
return syncArg