From aec36e0e136b55ffeb1d22dd3d7f5c2443b806aa Mon Sep 17 00:00:00 2001
From: yujian <yujian@123.com>
Date: 星期一, 23 九月 2019 10:49:56 +0800
Subject: [PATCH] 品牌 后台管理
---
fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java | 60 +++++++++++++++++++++++++++++++++++++++++++++++++++++-------
1 files changed, 53 insertions(+), 7 deletions(-)
diff --git a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java
index 3451cf8..d7768a3 100644
--- a/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java
+++ b/fanli/src/main/java/com/yeshi/fanli/service/impl/push/PushServiceImpl.java
@@ -9,12 +9,13 @@
import com.yeshi.fanli.controller.admin.PushController;
import com.yeshi.fanli.dao.mybatis.AccountMessageMapper;
import com.yeshi.fanli.dao.mybatis.push.PushRecordMapper;
+import com.yeshi.fanli.dto.push.PushTypeEnum;
import com.yeshi.fanli.entity.AppVersionInfo;
import com.yeshi.fanli.entity.bus.user.AccountMessage;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.system.SystemZnx;
import com.yeshi.fanli.entity.xinge.PushRecord;
-import com.yeshi.fanli.exception.PushException;
+import com.yeshi.fanli.exception.push.PushException;
import com.yeshi.fanli.service.inter.config.AppVersionService;
import com.yeshi.fanli.service.inter.push.DeviceTokenHWService;
import com.yeshi.fanli.service.inter.push.HWPushService;
@@ -104,7 +105,7 @@
PushRecord pushRecord = new PushRecord();
pushRecord.setUid(uid);
pushRecord.setState(1);
- pushRecord.setType(PushController.GOODS); // 閮芥垚鍔�
+ pushRecord.setType(PushTypeEnum.goodsdetail.getCode()); // 閮芥垚鍔�
pushRecord.setUrl(url);
pushRecord.setTitle(title);
pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
@@ -153,7 +154,7 @@
PushRecord pushRecord = new PushRecord();
pushRecord.setUid(uid);
pushRecord.setState(1);
- pushRecord.setType(PushController.URL);
+ pushRecord.setType(PushTypeEnum.url.getCode());
pushRecord.setUrl(url);
pushRecord.setTitle(title);
pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
@@ -221,7 +222,7 @@
pushRecord.setUid(uId);
pushRecord.setTitle(title);
pushRecord.setState(1); // 鎴愬姛
- pushRecord.setType(PushController.ZNX); // 绫诲瀷锛氱珯鍐呬俊
+ pushRecord.setType(PushTypeEnum.ZNX.getCode()); // 绫诲瀷锛氱珯鍐呬俊
pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
pushRecordMapper.insertSelective(pushRecord);
@@ -268,7 +269,7 @@
pushRecord.setTitle(title);
pushRecord.setUid(uid);
pushRecord.setState(1); // 鎴愬姛
- pushRecord.setType(PushController.WEEX); // 绫诲瀷锛歐EEX
+ pushRecord.setType(PushTypeEnum.weex.getCode()); // 绫诲瀷锛歐EEX
pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
pushRecordMapper.insertSelective(pushRecord);
@@ -317,7 +318,7 @@
pushRecord.setTitle(title);
pushRecord.setUid(uid);
pushRecord.setState(1); // 鎴愬姛
- pushRecord.setType(PushController.BAICHUAN); // 绫诲瀷锛氱櫨宸�
+ pushRecord.setType(PushTypeEnum.baichuan.getCode()); // 绫诲瀷锛氱櫨宸�
pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
pushRecordMapper.insertSelective(pushRecord);
@@ -363,7 +364,7 @@
pushRecord.setTitle(title);
pushRecord.setUid(uid);
pushRecord.setState(1); // 鎴愬姛
- pushRecord.setType(PushController.WELFARE_CENTER); // 绫诲瀷锛氱櫨宸�
+ pushRecord.setType(PushTypeEnum.welfare.getCode()); // 绫诲瀷锛氱櫨宸�
pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
pushRecordMapper.insertSelective(pushRecord);
@@ -449,4 +450,49 @@
return versionCodes;
}
+ @Override
+ public void pushUserSignInNotification(Long uid, String title, String content, List<String> listIOS,
+ List<String> listAndroid) throws PushException {
+ if (StringUtil.isNullOrEmpty(title))
+ throw new PushException(1, "鏃犳帹閫佹爣棰�");
+ if (StringUtil.isNullOrEmpty(content))
+ throw new PushException(1, "鏃犳帹閫佸唴瀹�");
+
+ /* IOS绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
+ if (listIOS == null || listIOS.size() > 0) {
+ // 闄愬埗鎺ㄩ�佺増鏈彿锛�1.6.5浠ュ悗
+ String codes = getEffectiveVersionCodes(60, AppVersionInfo.PLATFORM_IOS, listIOS);
+ if (listIOS == null || (listIOS.size() > 0 && codes != null && codes.trim().length() > 0)) {
+ iosPushService.pushUserSignInNotification(uid, title, content, codes);
+ }
+ }
+
+ /* Android绔帹閫� (娉ㄦ槑锛歭ist绛変簬 'null' 鏃跺叏鎺紝 size绛変簬0 涓嶅仛鎺ㄩ��) */
+ if (listAndroid == null || listAndroid.size() > 0) {
+ // 闄愬埗鎺ㄩ�佺増鏈彿锛�1.6.5浠ュ悗
+ String versions = getEffectiveVersions(47, AppVersionInfo.PLATFORM_ANDROID, listAndroid);
+ if (listAndroid == null || (listAndroid.size() > 0 && versions != null && versions.trim().length() > 0)) {
+ xmPushService.pushUserSignInNotification(uid, title, content, versions);
+ }
+ }
+
+ // 鍗庝负鎺ㄩ��
+ if (listAndroid == null || listAndroid.size() > 0) {
+ List<Integer> versionCodeList = null;
+ if (listAndroid != null)
+ versionCodeList = appVersionService.listVersionCodeByVersions("android", listAndroid);
+ hwPushService.pushUserSignInNotification(uid, title, content, versionCodeList);
+ }
+
+ // 鎻掑叆鎺ㄩ�佽褰�
+ PushRecord pushRecord = new PushRecord();
+ pushRecord.setTitle(title);
+ pushRecord.setUid(uid);
+ pushRecord.setState(1); // 鎴愬姛
+ pushRecord.setType(PushTypeEnum.signin.getCode()); // 绫诲瀷锛氱櫨宸�
+ pushRecord.setAppName(Constant.systemCommonConfig.getProjectChineseName());
+ pushRecord.setCreatetime(java.lang.System.currentTimeMillis());
+ pushRecordMapper.insertSelective(pushRecord);
+ }
+
}
--
Gitblit v1.8.0