This commit is contained in:
kuang.yife 2024-01-19 15:16:07 +08:00
parent cfaae3c17b
commit cf5af4d630
7 changed files with 102 additions and 3 deletions

View File

@ -37,6 +37,20 @@ public class LoginController {
} }
//密码登陆
@ResponseBody
@PostMapping(value = "/updatePasswordByPhone")
@ApiOperation(value = "验证码找回密码", response = LoginReq.class)
public Result<String> updatePasswordByPhone(@RequestBody @NotNull LoginReq loginReq){
try {
loginService.updatePasswordByPhone(loginReq);
return Result.success();
}catch (Exception e){
return Result.error(e.getMessage());
}
}
// 手机号验证码登陆 // 手机号验证码登陆
@ResponseBody @ResponseBody
@PostMapping(value = "/loginByPassword") @PostMapping(value = "/loginByPassword")

View File

@ -50,7 +50,7 @@ public class TbUserAppController {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public Result<String> drawData() public Result<String> drawData()
{ {
for (int i = 1; i< 40; i++){ for (int i = 101; i< 150; i++){
try { try {
Thread.sleep(3000L); Thread.sleep(3000L);
log.info("请求的url路径:{}", SZ_URL_PREFIX + i); log.info("请求的url路径:{}", SZ_URL_PREFIX + i);

View File

@ -21,6 +21,8 @@ import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import java.util.Calendar;
import java.util.Date;
import java.util.List; import java.util.List;
/** /**
@ -95,6 +97,20 @@ public class TbUserSingleAppController {
@RequestParam("pageNum") int pageNum, @RequestParam("pageNum") int pageNum,
@RequestParam("pageSize") int pageSize) { @RequestParam("pageSize") int pageSize) {
PageHelper.startPage(pageNum, pageSize); PageHelper.startPage(pageNum, pageSize);
// 18
if(tbUserSingle.getAgeStart() != null){
Calendar calendar = DateUtil.calendar(new Date());
calendar.add(Calendar.YEAR, -1 * tbUserSingle.getAgeStart());
// 2006
tbUserSingle.setBirthdayEnd(calendar.getTime());
}
// 30
if(tbUserSingle.getAgeEnd() != null){
Calendar calendar = DateUtil.calendar(new Date());
calendar.add(Calendar.YEAR, -1 * tbUserSingle.getAgeEnd());
// 1994
tbUserSingle.setBirthdayStart(calendar.getTime());
}
List<TbUserSingle> list = tbUserSingleService.selectTbUserSingleList(tbUserSingle); List<TbUserSingle> list = tbUserSingleService.selectTbUserSingleList(tbUserSingle);
list.forEach(model->{ list.forEach(model->{
if(model.getBirthday() != null){ if(model.getBirthday() != null){

View File

@ -9,4 +9,6 @@ public interface LoginService {
LoginResp loginByPassword(LoginReq loginReq) throws Exception; LoginResp loginByPassword(LoginReq loginReq) throws Exception;
void updatePasswordByPhone(LoginReq loginReq) throws Exception;
} }

View File

@ -82,6 +82,25 @@ public class LoginServiceImpl implements LoginService {
return resp; return resp;
} }
@Override
public void updatePasswordByPhone(LoginReq loginReq) throws Exception {
String alreadyCode = stringRedisTemplate.opsForValue().get(RedisConstants.SMS_CODE_PREFIX+loginReq.getMobile());
if(StringUtils.isEmpty(alreadyCode)){
throw new Exception("验证码已过期!");
}
if(!alreadyCode.equals(loginReq.getAuthCode())){
throw new Exception("短信验证码错误!");
}
TbUser tbUser = tbUserService.lambdaQuery().eq(TbUser::getMobile, loginReq.getMobile()).one();
//如果用户-- 则注册新用户,只带入用户的手机号+默认密码123456
if(tbUser != null){
if(StringUtils.isNotEmpty(loginReq.getPassword())){
tbUser.setPassword(DigestUtils.md5Hex(loginReq.getPassword()));
}
tbUserService.updateById(tbUser);
}
}
@Override @Override
public LoginResp loginByPassword(LoginReq loginReq) throws Exception{ public LoginResp loginByPassword(LoginReq loginReq) throws Exception{
LoginResp resp = new LoginResp(); LoginResp resp = new LoginResp();

View File

@ -64,11 +64,35 @@ public class TbUserSingle extends BaseEntity
@ApiModelProperty(value = "年龄") @ApiModelProperty(value = "年龄")
private Integer age; private Integer age;
@TableField(exist = false)
@ApiModelProperty(value = "年龄-最小")
private Integer ageStart;
@TableField(exist = false)
@ApiModelProperty(hidden = true)
private Date birthdayStart;
@TableField(exist = false)
@ApiModelProperty(value = "年龄-最大")
private Integer ageEnd;
@TableField(exist = false)
@ApiModelProperty(hidden = true)
private Date birthdayEnd;
/** 身高(单位cm) */ /** 身高(单位cm) */
@Excel(name = "身高(单位cm)") @Excel(name = "身高(单位cm)")
@ApiModelProperty(value = "身高(单位cm)") @ApiModelProperty(value = "身高(单位cm)")
private Long height; private Long height;
@TableField(exist = false)
@ApiModelProperty(value = "身高-最小")
private Long heightStart;
@TableField(exist = false)
@ApiModelProperty(value = "身高-最大")
private Long heightEnd;
/** 体重(单位KG) */ /** 体重(单位KG) */
@Excel(name = "体重(单位KG)") @Excel(name = "体重(单位KG)")
@ApiModelProperty(value = "体重(单位KG)") @ApiModelProperty(value = "体重(单位KG)")
@ -99,11 +123,23 @@ public class TbUserSingle extends BaseEntity
@ApiModelProperty(value = "收入(元/年)") @ApiModelProperty(value = "收入(元/年)")
private Long income; private Long income;
@TableField(exist = false)
@ApiModelProperty(value = "收入-最小")
private Long incomeStart;
@TableField(exist = false)
@ApiModelProperty(value = "收入-最大")
private Long incomeEnd;
/** 籍贯 */ /** 籍贯 */
@Excel(name = "籍贯") @Excel(name = "籍贯")
@ApiModelProperty(value = "籍贯") @ApiModelProperty(value = "籍贯")
private String nativePlace; private String nativePlace;
@Excel(name = "工作地")
@ApiModelProperty(value = "工作地")
private String workPlace;
/** 省份 */ /** 省份 */
@Excel(name = "省份") @Excel(name = "省份")
@ApiModelProperty(value = "省份") @ApiModelProperty(value = "省份")

View File

@ -20,6 +20,7 @@
<result property="job" column="job" /> <result property="job" column="job" />
<result property="income" column="income" /> <result property="income" column="income" />
<result property="nativePlace" column="native_place" /> <result property="nativePlace" column="native_place" />
<result property="workPlace" column="work_place " />
<result property="provinceId" column="province_id" /> <result property="provinceId" column="province_id" />
<result property="cityId" column="city_id" /> <result property="cityId" column="city_id" />
<result property="houseProperty" column="house_property" /> <result property="houseProperty" column="house_property" />
@ -34,7 +35,7 @@
</resultMap> </resultMap>
<sql id="selectTbUserSingleVo"> <sql id="selectTbUserSingleVo">
select id, user_id, nick_name, real_name, sex, status, birthday, height, weight, education, school, marriage, job, income, native_place, province_id, city_id, house_property, car_property, self_introduce, family_background, hobby, choosing_standard, create_time, update_time, remark from tb_user_single select id, user_id, nick_name, real_name, sex, status, birthday, height, weight, education, school, marriage, job, income, native_place, work_place, province_id, city_id, house_property, car_property, self_introduce, family_background, hobby, choosing_standard, create_time, update_time, remark from tb_user_single
</sql> </sql>
<select id="selectTbUserSingleList" parameterType="TbUserSingle" resultMap="TbUserSingleResult"> <select id="selectTbUserSingleList" parameterType="TbUserSingle" resultMap="TbUserSingleResult">
@ -45,14 +46,25 @@
<if test="realName != null and realName != ''"> and real_name like concat('%', #{realName}, '%')</if> <if test="realName != null and realName != ''"> and real_name like concat('%', #{realName}, '%')</if>
<if test="sex != null "> and sex = #{sex}</if> <if test="sex != null "> and sex = #{sex}</if>
<if test="birthday != null "> and birthday = #{birthday}</if> <if test="birthday != null "> and birthday = #{birthday}</if>
<if test="birthdayStart != null"><!-- 开始时间检索 -->
AND birthday &gt;= #{birthdayStart}
</if>
<if test="birthdayEnd != null"><!-- 结束时间检索 -->
AND birthday &lt;= #{birthdayEnd}
</if>
<if test="height != null "> and height = #{height}</if> <if test="height != null "> and height = #{height}</if>
<if test="heightStart != null "> and height &gt;= #{heightStart}</if>
<if test="heightEnd != null "> and height &lt;= #{heightEnd}</if>
<if test="weight != null "> and weight = #{weight}</if> <if test="weight != null "> and weight = #{weight}</if>
<if test="education != null "> and education = #{education}</if> <if test="education != null "> and education = #{education}</if>
<if test="school != null and school != ''"> and school = #{school}</if> <if test="school != null and school != ''"> and school = #{school}</if>
<if test="marriage != null "> and marriage = #{marriage}</if> <if test="marriage != null "> and marriage = #{marriage}</if>
<if test="job != null and job != ''"> and job = #{job}</if> <if test="job != null and job != ''"> and job = #{job}</if>
<if test="income != null "> and income = #{income}</if> <if test="income != null "> and income = #{income}</if>
<if test="nativePlace != null and nativePlace != ''"> and native_place = #{nativePlace}</if> <if test="incomeStart != null "> and income &gt;= #{incomeStart}</if>
<if test="incomeEnd != null "> and income &lt;= #{incomeEnd}</if>
<if test="nativePlace != null and nativePlace != ''"> and native_place like concat('%', #{nativePlace}, '%')</if>
<if test="workPlace != null and workPlace != ''"> and work_place like concat('%', #{workPlace}, '%')</if>
<if test="provinceId != null "> and province_id = #{provinceId}</if> <if test="provinceId != null "> and province_id = #{provinceId}</if>
<if test="cityId != null "> and city_id = #{cityId}</if> <if test="cityId != null "> and city_id = #{cityId}</if>
<if test="houseProperty != null "> and house_property = #{houseProperty}</if> <if test="houseProperty != null "> and house_property = #{houseProperty}</if>