提交 455cd081 authored 作者: 000516's avatar 000516

T100接口参数简化

package com.sfa.job.service.feishu;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import com.alibaba.fastjson2.JSONObject;
import com.lark.oapi.service.corehr.v2.model.*;
import com.sfa.common.core.enums.promotion.PlanStatus;
......@@ -14,13 +12,11 @@ import com.sfa.job.pojo.feishu.event.EventCallBackDto;
import com.sfa.job.pojo.promotion.response.ActivityPlanApprovalDto;
import com.sfa.job.pojo.response.SysEventLogDto;
import com.sfa.job.util.T100Util;
import io.swagger.v3.core.util.Json;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.Objects;
/**
......@@ -255,32 +251,18 @@ public class EventCallbackServiceImpl implements IEventCallbackService{
private String createOrUpdateDept(JSONObject deptT100){
JSONObject service = new JSONObject();
service.put("name","department.create");
JSONObject host = new JSONObject();
host.put("acct","tiptop");
host.put("ip","192.168.100.20");
host.put("lang","zh_CN");
host.put("prod","CRM");
host.put("timestamp",DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MS_PATTERN));
JSONObject deptJson = new JSONObject();
deptJson.put("service",service);
deptJson.put("host",host);
return t100Util.createOrUpdateDept(deptJson,deptT100);
}
private String createOrUpdateUser(JSONObject userT100){
JSONObject service = new JSONObject();
service.put("name","employee.create");
JSONObject host = new JSONObject();
host.put("acct","tiptop");
host.put("ip","192.168.100.20");
host.put("lang","zh_CN");
host.put("prod","CRM");
host.put("timestamp",DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MS_PATTERN));
JSONObject payload = new JSONObject();
payload.putObject("std_data").putObject("parameter").putArray("master_data").add(userT100);
JSONObject userJson = new JSONObject();
userJson.put("service",service);
userJson.put("host",host);
userJson.put("payload",payload);
return t100Util.createOrUpdateUser(userJson);
}
......
package com.sfa.job.util;
import cn.hutool.core.date.DatePattern;
import cn.hutool.core.date.DateUtil;
import cn.hutool.http.HttpUtil;
import com.alibaba.fastjson2.JSONObject;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
import java.util.Date;
import java.util.HashMap;
/**
......@@ -24,6 +27,8 @@ public class T100Util {
private String entId;
public String createOrUpdateDept(JSONObject deptJson,JSONObject deptT100){
deptJson.put("host",getHost());
JSONObject datakey = new JSONObject();
datakey.put("CompanyId","BJHQ");
datakey.put("EntId",entId);
......@@ -49,6 +54,7 @@ public class T100Util {
}
public String createOrUpdateUser(JSONObject userJson) {
userJson.put("host",getHost());
JSONObject datakey = new JSONObject();
datakey.put("CompanyId","BJHQ");
datakey.put("EntId",entId);
......@@ -68,4 +74,14 @@ public class T100Util {
return msg;
}
private JSONObject getHost(){
JSONObject host = new JSONObject();
host.put("acct","tiptop");
host.put("ip","192.168.100.20");
host.put("lang","zh_CN");
host.put("prod","CRM");
host.put("timestamp",DateUtil.format(new Date(), DatePattern.NORM_DATETIME_MS_PATTERN));
return host;
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论