给接口增加swagger描述

This commit is contained in:
季圣华
2021-11-08 23:14:21 +08:00
parent 744691d916
commit a923700c0e
30 changed files with 383 additions and 12 deletions

View File

@@ -16,6 +16,8 @@ import com.jsh.erp.service.redis.RedisService;
import com.jsh.erp.service.tenant.TenantService;
import com.jsh.erp.service.user.UserService;
import com.jsh.erp.utils.*;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Value;
@@ -39,6 +41,7 @@ import static com.jsh.erp.utils.ResponseJsonUtil.returnJson;
*/
@RestController
@RequestMapping(value = "/user")
@Api(tags = {"用户管理"})
public class UserController {
private Logger logger = LoggerFactory.getLogger(UserController.class);
@@ -68,6 +71,7 @@ public class UserController {
private static final String BASE_CHECK_CODES = "qwertyuiplkjhgfdsazxcvbnmQWERTYUPLKJHGFDSAZXCVBNM1234567890";
@PostMapping(value = "/login")
@ApiOperation(value = "登录")
public BaseResponseInfo login(@RequestBody User userParam,
HttpServletRequest request)throws Exception {
logger.info("============用户登录 login 方法调用开始==============");
@@ -166,6 +170,7 @@ public class UserController {
}
@GetMapping(value = "/getUserSession")
@ApiOperation(value = "获取用户信息")
public BaseResponseInfo getSessionUser(HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
@@ -185,6 +190,7 @@ public class UserController {
}
@GetMapping(value = "/logout")
@ApiOperation(value = "退出")
public BaseResponseInfo logout(HttpServletRequest request, HttpServletResponse response)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
@@ -199,6 +205,7 @@ public class UserController {
}
@PostMapping(value = "/resetPwd")
@ApiOperation(value = "重置密码")
public String resetPwd(@RequestBody JSONObject jsonObject,
HttpServletRequest request) throws Exception {
Map<String, Object> objectMap = new HashMap<>();
@@ -214,6 +221,7 @@ public class UserController {
}
@PutMapping(value = "/updatePwd")
@ApiOperation(value = "更新密码")
public String updatePwd(@RequestBody JSONObject jsonObject, HttpServletRequest request)throws Exception {
Integer flag = 0;
Map<String, Object> objectMap = new HashMap<String, Object>();
@@ -255,6 +263,7 @@ public class UserController {
* @return
*/
@GetMapping(value = "/getAllList")
@ApiOperation(value = "获取全部用户数据列表")
public BaseResponseInfo getAllList(HttpServletRequest request)throws Exception {
BaseResponseInfo res = new BaseResponseInfo();
try {
@@ -280,6 +289,7 @@ public class UserController {
* @throws Exception
*/
@GetMapping(value = "/getUserList")
@ApiOperation(value = "用户列表")
public JSONArray getUserList(HttpServletRequest request)throws Exception {
JSONArray dataArray = new JSONArray();
try {
@@ -307,6 +317,7 @@ public class UserController {
* @return java.lang.Object
*/
@PostMapping("/addUser")
@ApiOperation(value = "新增用户")
@ResponseBody
public Object addUser(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception{
JSONObject result = ExceptionConstants.standardSuccess();
@@ -331,6 +342,7 @@ public class UserController {
* @return java.lang.Object
*/
@PutMapping("/updateUser")
@ApiOperation(value = "修改用户")
@ResponseBody
public Object updateUser(@RequestBody JSONObject obj, HttpServletRequest request)throws Exception{
JSONObject result = ExceptionConstants.standardSuccess();
@@ -346,6 +358,7 @@ public class UserController {
* @throws Exception
*/
@PostMapping(value = "/registerUser")
@ApiOperation(value = "注册用户")
public Object registerUser(@RequestBody UserEx ue,
HttpServletRequest request)throws Exception{
JSONObject result = ExceptionConstants.standardSuccess();
@@ -355,7 +368,13 @@ public class UserController {
return result;
}
/**
* 获取机构用户树
* @return
* @throws Exception
*/
@RequestMapping("/getOrganizationUserTree")
@ApiOperation(value = "获取机构用户树")
public JSONArray getOrganizationUserTree()throws Exception{
JSONArray arr=new JSONArray();
List<TreeNodeEx> organizationUserTree= userService.getOrganizationUserTree();
@@ -375,6 +394,7 @@ public class UserController {
* @return
*/
@GetMapping("/getRoleTypeByCurrentUser")
@ApiOperation(value = "获取当前用户的角色类型")
public BaseResponseInfo getRoleTypeByCurrentUser(HttpServletRequest request) {
BaseResponseInfo res = new BaseResponseInfo();
try {
@@ -391,7 +411,14 @@ public class UserController {
return res;
}
/**
* 获取随机校验码
* @param response
* @param key
* @return
*/
@GetMapping(value = "/randomImage/{key}")
@ApiOperation(value = "获取随机校验码")
public BaseResponseInfo randomImage(HttpServletResponse response,@PathVariable String key){
BaseResponseInfo res = new BaseResponseInfo();
try {
@@ -417,6 +444,7 @@ public class UserController {
* @return
*/
@PostMapping(value = "/batchSetStatus")
@ApiOperation(value = "批量设置状态")
public String batchSetStatus(@RequestBody JSONObject jsonObject,
HttpServletRequest request)throws Exception {
Byte status = jsonObject.getByte("status");
@@ -436,6 +464,7 @@ public class UserController {
* @return
*/
@GetMapping(value = "/infoWithTenant")
@ApiOperation(value = "获取当前用户的用户数量和租户信息")
public BaseResponseInfo randomImage(HttpServletRequest request){
BaseResponseInfo res = new BaseResponseInfo();
try {