| | |
| | | import com.yeshi.fanli.entity.common.JumpDetailV2;
|
| | | import com.yeshi.fanli.entity.goods.CommonGoods;
|
| | | import com.yeshi.fanli.entity.push.DeviceActive;
|
| | | import com.yeshi.fanli.entity.push.DeviceTokenOPPO;
|
| | | import com.yeshi.fanli.entity.push.PushGoods;
|
| | | import com.yeshi.fanli.entity.push.PushGoodsGroup;
|
| | | import com.yeshi.fanli.entity.push.PushGoodsRecord;
|
| | |
| | | import com.yeshi.fanli.service.inter.config.ConfigService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceActiveService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceTokenHWService;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceTokenOPPOService;
|
| | | import com.yeshi.fanli.service.inter.push.IOSPushService;
|
| | | import com.yeshi.fanli.service.inter.push.PushGoodsGroupService;
|
| | | import com.yeshi.fanli.service.inter.push.PushGoodsRecordService;
|
| | |
| | | @Controller
|
| | | @RequestMapping(value = "api/v1/push")
|
| | | public class PushController {
|
| | |
|
| | | @Resource
|
| | | private BusinessSystemService businessSystemService;
|
| | |
|
| | |
| | |
|
| | | @Resource(name = "taskExecutor")
|
| | | private TaskExecutor executor;
|
| | | |
| | | @Resource
|
| | | private DeviceTokenOPPOService deviceTokenOPPOService;
|
| | |
|
| | | @RequestMapping(value = "callback", method = RequestMethod.POST)
|
| | | public void callback(AcceptData acceptData, String pushId, PrintWriter out) {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | |
| | |
|
| | | @RequestMapping("registerOppo")
|
| | | public void registerOppo(AcceptData acceptData, String registerId, Long uid, PrintWriter out) {
|
| | | System.out.println(registerId);
|
| | | System.out.println(uid);
|
| | | DeviceActive deviceActive = deviceActiveService.getFirstActiveInfo(acceptData.getDevice());
|
| | | if (deviceActive != null) {
|
| | | DeviceTokenOPPO oppo = new DeviceTokenOPPO();
|
| | | oppo.setDeviceActiveId(deviceActive.getId());
|
| | | oppo.setRegisterId(registerId);
|
| | | oppo.setUid(uid);
|
| | | deviceTokenOPPOService.addDeviceTokenOPPO(oppo);
|
| | | }
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | }
|
| | |
|
New file |
| | |
| | | package com.yeshi.fanli.dao.mybatis.push; |
| | | |
| | | import com.yeshi.fanli.dao.BaseMapper; |
| | | import com.yeshi.fanli.entity.push.DeviceTokenOPPO; |
| | | |
| | | public interface DeviceTokenOPPOMapper extends BaseMapper<DeviceTokenOPPO> { |
| | | |
| | | /** |
| | | * 根据设备激活ID查询 |
| | | * |
| | | * @param deviceActiveId |
| | | * @return |
| | | */ |
| | | DeviceTokenOPPO selectByDeviceActiveId(Long deviceActiveId); |
| | | |
| | | } |
New file |
| | |
| | | package com.yeshi.fanli.entity.push;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import org.yeshi.utils.mybatis.Column;
|
| | | import org.yeshi.utils.mybatis.Table;
|
| | |
|
| | | /**
|
| | | * oppo推送
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | @Table("yeshi_ec_uid_devicetoken_oppo")
|
| | | public class DeviceTokenOPPO {
|
| | | @Column(name = "do_id")
|
| | | private Long id;
|
| | | @Column(name = "do_device_id")
|
| | | private Long deviceActiveId;// 设备活跃ID
|
| | | @Column(name = "do_register_id")
|
| | | private String registerId;
|
| | | @Column(name = "do_uid")
|
| | | private Long uid;
|
| | | @Column(name = "do_create_time")
|
| | | private Date createTime;
|
| | | @Column(name = "do_update_time")
|
| | | private Date updateTime;
|
| | |
|
| | | public Long getId() {
|
| | | return id;
|
| | | }
|
| | |
|
| | | public void setId(Long id) {
|
| | | this.id = id;
|
| | | }
|
| | |
|
| | | public String getRegisterId() {
|
| | | return registerId;
|
| | | }
|
| | |
|
| | | public void setRegisterId(String registerId) {
|
| | | this.registerId = registerId;
|
| | | }
|
| | |
|
| | | public Long getUid() {
|
| | | return uid;
|
| | | }
|
| | |
|
| | | public void setUid(Long uid) {
|
| | | this.uid = uid;
|
| | | }
|
| | |
|
| | | public Date getCreateTime() {
|
| | | return createTime;
|
| | | }
|
| | |
|
| | | public void setCreateTime(Date createTime) {
|
| | | this.createTime = createTime;
|
| | | }
|
| | |
|
| | | public Date getUpdateTime() {
|
| | | return updateTime;
|
| | | }
|
| | |
|
| | | public void setUpdateTime(Date updateTime) {
|
| | | this.updateTime = updateTime;
|
| | | }
|
| | |
|
| | | public Long getDeviceActiveId() {
|
| | | return deviceActiveId;
|
| | | }
|
| | |
|
| | | public void setDeviceActiveId(Long deviceActiveId) {
|
| | | this.deviceActiveId = deviceActiveId;
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper namespace="com.yeshi.fanli.dao.mybatis.push.DeviceTokenOPPOMapper"> |
| | | <resultMap id="BaseResultMap" type="com.yeshi.fanli.entity.push.DeviceTokenOPPO"> |
| | | <id column="do_id" property="id" jdbcType="BIGINT" /> |
| | | <result column="do_device_id" property="deviceActiveId" jdbcType="BIGINT" /> |
| | | <result column="do_register_id" property="registerId" jdbcType="VARCHAR" /> |
| | | <result column="do_uid" property="uid" jdbcType="BIGINT" /> |
| | | <result column="do_create_time" property="createTime" jdbcType="TIMESTAMP" /> |
| | | <result column="do_update_time" property="updateTime" jdbcType="TIMESTAMP" /> |
| | | </resultMap> |
| | | <sql id="Base_Column_List">do_id,do_device_id,do_register_id,do_uid,do_create_time,do_update_time |
| | | </sql> |
| | | <select id="selectByPrimaryKey" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_uid_devicetoken_oppo where do_id = #{id,jdbcType=BIGINT} |
| | | </select> |
| | | |
| | | |
| | | <select id="selectByDeviceActiveId" resultMap="BaseResultMap" |
| | | parameterType="java.lang.Long"> |
| | | select |
| | | <include refid="Base_Column_List" /> |
| | | from yeshi_ec_uid_devicetoken_oppo where do_device_id = #{0} |
| | | </select> |
| | | |
| | | |
| | | <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from |
| | | yeshi_ec_uid_devicetoken_oppo where do_id = #{id,jdbcType=BIGINT} |
| | | </delete> |
| | | <insert id="insert" parameterType="com.yeshi.fanli.entity.push.DeviceTokenOPPO" |
| | | useGeneratedKeys="true" keyProperty="id">insert into |
| | | yeshi_ec_uid_devicetoken_oppo |
| | | (do_id,do_device_id,do_register_id,do_uid,do_create_time,do_update_time) |
| | | values |
| | | (#{id,jdbcType=BIGINT},#{deviceActiveId,jdbcType=BIGINT},#{registerId,jdbcType=VARCHAR},#{uid,jdbcType=BIGINT},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP}) |
| | | </insert> |
| | | <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.push.DeviceTokenOPPO" |
| | | useGeneratedKeys="true" keyProperty="id"> |
| | | insert into yeshi_ec_uid_devicetoken_oppo |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">do_id,</if> |
| | | <if test="deviceActiveId != null">do_device_id,</if> |
| | | <if test="registerId != null">do_register_id,</if> |
| | | <if test="uid != null">do_uid,</if> |
| | | <if test="createTime != null">do_create_time,</if> |
| | | <if test="updateTime != null">do_update_time,</if> |
| | | </trim> |
| | | values |
| | | <trim prefix="(" suffix=")" suffixOverrides=","> |
| | | <if test="id != null">#{id,jdbcType=BIGINT},</if> |
| | | <if test="deviceActiveId != null">#{deviceActiveId,jdbcType=BIGINT},</if> |
| | | <if test="registerId != null">#{registerId,jdbcType=VARCHAR},</if> |
| | | <if test="uid != null">#{uid,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </trim> |
| | | </insert> |
| | | <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.push.DeviceTokenOPPO">update |
| | | yeshi_ec_uid_devicetoken_oppo set do_device_id = |
| | | #{deviceActiveId,jdbcType=BIGINT},do_register_id = |
| | | #{registerId,jdbcType=VARCHAR},do_uid = |
| | | #{uid,jdbcType=BIGINT},do_create_time = |
| | | #{createTime,jdbcType=TIMESTAMP},do_update_time = |
| | | #{updateTime,jdbcType=TIMESTAMP} where do_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.push.DeviceTokenOPPO"> |
| | | update yeshi_ec_uid_devicetoken_oppo |
| | | <set> |
| | | <if test="deviceActiveId != null">do_device_id=#{deviceActiveId,jdbcType=BIGINT},</if> |
| | | <if test="registerId != null">do_register_id=#{registerId,jdbcType=VARCHAR},</if> |
| | | <if test="uid != null">do_uid=#{uid,jdbcType=BIGINT},</if> |
| | | <if test="createTime != null">do_create_time=#{createTime,jdbcType=TIMESTAMP},</if> |
| | | <if test="updateTime != null">do_update_time=#{updateTime,jdbcType=TIMESTAMP},</if> |
| | | </set> |
| | | where do_id = #{id,jdbcType=BIGINT} |
| | | </update> |
| | | </mapper> |
New file |
| | |
| | | package com.yeshi.fanli.service.impl.push;
|
| | |
|
| | | import java.util.Date;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dao.mybatis.push.DeviceTokenOPPOMapper;
|
| | | import com.yeshi.fanli.entity.push.DeviceTokenOPPO;
|
| | | import com.yeshi.fanli.service.inter.push.DeviceTokenOPPOService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | |
|
| | | @Service
|
| | | public class DeviceTokenOPPOServiceImpl implements DeviceTokenOPPOService {
|
| | |
|
| | | @Resource
|
| | | private DeviceTokenOPPOMapper deviceTokenOPPOMapper;
|
| | |
|
| | | @Override
|
| | | public void addDeviceTokenOPPO(DeviceTokenOPPO oppo) {
|
| | | if (oppo == null || oppo.getDeviceActiveId() == null || StringUtil.isNullOrEmpty(oppo.getRegisterId()))
|
| | | return;
|
| | | DeviceTokenOPPO oldOppo = deviceTokenOPPOMapper.selectByDeviceActiveId(oppo.getDeviceActiveId());
|
| | | if (oldOppo == null) {
|
| | | if (oppo.getCreateTime() == null)
|
| | | oppo.setCreateTime(new Date());
|
| | | deviceTokenOPPOMapper.insertSelective(oppo);
|
| | | } else {
|
| | | DeviceTokenOPPO update = new DeviceTokenOPPO();
|
| | | update.setId(oldOppo.getId());
|
| | | update.setRegisterId(oppo.getRegisterId());
|
| | | update.setUpdateTime(oppo.getUpdateTime());
|
| | | update.setUid(oppo.getUid());
|
| | | deviceTokenOPPOMapper.updateByPrimaryKeySelective(update);
|
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void unBindUid(Long uid, Long deviceActiveId) {
|
| | | DeviceTokenOPPO oldOppo = deviceTokenOPPOMapper.selectByDeviceActiveId(deviceActiveId);
|
| | | if (oldOppo != null) {
|
| | | oldOppo.setUid(null);
|
| | | oldOppo.setUpdateTime(new Date());
|
| | | deviceTokenOPPOMapper.updateByPrimaryKey(oldOppo);
|
| | | }
|
| | | }
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.impl.push;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Calendar;
|
| | | import java.util.HashSet;
|
| | | import java.util.List;
|
| | | import java.util.Set;
|
| | |
|
| | | import javax.annotation.Resource;
|
| | |
|
| | | import org.springframework.scheduling.annotation.Async;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import com.yeshi.fanli.dto.push.PushTypeEnum;
|
| | | 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.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.OPPOPushService;
|
| | | import com.yeshi.fanli.service.inter.user.UserCustomSettingsService;
|
| | | import com.yeshi.fanli.util.StringUtil;
|
| | | import com.yeshi.fanli.util.push.HWPushUtil;
|
| | |
|
| | | @Service
|
| | | public class OPPOPushServiceImpl implements OPPOPushService {
|
| | |
|
| | | @Resource
|
| | | private DeviceTokenHWService deviceTokenHWService;
|
| | |
|
| | | @Resource
|
| | | private AppVersionService appVersionService;
|
| | |
|
| | | @Resource
|
| | | private UserCustomSettingsService userCustomSettingsService;
|
| | |
|
| | | private List<Integer> getVersionCodeList(List<Integer> versionCodeList) {
|
| | | List<Integer> versionList = new ArrayList<>();
|
| | | if (versionCodeList == null) {// 全推
|
| | | List<AppVersionInfo> appInfoList = appVersionService.listByPlatformAndMinVersionCode("android", 49);
|
| | | if (appInfoList != null)
|
| | | for (AppVersionInfo version : appInfoList) {
|
| | | versionList.add(version.getVersionCode());
|
| | | }
|
| | |
|
| | | } else {// 按版本推送
|
| | | for (Integer versionCode : versionCodeList) {
|
| | | if (versionCode.intValue() >= 49) {// 2.0.1开始支持
|
| | | versionList.add(versionCode);
|
| | | }
|
| | | }
|
| | | }
|
| | | return versionList;
|
| | | }
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushGoods(Long uid, Long auctionId, String title, String content, List<Integer> versionCodeList)
|
| | | throws PushException {
|
| | | push(PushTypeEnum.goodsdetail, uid, title, content, null, null, auctionId, versionCodeList);
|
| | | }
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushUrl(Long uid, String url, String title, String content, List<Integer> versionCodeList)
|
| | | throws PushException {
|
| | | push(PushTypeEnum.url, uid, title, content, null, url, null, versionCodeList);
|
| | | }
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushZNX(Long uid, String title, String content, List<Integer> versionCodeList) throws PushException {
|
| | | push(PushTypeEnum.ZNX, uid, title, content, null, null, null, versionCodeList);
|
| | | }
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushWEEX(Long uid, String title, String content, String weexUrl, List<Integer> versionCodeList)
|
| | | throws PushException {
|
| | | push(PushTypeEnum.weex, uid, title, content, weexUrl, null, null, versionCodeList);
|
| | | }
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushBaiChuanUrl(Long uid, String title, String content, String url, List<Integer> versionCodeList)
|
| | | throws PushException {
|
| | |
|
| | | push(PushTypeEnum.baichuan, uid, title, content, null, url, null, versionCodeList);
|
| | | }
|
| | |
|
| | | @Async("pushExecutor")
|
| | | @Override
|
| | | public void pushWelfareCenter(Long uid, String title, String content, List<Integer> versionCodeList)
|
| | | throws PushException {
|
| | | push(PushTypeEnum.welfare, uid, title, content, null, null, null, versionCodeList);
|
| | | }
|
| | |
|
| | | @Override
|
| | | public void pushUserSignInNotification(Long uid, String title, String content, List<Integer> versionCodeList)
|
| | | throws PushException {
|
| | | push(PushTypeEnum.signin, uid, title, content, null, null, null, versionCodeList);
|
| | | }
|
| | |
|
| | | private List<DeviceTokenHW> filterDeviceToken(List<DeviceTokenHW> hwDeviceList, int hour) {
|
| | | // 处理消息免打扰
|
| | | if (hour >= 20 || hour < 8) {
|
| | | Set<Long> uidSets = new HashSet<>();
|
| | | for (DeviceTokenHW dt : hwDeviceList)
|
| | | if (dt.getUser() != null)
|
| | | uidSets.add(dt.getUser().getId());
|
| | | List<Long> uidList = new ArrayList<>();
|
| | | uidList.addAll(uidSets);
|
| | | List<UserCustomSettings> settingList = userCustomSettingsService.listByUidListAndTypeAndState(uidList,
|
| | | UserSettingTypeEnum.cancelNotice.name(), UserCustomSettings.STATE_VALID);
|
| | | uidSets.clear();
|
| | | if (settingList != null) {
|
| | | for (UserCustomSettings seeting : settingList)
|
| | | 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--);
|
| | | }
|
| | | }
|
| | | }
|
| | | return hwDeviceList;
|
| | | }
|
| | |
|
| | | /**
|
| | | * 推送
|
| | | * |
| | | * @param type
|
| | | * @param uid
|
| | | * @param title
|
| | | * @param content
|
| | | * @param url
|
| | | * @param webUrl
|
| | | * @param versionCodeList
|
| | | */
|
| | | private void push(PushTypeEnum type, Long uid, String title, String content, String url, String webUrl,
|
| | | Long goodsId, List<Integer> versionCodeList) throws PushException {
|
| | | int hour = Calendar.getInstance().get(Calendar.HOUR_OF_DAY);
|
| | | List<Integer> newVersionList = getVersionCodeList(versionCodeList);
|
| | | // 1.6.5后开始推送
|
| | | for (int i = 0; i < newVersionList.size(); i++) {
|
| | | if (newVersionList.get(i) < 47)
|
| | | newVersionList.remove(i--);
|
| | | }
|
| | |
|
| | | if (uid == null || uid == 0) {
|
| | | long deviceCount = deviceTokenHWService.countDeviceToken(newVersionList);
|
| | | int page = (int) (deviceCount % 100 == 0 ? deviceCount / 100 : deviceCount / 100 + 1);
|
| | | for (int p = 1; p <= page; p++) {
|
| | | List<DeviceTokenHW> hwDeviceList = deviceTokenHWService.getDeviceTokenList(p, 100, newVersionList);
|
| | | hwDeviceList = filterDeviceToken(hwDeviceList, hour);
|
| | |
|
| | | List<String> tokenList = new ArrayList<>();
|
| | | for (DeviceTokenHW token : hwDeviceList)
|
| | | tokenList.add(token.getDeviceToken());
|
| | | try {
|
| | | if (type == PushTypeEnum.goodsdetail) {// 商品详情
|
| | | if (goodsId == null)
|
| | | throw new PushException(2, "参数不完整");
|
| | | HWPushUtil.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);
|
| | | } else if (type == PushTypeEnum.ZNX) {// 站内信
|
| | | HWPushUtil.pushZNX(tokenList, title, content);
|
| | | } else if (type == PushTypeEnum.weex) {// weex
|
| | | if (StringUtil.isNullOrEmpty(url))
|
| | | throw new PushException(2, "参数不完整");
|
| | | HWPushUtil.pushWEEX(tokenList, title, content, url);
|
| | | } else if (type == PushTypeEnum.baichuan) {// 百川链接
|
| | | if (StringUtil.isNullOrEmpty(webUrl))
|
| | | throw new PushException(2, "参数不完整");
|
| | | HWPushUtil.pushBaiChuanUrl(tokenList, title, content, webUrl);
|
| | | } else if (type == PushTypeEnum.welfare) {// 福利中心
|
| | | HWPushUtil.pushWelfareCenter(tokenList, title, content);
|
| | | } else if (type == PushTypeEnum.signin) {// 签到
|
| | | HWPushUtil.pushUserSignInNotification(tokenList, title, content);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | PushLogHelper.hwError(e);
|
| | | }
|
| | |
|
| | | }
|
| | | } else {
|
| | | // 华为单推
|
| | | List<DeviceTokenHW> hwDeviceList = deviceTokenHWService.getDeviceTokenByUid(uid, newVersionList);
|
| | | List<String> tokenList = new ArrayList<>();
|
| | | if (hwDeviceList != null) {
|
| | | hwDeviceList = filterDeviceToken(hwDeviceList, hour);
|
| | | for (DeviceTokenHW token : hwDeviceList)
|
| | | tokenList.add(token.getDeviceToken());
|
| | | }
|
| | | if (tokenList.size() == 0)
|
| | | return;
|
| | |
|
| | | try {
|
| | | if (type == PushTypeEnum.goodsdetail) {// 商品详情
|
| | | if (goodsId == null)
|
| | | throw new PushException(2, "参数不完整");
|
| | | HWPushUtil.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);
|
| | | } else if (type == PushTypeEnum.ZNX) {// 站内信
|
| | | HWPushUtil.pushZNX(tokenList, title, content);
|
| | | } else if (type == PushTypeEnum.weex) {// weex
|
| | | if (StringUtil.isNullOrEmpty(url))
|
| | | throw new PushException(2, "参数不完整");
|
| | | HWPushUtil.pushWEEX(tokenList, title, content, url);
|
| | | } else if (type == PushTypeEnum.baichuan) {// 百川链接
|
| | | if (StringUtil.isNullOrEmpty(webUrl))
|
| | | throw new PushException(2, "参数不完整");
|
| | | HWPushUtil.pushBaiChuanUrl(tokenList, title, content, webUrl);
|
| | | } else if (type == PushTypeEnum.welfare) {// 福利中心
|
| | | HWPushUtil.pushWelfareCenter(tokenList, title, content);
|
| | | } else if (type == PushTypeEnum.signin) {// 签到
|
| | | HWPushUtil.pushUserSignInNotification(tokenList, title, content);
|
| | | }
|
| | | } catch (Exception e) {
|
| | | PushLogHelper.hwError(e);
|
| | | }
|
| | |
|
| | | }
|
| | | }
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.push;
|
| | |
|
| | | import com.yeshi.fanli.entity.push.DeviceTokenOPPO;
|
| | |
|
| | | /**
|
| | | * OPPO的设备绑定
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface DeviceTokenOPPOService {
|
| | |
|
| | | /**
|
| | | * 添加OPPO推送设备
|
| | | * |
| | | * @param oppo
|
| | | */
|
| | | public void addDeviceTokenOPPO(DeviceTokenOPPO oppo);
|
| | |
|
| | | /**
|
| | | * 解绑uid与设备
|
| | | * |
| | | * @param uid
|
| | | * @param deviceActiveId
|
| | | */
|
| | | public void unBindUid(Long uid, Long deviceActiveId);
|
| | |
|
| | | }
|
New file |
| | |
| | | package com.yeshi.fanli.service.inter.push;
|
| | |
|
| | | import java.util.List;
|
| | |
|
| | | import com.yeshi.fanli.exception.push.PushException;
|
| | |
|
| | | /**
|
| | | * 华为推送服务
|
| | | * |
| | | * @author Administrator
|
| | | *
|
| | | */
|
| | | public interface OPPOPushService {
|
| | |
|
| | | /**
|
| | | * 推送商品
|
| | | * |
| | | * @param uid
|
| | | * @param url
|
| | | * @param title
|
| | | * @param content
|
| | | * @throws PushException
|
| | | */
|
| | | void pushGoods(Long uid, Long auctionId, String title, String content, List<Integer> versionCodeList)
|
| | | throws PushException;
|
| | |
|
| | | /**
|
| | | * 推送链接
|
| | | * |
| | | * @param uid
|
| | | * @param url
|
| | | * @param title
|
| | | * @param content
|
| | | * @throws PushException
|
| | | */
|
| | | void pushUrl(Long uid, String url, String title, String content, List<Integer> versionCodeList)
|
| | | throws PushException;
|
| | |
|
| | | /**
|
| | | * 推送站内信
|
| | | * |
| | | * @param uId
|
| | | * @param title
|
| | | * @param content
|
| | | * @throws PushException
|
| | | */
|
| | | void pushZNX(Long uId, String title, String content, List<Integer> versionCodeList) throws PushException;
|
| | |
|
| | | /**
|
| | | * 适用版本 1.4.8及以后 推送weex页面
|
| | | * |
| | | * @param uid
|
| | | * @param title
|
| | | * @param content
|
| | | * @param weexUrl
|
| | | * @throws PushException
|
| | | */
|
| | | void pushWEEX(Long uid, String title, String content, String weexUrl, List<Integer> versionCodeList)
|
| | | throws PushException;
|
| | |
|
| | | /**
|
| | | * 适用版本 1.4.8及以后 推送百川网页
|
| | | * |
| | | * @param uid
|
| | | * @param title
|
| | | * @param content
|
| | | * @param url
|
| | | * @throws PushException
|
| | | */
|
| | | void pushBaiChuanUrl(Long uid, String title, String content, String url, List<Integer> versionCodeList)
|
| | | throws PushException;
|
| | |
|
| | | /**
|
| | | * 推送福利中心(版本号:1.5.1后)
|
| | | * |
| | | * @param uid
|
| | | * @param title
|
| | | * @param content
|
| | | * @throws PushException
|
| | | */
|
| | | void pushWelfareCenter(Long uid, String title, String content, List<Integer> versionCodeList) throws PushException;
|
| | |
|
| | | /**
|
| | | * 推送签到提醒
|
| | | * |
| | | * @param uid
|
| | | * @param title
|
| | | * @param content
|
| | | * @param versions
|
| | | * @throws PushException
|
| | | */
|
| | | void pushUserSignInNotification(Long uid, String title, String content, List<Integer> versionCodeList) throws PushException;
|
| | |
|
| | | }
|