parent
425bc4c457
commit
85029b83f8
|
|
@ -2,6 +2,7 @@ package org.jeecg.modules.system.model;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModel;
|
import io.swagger.annotations.ApiModel;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 登录表单
|
* 登录表单
|
||||||
|
|
@ -9,56 +10,20 @@ import io.swagger.annotations.ApiModelProperty;
|
||||||
* @Author scott
|
* @Author scott
|
||||||
* @since 2019-01-18
|
* @since 2019-01-18
|
||||||
*/
|
*/
|
||||||
|
@Data
|
||||||
@ApiModel(value="登录对象", description="登录对象")
|
@ApiModel(value="登录对象", description="登录对象")
|
||||||
public class SysLoginModel {
|
public class SysLoginModel {
|
||||||
@ApiModelProperty(value = "账号")
|
@ApiModelProperty(value = "账号")
|
||||||
private String username;
|
private String username;
|
||||||
@ApiModelProperty(value = "密码")
|
@ApiModelProperty(value = "密码")
|
||||||
private String password;
|
private String password;
|
||||||
|
@ApiModelProperty(value = "旧密码")
|
||||||
|
private String oldPassword;
|
||||||
@ApiModelProperty(value = "验证码")
|
@ApiModelProperty(value = "验证码")
|
||||||
private String captcha;
|
private String captcha;
|
||||||
@ApiModelProperty(value = "验证码key")
|
@ApiModelProperty(value = "验证码key")
|
||||||
private String checkKey;
|
private String checkKey;
|
||||||
|
|
||||||
@ApiModelProperty(value = "手机号")
|
@ApiModelProperty(value = "手机号")
|
||||||
private String phone;
|
private String phone;
|
||||||
public String getUsername() {
|
|
||||||
return username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUsername(String username) {
|
|
||||||
this.username = username;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPassword() {
|
|
||||||
return password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPassword(String password) {
|
|
||||||
this.password = password;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCaptcha() {
|
|
||||||
return captcha;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCaptcha(String captcha) {
|
|
||||||
this.captcha = captcha;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getCheckKey() {
|
|
||||||
return checkKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCheckKey(String checkKey) {
|
|
||||||
this.checkKey = checkKey;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getPhone() {
|
|
||||||
return phone;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setPhone(String phone) {
|
|
||||||
this.phone = phone;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,15 @@
|
||||||
package org.jeecg.modules.web.controller;
|
package org.jeecg.modules.web.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.shiro.SecurityUtils;
|
||||||
import org.jeecg.common.api.vo.Result;
|
import org.jeecg.common.api.vo.Result;
|
||||||
import org.jeecg.common.constant.CommonConstant;
|
import org.jeecg.common.constant.CommonConstant;
|
||||||
import org.jeecg.common.util.IpUtils;
|
import org.jeecg.common.system.vo.LoginUser;
|
||||||
import org.jeecg.common.util.PasswordUtil;
|
import org.jeecg.common.util.*;
|
||||||
import org.jeecg.common.util.RedisUtil;
|
|
||||||
import org.jeecg.common.util.oConvertUtils;
|
|
||||||
import org.jeecg.modules.mini.wx.model.WeXinConfig;
|
import org.jeecg.modules.mini.wx.model.WeXinConfig;
|
||||||
import org.jeecg.modules.system.entity.SysUser;
|
import org.jeecg.modules.system.entity.SysUser;
|
||||||
import org.jeecg.modules.system.model.SysLoginModel;
|
import org.jeecg.modules.system.model.SysLoginModel;
|
||||||
|
|
@ -20,6 +20,8 @@ import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ZhouWenTao
|
* @author ZhouWenTao
|
||||||
|
|
@ -80,6 +82,37 @@ public class WebUserController {
|
||||||
//return Result.OK("注册成功!");
|
//return Result.OK("注册成功!");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@RequestMapping(value = "passwordChanger",method = RequestMethod.POST)
|
||||||
|
@ApiOperation(value = "更改密码")
|
||||||
|
public Result<?> passwordChanger(@RequestBody SysLoginModel sysLoginModel, HttpServletRequest request){
|
||||||
|
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
|
||||||
|
String oldPassword = sysLoginModel.getOldPassword();//输入的旧密码
|
||||||
|
String newPassword = sysLoginModel.getPassword();//输入的新密码
|
||||||
|
AssertUtils.notEmpty(oldPassword, "请输入旧密码!");
|
||||||
|
AssertUtils.notEmpty(newPassword, "请输入新密码!");
|
||||||
|
//先判断之前的密码是否正确
|
||||||
|
String username = loginUser.getUsername();//用户名
|
||||||
|
String phone = loginUser.getPhone();//当前用户手机号
|
||||||
|
SysUser sysUser = this.sysUserService.getOne(new LambdaQueryWrapper<SysUser>().eq(SysUser::getUsername,username).eq(SysUser::getPhone,phone));
|
||||||
|
String password = sysUser.getPassword();//当前用户密码
|
||||||
|
String salt = sysUser.getSalt();//密码盐
|
||||||
|
String oldEncryptPassword = PasswordUtil.encrypt(salt, oldPassword, salt);
|
||||||
|
if (!oldEncryptPassword.equals(password)) {
|
||||||
|
return Result.error("旧密码不正确");
|
||||||
|
}
|
||||||
|
//生成新的密码密文
|
||||||
|
try {
|
||||||
|
String newEncryptPassword = PasswordUtil.encrypt(salt, newPassword, salt);
|
||||||
|
LambdaUpdateWrapper<SysUser> updateWrapper = new LambdaUpdateWrapper<>();
|
||||||
|
updateWrapper.eq(SysUser::getId,sysUser.getId());
|
||||||
|
updateWrapper.set(SysUser::getPassword,newEncryptPassword);
|
||||||
|
sysUserService.update(updateWrapper);
|
||||||
|
}catch (Exception e){
|
||||||
|
return Result.error(String.format("更改密码失败,请联系管理员[%s]",new Date().getTime()));
|
||||||
|
}
|
||||||
|
return Result.OK("更改成功");
|
||||||
|
//return Result.OK("注册成功!");
|
||||||
|
}
|
||||||
|
|
||||||
@RequestMapping(value = "/login/passwd", method = RequestMethod.POST)
|
@RequestMapping(value = "/login/passwd", method = RequestMethod.POST)
|
||||||
@ApiOperation(value = "手机号密码登录")
|
@ApiOperation(value = "手机号密码登录")
|
||||||
|
|
|
||||||
|
|
@ -290,6 +290,9 @@ public class YxHistoryMajorEnrollController extends JeecgController<YxHistoryMaj
|
||||||
index++;
|
index++;
|
||||||
schoolCode = yxHistoryMajorEnroll.getSchoolCode();//学校代码
|
schoolCode = yxHistoryMajorEnroll.getSchoolCode();//学校代码
|
||||||
schoolName = yxHistoryMajorEnroll.getSchoolName();//学校名称
|
schoolName = yxHistoryMajorEnroll.getSchoolName();//学校名称
|
||||||
|
if(schoolCode.equals("6170")){
|
||||||
|
System.out.println("aaaa");
|
||||||
|
}
|
||||||
majorName = yxHistoryMajorEnroll.getMajorName();//专业名称
|
majorName = yxHistoryMajorEnroll.getMajorName();//专业名称
|
||||||
batch = yxHistoryMajorEnroll.getBatch();//批次
|
batch = yxHistoryMajorEnroll.getBatch();//批次
|
||||||
year = yxHistoryMajorEnroll.getYear();
|
year = yxHistoryMajorEnroll.getYear();
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue