From 271ae63c20fcbe28d29c47f1881138ff6551a2a1 Mon Sep 17 00:00:00 2001
From: admin <weikou2014>
Date: 星期三, 10 六月 2020 19:26:26 +0800
Subject: [PATCH] 唯品会订单bug修复,APP端佣金比例展示错误bug修复
---
fanli/src/main/java/com/yeshi/fanli/service/impl/push/OPPOPushServiceImpl.java | 87 +++++++++++++++++++++++--------------------
1 files changed, 46 insertions(+), 41 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/OPPOPushServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/OPPOPushServiceImpl.java
index 4712110..f6e63b8 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/OPPOPushServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/OPPOPushServiceImpl.java
@@ -15,21 +15,21 @@
import com.yeshi.fanli.entity.AppVersionInfo;
import com.yeshi.fanli.entity.bus.user.UserCustomSettings;
import com.yeshi.fanli.entity.bus.user.UserCustomSettings.UserSettingTypeEnum;
-import com.yeshi.fanli.entity.push.DeviceTokenHW;
+import com.yeshi.fanli.entity.push.DeviceTokenOPPO;
import com.yeshi.fanli.exception.push.PushException;
import com.yeshi.fanli.log.PushLogHelper;
import com.yeshi.fanli.service.inter.config.AppVersionService;
-import com.yeshi.fanli.service.inter.push.DeviceTokenHWService;
+import com.yeshi.fanli.service.inter.push.DeviceTokenOPPOService;
import com.yeshi.fanli.service.inter.push.OPPOPushService;
import com.yeshi.fanli.service.inter.user.UserCustomSettingsService;
import com.yeshi.fanli.util.StringUtil;
-import com.yeshi.fanli.util.push.HWPushUtil;
+import com.yeshi.fanli.util.push.OPPOPushUtil;
@Service
public class OPPOPushServiceImpl implements OPPOPushService {
@Resource
- private DeviceTokenHWService deviceTokenHWService;
+ private DeviceTokenOPPOService deviceTokenOPPOService;
@Resource
private AppVersionService appVersionService;
@@ -40,7 +40,7 @@
private List<Integer> getVersionCodeList(List<Integer> versionCodeList) {
List<Integer> versionList = new ArrayList<>();
if (versionCodeList == null) {// 鍏ㄦ帹
- List<AppVersionInfo> appInfoList = appVersionService.listByPlatformAndMinVersionCode("android", 49);
+ List<AppVersionInfo> appInfoList = appVersionService.listByPlatformAndMinVersionCode("android", 51);
if (appInfoList != null)
for (AppVersionInfo version : appInfoList) {
versionList.add(version.getVersionCode());
@@ -48,7 +48,7 @@
} else {// 鎸夌増鏈帹閫�
for (Integer versionCode : versionCodeList) {
- if (versionCode.intValue() >= 49) {// 2.0.1寮�濮嬫敮鎸�
+ if (versionCode.intValue() >= 51) {// 2.0.1寮�濮嬫敮鎸�
versionList.add(versionCode);
}
}
@@ -104,13 +104,18 @@
push(PushTypeEnum.signin, uid, title, content, null, null, null, versionCodeList);
}
- private List<DeviceTokenHW> filterDeviceToken(List<DeviceTokenHW> hwDeviceList, int hour) {
+ private List<DeviceTokenOPPO> filterDeviceToken(List<DeviceTokenOPPO> deviceList, int hour) {
+
+ // TODO 娑堟伅鍏嶆墦鎵板叧闂�
+ if (1 > 0)
+ return deviceList;
+
// 澶勭悊娑堟伅鍏嶆墦鎵�
if (hour >= 20 || hour < 8) {
Set<Long> uidSets = new HashSet<>();
- for (DeviceTokenHW dt : hwDeviceList)
- if (dt.getUser() != null)
- uidSets.add(dt.getUser().getId());
+ for (DeviceTokenOPPO dt : deviceList)
+ if (dt.getUid() != null)
+ uidSets.add(dt.getUid());
List<Long> uidList = new ArrayList<>();
uidList.addAll(uidSets);
List<UserCustomSettings> settingList = userCustomSettingsService.listByUidListAndTypeAndState(uidList,
@@ -121,14 +126,13 @@
uidSets.add(seeting.getUserInfo().getId());
}
if (uidSets.size() > 0)
- for (int i = 0; i < hwDeviceList.size(); i++) {
- if (hwDeviceList.get(i).getUser() != null
- && uidSets.contains(hwDeviceList.get(i).getUser().getId())) {
- hwDeviceList.remove(i--);
+ for (int i = 0; i < deviceList.size(); i++) {
+ if (deviceList.get(i).getUid() != null && uidSets.contains(deviceList.get(i).getUid())) {
+ deviceList.remove(i--);
}
}
}
- return hwDeviceList;
+ return deviceList;
}
/**
@@ -153,38 +157,39 @@
}
if (uid == null || uid == 0) {
- long deviceCount = deviceTokenHWService.countDeviceToken(newVersionList);
- int page = (int) (deviceCount % 100 == 0 ? deviceCount / 100 : deviceCount / 100 + 1);
+ int pageSize = 200;
+ long deviceCount = deviceTokenOPPOService.countDeviceToken(newVersionList);
+ int page = (int) (deviceCount % pageSize == 0 ? deviceCount / pageSize : deviceCount / pageSize + 1);
for (int p = 1; p <= page; p++) {
- List<DeviceTokenHW> hwDeviceList = deviceTokenHWService.getDeviceTokenList(p, 100, newVersionList);
- hwDeviceList = filterDeviceToken(hwDeviceList, hour);
+ List<DeviceTokenOPPO> deviceList = deviceTokenOPPOService.listDeviceToken(p, pageSize, newVersionList);
+ deviceList = filterDeviceToken(deviceList, hour);
List<String> tokenList = new ArrayList<>();
- for (DeviceTokenHW token : hwDeviceList)
- tokenList.add(token.getDeviceToken());
+ for (DeviceTokenOPPO token : deviceList)
+ tokenList.add(token.getRegisterId());
try {
if (type == PushTypeEnum.goodsdetail) {// 鍟嗗搧璇︽儏
if (goodsId == null)
throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
- HWPushUtil.pushGoods(tokenList, title, content, 1, goodsId);
+ OPPOPushUtil.pushGoods(tokenList, title, content, 1, goodsId);
} else if (type == PushTypeEnum.url) {// 閾炬帴
if (StringUtil.isNullOrEmpty(webUrl))
throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
- HWPushUtil.pushUrl(tokenList, title, content, webUrl);
+ OPPOPushUtil.pushUrl(tokenList, title, content, webUrl);
} else if (type == PushTypeEnum.ZNX) {// 绔欏唴淇�
- HWPushUtil.pushZNX(tokenList, title, content);
+ OPPOPushUtil.pushZNX(tokenList, title, content);
} else if (type == PushTypeEnum.weex) {// weex
if (StringUtil.isNullOrEmpty(url))
throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
- HWPushUtil.pushWEEX(tokenList, title, content, url);
+ OPPOPushUtil.pushWEEX(tokenList, title, content, url);
} else if (type == PushTypeEnum.baichuan) {// 鐧惧窛閾炬帴
if (StringUtil.isNullOrEmpty(webUrl))
throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
- HWPushUtil.pushBaiChuanUrl(tokenList, title, content, webUrl);
+ OPPOPushUtil.pushBaiChuanUrl(tokenList, title, content, webUrl);
} else if (type == PushTypeEnum.welfare) {// 绂忓埄涓績
- HWPushUtil.pushWelfareCenter(tokenList, title, content);
+ OPPOPushUtil.pushWelfareCenter(tokenList, title, content);
} else if (type == PushTypeEnum.signin) {// 绛惧埌
- HWPushUtil.pushUserSignInNotification(tokenList, title, content);
+ OPPOPushUtil.pushUserSignInNotification(tokenList, title, content);
}
} catch (Exception e) {
PushLogHelper.hwError(e);
@@ -193,12 +198,12 @@
}
} else {
// 鍗庝负鍗曟帹
- List<DeviceTokenHW> hwDeviceList = deviceTokenHWService.getDeviceTokenByUid(uid, newVersionList);
+ List<DeviceTokenOPPO> deviceList = deviceTokenOPPOService.listByUid(uid, newVersionList);
List<String> tokenList = new ArrayList<>();
- if (hwDeviceList != null) {
- hwDeviceList = filterDeviceToken(hwDeviceList, hour);
- for (DeviceTokenHW token : hwDeviceList)
- tokenList.add(token.getDeviceToken());
+ if (deviceList != null) {
+ deviceList = filterDeviceToken(deviceList, hour);
+ for (DeviceTokenOPPO token : deviceList)
+ tokenList.add(token.getRegisterId());
}
if (tokenList.size() == 0)
return;
@@ -207,28 +212,28 @@
if (type == PushTypeEnum.goodsdetail) {// 鍟嗗搧璇︽儏
if (goodsId == null)
throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
- HWPushUtil.pushGoods(tokenList, title, content, 1, goodsId);
+ OPPOPushUtil.pushGoods(tokenList, title, content, 1, goodsId);
} else if (type == PushTypeEnum.url) {// 閾炬帴
if (StringUtil.isNullOrEmpty(webUrl))
throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
- HWPushUtil.pushUrl(tokenList, title, content, webUrl);
+ OPPOPushUtil.pushUrl(tokenList, title, content, webUrl);
} else if (type == PushTypeEnum.ZNX) {// 绔欏唴淇�
- HWPushUtil.pushZNX(tokenList, title, content);
+ OPPOPushUtil.pushZNX(tokenList, title, content);
} else if (type == PushTypeEnum.weex) {// weex
if (StringUtil.isNullOrEmpty(url))
throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
- HWPushUtil.pushWEEX(tokenList, title, content, url);
+ OPPOPushUtil.pushWEEX(tokenList, title, content, url);
} else if (type == PushTypeEnum.baichuan) {// 鐧惧窛閾炬帴
if (StringUtil.isNullOrEmpty(webUrl))
throw new PushException(2, "鍙傛暟涓嶅畬鏁�");
- HWPushUtil.pushBaiChuanUrl(tokenList, title, content, webUrl);
+ OPPOPushUtil.pushBaiChuanUrl(tokenList, title, content, webUrl);
} else if (type == PushTypeEnum.welfare) {// 绂忓埄涓績
- HWPushUtil.pushWelfareCenter(tokenList, title, content);
+ OPPOPushUtil.pushWelfareCenter(tokenList, title, content);
} else if (type == PushTypeEnum.signin) {// 绛惧埌
- HWPushUtil.pushUserSignInNotification(tokenList, title, content);
+ OPPOPushUtil.pushUserSignInNotification(tokenList, title, content);
}
} catch (Exception e) {
- PushLogHelper.hwError(e);
+ PushLogHelper.oppoError(e);
}
}
--
Gitblit v1.8.0