Commit a989441ee0de3f4f16d4427af3d8a869c62efc3f

Authored by 王明元
1 parent 4e52a56c

2022年6月30日18:41:00 上报账户名

src/main/java/cn/fw/freya/common/PathConstant.java
... ... @@ -15,9 +15,9 @@ public interface PathConstant {
15 15 */
16 16 String PULL_ACCOUNT = "/common/account/list";
17 17 /**
18   - * 粉丝数上报
  18 + * 账号信息上报
19 19 */
20   - String REPORT_FANS = "/common/report/fans_num";
  20 + String REPORT_ACCOUNT_MSG = "/common/report/accountMsg";
21 21 /**
22 22 * 短视频数据上报
23 23 */
... ...
src/main/java/cn/fw/freya/service/rpc/ReportRpcService.java
1 1 package cn.fw.freya.service.rpc;
2 2  
3 3 import cn.fw.freya.common.PathConstant;
  4 +import cn.fw.freya.enums.AccountTypeEnum;
4 5 import cn.fw.freya.model.data.pool.LivePool;
5 6 import cn.fw.freya.model.data.pool.VideoPool;
6 7 import cn.fw.freya.model.dto.rpc.LivePoolDto;
... ... @@ -44,11 +45,11 @@ public class ReportRpcService {
44 45 Map<String, Object> params = new HashMap<>();
45 46 params.put("account", accountNo);
46 47 params.put("type", type);
47   - params.put("fans", accountMsg.getFansCnt());
  48 + params.put("fansCnt", accountMsg.getFansCnt());
48 49 params.put("accountName", accountMsg.getAccountName());
49 50 HttpConfig config = HttpConfig.custom()
50 51 .encoding(java.nio.charset.StandardCharsets.UTF_8.displayName())
51   - .url(getBaseUrl() + PathConstant.REPORT_FANS)
  52 + .url(getBaseUrl() + PathConstant.REPORT_ACCOUNT_MSG)
52 53 .map(params);
53 54 String res = RequestUtil.put(config);
54 55 if (!StringUtils.hasText(res)) {
... ... @@ -58,8 +59,8 @@ public class ReportRpcService {
58 59 Boolean result = resObj.getBoolean("success");
59 60 if (Boolean.FALSE.equals(result)) {
60 61 Integer status = Optional.ofNullable(resObj.getInteger("status")).orElse(-1);
61   - String message = Optional.ofNullable(resObj.getString("message")).orElse("账号粉丝数上报失败");
62   - log.error(LocalDate.now() + "上报账户 " + accountNo + (Objects.equals(type, 1) ? " 快手" : " 抖音") + "粉丝数据异常", message);
  62 + String message = Optional.ofNullable(resObj.getString("message")).orElse("账号信息上报失败");
  63 + log.error(LocalDate.now() + "上报账户 " + accountNo + AccountTypeEnum.getNameByValue(type) + "平台粉丝数据异常", message);
63 64 return false;
64 65 }
65 66 return true;
... ... @@ -81,7 +82,7 @@ public class ReportRpcService {
81 82 return true;
82 83 }
83 84 if (Objects.isNull(videoPool.getVideoId()) || Objects.isNull(videoPool.getVideoUrl())) {
84   - log.info(LocalDate.now() + (Objects.equals(type, 1) ? " '快手'" : " '抖音'") + " 账户号为: " + accountNo + "的账号, 暂无视频数据");
  85 + log.info(LocalDate.now() + AccountTypeEnum.getNameByValue(type) + "平台, 账户号为: " + accountNo + "的账号, 暂无视频数据");
85 86 return true;
86 87 }
87 88 VideoPoolDto dto = new VideoPoolDto();
... ... @@ -116,7 +117,7 @@ public class ReportRpcService {
116 117 if (Boolean.FALSE.equals(result)) {
117 118 Integer status = Optional.ofNullable(resObj.getInteger("status")).orElse(-1);
118 119 String message = Optional.ofNullable(resObj.getString("message")).orElse("账号视频数据上报失败");
119   - log.error(LocalDate.now() + " 上报账户 " + accountNo + (Objects.equals(type, 1) ? " 快手" : " 抖音") + "视频数据异常", message);
  120 + log.error(LocalDate.now() + " 上报账户 " + AccountTypeEnum.getNameByValue(type) + "平台视频数据异常", message);
120 121 return false;
121 122 }
122 123 return true;
... ... @@ -138,7 +139,7 @@ public class ReportRpcService {
138 139 return true;
139 140 }
140 141 if (Objects.isNull(livePool.getOpenTime()) || Objects.isNull(livePool.getRoomId())) {
141   - log.info(LocalDate.now() + (Objects.equals(type, 1) ? " '快手'" : " '抖音'") + " 账户号为: " + accountNo + "的账号, 暂无直播数据");
  142 + log.info(LocalDate.now() + AccountTypeEnum.getNameByValue(type) + "平台, 账户号为: " + accountNo + "的账号, 暂无直播数据");
142 143 return true;
143 144 }
144 145 LivePoolDto dto = new LivePoolDto();
... ... @@ -177,7 +178,7 @@ public class ReportRpcService {
177 178 if (Boolean.FALSE.equals(result)) {
178 179 Integer status = Optional.ofNullable(resObj.getInteger("status")).orElse(-1);
179 180 String message = Optional.ofNullable(resObj.getString("message")).orElse("账号直播数据上报失败");
180   - log.error(LocalDate.now() + " 上报账户 " + accountNo + (Objects.equals(type, 1) ? " 快手" : " 抖音") + "直播数据异常", message);
  181 + log.error(LocalDate.now() + " 上报账户 " + accountNo + AccountTypeEnum.getNameByValue(type) + "平台直播数据异常", message);
181 182 return false;
182 183 }
183 184 return true;
... ...