|
@@ -65,6 +65,9 @@ public class ShopUserTypeComponent {
|
|
|
@Value(value = "${spring.esb.shopStoneLikePaint}")
|
|
@Value(value = "${spring.esb.shopStoneLikePaint}")
|
|
|
private String stoneLikePaintUrl;
|
|
private String stoneLikePaintUrl;
|
|
|
|
|
|
|
|
|
|
+ @Value( value = "${spring.esb.goldShopUser}")
|
|
|
|
|
+ private String goldShopUserUrl;
|
|
|
|
|
+
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -136,6 +139,7 @@ public class ShopUserTypeComponent {
|
|
|
JSONObject stoneUserJson = JSONObject.parseObject(stoneLikeUser);
|
|
JSONObject stoneUserJson = JSONObject.parseObject(stoneLikeUser);
|
|
|
if(stoneUserJson !=null && stoneUserJson.getString("code").equals("0")){
|
|
if(stoneUserJson !=null && stoneUserJson.getString("code").equals("0")){
|
|
|
JSONArray stoneUserArray = stoneUserJson.getJSONArray("data");
|
|
JSONArray stoneUserArray = stoneUserJson.getJSONArray("data");
|
|
|
|
|
+ //0TUC仿石漆服务商人员
|
|
|
buildShopUser(stoneUserArray,"0",roleId);
|
|
buildShopUser(stoneUserArray,"0",roleId);
|
|
|
}
|
|
}
|
|
|
}catch (Exception e) {
|
|
}catch (Exception e) {
|
|
@@ -146,6 +150,7 @@ public class ShopUserTypeComponent {
|
|
|
|
|
|
|
|
}else{
|
|
}else{
|
|
|
JSONArray stoneUserArray = stoneLikeJson.getJSONArray("data");
|
|
JSONArray stoneUserArray = stoneLikeJson.getJSONArray("data");
|
|
|
|
|
+ //0TUC仿石漆服务商人员
|
|
|
buildShopUser(stoneUserArray,"0",roleId);
|
|
buildShopUser(stoneUserArray,"0",roleId);
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
@@ -154,6 +159,95 @@ public class ShopUserTypeComponent {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
|
+ * @description: 获取金牌店人员
|
|
|
|
|
+ * @param:
|
|
|
|
|
+ * @return:
|
|
|
|
|
+ * @author: njs
|
|
|
|
|
+ * @date: 2025/9/1 9:14
|
|
|
|
|
+ */
|
|
|
|
|
+ public void shopGoldShopUser() throws ParseException {
|
|
|
|
|
+ //获取请求参数
|
|
|
|
|
+ Map<String, String> tokenHeaders =this.HeaderToMap();
|
|
|
|
|
+ Map<String, Object> params = new HashMap<>();
|
|
|
|
|
+ params.put("appid", appid);
|
|
|
|
|
+ params.put("appsecret", appsecret);
|
|
|
|
|
+ // 发送GET请求,包含URL、请求头和请求参数
|
|
|
|
|
+ String token = null;
|
|
|
|
|
+ try {
|
|
|
|
|
+ token = HttpUtils.get(tokenUrl, tokenHeaders, params);
|
|
|
|
|
+ if (token == null || token.isEmpty()) {
|
|
|
|
|
+ // 处理空返回值的情况
|
|
|
|
|
+ log.error("HTTP请求返回空结果");
|
|
|
|
|
+ }
|
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
|
+ // 处理HTTP请求异常
|
|
|
|
|
+ log.error("HTTP请求失败: " + e.getMessage());
|
|
|
|
|
+ // 可以选择重试或抛出异常
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ JSONObject jsonObject = JSON.parseObject(token);
|
|
|
|
|
+ if(jsonObject !=null && jsonObject.containsKey("access_token")){
|
|
|
|
|
+ String shopToken = jsonObject.getString("access_token");
|
|
|
|
|
+ String url = goldShopUserUrl;
|
|
|
|
|
+ Map<String, String> stoneLikePaintHeaders =this.HeaderToMap();
|
|
|
|
|
+ Map<String, Object> stoneParams = new HashMap<>();
|
|
|
|
|
+ stoneParams.put("access_token", shopToken);
|
|
|
|
|
+ stoneParams.put("page", 1);
|
|
|
|
|
+ stoneParams.put("page_size", 100);
|
|
|
|
|
+ String dateString = userShopExtMapper.searchRunTime();
|
|
|
|
|
+ if(dateString !=null){
|
|
|
|
|
+ // 截取前3位毫秒数
|
|
|
|
|
+ String truncatedDate = dateString.substring(0, dateString.lastIndexOf('.') + 4);
|
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm");
|
|
|
|
|
+ Date date = sdf.parse(truncatedDate);
|
|
|
|
|
+ String runTime = sdf.format(date);
|
|
|
|
|
+ //获取上次同步时间进行增量同步
|
|
|
|
|
+ if(runTime !=null && !runTime.isEmpty()){
|
|
|
|
|
+ stoneParams.put("datetime_start", runTime);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ //金牌店用户-1
|
|
|
|
|
+ Long roleId = roleMapper.selectRoleIdByRoleKey("goldShopUser");
|
|
|
|
|
+ String stoneLikePaintUser =HttpUtils.get(url, stoneLikePaintHeaders, stoneParams);
|
|
|
|
|
+ JSONObject stoneLikeJson = JSONObject.parseObject(stoneLikePaintUser);
|
|
|
|
|
+ if(stoneLikeJson !=null && stoneLikeJson.getString("code").equals("0")){
|
|
|
|
|
+ Integer count = stoneLikeJson.getInteger("count");
|
|
|
|
|
+ if(count > 100){
|
|
|
|
|
+ int num = 0;
|
|
|
|
|
+ if (count % 100 != 0) {
|
|
|
|
|
+ num = (count / 100) + 2;
|
|
|
|
|
+ } else {
|
|
|
|
|
+ num = (count / 100) + 1;
|
|
|
|
|
+ }
|
|
|
|
|
+ for (int i = 1; i < num; i++) {
|
|
|
|
|
+ stoneParams.put("page", i);
|
|
|
|
|
+ Map<String, String> headerUuid =this.HeaderToMap();
|
|
|
|
|
+ try {
|
|
|
|
|
+ String stoneLikeUser =HttpUtils.get(url, headerUuid, stoneParams);
|
|
|
|
|
+ JSONObject stoneUserJson = JSONObject.parseObject(stoneLikeUser);
|
|
|
|
|
+ if(stoneUserJson !=null && stoneUserJson.getString("code").equals("0")){
|
|
|
|
|
+ JSONArray stoneUserArray = stoneUserJson.getJSONArray("data");
|
|
|
|
|
+ //1金牌店
|
|
|
|
|
+ buildShopUser(stoneUserArray,"1",roleId);
|
|
|
|
|
+ }
|
|
|
|
|
+ }catch (Exception e) {
|
|
|
|
|
+ log.error("循环获取获取金牌店人员列表接口错误!第" + i + "页");
|
|
|
|
|
+ throw e;
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ }else{
|
|
|
|
|
+ JSONArray stoneUserArray = stoneLikeJson.getJSONArray("data");
|
|
|
|
|
+ //1金牌店
|
|
|
|
|
+ buildShopUser(stoneUserArray,"1",roleId);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
/**
|
|
/**
|
|
|
* @description: 构建门店用户信息
|
|
* @description: 构建门店用户信息
|
|
|
* @param: [json, Usertype, roleId, deptId]
|
|
* @param: [json, Usertype, roleId, deptId]
|