fix bug
This commit is contained in:
parent
cfaae3c17b
commit
cf5af4d630
|
|
@ -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
|
||||
@PostMapping(value = "/loginByPassword")
|
||||
|
|
|
|||
|
|
@ -50,7 +50,7 @@ public class TbUserAppController {
|
|||
@Transactional(rollbackFor = Exception.class)
|
||||
public Result<String> drawData()
|
||||
{
|
||||
for (int i = 1; i< 40; i++){
|
||||
for (int i = 101; i< 150; i++){
|
||||
try {
|
||||
Thread.sleep(3000L);
|
||||
log.info("请求的url路径:{}", SZ_URL_PREFIX + i);
|
||||
|
|
|
|||
|
|
@ -21,6 +21,8 @@ import io.swagger.annotations.ApiOperation;
|
|||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
|
|
@ -95,6 +97,20 @@ public class TbUserSingleAppController {
|
|||
@RequestParam("pageNum") int pageNum,
|
||||
@RequestParam("pageSize") int 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.forEach(model->{
|
||||
if(model.getBirthday() != null){
|
||||
|
|
|
|||
|
|
@ -9,4 +9,6 @@ public interface LoginService {
|
|||
|
||||
LoginResp loginByPassword(LoginReq loginReq) throws Exception;
|
||||
|
||||
void updatePasswordByPhone(LoginReq loginReq) throws Exception;
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -82,6 +82,25 @@ public class LoginServiceImpl implements LoginService {
|
|||
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
|
||||
public LoginResp loginByPassword(LoginReq loginReq) throws Exception{
|
||||
LoginResp resp = new LoginResp();
|
||||
|
|
|
|||
|
|
@ -64,11 +64,35 @@ public class TbUserSingle extends BaseEntity
|
|||
@ApiModelProperty(value = "年龄")
|
||||
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) */
|
||||
@Excel(name = "身高(单位cm)")
|
||||
@ApiModelProperty(value = "身高(单位cm)")
|
||||
private Long height;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "身高-最小")
|
||||
private Long heightStart;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "身高-最大")
|
||||
private Long heightEnd;
|
||||
|
||||
/** 体重(单位KG) */
|
||||
@Excel(name = "体重(单位KG)")
|
||||
@ApiModelProperty(value = "体重(单位KG)")
|
||||
|
|
@ -99,11 +123,23 @@ public class TbUserSingle extends BaseEntity
|
|||
@ApiModelProperty(value = "收入(元/年)")
|
||||
private Long income;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "收入-最小")
|
||||
private Long incomeStart;
|
||||
|
||||
@TableField(exist = false)
|
||||
@ApiModelProperty(value = "收入-最大")
|
||||
private Long incomeEnd;
|
||||
|
||||
/** 籍贯 */
|
||||
@Excel(name = "籍贯")
|
||||
@ApiModelProperty(value = "籍贯")
|
||||
private String nativePlace;
|
||||
|
||||
@Excel(name = "工作地")
|
||||
@ApiModelProperty(value = "工作地")
|
||||
private String workPlace;
|
||||
|
||||
/** 省份 */
|
||||
@Excel(name = "省份")
|
||||
@ApiModelProperty(value = "省份")
|
||||
|
|
|
|||
|
|
@ -20,6 +20,7 @@
|
|||
<result property="job" column="job" />
|
||||
<result property="income" column="income" />
|
||||
<result property="nativePlace" column="native_place" />
|
||||
<result property="workPlace" column="work_place " />
|
||||
<result property="provinceId" column="province_id" />
|
||||
<result property="cityId" column="city_id" />
|
||||
<result property="houseProperty" column="house_property" />
|
||||
|
|
@ -34,7 +35,7 @@
|
|||
</resultMap>
|
||||
|
||||
<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>
|
||||
|
||||
<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="sex != null "> and sex = #{sex}</if>
|
||||
<if test="birthday != null "> and birthday = #{birthday}</if>
|
||||
<if test="birthdayStart != null"><!-- 开始时间检索 -->
|
||||
AND birthday >= #{birthdayStart}
|
||||
</if>
|
||||
<if test="birthdayEnd != null"><!-- 结束时间检索 -->
|
||||
AND birthday <= #{birthdayEnd}
|
||||
</if>
|
||||
<if test="height != null "> and height = #{height}</if>
|
||||
<if test="heightStart != null "> and height >= #{heightStart}</if>
|
||||
<if test="heightEnd != null "> and height <= #{heightEnd}</if>
|
||||
<if test="weight != null "> and weight = #{weight}</if>
|
||||
<if test="education != null "> and education = #{education}</if>
|
||||
<if test="school != null and school != ''"> and school = #{school}</if>
|
||||
<if test="marriage != null "> and marriage = #{marriage}</if>
|
||||
<if test="job != null and job != ''"> and job = #{job}</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 >= #{incomeStart}</if>
|
||||
<if test="incomeEnd != null "> and income <= #{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="cityId != null "> and city_id = #{cityId}</if>
|
||||
<if test="houseProperty != null "> and house_property = #{houseProperty}</if>
|
||||
|
|
|
|||
Loading…
Reference in New Issue