Commit 22998a6f authored by 赵啸非's avatar 赵啸非

修改人员同步

parent 058a4dfe
...@@ -96,16 +96,33 @@ public class UserSyncTaskImpl implements ITaskExcuteService { ...@@ -96,16 +96,33 @@ public class UserSyncTaskImpl implements ITaskExcuteService {
userEntity.setUpdateUserId(1L); userEntity.setUpdateUserId(1L);
userEntity.setUpdateTime(new Date()); userEntity.setUpdateTime(new Date());
userService.update(userEntity); userService.update(userEntity);
//判断角色是否更新,如果更新了 则更新角色权限
if(!user.getType().equals(userEntity.getUserType())){
updateRoleUser(user, userEntity);
}
} else { } else {
//新增用户 //新增用户
userEntity = userService.createUser(null, user.getId(), "", user.getAccount(), user.getPassword(), user.getUser_name(), user.getMobile()); userEntity = userService.createUser(null, user.getId(), "", user.getAccount(), user.getPassword(), user.getUser_name(), user.getMobile());
if(UserType.WORK.getValue()==user.getType()){ updateRoleUser(user, userEntity);
}
}
}
log.debug("user resp:{}", JSON.toJSONString(apiResp));
} catch (Exception e) {
log.error("用户同步异常,结束执行", e);
}
}
private void updateRoleUser(CustomerInfoPdu user, UserEntity userEntity) {
if(UserType.WORK.getValue()== user.getType()){
//根据用户类型添加默认访问权限 //根据用户类型添加默认访问权限
RoleUserQuery roleUserQuery = new RoleUserQuery(); RoleUserQuery roleUserQuery = new RoleUserQuery();
roleUserQuery.setUserId(userEntity.getId()); roleUserQuery.setUserId(userEntity.getId());
roleUserQuery.setRoleIdList(Arrays.asList(new Long[]{3L})); roleUserQuery.setRoleIdList(Arrays.asList(new Long[]{3L}));
roleUserService.doDistributionRole(roleUserQuery); roleUserService.doDistributionRole(roleUserQuery);
}else if (UserType.WORK_PERSON.getValue()==user.getType()){ }else if (UserType.WORK_PERSON.getValue()== user.getType()){
//根据用户类型添加默认访问权限 //根据用户类型添加默认访问权限
RoleUserQuery roleUserQuery = new RoleUserQuery(); RoleUserQuery roleUserQuery = new RoleUserQuery();
roleUserQuery.setUserId(userEntity.getId()); roleUserQuery.setUserId(userEntity.getId());
...@@ -113,14 +130,6 @@ public class UserSyncTaskImpl implements ITaskExcuteService { ...@@ -113,14 +130,6 @@ public class UserSyncTaskImpl implements ITaskExcuteService {
roleUserService.doDistributionRole(roleUserQuery); roleUserService.doDistributionRole(roleUserQuery);
} }
} }
}
}
log.debug("user resp:{}", JSON.toJSONString(apiResp));
} catch (Exception e) {
log.error("用户同步异常,结束执行", e);
}
}
private void updateDefaultDept(UserEntity userEntity) { private void updateDefaultDept(UserEntity userEntity) {
if(ObjectUtils.isEmpty(userEntity.getDeptId())){ if(ObjectUtils.isEmpty(userEntity.getDeptId())){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment