|
@@ -21,6 +21,7 @@ import com.huimv.farm.damsubsidy.mapper.SysUserMapper;
|
|
|
import com.huimv.farm.damsubsidy.service.ISysUserService;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
@@ -48,6 +49,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
private PovertyUserRegistMapper povertyUserRegistMapper;
|
|
|
@Autowired
|
|
|
private BaseVeterStationMapper baseVeterStationMapper;
|
|
|
+ @Autowired
|
|
|
+ private RedisTemplate<String,String> redisTemplate;
|
|
|
|
|
|
@Autowired
|
|
|
private AccountGroupMapper accountGroupMapper;
|
|
@@ -56,22 +59,40 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
public Result loginMultilevel(HttpServletRequest httpServletRequest, Map<String, String> paramsMap) {
|
|
|
//TODO 验证码接口暂时不写,验证码验证接口写在此接口之前,这里默认验证码已经正确!
|
|
|
String phone = paramsMap.get("phone");
|
|
|
- if (!phone.matches("1[3-9]\\d{9}")) {
|
|
|
- return new Result(10001, "手机号格式不正确",false);
|
|
|
+ String code = paramsMap.get("code");
|
|
|
+ //是否存在
|
|
|
+ Boolean aBoolean = redisTemplate.hasKey("xumu:" + phone);
|
|
|
+
|
|
|
+
|
|
|
+ if (!aBoolean) {
|
|
|
+ return new Result(10001, "该手机号未发送验证码或验证码过期!!!", false);
|
|
|
}
|
|
|
+ System.out.println(aBoolean);
|
|
|
+ String s = redisTemplate.opsForValue().get("xumu:" + phone);
|
|
|
+ if (!code.equals(s)) {
|
|
|
+ return new Result(10001, "验证码错误!!", false);
|
|
|
+ } else {
|
|
|
+ System.out.println("登录成功");
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+// if (!phone.matches("1[3-9]\\d{9}")) {
|
|
|
+// return new Result(10001, "手机号格式不正确",false);
|
|
|
+// }
|
|
|
QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("phone", phone);
|
|
|
SysUser sysUser = userMapper.selectOne(queryWrapper);
|
|
|
if (ObjectUtil.isEmpty(sysUser)) {
|
|
|
- return new Result(10004, "用户暂未注册,请注册!",false);
|
|
|
+ return new Result(10004, "用户暂未注册,请注册!", false);
|
|
|
} else {
|
|
|
if (sysUser.getAccoutType() == 1) {
|
|
|
return new Result(ResultCode.SUCCESS, sysUser);
|
|
|
- }else {
|
|
|
+ } else {
|
|
|
return new Result(10002, "未审核或者账号异常!", false);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
@Override
|
|
|
public Result loginMultilevelClient(String accountName, String password) {
|
|
@@ -518,13 +539,4 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
return new Result(ResultCode.SUCCESS,sysUsers);
|
|
|
}
|
|
|
|
|
|
- public static void main(String[] args) {
|
|
|
- String s = "6211621121621121101203";
|
|
|
- if (s.length() == 19) {
|
|
|
- System.out.println(s.substring(10));
|
|
|
- } else {
|
|
|
- System.out.println(s.substring(19));
|
|
|
- }
|
|
|
-
|
|
|
- }
|
|
|
}
|