admin
2019-04-12 8eacbd15374d01296926e87be3125731521000ee
手机号修改7天内禁止事件添加
7个文件已修改
5个文件已添加
606 ■■■■ 已修改文件
fanli/src/main/java/com/yeshi/fanli/controller/client/ShareController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/UserAccountController.java 61 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java 55 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserAccountBindingHistoryMapper.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserAccountBindingHistory.java 79 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserAccountBindingHistoryMapper.xml 91 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/BindingAccountServiceImpl.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/ExtractServiceImpl.java 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountBindingHistoryServiceImpl.java 33 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java 115 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserExtraTaoBaoInfoServiceImpl.java 93 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserAccountBindingHistoryService.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
fanli/src/main/java/com/yeshi/fanli/controller/client/ShareController.java
@@ -499,7 +499,8 @@
     * @param out
     */
    @RequestMapping(value = "resetShareTextTemplate", method = RequestMethod.POST)
    public void resetShareTextTemplate(AcceptData acceptData, Long uid, Boolean hasCoupon, PrintWriter out) {
    public void resetShareTextTemplate(AcceptData acceptData, Long uid, Long goodsId, Boolean hasCoupon,
            PrintWriter out) {
        if (uid == null) {
            out.print(JsonUtil.loadFalseResult(1, "用户未登录"));
            return;
@@ -510,6 +511,11 @@
            shareGoodsTextTemplateService.resetCommonTemplate(uid);
        }
        if (goodsId != null) {
            preViewShareTextTemplate(acceptData, uid, null, goodsId, hasCoupon, out);
            return;
        }
        out.print(JsonUtil.loadTrueResult(""));
    }
fanli/src/main/java/com/yeshi/fanli/controller/client/UserAccountController.java
@@ -20,6 +20,7 @@
import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
import com.yeshi.fanli.entity.bus.user.LoginResult;
import com.yeshi.fanli.entity.bus.user.SMSHistory;
import com.yeshi.fanli.entity.bus.user.UserAccountBindingHistory;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.WeiXinUser;
import com.yeshi.fanli.entity.system.BusinessSystem;
@@ -46,6 +47,7 @@
import com.yeshi.fanli.service.inter.user.ShamUserService;
import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
import com.yeshi.fanli.service.inter.user.TBPidService;
import com.yeshi.fanli.service.inter.user.UserAccountBindingHistoryService;
import com.yeshi.fanli.service.inter.user.UserAccountService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.UserMoneyService;
@@ -133,7 +135,9 @@
    @Resource
    private UserMoneyService userMoneyService;
    @Resource
    private UserAccountBindingHistoryService userAccountBindingHistoryService;
    private static final String PASSWORD_MAX_ERROR = "password_max_error";
    private static final String EXTRACT_MIN_MONEY = "extract_min_money";
@@ -912,6 +916,8 @@
        }
        redisManager.cacheCommonString(key, "1", 120);
        // 支付宝绑定
        ForbiddenUserIdentifyCode ic = forbiddenUserIdentifyCodeService
                .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.alipayAccount, account);
@@ -1106,23 +1112,23 @@
            deviceTokenHWService.unBindDeviceToken(acceptData.getDevice());
        out.print(JsonUtil.loadTrueResult(""));
    }
    /**
     *   新版登录  V1.5.3
     * 新版登录 V1.5.3
     *
     * @param acceptData
     * @param vcode
     * @param phone
     * @param code
     * @param loginType 登录方式:  1-手机登录   2-微信登录
     * @param loginType
     *            登录方式: 1-手机登录 2-微信登录
     * @param request
     * @param out
     */
    @RequestMapping(value = "loginNew", method = RequestMethod.POST)
    public void loginNew(AcceptData acceptData, String vcode, String phone, String code,
            int loginType, HttpServletRequest request, PrintWriter out) {
    public void loginNew(AcceptData acceptData, String vcode, String phone, String code, int loginType,
            HttpServletRequest request, PrintWriter out) {
        try {
            BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
                    acceptData.getPackages());
@@ -1130,30 +1136,30 @@
                out.print(JsonUtil.loadFalseResult("系统不存在"));
                return;
            }
            UserInfo userInfo = null;
            // 手机登录
            if (loginType == 1) {
                userInfo = userAccountService.loginPhone(request, loginType, vcode, phone, system.getAppid());
            }
            // 微信登录
            if (loginType == 2) {
                userInfo = userAccountService.loginWinXin(request,loginType, code, system.getAppid());
                userInfo = userAccountService.loginWinXin(request, loginType, code, system.getAppid());
            }
            if (userInfo == null) {
                out.print(JsonUtil.loadFalseResult("登录失败"));
            } else {
                JSONObject data = new JSONObject();
                data.put("userInfo", UserUtil.filterForClientUser(userInfo));
                out.print(JsonUtil.loadTrueResult(data));
                final UserInfo uuser = userInfo;
                ThreadUtil.run(new Runnable() {
                    public void run() {
                        try {
                            /* 同步未登录之前设备抽奖数据  */
                            /* 同步未登录之前设备抽奖数据 */
                            int platformType = 0;
                            String platform = acceptData.getPlatform();
                            if ("android".equals(platform)) {
@@ -1161,14 +1167,15 @@
                            } else if ("ios".equals(platform)) {
                                platformType = 2;
                            }
                            userSystemCouponService.copyLotteryPrize(uuser.getId(), platformType, acceptData.getDevice());
                            userSystemCouponService.copyLotteryPrize(uuser.getId(), platformType,
                                    acceptData.getDevice());
                        } catch (Exception e) {
                            e.printStackTrace();
                        }
                    }
                });
            }
        } catch (UserAccountException e) {
            out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
            try {
@@ -1185,11 +1192,9 @@
            }
        }
    }
    /**
     *   绑定电话号码  V1.5.3
     * 绑定电话号码 V1.5.3
     * 
     * @param acceptData
     * @param vcode
@@ -1198,7 +1203,7 @@
     */
    @RequestMapping(value = "bindPhoneNew")
    public void bindPhoneNew(AcceptData acceptData, Long uid, String vcode, String phone, PrintWriter out) {
        BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
                acceptData.getPackages());
        if (system == null) {
@@ -1217,7 +1222,7 @@
        }
        phone = phone.replaceAll(" ", "");
        String oldVCode = redisManager.getSMSVCode(phone, SMSHistory.TYPE_BIND);
        if (Constant.IS_OUTNET) {
            if (!vcode.equalsIgnoreCase(oldVCode)) {
@@ -1226,12 +1231,11 @@
            }
            redisManager.clearSMSFrequencyLimit(phone, SMSHistory.TYPE_BIND);
        }
        try {
            // 绑定用户
            userAccountService.bindPhoneNew(uid, phone);
            UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
            // 判断电话号码是否已经封禁
            ForbiddenUserIdentifyCode ic = forbiddenUserIdentifyCodeService
@@ -1259,8 +1263,7 @@
            out.print(JsonUtil.loadFalseResult(1, "绑定失败"));
        }
    }
    /**
     * 更改微信
     * 
@@ -1273,7 +1276,7 @@
    public void bindWeiXin(AcceptData acceptData, Long uid, String code, PrintWriter out) {
        BusinessSystem system = businessSystemService.getBusinessSystemCache(acceptData.getPlatform(),
                acceptData.getPackages());
        if (system == null) {
            out.print(JsonUtil.loadFalseResult("系统不存在"));
            return;
@@ -1286,7 +1289,7 @@
        try {
            userAccountService.bindWeiXin(uid, code);
            UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
            // 判断taoBaoUid是否已经封禁
            ForbiddenUserIdentifyCode ic = forbiddenUserIdentifyCodeService
fanli/src/main/java/com/yeshi/fanli/controller/client/UserInfoController.java
@@ -202,7 +202,6 @@
    @Resource
    private AccountMessageService accountMessageService;
    private static final String PASSWORD_MAX_ERROR = "password_max_error";
    private static final String EXTRACT_MIN_MONEY = "extract_min_money";
@@ -519,7 +518,6 @@
                }
            }
        }
        GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
@@ -578,12 +576,12 @@
        int welfareCenterNews = 0;
        String invitCode = null;
        UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(user.getId());
        if (userInfoExtra != null  ) {
            if(userInfoExtra.getCouponNews() != null) {
        if (userInfoExtra != null) {
            if (userInfoExtra.getCouponNews() != null) {
                welfareCenterNews = userInfoExtra.getCouponNews();
            }
            if(userInfoExtra.getInviteCode() != null && userInfoExtra.getInviteCode().trim().length() > 0) {
            if (userInfoExtra.getInviteCode() != null && userInfoExtra.getInviteCode().trim().length() > 0) {
                invitCode = userInfoExtra.getInviteCode();
            }
        }
@@ -1053,7 +1051,6 @@
        return;
    }
    /**
     * 新版提现
     * 
@@ -1175,6 +1172,8 @@
            out.print(JsonUtil.loadFalseResult("已超过当日提现金额"));
        } else if (etype == 3) {
            out.print(JsonUtil.loadFalseResult("提现金额大于我的红包"));
        } else if (etype == 111) {
            out.print(JsonUtil.loadFalseResult("更换了手机号后7天内不允许提现"));
        }
    }
@@ -1651,7 +1650,6 @@
    }
    /**
     * 用户队员列表查询 1.5.3查询有效队员
     * 
@@ -1723,9 +1721,7 @@
            e.printStackTrace();
        }
    }
    /**
     * 用户队员统计 1.4.1
     * 
@@ -1997,7 +1993,7 @@
            e.printStackTrace();
        }
    }
    /**
     * 获取用户信息
     * 
@@ -2015,14 +2011,14 @@
                out.print(JsonUtil.loadFalseResult("系统不存在"));
                return;
            }
            if (uid == null) {
                out.print(JsonUtil.loadFalseResult("请求参数为空"));
                return;
            }
            UserInfo userInfo = userInfoService.getUserInfo(uid);
            // 添加用户活跃记录
            UserActiveLog userActiveLog = new UserActiveLog();
            userActiveLog.setChannel(acceptData.getChannel());
@@ -2032,14 +2028,14 @@
            userActiveLog.setOsVersion(acceptData.getOsVersion());
            userActiveLog.setDeviceType(acceptData.getDeviceType());
            userActiveLogService.addUserActiveLog(userActiveLog);
            // 处理用户信息
            outUserInfoHandle(userInfo);
            GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
            JSONObject data = new JSONObject();
            data.put("user", JsonUtil.getConvertBigDecimalToStringBuilder(gsonBuilder).create().toJson(userInfo));
            // 界面状态
            UserSettingsVO mySettings = null;
            try {
@@ -2066,19 +2062,18 @@
            }
            data.put("moduleState", mySettings);
            int welfareCenterNews = 0;
            String invitCode = null;
            UserInfoExtra userInfoExtra = userInfoExtraService.getUserInfoExtra(uid);
            if (userInfoExtra != null  ) {
                if(userInfoExtra.getCouponNews() != null) {
            if (userInfoExtra != null) {
                if (userInfoExtra.getCouponNews() != null) {
                    welfareCenterNews = userInfoExtra.getCouponNews();
                }
                if(userInfoExtra.getInviteCode() != null && userInfoExtra.getInviteCode().trim().length() > 0) {
                if (userInfoExtra.getInviteCode() != null && userInfoExtra.getInviteCode().trim().length() > 0) {
                    invitCode = userInfoExtra.getInviteCode();
                }
                if (userInfoExtra.getUserRank() != null) {
                    String picture = userInfoExtra.getUserRank().getPicture();
                    String icon = userInfoExtra.getUserRank().getIcon();
@@ -2089,7 +2084,7 @@
                    userInfo.setRankIcon(null);
                }
            }
            data.put("invitCode", invitCode); // 邀请码
            data.put("welfareCenterNews", welfareCenterNews);// 福利中心消息
            out.print(JsonUtil.loadTrueResult(data));
@@ -2112,7 +2107,7 @@
                    }
                }
            });
        } catch (UserInfoException e) {
            out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
        } catch (Exception e) {
@@ -2120,9 +2115,9 @@
            e.printStackTrace();
        }
    }
    private void outUserInfoHandle(UserInfo user) {
        // 红包处理
        user.setTotalHongBao(new BigDecimal(0));
        user.setNoOpenHongBao(new BigDecimal(0));
@@ -2137,7 +2132,7 @@
                user.setPhone(phone);
            }
        }
        UserInfoExtraVO userInfoExtra = userInfoExtraService.getInfoExtraVOByUid(user.getId());
        if (userInfoExtra != null && userInfoExtra.getUserRank() != null) {
            String picture = userInfoExtra.getUserRank().getPicture();
@@ -2146,5 +2141,5 @@
            user.setRankIcon(icon);
        }
    }
}
fanli/src/main/java/com/yeshi/fanli/dao/mybatis/user/UserAccountBindingHistoryMapper.java
New file
@@ -0,0 +1,19 @@
package com.yeshi.fanli.dao.mybatis.user;
import org.apache.ibatis.annotations.Param;
import com.yeshi.fanli.dao.BaseMapper;
import com.yeshi.fanli.entity.bus.user.UserAccountBindingHistory;
public interface UserAccountBindingHistoryMapper extends BaseMapper<UserAccountBindingHistory> {
    /**
     * 获取最近一次的绑定记录
     *
     * @param uid
     * @param type
     * @return
     */
    UserAccountBindingHistory selectLatestByTypeAndUid(@Param("uid") Long uid, @Param("type") int type);
}
fanli/src/main/java/com/yeshi/fanli/entity/bus/user/UserAccountBindingHistory.java
New file
@@ -0,0 +1,79 @@
package com.yeshi.fanli.entity.bus.user;
import java.util.Date;
import org.yeshi.utils.mybatis.Column;
import org.yeshi.utils.mybatis.Table;
/**
 * 用户账户绑定记录
 *
 * @author Administrator
 *
 */
@Table("yeshi_ec_user_account_bind_history")
public class UserAccountBindingHistory {
    public final static int TYPE_WX = 1;
    public final static int TYPE_TB = 2;
    public final static int TYPE_PHONE = 3;
    @Column(name = "uabh_id")
    private Long id;
    @Column(name = "uabh_uid")
    private Long uid;
    @Column(name = "uabh_type")
    private Integer type;
    @Column(name = "uabh_content")
    private String content;
    @Column(name = "uabh_first")
    private Boolean first;
    @Column(name = "uabh_create_time")
    private Date createTime;
    public Long getId() {
        return id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    public Long getUid() {
        return uid;
    }
    public void setUid(Long uid) {
        this.uid = uid;
    }
    public Integer getType() {
        return type;
    }
    public void setType(Integer type) {
        this.type = type;
    }
    public String getContent() {
        return content;
    }
    public void setContent(String content) {
        this.content = content;
    }
    public Boolean getFirst() {
        return first;
    }
    public void setFirst(Boolean first) {
        this.first = first;
    }
    public Date getCreateTime() {
        return createTime;
    }
    public void setCreateTime(Date createTime) {
        this.createTime = createTime;
    }
}
fanli/src/main/java/com/yeshi/fanli/mapping/user/UserAccountBindingHistoryMapper.xml
New file
@@ -0,0 +1,91 @@
<?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.user.UserAccountBindingHistoryMapper">
    <resultMap id="BaseResultMap"
        type="com.yeshi.fanli.entity.bus.user.UserAccountBindingHistory">
        <id column="uabh_id" property="id" jdbcType="BIGINT" />
        <result column="uabh_uid" property="uid" jdbcType="BIGINT" />
        <result column="uabh_type" property="type" jdbcType="INTEGER" />
        <result column="uabh_content" property="content" jdbcType="VARCHAR" />
        <result column="uabh_first" property="first" jdbcType="BOOLEAN" />
        <result column="uabh_create_time" property="createTime"
            jdbcType="TIMESTAMP" />
    </resultMap>
    <sql id="Base_Column_List">uabh_id,uabh_uid,uabh_type,uabh_content,uabh_first,uabh_create_time
    </sql>
    <select id="selectByPrimaryKey" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user_account_bind_history where uabh_id =
        #{id,jdbcType=BIGINT}
    </select>
    <select id="selectLatestByTypeAndUid" resultMap="BaseResultMap"
        parameterType="java.lang.Long">
        select
        <include refid="Base_Column_List" />
        from yeshi_ec_user_account_bind_history where uabh_uid =#{uid} and
        uabh_type=#{type} order by uabh_create_time desc limit 1
    </select>
    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">delete from
        yeshi_ec_user_account_bind_history where uabh_id =
        #{id,jdbcType=BIGINT}
    </delete>
    <insert id="insert"
        parameterType="com.yeshi.fanli.entity.bus.user.UserAccountBindingHistory"
        useGeneratedKeys="true" keyProperty="id">insert into
        yeshi_ec_user_account_bind_history
        (uabh_id,uabh_uid,uabh_type,uabh_content,uabh_first,uabh_create_time)
        values
        (#{id,jdbcType=BIGINT},#{uid,jdbcType=BIGINT},#{type,jdbcType=INTEGER},#{content,jdbcType=VARCHAR},#{first,jdbcType=BOOLEAN},#{createTime,jdbcType=TIMESTAMP})
    </insert>
    <insert id="insertSelective"
        parameterType="com.yeshi.fanli.entity.bus.user.UserAccountBindingHistory"
        useGeneratedKeys="true" keyProperty="id">
        insert into yeshi_ec_user_account_bind_history
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">uabh_id,</if>
            <if test="uid != null">uabh_uid,</if>
            <if test="type != null">uabh_type,</if>
            <if test="content != null">uabh_content,</if>
            <if test="first != null">uabh_first,</if>
            <if test="createTime != null">uabh_create_time,</if>
        </trim>
        values
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id,jdbcType=BIGINT},</if>
            <if test="uid != null">#{uid,jdbcType=BIGINT},</if>
            <if test="type != null">#{type,jdbcType=INTEGER},</if>
            <if test="content != null">#{content,jdbcType=VARCHAR},</if>
            <if test="first != null">#{first,jdbcType=BOOLEAN},</if>
            <if test="createTime != null">#{createTime,jdbcType=TIMESTAMP},</if>
        </trim>
    </insert>
    <update id="updateByPrimaryKey"
        parameterType="com.yeshi.fanli.entity.bus.user.UserAccountBindingHistory">update yeshi_ec_user_account_bind_history set uabh_uid =
        #{uid,jdbcType=BIGINT},uabh_type =
        #{type,jdbcType=INTEGER},uabh_content =
        #{content,jdbcType=VARCHAR},uabh_first =
        #{first,jdbcType=BOOLEAN},uabh_create_time =
        #{createTime,jdbcType=TIMESTAMP} where uabh_id = #{id,jdbcType=BIGINT}
    </update>
    <update id="updateByPrimaryKeySelective"
        parameterType="com.yeshi.fanli.entity.bus.user.UserAccountBindingHistory">
        update yeshi_ec_user_account_bind_history
        <set>
            <if test="uid != null">uabh_uid=#{uid,jdbcType=BIGINT},</if>
            <if test="type != null">uabh_type=#{type,jdbcType=INTEGER},</if>
            <if test="content != null">uabh_content=#{content,jdbcType=VARCHAR},</if>
            <if test="first != null">uabh_first=#{first,jdbcType=BOOLEAN},</if>
            <if test="createTime != null">uabh_create_time=#{createTime,jdbcType=TIMESTAMP},</if>
        </set>
        where uabh_id = #{id,jdbcType=BIGINT}
    </update>
</mapper>
fanli/src/main/java/com/yeshi/fanli/service/impl/user/BindingAccountServiceImpl.java
@@ -22,6 +22,7 @@
import com.yeshi.fanli.dao.mybatis.money.UserMoneyDetailMapper;
import com.yeshi.fanli.entity.bus.user.AlipayAccountValidNormalHistory;
import com.yeshi.fanli.entity.bus.user.BindingAccount;
import com.yeshi.fanli.entity.bus.user.UserAccountBindingHistory;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.money.UserMoneyDetail;
import com.yeshi.fanli.exception.AlipayAccountException;
@@ -30,6 +31,7 @@
import com.yeshi.fanli.exception.money.UserMoneyDetailException;
import com.yeshi.fanli.log.LogHelper;
import com.yeshi.fanli.service.inter.user.BindingAccountService;
import com.yeshi.fanli.service.inter.user.UserAccountBindingHistoryService;
import com.yeshi.fanli.service.inter.user.UserNotificationService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
@@ -48,6 +50,9 @@
    @Resource
    private UserNotificationService userNotificationService;
    @Resource
    private UserAccountBindingHistoryService userAccountBindingHistoryService;
    @Resource
    private UserMoneyDetailMapper userMoneyDetailMapper;
@@ -199,6 +204,17 @@
    @Override
    public BindingAccount changeAlipayBindingWithVerify(Long uid, String name, String account)
            throws AlipayTransferException, AlipayApiException, AlipayAccountException {
        BindingAccount bindingAccount = bindingAccountMapper.selectByUidAndType(uid, BindingAccount.TYPE_ALIPAY);
        if (bindingAccount != null) {
            // 验证是否7天内更换了手机号
            UserAccountBindingHistory history = userAccountBindingHistoryService.getLatestHistory(uid,
                    UserAccountBindingHistory.TYPE_PHONE);
            // 手机号更换绑定的7天内不能提现
            if (history != null && !history.getFirst()
                    && (System.currentTimeMillis() - history.getCreateTime().getTime()) > 1000 * 60 * 60 * 24 * 7L) {
                throw new AlipayAccountException(111, "修改手机号7天内不允许修改支付宝账号");
            }
        }
        try {
            validAlipayAccount(uid, account, name);
@@ -210,7 +226,6 @@
            throw new AlipayAccountException(e1.getCode(), e1.getMsg());
        }
        BindingAccount bindingAccount = bindingAccountMapper.selectByUidAndType(uid, BindingAccount.TYPE_ALIPAY);
        if (bindingAccount == null)// 创建账号
        {
            bindingAccount = new BindingAccount();
fanli/src/main/java/com/yeshi/fanli/service/impl/user/ExtractServiceImpl.java
@@ -34,6 +34,7 @@
import com.yeshi.fanli.entity.bus.user.ExtractRecord;
import com.yeshi.fanli.entity.bus.user.HongBaoV2;
import com.yeshi.fanli.entity.bus.user.PayInfo;
import com.yeshi.fanli.entity.bus.user.UserAccountBindingHistory;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.common.AdminUser;
import com.yeshi.fanli.entity.money.UserMoneyDetail;
@@ -50,6 +51,7 @@
import com.yeshi.fanli.service.inter.push.PushService;
import com.yeshi.fanli.service.inter.user.ExtractRecordService;
import com.yeshi.fanli.service.inter.user.ExtractService;
import com.yeshi.fanli.service.inter.user.UserAccountBindingHistoryService;
import com.yeshi.fanli.service.inter.user.UserInfoService;
import com.yeshi.fanli.service.inter.user.UserMoneyDetailService;
import com.yeshi.fanli.service.inter.user.UserNotificationService;
@@ -118,6 +120,9 @@
    @Resource
    private UserMoneyDetailService userMoneyDetailService;
    @Resource
    private UserAccountBindingHistoryService userAccountBindingHistoryService;
    @Transactional
    public Integer addExtract(Extract extract) {
@@ -228,6 +233,13 @@
     */
    @Transactional
    private Integer extract(Extract extract) {
        UserAccountBindingHistory history = userAccountBindingHistoryService
                .getLatestHistory(extract.getUserInfo().getId(), UserAccountBindingHistory.TYPE_PHONE);
        // 手机号更换绑定的7天内不能提现
        if (history != null && !history.getFirst()
                && (System.currentTimeMillis() - history.getCreateTime().getTime()) > 1000 * 60 * 60 * 24 * 7L)
            return 111;
        final String autoExtract = configService.get("extract_way"); // 是否自动转账
        final String maxCount = configService.get("extract_count_day");
        final String maxMoney = configService.get("extract_money_day");
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountBindingHistoryServiceImpl.java
New file
@@ -0,0 +1,33 @@
package com.yeshi.fanli.service.impl.user;
import java.util.Date;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
import com.yeshi.fanli.dao.mybatis.user.UserAccountBindingHistoryMapper;
import com.yeshi.fanli.entity.bus.user.UserAccountBindingHistory;
import com.yeshi.fanli.service.inter.user.UserAccountBindingHistoryService;
import com.yeshi.fanli.util.StringUtil;
@Service
public class UserAccountBindingHistoryServiceImpl implements UserAccountBindingHistoryService {
    @Resource
    private UserAccountBindingHistoryMapper userAccountBindingHistoryMapper;
    @Override
    public void addUserAccountBindingHistory(UserAccountBindingHistory history) {
        if (history.getType() == null || StringUtil.isNullOrEmpty(history.getContent()) || history.getUid() == null)
            return;
        history.setCreateTime(new Date());
        userAccountBindingHistoryMapper.insertSelective(history);
    }
    @Override
    public UserAccountBindingHistory getLatestHistory(Long uid, int type) {
        return userAccountBindingHistoryMapper.selectLatestByTypeAndUid(uid, type);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserAccountServiceImpl.java
@@ -28,6 +28,7 @@
import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
import com.yeshi.fanli.entity.bus.user.LoginResult;
import com.yeshi.fanli.entity.bus.user.ThreeSale;
import com.yeshi.fanli.entity.bus.user.UserAccountBindingHistory;
import com.yeshi.fanli.entity.bus.user.UserConnectHistory;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.entity.bus.user.WeiXinUser;
@@ -38,6 +39,7 @@
import com.yeshi.fanli.service.inter.user.BindingAccountService;
import com.yeshi.fanli.service.inter.user.ForbiddenUserIdentifyCodeService;
import com.yeshi.fanli.service.inter.user.SpreadUserImgService;
import com.yeshi.fanli.service.inter.user.UserAccountBindingHistoryService;
import com.yeshi.fanli.service.inter.user.UserAccountService;
import com.yeshi.fanli.service.inter.user.UserExtraTaoBaoInfoService;
import com.yeshi.fanli.service.inter.user.UserInfoExtraService;
@@ -83,9 +85,12 @@
    @Resource
    private ForbiddenUserIdentifyCodeService forbiddenUserIdentifyCodeService;
    @Resource
    private UserInfoExtraService userInfoExtraService;
    @Resource
    private UserAccountBindingHistoryService userAccountBindingHistoryService;
    @Transactional
    @Override
@@ -899,36 +904,37 @@
        return user.getPortrait();
    }
    @Transactional
    @Override
    public UserInfo loginPhone(HttpServletRequest request,int loginType, String vcode, String phone,
            String appId) throws UserAccountException {
    public UserInfo loginPhone(HttpServletRequest request, int loginType, String vcode, String phone, String appId)
            throws UserAccountException {
        // 空额清理
        if (phone == null || phone.trim().length() == 0) {
            throw new UserAccountException(1, "请输入手机号码");
        }
        phone = phone.replaceAll(" ", "");
//        // 苹果应用商店上线测试号码
//        if ("17316780233".equalsIgnoreCase(phone) && "258168".equalsIgnoreCase(vcode)) {
//            ;
//        } else {
//
//            if (StringUtil.isNullOrEmpty(vcode)) {
//                throw new UserAccountException(1, "请输入验证码");
//            }
//
//            String oldVcode = redisManager.getSMSVCode(phone, SMSHistory.TYPE_LOGIN);
//            LogHelper.test("----------------------登录验证码: " + oldVcode);
//            if (StringUtil.isNullOrEmpty(oldVcode) || !oldVcode.equalsIgnoreCase(vcode)) {
//                throw new UserAccountException(1, "验证码错误,重新输入");
//            }
//        }
//        redisManager.clearSMSFrequencyLimit(phone, SMSHistory.TYPE_LOGIN);
        // // 苹果应用商店上线测试号码
        // if ("17316780233".equalsIgnoreCase(phone) &&
        // "258168".equalsIgnoreCase(vcode)) {
        // ;
        // } else {
        //
        // if (StringUtil.isNullOrEmpty(vcode)) {
        // throw new UserAccountException(1, "请输入验证码");
        // }
        //
        // String oldVcode = redisManager.getSMSVCode(phone,
        // SMSHistory.TYPE_LOGIN);
        // LogHelper.test("----------------------登录验证码: " + oldVcode);
        // if (StringUtil.isNullOrEmpty(oldVcode) ||
        // !oldVcode.equalsIgnoreCase(vcode)) {
        // throw new UserAccountException(1, "验证码错误,重新输入");
        // }
        // }
        // redisManager.clearSMSFrequencyLimit(phone, SMSHistory.TYPE_LOGIN);
        JSONObject logInfo = new JSONObject();
        logInfo.put("appId", appId);
        logInfo.put("phone", phone);
@@ -957,8 +963,7 @@
            userInfo.setState(UserInfo.STATE_NORMAL);
            // 创建用户
            addUser(userInfo);
            try {
                // 第一次登录时创建用户额外信息
                userInfoExtraService.createUserInfoExtra(userInfo.getId());
@@ -969,10 +974,11 @@
        return userInfo;
    }
    @Transactional
    @Override
    public UserInfo loginWinXin(HttpServletRequest request,int loginType, String code, String appId) throws UserAccountException {
    public UserInfo loginWinXin(HttpServletRequest request, int loginType, String code, String appId)
            throws UserAccountException {
        // 日志信息
        JSONObject logInfo = new JSONObject();
        logInfo.put("appId", appId);
@@ -1014,7 +1020,7 @@
            userInfo.setLastLoginIp(request.getRemoteHost());
            userInfo.setState(UserInfo.STATE_NORMAL);
            addUser(userInfo);
            try {
                // 第一次登录时创建用户额外信息
                userInfoExtraService.createUserInfoExtra(userInfo.getId());
@@ -1024,9 +1030,10 @@
        }
        return userInfo;
    }
    /**
     * 更新账户登录信息
     *
     * @param userInfo
     * @param loginType
     * @param request
@@ -1039,15 +1046,14 @@
        updateUserInfo.setLastLoginIp(request.getRemoteHost());
        userInfoMapper.updateByPrimaryKeySelective(updateUserInfo);
    }
    @Override
    public void bindPhoneNew(Long uid, String phone) throws UserAccountException {
        UserInfo user = userInfoMapper.selectByPrimaryKey(uid);
        if (user == null) {
            throw new UserAccountException(1, "用户不存在");
        }
        String hasPhone = user.getPhone();
        if (!StringUtil.isNullOrEmpty(hasPhone) && hasPhone.equals(phone)) {
            throw new UserAccountException(2, "您已经绑定了该电话号码");
@@ -1057,44 +1063,54 @@
        if (phoneUser != null) {
            throw new UserAccountException(2, "号码已经被占用");
        }
        // 更新电话号码
        UserInfo update = new UserInfo(user.getId());
        update.setPhone(phone);
        userInfoMapper.updateByPrimaryKeySelective(update);
        // 加入绑定记录
        UserAccountBindingHistory history = new UserAccountBindingHistory();
        history.setContent(phone);
        history.setType(UserAccountBindingHistory.TYPE_PHONE);
        history.setUid(uid);
        // 之前已经绑定电话号码
        if (!StringUtil.isNullOrEmpty(user.getPhone()))
            history.setFirst(false);
        else
            history.setFirst(true);
        userAccountBindingHistoryService.addUserAccountBindingHistory(history);
        // 发送消息
        userAccountMsgNotificationService.bindingSuccess(uid, MsgAccountDetailFactory.TYPE_PHONE);
    }
    @Override
    public void bindWeiXin(Long uid, String code) throws UserAccountException {
        UserInfo user = userInfoMapper.selectByPrimaryKey(uid);
        if (user == null) {
            throw new UserAccountException(1, "用户不存在");
        }
        WeiXinUser weiXinUser = WXLoginUtil.getWeiXinUserWithSavePortrait(code);
        if (weiXinUser == null) {
            throw new UserAccountException(2, "微信帐号授权失败");
        }
        if (weiXinUser.getUnionid().equalsIgnoreCase(user.getWxUnionId())) {
            throw new UserAccountException(3, "微信帐号一致无需更换");
        }
        UserInfo newUser = userInfoMapper.getEffectiveUserInfoByWXUnionId(weiXinUser.getUnionid());
        if (newUser != null) {
            throw new UserAccountException(4, "该微信号已被其他帐号绑定");
        }
        String wxUnionId = user.getWxUnionId();
        if (!StringUtil.isNullOrEmpty(wxUnionId) && StringUtil.isNullOrEmpty(user.getPhone())) {
            throw new UserAccountException(5, "该帐号没有绑定手机号码,需绑定手机号码才能完成微信更换");
        }
        UserInfo updateUserInfo = new UserInfo(uid);
        updateUserInfo.setWxName(weiXinUser.getNickname());
        updateUserInfo.setWxOpenId(weiXinUser.getOpenid());
@@ -1111,7 +1127,20 @@
        }
        userInfoMapper.updateByPrimaryKeySelective(updateUserInfo);
        // 加入绑定记录
        UserAccountBindingHistory history = new UserAccountBindingHistory();
        history.setContent(weiXinUser.getUnionid());
        history.setType(UserAccountBindingHistory.TYPE_WX);
        history.setUid(uid);
        // 之前已经绑定电话号码
        if (!StringUtil.isNullOrEmpty(user.getWxUnionId()))
            history.setFirst(false);
        else
            history.setFirst(true);
        userAccountBindingHistoryService.addUserAccountBindingHistory(history);
        userAccountMsgNotificationService.bindingSuccess(uid, MsgAccountDetailFactory.TYPE_WX);
    }
}
fanli/src/main/java/com/yeshi/fanli/service/impl/user/UserExtraTaoBaoInfoServiceImpl.java
@@ -11,10 +11,12 @@
import com.yeshi.fanli.dao.mybatis.user.UserExtraTaoBaoInfoMapper;
import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode;
import com.yeshi.fanli.entity.bus.user.ForbiddenUserIdentifyCode.ForbiddenUserIdentifyCodeTypeEnum;
import com.yeshi.fanli.entity.bus.user.UserAccountBindingHistory;
import com.yeshi.fanli.entity.bus.user.UserExtraTaoBaoInfo;
import com.yeshi.fanli.entity.bus.user.UserInfo;
import com.yeshi.fanli.exception.user.UserExtraTaoBaoInfoException;
import com.yeshi.fanli.service.inter.user.ForbiddenUserIdentifyCodeService;
import com.yeshi.fanli.service.inter.user.UserAccountBindingHistoryService;
import com.yeshi.fanli.service.inter.user.UserExtraTaoBaoInfoService;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.StringUtil;
@@ -24,25 +26,27 @@
    @Resource
    private UserExtraTaoBaoInfoMapper userExtraTaoBaoInfoMapper;
    @Resource
    private ForbiddenUserIdentifyCodeService forbiddenUserIdentifyCodeService;
    
    @Resource
    private UserAccountBindingHistoryService userAccountBindingHistoryService;
    @Transactional
    @Override
    public void addRelationId(Long uid, String relationId, String taoBaoUid,String nickName,
            boolean valid) throws UserExtraTaoBaoInfoException{
    public void addRelationId(Long uid, String relationId, String taoBaoUid, String nickName, boolean valid)
            throws UserExtraTaoBaoInfoException {
        if (uid == null || StringUtil.isNullOrEmpty(relationId) || StringUtil.isNullOrEmpty(taoBaoUid)) {
            throw new UserExtraTaoBaoInfoException(1, "传递参数为空");
        }
        // 验证taoBaoUid是否被封禁
        if(validateTaoBaoUidForbidden(taoBaoUid)) {
        if (validateTaoBaoUidForbidden(taoBaoUid)) {
            throw new UserExtraTaoBaoInfoException(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC);
        }
        UserExtraTaoBaoInfo taoBaoInfo = new UserExtraTaoBaoInfo();
        taoBaoInfo.setUser(new UserInfo(uid));
        taoBaoInfo.setTaoBaoNickName(nickName);
@@ -50,10 +54,10 @@
        taoBaoInfo.setRelationId(relationId);
        taoBaoInfo.setRelationValid(valid);
        taoBaoInfo.setRelationUpdateTime(new Date());
        List<UserExtraTaoBaoInfo> list = userExtraTaoBaoInfoMapper.listByTaoBaoUid(taoBaoUid);
        if (list == null || list.size() == 0) {
            //新增
            // 新增
            taoBaoInfo.setCreateTime(new Date());
            userExtraTaoBaoInfoMapper.insertSelective(taoBaoInfo);
        } else {
@@ -61,7 +65,7 @@
            taoBaoInfo.setId(list.get(0).getId());
            taoBaoInfo.setUpdateTime(new Date());
            userExtraTaoBaoInfoMapper.updateByPrimaryKeySelective(taoBaoInfo);
            // 清空多余已绑定数据
            if (list.size() > 1) {
                for (int i = 1; i < list.size(); i++) {
@@ -73,18 +77,18 @@
    @Transactional
    @Override
    public void addSpecialId(Long uid, String specialId, String taoBaoUid, String nickName,
            boolean valid) throws UserExtraTaoBaoInfoException{
    public void addSpecialId(Long uid, String specialId, String taoBaoUid, String nickName, boolean valid)
            throws UserExtraTaoBaoInfoException {
        if (uid == null || StringUtil.isNullOrEmpty(specialId) || StringUtil.isNullOrEmpty(taoBaoUid)) {
            throw new UserExtraTaoBaoInfoException(1, "传递参数为空");
        }
        // 验证taoBaoUid是否被封禁
        if(validateTaoBaoUidForbidden(taoBaoUid)) {
        if (validateTaoBaoUidForbidden(taoBaoUid)) {
            throw new UserExtraTaoBaoInfoException(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC);
        }
        UserExtraTaoBaoInfo taoBaoInfo = new UserExtraTaoBaoInfo();
        taoBaoInfo.setUser(new UserInfo(uid));
        taoBaoInfo.setTaoBaoNickName(nickName);
@@ -92,10 +96,10 @@
        taoBaoInfo.setSpecialValid(valid);
        taoBaoInfo.setSpecialId(specialId);
        taoBaoInfo.setSpecialUpdateTime(new Date());
        List<UserExtraTaoBaoInfo> list = userExtraTaoBaoInfoMapper.listByTaoBaoUid(taoBaoUid);
        if (list == null || list.size() == 0) {
            //新增
            // 新增
            taoBaoInfo.setCreateTime(new Date());
            userExtraTaoBaoInfoMapper.insertSelective(taoBaoInfo);
        } else {
@@ -103,7 +107,7 @@
            taoBaoInfo.setId(list.get(0).getId());
            taoBaoInfo.setUpdateTime(new Date());
            userExtraTaoBaoInfoMapper.updateByPrimaryKeySelective(taoBaoInfo);
            // 清空多余已绑定数据
            if (list.size() > 1) {
                for (int i = 1; i < list.size(); i++) {
@@ -115,19 +119,19 @@
    @Transactional
    @Override
    public void saveUserTaoBaoInfo(Long uid, String relationId, String specialId, String taoBaoUid,
            String nickName, boolean valid) throws UserExtraTaoBaoInfoException {
    public void saveUserTaoBaoInfo(Long uid, String relationId, String specialId, String taoBaoUid, String nickName,
            boolean valid) throws UserExtraTaoBaoInfoException {
        if (uid == null || StringUtil.isNullOrEmpty(relationId) || StringUtil.isNullOrEmpty(specialId)
                || StringUtil.isNullOrEmpty(taoBaoUid)) {
            throw new UserExtraTaoBaoInfoException(1, "传递参数部分为空");
        }
        // 验证taoBaoUid是否被封禁
        if(validateTaoBaoUidForbidden(taoBaoUid)) {
        if (validateTaoBaoUidForbidden(taoBaoUid)) {
            throw new UserExtraTaoBaoInfoException(Constant.CODE_FORBIDDEN_USER, Constant.FORBIDDEN_USER_REASON_DESC);
        }
        UserExtraTaoBaoInfo taoBaoInfo = new UserExtraTaoBaoInfo();
        taoBaoInfo.setTaoBaoUid(taoBaoUid);
        taoBaoInfo.setTaoBaoNickName(nickName);
@@ -142,8 +146,12 @@
        taoBaoInfo.setSpecialUpdateTime(new Date());
        List<UserExtraTaoBaoInfo> list = userExtraTaoBaoInfoMapper.listByTaoBaoUid(taoBaoUid);
        // 判断之前用户是否绑定过
        UserExtraTaoBaoInfo info = userExtraTaoBaoInfoMapper.selectByUid(uid);
        if (list == null || list.size() == 0) {
            //新增
            // 新增
            taoBaoInfo.setCreateTime(new Date());
            userExtraTaoBaoInfoMapper.insertSelective(taoBaoInfo);
        } else {
@@ -151,7 +159,7 @@
            taoBaoInfo.setId(list.get(0).getId());
            taoBaoInfo.setUpdateTime(new Date());
            userExtraTaoBaoInfoMapper.updateByPrimaryKeySelective(taoBaoInfo);
            // 清空多余已绑定数据
            if (list.size() > 1) {
                for (int i = 1; i < list.size(); i++) {
@@ -159,43 +167,58 @@
                }
            }
        }
        // 加入绑定记录
        UserAccountBindingHistory history = new UserAccountBindingHistory();
        history.setContent(taoBaoUid);
        history.setType(UserAccountBindingHistory.TYPE_TB);
        history.setUid(uid);
        // 之前已经绑定电话号码
        if (info!=null)
            history.setFirst(false);
        else
            history.setFirst(true);
        userAccountBindingHistoryService.addUserAccountBindingHistory(history);
    }
    /**
     * 验证taoBaoUid  是否被封
     * 验证taoBaoUid 是否被封
     *
     * @param taoBaoUid
     * @return
     */
    public boolean validateTaoBaoUidForbidden(String taoBaoUid) {
        boolean validate = false;
        ForbiddenUserIdentifyCode identifyCode = forbiddenUserIdentifyCodeService.listByTypeAndIdentifyCode(
                ForbiddenUserIdentifyCodeTypeEnum.taobaoUid, taoBaoUid);
        ForbiddenUserIdentifyCode identifyCode = forbiddenUserIdentifyCodeService
                .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.taobaoUid, taoBaoUid);
        // 账号被封
        if (identifyCode != null && identifyCode.getEffective() != null && identifyCode.getEffective()) {
            validate = true;
        }
        return validate;
    }
    /**
     * 清空多余绑定淘宝账号信息
     *
     * @param otherInfo
     */
    public void clearTaoBaoInfo(UserExtraTaoBaoInfo otherInfo ) {
    public void clearTaoBaoInfo(UserExtraTaoBaoInfo otherInfo) {
        otherInfo.setUser(null);
        otherInfo.setTaoBaoUid(null);
        otherInfo.setTaoBaoNickName(null);
        otherInfo.setRelationValid(null);
        otherInfo.setRelationId(null);
        otherInfo.setRelationUpdateTime(null);
        otherInfo.setSpecialValid(null);
        otherInfo.setSpecialId(null);
        otherInfo.setSpecialUpdateTime(new Date());
        userExtraTaoBaoInfoMapper.updateByPrimaryKey(otherInfo);
    }
    @Override
    public UserExtraTaoBaoInfo getByUid(Long uid) {
        return userExtraTaoBaoInfoMapper.selectByUid(uid);
fanli/src/main/java/com/yeshi/fanli/service/inter/user/UserAccountBindingHistoryService.java
New file
@@ -0,0 +1,23 @@
package com.yeshi.fanli.service.inter.user;
import com.yeshi.fanli.entity.bus.user.UserAccountBindingHistory;
public interface UserAccountBindingHistoryService {
    /**
     * 添加绑定
     *
     * @param history
     */
    public void addUserAccountBindingHistory(UserAccountBindingHistory history);
    /**
     * 获取最近一次的绑定记录
     *
     * @param uid
     * @param type
     * @return
     */
    public UserAccountBindingHistory getLatestHistory(Long uid, int type);
}