记得上下班打卡 | git大法好,push需谨慎

Commit 85c9c89e authored by 张国柄's avatar 张国柄

swagger api调整;

parent 86a55247
package com.liquidnet.client.admin.web.controller.tool;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.liquidnet.client.admin.common.core.controller.BaseController;
import com.liquidnet.client.admin.common.core.domain.AjaxResult;
import com.liquidnet.client.admin.common.utils.StringUtils;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.annotations.ApiOperation;
/**
* swagger 用户测试方法
*
* @author ruoyi
*/
@Api("用户信息管理")
@RestController
@RequestMapping("/test/user")
public class TestController extends BaseController
{
private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
{
users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
}
@ApiOperation("获取用户列表")
@GetMapping("/list")
public AjaxResult userList()
{
List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
return AjaxResult.success(userList);
}
@ApiOperation("获取用户详细")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
@GetMapping("/{userId}")
public AjaxResult getUser(@PathVariable Integer userId)
{
if (!users.isEmpty() && users.containsKey(userId))
{
return AjaxResult.success(users.get(userId));
}
else
{
return error("用户不存在");
}
}
@ApiOperation("新增用户")
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
@PostMapping("/save")
public AjaxResult save(UserEntity user)
{
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{
return error("用户ID不能为空");
}
return AjaxResult.success(users.put(user.getUserId(), user));
}
@ApiOperation("更新用户")
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
@PutMapping("/update")
public AjaxResult update(UserEntity user)
{
if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
{
return error("用户ID不能为空");
}
if (users.isEmpty() || !users.containsKey(user.getUserId()))
{
return error("用户不存在");
}
users.remove(user.getUserId());
return AjaxResult.success(users.put(user.getUserId(), user));
}
@ApiOperation("删除用户信息")
@ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
@DeleteMapping("/{userId}")
public AjaxResult delete(@PathVariable Integer userId)
{
if (!users.isEmpty() && users.containsKey(userId))
{
users.remove(userId);
return success();
}
else
{
return error("用户不存在");
}
}
}
@ApiModel("用户实体")
class UserEntity
{
@ApiModelProperty("用户ID")
private Integer userId;
@ApiModelProperty("用户名称")
private String username;
@ApiModelProperty("用户密码")
private String password;
@ApiModelProperty("用户手机")
private String mobile;
public UserEntity()
{
}
public UserEntity(Integer userId, String username, String password, String mobile)
{
this.userId = userId;
this.username = username;
this.password = password;
this.mobile = mobile;
}
public Integer getUserId()
{
return userId;
}
public void setUserId(Integer userId)
{
this.userId = userId;
}
public String getUsername()
{
return username;
}
public void setUsername(String username)
{
this.username = username;
}
public String getPassword()
{
return password;
}
public void setPassword(String password)
{
this.password = password;
}
public String getMobile()
{
return mobile;
}
public void setMobile(String mobile)
{
this.mobile = mobile;
}
}
//package com.liquidnet.client.admin.web.controller.tool;
//
//import java.util.ArrayList;
//import java.util.LinkedHashMap;
//import java.util.List;
//import java.util.Map;
//import org.springframework.web.bind.annotation.DeleteMapping;
//import org.springframework.web.bind.annotation.GetMapping;
//import org.springframework.web.bind.annotation.PathVariable;
//import org.springframework.web.bind.annotation.PostMapping;
//import org.springframework.web.bind.annotation.PutMapping;
//import org.springframework.web.bind.annotation.RequestMapping;
//import org.springframework.web.bind.annotation.RestController;
//import com.liquidnet.client.admin.common.core.controller.BaseController;
//import com.liquidnet.client.admin.common.core.domain.AjaxResult;
//import com.liquidnet.client.admin.common.utils.StringUtils;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiImplicitParam;
//import io.swagger.annotations.ApiModel;
//import io.swagger.annotations.ApiModelProperty;
//import io.swagger.annotations.ApiOperation;
//
///**
// * swagger 用户测试方法
// *
// * @author ruoyi
// */
//@Api("用户信息管理")
//@RestController
//@RequestMapping("/test/user")
//public class TestController extends BaseController
//{
// private final static Map<Integer, UserEntity> users = new LinkedHashMap<Integer, UserEntity>();
// {
// users.put(1, new UserEntity(1, "admin", "admin123", "15888888888"));
// users.put(2, new UserEntity(2, "ry", "admin123", "15666666666"));
// }
//
// @ApiOperation("获取用户列表")
// @GetMapping("/list")
// public AjaxResult userList()
// {
// List<UserEntity> userList = new ArrayList<UserEntity>(users.values());
// return AjaxResult.success(userList);
// }
//
// @ApiOperation("获取用户详细")
// @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
// @GetMapping("/{userId}")
// public AjaxResult getUser(@PathVariable Integer userId)
// {
// if (!users.isEmpty() && users.containsKey(userId))
// {
// return AjaxResult.success(users.get(userId));
// }
// else
// {
// return error("用户不存在");
// }
// }
//
// @ApiOperation("新增用户")
// @ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
// @PostMapping("/save")
// public AjaxResult save(UserEntity user)
// {
// if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
// {
// return error("用户ID不能为空");
// }
// return AjaxResult.success(users.put(user.getUserId(), user));
// }
//
// @ApiOperation("更新用户")
// @ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
// @PutMapping("/update")
// public AjaxResult update(UserEntity user)
// {
// if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
// {
// return error("用户ID不能为空");
// }
// if (users.isEmpty() || !users.containsKey(user.getUserId()))
// {
// return error("用户不存在");
// }
// users.remove(user.getUserId());
// return AjaxResult.success(users.put(user.getUserId(), user));
// }
//
// @ApiOperation("删除用户信息")
// @ApiImplicitParam(name = "userId", value = "用户ID", required = true, dataType = "int", paramType = "path")
// @DeleteMapping("/{userId}")
// public AjaxResult delete(@PathVariable Integer userId)
// {
// if (!users.isEmpty() && users.containsKey(userId))
// {
// users.remove(userId);
// return success();
// }
// else
// {
// return error("用户不存在");
// }
// }
//}
//
//@ApiModel("用户实体")
//class UserEntity
//{
// @ApiModelProperty("用户ID")
// private Integer userId;
//
// @ApiModelProperty("用户名称")
// private String username;
//
// @ApiModelProperty("用户密码")
// private String password;
//
// @ApiModelProperty("用户手机")
// private String mobile;
//
// public UserEntity()
// {
//
// }
//
// public UserEntity(Integer userId, String username, String password, String mobile)
// {
// this.userId = userId;
// this.username = username;
// this.password = password;
// this.mobile = mobile;
// }
//
// public Integer getUserId()
// {
// return userId;
// }
//
// public void setUserId(Integer userId)
// {
// this.userId = userId;
// }
//
// public String getUsername()
// {
// return username;
// }
//
// public void setUsername(String username)
// {
// this.username = username;
// }
//
// public String getPassword()
// {
// return password;
// }
//
// public void setPassword(String password)
// {
// this.password = password;
// }
//
// public String getMobile()
// {
// return mobile;
// }
//
// public void setMobile(String mobile)
// {
// this.mobile = mobile;
// }
//}
package com.liquidnet.client.admin.web.controller.zhengzai.adam;
import com.liquidnet.client.admin.common.annotation.Log;
import com.liquidnet.client.admin.common.enums.BusinessType;
import com.liquidnet.common.cache.redis.util.RedisUtil;
import com.liquidnet.service.adam.constant.AdamRedisConst;
import com.liquidnet.service.base.ResponseDto;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.Max;
import javax.validation.constraints.Min;
@Api(tags = "ADAM配置")
@Slf4j
@Validated
@RestController
@RequestMapping("adam/switch")
public class AdamSwitchAdminController {
@Autowired
RedisUtil redisUtil;
@Log(title = "ADAM配置", businessType = BusinessType.GRANT)
@RequiresPermissions("adam:switch:buy:member")
@ApiOperation(value = "开放/限制购买会员")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "int", name = "opt", value = "0-限制|1-开放", example = "0"),
})
@PostMapping("buy/member")
public ResponseDto<Object> purchaseSwitch(@Max(1) @Min(0) @RequestParam int opt) {
redisUtil.set(AdamRedisConst.SWITCH_BUY_MEMBER, opt);
return ResponseDto.success(redisUtil.get(AdamRedisConst.SWITCH_BUY_MEMBER));
}
@Log(title = "ADAM配置", businessType = BusinessType.OTHER)
@RequiresPermissions("adam:switch:max:memberno")
@ApiOperation(value = "会员用户最大ID_NO")
@ApiImplicitParams({
@ApiImplicitParam(type = "form", required = true, dataType = "int", name = "opt", value = "会员用户最大ID_NO", example = "15000"),
})
@PostMapping("set/memberno")
public ResponseDto<Object> purchaseStartMemberNo(@Min(11417) @RequestParam int opt) {
redisUtil.set(AdamRedisConst.INCR_MEMBER_NO, opt);
return ResponseDto.success(redisUtil.get(AdamRedisConst.INCR_MEMBER_NO));
}
}
......@@ -22,7 +22,7 @@ import javax.validation.constraints.NotBlank;
import java.util.ArrayList;
import java.util.List;
@Api(tags = "会员用户")
@Api(tags = "登登登会员")
@Slf4j
@Validated
@RestController
......
......@@ -18,6 +18,7 @@ import com.liquidnet.service.kylin.dto.param.RefundSearchParam;
import com.liquidnet.service.kylin.dto.vo.returns.KylinOrderRefundsVo;
import com.liquidnet.service.kylin.dto.vo.returns.RefundOrderDetailsVo;
import com.liquidnet.service.kylin.service.IKylinOrderRefundsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
......@@ -38,7 +39,7 @@ import java.util.Map;
* @author jiangxiulong
* @since 2021-05-25 10:58 上午
*/
@Api(tags = "RDFUND订单")
@Controller
@RequestMapping("/kylin/refund")
public class KylinOrderRefundAdminController extends BaseController {
......
......@@ -17,7 +17,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.validation.constraints.NotNull;
@Api(tags = "ORDER 订单号")
@Api(tags = "ORDER订单")
@Slf4j
@Validated
@RestController
......
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