|
@@ -24,7 +24,10 @@ import com.qmth.sop.business.util.AuthUtil;
|
|
|
import com.qmth.sop.common.contant.SpringContextHolder;
|
|
|
import com.qmth.sop.common.contant.SystemConstant;
|
|
|
import com.qmth.sop.common.enums.*;
|
|
|
-import com.qmth.sop.common.util.*;
|
|
|
+import com.qmth.sop.common.util.IpUtil;
|
|
|
+import com.qmth.sop.common.util.ResultUtil;
|
|
|
+import com.qmth.sop.common.util.ServletUtil;
|
|
|
+import com.qmth.sop.common.util.SessionUtil;
|
|
|
import org.springframework.dao.DuplicateKeyException;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
@@ -308,7 +311,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
} else {//修改用户
|
|
|
SysUser dbUser = this.getById(sysUser.getId());
|
|
|
Optional.ofNullable(dbUser).orElseThrow(() -> ExceptionResultEnum.USER_NO_EXISTS.exception());
|
|
|
- sysUser.setPasswordInfo(sysUser.getMobileNumber());
|
|
|
|
|
|
List<SysUserRole> sysUserRoleList = commonCacheService.userRolePrivilegeCache(sysUser.getId());
|
|
|
List<Long> userRolesList = Arrays.asList(sysUser.getRoleIds());
|
|
@@ -320,7 +322,6 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
.set(SysUser::getRealName, sysUser.getRealName())
|
|
|
.set(SysUser::getCode, sysUser.getCode())
|
|
|
.set(SysUser::getMobileNumber, sysUser.getMobileNumber())
|
|
|
- .set(SysUser::getPassword, sysUser.getPassword())
|
|
|
.set(SysUser::getGender, sysUser.getGender())
|
|
|
.set(SysUser::getOrgId, sysUser.getOrgId())
|
|
|
.set(SysUser::getUpdateId, requestUser.getId())
|
|
@@ -437,6 +438,34 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
return success;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 初始化用户密码
|
|
|
+ *
|
|
|
+ * @param sysUser
|
|
|
+ * @return
|
|
|
+ * @throws NoSuchAlgorithmException
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional
|
|
|
+ public Boolean initPassword(SysUser sysUser) throws NoSuchAlgorithmException {
|
|
|
+ Optional.ofNullable(sysUser).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("参数不能为空"));
|
|
|
+ Optional.ofNullable(sysUser.getId()).orElseThrow(() -> ExceptionResultEnum.ERROR.exception("id不能为空"));
|
|
|
+
|
|
|
+ SysUser sysUserDb = this.getById(sysUser.getId());
|
|
|
+ Optional.ofNullable(sysUserDb).orElseThrow(() -> ExceptionResultEnum.USER_NO_EXISTS.exception());
|
|
|
+
|
|
|
+ SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
+ sysUserDb.setPasswordInfo(sysUserDb.getMobileNumber());
|
|
|
+ sysUserDb.updateInfo(requestUser.getId());
|
|
|
+ boolean success = this.saveOrUpdate(sysUserDb);
|
|
|
+ if (success) {
|
|
|
+ commonCacheService.updateUserCache(sysUser.getId());
|
|
|
+ //修改密码后,需要踢下线重新登录
|
|
|
+ this.removeUserInfo(sysUser.getId(), true);
|
|
|
+ }
|
|
|
+ return success;
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 获取工作台待办
|
|
|
*
|