新增简单格式用户列表接口
This commit is contained in:
parent
d879c6dd7f
commit
7841060c8e
@ -138,4 +138,8 @@ public interface IApiConsts {
|
||||
* 获取用户ID列表(通过上级区域ID)
|
||||
*/
|
||||
String LIST_USER_ID_BY_AREA_ID = "%s/resource/user/listuseridbyareaid";
|
||||
/**
|
||||
* 用户列表(简单格式)
|
||||
*/
|
||||
String LIST_PAGE_USER_SIMPLE = "%s/resource/user/listpageusersimple";
|
||||
}
|
||||
|
@ -10,8 +10,10 @@ import com.cm.common.exception.ParamsException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.exception.UpdateException;
|
||||
import com.cm.common.plugin.oauth.service.user.IUserService;
|
||||
import com.cm.common.plugin.pojo.bos.UserResourceBO;
|
||||
import com.cm.common.result.ErrorResult;
|
||||
import com.cm.common.result.SuccessResult;
|
||||
import com.cm.common.result.SuccessResultList;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -174,4 +176,17 @@ public class UserController extends AbstractController {
|
||||
return userService.listDepartmentUserByUserDepartmentId(params);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "用户列表(简单格式)", notes = "用户列表(简单格式)接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
||||
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
|
||||
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listpageusersimple")
|
||||
public SuccessResultList<List<UserResourceBO>> listPageUserSimple() {
|
||||
Map<String, Object> params = requestParams();
|
||||
return userService.listPageUserSimple(params);
|
||||
}
|
||||
|
||||
}
|
@ -6,6 +6,7 @@ import com.cm.common.exception.AccessTokenException;
|
||||
import com.cm.common.exception.SearchException;
|
||||
import com.cm.common.plugin.pojo.bos.UserResourceBO;
|
||||
import com.cm.common.result.SuccessResult;
|
||||
import com.cm.common.result.SuccessResultList;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@ -210,4 +211,13 @@ public interface IUserService {
|
||||
*/
|
||||
List<String> listUserIdByAreaId(Map<String, Object> params) throws AccessTokenException, SearchException;
|
||||
|
||||
/**
|
||||
* 用户列表(简单格式)
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws AccessTokenException
|
||||
* @throws SearchException
|
||||
*/
|
||||
SuccessResultList<List<UserResourceBO>> listPageUserSimple(Map<String, Object> params) throws AccessTokenException, SearchException;
|
||||
}
|
||||
|
@ -13,6 +13,7 @@ import com.cm.common.plugin.oauth.token.ClientTokenManager;
|
||||
import com.cm.common.plugin.pojo.bos.UserResourceBO;
|
||||
import com.cm.common.plugin.utils.RestTemplateUtil;
|
||||
import com.cm.common.result.SuccessResult;
|
||||
import com.cm.common.result.SuccessResultList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@ -181,4 +182,17 @@ public class UserServiceImpl extends AbstractService implements IUserService {
|
||||
return JSONArray.parseArray(result, String.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<UserResourceBO>> listPageUserSimple(Map<String, Object> params) throws AccessTokenException, SearchException {
|
||||
params.put(IApiConsts.ACCESS_TOKEN, ClientTokenManager.getInstance().getClientToken().getAccessToken());
|
||||
String result = restTemplateUtil.doGetFormNormal(String.format(IApiConsts.LIST_PAGE_USER_SIMPLE, apiPathProperties.getUserCenter()), params);
|
||||
searchResourceResult(result, "获取用户列表(简单格式)失败");
|
||||
JSONObject resultObj = JSONObject.parseObject(result);
|
||||
SuccessResultList<List<UserResourceBO>> successResult = new SuccessResultList<>();
|
||||
successResult.setPage(resultObj.getInteger("page"));
|
||||
successResult.setTotal(resultObj.getLong("total"));
|
||||
successResult.setRows(resultObj.getJSONArray("rows").toJavaList(UserResourceBO.class));
|
||||
return successResult;
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -25,6 +25,10 @@ public class UserResourceBO implements Serializable {
|
||||
this.userId = userId;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId == null ? "" : userId.trim();
|
||||
}
|
||||
|
||||
public String getUserUsername() {
|
||||
return userUsername == null ? "" : userUsername.trim();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user