From a989441ee0de3f4f16d4427af3d8a869c62efc3f Mon Sep 17 00:00:00 2001 From: 王明元 <97082371@qq.com> Date: Thu, 30 Jun 2022 18:41:35 +0800 Subject: [PATCH] 2022年6月30日18:41:00 上报账户名 --- src/main/java/cn/fw/freya/common/PathConstant.java | 4 ++-- src/main/java/cn/fw/freya/service/rpc/ReportRpcService.java | 17 +++++++++-------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/src/main/java/cn/fw/freya/common/PathConstant.java b/src/main/java/cn/fw/freya/common/PathConstant.java index 20b13ae..1d056fb 100644 --- a/src/main/java/cn/fw/freya/common/PathConstant.java +++ b/src/main/java/cn/fw/freya/common/PathConstant.java @@ -15,9 +15,9 @@ public interface PathConstant { */ String PULL_ACCOUNT = "/common/account/list"; /** - * 粉丝数上报 + * 账号信息上报 */ - String REPORT_FANS = "/common/report/fans_num"; + String REPORT_ACCOUNT_MSG = "/common/report/accountMsg"; /** * 短视频数据上报 */ diff --git a/src/main/java/cn/fw/freya/service/rpc/ReportRpcService.java b/src/main/java/cn/fw/freya/service/rpc/ReportRpcService.java index 86de7f2..51071fa 100644 --- a/src/main/java/cn/fw/freya/service/rpc/ReportRpcService.java +++ b/src/main/java/cn/fw/freya/service/rpc/ReportRpcService.java @@ -1,6 +1,7 @@ package cn.fw.freya.service.rpc; import cn.fw.freya.common.PathConstant; +import cn.fw.freya.enums.AccountTypeEnum; import cn.fw.freya.model.data.pool.LivePool; import cn.fw.freya.model.data.pool.VideoPool; import cn.fw.freya.model.dto.rpc.LivePoolDto; @@ -44,11 +45,11 @@ public class ReportRpcService { Map params = new HashMap<>(); params.put("account", accountNo); params.put("type", type); - params.put("fans", accountMsg.getFansCnt()); + params.put("fansCnt", accountMsg.getFansCnt()); params.put("accountName", accountMsg.getAccountName()); HttpConfig config = HttpConfig.custom() .encoding(java.nio.charset.StandardCharsets.UTF_8.displayName()) - .url(getBaseUrl() + PathConstant.REPORT_FANS) + .url(getBaseUrl() + PathConstant.REPORT_ACCOUNT_MSG) .map(params); String res = RequestUtil.put(config); if (!StringUtils.hasText(res)) { @@ -58,8 +59,8 @@ public class ReportRpcService { Boolean result = resObj.getBoolean("success"); if (Boolean.FALSE.equals(result)) { Integer status = Optional.ofNullable(resObj.getInteger("status")).orElse(-1); - String message = Optional.ofNullable(resObj.getString("message")).orElse("账号粉丝数上报失败"); - log.error(LocalDate.now() + "上报账户 " + accountNo + (Objects.equals(type, 1) ? " 快手" : " 抖音") + "粉丝数据异常", message); + String message = Optional.ofNullable(resObj.getString("message")).orElse("账号信息上报失败"); + log.error(LocalDate.now() + "上报账户 " + accountNo + AccountTypeEnum.getNameByValue(type) + "平台粉丝数据异常", message); return false; } return true; @@ -81,7 +82,7 @@ public class ReportRpcService { return true; } if (Objects.isNull(videoPool.getVideoId()) || Objects.isNull(videoPool.getVideoUrl())) { - log.info(LocalDate.now() + (Objects.equals(type, 1) ? " '快手'" : " '抖音'") + " 账户号为: " + accountNo + "的账号, 暂无视频数据"); + log.info(LocalDate.now() + AccountTypeEnum.getNameByValue(type) + "平台, 账户号为: " + accountNo + "的账号, 暂无视频数据"); return true; } VideoPoolDto dto = new VideoPoolDto(); @@ -116,7 +117,7 @@ public class ReportRpcService { if (Boolean.FALSE.equals(result)) { Integer status = Optional.ofNullable(resObj.getInteger("status")).orElse(-1); String message = Optional.ofNullable(resObj.getString("message")).orElse("账号视频数据上报失败"); - log.error(LocalDate.now() + " 上报账户 " + accountNo + (Objects.equals(type, 1) ? " 快手" : " 抖音") + "视频数据异常", message); + log.error(LocalDate.now() + " 上报账户 " + AccountTypeEnum.getNameByValue(type) + "平台视频数据异常", message); return false; } return true; @@ -138,7 +139,7 @@ public class ReportRpcService { return true; } if (Objects.isNull(livePool.getOpenTime()) || Objects.isNull(livePool.getRoomId())) { - log.info(LocalDate.now() + (Objects.equals(type, 1) ? " '快手'" : " '抖音'") + " 账户号为: " + accountNo + "的账号, 暂无直播数据"); + log.info(LocalDate.now() + AccountTypeEnum.getNameByValue(type) + "平台, 账户号为: " + accountNo + "的账号, 暂无直播数据"); return true; } LivePoolDto dto = new LivePoolDto(); @@ -177,7 +178,7 @@ public class ReportRpcService { if (Boolean.FALSE.equals(result)) { Integer status = Optional.ofNullable(resObj.getInteger("status")).orElse(-1); String message = Optional.ofNullable(resObj.getString("message")).orElse("账号直播数据上报失败"); - log.error(LocalDate.now() + " 上报账户 " + accountNo + (Objects.equals(type, 1) ? " 快手" : " 抖音") + "直播数据异常", message); + log.error(LocalDate.now() + " 上报账户 " + accountNo + AccountTypeEnum.getNameByValue(type) + "平台直播数据异常", message); return false; } return true; -- libgit2 0.22.2