|
@@ -131,7 +131,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public boolean saveUser(UserSaveParams userSaveParams) {
|
|
|
+ public boolean saveUser(UserSaveParams userSaveParams) throws IllegalAccessException {
|
|
|
SysUser requestUser = (SysUser) ServletUtil.getRequestUser();
|
|
|
Long oldId = userSaveParams.getId();
|
|
|
Set<Long> dbRoleIdSet = new HashSet<>();
|
|
@@ -144,9 +144,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
Long upUserId = saveUserCommon(userSaveParams, null);
|
|
|
if (SystemConstant.longNotNull(upUserId)) {
|
|
|
result = true;
|
|
|
- List<PushUserTrack> pushUserTrackList = pushUserTrackService.createPushTrackUser(dbRoleIdSet,currentRoleIdSet,upUserId,this.getById(upUserId).getEnable(),requestUser.getId());
|
|
|
+ List<PushUserTrack> pushUserTrackList = pushUserTrackService.createPushTrackUser(dbRoleIdSet, currentRoleIdSet, upUserId, this.getById(upUserId).getEnable(), requestUser.getId());
|
|
|
List<UserPushParam> userPushParamList = pushUserTrackService.analyzeUserPushSpecialPrivilege(pushUserTrackList);
|
|
|
- if (userPushParamList != null && userPushParamList.size() > 0){
|
|
|
+ if (userPushParamList != null && userPushParamList.size() > 0) {
|
|
|
this.userPushService(userPushParamList, requestUser.getId());
|
|
|
}
|
|
|
}
|
|
@@ -166,7 +166,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
commonService.removeUserInfo(user.getId(), true);
|
|
|
}
|
|
|
if (success) {
|
|
|
- this.analyzeUserEnableSpecialPrivilege(user.getId(), user.getEnable(),requestUser.getId());
|
|
|
+ this.analyzeUserEnableSpecialPrivilege(user.getId(), user.getEnable(), requestUser.getId());
|
|
|
}
|
|
|
return success;
|
|
|
}
|
|
@@ -664,11 +664,11 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
/**
|
|
|
* 过滤拥有审核权限的人
|
|
|
*
|
|
|
- * @param schoolId schoolId
|
|
|
- * @param orgIds orgIds
|
|
|
- * @param filter filter
|
|
|
+ * @param schoolId schoolId
|
|
|
+ * @param orgIds orgIds
|
|
|
+ * @param filter filter
|
|
|
* @param approveName approveName
|
|
|
- * @param realName realName
|
|
|
+ * @param realName realName
|
|
|
* @return return
|
|
|
*/
|
|
|
@Override
|
|
@@ -728,9 +728,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
if (SystemConstant.longNotNull(upUserId)) {
|
|
|
|
|
|
Set<Long> currentRoleIdSet = new HashSet<>(Arrays.asList(userSaveParams.getRoleIds()));
|
|
|
- List<PushUserTrack> pushUserTrackList = pushUserTrackService.createPushTrackUser(oldRoleIdSet,currentRoleIdSet,upUserId,true,requestUser.getId());
|
|
|
+ List<PushUserTrack> pushUserTrackList = pushUserTrackService.createPushTrackUser(oldRoleIdSet, currentRoleIdSet, upUserId, true, requestUser.getId());
|
|
|
List<UserPushParam> userPushParamCell = pushUserTrackService.analyzeUserPushSpecialPrivilege(pushUserTrackList);
|
|
|
- if (userPushParamCell != null && userPushParamCell.size() > 0){
|
|
|
+ if (userPushParamCell != null && userPushParamCell.size() > 0) {
|
|
|
userPushParamList.addAll(userPushParamCell);
|
|
|
}
|
|
|
}
|
|
@@ -769,7 +769,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
* 获取命题审批人
|
|
|
*
|
|
|
* @param courseCode courseCode
|
|
|
- * @param realName realName
|
|
|
+ * @param realName realName
|
|
|
* @return return
|
|
|
*/
|
|
|
@Override
|
|
@@ -792,7 +792,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
* 获取教研室主任审批人
|
|
|
*
|
|
|
* @param courseCode courseCode
|
|
|
- * @param realName realName
|
|
|
+ * @param realName realName
|
|
|
* @return return
|
|
|
*/
|
|
|
@Override
|
|
@@ -821,7 +821,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
/**
|
|
|
* 获取院长审批人
|
|
|
*
|
|
|
- * @param orgIds orgIds
|
|
|
+ * @param orgIds orgIds
|
|
|
* @param realName realName
|
|
|
* @return return
|
|
|
*/
|
|
@@ -847,9 +847,9 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
/**
|
|
|
* 获取同级别下一级审批人
|
|
|
*
|
|
|
- * @param courseCode courseCode
|
|
|
- * @param orgIds orgIds
|
|
|
- * @param realName realName
|
|
|
+ * @param courseCode courseCode
|
|
|
+ * @param orgIds orgIds
|
|
|
+ * @param realName realName
|
|
|
* @param flowApproveNameEnum flowApproveNameEnum
|
|
|
* @return return
|
|
|
*/
|
|
@@ -940,21 +940,21 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public boolean userPushService(List<UserPushParam> userPushParamList, Long requestUserId) {
|
|
|
+ public boolean userPushService(List<UserPushParam> userPushParamList, Long requestUserId) throws IllegalAccessException {
|
|
|
SysUser requestUser = this.getById(requestUserId);
|
|
|
- if (Objects.isNull(requestUser)){
|
|
|
+ if (Objects.isNull(requestUser)) {
|
|
|
log.error("未找到请求用户信息 requestUserId = " + requestUserId);
|
|
|
throw ExceptionResultEnum.ERROR.exception("未找到请求用户信息");
|
|
|
}
|
|
|
boolean result = true;
|
|
|
for (UserPushParam userPushParam : userPushParamList) {
|
|
|
- boolean syncResult = stmmsUtils.syncUser(userPushParam, requestUser.getSchoolId());
|
|
|
+ boolean syncResult = stmmsUtils.syncUser(userPushParam);
|
|
|
if (!syncResult) {
|
|
|
log.warn("-----------------------------用户同步推送失败----------------------------");
|
|
|
result = false;
|
|
|
PushUserError pushUserError = new PushUserError();
|
|
|
pushUserError.setId(SystemConstant.getDbUuid());
|
|
|
- pushUserError.setSchoolId(requestUser.getSchoolId());
|
|
|
+ pushUserError.setSchoolId(userPushParam.getSchoolId());
|
|
|
pushUserError.setUserId(userPushParam.getUserId());
|
|
|
pushUserError.setAccount(userPushParam.getAccount());
|
|
|
pushUserError.setName(userPushParam.getName());
|
|
@@ -972,24 +972,24 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
|
|
|
@Transactional
|
|
|
@Override
|
|
|
- public void autoPushUserErrorData() {
|
|
|
+ public void autoPushUserErrorData() throws IllegalAccessException {
|
|
|
List<PushUserError> pushUserErrorList = pushUserErrorService.list();
|
|
|
Set<Long> userIdSet = pushUserErrorList.stream().map(PushUserError::getUserId).collect(Collectors.toSet());
|
|
|
- List<SysUser> sysUserList = this.listByIds(userIdSet);
|
|
|
- // 清空push-user-error表
|
|
|
- pushUserErrorService.remove(new QueryWrapper<PushUserError>().lambda().in(PushUserError::getUserId, userIdSet));
|
|
|
- for (SysUser sysUser : sysUserList) {
|
|
|
- if (!SyncStatusEnum.NEED_PUSH_AGAIN.equals(sysUser.getSyncStatus())) {
|
|
|
- // 用户同步状态不为需要重新同步的错误数据再同步(防止和需要重新同步类型的数据冲突或因为权限改动导致的反复同步!)
|
|
|
- Long userId = sysUser.getId();
|
|
|
- Long schoolId = sysUser.getSchoolId();
|
|
|
- Set<Long> roleIdSet = sysUserRoleService.listRoleByUserId(userId).stream().map(BaseEntity::getId).collect(Collectors.toSet());
|
|
|
-
|
|
|
- // TODO: 2021/11/4 系统管理员的id判断
|
|
|
- Long requestUserId = 1L; // 系统管理员
|
|
|
- List<PushUserTrack> pushUserTrackList = pushUserTrackService.createPushTrackUser(null,roleIdSet,userId,sysUser.getEnable(),requestUserId);
|
|
|
- List<UserPushParam> userPushParamList = pushUserTrackService.analyzeUserPushSpecialPrivilege(pushUserTrackList);
|
|
|
- this.userPushService(userPushParamList, requestUserId);
|
|
|
+ if (userIdSet.size() > 0) {
|
|
|
+ List<SysUser> sysUserList = this.listByIds(userIdSet);
|
|
|
+ // 清空push-user-error表
|
|
|
+ pushUserErrorService.remove(new QueryWrapper<PushUserError>().lambda().in(PushUserError::getUserId, userIdSet));
|
|
|
+ for (SysUser sysUser : sysUserList) {
|
|
|
+ if (!SyncStatusEnum.NEED_PUSH_AGAIN.equals(sysUser.getSyncStatus())) {
|
|
|
+ // 用户同步状态不为需要重新同步的错误数据再同步(防止和需要重新同步类型的数据冲突或因为权限改动导致的反复同步!)
|
|
|
+ Long userId = sysUser.getId();
|
|
|
+ Set<Long> roleIdSet = sysUserRoleService.listRoleByUserId(userId).stream().map(BaseEntity::getId).collect(Collectors.toSet());
|
|
|
+
|
|
|
+ Long requestUserId = 1L; // 系统管理员
|
|
|
+ List<PushUserTrack> pushUserTrackList = pushUserTrackService.createPushTrackUser(null, roleIdSet, userId, sysUser.getEnable(), requestUserId);
|
|
|
+ List<UserPushParam> userPushParamList = pushUserTrackService.analyzeUserPushSpecialPrivilege(pushUserTrackList);
|
|
|
+ this.userPushService(userPushParamList, requestUserId);
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -1037,7 +1037,7 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
public SyncCountResult needPushAgainOperate(SysUser requestUser) throws IllegalAccessException {
|
|
|
int correctCount = 0;
|
|
|
int totalCount = 0;
|
|
|
- if (Objects.isNull(requestUser)){
|
|
|
+ if (Objects.isNull(requestUser)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("未找到请求用户");
|
|
|
}
|
|
|
Long schoolId = requestUser.getSchoolId();
|
|
@@ -1045,8 +1045,8 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
// 需要同步的用户
|
|
|
QueryWrapper<SysUser> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.lambda().eq(SysUser::getSyncStatus, SyncStatusEnum.NEED_PUSH_AGAIN);
|
|
|
- if (SystemConstant.longNotNull(schoolId)){
|
|
|
- queryWrapper.lambda().eq(SysUser::getSchoolId,schoolId);
|
|
|
+ if (SystemConstant.longNotNull(schoolId)) {
|
|
|
+ queryWrapper.lambda().eq(SysUser::getSchoolId, schoolId);
|
|
|
}
|
|
|
List<SysUser> sysUserList = sysUserService.list(queryWrapper);
|
|
|
totalCount = sysUserList.size();
|
|
@@ -1189,20 +1189,21 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
|
|
|
|
|
|
/**
|
|
|
* 用户禁用启用特殊权限判断及处理
|
|
|
- * @param userId 用户id
|
|
|
- * @param enable 启用/禁用
|
|
|
+ *
|
|
|
+ * @param userId 用户id
|
|
|
+ * @param enable 启用/禁用
|
|
|
* @param requestUserId 请求人id
|
|
|
*/
|
|
|
- private void analyzeUserEnableSpecialPrivilege(Long userId, boolean enable,Long requestUserId) {
|
|
|
+ private void analyzeUserEnableSpecialPrivilege(Long userId, boolean enable, Long requestUserId) throws IllegalAccessException {
|
|
|
SysUser dbUser = sysUserService.getById(userId);
|
|
|
if (Objects.isNull(dbUser)) {
|
|
|
throw ExceptionResultEnum.ERROR.exception("未找到系统用户");
|
|
|
}
|
|
|
Set<Long> currentRoleIdSet = new HashSet<>(sysRoleService.getUserRoles(userId));
|
|
|
- List<PushUserTrack> pushUserTrackList = pushUserTrackService.createPushTrackUser(null,currentRoleIdSet,userId,enable,requestUserId);
|
|
|
+ List<PushUserTrack> pushUserTrackList = pushUserTrackService.createPushTrackUser(null, currentRoleIdSet, userId, enable, requestUserId);
|
|
|
List<UserPushParam> userPushParamList = pushUserTrackService.analyzeUserPushSpecialPrivilege(pushUserTrackList);
|
|
|
- if (userPushParamList != null && userPushParamList.size() > 0){
|
|
|
- this.userPushService(userPushParamList,requestUserId);
|
|
|
+ if (userPushParamList != null && userPushParamList.size() > 0) {
|
|
|
+ this.userPushService(userPushParamList, requestUserId);
|
|
|
}
|
|
|
}
|
|
|
}
|