|
@@ -86,13 +86,13 @@ public class IFeiShuCommonService {
|
|
|
continue;
|
|
|
}
|
|
|
|
|
|
- if(targetGroups.isEmpty()){
|
|
|
+ if (targetGroups.isEmpty()) {
|
|
|
String omsId = jsonObject.getString("OMS系统ID");
|
|
|
if (!targetGroupData.containsKey(omsId)) {
|
|
|
targetGroupData.put(omsId, new ArrayList<>());
|
|
|
}
|
|
|
targetGroupData.get(omsId).add(jsonObject);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
if (targetGroups.contains(groupNameData)) {
|
|
|
if (!targetGroupData.containsKey(groupNameData)) {
|
|
|
targetGroupData.put(groupNameData, new ArrayList<>());
|
|
@@ -164,7 +164,7 @@ public class IFeiShuCommonService {
|
|
|
*
|
|
|
* @param okkiSite
|
|
|
*/
|
|
|
- public String syncWebsiteToFeiShuSheet(OkkiSite okkiSite,Map<String, Object> updateGroupFieldMap) {
|
|
|
+ public String syncWebsiteToFeiShuSheet(OkkiSite okkiSite, Map<String, Object> updateGroupFieldMap) {
|
|
|
FeiShuConfigEnum configEnum = FeiShuConfigManager.getInstance().getConfigEnum();
|
|
|
Client client = Client.newBuilder(configEnum.getAppId(), configEnum.getAppSecret()).build();
|
|
|
|
|
@@ -684,7 +684,7 @@ public class IFeiShuCommonService {
|
|
|
*
|
|
|
* @return
|
|
|
*/
|
|
|
- public Map<String, List<JSONObject>> getKfTeamSheet() {
|
|
|
+ public List<Map<String, Object>> getRequestKfTeamSheet(String pageNextToken, List<Map<String, Object>> mapList) {
|
|
|
FeiShuConfigEnum configEnum = FeiShuConfigManager.getInstance().getConfigEnum();
|
|
|
// 构建client
|
|
|
Client client = Client.newBuilder(configEnum.getAppId(), configEnum.getAppSecret()).build();
|
|
@@ -710,21 +710,34 @@ public class IFeiShuCommonService {
|
|
|
log.error(String.format("code:%s,msg:%s,reqId:%s", resp.getCode(), resp.getMsg(), resp.getRequestId()));
|
|
|
}
|
|
|
|
|
|
- List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
+// List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
if (resp.success()) {
|
|
|
SearchAppTableRecordRespBody recordRespBody = resp.getData();
|
|
|
AppTableRecord[] items = recordRespBody.getItems();
|
|
|
for (AppTableRecord item : items) {
|
|
|
mapList.add(item.getFields());
|
|
|
}
|
|
|
+
|
|
|
+ if (recordRespBody.getHasMore()) {
|
|
|
+ getRequestKfTeamSheet(recordRespBody.getPageToken(), mapList);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
// 业务数据处理
|
|
|
- log.info(Jsons.DEFAULT.toJson(resp.getData()));
|
|
|
+// log.info(Jsons.DEFAULT.toJson(resp.getData()));
|
|
|
// log.info("mapList:{}", FastJsonUtil.toJSONString(mapList));
|
|
|
+ return mapList;
|
|
|
+ }
|
|
|
|
|
|
+ /**
|
|
|
+ * 获取客服团队表数据
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public Map<String, List<JSONObject>> getKfTeamSheet() {
|
|
|
+ List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
+ List<Map<String, Object>> getKfMapList = getRequestKfTeamSheet("",mapList);
|
|
|
// 业务数据处理
|
|
|
- String jsonData = FastJsonUtil.toJSONString(mapList);
|
|
|
+ String jsonData = FastJsonUtil.toJSONString(getKfMapList);
|
|
|
JSONArray jsonArray = JSON.parseArray(jsonData);
|
|
|
Map<String, List<JSONObject>> kfGroupData = new HashMap<>();
|
|
|
for (int i = 0; i < jsonArray.size(); i++) {
|
|
@@ -879,11 +892,11 @@ public class IFeiShuCommonService {
|
|
|
.fieldNames(new String[]{"公司名称", "网站ID"})
|
|
|
.filter(FilterInfo.newBuilder()
|
|
|
.conjunction("and")
|
|
|
- .conditions(new Condition[] {
|
|
|
+ .conditions(new Condition[]{
|
|
|
Condition.newBuilder()
|
|
|
.fieldName("网站ID")
|
|
|
.operator("is")
|
|
|
- .value(new String[] {
|
|
|
+ .value(new String[]{
|
|
|
siteId
|
|
|
})
|
|
|
.build(),
|
|
@@ -913,8 +926,8 @@ public class IFeiShuCommonService {
|
|
|
SearchAppTableRecordRespBody recordRespBody = resp.getData();
|
|
|
AppTableRecord[] items = recordRespBody.getItems();
|
|
|
for (AppTableRecord item : items) {
|
|
|
- Map<String,Object> fieldsObject = item.getFields();
|
|
|
- fieldsObject.put("record_id",item.getRecordId());
|
|
|
+ Map<String, Object> fieldsObject = item.getFields();
|
|
|
+ fieldsObject.put("record_id", item.getRecordId());
|
|
|
mapList.add(fieldsObject);
|
|
|
}
|
|
|
}
|
|
@@ -926,13 +939,15 @@ public class IFeiShuCommonService {
|
|
|
|
|
|
/**
|
|
|
* 获取客服团队表数据
|
|
|
+ *
|
|
|
* @return
|
|
|
*/
|
|
|
- public List<Map<String, Object>> getCustomerInfoKfSheet() {
|
|
|
+ public List<Map<String, Object>> getCustomerInfoKfSheet(String pageNextToken, List<Map<String, Object>> mapList) {
|
|
|
FeiShuConfigEnum configEnum = FeiShuConfigManager.getInstance().getConfigEnum();
|
|
|
Client client = Client.newBuilder(configEnum.getAppId(), configEnum.getAppSecret()).build();
|
|
|
|
|
|
SearchAppTableRecordReq req = SearchAppTableRecordReq.newBuilder().appToken(configEnum.getAppToken()).tableId(configEnum.getKfTableId())
|
|
|
+ .pageToken(pageNextToken)
|
|
|
.searchAppTableRecordReqBody(SearchAppTableRecordReqBody.newBuilder()
|
|
|
.viewId(configEnum.getKfTableSummaryViewId())
|
|
|
.fieldNames(new String[]{"公司名称", "网站ID"})
|
|
@@ -955,18 +970,22 @@ public class IFeiShuCommonService {
|
|
|
|
|
|
// log.info(Jsons.DEFAULT.toJson(resp.getData()));
|
|
|
|
|
|
- List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
+// List<Map<String, Object>> mapList = new ArrayList<>();
|
|
|
if (resp.success()) {
|
|
|
SearchAppTableRecordRespBody recordRespBody = resp.getData();
|
|
|
AppTableRecord[] items = recordRespBody.getItems();
|
|
|
for (AppTableRecord item : items) {
|
|
|
- Map<String,Object> fieldsObject = item.getFields();
|
|
|
- fieldsObject.put("record_id",item.getRecordId());
|
|
|
+ Map<String, Object> fieldsObject = item.getFields();
|
|
|
+ fieldsObject.put("record_id", item.getRecordId());
|
|
|
mapList.add(fieldsObject);
|
|
|
}
|
|
|
+
|
|
|
+ if (recordRespBody.getHasMore()) {
|
|
|
+ getCustomerInfoKfSheet(recordRespBody.getPageToken(), mapList);
|
|
|
+ }
|
|
|
}
|
|
|
// 业务数据处理
|
|
|
- log.info("mapList:{}", FastJsonUtil.toJSONString(mapList));
|
|
|
+// log.info("mapList:{}", FastJsonUtil.toJSONString(mapList));
|
|
|
|
|
|
return mapList;
|
|
|
}
|