| | |
| | | * @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;
|
| | |
| | | shareGoodsTextTemplateService.resetCommonTemplate(uid);
|
| | | }
|
| | |
|
| | | if (goodsId != null) {
|
| | | preViewShareTextTemplate(acceptData, uid, null, goodsId, hasCoupon, out);
|
| | | return;
|
| | | }
|
| | |
|
| | | out.print(JsonUtil.loadTrueResult(""));
|
| | | }
|
| | |
|
| | |
| | | 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;
|
| | |
| | | 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;
|
| | |
| | |
|
| | | @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";
|
| | |
| | | }
|
| | | redisManager.cacheCommonString(key, "1", 120);
|
| | |
|
| | | |
| | |
|
| | | // 支付宝绑定
|
| | | ForbiddenUserIdentifyCode ic = forbiddenUserIdentifyCodeService
|
| | | .listByTypeAndIdentifyCode(ForbiddenUserIdentifyCodeTypeEnum.alipayAccount, account);
|
| | |
| | | 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());
|
| | |
| | | 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)) {
|
| | |
| | | } 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 {
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 绑定电话号码 V1.5.3
|
| | | * 绑定电话号码 V1.5.3
|
| | | *
|
| | | * @param acceptData
|
| | | * @param vcode
|
| | |
| | | */
|
| | | @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) {
|
| | |
| | | }
|
| | |
|
| | | phone = phone.replaceAll(" ", "");
|
| | | |
| | |
|
| | | String oldVCode = redisManager.getSMSVCode(phone, SMSHistory.TYPE_BIND);
|
| | | if (Constant.IS_OUTNET) {
|
| | | if (!vcode.equalsIgnoreCase(oldVCode)) {
|
| | |
| | | }
|
| | | redisManager.clearSMSFrequencyLimit(phone, SMSHistory.TYPE_BIND);
|
| | | }
|
| | | |
| | | |
| | |
|
| | | try {
|
| | | // 绑定用户
|
| | | userAccountService.bindPhoneNew(uid, phone);
|
| | | |
| | |
|
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
|
| | | // 判断电话号码是否已经封禁
|
| | | ForbiddenUserIdentifyCode ic = forbiddenUserIdentifyCodeService
|
| | |
| | | out.print(JsonUtil.loadFalseResult(1, "绑定失败"));
|
| | | }
|
| | | }
|
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 更改微信
|
| | | *
|
| | |
| | | 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;
|
| | |
| | |
|
| | | try {
|
| | | userAccountService.bindWeiXin(uid, code);
|
| | | |
| | |
|
| | | UserInfo user = userInfoService.getUserByIdWithMybatis(uid);
|
| | | // 判断taoBaoUid是否已经封禁
|
| | | ForbiddenUserIdentifyCode ic = forbiddenUserIdentifyCodeService
|
| | |
| | |
|
| | | @Resource
|
| | | private AccountMessageService accountMessageService;
|
| | | |
| | |
|
| | | private static final String PASSWORD_MAX_ERROR = "password_max_error";
|
| | | private static final String EXTRACT_MIN_MONEY = "extract_min_money";
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
|
| | |
|
| | |
| | | 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();
|
| | | }
|
| | | }
|
| | |
| | | return;
|
| | | }
|
| | |
|
| | |
|
| | | /**
|
| | | * 新版提现
|
| | | *
|
| | |
| | | out.print(JsonUtil.loadFalseResult("已超过当日提现金额"));
|
| | | } else if (etype == 3) {
|
| | | out.print(JsonUtil.loadFalseResult("提现金额大于我的红包"));
|
| | | } else if (etype == 111) {
|
| | | out.print(JsonUtil.loadFalseResult("更换了手机号后7天内不允许提现"));
|
| | | }
|
| | |
|
| | | }
|
| | |
| | |
|
| | | }
|
| | |
|
| | | |
| | | /**
|
| | | * 用户队员列表查询 1.5.3查询有效队员
|
| | | *
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | | |
| | | |
| | |
|
| | | /**
|
| | | * 用户队员统计 1.4.1
|
| | | *
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 获取用户信息
|
| | | *
|
| | |
| | | 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());
|
| | |
| | | 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 {
|
| | |
| | | }
|
| | | 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();
|
| | |
| | | userInfo.setRankIcon(null);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | data.put("invitCode", invitCode); // 邀请码
|
| | | data.put("welfareCenterNews", welfareCenterNews);// 福利中心消息
|
| | | out.print(JsonUtil.loadTrueResult(data));
|
| | |
| | | }
|
| | | }
|
| | | });
|
| | | |
| | |
|
| | | } catch (UserInfoException e) {
|
| | | out.print(JsonUtil.loadFalseResult(e.getCode(), e.getMsg()));
|
| | | } catch (Exception e) {
|
| | |
| | | e.printStackTrace();
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | private void outUserInfoHandle(UserInfo user) {
|
| | | |
| | |
|
| | | // 红包处理
|
| | | user.setTotalHongBao(new BigDecimal(0));
|
| | | user.setNoOpenHongBao(new BigDecimal(0));
|
| | |
| | | user.setPhone(phone);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | UserInfoExtraVO userInfoExtra = userInfoExtraService.getInfoExtraVOByUid(user.getId());
|
| | | if (userInfoExtra != null && userInfoExtra.getUserRank() != null) {
|
| | | String picture = userInfoExtra.getUserRank().getPicture();
|
| | |
| | | user.setRankIcon(icon);
|
| | | }
|
| | | }
|
| | | |
| | |
|
| | | }
|
New file |
| | |
| | | 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); |
| | | |
| | | } |
New file |
| | |
| | | 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;
|
| | | }
|
| | | }
|
New file |
| | |
| | | <?xml version="1.0" encoding="UTF-8"?> |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | |
| | | <mapper |
| | | namespace="com.yeshi.fanli.dao.mybatis.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> |
| | |
| | | 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;
|
| | |
| | | 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;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserNotificationService userNotificationService;
|
| | |
|
| | | @Resource
|
| | | private UserAccountBindingHistoryService userAccountBindingHistoryService;
|
| | |
|
| | | @Resource
|
| | | private UserMoneyDetailMapper userMoneyDetailMapper;
|
| | |
| | | @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);
|
| | |
| | | throw new AlipayAccountException(e1.getCode(), e1.getMsg());
|
| | | }
|
| | |
|
| | | BindingAccount bindingAccount = bindingAccountMapper.selectByUidAndType(uid, BindingAccount.TYPE_ALIPAY);
|
| | | if (bindingAccount == null)// 创建账号
|
| | | {
|
| | | bindingAccount = new BindingAccount();
|
| | |
| | | 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;
|
| | |
| | | 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;
|
| | |
| | |
|
| | | @Resource
|
| | | private UserMoneyDetailService userMoneyDetailService;
|
| | |
|
| | | @Resource
|
| | | private UserAccountBindingHistoryService userAccountBindingHistoryService;
|
| | |
|
| | | @Transactional
|
| | | public Integer addExtract(Extract extract) {
|
| | |
| | | */
|
| | | @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");
|
New file |
| | |
| | | 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);
|
| | | }
|
| | |
|
| | | }
|
| | |
| | | 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;
|
| | |
| | | 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;
|
| | |
| | |
|
| | | @Resource
|
| | | private ForbiddenUserIdentifyCodeService forbiddenUserIdentifyCodeService;
|
| | | |
| | |
|
| | | @Resource
|
| | | private UserInfoExtraService userInfoExtraService;
|
| | |
|
| | | @Resource
|
| | | private UserAccountBindingHistoryService userAccountBindingHistoryService;
|
| | |
|
| | | @Transactional
|
| | | @Override
|
| | |
| | | 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);
|
| | |
| | | userInfo.setState(UserInfo.STATE_NORMAL);
|
| | | // 创建用户
|
| | | addUser(userInfo);
|
| | | |
| | | |
| | |
|
| | | try {
|
| | | // 第一次登录时创建用户额外信息
|
| | | userInfoExtraService.createUserInfoExtra(userInfo.getId());
|
| | |
| | |
|
| | | 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);
|
| | |
| | | userInfo.setLastLoginIp(request.getRemoteHost());
|
| | | userInfo.setState(UserInfo.STATE_NORMAL);
|
| | | addUser(userInfo);
|
| | | |
| | |
|
| | | try {
|
| | | // 第一次登录时创建用户额外信息
|
| | | userInfoExtraService.createUserInfoExtra(userInfo.getId());
|
| | |
| | | }
|
| | | return userInfo;
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 更新账户登录信息
|
| | | * |
| | | * @param userInfo
|
| | | * @param loginType
|
| | | * @param request
|
| | |
| | | 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, "您已经绑定了该电话号码");
|
| | |
| | | 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());
|
| | |
| | | }
|
| | | 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);
|
| | | }
|
| | | |
| | |
|
| | | }
|
| | |
| | | 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;
|
| | |
| | |
|
| | | @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);
|
| | |
| | | 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 {
|
| | |
| | | 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++) {
|
| | |
| | |
|
| | | @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);
|
| | |
| | | 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 {
|
| | |
| | | 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++) {
|
| | |
| | |
|
| | | @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);
|
| | |
| | | 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 {
|
| | |
| | | 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++) {
|
| | |
| | | }
|
| | | }
|
| | | }
|
| | |
|
| | | // 加入绑定记录
|
| | | 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);
|
New file |
| | |
| | | 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);
|
| | |
|
| | | }
|