全量用户接口增加角色
							parent
							
								
									71071e2283
								
							
						
					
					
						commit
						6aa32c66d3
					
				| 
						 | 
					@ -45,7 +45,7 @@ public class WebInterceptorConfiguration implements InterceptorConfiguration {
 | 
				
			||||||
            "/v1/logview", "/v1/logzip", "/status/**", "/v1/tokens", "/v1/config/captcha/install", "/v1/status/sid",
 | 
					            "/v1/logview", "/v1/logzip", "/status/**", "/v1/tokens", "/v1/config/captcha/install", "/v1/status/sid",
 | 
				
			||||||
            "/v1/config/license/install", "/v1/config/status/", "/v1/status/sids", "/status", "/status/db",
 | 
					            "/v1/config/license/install", "/v1/config/status/", "/v1/status/sids", "/status", "/status/db",
 | 
				
			||||||
            "/error", "/v1/*/info", "/v1/*/status", "/v1/config/**", "/v1/status/**", "/v1/config/license",
 | 
					            "/error", "/v1/*/info", "/v1/*/status", "/v1/config/**", "/v1/status/**", "/v1/config/license",
 | 
				
			||||||
            "/v3/api-docs/**", "/v1/autologin", "/v1/single/login", "/v1/token/check", "/v1/trx/**"};
 | 
					            "/v3/api-docs/**", "/v1/autologin", "/v1/single/login", "/v1/token/check", "/v1/trx/**", "/v1/users/manager/external"};
 | 
				
			||||||
    private static final String[] LOG_EXCLUDES = new String[]{"/*/*.css",
 | 
					    private static final String[] LOG_EXCLUDES = new String[]{"/*/*.css",
 | 
				
			||||||
            "/*/*.js", "/*/*.png", "/*/*.jpg", "/*/*.jpeg", "/*.html", "/*/*.html", "/swagger-resources/**", "/favicon.ico",
 | 
					            "/*/*.js", "/*/*.png", "/*/*.jpg", "/*/*.jpeg", "/*.html", "/*/*.html", "/swagger-resources/**", "/favicon.ico",
 | 
				
			||||||
            "/webjars/**", "/v2/**", "/swagger-ui.html/**", "/error", "/v3/api-docs/**"};
 | 
					            "/webjars/**", "/v2/**", "/swagger-ui.html/**", "/error", "/v3/api-docs/**"};
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -49,6 +49,21 @@ public class UserController {
 | 
				
			||||||
        return userService.list(pager, requestContext);
 | 
					        return userService.list(pager, requestContext);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 获取用户列表
 | 
				
			||||||
 | 
					     *
 | 
				
			||||||
 | 
					     * @param pager
 | 
				
			||||||
 | 
					     * @param requestContext
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @Operation(summary = "查询用户列表")
 | 
				
			||||||
 | 
					    @GetMapping("/manager/external")
 | 
				
			||||||
 | 
					    public GeneralResult<GridBean<User>> managerExternalList(Pager pager, @Value(Common.REQ_CONTEXT) RequestContext requestContext) {
 | 
				
			||||||
 | 
					        return userService.managerExternalList(pager, requestContext);
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 创建用户
 | 
					     * 创建用户
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -152,6 +152,9 @@ public interface UserService {
 | 
				
			||||||
     */
 | 
					     */
 | 
				
			||||||
    GeneralResult<GridBean<User>> list(Pager pager, RequestContext requestContext);
 | 
					    GeneralResult<GridBean<User>> list(Pager pager, RequestContext requestContext);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    GeneralResult<GridBean<User>> managerExternalList(Pager pager, RequestContext requestContext);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    /**
 | 
					    /**
 | 
				
			||||||
     * 获取安全密钥
 | 
					     * 获取安全密钥
 | 
				
			||||||
     *
 | 
					     *
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -57,6 +57,7 @@ import java.util.stream.Collectors;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import static com.bocloud.sms.service.utils.ExportUtil.exportExcel;
 | 
					import static com.bocloud.sms.service.utils.ExportUtil.exportExcel;
 | 
				
			||||||
import static com.bocloud.sms.service.utils.ExportUtil.getCellStringValue;
 | 
					import static com.bocloud.sms.service.utils.ExportUtil.getCellStringValue;
 | 
				
			||||||
 | 
					import static dm.jdbc.desc.Configuration.user;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					/**
 | 
				
			||||||
 * 用户抽象Service接口实现类
 | 
					 * 用户抽象Service接口实现类
 | 
				
			||||||
| 
						 | 
					@ -169,6 +170,26 @@ public class UserServiceImpl implements UserService {
 | 
				
			||||||
        return new GeneralResult<>(true, gridBean, "查询用户成功");
 | 
					        return new GeneralResult<>(true, gridBean, "查询用户成功");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    @Override
 | 
				
			||||||
 | 
					    public GeneralResult<GridBean<User>> managerExternalList(Pager pager, RequestContext requestContext) {
 | 
				
			||||||
 | 
					        GeneralResult<GridBean<User>> list = this.list(pager, requestContext);
 | 
				
			||||||
 | 
					        Optional.of(list).map(GeneralResult::getData).map(GridBean::getRows).ifPresent(users -> {
 | 
				
			||||||
 | 
					            users.stream().parallel().forEach(user -> {
 | 
				
			||||||
 | 
					                List<String> roleNames = user.getRoleNames();
 | 
				
			||||||
 | 
					                //给用户设置管理端的角色名
 | 
				
			||||||
 | 
					                List<Role> managerRoles = roleRepository.listByManager(user.getId());
 | 
				
			||||||
 | 
					                if (!ListTool.isEmpty(managerRoles)) {
 | 
				
			||||||
 | 
					                    for (Role role : managerRoles) {
 | 
				
			||||||
 | 
					                        if (!roleNames.contains(role.getName())) {
 | 
				
			||||||
 | 
					                            roleNames.add(role.getName());
 | 
				
			||||||
 | 
					                        }
 | 
				
			||||||
 | 
					                    }
 | 
				
			||||||
 | 
					                }
 | 
				
			||||||
 | 
					            });
 | 
				
			||||||
 | 
					        });
 | 
				
			||||||
 | 
					        return list;
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    private List<Long> getDeptIdTree(Map<Long, Department> departmentMap, Department department) {
 | 
					    private List<Long> getDeptIdTree(Map<Long, Department> departmentMap, Department department) {
 | 
				
			||||||
        List<Long> result = new ArrayList<>();
 | 
					        List<Long> result = new ArrayList<>();
 | 
				
			||||||
        result.add(department.getId());
 | 
					        result.add(department.getId());
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue