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