yujian
2019-09-25 3c1f04d76fdd1f60bd78696f8a1aac6dafbbb543
Merge branch 'div' of ssh://193.112.35.168:29418/fanli-server into div
10个文件已修改
7个文件已添加
827 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/AuthCallBackController.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/PushController.java 21 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SystemClientController.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserAccountController.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/push/DeviceTokenOPPOMapper.java 44 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/push/DeviceActive.java 22 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/push/DeviceTokenOPPO.java 77 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/log/PushLogHelper.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/push/DeviceActiveMapper.xml 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/push/DeviceTokenOPPOMapper.xml 132 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/money/extract/ExtractServiceImpl.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/DeviceActiveServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/DeviceTokenOPPOServiceImpl.java 65 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/OPPOPushServiceImpl.java 238 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/push/DeviceTokenOPPOService.java 54 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/push/OPPOPushService.java 94 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/AuthCallBackController.java
@@ -71,7 +71,7 @@
        if (StringUtil.isNullOrEmpty(code) || StringUtil.isNullOrEmpty(state)) {
            LogHelper.error("淘宝授权回调出错");
            try {
                response.sendRedirect("http://apph5.yeshitv.com/apppage/flq_bonusState.html?code=1");
                response.sendRedirect("http://apph5.yeshitv.com/flqWeb/h5/tbauth/fail.html?code=1");
            } catch (IOException e1) {
                e1.printStackTrace();
            }
@@ -85,7 +85,10 @@
        } catch (Exception e) {
        }
        LogHelper.userErrorInfo("淘宝授权回调state:"+state);
        String stateStr = AESUtil.decrypt(state, Constant.UIDAESKEY);
        LogHelper.userErrorInfo("淘宝授权回调解密:"+stateStr);
        int errCode = 0;
        if (StringUtil.isNullOrEmpty(stateStr)) {
            // 解密错误
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/PushController.java
@@ -17,6 +17,7 @@
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;
@@ -27,6 +28,7 @@
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;
@@ -44,7 +46,6 @@
@Controller
@RequestMapping(value = "api/v1/push")
public class PushController {
    @Resource
    private BusinessSystemService businessSystemService;
@@ -80,6 +81,9 @@
    @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) {
@@ -337,4 +341,19 @@
        }
    }
    @RequestMapping("registerOppo")
    public void registerOppo(AcceptData acceptData, String registerId, Long uid, PrintWriter out) {
        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(""));
    }
}
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SystemClientController.java
@@ -58,7 +58,8 @@
    private UserInfoExtraService userInfoExtraService;
    @RequestMapping("getsystemclientparams")
    public void getSystemClientParams(AcceptData acceptData, Long uid, HttpServletRequest request, PrintWriter out) {
    public void getSystemClientParams(AcceptData acceptData, Long uid, String mac, HttpServletRequest request,
            PrintWriter out) {
        BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
                acceptData.getPackages());
        if (system == null) {
@@ -117,6 +118,7 @@
                    da.setIpInfo(ipInfo);
                    da.setChannel(acceptData.getChannel());
                    da.setImei(acceptData.getImei());
                    da.setMac(mac);
                    deviceActiveService.addDeviceActive(da);
                } catch (Exception e) {
                }
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserAccountController.java
@@ -24,6 +24,7 @@
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.UserInfoModifyRecord.ModifyTypeEnum;
import com.yeshi.fanli.entity.bus.user.WeiXinUser;
import com.yeshi.fanli.entity.push.DeviceActive;
import com.yeshi.fanli.entity.system.BusinessSystem;
import com.yeshi.fanli.entity.taobao.ClientTBPid;
import com.yeshi.fanli.entity.taobao.PidUser;
@@ -43,7 +44,9 @@
import com.yeshi.fanli.service.inter.order.LostOrderService;
import com.yeshi.fanli.service.inter.order.OrderService;
import com.yeshi.fanli.service.inter.order.config.HongBaoManageService;
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.taobao.TaoBaoUnionConfigService;
import com.yeshi.fanli.service.inter.tlj.UserTaoLiJinOriginService;
import com.yeshi.fanli.service.inter.user.ForbiddenUserIdentifyCodeService;
@@ -125,6 +128,9 @@
    private DeviceTokenHWService deviceTokenHWService;
    @Resource
    private DeviceTokenOPPOService deviceTokenOPPOService;
    @Resource
    private TaoBaoUnionConfigService taoBaoUnionConfigService;
    @Resource
@@ -156,6 +162,9 @@
    @Resource
    private UserInfoModifyRecordService userInfoModifyRecordService;
    @Resource
    private DeviceActiveService deviceActiveService;
    private static final String PASSWORD_MAX_ERROR = "password_max_error";
    private static final String EXTRACT_MIN_MONEY = "extract_min_money";
@@ -1128,9 +1137,15 @@
    public void logOut(AcceptData acceptData, Long uid, PrintWriter out) {
        if (uid == null || uid == 0)
            return;
        if ("android".equalsIgnoreCase(acceptData.getPlatform())) {
            DeviceActive deviceActive = deviceActiveService.getFirstActiveInfo(acceptData.getDevice());
        // 需要解绑HW推送的用户绑定
        if ("android".equalsIgnoreCase(acceptData.getPlatform()))
            deviceTokenHWService.unBindDeviceToken(acceptData.getDevice());
            if (deviceActive != null) {
                // 解绑OPPO推送的用户绑定
                deviceTokenOPPOService.unBindUid(uid, deviceActive.getId());
            }
        }
        out.print(JsonUtil.loadTrueResult(""));
    }
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/push/DeviceTokenOPPOMapper.java
New file
@@ -0,0 +1,44 @@
package com.yeshi.fanli.dao.mybatis.push;
import java.util.List;
import org.apache.ibatis.annotations.Param;
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);
    /**
     * 设备数量
     *
     * @return
     */
    long countDeviceToken(@Param("versionList")List<Integer> versionList);
    /**
     * 设备列表
     *
     * @param start
     * @param count
     * @return
     */
    List<DeviceTokenOPPO> listDeviceToken(@Param("start") long start, @Param("count") int count,
            @Param("versionList") List<Integer> versionList);
    /**
     * 根据用户ID查询
     *
     * @param uid
     * @return
     */
    List<DeviceTokenOPPO> listByUid(@Param("uid")Long uid,@Param("versionList") List<Integer> verisonList);
}
fanli/src/main/java/com/yeshi/fanli/entity/push/DeviceActive.java
@@ -33,6 +33,28 @@
    private String channel;// 渠道
    @Column(name = "da_imei")
    private String imei;
    @Column(name = "da_idfa")
    private String idfa;
    @Column(name = "da_mac")
    private String mac;
    public String getIdfa() {
        return idfa;
    }
    public void setIdfa(String idfa) {
        this.idfa = idfa;
    }
    public String getMac() {
        return mac;
    }
    public void setMac(String mac) {
        this.mac = mac;
    }
    public String getImei() {
        return imei;
fanli/src/main/java/com/yeshi/fanli/entity/push/DeviceTokenOPPO.java
New file
@@ -0,0 +1,77 @@
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;
    }
}
fanli/src/main/java/com/yeshi/fanli/log/PushLogHelper.java
@@ -77,6 +77,21 @@
        } catch (IOException e1) {
        }
    }
    public static void oppoError(Throwable e) {
        String date = TimeUtil.getGernalTime(System.currentTimeMillis(), "yyyy_MM_dd");
        String os = System.getProperty("os.name");
        String filePath = String.format("/usr/local/tomcat8/logs/push/oppo_error_detail_%s.txt", date);
        if (os.toLowerCase().startsWith("win")) {
            filePath = String.format("C:/logs/push/oppo_error_detail_%s.txt", date);
        }
        try {
            saveErrorLog(e, filePath);
        } catch (IOException e1) {
        }
    }
    public static void saveErrorLog(Throwable e, String filePath) throws IOException {
        // 创建文件夹
fanli/src/main/java/com/yeshi/fanli/mapping/push/DeviceActiveMapper.xml
@@ -17,8 +17,11 @@
        <result column="da_ip" property="ipInfo" jdbcType="VARCHAR" />
        <result column="da_channel" property="channel" jdbcType="VARCHAR" />
        <result column="da_imei" property="imei" jdbcType="VARCHAR" />
        <result column="da_idfa" property="idfa" jdbcType="VARCHAR" />
        <result column="da_mac" property="mac" jdbcType="VARCHAR" />
    </resultMap>
    <sql id="Base_Column_List">da_id,da_platform,da_device,da_device_token_md5,da_device_token,da_version_code,da_createtime,da_updatetime,da_ip,da_channel,da_imei</sql>
    <sql id="Base_Column_List">da_id,da_platform,da_device,da_device_token_md5,da_device_token,da_version_code,da_createtime,da_updatetime,da_ip,da_channel,da_imei,da_idfa,da_mac
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
@@ -50,22 +53,21 @@
        from yeshi_ec_device_active where da_device = #{0} order by da_id
        limit 1
    </select>
    <select id="selectFirstByImei" resultMap="BaseResultMap"
        parameterType="java.lang.String">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_device_active where da_imei = #{0} order by da_id
        limit 1
        from yeshi_ec_device_active where da_imei = #{0} order by da_id limit
        1
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_device_active where da_id = #{id,jdbcType=BIGINT}</delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.push.DeviceActive"
        useGeneratedKeys="true" keyProperty="id">insert into yeshi_ec_device_active
        (da_id,da_platform,da_device,da_device_token_md5,da_device_token,da_version_code,da_createtime,da_updatetime,da_ip,da_channel,da_imei)
        (da_id,da_platform,da_device,da_device_token_md5,da_device_token,da_version_code,da_createtime,da_updatetime,da_ip,da_channel,da_imei,da_idfa,da_mac)
        values
        (#{id,jdbcType=BIGINT},#{platform,jdbcType=INTEGER},#{device,jdbcType=VARCHAR},#{deviceTokenMd5,jdbcType=VARCHAR},#{deviceToken,jdbcType=VARCHAR},#{versionCode,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{ipInfo,jdbcType=VARCHAR},#{channel,jdbcType=VARCHAR},#{imei,jdbcType=VARCHAR})</insert>
        (#{id,jdbcType=BIGINT},#{platform,jdbcType=INTEGER},#{device,jdbcType=VARCHAR},#{deviceTokenMd5,jdbcType=VARCHAR},#{deviceToken,jdbcType=VARCHAR},#{versionCode,jdbcType=INTEGER},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{ipInfo,jdbcType=VARCHAR},#{channel,jdbcType=VARCHAR},#{imei,jdbcType=VARCHAR},#{idfa,jdbcType=VARCHAR},#{mac,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.push.DeviceActive"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_device_active
@@ -81,6 +83,8 @@
            <if test="ipInfo != null">da_ip,</if>
            <if test="channel != null">da_channel,</if>
            <if test="imei != null">da_imei,</if>
            <if test="idfa != null">da_idfa,</if>
            <if test="mac != null">da_mac,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -95,6 +99,8 @@
            <if test="ipInfo != null">#{ipInfo,jdbcType=VARCHAR},</if>
            <if test="channel != null">#{channel,jdbcType=VARCHAR}</if>
            <if test="imei != null">#{imei,jdbcType=VARCHAR}</if>
            <if test="idfa != null">#{idfa,jdbcType=VARCHAR}</if>
            <if test="mac != null">#{mac,jdbcType=VARCHAR}</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.push.DeviceActive">update
@@ -106,14 +112,16 @@
        #{versionCode,jdbcType=INTEGER},da_createtime =
        #{createTime,jdbcType=TIMESTAMP},da_updatetime =
        #{updateTime,jdbcType=TIMESTAMP},da_ip = #{ipInfo,jdbcType=VARCHAR}
        ,da_channel =#{channel,jdbcType=VARCHAR},da_imei =#{imei,jdbcType=VARCHAR} where da_id =
        #{id,jdbcType=BIGINT}</update>
        ,da_channel =#{channel,jdbcType=VARCHAR},da_imei
        =#{imei,jdbcType=VARCHAR} ,da_idfa =#{idfa,jdbcType=VARCHAR} ,da_mac
        =#{mac,jdbcType=VARCHAR} where da_id = #{id,jdbcType=BIGINT}</update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.push.DeviceActive">
        update yeshi_ec_device_active
        <set>
            <if test="platform != null">da_platform=#{platform,jdbcType=INTEGER},</if>
            <if test="device != null">da_device=#{device,jdbcType=VARCHAR},</if>
            <if test="deviceTokenMd5 != null">da_device_token_md5=#{deviceTokenMd5,jdbcType=VARCHAR},</if>
            <if test="deviceTokenMd5 != null">da_device_token_md5=#{deviceTokenMd5,jdbcType=VARCHAR},
            </if>
            <if test="deviceToken != null">da_device_token=#{deviceToken,jdbcType=VARCHAR},</if>
            <if test="versionCode != null">da_version_code=#{versionCode,jdbcType=INTEGER},</if>
            <if test="createTime != null">da_createtime=#{createTime,jdbcType=TIMESTAMP},</if>
@@ -121,6 +129,8 @@
            <if test="ipInfo != null">da_ip=#{ipInfo,jdbcType=VARCHAR},</if>
            <if test="channel !=null">da_channel =#{channel,jdbcType=VARCHAR},</if>
            <if test="imei !=null">da_imei =#{imei,jdbcType=VARCHAR},</if>
            <if test="idfa !=null">da_idfa =#{idfa,jdbcType=VARCHAR},</if>
            <if test="mac !=null">da_mac =#{mac,jdbcType=VARCHAR},</if>
        </set>
        where da_id = #{id,jdbcType=BIGINT}
    </update>
fanli/src/main/java/com/yeshi/fanli/mapping/push/DeviceTokenOPPOMapper.xml
New file
@@ -0,0 +1,132 @@
<?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>
    <select id="countDeviceToken" resultType="java.lang.Long"
        parameterType="java.lang.Long">
        select
        count(do_id)
        from yeshi_ec_uid_devicetoken_oppo op left join
        yeshi_ec_device_active a on a.da_id=op.do_device_id
        <if test="versionList!=null">
            <foreach collection="versionList" open="where (" separator=" or "
                item="ver" close=")">
                da_version_code=#{ver}
            </foreach>
        </if>
    </select>
    <select id="listDeviceToken" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_uid_devicetoken_oppo
        left join
        yeshi_ec_device_active a on a.da_id=do_device_id
        <if test="versionList!=null">
            <foreach collection="versionList" open="where (" separator=" or "
                item="ver" close=")">
                da_version_code=#{ver}
            </foreach>
        </if>
         limit #{start},#{count}
    </select>
    <select id="listByUid" resultMap="BaseResultMap" parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_uid_devicetoken_oppo
        left join
        yeshi_ec_device_active a on a.da_id=do_device_id
        where do_uid=#{uid}
        <if test="versionList!=null">
            <foreach collection="versionList" open="and (" separator=" or "
                item="ver" close=")">
                da_version_code=#{ver}
            </foreach>
        </if>
    </select>
     List<Integer> verisonList
    <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>
fanli/src/main/java/com/yeshi/fanli/service/impl/money/extract/ExtractServiceImpl.java
@@ -382,10 +382,9 @@
        AlipayClient alipayClient = new DefaultAlipayClient("https://openapi.alipay.com/gateway.do",
                Constant.alipayConfig.getAppId(), privateKey, "json", "gbk", null, "RSA2");
        AlipayFundTransToaccountTransferRequest request = new AlipayFundTransToaccountTransferRequest();
        String uuid = UUID.randomUUID().toString().replace("-", "");
        String appName = Constant.systemCommonConfig.getProjectChineseName();
        JSONObject json = new JSONObject();
        json.put("out_biz_no", uuid);//最长长度64位,支持英文,下划线,数字
        json.put("out_biz_no", "widthdraw_"+extract.getId());//最长长度64位,支持英文,下划线,数字
        json.put("payee_type", "ALIPAY_LOGONID");
        json.put("payee_account", extract.getAccount());
        json.put("amount", extract.getMoney());
fanli/src/main/java/com/yeshi/fanli/service/impl/push/DeviceActiveServiceImpl.java
@@ -58,6 +58,10 @@
                updateDeviceActive.setDeviceToken(deviceActive.getDeviceToken());
                updateDeviceActive.setDeviceTokenMd5(StringUtil.Md5(deviceActive.getDeviceToken()));
            }
            if (StringUtil.isNullOrEmpty(da.getMac()))
                updateDeviceActive.setImei(deviceActive.getMac());
            deviceActiveMapper.updateByPrimaryKeySelective(updateDeviceActive);
        }
fanli/src/main/java/com/yeshi/fanli/service/impl/push/DeviceTokenOPPOServiceImpl.java
New file
@@ -0,0 +1,65 @@
package com.yeshi.fanli.service.impl.push;
import java.util.Date;
import java.util.List;
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);
        }
    }
    @Override
    public long countDeviceToken(List<Integer> versionList) {
        return deviceTokenOPPOMapper.countDeviceToken(versionList);
    }
    @Override
    public List<DeviceTokenOPPO> listDeviceToken(int page, int pageSize, List<Integer> versionList) {
        return deviceTokenOPPOMapper.listDeviceToken((page - 1) * pageSize, pageSize, versionList);
    }
    @Override
    public List<DeviceTokenOPPO> listByUid(Long uid, List<Integer> verisonList) {
        return deviceTokenOPPOMapper.listByUid(uid, verisonList);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/push/OPPOPushServiceImpl.java
New file
@@ -0,0 +1,238 @@
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.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.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 DeviceTokenOPPOService deviceTokenOPPOService;
    @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<DeviceTokenOPPO> filterDeviceToken(List<DeviceTokenOPPO> deviceList, int hour) {
        // 处理消息免打扰
        if (hour >= 20 || hour < 8) {
            Set<Long> uidSets = new HashSet<>();
            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,
                    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 < deviceList.size(); i++) {
                    if (deviceList.get(i).getUid() != null && uidSets.contains(deviceList.get(i).getUid())) {
                        deviceList.remove(i--);
                    }
                }
        }
        return deviceList;
    }
    /**
     * 推送
     *
     * @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) {
            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<DeviceTokenOPPO> deviceList = deviceTokenOPPOService.listDeviceToken(p, pageSize, newVersionList);
                deviceList = filterDeviceToken(deviceList, hour);
                List<String> tokenList = new ArrayList<>();
                for (DeviceTokenOPPO token : deviceList)
                    tokenList.add(token.getRegisterId());
                try {
                    if (type == PushTypeEnum.goodsdetail) {// 商品详情
                        if (goodsId == null)
                            throw new PushException(2, "参数不完整");
                        OPPOPushUtil.pushGoods(tokenList, title, content, 1, goodsId);
                    } else if (type == PushTypeEnum.url) {// 链接
                        if (StringUtil.isNullOrEmpty(webUrl))
                            throw new PushException(2, "参数不完整");
                        OPPOPushUtil.pushUrl(tokenList, title, content, webUrl);
                    } else if (type == PushTypeEnum.ZNX) {// 站内信
                        OPPOPushUtil.pushZNX(tokenList, title, content);
                    } else if (type == PushTypeEnum.weex) {// weex
                        if (StringUtil.isNullOrEmpty(url))
                            throw new PushException(2, "参数不完整");
                        OPPOPushUtil.pushWEEX(tokenList, title, content, url);
                    } else if (type == PushTypeEnum.baichuan) {// 百川链接
                        if (StringUtil.isNullOrEmpty(webUrl))
                            throw new PushException(2, "参数不完整");
                        OPPOPushUtil.pushBaiChuanUrl(tokenList, title, content, webUrl);
                    } else if (type == PushTypeEnum.welfare) {// 福利中心
                        OPPOPushUtil.pushWelfareCenter(tokenList, title, content);
                    } else if (type == PushTypeEnum.signin) {// 签到
                        OPPOPushUtil.pushUserSignInNotification(tokenList, title, content);
                    }
                } catch (Exception e) {
                    PushLogHelper.hwError(e);
                }
            }
        } else {
            // 华为单推
            List<DeviceTokenOPPO> deviceList = deviceTokenOPPOService.listByUid(uid, newVersionList);
            List<String> tokenList = new ArrayList<>();
            if (deviceList != null) {
                deviceList = filterDeviceToken(deviceList, hour);
                for (DeviceTokenOPPO token : deviceList)
                    tokenList.add(token.getRegisterId());
            }
            if (tokenList.size() == 0)
                return;
            try {
                if (type == PushTypeEnum.goodsdetail) {// 商品详情
                    if (goodsId == null)
                        throw new PushException(2, "参数不完整");
                    OPPOPushUtil.pushGoods(tokenList, title, content, 1, goodsId);
                } else if (type == PushTypeEnum.url) {// 链接
                    if (StringUtil.isNullOrEmpty(webUrl))
                        throw new PushException(2, "参数不完整");
                    OPPOPushUtil.pushUrl(tokenList, title, content, webUrl);
                } else if (type == PushTypeEnum.ZNX) {// 站内信
                    OPPOPushUtil.pushZNX(tokenList, title, content);
                } else if (type == PushTypeEnum.weex) {// weex
                    if (StringUtil.isNullOrEmpty(url))
                        throw new PushException(2, "参数不完整");
                    OPPOPushUtil.pushWEEX(tokenList, title, content, url);
                } else if (type == PushTypeEnum.baichuan) {// 百川链接
                    if (StringUtil.isNullOrEmpty(webUrl))
                        throw new PushException(2, "参数不完整");
                    OPPOPushUtil.pushBaiChuanUrl(tokenList, title, content, webUrl);
                } else if (type == PushTypeEnum.welfare) {// 福利中心
                    OPPOPushUtil.pushWelfareCenter(tokenList, title, content);
                } else if (type == PushTypeEnum.signin) {// 签到
                    OPPOPushUtil.pushUserSignInNotification(tokenList, title, content);
                }
            } catch (Exception e) {
                PushLogHelper.oppoError(e);
            }
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/service/inter/push/DeviceTokenOPPOService.java
New file
@@ -0,0 +1,54 @@
package com.yeshi.fanli.service.inter.push;
import java.util.List;
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);
    /**
     * 计算所有的设备
     *
     * @return
     */
    public long countDeviceToken(List<Integer> verisonList);
    /**
     * 设备列表
     *
     * @param page
     * @param pageSize
     * @return
     */
    public List<DeviceTokenOPPO> listDeviceToken(int page, int pageSize, List<Integer> verisonList);
    /**
     * 根据用户ID检索
     *
     * @param uid
     * @return
     */
    public List<DeviceTokenOPPO> listByUid(Long uid, List<Integer> verisonList);
}
fanli/src/main/java/com/yeshi/fanli/service/inter/push/OPPOPushService.java
New file
@@ -0,0 +1,94 @@
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;
}
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java
@@ -173,7 +173,7 @@
            doPDDOrderJob();// 拼多多订单处理
            doImportantTaoBaoGoodsUpdateJob();// 淘宝重要商品的信息更新
            doHongBaoRecieveIntegralGetJob();// 返利到账,金币增加
            doPlaceOrderIntegralJob();// 下单赠送金币任务
//            doPlaceOrderIntegralJob();// 下单赠送金币任务
            doDouYinDeviceActiveJob();// 抖音设备激活广告监测
        }