本文整理汇总了Java中io.swagger.annotations.ApiImplicitParam类的典型用法代码示例。如果您正苦于以下问题:Java ApiImplicitParam类的具体用法?Java ApiImplicitParam怎么用?Java ApiImplicitParam使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ApiImplicitParam类属于io.swagger.annotations包,在下文中一共展示了ApiImplicitParam类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createAuthenticationToken
import io.swagger.annotations.ApiImplicitParam; //导入依赖的package包/类
@ApiOperation(value = "授权", notes = "")
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query",name = "appName", value = "应用的名字", required = true,dataType = "String"),
@ApiImplicitParam(paramType = "query",name = "vq",value = "vq",required = true,dataType = "String"),
@ApiImplicitParam(paramType = "query",name = "device",value = "设备的名字",required = true,dataType = "String")})
@RequestMapping(value = "${jwt.route.authentication.path}", method = RequestMethod.POST)
public ResponseEntity<?> createAuthenticationToken(String appName,String vq, Device device) throws AuthenticationException {
logger.info("应用:" + appName + " 正在授权!");
App app = appRepository.findFirstByAppname(appName);
if (app == null) {
return ResponseEntity.ok(new ErrorReporter(1, "未找到应用" + appName));
}
YibanOAuth yibanOAuth = new YibanOAuth(vq, app);
yibanOAuth.dealYibanOauth();
if (yibanOAuth.isHasError() == false) {
upcYbUserFactory.createUser(yibanOAuth.getYibanBasicUserInfo());
String ybid = String.valueOf(yibanOAuth.getYibanBasicUserInfo().visit_user.userid);
String ybtocken = yibanOAuth.getYibanBasicUserInfo().visit_oauth.access_token;
logger.info("ybtocken: " + ybtocken);
final JwtUser userDetails = (JwtUser) userDetailsService.loadUserByUsername(ybid);
final String token = jwtTokenUtil.generateToken(userDetails, ybtocken,appName, device);
logger.info("发放token:" + token);
return ResponseEntity.ok(new JwtAuthenticationResponse(token));
} else {
return ResponseEntity.ok(new ErrorReporter(2, "解析vq失败,可能是由于密钥长度不匹配"));
}
}
示例2: CreatePosts
import io.swagger.annotations.ApiImplicitParam; //导入依赖的package包/类
@ApiOperation("发帖接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "content", value = "帖子内容", dataType = "String"),
@ApiImplicitParam(name = "title", value = "帖子标题", dataType = "String"),
@ApiImplicitParam(name = "token", value = "用户令牌", dataType = "String"),
@ApiImplicitParam(name = "labelId", value = "标签ID", dataType = "Integer")
})
@PostMapping
public QuarkResult CreatePosts(Posts posts, String token, Integer labelId) {
QuarkResult result = restProcessor(() -> {
if (token == null) return QuarkResult.warn("请先登录!");
User userbytoken = userService.getUserByToken(token);
if (userbytoken == null) return QuarkResult.warn("用户不存在,请先登录!");
User user = userService.findOne(userbytoken.getId());
if (user.getEnable() != 1) return QuarkResult.warn("用户处于封禁状态!");
postsService.savePosts(posts, labelId, user);
return QuarkResult.ok();
});
return result;
}
示例3: getParticipantFromCGOR
import io.swagger.annotations.ApiImplicitParam; //导入依赖的package包/类
@ApiOperation(value = "getParticipantFromCGOR", nickname = "getParticipantFromCGOR")
@RequestMapping(value = "/CISConnector/getParticipantFromCGOR/{cgorName}", method = RequestMethod.GET)
@ApiImplicitParams({
@ApiImplicitParam(name = "cgorName", value = "the CGOR name", required = true, dataType = "String", paramType = "path"),
@ApiImplicitParam(name = "organisation", value = "the Organisation name", required = true, dataType = "String", paramType = "query")
})
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Success", response = Participant.class),
@ApiResponse(code = 400, message = "Bad Request", response = Participant.class),
@ApiResponse(code = 500, message = "Failure", response = Participant.class)})
public ResponseEntity<Participant> getParticipantFromCGOR(@PathVariable String cgorName, @QueryParam("organisation") String organisation) {
log.info("--> getParticipantFromCGOR: " + cgorName);
Participant participant;
try {
participant = connector.getParticipantFromCGOR(cgorName, organisation);
} catch (CISCommunicationException e) {
log.error("Error executing the request: Communication Error" , e);
participant = null;
}
HttpHeaders responseHeaders = new HttpHeaders();
log.info("getParticipantFromCGOR -->");
return new ResponseEntity<Participant>(participant, responseHeaders, HttpStatus.OK);
}
示例4: createParameterInstance
import io.swagger.annotations.ApiImplicitParam; //导入依赖的package包/类
private static Parameter createParameterInstance(ApiImplicitParam paramAnnotation) {
switch (paramAnnotation.paramType()) {
case "path":
return new PathParameter();
case "query":
return new QueryParameter();
case "body":
return new BodyParameter();
case "header":
return new HeaderParameter();
case "form":
return new FormParameter();
case "cookie":
return new CookieParameter();
default:
throw new Error("not support paramType " + paramAnnotation.paramType());
}
}
示例5: add
import io.swagger.annotations.ApiImplicitParam; //导入依赖的package包/类
/**
* 新增域
*/
@RequestMapping(method = RequestMethod.POST)
@ResponseBody
@ApiOperation(value = "新增域信息", notes = "添加新的域信息,新增的域默认授权给创建人")
@ApiImplicitParam(name = "domain_id", value = "域编码", required = true, dataType = "String")
public String add(HttpServletResponse response, HttpServletRequest request) {
DomainEntity domainEntity = parse(request);
RetMsg retMsg = domainService.add(domainEntity);
if (retMsg.checkCode()) {
return Hret.success(retMsg);
}
response.setStatus(retMsg.getCode());
return Hret.error(retMsg);
}
示例6: GetPosts
import io.swagger.annotations.ApiImplicitParam; //导入依赖的package包/类
@ApiOperation("翻页查询帖子接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "search", value = "查询条件", dataType = "int"),
@ApiImplicitParam(name = "type", value = "帖子类型[top : good : ]", dataType = "String"),
@ApiImplicitParam(name = "pageNo", value = "页码[从1开始]", dataType = "int"),
@ApiImplicitParam(name = "length", value = "返回结果数量[默认20]", dataType = "int")
})
@GetMapping()
public QuarkResult GetPosts(
@RequestParam(required = false, defaultValue = "") String search,
@RequestParam(required = false, defaultValue = "") String type,
@RequestParam(required = false, defaultValue = "1") int pageNo,
@RequestParam(required = false, defaultValue = "20") int length) {
QuarkResult result = restProcessor(() -> {
if (!type.equals("good") && !type.equals("top") && !type.equals(""))
return QuarkResult.error("类型错误!");
Page<Posts> page = postsService.getPostsByPage(type, search, pageNo - 1, length);
return QuarkResult.ok(page.getContent(), page.getTotalElements(), page.getNumberOfElements());
});
return result;
}
示例7: GetPostsDetail
import io.swagger.annotations.ApiImplicitParam; //导入依赖的package包/类
@ApiOperation("翻页帖子详情与回复接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "postsid", value = "帖子的id", dataType = "int"),
@ApiImplicitParam(name = "pageNo", value = "页码[从1开始]", dataType = "int"),
@ApiImplicitParam(name = "length", value = "返回结果数量[默认20]", dataType = "int")
})
@GetMapping("/detail/{postsid}")
public QuarkResult GetPostsDetail(
@PathVariable("postsid") Integer postsid,
@RequestParam(required = false, defaultValue = "1") int pageNo,
@RequestParam(required = false, defaultValue = "20") int length) {
QuarkResult result = restProcessor(() -> {
HashMap<String, Object> map = new HashMap<>();
Posts posts = postsService.findOne(postsid);
if (posts == null) return QuarkResult.error("帖子不存在");
map.put("posts", posts);
Page<Reply> page = replyService.getReplyByPage(postsid, pageNo - 1, length);
map.put("replys", page.getContent());
return QuarkResult.ok(map, page.getTotalElements(), page.getNumberOfElements());
});
return result;
}
示例8: GetPostsByLabel
import io.swagger.annotations.ApiImplicitParam; //导入依赖的package包/类
@ApiOperation("根据labelId获取帖子接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "labelid", value = "标签的id", dataType = "int"),
@ApiImplicitParam(name = "pageNo", value = "页码[从1开始]", dataType = "int"),
@ApiImplicitParam(name = "length", value = "返回结果数量[默认20]", dataType = "int"),
})
@GetMapping("/label/{labelid}")
public QuarkResult GetPostsByLabel(
@PathVariable("labelid") Integer labelid,
@RequestParam(required = false, defaultValue = "1") int pageNo,
@RequestParam(required = false, defaultValue = "20") int length) {
QuarkResult result = restProcessor(() -> {
Label label = labelService.findOne(labelid);
if (label == null) return QuarkResult.error("标签不存在");
Page<Posts> page = postsService.getPostsByLabel(label, pageNo - 1, length);
return QuarkResult.ok(page.getContent(), page.getTotalElements(), page.getNumberOfElements());
});
return result;
}
示例9: checkUserName
import io.swagger.annotations.ApiImplicitParam; //导入依赖的package包/类
@ApiOperation("注册接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "email", value = "用户邮箱",dataType = "String"),
@ApiImplicitParam(name = "username", value = "用户名称",dataType = "String"),
@ApiImplicitParam(name = "password", value = "用户密码",dataType = "String")
})
@PostMapping
public QuarkResult checkUserName(String email,String username,String password) {
QuarkResult result = restProcessor(() -> {
if (!userService.checkUserName(username))
return QuarkResult.warn("用户名已存在,请重新输入");
if (!userService.checkUserEmail(email))
return QuarkResult.warn("用户邮箱已存在,请重新输入");
else
userService.createUser(email,username,password);
return QuarkResult.ok();
});
return result;
}
示例10: Login
import io.swagger.annotations.ApiImplicitParam; //导入依赖的package包/类
@ApiOperation("登录接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "email", value = "用户邮箱",dataType = "String"),
@ApiImplicitParam(name = "password", value = "用户密码",dataType = "String")
})
@PostMapping("/login")
public QuarkResult Login(String email,String password) {
QuarkResult result = restProcessor(() -> {
User loginUser = userService.findByEmail(email);
if (loginUser == null)
return QuarkResult.warn("用户邮箱不存在,请重新输入");
if (!loginUser.getPassword().equals(DigestUtils.md5DigestAsHex(password.getBytes())))
return QuarkResult.warn("用户密码错误,请重新输入");
String token = userService.LoginUser(loginUser);
return QuarkResult.ok(token);
});
return result;
}
示例11: getUserAndMessageByToken
import io.swagger.annotations.ApiImplicitParam; //导入依赖的package包/类
@ApiOperation("根据Token获取用户的信息与通知消息数量")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "发送给用户的唯一令牌",dataType = "String"),
})
@GetMapping("/message/{token}")
public QuarkResult getUserAndMessageByToken(@PathVariable String token){
QuarkResult result = restProcessor(() -> {
HashMap<String, Object> map = new HashMap<>();
User user = userService.getUserByToken(token);
if (user == null) return QuarkResult.warn("session过期,请重新登录");
long count = notificationService.getNotificationCount(user.getId());
map.put("user",user);
map.put("messagecount",count);
return QuarkResult.ok(map);
});
return result;
}
示例12: updateUser
import io.swagger.annotations.ApiImplicitParam; //导入依赖的package包/类
@ApiOperation("根据Token修改用户的信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "token", value = "发送给用户的唯一令牌",dataType = "String"),
@ApiImplicitParam(name = "username", value = "要修改的用户名",dataType = "String"),
@ApiImplicitParam(name = "signature", value = "用户签名",dataType = "String"),
@ApiImplicitParam(name = "sex", value = "要修改的性别:数值0为男,1为女",dataType = "int"),
})
@PutMapping("/{token}")
public QuarkResult updateUser(@PathVariable("token") String token,String username,String signature,Integer sex){
QuarkResult result = restProcessor(() -> {
if (!userService.checkUserName(username)) return QuarkResult.warn("用户名重复!");
if (sex != 0 && sex != 1) return QuarkResult.warn("性别输入错误!");
userService.updateUser(token, username, signature, sex);
return QuarkResult.ok();
});
return result;
}
示例13: getUserById
import io.swagger.annotations.ApiImplicitParam; //导入依赖的package包/类
@ApiOperation("根据用户ID获取用户详情与用户最近发布的十个帖子[主要用于用户主页展示]")
@ApiImplicitParams({
@ApiImplicitParam(name = "id", value = "用户的id", dataType = "int")
})
@GetMapping("/detail/{userid}")
public QuarkResult getUserById(@PathVariable("userid") Integer userid){
QuarkResult result = restProcessor(() -> {
User user = userService.findOne(userid);
if (user == null || userid == null) return QuarkResult.warn("用户不存在");
List<Posts> postss = postsService.getPostsByUser(user);
HashMap<String, Object> map = new HashMap<>();
map.put("posts",postss);
map.put("user",user);
return QuarkResult.ok(map);
});
return result;
}
示例14: getOrganisationByName
import io.swagger.annotations.ApiImplicitParam; //导入依赖的package包/类
@ApiOperation(value = "getOrganisationByName", nickname = "getOrganisationByName")
@RequestMapping(value = "/CISConnector/getOrganisationByName/{organisation}", method = RequestMethod.GET)
@ApiImplicitParams({
@ApiImplicitParam(name = "organisation", value = "the Organisation name", required = true, dataType = "String", paramType = "path")
})
@ApiResponses(value = {
@ApiResponse(code = 200, message = "Success", response = ResponseEntity.class),
@ApiResponse(code = 400, message = "Bad Request", response = ResponseEntity.class),
@ApiResponse(code = 500, message = "Failure", response = ResponseEntity.class)})
public ResponseEntity<Organisation> getOrganisationByName(@PathVariable String organisation) throws CISCommunicationException {
log.info("--> getOrganisationByName: " + organisation);
Organisation organisationRes = null;
try {
organisationRes = connector.getOrganisationByName(organisation);
} catch (CISCommunicationException e) {
log.error("Error executing the request: Communication Error" , e);
organisationRes = null;
}
HttpHeaders responseHeaders = new HttpHeaders();
log.info("getOrganisationByName -->");
return new ResponseEntity<Organisation>(organisationRes, responseHeaders, HttpStatus.OK);
}
示例15: CreateReply
import io.swagger.annotations.ApiImplicitParam; //导入依赖的package包/类
@ApiOperation("发布回复接口")
@ApiImplicitParams({
@ApiImplicitParam(name = "content", value = "回复内容", dataType = "String"),
@ApiImplicitParam(name = "token", value = "用户令牌", dataType = "String"),
@ApiImplicitParam(name = "postsId", value = "帖子ID", dataType = "Integer")
})
@PostMapping
public QuarkResult CreateReply(Reply reply,Integer postsId,String token){
QuarkResult result = restProcessor(() -> {
if (token == null) return QuarkResult.warn("请先登录!");
User userbytoken = userService.getUserByToken(token);
if (userbytoken == null) return QuarkResult.warn("用户不存在,请先登录!");
User user = userService.findOne(userbytoken.getId());
if (user.getEnable() != 1) return QuarkResult.warn("用户处于封禁状态!");
replyService.saveReply(reply, postsId, user);
return QuarkResult.ok();
});
return result;
}