'提交代码'

dev-discount
= 4 years ago
parent 3340ea1beb
commit 94f2a489e0
  1. 1
      hai-cweb/src/main/java/com/cweb/config/AuthConfig.java
  2. 7
      hai-cweb/src/main/java/com/cweb/controller/HighUserCommonController.java
  3. 2
      hai-cweb/src/main/java/com/cweb/controller/HighUserController.java
  4. 33
      hai-cweb/src/main/java/com/cweb/controller/WechatController.java
  5. 10
      hai-service/src/main/java/com/hai/dao/HighUserMapper.java
  6. 28
      hai-service/src/main/java/com/hai/dao/HighUserSqlProvider.java
  7. 32
      hai-service/src/main/java/com/hai/entity/HighUser.java
  8. 140
      hai-service/src/main/java/com/hai/entity/HighUserExample.java
  9. 7
      hai-service/src/main/java/com/hai/service/HighUserService.java
  10. 17
      hai-service/src/main/java/com/hai/service/impl/HighUserServiceImpl.java

@ -104,6 +104,7 @@ public class AuthConfig implements WebMvcConfigurer {
.excludePathPatterns("/highMerchantStore/getStoreListByMerchant") .excludePathPatterns("/highMerchantStore/getStoreListByMerchant")
.excludePathPatterns("/sms/sendSmsCode") .excludePathPatterns("/sms/sendSmsCode")
.excludePathPatterns("/sms/getSmsCode") .excludePathPatterns("/sms/getSmsCode")
.excludePathPatterns("/user/login")
.excludePathPatterns("/wechat/*") .excludePathPatterns("/wechat/*")
; ;
} }

@ -8,10 +8,7 @@ import com.cweb.config.WxMaConfiguration;
import com.hai.common.exception.ErrorCode; import com.hai.common.exception.ErrorCode;
import com.hai.common.exception.ErrorHelp; import com.hai.common.exception.ErrorHelp;
import com.hai.common.exception.SysCode; import com.hai.common.exception.SysCode;
import com.hai.common.security.SessionObject; import com.hai.common.security.*;
import com.hai.common.security.UserCenter;
import com.hai.common.security.VerifyCode;
import com.hai.common.security.VerifyCodeStorage;
import com.hai.common.utils.ResponseMsgUtil; import com.hai.common.utils.ResponseMsgUtil;
import com.hai.entity.HighUser; import com.hai.entity.HighUser;
import com.hai.model.HighUserModel; import com.hai.model.HighUserModel;
@ -77,7 +74,7 @@ public class HighUserCommonController {
HighUserModel highUserModel = new HighUserModel(); HighUserModel highUserModel = new HighUserModel();
user.setPassword(null); user.setPassword(null);
highUserModel.setHighUser(user); highUserModel.setHighUser(user);
SessionObject so = new SessionObject(user.getOpenId(), 1 , highUserModel); SessionObject so = new SessionObject(Base64Util.encode(user.getId().toString()), 1 , highUserModel);
userCenter.save(request, response, so); userCenter.save(request, response, so);
return ResponseMsgUtil.success(so); return ResponseMsgUtil.success(so);
} catch (Exception e) { } catch (Exception e) {

@ -104,7 +104,7 @@ public class HighUserController {
HighUserModel highUserModel = new HighUserModel(); HighUserModel highUserModel = new HighUserModel();
highUser.setPassword(null); highUser.setPassword(null);
highUserModel.setHighUser(highUser); highUserModel.setHighUser(highUser);
SessionObject so = new SessionObject(highUser.getOpenId(), 1 , highUserModel); SessionObject so = new SessionObject(highUser.getUnionId(), 1 , highUserModel);
userCenter.save(request, response, so); userCenter.save(request, response, so);
return ResponseMsgUtil.success(so); return ResponseMsgUtil.success(so);

@ -98,8 +98,7 @@ public class WechatController {
HighUserModel loginDataModel = new HighUserModel(); HighUserModel loginDataModel = new HighUserModel();
highUser.setPassword(null); highUser.setPassword(null);
loginDataModel.setHighUser(highUser); loginDataModel.setHighUser(highUser);
SessionObject so = new SessionObject(highUser.getUnionId(), 1 , loginDataModel);
SessionObject so = new SessionObject(openId, 99 , loginDataModel);
userCenter.save(request, response, so); userCenter.save(request, response, so);
return ResponseMsgUtil.success(so); return ResponseMsgUtil.success(so);
@ -135,26 +134,15 @@ public class WechatController {
if (phoneNoInfo == null || StringUtils.isEmpty(phoneNoInfo.getPurePhoneNumber())) { if (phoneNoInfo == null || StringUtils.isEmpty(phoneNoInfo.getPurePhoneNumber())) {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_DECRYPT_ERROR, "用户phoneNumber解析失败"); throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_DECRYPT_ERROR, "用户phoneNumber解析失败");
} }
HighUser user = highUserService.findByOpenId(openId);
if (user == null) { HighUser user = highUserService.bindUserPhone(phoneNoInfo.getPurePhoneNumber(), request);
user = new HighUser();
user.setOpenId(openId);
user.setRegTime(new Date());
user.setStatus(1);
user.setGold(0);
user.setPhone(phoneNoInfo.getPurePhoneNumber());
highUserService.insertUser(user);
} else {
user.setPhone(phoneNoInfo.getPurePhoneNumber());
highUserService.updateUser(user);
}
// 定义个人所有数据 // 定义个人所有数据
HighUserModel highUserModel = new HighUserModel(); HighUserModel highUserModel = new HighUserModel();
user.setPassword(null); user.setPassword(null);
highUserModel.setHighUser(user); highUserModel.setHighUser(user);
SessionObject so = new SessionObject(openId, 1 , highUserModel); SessionObject so = new SessionObject(user.getUnionId(), 1 , highUserModel);
userCenter.save(request, response, so); userCenter.save(request, response, so);
return ResponseMsgUtil.success(so); return ResponseMsgUtil.success(so);
@ -187,13 +175,13 @@ public class WechatController {
final WxMaService wxService = WxMaConfiguration.getMaService(); final WxMaService wxService = WxMaConfiguration.getMaService();
WxMaUserInfo userInfo = wxService.getUserService().getUserInfo(sessionKey, encryptedData, iv); WxMaUserInfo userInfo = wxService.getUserService().getUserInfo(sessionKey, encryptedData, iv);
System.out.println("");
if (userInfo == null) { if (userInfo == null) {
throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_DECRYPT_ERROR, "用户phoneNumber解析失败"); throw ErrorHelp.genException(SysCode.MiniProgram, ErrorCode.WECHAT_DECRYPT_ERROR, "用户phoneNumber解析失败");
} }
HighUser user = highUserService.findByOpenId(openId); HighUser user = highUserService.findByUnionId(userInfo.getUnionId());
if (user == null) { if (user == null) {
user = new HighUser(); user = new HighUser();
user.setUnionId(userInfo.getUnionId());
user.setOpenId(openId); user.setOpenId(openId);
user.setRegTime(new Date()); user.setRegTime(new Date());
user.setStatus(1); user.setStatus(1);
@ -212,7 +200,7 @@ public class WechatController {
user.setPassword(null); user.setPassword(null);
highUserModel.setHighUser(user); highUserModel.setHighUser(user);
SessionObject so = new SessionObject(openId, 1 , highUserModel); SessionObject so = new SessionObject(userInfo.getUnionId(), 1 , highUserModel);
userCenter.save(request, response, so); userCenter.save(request, response, so);
return ResponseMsgUtil.success(so); return ResponseMsgUtil.success(so);
@ -301,10 +289,11 @@ public class WechatController {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取微信用户信息失败"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "获取微信用户信息失败");
} }
HighUser user = highUserService.findByOpenId(openid); HighUser user = highUserService.findByUnionId(userInfo.getString("unionid"));
if (user == null) { if (user == null) {
user = new HighUser(); user = new HighUser();
user.setOpenId(openid); user.setUnionId(userInfo.getString("unionid"));
user.setOpenIdH5(openid);
user.setRegTime(new Date()); user.setRegTime(new Date());
user.setStatus(1); user.setStatus(1);
user.setGold(0); user.setGold(0);
@ -321,7 +310,7 @@ public class WechatController {
HighUserModel highUserModel = new HighUserModel(); HighUserModel highUserModel = new HighUserModel();
user.setPassword(null); user.setPassword(null);
highUserModel.setHighUser(user); highUserModel.setHighUser(user);
SessionObject so = new SessionObject(openid, 1 , highUserModel); SessionObject so = new SessionObject(userInfo.getString("unionid"), 1 , highUserModel);
userCenter.save(request, response, so); userCenter.save(request, response, so);
return ResponseMsgUtil.success(so); return ResponseMsgUtil.success(so);

@ -43,12 +43,14 @@ public interface HighUserMapper extends HighUserMapperExt {
"phone, `password`, ", "phone, `password`, ",
"sex, birthdate, reg_time, ", "sex, birthdate, reg_time, ",
"gold, `status`, open_id, ", "gold, `status`, open_id, ",
"open_id_h5, union_id, ",
"ext_1, ext_2, ext_3, ", "ext_1, ext_2, ext_3, ",
"ext_4)", "ext_4)",
"values (#{headerImg,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, ", "values (#{headerImg,jdbcType=VARCHAR}, #{name,jdbcType=VARCHAR}, ",
"#{phone,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, ", "#{phone,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, ",
"#{sex,jdbcType=VARCHAR}, #{birthdate,jdbcType=DATE}, #{regTime,jdbcType=TIMESTAMP}, ", "#{sex,jdbcType=VARCHAR}, #{birthdate,jdbcType=DATE}, #{regTime,jdbcType=TIMESTAMP}, ",
"#{gold,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{openId,jdbcType=VARCHAR}, ", "#{gold,jdbcType=INTEGER}, #{status,jdbcType=INTEGER}, #{openId,jdbcType=VARCHAR}, ",
"#{openIdH5,jdbcType=VARCHAR}, #{unionId,jdbcType=VARCHAR}, ",
"#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, ", "#{ext1,jdbcType=VARCHAR}, #{ext2,jdbcType=VARCHAR}, #{ext3,jdbcType=VARCHAR}, ",
"#{ext4,jdbcType=VARCHAR})" "#{ext4,jdbcType=VARCHAR})"
}) })
@ -72,6 +74,8 @@ public interface HighUserMapper extends HighUserMapperExt {
@Result(column="gold", property="gold", jdbcType=JdbcType.INTEGER), @Result(column="gold", property="gold", jdbcType=JdbcType.INTEGER),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="open_id", property="openId", jdbcType=JdbcType.VARCHAR), @Result(column="open_id", property="openId", jdbcType=JdbcType.VARCHAR),
@Result(column="open_id_h5", property="openIdH5", jdbcType=JdbcType.VARCHAR),
@Result(column="union_id", property="unionId", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR), @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR),
@ -82,7 +86,7 @@ public interface HighUserMapper extends HighUserMapperExt {
@Select({ @Select({
"select", "select",
"id, header_img, `name`, phone, `password`, sex, birthdate, reg_time, gold, `status`, ", "id, header_img, `name`, phone, `password`, sex, birthdate, reg_time, gold, `status`, ",
"open_id, ext_1, ext_2, ext_3, ext_4", "open_id, open_id_h5, union_id, ext_1, ext_2, ext_3, ext_4",
"from high_user", "from high_user",
"where id = #{id,jdbcType=BIGINT}" "where id = #{id,jdbcType=BIGINT}"
}) })
@ -98,6 +102,8 @@ public interface HighUserMapper extends HighUserMapperExt {
@Result(column="gold", property="gold", jdbcType=JdbcType.INTEGER), @Result(column="gold", property="gold", jdbcType=JdbcType.INTEGER),
@Result(column="status", property="status", jdbcType=JdbcType.INTEGER), @Result(column="status", property="status", jdbcType=JdbcType.INTEGER),
@Result(column="open_id", property="openId", jdbcType=JdbcType.VARCHAR), @Result(column="open_id", property="openId", jdbcType=JdbcType.VARCHAR),
@Result(column="open_id_h5", property="openIdH5", jdbcType=JdbcType.VARCHAR),
@Result(column="union_id", property="unionId", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR), @Result(column="ext_1", property="ext1", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR), @Result(column="ext_2", property="ext2", jdbcType=JdbcType.VARCHAR),
@Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR), @Result(column="ext_3", property="ext3", jdbcType=JdbcType.VARCHAR),
@ -126,6 +132,8 @@ public interface HighUserMapper extends HighUserMapperExt {
"gold = #{gold,jdbcType=INTEGER},", "gold = #{gold,jdbcType=INTEGER},",
"`status` = #{status,jdbcType=INTEGER},", "`status` = #{status,jdbcType=INTEGER},",
"open_id = #{openId,jdbcType=VARCHAR},", "open_id = #{openId,jdbcType=VARCHAR},",
"open_id_h5 = #{openIdH5,jdbcType=VARCHAR},",
"union_id = #{unionId,jdbcType=VARCHAR},",
"ext_1 = #{ext1,jdbcType=VARCHAR},", "ext_1 = #{ext1,jdbcType=VARCHAR},",
"ext_2 = #{ext2,jdbcType=VARCHAR},", "ext_2 = #{ext2,jdbcType=VARCHAR},",
"ext_3 = #{ext3,jdbcType=VARCHAR},", "ext_3 = #{ext3,jdbcType=VARCHAR},",

@ -68,6 +68,14 @@ public class HighUserSqlProvider {
sql.VALUES("open_id", "#{openId,jdbcType=VARCHAR}"); sql.VALUES("open_id", "#{openId,jdbcType=VARCHAR}");
} }
if (record.getOpenIdH5() != null) {
sql.VALUES("open_id_h5", "#{openIdH5,jdbcType=VARCHAR}");
}
if (record.getUnionId() != null) {
sql.VALUES("union_id", "#{unionId,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) { if (record.getExt1() != null) {
sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}"); sql.VALUES("ext_1", "#{ext1,jdbcType=VARCHAR}");
} }
@ -104,6 +112,8 @@ public class HighUserSqlProvider {
sql.SELECT("gold"); sql.SELECT("gold");
sql.SELECT("`status`"); sql.SELECT("`status`");
sql.SELECT("open_id"); sql.SELECT("open_id");
sql.SELECT("open_id_h5");
sql.SELECT("union_id");
sql.SELECT("ext_1"); sql.SELECT("ext_1");
sql.SELECT("ext_2"); sql.SELECT("ext_2");
sql.SELECT("ext_3"); sql.SELECT("ext_3");
@ -169,6 +179,14 @@ public class HighUserSqlProvider {
sql.SET("open_id = #{record.openId,jdbcType=VARCHAR}"); sql.SET("open_id = #{record.openId,jdbcType=VARCHAR}");
} }
if (record.getOpenIdH5() != null) {
sql.SET("open_id_h5 = #{record.openIdH5,jdbcType=VARCHAR}");
}
if (record.getUnionId() != null) {
sql.SET("union_id = #{record.unionId,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) { if (record.getExt1() != null) {
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
} }
@ -204,6 +222,8 @@ public class HighUserSqlProvider {
sql.SET("gold = #{record.gold,jdbcType=INTEGER}"); sql.SET("gold = #{record.gold,jdbcType=INTEGER}");
sql.SET("`status` = #{record.status,jdbcType=INTEGER}"); sql.SET("`status` = #{record.status,jdbcType=INTEGER}");
sql.SET("open_id = #{record.openId,jdbcType=VARCHAR}"); sql.SET("open_id = #{record.openId,jdbcType=VARCHAR}");
sql.SET("open_id_h5 = #{record.openIdH5,jdbcType=VARCHAR}");
sql.SET("union_id = #{record.unionId,jdbcType=VARCHAR}");
sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}"); sql.SET("ext_1 = #{record.ext1,jdbcType=VARCHAR}");
sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}"); sql.SET("ext_2 = #{record.ext2,jdbcType=VARCHAR}");
sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}"); sql.SET("ext_3 = #{record.ext3,jdbcType=VARCHAR}");
@ -258,6 +278,14 @@ public class HighUserSqlProvider {
sql.SET("open_id = #{openId,jdbcType=VARCHAR}"); sql.SET("open_id = #{openId,jdbcType=VARCHAR}");
} }
if (record.getOpenIdH5() != null) {
sql.SET("open_id_h5 = #{openIdH5,jdbcType=VARCHAR}");
}
if (record.getUnionId() != null) {
sql.SET("union_id = #{unionId,jdbcType=VARCHAR}");
}
if (record.getExt1() != null) { if (record.getExt1() != null) {
sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}"); sql.SET("ext_1 = #{ext1,jdbcType=VARCHAR}");
} }

@ -67,6 +67,16 @@ public class HighUser extends UserModel implements Serializable {
private String openId; private String openId;
/**
* H5openId
*/
private String openIdH5;
/**
* 微信·开放平台
*/
private String unionId;
private String ext1; private String ext1;
private String ext2; private String ext2;
@ -165,6 +175,22 @@ public class HighUser extends UserModel implements Serializable {
this.openId = openId; this.openId = openId;
} }
public String getOpenIdH5() {
return openIdH5;
}
public void setOpenIdH5(String openIdH5) {
this.openIdH5 = openIdH5;
}
public String getUnionId() {
return unionId;
}
public void setUnionId(String unionId) {
this.unionId = unionId;
}
public String getExt1() { public String getExt1() {
return ext1; return ext1;
} }
@ -220,6 +246,8 @@ public class HighUser extends UserModel implements Serializable {
&& (this.getGold() == null ? other.getGold() == null : this.getGold().equals(other.getGold())) && (this.getGold() == null ? other.getGold() == null : this.getGold().equals(other.getGold()))
&& (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus())) && (this.getStatus() == null ? other.getStatus() == null : this.getStatus().equals(other.getStatus()))
&& (this.getOpenId() == null ? other.getOpenId() == null : this.getOpenId().equals(other.getOpenId())) && (this.getOpenId() == null ? other.getOpenId() == null : this.getOpenId().equals(other.getOpenId()))
&& (this.getOpenIdH5() == null ? other.getOpenIdH5() == null : this.getOpenIdH5().equals(other.getOpenIdH5()))
&& (this.getUnionId() == null ? other.getUnionId() == null : this.getUnionId().equals(other.getUnionId()))
&& (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1())) && (this.getExt1() == null ? other.getExt1() == null : this.getExt1().equals(other.getExt1()))
&& (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2())) && (this.getExt2() == null ? other.getExt2() == null : this.getExt2().equals(other.getExt2()))
&& (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3())) && (this.getExt3() == null ? other.getExt3() == null : this.getExt3().equals(other.getExt3()))
@ -241,6 +269,8 @@ public class HighUser extends UserModel implements Serializable {
result = prime * result + ((getGold() == null) ? 0 : getGold().hashCode()); result = prime * result + ((getGold() == null) ? 0 : getGold().hashCode());
result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode()); result = prime * result + ((getStatus() == null) ? 0 : getStatus().hashCode());
result = prime * result + ((getOpenId() == null) ? 0 : getOpenId().hashCode()); result = prime * result + ((getOpenId() == null) ? 0 : getOpenId().hashCode());
result = prime * result + ((getOpenIdH5() == null) ? 0 : getOpenIdH5().hashCode());
result = prime * result + ((getUnionId() == null) ? 0 : getUnionId().hashCode());
result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode()); result = prime * result + ((getExt1() == null) ? 0 : getExt1().hashCode());
result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode()); result = prime * result + ((getExt2() == null) ? 0 : getExt2().hashCode());
result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode()); result = prime * result + ((getExt3() == null) ? 0 : getExt3().hashCode());
@ -265,6 +295,8 @@ public class HighUser extends UserModel implements Serializable {
sb.append(", gold=").append(gold); sb.append(", gold=").append(gold);
sb.append(", status=").append(status); sb.append(", status=").append(status);
sb.append(", openId=").append(openId); sb.append(", openId=").append(openId);
sb.append(", openIdH5=").append(openIdH5);
sb.append(", unionId=").append(unionId);
sb.append(", ext1=").append(ext1); sb.append(", ext1=").append(ext1);
sb.append(", ext2=").append(ext2); sb.append(", ext2=").append(ext2);
sb.append(", ext3=").append(ext3); sb.append(", ext3=").append(ext3);

@ -872,6 +872,146 @@ public class HighUserExample {
return (Criteria) this; return (Criteria) this;
} }
public Criteria andOpenIdH5IsNull() {
addCriterion("open_id_h5 is null");
return (Criteria) this;
}
public Criteria andOpenIdH5IsNotNull() {
addCriterion("open_id_h5 is not null");
return (Criteria) this;
}
public Criteria andOpenIdH5EqualTo(String value) {
addCriterion("open_id_h5 =", value, "openIdH5");
return (Criteria) this;
}
public Criteria andOpenIdH5NotEqualTo(String value) {
addCriterion("open_id_h5 <>", value, "openIdH5");
return (Criteria) this;
}
public Criteria andOpenIdH5GreaterThan(String value) {
addCriterion("open_id_h5 >", value, "openIdH5");
return (Criteria) this;
}
public Criteria andOpenIdH5GreaterThanOrEqualTo(String value) {
addCriterion("open_id_h5 >=", value, "openIdH5");
return (Criteria) this;
}
public Criteria andOpenIdH5LessThan(String value) {
addCriterion("open_id_h5 <", value, "openIdH5");
return (Criteria) this;
}
public Criteria andOpenIdH5LessThanOrEqualTo(String value) {
addCriterion("open_id_h5 <=", value, "openIdH5");
return (Criteria) this;
}
public Criteria andOpenIdH5Like(String value) {
addCriterion("open_id_h5 like", value, "openIdH5");
return (Criteria) this;
}
public Criteria andOpenIdH5NotLike(String value) {
addCriterion("open_id_h5 not like", value, "openIdH5");
return (Criteria) this;
}
public Criteria andOpenIdH5In(List<String> values) {
addCriterion("open_id_h5 in", values, "openIdH5");
return (Criteria) this;
}
public Criteria andOpenIdH5NotIn(List<String> values) {
addCriterion("open_id_h5 not in", values, "openIdH5");
return (Criteria) this;
}
public Criteria andOpenIdH5Between(String value1, String value2) {
addCriterion("open_id_h5 between", value1, value2, "openIdH5");
return (Criteria) this;
}
public Criteria andOpenIdH5NotBetween(String value1, String value2) {
addCriterion("open_id_h5 not between", value1, value2, "openIdH5");
return (Criteria) this;
}
public Criteria andUnionIdIsNull() {
addCriterion("union_id is null");
return (Criteria) this;
}
public Criteria andUnionIdIsNotNull() {
addCriterion("union_id is not null");
return (Criteria) this;
}
public Criteria andUnionIdEqualTo(String value) {
addCriterion("union_id =", value, "unionId");
return (Criteria) this;
}
public Criteria andUnionIdNotEqualTo(String value) {
addCriterion("union_id <>", value, "unionId");
return (Criteria) this;
}
public Criteria andUnionIdGreaterThan(String value) {
addCriterion("union_id >", value, "unionId");
return (Criteria) this;
}
public Criteria andUnionIdGreaterThanOrEqualTo(String value) {
addCriterion("union_id >=", value, "unionId");
return (Criteria) this;
}
public Criteria andUnionIdLessThan(String value) {
addCriterion("union_id <", value, "unionId");
return (Criteria) this;
}
public Criteria andUnionIdLessThanOrEqualTo(String value) {
addCriterion("union_id <=", value, "unionId");
return (Criteria) this;
}
public Criteria andUnionIdLike(String value) {
addCriterion("union_id like", value, "unionId");
return (Criteria) this;
}
public Criteria andUnionIdNotLike(String value) {
addCriterion("union_id not like", value, "unionId");
return (Criteria) this;
}
public Criteria andUnionIdIn(List<String> values) {
addCriterion("union_id in", values, "unionId");
return (Criteria) this;
}
public Criteria andUnionIdNotIn(List<String> values) {
addCriterion("union_id not in", values, "unionId");
return (Criteria) this;
}
public Criteria andUnionIdBetween(String value1, String value2) {
addCriterion("union_id between", value1, value2, "unionId");
return (Criteria) this;
}
public Criteria andUnionIdNotBetween(String value1, String value2) {
addCriterion("union_id not between", value1, value2, "unionId");
return (Criteria) this;
}
public Criteria andExt1IsNull() { public Criteria andExt1IsNull() {
addCriterion("ext_1 is null"); addCriterion("ext_1 is null");
return (Criteria) this; return (Criteria) this;

@ -47,6 +47,13 @@ public interface HighUserService {
**/ **/
HighUser findByOpenId(String openId); HighUser findByOpenId(String openId);
/**
*
* @param unionId
* @return
*/
HighUser findByUnionId(String unionId);
/** /**
* @Author 胡锐 * @Author 胡锐
* @Description 根据手机号 查询用户 * @Description 根据手机号 查询用户

@ -72,7 +72,18 @@ public class HighUserServiceImpl implements HighUserService {
@Override @Override
public HighUser findByOpenId(String openId) { public HighUser findByOpenId(String openId) {
HighUserExample example = new HighUserExample(); HighUserExample example = new HighUserExample();
example.createCriteria().andOpenIdEqualTo(openId); example.createCriteria().andOpenIdEqualTo(openId).andStatusEqualTo(1);
List<HighUser> list = highUserMapper.selectByExample(example);
if (list != null && list.size() > 0) {
return list.get(0);
}
return null;
}
@Override
public HighUser findByUnionId(String unionId) {
HighUserExample example = new HighUserExample();
example.createCriteria().andUnionIdEqualTo(unionId).andStatusEqualTo(1);
List<HighUser> list = highUserMapper.selectByExample(example); List<HighUser> list = highUserMapper.selectByExample(example);
if (list != null && list.size() > 0) { if (list != null && list.size() > 0) {
return list.get(0); return list.get(0);
@ -101,6 +112,9 @@ public class HighUserServiceImpl implements HighUserService {
if (highUser == null) { if (highUser == null) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到用户"); throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "未找到用户");
} }
if (StringUtils.isBlank(highUser.getPhone())) {
throw ErrorHelp.genException(SysCode.System, ErrorCode.COMMON_ERROR, "已绑定手机号,请勿重复绑定");
}
// 查询手机号是否被绑定 // 查询手机号是否被绑定
HighUser user = findByPhone(phone); HighUser user = findByPhone(phone);
@ -114,6 +128,7 @@ public class HighUserServiceImpl implements HighUserService {
user.setHeaderImg(highUser.getHeaderImg()); user.setHeaderImg(highUser.getHeaderImg());
user.setName(highUser.getName()); user.setName(highUser.getName());
user.setOpenId(highUser.getOpenId()); user.setOpenId(highUser.getOpenId());
user.setUnionId(highUser.getUnionId());
highUserMapper.updateByPrimaryKey(user); highUserMapper.updateByPrimaryKey(user);
return user; return user;
} }

Loading…
Cancel
Save