|
@@ -14,6 +14,7 @@ import com.ruixuan.common.utils.RedisUtil;
|
|
|
import com.ruixuan.common.utils.Result;
|
|
|
import com.ruixuan.common.utils.file.FileUtil;
|
|
|
import com.ruixuan.common.utils.http.HttpUtil;
|
|
|
+import com.ruixuan.common.weixin.CorpWexinUtils;
|
|
|
import com.ruixuan.data.utils.ExportExcelUtils;
|
|
|
import com.ruixuan.isc.entity.FirstDeliveryValidMaterials;
|
|
|
import com.ruixuan.isc.entity.JYKuaishouPromoter;
|
|
@@ -87,6 +88,9 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
|
|
|
@Autowired
|
|
|
private IKuaishouItemCollectSamplesService kuaishouItemCollectSamplesService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CorpWexinUtils corpWexinUtils;
|
|
|
+
|
|
|
/**
|
|
|
* 查询快手达人 信息列表
|
|
|
*
|
|
@@ -391,6 +395,8 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
|
|
|
kuaishouPromoterMapper.updateKuaishouPromoterByPromoterId(kuaishouPromoter);
|
|
|
} else {
|
|
|
log.error("更新达人失败,达人ID:{} 【返回结果】:{}", promoterId, result);
|
|
|
+ String key = DateUtils.getDate() + "_token_invalid";
|
|
|
+ stToken(key);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -398,6 +404,31 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ private void stToken(String key) {
|
|
|
+ String value = (String) redisUtil.get(key);
|
|
|
+ if (Check.isNotNull(value)) {
|
|
|
+ Integer times = Integer.valueOf(value);
|
|
|
+ redisUtil.set(key, times + 1, 60 * 60 * 24);
|
|
|
+ sendNotice(times);
|
|
|
+ } else {
|
|
|
+ redisUtil.set(key, "1", 60 * 60 * 24);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void sendNotice(Integer times) {
|
|
|
+ if (times >= 1 && times < 5) {
|
|
|
+ //发送token失效通知
|
|
|
+ String date = DateUtils.getDate();
|
|
|
+ JSONObject weChat = new JSONObject();
|
|
|
+ weChat.put("wexin_id", "RenYuPeng");
|
|
|
+ weChat.put("corp_id", "ww24b8a47826f5875f");
|
|
|
+ StringBuilder text = new StringBuilder();
|
|
|
+ text.append("达人更新token失效通知:").append("<br/>").append("达人token已失效,请及时更新token");
|
|
|
+ corpWexinUtils.sendMessage(weChat, text.toString());
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 同步更新数据
|
|
|
*/
|
|
@@ -445,6 +476,8 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
|
|
|
kuaishouPromoterMapper.updateKuaishouPromoterByPromoterId3(kuaishouPromoter);
|
|
|
} else {
|
|
|
log.error("更新达人失败,达人ID:{} 【返回结果】:{}", promoterId, result);
|
|
|
+ String key = DateUtils.getDate() + "_token_invalid";
|
|
|
+ stToken(key);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -499,6 +532,8 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
|
|
|
kuaishouPromoterMapper.updateMiaogousiKuaishouPromoterByPromoterId(kuaishouPromoter);
|
|
|
} else {
|
|
|
log.error("更新达人失败,达人ID:{} 【返回结果】:{}", promoterId, result);
|
|
|
+ String key = DateUtils.getDate() + "_token_invalid";
|
|
|
+ stToken(key);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -552,6 +587,8 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
|
|
|
kuaishouPromoterMapper.updateRocketKuaishouPromoterByPromoterId(kuaishouPromoter);
|
|
|
} else {
|
|
|
log.error("更新达人失败,达人ID:{} 【返回结果】:{}", promoterId, result);
|
|
|
+ String key = DateUtils.getDate() + "_token_invalid";
|
|
|
+ stToken(key);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -605,6 +642,8 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
|
|
|
kuaishouPromoterMapper.updateYufuKuaishouPromoterByPromoterId(kuaishouPromoter);
|
|
|
} else {
|
|
|
log.error("更新达人失败,达人ID:{} 【返回结果】:{}", promoterId, result);
|
|
|
+ String key = DateUtils.getDate() + "_token_invalid";
|
|
|
+ stToken(key);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -657,6 +696,8 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
|
|
|
kuaishouPromoterMapper.updateYuxiuKuaishouPromoterByPromoterId(kuaishouPromoter);
|
|
|
} else {
|
|
|
log.error("更新达人失败,达人ID:{} 【返回结果】:{}", promoterId, result);
|
|
|
+ String key = DateUtils.getDate() + "_token_invalid";
|
|
|
+ stToken(key);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -710,6 +751,8 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
|
|
|
kuaishouPromoterMapper.updateZhishuiKuaishouPromoterByPromoterId(kuaishouPromoter);
|
|
|
} else {
|
|
|
log.error("更新达人失败,达人ID:{} 【返回结果】:{}", promoterId, result);
|
|
|
+ String key = DateUtils.getDate() + "_token_invalid";
|
|
|
+ stToken(key);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
e.printStackTrace();
|
|
@@ -775,6 +818,9 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
|
|
|
|
|
|
@Override
|
|
|
public Result supplementInfo() {
|
|
|
+ String key = DateUtils.getDate() + "_token_invalid";
|
|
|
+ redisUtil.del(key);
|
|
|
+
|
|
|
List<String> promoters = new ArrayList<>();
|
|
|
List<KuaishouPromoter> list = kuaishouPromoterMapper.getFailInfo();
|
|
|
if (!Check.isNull(list)) {
|
|
@@ -793,6 +839,7 @@ public class KuaishouPromoterServiceImpl implements IKuaishouPromoterService {
|
|
|
promoters.add(yufuInfo());
|
|
|
promoters.add(yuxiuInfo());
|
|
|
promoters.add(zhishuiInfo());
|
|
|
+
|
|
|
return Result.success("达人数据更新 -------------<睿选>共计:" + list.size() + "条", promoters);
|
|
|
}
|
|
|
|