From 4f5a5b0a00c01491f009074351089f086f950d3e Mon Sep 17 00:00:00 2001 From: admin <weikou2014> Date: 星期二, 01 六月 2021 19:09:48 +0800 Subject: [PATCH] 系统配置改为数据库 --- fanli/src/main/java/com/yeshi/fanli/service/impl/push/HWPushServiceImpl.java | 37 ++++++++++++++++++++++++------------- 1 files changed, 24 insertions(+), 13 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..56f89a2 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); @@ -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