admin
2019-09-19 b469ab33391a3c2c0a031e17eea5de7a069f0c67
抖音广告监测
1 文件已重命名
27个文件已修改
2个文件已添加
666 ■■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/ClientJspController.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SystemClientController.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserInfoController.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/ad/DouYinClickEventDao.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dto/ad/DouYinDeviceActiveQueueDTO.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dto/ad/DouYinUserActionInfoDTO.java 6 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserActiveLog.java 14 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/push/DeviceActive.java 10 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/job/PushJob.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/msg/MsgDeviceReadStateMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/push/DeviceActiveMapper.xml 42 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserActiveLogMapper.xml 29 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/ad/DouYinClickEventServiceImpl.java 15 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/DynamicInfoServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/monitor/BusinessEmergent110ServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgConfigServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderRepairServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/push/DeviceActiveServiceImpl.java 3 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserActiveLogServiceImpl.java 18 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoExtraServiceImpl.java 199 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoModifyRecordServiceImpl.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/ad/DouYinClickEventService.java 24 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/Constant.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java 63 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/ad/DouYinAdUtil.java 38 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/util/cmq/DouYinDeviceActiveCMQManager.java 66 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/ClientJspController.java
@@ -313,8 +313,6 @@
    @RequestMapping("threeShareNew")
    public String threeShareNew(HttpServletRequest request, HttpSession session, HttpServletResponse response,
            long uid) {
        String serverName = request.getServerName();
        String contextPath = request.getContextPath();
        UserInfo userInfo = userInfoService.getUserById(uid);
        if (userInfo == null) {
            return "share/error";
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/SystemClientController.java
@@ -116,6 +116,7 @@
                            : DeviceActive.PLATFORM_IOS);
                    da.setVersionCode(Integer.parseInt(acceptData.getVersion()));
                    da.setIpInfo(ipInfo);
                    da.setChannel(acceptData.getChannel());
                    deviceActiveService.addDeviceActive(da);
                } catch (Exception e) {
                }
fanli/src/main/java/com/yeshi/fanli/controller/client/v1/UserInfoController.java
@@ -266,6 +266,8 @@
                userActiveLog.setVersionCode(acceptData.getVersion());
                userActiveLog.setOsVersion(acceptData.getOsVersion());
                userActiveLog.setDeviceType(acceptData.getDeviceType());
                userActiveLog.setDevice(acceptData.getDevice());
                userActiveLogService.addUserActiveLog(userActiveLog);
                outUserInfo(acceptData, out, remotIP, find, acceptData.getDevice());
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/InviteControllerV2.java
@@ -207,7 +207,7 @@
                    if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getWeiXin())) {
                        object.put("weiXin", userInfoExtra.getWeiXin());
                        object.put("weiXinState", 3);
                        object.put("weiXinTip", "添加TA的微信,你可教授TA如何通过返利券赚钱技巧。");
                        object.put("weiXinTip", "添加TA的微信,你可教授TA如何通过板栗快省赚钱技巧。");
                    } else {
                        if (!threeSaleExtraInfoSerivce.isRemindWorker(uid, workerId)) {
                            object.put("weiXinState", 1);
@@ -314,7 +314,7 @@
            if (userInfoExtra != null && !StringUtil.isNullOrEmpty(userInfoExtra.getWeiXin())) {
                bossData.put("weiXin", userInfoExtra.getWeiXin());
                bossData.put("weiXinState", 3);
                bossData.put("weiXinTip", "添加TA的微信,你可向TA学习如何通过返利券赚钱。");
                bossData.put("weiXinTip", "添加TA的微信,你可向TA学习如何通过板栗快省赚钱。");
            } else {
                if (!threeSaleExtraInfoSerivce.isRemindBoss(boss.getId(), uid)) {
                    bossData.put("weiXinState", 1);
fanli/src/main/java/com/yeshi/fanli/dao/ad/DouYinClickEventDao.java
@@ -16,4 +16,10 @@
        return findOne(query);
    }
    public DouYinClickEvent selectByAndroidId(String androidId) {
        Query query = new Query();
        query.addCriteria(Criteria.where("androidId").is(androidId));
        return findOne(query);
    }
}
fanli/src/main/java/com/yeshi/fanli/dto/ad/DouYinDeviceActiveQueueDTO.java
New file
@@ -0,0 +1,63 @@
package com.yeshi.fanli.dto.ad;
/**
 * 抖音广告与设备处理队列
 *
 * @author Administrator
 *
 */
public class DouYinDeviceActiveQueueDTO {
    public final static int TYPE_AD = 1;
    public final static int TYPE_DEVICE = 2;
    private int type;
    private String aid;
    private String device;
    private int platform;
    public DouYinDeviceActiveQueueDTO() {
    }
    public DouYinDeviceActiveQueueDTO(int type, String aid) {
        this.type = type;
        this.aid = aid;
    }
    public DouYinDeviceActiveQueueDTO(int type, String device, int platform) {
        this.type = type;
        this.device = device;
        this.platform = platform;
    }
    public int getPlatform() {
        return platform;
    }
    public void setPlatform(int platform) {
        this.platform = platform;
    }
    public int getType() {
        return type;
    }
    public void setType(int type) {
        this.type = type;
    }
    public String getAid() {
        return aid;
    }
    public void setAid(String aid) {
        this.aid = aid;
    }
    public String getDevice() {
        return device;
    }
    public void setDevice(String device) {
        this.device = device;
    }
}
fanli/src/main/java/com/yeshi/fanli/dto/ad/DouYinUserActionInfoDTO.java
File was renamed from fanli/src/main/java/com/yeshi/fanli/dto/ad/DouYinUserActionInfo.java
@@ -6,7 +6,7 @@
 * @author Administrator
 *
 */
public class DouYinUserActionInfo {
public class DouYinUserActionInfoDTO {
    // 0: 激活
    // 1: 注册
@@ -37,7 +37,7 @@
    private long convTime;// UTC时间戳
    private int eventType;
    public DouYinUserActionInfo(String callback, String muid, int os, long convTime,
    public DouYinUserActionInfoDTO(String callback, String muid, int os, long convTime,
            int eventType) {
        this.callback = callback;
        this.muid = muid;
@@ -46,7 +46,7 @@
        this.eventType = eventType;
    }
    public DouYinUserActionInfo() {
    public DouYinUserActionInfoDTO() {
    }
    public String getCallback() {
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserActiveLog.java
@@ -14,9 +14,9 @@
 */
@Table("yeshi_ec_log_user_active")
public class UserActiveLog {
    @Column(name = "ual_id")
    @Column(name = "lua_id")
    private Long id;
    @Column(name = "ual_uid")
    @Column(name = "lua_uid")
    private Long uid;
    @Column(name = "lua_ip")
    private String ip;
@@ -32,6 +32,16 @@
    private String deviceType;
    @Column(name = "lua_os_version")
    private String osVersion;
    @Column(name = "lua_device")
    private String device;//设备号
    public String getDevice() {
        return device;
    }
    public void setDevice(String device) {
        this.device = device;
    }
    public String getDeviceType() {
        return deviceType;
fanli/src/main/java/com/yeshi/fanli/entity/push/DeviceActive.java
@@ -29,6 +29,16 @@
    private Date updateTime;
    @Column(name = "da_ip")
    private String ipInfo;
    @Column(name = "da_channel")
    private String channel;// 渠道
    public String getChannel() {
        return channel;
    }
    public void setChannel(String channel) {
        this.channel = channel;
    }
    public String getIpInfo() {
        return ipInfo;
fanli/src/main/java/com/yeshi/fanli/job/PushJob.java
@@ -48,8 +48,8 @@
        InputStream cer = null;
        int p = deviceList.size() / 50 + 1;
        JSONObject json = IOSPushFactory.createURLPush("https://0x9.me/TusaI", "返利券苹果端进行了重大更新!请立即升级",
                "更多优惠券,更高返利,尽在新版苹果端返利券!");
        JSONObject json = IOSPushFactory.createURLPush("https://0x9.me/TusaI", "板栗快省苹果端进行了重大更新!请立即升级",
                "更多优惠券,更高返利,尽在新版苹果端板栗快省!");
        for (int i = 0; i < p; i++) {
            cer = this.getClass().getClassLoader().getResourceAsStream("certificate/老版本-生产证书.p12");
            try {
fanli/src/main/java/com/yeshi/fanli/mapping/UserInfoMapper.xml
@@ -91,8 +91,8 @@
        <include refid="Base_Column_List" />
        from yeshi_ec_user where id = #{id,jdbcType=BIGINT}
    </select>
        <!-- 不能查询缓存 -->
    <!-- 不能查询缓存 -->
    <select id="selectAvailableByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long" flushCache="true" useCache="false">
        select
@@ -250,7 +250,8 @@
        from yeshi_ec_user where appid=#{appId} and identifycode=#{openId}
    </select>
    <!-- 根据AppId与电话号码获取用户 -->
    <select id="listByAppIdAndPhone" resultMap="BaseResultMap">
    <select id="listByAppIdAndPhone" resultMap="BaseResultMap"
        useCache="false" flushCache="true">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user where appid=#{appId} and phone=#{phone}
@@ -686,8 +687,8 @@
        uf.`uie_invite_code` = #{inviteCode})
        LIMIT 1
    </select>
    <select id="countAvaiableUser" resultType="java.lang.Long">
        SELECT count(*) FROM
        yeshi_ec_user u
fanli/src/main/java/com/yeshi/fanli/mapping/msg/MsgDeviceReadStateMapper.xml
@@ -29,13 +29,13 @@
        from yeshi_ec_msg_device_read_state where mdrs_id =
        #{id,jdbcType=BIGINT}
    </select>
    <select id="selectByDeviceAndPlatformAndType" resultMap="BaseResultMap">
    <select id="selectByDeviceAndPlatformAndType" resultMap="BaseResultMap" useCache="false" flushCache="true">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_msg_device_read_state where mdrs_device=#{device} and
        mdrs_platform=#{platform} and mdrs_type=#{type}
    </select>
    <select id="listByDeviceAndPlatform" resultMap="BaseResultMap">
    <select id="listByDeviceAndPlatform" resultMap="BaseResultMap"  useCache="false" flushCache="true">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_msg_device_read_state where mdrs_device=#{device} and
fanli/src/main/java/com/yeshi/fanli/mapping/push/DeviceActiveMapper.xml
@@ -15,55 +15,47 @@
        <result column="da_createtime" property="createTime" jdbcType="TIMESTAMP" />
        <result column="da_updatetime" property="updateTime" jdbcType="TIMESTAMP" />
        <result column="da_ip" property="ipInfo" jdbcType="VARCHAR" />
        <result column="da_channel" property="channel" 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
    </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</sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_device_active where da_id = #{id,jdbcType=BIGINT}
    </select>
    <select id="selectByDeviceAndPlatform" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_device_active where da_device = #{device} and
        da_platform=#{platform} order by da_id desc  limit 1
        da_platform=#{platform} order by da_id desc limit 1
    </select>
    <select id="selectFirstByDeviceAndPlatform" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_device_active where da_device = #{device} and
        da_platform=#{platform} limit 1
    </select>
    <select id="selectByDeviceToeknMd5AndPlatform" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_device_active where da_device_token_md5 =
        #{deviceTokenMd5} and da_platform=#{platform}
    </select>
    <select id="selectFirst" resultMap="BaseResultMap" parameterType="java.lang.String">
    <select id="selectFirst" resultMap="BaseResultMap"
        parameterType="java.lang.String">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_device_active where da_device =
        #{0} order by da_id limit 1
        from yeshi_ec_device_active where da_device = #{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>
        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_id,da_platform,da_device,da_device_token_md5,da_device_token,da_version_code,da_createtime,da_updatetime,da_ip,da_channel)
        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})
    </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})</insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.push.DeviceActive"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_device_active
@@ -77,7 +69,7 @@
            <if test="createTime != null">da_createtime,</if>
            <if test="updateTime != null">da_updatetime,</if>
            <if test="ipInfo != null">da_ip,</if>
            <if test="channel != null">da_channel,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -90,6 +82,7 @@
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="ipInfo != null">#{ipInfo,jdbcType=VARCHAR},</if>
            <if test="channel != null">#{channel,jdbcType=VARCHAR}</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.push.DeviceActive">update
@@ -100,22 +93,21 @@
        #{deviceToken,jdbcType=VARCHAR},da_version_code =
        #{versionCode,jdbcType=INTEGER},da_createtime =
        #{createTime,jdbcType=TIMESTAMP},da_updatetime =
        #{updateTime,jdbcType=TIMESTAMP},da_ip =
        #{ipInfo,jdbcType=VARCHAR}
        where da_id = #{id,jdbcType=BIGINT}
    </update>
        #{updateTime,jdbcType=TIMESTAMP},da_ip = #{ipInfo,jdbcType=VARCHAR}
        ,da_channel =#{channel,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>
            <if test="updateTime != null">da_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="ipInfo != null">da_ip=#{ipInfo,jdbcType=VARCHAR},</if>
            <if test="channel !=null">da_channel =#{channel,jdbcType=VARCHAR},</if>
        </set>
        where da_id = #{id,jdbcType=BIGINT}
    </update>
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserActiveLogMapper.xml
@@ -14,8 +14,9 @@
        <result column="lua_device_type" property="deviceType"
            jdbcType="VARCHAR" />
        <result column="lua_os_version" property="osVersion" jdbcType="VARCHAR" />
        <result column="lua_device" property="device" jdbcType="VARCHAR" />
    </resultMap>
    <sql id="Base_Column_List">lua_id,lua_uid,lua_ip,lua_channel,lua_version_code,lua_createtime,lua_updatetime,lua_device_type,lua_os_version
    <sql id="Base_Column_List">lua_id,lua_uid,lua_ip,lua_channel,lua_version_code,lua_createtime,lua_updatetime,lua_device_type,lua_os_version,lua_device
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
@@ -23,32 +24,28 @@
        <include refid="Base_Column_List" />
        from yeshi_ec_log_user_active where lua_id = #{id,jdbcType=BIGINT}
    </select>
    <select id="selectLatestByUid" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_log_user_active where lua_uid = #{0} order by lua_id desc limit 1
        from yeshi_ec_log_user_active where lua_uid = #{0} order by lua_id
        desc limit 1
    </select>
    <select id="selectFirstActiveInfo" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_log_user_active where lua_uid = #{0} order by lua_id  limit 1
        from yeshi_ec_log_user_active where lua_uid = #{0} order by lua_id
        limit 1
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_log_user_active where lua_id = #{id,jdbcType=BIGINT}
    </delete>
        yeshi_ec_log_user_active where lua_id = #{id,jdbcType=BIGINT}</delete>
    <insert id="insert" parameterType="com.yeshi.fanli.entity.bus.user.UserActiveLog"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_log_user_active
        (lua_id,lua_uid,lua_ip,lua_channel,lua_version_code,lua_createtime,lua_updatetime,lua_device_type,lua_os_version)
        (lua_id,lua_uid,lua_ip,lua_channel,lua_version_code,lua_createtime,lua_updatetime,lua_device_type,lua_os_version,lua_device)
        values
        (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{ip,jdbcType=VARCHAR},#{channel,jdbcType=VARCHAR},#{versionCode,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{deviceType,jdbcType=VARCHAR},#{osVersion,jdbcType=VARCHAR})
        (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{ip,jdbcType=VARCHAR},#{channel,jdbcType=VARCHAR},#{versionCode,jdbcType=VARCHAR},#{createTime,jdbcType=TIMESTAMP},#{updateTime,jdbcType=TIMESTAMP},#{deviceType,jdbcType=VARCHAR},#{osVersion,jdbcType=VARCHAR},#{device,jdbcType=VARCHAR})
    </insert>
    <insert id="insertSelective" parameterType="com.yeshi.fanli.entity.bus.user.UserActiveLog"
        useGeneratedKeys="true" keyProperty="id">
@@ -63,6 +60,7 @@
            <if test="updateTime != null">lua_updatetime,</if>
            <if test="deviceType != null">lua_device_type,</if>
            <if test="osVersion != null">lua_os_version,</if>
            <if test="device != null">lua_device,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
@@ -75,6 +73,7 @@
            <if test="updateTime != null">#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="deviceType != null">#{deviceType,jdbcType=VARCHAR},</if>
            <if test="osVersion != null">#{osVersion,jdbcType=VARCHAR}</if>
            <if test="device != null">#{device,jdbcType=VARCHAR}</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey" parameterType="com.yeshi.fanli.entity.bus.user.UserActiveLog">update
@@ -85,8 +84,8 @@
        #{createTime,jdbcType=TIMESTAMP},lua_updatetime =
        #{updateTime,jdbcType=TIMESTAMP} ,lua_device_type
        =#{deviceType,jdbcType=VARCHAR} ,lua_os_version
        =#{osVersion,jdbcType=VARCHAR} where lua_id = #{id,jdbcType=BIGINT}
    </update>
        =#{osVersion,jdbcType=VARCHAR},lua_device
        =#{device,jdbcType=VARCHAR} where lua_id = #{id,jdbcType=BIGINT}</update>
    <update id="updateByPrimaryKeySelective" parameterType="com.yeshi.fanli.entity.bus.user.UserActiveLog">
        update yeshi_ec_log_user_active
        <set>
@@ -96,9 +95,9 @@
            <if test="versionCode != null">lua_version_code=#{versionCode,jdbcType=VARCHAR},</if>
            <if test="createTime != null">lua_createtime=#{createTime,jdbcType=TIMESTAMP},</if>
            <if test="updateTime != null">lua_updatetime=#{updateTime,jdbcType=TIMESTAMP},</if>
            <if test="id !=null">lua_id =#{id,jdbcType=BIGINT},</if>
            <if test="deviceType !=null">lua_device_type =#{deviceType,jdbcType=VARCHAR},</if>
            <if test="osVersion !=null">lua_os_version =#{osVersion,jdbcType=VARCHAR},</if>
            <if test="device !=null">lua_device =#{device,jdbcType=VARCHAR},</if>
        </set>
        where lua_id = #{id,jdbcType=BIGINT}
    </update>
fanli/src/main/java/com/yeshi/fanli/service/impl/ad/DouYinClickEventServiceImpl.java
@@ -7,6 +7,7 @@
import com.yeshi.fanli.dao.ad.DouYinClickEventDao;
import com.yeshi.fanli.entity.ad.DouYinClickEvent;
import com.yeshi.fanli.service.inter.ad.DouYinClickEventService;
import com.yeshi.fanli.util.cmq.DouYinDeviceActiveCMQManager;
@Service
public class DouYinClickEventServiceImpl implements DouYinClickEventService {
@@ -18,8 +19,20 @@
    public void save(DouYinClickEvent event) {
        // 查询
        DouYinClickEvent old = douYinClickEventDao.selectByAid(event.getAid());
        if (old == null)
        if (old == null) {
            douYinClickEventDao.save(event);
            DouYinDeviceActiveCMQManager.getInstance().addAdActive(event.getAid());
        }
    }
    @Override
    public DouYinClickEvent selectByAid(String aid) {
        return douYinClickEventDao.selectByAid(aid);
    }
    @Override
    public DouYinClickEvent selectByAndroidId(String androidId) {
        return douYinClickEventDao.selectByAndroidId(androidId);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/dynamic/DynamicInfoServiceImpl.java
@@ -148,7 +148,7 @@
            buffer.append("         ");
            buffer.append("早安~\n");
            buffer.append("我的邀请码:【邀请码】\n");
            buffer.append("购物省钱返利券App:【邀请链接】");
            buffer.append("购物省钱板栗快省App:【邀请链接】");
            content = content.replaceAll("\\,", "\\,").replaceAll("\\.", "\\。").replaceAll("\\;", "\\;")
                    .replaceAll("\\!", "\\!").replaceAll("\\?", "\\?").replaceAll("\\:", "\\:");
fanli/src/main/java/com/yeshi/fanli/service/impl/monitor/BusinessEmergent110ServiceImpl.java
@@ -51,7 +51,7 @@
            stList.add(identifyCode);
        if (stList.size() >= limitCount) {// 触发报警
            if ("1".equalsIgnoreCase(configService.get("can_send_emergency_msg")))
                EmergencyUtil.baoJin(key, "返利券【分享赚】", phones);
                EmergencyUtil.baoJin(key, "板栗快省【分享赚】", phones);
        }
    }
@@ -81,7 +81,7 @@
            stList.add(identifyCode);
        if (stList.size() >= limitCount) {// 触发报警
            if ("1".equalsIgnoreCase(configService.get("can_send_emergency_msg")))
                EmergencyUtil.baoJin(key, "返利券【领券返利】", phones);
                EmergencyUtil.baoJin(key, "板栗快省【领券返利】", phones);
        }
    }
fanli/src/main/java/com/yeshi/fanli/service/impl/msg/MsgConfigServiceImpl.java
@@ -54,7 +54,7 @@
            Config config = new Config();
            config.setCreatetime(System.currentTimeMillis() + "");
            config.setKey(KEY_ZHUSHOU);
            config.setName("消息-返利券小助手");
            config.setName("消息-板栗快省小助手");
            config.setValue(new Gson().toJson(dto));
            configService.save(config);
        }
fanli/src/main/java/com/yeshi/fanli/service/impl/order/OrderRepairServiceImpl.java
@@ -1318,7 +1318,7 @@
                // 加资金
                userMoneyService.addUserMoney(uid, money, detail);
                pushMsg(uid, "关于近期订单与资金异常的排查与修复结果通知",
                        "尊敬的用户,经仔细核对您账户中的订单,发现您账户中有未统计或错误统计的订单,我们已经为您补齐资金,对应资金已经存入您的账户余额中,敬请查收注查收。感谢信任,返利券App终将成为您最信任的购物省钱助手。");
                        "尊敬的用户,经仔细核对您账户中的订单,发现您账户中有未统计或错误统计的订单,我们已经为您补齐资金,对应资金已经存入您的账户余额中,敬请查收注查收。感谢信任,板栗快省App终将成为您最信任的购物省钱助手。");
                userMoneyMsgNotificationService.systemEqualize(uid, "订单统计异常修复", money, userInfoService.getBalance(uid));
            } catch (UserMoneyDetailException e) {
                e.printStackTrace();
@@ -1326,7 +1326,7 @@
        } else {// 资金需要减少,不要扣钱
            pushMsg(uid, "关于近期订单与资金异常的排查与修复结果通知",
                    "尊敬的用户,经仔细核对您账户中的订单,发现您账户中有错误统计的订单,我们已经为您恢复正常,所涉及订单多统计出来的资金,不会被扣除,即您账户中的资金将保持不变,已提现的资金,也不会收回,敬请知晓。感谢信任,返利券App终将成为您最信任的购物省钱助手。");
                    "尊敬的用户,经仔细核对您账户中的订单,发现您账户中有错误统计的订单,我们已经为您恢复正常,所涉及订单多统计出来的资金,不会被扣除,即您账户中的资金将保持不变,已提现的资金,也不会收回,敬请知晓。感谢信任,板栗快省App终将成为您最信任的购物省钱助手。");
            // userMoneyMsgNotificationService.systemEqualize(uid, "订单统计异常修复",
            // money, userInfoService.getBalance(uid));
            // 加入提现审核异常保护中
fanli/src/main/java/com/yeshi/fanli/service/impl/push/DeviceActiveServiceImpl.java
@@ -10,6 +10,7 @@
import com.yeshi.fanli.entity.push.DeviceActive;
import com.yeshi.fanli.service.inter.push.DeviceActiveService;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.cmq.DouYinDeviceActiveCMQManager;
@Service
public class DeviceActiveServiceImpl implements DeviceActiveService {
@@ -44,6 +45,8 @@
            }
            deviceActiveMapper.insertSelective(deviceActive);
            DouYinDeviceActiveCMQManager.getInstance().addDeviceActive(deviceActive.getDevice(),
                    deviceActive.getPlatform());
        } else {
            DeviceActive updateDeviceActive = new DeviceActive();
            updateDeviceActive.setId(da.getId());
fanli/src/main/java/com/yeshi/fanli/service/impl/user/TokenRecordServiceImpl.java
@@ -210,10 +210,10 @@
                UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
                if (userInfoExtra == null || StringUtil.isNullOrEmpty(userInfoExtra.getInviteCode())) {
                    tips.add("确认领取后,你将成为赠送者的一级队员;");
                    tips.add("返利券奖励券,可用于“已到账”的返利订单,在返利的基础上再获得一定比例的返利;");
                    tips.add("板栗快省奖励券,可用于“已到账”的返利订单,在返利的基础上再获得一定比例的返利;");
                    tips.add("成功领取后,请到“我的-福利中心”中查看。");
                } else {
                    tips.add("返利券奖励券,可用于“已到账”的返利订单,在返利的基础上再获得一定比例的返利;");
                    tips.add("板栗快省奖励券,可用于“已到账”的返利订单,在返利的基础上再获得一定比例的返利;");
                    tips.add("成功领取后,请到“我的-福利中心”中查看。");
                }
            } else {
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java
@@ -860,7 +860,7 @@
        String defaultNickName = Constant.systemCommonConfig.getDefaultNickName();
        if (!StringUtil.isNullOrEmpty(defaultNickName) && !StringUtil.isNullOrEmpty(weiXinUser.getNickname())) {
            defaultNickName = defaultNickName + uid;
            if ((defaultNickName.equals(user.getNickName()) || "返利券".equals(user.getNickName()))) {
            if ((defaultNickName.equals(user.getNickName()) || "板栗快省".equals(user.getNickName()))) {
                updateUserInfo.setNickName(weiXinUser.getNickname());
            }
        }
@@ -1254,7 +1254,7 @@
        String defaultNickName = Constant.systemCommonConfig.getDefaultNickName();
        if (!StringUtil.isNullOrEmpty(defaultNickName) && !StringUtil.isNullOrEmpty(weiXinUser.getNickname())) {
            defaultNickName = defaultNickName + uid;
            if ((defaultNickName.equals(user.getNickName()) || "返利券".equals(user.getNickName()))) {
            if ((defaultNickName.equals(user.getNickName()) || "板栗快省".equals(user.getNickName()))) {
                updateUserInfo.setNickName(weiXinUser.getNickname());
            }
        }
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserActiveLogServiceImpl.java
@@ -28,6 +28,17 @@
            userActiveLog.setCreateTime(new Date());
            userActiveLog.setUpdateTime(new Date());
            userActiveLogMapper.insertSelective(userActiveLog);
        } else if (latestLog != null) {
            // 如果设备 ,版本,渠道有变化则需要更改
            String oldIdentify = latestLog.getDevice() + "#" + latestLog.getVersionCode() + "#"
                    + latestLog.getChannel();
            String newIdentify = userActiveLog.getDevice() + "#" + userActiveLog.getVersionCode() + "#"
                    + userActiveLog.getChannel();
            if (!oldIdentify.equalsIgnoreCase(newIdentify)) {// 设备信息变化要记录信息
                userActiveLog.setCreateTime(new Date());
                userActiveLog.setUpdateTime(new Date());
                userActiveLogMapper.insertSelective(userActiveLog);
            }
        }
    }
@@ -38,13 +49,8 @@
    @Override
    public UserActiveLog getFirstActiveInfo(Long uid) {
        return userActiveLogMapper.selectFirstActiveInfo(uid);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoExtraServiceImpl.java
@@ -41,13 +41,12 @@
import com.yeshi.fanli.util.wx.WXLoginUtil;
import com.yeshi.fanli.vo.user.UserInfoExtraVO;
@Service
public class UserInfoExtraServiceImpl implements UserInfoExtraService {
    @Resource
    private UserInfoExtraMapper userInfoExtraMapper;
    @Resource
    private UserRankRecordMapper userRankRecordMapper;
@@ -59,22 +58,21 @@
    @Resource
    private ConfigService configService;
    @Resource
    private ThreeSaleSerivce threeSaleSerivce;
    @Resource
    private UserInfoService userInfoService;
    @Resource
    private UserAccountService userAccountService;
    @Resource
    private ForbiddenUserIdentifyCodeService forbiddenUserIdentifyCodeService;
    @Resource
    private UserInviteRecordService userInviteRecordService;
    @Override
    public UserInfoExtraVO getRankInfo(Long uid) throws UserInfoExtraException, Exception {
@@ -84,7 +82,7 @@
            throw new UserInfoExtraException(1, "用户附加信息不存在");
        }
        // 等级对照表
        // 等级对照表
        String contrast = configService.get("user_rank_contrast");
        extraVO.setRankContrast(contrast);
        // 特别提醒
@@ -92,11 +90,11 @@
        extraVO.setRankTip(rankTip);
        Integer rankOrderNum = extraVO.getRankOrderNum();
        UserRank userRank = extraVO.getUserRank();
        // 青铜等级不返回恭喜语句 注:青铜等级id 必须为1
        if (userRank != null && userRank.getId() != null && userRank.getId() > 1) {
            String rankMsg = null;
            Integer rankSource = extraVO.getRankSource();
            switch (rankSource) {
@@ -151,13 +149,13 @@
    }
    @Override
    public void updateUserRankByUid(Long uid) throws UserInfoExtraException{
    public void updateUserRankByUid(Long uid) throws UserInfoExtraException {
        if (uid == null || uid == 0) {
            return;
        }
        boolean isupdateRank = true;
        UserInfoExtra userInfoExtra = userInfoExtraMapper.getInfoExtraByUid(uid);
        if (userInfoExtra != null && userInfoExtra.getId() != null) {
            // 判断当月是否已更新
@@ -167,25 +165,25 @@
                if (sdf.format(rankUpdateTime).equals(sdf.format(new Date()))) {
                    isupdateRank = false;
                }
            }
            }
        } else {
            userInfoExtra = new UserInfoExtra();
            userInfoExtra.setUserInfo(new UserInfo(uid));
        }
        // 更新等级
        if (isupdateRank) {
            updateRank(userInfoExtra);
        }
    }
    @Override
    public void createUserInfoExtra (Long uid) throws UserInfoExtraException{
    public void createUserInfoExtra(Long uid) throws UserInfoExtraException {
        UserInfoExtra userInfoExtra = userInfoExtraMapper.getInfoExtraByUid(uid);
        if (userInfoExtra != null) {
            return;
        }
        }
        userInfoExtra = new UserInfoExtra();
        userInfoExtra.setUserInfo(new UserInfo(uid));
        userInfoExtra.setFirstLoginTime(new Date());
@@ -193,20 +191,19 @@
        userInfoExtra.setUpdateTime(new Date());
        userInfoExtraMapper.insertSelective(userInfoExtra);
    }
    @Override
    public UserInfoExtra updateRank(UserInfoExtra userInfoExtra) throws UserInfoExtraException {
        UserInfo userInfo = userInfoExtra.getUserInfo();
        if (userInfo == null ) {
        if (userInfo == null) {
            throw new UserInfoExtraException(1, "用户不存在");
        }
        Long uid = userInfo.getId();
        if (uid == null ) {
        if (uid == null) {
            throw new UserInfoExtraException(1, "用户ID不存在");
        }
        }
        List<UserRank> listRank = userRankService.getAllRank();
        if (listRank == null || listRank.size() == 0) {
            throw new UserInfoExtraException(1, "系统等级不存在");
@@ -259,7 +256,6 @@
                userInfoExtra.setRankSource(Constant.TYPE_REBATE);
            }
            if (rank != null) {
                userInfoExtra.setUserRank(rank);
            } else {
@@ -271,21 +267,21 @@
                break;
            }
        }
        // 等级更新时间 当月1号
        Calendar calendar1=Calendar.getInstance();
        calendar1.set(Calendar.DAY_OF_MONTH, 1);
        Calendar calendar1 = Calendar.getInstance();
        calendar1.set(Calendar.DAY_OF_MONTH, 1);
        userInfoExtra.setRankUpdateTime(calendar1.getTime());
        // 保存信息并返回
        saveUserInfoExtra(userInfoExtra);
        UserRankRecord userRankRecord = new UserRankRecord();
        userRankRecord.setUid(uid);
        userRankRecord.setRankId(rank.getId());
        userRankRecord.setCreateTime(new Date());
        userRankRecordMapper.insertSelective(userRankRecord);
        return userInfoExtra;
    }
@@ -321,19 +317,19 @@
        }
        return userInfoExtra;
    }
    @Override
    public String activateInviteCode(Long uid, String inviteCode) throws UserInfoExtraException{
    public String activateInviteCode(Long uid, String inviteCode) throws UserInfoExtraException {
        if (uid == null || inviteCode == null) {
            throw new UserInfoExtraException(1, "用户id、邀请码不能为空");
        }
        // 被邀请人信息
        UserInfo invitee = userInfoService.selectByPKey(uid);
        if (invitee == null) {
            throw new UserInfoExtraException(1, "用户不存在");
        }
        UserInfoExtra extra = userInfoExtraMapper.getInfoExtraByUid(uid);
        if (extra != null) {
            String inviteCodeHas = extra.getInviteCode();
@@ -341,13 +337,13 @@
                throw new UserInfoExtraException(1, "已存在邀请码,请刷新页面");
            }
        }
        // 邀请人信息
        UserInfo inviter = userInfoService.getInfoByPhoneOrInviteCode(inviteCode, inviteCode);
        if (inviter == null) {
            throw new UserInfoExtraException(1, "上级邀请码不存在");
        }
        // 绑定关系
        try {
            threeSaleSerivce.bindRelationshipByInviteCode(invitee, inviter);
@@ -359,43 +355,40 @@
            }
            throw new UserInfoExtraException(1, "激活失败");
        }
        // 邀请码有效、生成邀请码
        String code = UserUtil.getInviteCode(uid);
        String code = UserUtil.getInviteCode(uid);
        if (code == null || code.trim().length() == 0) {
            throw new UserInfoExtraException(1, "激活码生成失败");
        }
        UserInfoExtra userInfoExtra = new UserInfoExtra();
        userInfoExtra.setUserInfo(invitee);
        userInfoExtra.setInviteCode(code);
        // 保存额外信息
        saveUserInfoExtra(userInfoExtra);
        Long id = userInfoExtra.getId();
        if (id == null) {
            throw new UserInfoExtraException(1, "激活码生成失败");
        }
        return code;
    }
    @Override
    public void activationInviteWX(WXAccountInfoDTO wxAccount, Long uid, String code) throws UserInfoExtraException{
    public void activationInviteWX(WXAccountInfoDTO wxAccount, Long uid, String code) throws UserInfoExtraException {
        if (uid == null || code == null) {
            throw new UserInfoExtraException(1, "激活信息不完整");
        }
        // 用户信息
        UserInfo invitee = userInfoService.selectByPKey(uid);
        if (invitee == null) {
            throw new UserInfoExtraException(1, "用户不存在");
        }
        // 用户额外信息
        UserInfoExtra extra = userInfoExtraMapper.getInfoExtraByUid(uid);
        if (extra != null) {
@@ -404,9 +397,10 @@
                throw new UserInfoExtraException(1, "已经激活, 无需再次激活");
            }
        }
        // 获取微信信息
        WeiXinUser weiXinUser = WXLoginUtil.getWeiXinUserWithSavePortrait(code,wxAccount.getAppId(),wxAccount.getAppSecret());
        WeiXinUser weiXinUser = WXLoginUtil.getWeiXinUserWithSavePortrait(code, wxAccount.getAppId(),
                wxAccount.getAppSecret());
        if (weiXinUser == null) {
            throw new UserInfoExtraException(1, "微信授权失败");
        }
@@ -414,7 +408,7 @@
        if (wxUnionId == null || wxUnionId.trim().length() == 0) {
            throw new UserInfoExtraException(1, "微信授权失败");
        }
        // 验证数据
        String wxUnionIdExist = invitee.getWxUnionId();
        if (StringUtil.isNullOrEmpty(wxUnionIdExist)) {
@@ -422,46 +416,46 @@
            if (newUser != null) {
                throw new UserInfoExtraException(1, "此微信已被其他帐号绑定");
            }
            // 自动绑定微信
            UserInfo updateUserInfo = new UserInfo(uid);
            updateUserInfo.setWxOpenId(weiXinUser.getOpenid());
            updateUserInfo.setWxUnionId(weiXinUser.getUnionid());
            updateUserInfo.setWxName(weiXinUser.getNickname());
            updateUserInfo.setWxPic(weiXinUser.getHeadimgurl());
            // 将默认昵称替换成微信昵称
            String defaultNickName = Constant.systemCommonConfig.getDefaultNickName();
            if (!StringUtil.isNullOrEmpty(defaultNickName) && !StringUtil.isNullOrEmpty(weiXinUser.getNickname())) {
                defaultNickName = defaultNickName + uid;
                if ((defaultNickName.equals(invitee.getNickName()) || "返利券".equals(invitee.getNickName()))) {
                if ((defaultNickName.equals(invitee.getNickName()) || "返利券".equals(invitee.getNickName())
                        || invitee.getNickName().startsWith(Constant.systemCommonConfig.getDefaultNickName()))) {
                    updateUserInfo.setNickName(weiXinUser.getNickname());
                }
            }
            // 将默认头像替换成微信头像
            String defaultPortrait = Constant.systemCommonConfig.getDefaultPortrait();
            if (!StringUtil.isNullOrEmpty(weiXinUser.getHeadimgurl()) && !StringUtil.isNullOrEmpty(defaultPortrait)
                    && defaultPortrait.equals(invitee.getPortrait())) {
                updateUserInfo.setPortrait(weiXinUser.getHeadimgurl());
            }
            userInfoService.updateByPrimaryKeySelective(updateUserInfo);
        } else if (!wxUnionId.equals(wxUnionIdExist)){
        } else if (!wxUnionId.equals(wxUnionIdExist)) {
            throw new UserInfoExtraException(1, "绑定微信与激活微信不一致");
        }
        // 邀请人ID -1.5.3新版
        Long inviterId = userInviteRecordService.getNewestInviterId(wxUnionId);
        // 兼容1.5.3 之前版本
        ThreeSale threeSale = threeSaleSerivce.getByWorkerId(uid);
        if (inviterId == null && threeSale != null) {
            Long bossId = threeSale.getBoss().getId();
            UserInfoExtra inviterExtra = userInfoExtraMapper.getInfoExtraByUid(bossId);
            if (inviterExtra != null && inviterExtra.getInviteCode() == null ) {
            if (inviterExtra != null && inviterExtra.getInviteCode() == null) {
                // 更新邀请码
                UserInfoExtra inviterInfoExtra = new UserInfoExtra();
                inviterInfoExtra.setId(inviterExtra.getId());
@@ -469,12 +463,12 @@
                userInfoExtraMapper.updateByPrimaryKeySelective(inviterInfoExtra);
            }
        }
        // 没有被邀请过
        if (inviterId == null && threeSale == null) {
            throw new UserInfoExtraException(1, "没有对应的邀请关系");
        }
        // 绑定关系
        try {
            threeSaleSerivce.bindRelationshipByWX(invitee, inviterId, threeSale);
@@ -486,10 +480,9 @@
            }
            throw new UserInfoExtraException(1, "关系绑定时失败");
        }
        // 邀请码有效、生成邀请码
        String inviteCode = UserUtil.getInviteCode(uid);
        String inviteCode = UserUtil.getInviteCode(uid);
        if (inviteCode == null || inviteCode.trim().length() == 0) {
            throw new UserInfoExtraException(1, "激活码生成失败");
        }
@@ -506,41 +499,39 @@
            userInfoExtraMapper.insertSelective(userInfoExtra);
        }
    }
    @Override
    public UserInfoExtra getUserInfoExtra(Long uid) {
        return userInfoExtraMapper.getInfoExtraByUid(uid);
    }
    @Override
    public UserInfoExtraVO getInfoExtraVOByUid(Long uid) {
        return userInfoExtraMapper.getInfoExtraVOByUid(uid);
    }
    @Override
    public String getUserInviteCode(Long uid) throws UserInfoExtraException {
        UserInfoExtra userInfoExtra = userInfoExtraMapper.getInfoExtraByUid(uid);
        if (userInfoExtra == null) {
            userInfoExtra = new UserInfoExtra();
        }
        // 邀请码
        String inviteCode = userInfoExtra.getInviteCode();
        if (inviteCode == null || inviteCode.trim().length() == 0) {
            // 判断用户
            int relationshipNum = threeSaleSerivce.getSuccessRelationshipNum(uid);
            if (relationshipNum > 0) {
                // 邀请码有效、生成邀请码
                inviteCode = UserUtil.getInviteCode(uid);
                inviteCode = UserUtil.getInviteCode(uid);
                if (inviteCode == null || inviteCode.trim().length() == 0) {
                    throw new UserInfoExtraException(1, "激活码生成失败");
                }
                // 保存邀请码
                userInfoExtra.setUserInfo(new UserInfo(uid));
                userInfoExtra.setInviteCode(inviteCode);
@@ -548,22 +539,22 @@
                saveUserInfoExtra(userInfoExtra);
            }
        }
        return inviteCode;
    }
    @Override
    public long countByRankId(Long rankId) {
        return userInfoExtraMapper.countByRankId(rankId);
    }
    @Override
    public boolean isNewUser(Long uid) {
        boolean isNew = false;
        if (uid == null) {
            return isNew;
        }
        UserInfoExtra extra = userInfoExtraMapper.getInfoExtraByUid(uid);
        if (extra != null && extra.getFirstLoginTime() != null) {
            try {
@@ -577,25 +568,22 @@
        }
        return isNew;
    }
    @Override
    public UserRank gerUserRank(Long uid) {
        if(uid == null) {
        if (uid == null) {
            return null;
        }
        UserInfoExtra userInfoExtra = userInfoExtraMapper.gerUserRank(uid);
        if (userInfoExtra == null) {
            return null;
        }
        return userInfoExtra.getUserRank();
    }
    @Override
    public UserInfo getUserByInviteCode(String inviteCode) throws UserInfoExtraException{
    public UserInfo getUserByInviteCode(String inviteCode) throws UserInfoExtraException {
        if (StringUtil.isNullOrEmpty(inviteCode)) {
            throw new UserInfoExtraException(1, "邀请码不能为空");
        }
@@ -606,20 +594,19 @@
        }
        return inviter;
    }
    @Override
    public UserInfo getInviterInfo(WXAccountInfoDTO wxAccount,Long uid, String code) throws UserInfoExtraException{
    public UserInfo getInviterInfo(WXAccountInfoDTO wxAccount, Long uid, String code) throws UserInfoExtraException {
        if (code == null) {
            throw new UserInfoExtraException(1, "code信息不完整");
        }
        // 用户信息
        UserInfo invitee = userInfoService.selectByPKey(uid);
        if (invitee == null) {
            throw new UserInfoExtraException(1, "用户不存在");
        }
        // 用户额外信息
        UserInfoExtra extra = userInfoExtraMapper.getInfoExtraByUid(uid);
        if (extra != null) {
@@ -628,9 +615,9 @@
                throw new UserInfoExtraException(1, "已经激活, 无需再次激活");
            }
        }
        // 获取微信信息
        WeiXinUser weiXinUser = WXLoginUtil.getWeiXinUser(code,wxAccount.getAppId(),wxAccount.getAppSecret());
        WeiXinUser weiXinUser = WXLoginUtil.getWeiXinUser(code, wxAccount.getAppId(), wxAccount.getAppSecret());
        if (weiXinUser == null) {
            throw new UserInfoExtraException(1, "微信授权失败");
        }
@@ -638,7 +625,7 @@
        if (wxUnionId == null || wxUnionId.trim().length() == 0) {
            throw new UserInfoExtraException(1, "微信授权失败");
        }
        // 验证数据
        String wxUnionIdExist = invitee.getWxUnionId();
        if (StringUtil.isNullOrEmpty(wxUnionIdExist)) {
@@ -646,16 +633,16 @@
            if (newUser != null) {
                throw new UserInfoExtraException(1, "此微信已被其他帐号绑定");
            }
        } else if (!wxUnionId.equals(wxUnionIdExist)){
        } else if (!wxUnionId.equals(wxUnionIdExist)) {
            throw new UserInfoExtraException(1, "绑定微信与激活微信不一致");
        }
        // 邀请人ID
        Long inviterId = userInviteRecordService.getNewestInviterId(wxUnionId);
        if (inviterId == null) {
            throw new UserInfoExtraException(1, "没有对应的邀请关系");
        }
        UserInfo inviter = userInfoService.selectByPKey(inviterId);
        if (inviter == null) {
            throw new UserInfoExtraException(1, "对应的邀请关系不存在");
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserInfoModifyRecordServiceImpl.java
@@ -113,7 +113,7 @@
            addModifyRecord(uid, ModifyTypeEnum.bindWeiXin, user.getWxUnionId());
        }
        if (user.getNickName() != null && !user.getNickName().startsWith("返利券")) {
        if (user.getNickName() != null && !user.getNickName().startsWith("返利券")&&!user.getNickName().startsWith(Constant.systemCommonConfig.getDefaultNickName())) {
            addModifyRecord(uid, ModifyTypeEnum.nickName, user.getNickName() + "");
        }
fanli/src/main/java/com/yeshi/fanli/service/inter/ad/DouYinClickEventService.java
@@ -4,8 +4,26 @@
public interface DouYinClickEventService {
    /**
     * 缓存到数据库
     *
     * @param event
     */
    public void save(DouYinClickEvent event);
    /**
     * 根据广告ID查询
     *
     * @param aid
     * @return
     */
    public DouYinClickEvent selectByAid(String aid);
    /**
     * 根据androidID查询
     * @param androidId
     * @return
     */
    public DouYinClickEvent selectByAndroidId(String androidId);
}
fanli/src/main/java/com/yeshi/fanli/util/Constant.java
@@ -263,19 +263,17 @@
    }
    public static String getAppName(String platform, String version) {
        if (VersionUtil.greaterThan_2_0(platform, version))
            return Constant.systemCommonConfig.getProjectChineseName();
        else
            return "返利券";
        // if (VersionUtil.greaterThan_2_0(platform, version))
        return Constant.systemCommonConfig.getProjectChineseName();
        // else
        // return "返利券";
    }
    public static WXAccountInfoDTO getWXAccount(String platform, String version) {
//        if (VersionUtil.greaterThan_2_0(platform, version)) {
//            return new WXAccountInfoDTO("wxa99686bb65a9f466", "57390718ddedaa1591f6876cdcf96f43", "wx879fb78463222cd5",
//                    "2ad8ec333a9f96b13c5c5c1c2b13cd67");
//        } else {
            return new WXAccountInfoDTO("wx43617e2ed82c5b28", "f8a65908fb4681bdd181de70f6ab9a3b", "wx5c0d167c6e3ad726",
                    "0c79d5869bb0f2d7c13e43f9a18f440d");
//        }
        // return new WXAccountInfoDTO("wx43617e2ed82c5b28",
        // "f8a65908fb4681bdd181de70f6ab9a3b", "wx5c0d167c6e3ad726",
        // "0c79d5869bb0f2d7c13e43f9a18f440d");
        return new WXAccountInfoDTO("wxa99686bb65a9f466", "57390718ddedaa1591f6876cdcf96f43", "wx5c0d167c6e3ad726",
                "0c79d5869bb0f2d7c13e43f9a18f440d");
    }
}
fanli/src/main/java/com/yeshi/fanli/util/SpringContext.java
@@ -17,7 +17,9 @@
import org.yeshi.utils.tencentcloud.COSManager;
import org.yeshi.utils.tencentcloud.entity.COSInitParams;
import com.yeshi.fanli.dto.ad.DouYinDeviceActiveQueueDTO;
import com.yeshi.fanli.dto.money.UserMoneyChangeDTO;
import com.yeshi.fanli.entity.ad.DouYinClickEvent;
import com.yeshi.fanli.entity.bus.user.AlipayTransferResultInfo;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.bus.user.Order;
@@ -27,12 +29,14 @@
import com.yeshi.fanli.entity.order.CommonOrder;
import com.yeshi.fanli.entity.order.HongBaoOrder;
import com.yeshi.fanli.entity.pdd.PDDOrder;
import com.yeshi.fanli.entity.push.DeviceActive;
import com.yeshi.fanli.entity.push.PushQueueRecord;
import com.yeshi.fanli.entity.taobao.TaoBaoGoodsBrief;
import com.yeshi.fanli.entity.taobao.TaoBaoOrder;
import com.yeshi.fanli.entity.taobao.TaoBaoWeiQuanOrder;
import com.yeshi.fanli.exception.order.TaoBaoWeiQuanException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.ad.DouYinClickEventService;
import com.yeshi.fanli.service.inter.lable.BoutiqueAutoRuleService;
import com.yeshi.fanli.service.inter.lable.LabelService;
import com.yeshi.fanli.service.inter.money.UserMoneyDebtService;
@@ -44,6 +48,7 @@
import com.yeshi.fanli.service.inter.order.jd.JDOrderService;
import com.yeshi.fanli.service.inter.order.pdd.PDDOrderService;
import com.yeshi.fanli.service.inter.order.tb.TaoBaoOrderService;
import com.yeshi.fanli.service.inter.push.DeviceActiveService;
import com.yeshi.fanli.service.inter.push.IOSPushService;
import com.yeshi.fanli.service.inter.taobao.TaoBaoGoodsUpdateService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
@@ -51,6 +56,8 @@
import com.yeshi.fanli.service.inter.user.integral.IntegralGetService;
import com.yeshi.fanli.service.inter.user.integral.IntegralTaskRecordService;
import com.yeshi.fanli.service.inter.user.invite.ThreeSaleSerivce;
import com.yeshi.fanli.util.ad.DouYinAdUtil;
import com.yeshi.fanli.util.cmq.DouYinDeviceActiveCMQManager;
import com.yeshi.fanli.util.cmq.HongBaoRecieveCMQManager;
import com.yeshi.fanli.util.cmq.JDOrderCMQManager;
import com.yeshi.fanli.util.cmq.PDDOrderCMQManager;
@@ -128,6 +135,9 @@
    @Resource
    private IntegralTaskRecordService integralTaskRecordService;
    @Resource
    private DeviceActiveService deviceActiveService;
    private static boolean isInited = false;
    public void onApplicationEvent(ContextRefreshedEvent arg0) {
@@ -164,6 +174,7 @@
            doImportantTaoBaoGoodsUpdateJob();// 淘宝重要商品的信息更新
            doHongBaoRecieveIntegralGetJob();// 返利到账,金币增加
            doPlaceOrderIntegralJob();// 下单赠送金币任务
            doDouYinDeviceActiveJob();// 抖音设备激活广告监测
        }
    }
@@ -893,4 +904,56 @@
        });
    }
    @Resource
    private DouYinClickEventService douYinClickEventService;
    // 抖音
    public void doDouYinDeviceActiveJob() {
        executor.execute(new Runnable() {
            @Override
            public void run() {
                while (true) {
                    Map<String, DouYinDeviceActiveQueueDTO> map = DouYinDeviceActiveCMQManager.getInstance()
                            .consume(16);
                    if (map != null) {
                        // 是否是首单
                        for (Iterator<String> its = map.keySet().iterator(); its.hasNext();) {
                            String key = its.next();
                            DouYinDeviceActiveQueueDTO active = map.get(key);
                            if (active.getType() == DouYinDeviceActiveQueueDTO.TYPE_AD) {// 抖音
                                DeviceActive deviceActive = deviceActiveService.getFirstActiveInfo(active.getDevice());
                                if (deviceActive != null) {
                                    DouYinClickEvent event = douYinClickEventService.selectByAid(active.getAid());
                                    if (event != null) {
                                        if (event.getOs() == 0)
                                            DouYinAdUtil.activeAndroid(event.getCallback(), event.getImei(),
                                                    deviceActive.getCreateTime().getTime());
                                        else if (event.getOs() == 1)
                                            DouYinAdUtil.activeIOS(event.getCallback(), event.getIdfa(),
                                                    deviceActive.getCreateTime().getTime());
                                    }
                                }
                            } else if (active.getType() == DouYinDeviceActiveQueueDTO.TYPE_DEVICE) {// 设备
                                // TODO 兼容IOS
                                if (active.getPlatform() == 1) {
                                    DouYinClickEvent event = douYinClickEventService
                                            .selectByAndroidId(active.getDevice());
                                    if (event != null) {// 回调
                                        DeviceActive deviceActive = deviceActiveService
                                                .getFirstActiveInfo(active.getDevice());
                                        if (deviceActive != null)
                                            DouYinAdUtil.activeAndroid(event.getCallback(), event.getImei(),
                                                    deviceActive.getCreateTime().getTime());
                                    }
                                }
                            }
                        }
                    }
                }
            }
        });
    }
}
fanli/src/main/java/com/yeshi/fanli/util/ad/DouYinAdUtil.java
@@ -7,14 +7,14 @@
import org.yeshi.utils.HttpUtil;
import org.yeshi.utils.StringUtil;
import com.yeshi.fanli.dto.ad.DouYinUserActionInfo;
import com.yeshi.fanli.dto.ad.DouYinUserActionInfoDTO;
public class DouYinAdUtil {
    public final static String SIGN_KEY = "tdqaWqs-Xkkxe-nea-UDsPtnorzpARzgB";
    public final static String SIGN_KEY = "TuXUwRE-aosga-mno-LTxzgvSbhrkUKbK";
    // 上传用户行为
    private static void postUserAction(DouYinUserActionInfo info, String signKey) {
    private static void postUserAction(DouYinUserActionInfoDTO info, String signKey) {
        String url = "http://ad.toutiao.com/track/activate/";
        Map<String, String> map = new HashMap<>();
        map.put("callback", info.getCallback());
@@ -46,16 +46,16 @@
     * @param callBack
     */
    public static void activeAndroid(String callBack, String imei, Long convTime) {
        DouYinUserActionInfo info = new DouYinUserActionInfo(callBack, StringUtil.Md5(imei), 0,
        DouYinUserActionInfoDTO info = new DouYinUserActionInfoDTO(callBack, StringUtil.Md5(imei), 0,
                convTime == null ? System.currentTimeMillis() / 1000 : convTime / 1000,
                DouYinUserActionInfo.EVENT_TYPE_ACTIVE);
                DouYinUserActionInfoDTO.EVENT_TYPE_ACTIVE);
        postUserAction(info, SIGN_KEY);
    }
    public static void activeIOS(String callBack, String idfa, Long convTime) {
        DouYinUserActionInfo info = new DouYinUserActionInfo(callBack, idfa, 1,
        DouYinUserActionInfoDTO info = new DouYinUserActionInfoDTO(callBack, idfa, 1,
                convTime == null ? System.currentTimeMillis() / 1000 : convTime / 1000,
                DouYinUserActionInfo.EVENT_TYPE_ACTIVE);
                DouYinUserActionInfoDTO.EVENT_TYPE_ACTIVE);
        postUserAction(info, SIGN_KEY);
    }
@@ -63,16 +63,16 @@
     * 注册
     */
    public static void registerAndroid(String callBack, String imei, Long convTime) {
        DouYinUserActionInfo info = new DouYinUserActionInfo(callBack, StringUtil.Md5(imei), 0,
        DouYinUserActionInfoDTO info = new DouYinUserActionInfoDTO(callBack, StringUtil.Md5(imei), 0,
                convTime == null ? System.currentTimeMillis() / 1000 : convTime / 1000,
                DouYinUserActionInfo.EVENT_TYPE_REGISTER);
                DouYinUserActionInfoDTO.EVENT_TYPE_REGISTER);
        postUserAction(info, SIGN_KEY);
    }
    public static void registerIOS(String callBack, String idfa, Long convTime) {
        DouYinUserActionInfo info = new DouYinUserActionInfo(callBack, idfa, 1,
        DouYinUserActionInfoDTO info = new DouYinUserActionInfoDTO(callBack, idfa, 1,
                convTime == null ? System.currentTimeMillis() / 1000 : convTime / 1000,
                DouYinUserActionInfo.EVENT_TYPE_REGISTER);
                DouYinUserActionInfoDTO.EVENT_TYPE_REGISTER);
        postUserAction(info, SIGN_KEY);
    }
@@ -81,16 +81,16 @@
     */
    public static void validOrderAndroid(String callBack, String imei, Long convTime) {
        DouYinUserActionInfo info = new DouYinUserActionInfo(callBack, StringUtil.Md5(imei), 0,
        DouYinUserActionInfoDTO info = new DouYinUserActionInfoDTO(callBack, StringUtil.Md5(imei), 0,
                convTime == null ? System.currentTimeMillis() / 1000 : convTime / 1000,
                DouYinUserActionInfo.EVENT_TYPE_ORDER);
                DouYinUserActionInfoDTO.EVENT_TYPE_ORDER);
        postUserAction(info, SIGN_KEY);
    }
    public static void validOrderIOS(String callBack, String idfa, Long convTime) {
        DouYinUserActionInfo info = new DouYinUserActionInfo(callBack, idfa, 1,
        DouYinUserActionInfoDTO info = new DouYinUserActionInfoDTO(callBack, idfa, 1,
                convTime == null ? System.currentTimeMillis() / 1000 : convTime / 1000,
                DouYinUserActionInfo.EVENT_TYPE_ORDER);
                DouYinUserActionInfoDTO.EVENT_TYPE_ORDER);
        postUserAction(info, SIGN_KEY);
    }
@@ -99,16 +99,16 @@
     */
    public static void retainedAndroid(String callBack, String imei, Long convTime) {
        DouYinUserActionInfo info = new DouYinUserActionInfo(callBack, StringUtil.Md5(imei), 0,
        DouYinUserActionInfoDTO info = new DouYinUserActionInfoDTO(callBack, StringUtil.Md5(imei), 0,
                convTime == null ? System.currentTimeMillis() / 1000 : convTime / 1000,
                DouYinUserActionInfo.EVENT_TYPE_CILIU);
                DouYinUserActionInfoDTO.EVENT_TYPE_CILIU);
        postUserAction(info, SIGN_KEY);
    }
    public static void retainedIOS(String callBack, String idfa, Long convTime) {
        DouYinUserActionInfo info = new DouYinUserActionInfo(callBack, idfa, 1,
        DouYinUserActionInfoDTO info = new DouYinUserActionInfoDTO(callBack, idfa, 1,
                convTime == null ? System.currentTimeMillis() / 1000 : convTime / 1000,
                DouYinUserActionInfo.EVENT_TYPE_CILIU);
                DouYinUserActionInfoDTO.EVENT_TYPE_CILIU);
        postUserAction(info, SIGN_KEY);
    }
fanli/src/main/java/com/yeshi/fanli/util/cmq/DouYinDeviceActiveCMQManager.java
New file
@@ -0,0 +1,66 @@
package com.yeshi.fanli.util.cmq;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.yeshi.utils.CMQUtil;
import com.google.gson.Gson;
import com.qcloud.cmq.Message;
import com.yeshi.fanli.dto.ad.DouYinDeviceActiveQueueDTO;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
public class DouYinDeviceActiveCMQManager {
    private static String secretId = "AKIDTlpgJhLjOozvd6QI2XnpfGbgV4NQJk25";
    private static String secretKey = "xhCSUHo55oHUQ6XicFcmfIgspX0EEzWo";
    private static DouYinDeviceActiveCMQManager jdOrderCMQManager;
    private static CMQUtil cmqUtil;
    public static String DOUYIN_DEVICE_ACTIVE = "douyin-device-active";
    static {
        cmqUtil = CMQUtil.getInstance(secretId, secretKey);
        DOUYIN_DEVICE_ACTIVE += "-" + Constant.systemCommonConfig.getProjectName();
        cmqUtil.createQueue(DOUYIN_DEVICE_ACTIVE);
    }
    public static DouYinDeviceActiveCMQManager getInstance() {
        if (jdOrderCMQManager == null)
            jdOrderCMQManager = new DouYinDeviceActiveCMQManager();
        return jdOrderCMQManager;
    }
    public void addDeviceActive(String device, int platform) {
        if (StringUtil.isNullOrEmpty(device) || platform == 0)
            return;
        DouYinDeviceActiveQueueDTO dto = new DouYinDeviceActiveQueueDTO(DouYinDeviceActiveQueueDTO.TYPE_DEVICE, device,
                platform);
        cmqUtil.sendMsg(DOUYIN_DEVICE_ACTIVE, new Gson().toJson(dto));
    }
    public void addAdActive(String aid) {
        if (StringUtil.isNullOrEmpty(aid))
            return;
        DouYinDeviceActiveQueueDTO dto = new DouYinDeviceActiveQueueDTO(DouYinDeviceActiveQueueDTO.TYPE_AD, aid);
        cmqUtil.sendMsg(DOUYIN_DEVICE_ACTIVE, new Gson().toJson(dto));
    }
    public Map<String, DouYinDeviceActiveQueueDTO> consume(int count) {
        List<Message> list = cmqUtil.recieveMsg(count, DOUYIN_DEVICE_ACTIVE);
        Map<String, DouYinDeviceActiveQueueDTO> map = new HashMap<>();
        if (list != null)
            for (Message msg : list) {
                String result = msg.msgBody;
                map.put(msg.receiptHandle, new Gson().fromJson(result, DouYinDeviceActiveQueueDTO.class));
            }
        return map;
    }
    public void delete(String receiptHandle) {
        cmqUtil.deleteMsg(DOUYIN_DEVICE_ACTIVE, receiptHandle);
    }
}