|
@@ -346,6 +346,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
|
|
|
result.getString("totalSale"),
|
|
|
promoterId
|
|
|
);
|
|
|
+
|
|
|
if ("1".equals(mediaId)) {
|
|
|
String followerincr = result.getString("follower_incr");
|
|
|
if (Check.isNotNull(followerincr) && !"-".equals(followerincr)) {
|
|
@@ -419,6 +420,108 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 同步更新数据
|
|
|
+ */
|
|
|
+ private void editMiaogousiPromoter(Long id, String mediaId, String promoterId, boolean flag) {
|
|
|
+ try {
|
|
|
+ if (flag) {
|
|
|
+ /*缓存标记,每日第一次访问调用该接口,更新达人部分(昵称,省市,粉丝,总销售,头像等)数据*/
|
|
|
+ String key = DateUtils.getDate() + "mgs_" + promoterId + "_" + id;
|
|
|
+ String value = (String) redisUtil.get(key);
|
|
|
+ if (Check.isNotNull(value) && "1".equals(value)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ redisUtil.set(key, "1", 60 * 60 * 24);
|
|
|
+ }
|
|
|
+
|
|
|
+ /*更新达人数据*/
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
+ param.put("promoterId", promoterId);
|
|
|
+ param.put("mediaId", mediaId);
|
|
|
+ Long startTime = System.currentTimeMillis();
|
|
|
+ String content = HttpUtil.httpPostRequest(startIpPath + "promoterInfo/getPromoterId", param, null);
|
|
|
+ Thread.sleep(3000);
|
|
|
+
|
|
|
+ JSONObject result = JSONObject.parseObject(content);
|
|
|
+ if (Check.isNotNull(result) && Check.isNotNull(result.getString("promoterNickName"))) {
|
|
|
+ String province = "";
|
|
|
+ if (Check.isNotNull(result.getString("province"))) {
|
|
|
+ province = result.getString("province").concat("-").concat(result.getString("city"));
|
|
|
+ }
|
|
|
+ KuaishouPromoter kuaishouPromoter = new KuaishouPromoter(
|
|
|
+ id,
|
|
|
+ result.getString("promoterNickName"),
|
|
|
+ province,
|
|
|
+ result.getString("promoterHeadImgUrl"),
|
|
|
+ result.getString("fanNum"),
|
|
|
+ result.getString("avgVideoSales"),
|
|
|
+ result.getString("videoSales"),
|
|
|
+ result.getString("totalSale"),
|
|
|
+ promoterId
|
|
|
+ );
|
|
|
+
|
|
|
+ kuaishouPromoterMapper.updateMiaogousiKuaishouPromoterByPromoterId(kuaishouPromoter);
|
|
|
+ } else {
|
|
|
+ log.error("更新达人失败,达人ID:{} 【返回结果】:{}", promoterId, result);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error("更新达人信息异常", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 同步更新数据
|
|
|
+ */
|
|
|
+ private void editRocketPromoter(Long id, String mediaId, String promoterId, boolean flag) {
|
|
|
+ try {
|
|
|
+ if (flag) {
|
|
|
+ /*缓存标记,每日第一次访问调用该接口,更新达人部分(昵称,省市,粉丝,总销售,头像等)数据*/
|
|
|
+ String key = DateUtils.getDate() + "rocket_" + promoterId + "_" + id;
|
|
|
+ String value = (String) redisUtil.get(key);
|
|
|
+ if (Check.isNotNull(value) && "1".equals(value)) {
|
|
|
+ return;
|
|
|
+ }
|
|
|
+ redisUtil.set(key, "1", 60 * 60 * 24);
|
|
|
+ }
|
|
|
+
|
|
|
+ /*更新达人数据*/
|
|
|
+ Map<String, Object> param = new HashMap<>();
|
|
|
+ param.put("promoterId", promoterId);
|
|
|
+ param.put("mediaId", mediaId);
|
|
|
+ Long startTime = System.currentTimeMillis();
|
|
|
+ String content = HttpUtil.httpPostRequest(startIpPath + "promoterInfo/getPromoterId", param, null);
|
|
|
+ Thread.sleep(3000);
|
|
|
+
|
|
|
+ JSONObject result = JSONObject.parseObject(content);
|
|
|
+ if (Check.isNotNull(result) && Check.isNotNull(result.getString("promoterNickName"))) {
|
|
|
+ String province = "";
|
|
|
+ if (Check.isNotNull(result.getString("province"))) {
|
|
|
+ province = result.getString("province").concat("-").concat(result.getString("city"));
|
|
|
+ }
|
|
|
+ KuaishouPromoter kuaishouPromoter = new KuaishouPromoter(
|
|
|
+ id,
|
|
|
+ result.getString("promoterNickName"),
|
|
|
+ province,
|
|
|
+ result.getString("promoterHeadImgUrl"),
|
|
|
+ result.getString("fanNum"),
|
|
|
+ result.getString("avgVideoSales"),
|
|
|
+ result.getString("videoSales"),
|
|
|
+ result.getString("totalSale"),
|
|
|
+ promoterId
|
|
|
+ );
|
|
|
+ kuaishouPromoterMapper.updateRocketKuaishouPromoterByPromoterId(kuaishouPromoter);
|
|
|
+ } else {
|
|
|
+ log.error("更新达人失败,达人ID:{} 【返回结果】:{}", promoterId, result);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ log.error("更新达人信息异常", e);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public JSONObject insertKuaishouPromoter3(JYKuaishouPromoter promoter) {
|
|
|
JSONObject result = new JSONObject();
|
|
@@ -457,8 +560,9 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
|
|
|
thread.start();
|
|
|
List<String> promoters = new ArrayList<>();
|
|
|
list.forEach(kuaishouPromoter -> promoters.add(kuaishouPromoter.getPromoterId() + "【" + kuaishouPromoter.getMediaId() + "】"));
|
|
|
- String jyMsg = supplementInfo3();
|
|
|
- promoters.add(jyMsg);
|
|
|
+ promoters.add(supplementInfo3());
|
|
|
+ promoters.add(miaogousiInfo());
|
|
|
+ promoters.add(rocketInfo());
|
|
|
return Result.success("共计" + list.size() + "条,数据补充中...", promoters);
|
|
|
}
|
|
|
|
|
@@ -481,6 +585,44 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
|
|
|
return "-------------骄阳共计" + list.size() + "条,达人IDS: " + promoters.toString();
|
|
|
}
|
|
|
|
|
|
+ //miaogousi
|
|
|
+ public String miaogousiInfo() {
|
|
|
+ List<JYKuaishouPromoter> list = kuaishouPromoterMapper.getMiaogousiInfoFailInfo();
|
|
|
+ Thread thread = new Thread() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ try {
|
|
|
+ list.forEach(kuaishouPromoter -> editMiaogousiPromoter(kuaishouPromoter.getId(), kuaishouPromoter.getMediaId(), kuaishouPromoter.getPromoterId(), false));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ thread.start();
|
|
|
+ List<String> promoters = new ArrayList<>();
|
|
|
+ list.forEach(kuaishouPromoter -> promoters.add(kuaishouPromoter.getPromoterId()));
|
|
|
+ return "-------------miaogousi共计" + list.size() + "条,达人IDS: " + promoters.toString();
|
|
|
+ }
|
|
|
+
|
|
|
+ //rocket
|
|
|
+ public String rocketInfo() {
|
|
|
+ List<JYKuaishouPromoter> list = kuaishouPromoterMapper.getRocketFailInfo();
|
|
|
+ Thread thread = new Thread() {
|
|
|
+ @Override
|
|
|
+ public void run() {
|
|
|
+ try {
|
|
|
+ list.forEach(kuaishouPromoter -> editRocketPromoter(kuaishouPromoter.getId(), kuaishouPromoter.getMediaId(), kuaishouPromoter.getPromoterId(), false));
|
|
|
+ } catch (Exception e) {
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ };
|
|
|
+ thread.start();
|
|
|
+ List<String> promoters = new ArrayList<>();
|
|
|
+ list.forEach(kuaishouPromoter -> promoters.add(kuaishouPromoter.getPromoterId()));
|
|
|
+ return "-------------rocket共计" + list.size() + "条,达人IDS: " + promoters.toString();
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
@Override
|
|
|
public int addFollowUpRecords(JSONObject result) {
|