修改了用户修改密码的接口,添加了部门字段信息,修改了提交工时的接口,将提交的时间卡在24小时
This commit is contained in:
parent
fd3cfa03f7
commit
8886bb2eb8
@ -223,13 +223,14 @@ public class SysUserController {
|
|||||||
String oldPassword = (String) map.get("oldPassword");
|
String oldPassword = (String) map.get("oldPassword");
|
||||||
String newPassword = (String) map.get("newPassword");
|
String newPassword = (String) map.get("newPassword");
|
||||||
String confirmPassword = (String) map.get("confirmPassword");
|
String confirmPassword = (String) map.get("confirmPassword");
|
||||||
|
String userDepartment = (String) map.get("userDepartment");
|
||||||
// 验证token
|
// 验证token
|
||||||
String tokenUserName = TokenUtil.getTokenUserName(token);
|
String tokenUserName = TokenUtil.getTokenUserName(token);
|
||||||
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
|
SysUserEntity sysUserEntity = sysUserDao.selectByUserName(tokenUserName);
|
||||||
if(sysUserEntity == null){
|
if(sysUserEntity == null){
|
||||||
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale);
|
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale);
|
||||||
}
|
}
|
||||||
return sysUserService.updatePassword(oldPassword,newPassword,confirmPassword,sysUserEntity);
|
return sysUserService.updatePassword(oldPassword,newPassword,confirmPassword,sysUserEntity,userDepartment);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -125,10 +125,20 @@ public interface SysUserDao extends JpaRepository<SysUserEntity,Integer> {
|
|||||||
* 用户修改密码
|
* 用户修改密码
|
||||||
* @param userId
|
* @param userId
|
||||||
* @param newPassword
|
* @param newPassword
|
||||||
|
* @param userDepartment
|
||||||
|
*/
|
||||||
|
@Query(value = "update sys_user set password = ?2, user_department = ?3 where id = ?1",nativeQuery = true)
|
||||||
|
@Modifying(clearAutomatically=true)
|
||||||
|
void updatePassword(Integer userId,String newPassword,String userDepartment);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 管理员修改用户密码
|
||||||
|
* @param userId
|
||||||
|
* @param newPassword
|
||||||
*/
|
*/
|
||||||
@Query(value = "update sys_user set password = ?2 where id = ?1",nativeQuery = true)
|
@Query(value = "update sys_user set password = ?2 where id = ?1",nativeQuery = true)
|
||||||
@Modifying(clearAutomatically=true)
|
@Modifying(clearAutomatically=true)
|
||||||
void updatePassword(Integer userId,String newPassword);
|
void updatePasswords(Integer userId,String newPassword);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 根据id查询用户的信息
|
* 根据id查询用户的信息
|
||||||
|
@ -87,7 +87,7 @@ public interface SysUserService {
|
|||||||
* @param sysUserEntity
|
* @param sysUserEntity
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
String updatePassword(String oldPassword,String newPassword,String confirmPassword,SysUserEntity sysUserEntity);
|
String updatePassword(String oldPassword,String newPassword,String confirmPassword,SysUserEntity sysUserEntity,String userDepartment);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 管理员修改用户的密码
|
* 管理员修改用户的密码
|
||||||
|
@ -196,7 +196,7 @@ public class SysUserServiceImpl implements SysUserService {
|
|||||||
*/
|
*/
|
||||||
@Transactional(rollbackFor=Exception.class)
|
@Transactional(rollbackFor=Exception.class)
|
||||||
@Override
|
@Override
|
||||||
public String updatePassword(String oldPassword, String newPassword, String confirmPassword, SysUserEntity sysUserEntity) {
|
public String updatePassword(String oldPassword, String newPassword, String confirmPassword, SysUserEntity sysUserEntity,String userDepartment) {
|
||||||
Locale locale = LocaleContextHolder.getLocale();
|
Locale locale = LocaleContextHolder.getLocale();
|
||||||
String oldFrontPassword = encry256(oldPassword + sysUserEntity.getSalt());
|
String oldFrontPassword = encry256(oldPassword + sysUserEntity.getSalt());
|
||||||
if(!oldFrontPassword.equals(sysUserEntity.getPassword())){
|
if(!oldFrontPassword.equals(sysUserEntity.getPassword())){
|
||||||
@ -206,8 +206,8 @@ public class SysUserServiceImpl implements SysUserService {
|
|||||||
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"两次密码输入不一致",locale);
|
return outputEncapsulationObject(PromptMessageEnum.PROCESS_FAIL,"两次密码输入不一致",locale);
|
||||||
}
|
}
|
||||||
String newAfterPassword = encry256(newPassword + sysUserEntity.getSalt());
|
String newAfterPassword = encry256(newPassword + sysUserEntity.getSalt());
|
||||||
sysUserDao.updatePassword(sysUserEntity.getId(),newAfterPassword);
|
sysUserDao.updatePassword(sysUserEntity.getId(),newAfterPassword,userDepartment);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"密码修改成功",locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"修改成功",locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -226,8 +226,8 @@ public class SysUserServiceImpl implements SysUserService {
|
|||||||
}
|
}
|
||||||
SysUserEntity sysUserEntity = sysUserDao.selectByUserId(userId);
|
SysUserEntity sysUserEntity = sysUserDao.selectByUserId(userId);
|
||||||
String newAfterPassword = encry256(newPassword + sysUserEntity.getSalt());
|
String newAfterPassword = encry256(newPassword + sysUserEntity.getSalt());
|
||||||
sysUserDao.updatePassword(userId,newAfterPassword);
|
sysUserDao.updatePasswords(userId,newAfterPassword);
|
||||||
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"密码修改成功",locale);
|
return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"修改成功",locale);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -60,6 +60,9 @@ public class WorkHourRecordServiceImpl implements WorkHourRecordService {
|
|||||||
if(sysUserEntity == null){
|
if(sysUserEntity == null){
|
||||||
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale);
|
return outputEncapsulationObject(PromptMessageEnum.USER_LOGIN_ERROR,"您还没有注册登录,请先注册登录",locale);
|
||||||
}
|
}
|
||||||
|
if(workRecordQo.getWorkHour() > 24){
|
||||||
|
return outputEncapsulationObject(PromptMessageEnum.DATA_WRONG,"工时不能超过24小时,请重新填写",locale);
|
||||||
|
}
|
||||||
WorkHourRecord workHourRecord = new WorkHourRecord();
|
WorkHourRecord workHourRecord = new WorkHourRecord();
|
||||||
workHourRecord.setWorkContent(workRecordQo.getWorkContent());
|
workHourRecord.setWorkContent(workRecordQo.getWorkContent());
|
||||||
workHourRecord.setWorkHour(workRecordQo.getWorkHour());
|
workHourRecord.setWorkHour(workRecordQo.getWorkHour());
|
||||||
|
Loading…
Reference in New Issue
Block a user