From 0f704a4650edd60cea2e57778b6703509376a42c Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期五, 08 三月 2024 17:48:09 +0800 Subject: [PATCH] 京东API(大淘客补充)优化/日志优化 --- fanli/src/main/java/com/yeshi/fanli/service/impl/push/HWPushServiceImpl.java | 41 ++++++++++++++++++++++++++--------------- 1 files changed, 26 insertions(+), 15 deletions(-) diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/HWPushServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/HWPushServiceImpl.java index 1d526e9..6239850 100644 --- a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/HWPushServiceImpl.java +++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/HWPushServiceImpl.java @@ -7,12 +7,14 @@ import com.yeshi.fanli.entity.SystemEnum; import com.yeshi.fanli.entity.bus.user.UserCustomSettings; import com.yeshi.fanli.entity.bus.user.UserCustomSettings.UserSettingTypeEnum; +import com.yeshi.fanli.entity.config.SystemConfigKeyEnum; import com.yeshi.fanli.entity.push.DeviceTokenHW; import com.yeshi.fanli.exception.push.PushException; import com.yeshi.fanli.log.LogHelper; import com.yeshi.fanli.log.LogManager; import com.yeshi.fanli.log.PushLogHelper; import com.yeshi.fanli.service.inter.config.AppVersionService; +import com.yeshi.fanli.service.inter.config.SystemConfigService; import com.yeshi.fanli.service.inter.push.DeviceTokenHWService; import com.yeshi.fanli.service.inter.push.HWPushService; import com.yeshi.fanli.service.inter.user.UserCustomSettingsService; @@ -37,7 +39,10 @@ @Resource private UserCustomSettingsService userCustomSettingsService; - private List<Integer> getVersionCodeList(List<Integer> versionCodeList, SystemEnum system) { + @Resource + private SystemConfigService systemConfigService; + + private List<Integer> getVersionCodeList(List<Integer> versionCodeList,SystemEnum system) { List<Integer> versionList = new ArrayList<>(); if (versionCodeList == null) {// 鍏ㄦ帹 List<AppVersionInfo> appInfoList = appVersionService.listByPlatformAndMinVersionCode("android", 46, system); @@ -57,7 +62,7 @@ } @Override - public void pushGoods(Long uid, Long auctionId, PushBaseContent baseContent) + public void pushGoods(Long uid, String auctionId, PushBaseContent baseContent) throws PushException { addPushQueue(PushTypeEnum.goodsdetail, uid, null, null, auctionId, baseContent); } @@ -130,7 +135,7 @@ //娣诲姞鍒版帹閫侀槦鍒� private void addPushQueue(PushTypeEnum type, Long uid, String url, String webUrl, - Long goodsId, PushBaseContent content) { + String goodsId, PushBaseContent content) { //娣诲姞鍒版帹閫侀槦鍒� PushContentDetailDTO dto = new PushContentDetailDTO(type, uid, url, webUrl, goodsId, content); PushCMQManager.getInstance().addHWPush(dto); @@ -159,7 +164,7 @@ for (int p = 1; p <= page; p++) { List<DeviceTokenHW> hwDeviceList = deviceTokenHWService.getDeviceTokenList(p, 100, newVersionList, minUpdateTime); hwDeviceList = filterDeviceToken(hwDeviceList, hour); - LogHelper.pushHW(String.format("鍏ㄦ帹:璁惧鏁�%s",hwDeviceList.size())); + LogHelper.pushHW(String.format("鍏ㄦ帹:璁惧鏁�%s", hwDeviceList.size())); List<String> tokenList = new ArrayList<>(); for (DeviceTokenHW token : hwDeviceList) tokenList.add(token.getDeviceToken()); @@ -167,25 +172,25 @@ if (dto.getType() == PushTypeEnum.goodsdetail) {// 鍟嗗搧璇︽儏 if (dto.getGoodsId() == null) throw new PushException(2, "鍙傛暟涓嶅畬鏁�"); - HWPushUtil.pushGoods(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), 1, dto.getGoodsId()); + HWPushUtil.pushGoods(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), 1, dto.getGoodsId(),getAndroidBaseActivity( dto.getContent().getSystem())); } else if (dto.getType() == PushTypeEnum.url) {// 閾炬帴 if (StringUtil.isNullOrEmpty(dto.getWebUrl())) throw new PushException(2, "鍙傛暟涓嶅畬鏁�"); - HWPushUtil.pushUrl(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), dto.getWebUrl()); + HWPushUtil.pushUrl(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), dto.getWebUrl(),getAndroidBaseActivity(dto.getContent().getSystem())); } else if (dto.getType() == PushTypeEnum.ZNX) {// 绔欏唴淇� HWPushUtil.pushZNX(tokenList, dto.getContent().getTitle(), dto.getContent().getContent()); } else if (dto.getType() == PushTypeEnum.weex) {// weex if (StringUtil.isNullOrEmpty(dto.getUrl())) throw new PushException(2, "鍙傛暟涓嶅畬鏁�"); - HWPushUtil.pushWEEX(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), dto.getUrl()); + HWPushUtil.pushWEEX(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), dto.getUrl(),getAndroidBaseActivity(dto.getContent().getSystem())); } else if (dto.getType() == PushTypeEnum.baichuan) {// 鐧惧窛閾炬帴 if (StringUtil.isNullOrEmpty(dto.getWebUrl())) throw new PushException(2, "鍙傛暟涓嶅畬鏁�"); HWPushUtil.pushBaiChuanUrl(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), dto.getWebUrl()); } else if (dto.getType() == PushTypeEnum.welfare) {// 绂忓埄涓績 - HWPushUtil.pushWelfareCenter(tokenList, dto.getContent().getTitle(), dto.getContent().getContent()); + HWPushUtil.pushWelfareCenter(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(),getAndroidBaseActivity(dto.getContent().getSystem())); } else if (dto.getType() == PushTypeEnum.signin) {// 绛惧埌 - HWPushUtil.pushUserSignInNotification(tokenList, dto.getContent().getTitle(), dto.getContent().getContent()); + HWPushUtil.pushUserSignInNotification(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(),getAndroidBaseActivity(dto.getContent().getSystem())); } } catch (Exception e) { PushLogHelper.hwError(e); @@ -203,7 +208,7 @@ tokenList.add(token.getDeviceToken()); } - LogHelper.pushHW(String.format("鍗曟帹:璁惧鏁�%s 鐢ㄦ埛:%s",hwDeviceList.size(),dto.getUid()+"")); + LogHelper.pushHW(String.format("鍗曟帹:璁惧鏁�%s 鐢ㄦ埛:%s", hwDeviceList.size(), dto.getUid() + "")); if (tokenList.size() == 0) return; @@ -212,25 +217,25 @@ if (dto.getType() == PushTypeEnum.goodsdetail) {// 鍟嗗搧璇︽儏 if (dto.getGoodsId() == null) throw new PushException(2, "鍙傛暟涓嶅畬鏁�"); - HWPushUtil.pushGoods(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), 1, dto.getGoodsId()); + HWPushUtil.pushGoods(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), 1, dto.getGoodsId(),getAndroidBaseActivity(dto.getContent().getSystem())); } else if (dto.getType() == PushTypeEnum.url) {// 閾炬帴 if (StringUtil.isNullOrEmpty(dto.getWebUrl())) throw new PushException(2, "鍙傛暟涓嶅畬鏁�"); - HWPushUtil.pushUrl(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), dto.getWebUrl()); + HWPushUtil.pushUrl(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), dto.getWebUrl(),getAndroidBaseActivity(dto.getContent().getSystem())); } else if (dto.getType() == PushTypeEnum.ZNX) {// 绔欏唴淇� HWPushUtil.pushZNX(tokenList, dto.getContent().getTitle(), dto.getContent().getContent()); } else if (dto.getType() == PushTypeEnum.weex) {// weex if (StringUtil.isNullOrEmpty(dto.getUrl())) throw new PushException(2, "鍙傛暟涓嶅畬鏁�"); - HWPushUtil.pushWEEX(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), dto.getUrl()); + HWPushUtil.pushWEEX(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), dto.getUrl(),getAndroidBaseActivity(dto.getContent().getSystem())); } else if (dto.getType() == PushTypeEnum.baichuan) {// 鐧惧窛閾炬帴 if (StringUtil.isNullOrEmpty(dto.getWebUrl())) throw new PushException(2, "鍙傛暟涓嶅畬鏁�"); HWPushUtil.pushBaiChuanUrl(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(), dto.getWebUrl()); } else if (dto.getType() == PushTypeEnum.welfare) {// 绂忓埄涓績 - HWPushUtil.pushWelfareCenter(tokenList, dto.getContent().getTitle(), dto.getContent().getContent()); + HWPushUtil.pushWelfareCenter(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(),getAndroidBaseActivity(dto.getContent().getSystem())); } else if (dto.getType() == PushTypeEnum.signin) {// 绛惧埌 - HWPushUtil.pushUserSignInNotification(tokenList, dto.getContent().getTitle(), dto.getContent().getContent()); + HWPushUtil.pushUserSignInNotification(tokenList, dto.getContent().getTitle(), dto.getContent().getContent(),getAndroidBaseActivity(dto.getContent().getSystem())); } } catch (Exception e) { PushLogHelper.hwError(e); @@ -238,4 +243,10 @@ } } + + private String getAndroidBaseActivity(SystemEnum system) { + + return systemConfigService.getValueCache(SystemConfigKeyEnum.androidBaseActivityName, system); + + } } -- Gitblit v1.8.0