|
@@ -1,12 +1,12 @@
|
|
package com.qmth.sop.business.sync;
|
|
package com.qmth.sop.business.sync;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.qmth.sop.business.service.SysConfigService;
|
|
import com.qmth.sop.business.service.SysConfigService;
|
|
import com.qmth.sop.business.sync.been.fxxk.FxxkAppAuthInfo;
|
|
import com.qmth.sop.business.sync.been.fxxk.FxxkAppAuthInfo;
|
|
import com.qmth.sop.business.sync.been.fxxk.FxxkAppAuthResult;
|
|
import com.qmth.sop.business.sync.been.fxxk.FxxkAppAuthResult;
|
|
import com.qmth.sop.business.sync.been.fxxk.FxxkCrm;
|
|
import com.qmth.sop.business.sync.been.fxxk.FxxkCrm;
|
|
|
|
+import com.qmth.sop.business.sync.been.fxxk.FxxkUser;
|
|
import com.qmth.sop.common.contant.SystemConstant;
|
|
import com.qmth.sop.common.contant.SystemConstant;
|
|
import com.qmth.sop.common.enums.ExceptionResultEnum;
|
|
import com.qmth.sop.common.enums.ExceptionResultEnum;
|
|
import com.qmth.sop.common.enums.ProductTypeEnum;
|
|
import com.qmth.sop.common.enums.ProductTypeEnum;
|
|
@@ -117,6 +117,72 @@ public class FxxkApiUtils {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 根据id获取纷享销客用户信息
|
|
|
|
+ *
|
|
|
|
+ * @param userId userId
|
|
|
|
+ * @return 纷享销客用户信息
|
|
|
|
+ */
|
|
|
|
+ public FxxkUser findFxxkUserById(String userId) {
|
|
|
|
+ final String apiName = "PersonnelObj";
|
|
|
|
+ String postUrl = sysConfigService.findByConfigKey(SystemConstant.FXXK_USER_QUERY_URL).getConfigValue();
|
|
|
|
+ try {
|
|
|
|
+ FxxkAppAuthInfo fxxkAppAuthInfo = this.findFxxkAppAuthInfo();
|
|
|
|
+ String corpAccessToken = fxxkAppAuthInfo.getCorpAccessToken();
|
|
|
|
+ String corpId = fxxkAppAuthInfo.getCorpId();
|
|
|
|
+
|
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
|
+ map.put("corpAccessToken", commonUtils.validParam(corpAccessToken, null, true, "企业应用访问公司合法性凭证"));
|
|
|
|
+ map.put("corpId", commonUtils.validParam(corpId, null, true, "开放平台公司帐号"));
|
|
|
|
+ map.put("currentOpenUserId", commonUtils.validParam(fxxkCurrenOpenUserId, null, true, "当前操作人OpenUserID"));
|
|
|
|
+
|
|
|
|
+ Map<String, Object> dataMap = new HashMap<>();
|
|
|
|
+ dataMap.put("dataObjectApiName", apiName);
|
|
|
|
+
|
|
|
|
+ Map<String, Object> queryMap = new HashMap<>();
|
|
|
|
+ queryMap.put("offset", 0.0);
|
|
|
|
+ queryMap.put("limit", 1);
|
|
|
|
+
|
|
|
|
+ // 查询
|
|
|
|
+ List<Map<String, Object>> filterMapList = new ArrayList<>();
|
|
|
|
+ // 查询条件1 : 派单状态为正常的
|
|
|
|
+ Map<String, Object> filterMap1 = new HashMap<>();
|
|
|
|
+ filterMap1.put("field_name", "user_id");
|
|
|
|
+ List<String> fieldValues = new ArrayList<>();
|
|
|
|
+ fieldValues.add(userId);
|
|
|
|
+ filterMap1.put("field_values", fieldValues);
|
|
|
|
+ filterMap1.put("operator", "EQ");
|
|
|
|
+ filterMapList.add(filterMap1);
|
|
|
|
+ queryMap.put("filters", filterMapList);
|
|
|
|
+ dataMap.put("search_query_info", queryMap);
|
|
|
|
+ map.put("data", dataMap);
|
|
|
|
+
|
|
|
|
+ String requestJson = JacksonUtil.parseJson(map);
|
|
|
|
+
|
|
|
|
+ String result = HttpUtil.postJson(postUrl, requestJson, null, null, false);
|
|
|
|
+ JSONObject jsonObject = JSONObject.parseObject(result);
|
|
|
|
+ Long errorCode = jsonObject.getLong("errorCode");
|
|
|
|
+ String errorMessage = jsonObject.getString("errorMessage");
|
|
|
|
+ if (errorCode != 0) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception("获取自定义对象列表失败 : " + errorMessage);
|
|
|
|
+ }
|
|
|
|
+ JSONObject data = jsonObject.getJSONObject("data");
|
|
|
|
+ JSONArray dataList = data.getJSONArray("dataList");
|
|
|
|
+ JSONObject cell = dataList.getJSONObject(0);
|
|
|
|
+ String fullName = cell.getString("full_name");
|
|
|
|
+ String phone = cell.getString("phone");
|
|
|
|
+ String id = cell.getString("user_id");
|
|
|
|
+
|
|
|
|
+ FxxkUser fxxkUser = new FxxkUser();
|
|
|
|
+ fxxkUser.setId(id);
|
|
|
|
+ fxxkUser.setFullName(fullName);
|
|
|
|
+ fxxkUser.setPhone(phone);
|
|
|
|
+ return fxxkUser;
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ throw ExceptionResultEnum.ERROR.exception(e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
/**
|
|
/**
|
|
* 查询自定义对象列表
|
|
* 查询自定义对象列表
|
|
*/
|
|
*/
|
|
@@ -193,7 +259,6 @@ public class FxxkApiUtils {
|
|
}
|
|
}
|
|
JSONObject data = jsonObject.getJSONObject("data");
|
|
JSONObject data = jsonObject.getJSONObject("data");
|
|
JSONArray dataList = data.getJSONArray("dataList");
|
|
JSONArray dataList = data.getJSONArray("dataList");
|
|
- System.out.println(JSON.toJSONString(dataList));
|
|
|
|
|
|
|
|
List<FxxkCrm> fxxkCrmList = new ArrayList<>();
|
|
List<FxxkCrm> fxxkCrmList = new ArrayList<>();
|
|
for (int i = 0; i < dataList.size(); i++) {
|
|
for (int i = 0; i < dataList.size(); i++) {
|