io.swagger.annotations.ApiImplicitParams Java Examples

The following examples show how to use io.swagger.annotations.ApiImplicitParams. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CartController.java    From gpmall with Apache License 2.0 6 votes vote down vote up
/**
 * 删除购物车中的商品
 *
 * @return
 */
@ApiOperation("删除购物车中的商品")
@DeleteMapping("/carts/{uid}/{pid}")
@ApiImplicitParams({
        @ApiImplicitParam(name = "uid", value = "用户ID", paramType = "path"),
        @ApiImplicitParam(name = "pid", value = "商品ID", paramType = "path")
})
public ResponseData deleteCarts(@PathVariable("uid") long uid, @PathVariable("pid") long pid) {
    DeleteCartItemRequest request = new DeleteCartItemRequest();
    request.setUserId(uid);
    request.setItemId(pid);

    DeleteCartItemResponse response = iCartService.deleteCartItem(request);
    if (response.getCode().equals(ShoppingRetCode.SUCCESS.getCode())) {
        return new ResponseUtil().setData(response.getMsg());
    }
    return new ResponseUtil().setErrorMsg(response.getMsg());
}
 
Example #2
Source File: UserController.java    From JavaQuarkBBS with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #3
Source File: OrderController.java    From gpmall with Apache License 2.0 6 votes vote down vote up
/**
 * 获取当前用户的所有订单
 * @return
 */
@GetMapping("/order")
@ApiOperation("获取当前用户的所有订单")
@ApiImplicitParams({
        @ApiImplicitParam(name = "pageInfo", value = "分页信息", dataType = "PageInfo", required = true),
        @ApiImplicitParam(name = "servletRequest", value = "HttpServletRequest", dataType = "HttpServletRequest", required = true)
})
public ResponseData orderByCurrentId(PageInfo pageInfo,HttpServletRequest servletRequest){
    OrderListRequest request = new OrderListRequest();
    request.setPage(pageInfo.getPage());
    request.setSize(pageInfo.getSize());
    request.setSort(pageInfo.getSort());
    String userInfo=(String)servletRequest.getAttribute(TokenIntercepter.USER_INFO_KEY);
    JSONObject object= JSON.parseObject(userInfo);
    Long uid=Long.parseLong(object.get("uid").toString());
    request.setUserId(uid);
    OrderListResponse listResponse = orderQueryService.orderList(request);
    if(listResponse.getCode().equals(OrderRetCode.SUCCESS.getCode())){
        PageResponse response = new PageResponse();
        response.setData(listResponse.getDetailInfoList());
        response.setTotal(listResponse.getTotal());
        return new ResponseUtil<>().setData(response);
    }
    return new ResponseUtil<>().setErrorMsg(listResponse.getMsg());
}
 
Example #4
Source File: UserController.java    From efo with MIT License 6 votes vote down vote up
@ApiOperation(value = "登录(用户名密码和token必须有一个输入)")
@ApiImplicitParams({@ApiImplicitParam(name = "username", value = "用户名"), @ApiImplicitParam(name
        = "password", value = "密码"), @ApiImplicitParam(name = "auto", value = "是否自动登录", dataType = "Boolean"),
        @ApiImplicitParam(name = "token", value = "用于自动登录")})
@AuthInterceptor(InterceptorLevel.NONE)
@RequestMapping(value = "/login", method = RequestMethod.PUT)
public String login(String username, String password, boolean auto, String token) {
    //使用密码登录
    User user = userService.login(username, password, ValueConsts.NULL_STRING, ValueConsts.NULL_RESPONSE);
    if (Checker.isNull(user) || user.getPermission() < 1) {
        jsonObject.put("status", "failed");
    } else {
        request.getSession().setAttribute(ValueConsts.USER_STRING, user);
        jsonObject.put("status", "success");
        if (auto) {
            jsonObject.put("token", TokenConfig.generateToken(token, user.getId()));
        } else {
            jsonObject.put("token", "");
            TokenConfig.removeTokenByValue(user.getId());
        }
    }
    return jsonObject.toString();
}
 
Example #5
Source File: DomainMappingsRoutes.java    From james-project with Apache License 2.0 6 votes vote down vote up
@DELETE
@Path(SPECIFIC_MAPPING_PATH)
@ApiOperation(value = "Removes domain mapping between source and destination domains.")
@ApiImplicitParams({
    @ApiImplicitParam(required = true, dataType = "string", name = FROM_DOMAIN, paramType = "path")
})
@ApiResponses(value = {
    @ApiResponse(code = HttpStatus.NO_CONTENT_204, message = "Ok"),
    @ApiResponse(code = HttpStatus.BAD_REQUEST_400, message = "Domain name is invalid"),
    @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500,
        message = "Internal server error - Something went bad on the server side.")
})
public HaltException removeDomainMapping(Request request, Response response) throws RecipientRewriteTableException {
    MappingSource mappingSource = mappingSourceFrom(request);
    Domain destinationDomain = extractDomain(request.body());

    recipientRewriteTable.removeDomainMapping(mappingSource, destinationDomain);
    return halt(HttpStatus.NO_CONTENT_204);
}
 
Example #6
Source File: DomainController.java    From hauth-java with MIT License 6 votes vote down vote up
/**
 * 查询某一个域的详细信息
 * 如果http请求的参数domain_id为空,则返回null
 */
@RequestMapping(value = "/details", method = RequestMethod.GET)
@ApiOperation(value = "查询域的详细信息", notes = "查询某一个指定域的详细定义信息,如果请求的参数为空,则返回用户自己所在域的详细信息")
@ApiImplicitParams({
        @ApiImplicitParam(required = true, name = "domain_id", value = "域编码")
})
public String getDomainDetails(HttpServletRequest request) {
    String domainId = request.getParameter("domain_id");
    if (domainId == null || domainId.isEmpty()) {
        logger.info("domain id is empty, return null");
        return null;
    }

    // 检查用户对域有没有读权限
    Boolean status = authService.domainAuth(request, domainId, "r").getStatus();
    if (status) {
        return Hret.error(403, "您没有被授权访问域【" + domainId + "】", null);
    }

    DomainEntity domainEntity = domainService.getDomainDetails(domainId);
    return new GsonBuilder().create().toJson(domainEntity);
}
 
Example #7
Source File: CatalogController.java    From logging-log4j-audit with Apache License 2.0 6 votes vote down vote up
@ApiImplicitParams( {@ApiImplicitParam(dataType = "String", name = "Authorization", paramType = "header")})
@ApiOperation(value = "Create a catalog Product", notes = "Creates a catalog product", tags = {"Catalog"})
@PostMapping(value = "/product", consumes=Versions.V1_0, produces=Versions.V1_0)
public ResponseEntity<Product> createProduct(@ApiParam(value = "product", required = true) @RequestBody Product product) {
    if (product.getCatalogId() == null) {
        throw new IllegalArgumentException("A catalog id is required to create a product.");
    }
    if (DEFAULT_CATALOG.equals(product.getCatalogId())) {
        throw new IllegalArgumentException("The default catalog cannot be modified at run time.");
    }
    Optional<ProductModel> opt = productService.getProduct(product.getCatalogId(), product.getName());
    if (opt != null && opt.isPresent()) {
        throw new IllegalStateException("A product named "+ product.getName() + " in catalog " +
                product.getCatalogId() + " already exists");
    }
    ProductModel model = productConverter.convert(product);
    model = productService.saveProduct(model);
    return new ResponseEntity<>(productModelConverter.convert(model), HttpStatus.CREATED);
}
 
Example #8
Source File: UserController.java    From efo with MIT License 6 votes vote down vote up
@ApiOperation(value = "重置我的密码")
@ApiImplicitParams({@ApiImplicitParam(name = "email", value = "邮箱", required = true), @ApiImplicitParam(name =
        "code", value = "验证码", required = true), @ApiImplicitParam(name = "password", value = "密码", required =
        true)})
@AuthInterceptor(InterceptorLevel.NONE)
@RequestMapping(value = "/password/reset", method = RequestMethod.PUT)
public String resetPassword(String email, String code, String password) {
    jsonObject.put("status", "error");
    if (isCodeValidate(code)) {
        if (userService.resetPasswordByEmail(email, password)) {
            jsonObject.put("status", "success");
        } else {
            jsonObject.put("message", "格式不合法");
        }
    } else {
        jsonObject.put("message", "验证码校验失败");
    }
    return jsonObject.toString();
}
 
Example #9
Source File: ReCiterPubManagerController.java    From ReCiter with Apache License 2.0 6 votes vote down vote up
@ApiOperation(value = "Create user for ReCiter publications manager", response = Boolean.class, notes = "This api create user for reciter publication manager app.")
@ApiImplicitParams({
	@ApiImplicitParam(name = "api-key", value = "api-key for this resource", paramType = "header")
})
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "User created"),
        @ApiResponse(code = 401, message = "You are not authorized to view the resource"),
        @ApiResponse(code = 403, message = "Accessing the resource you were trying to reach is forbidden"),
        @ApiResponse(code = 404, message = "The resource you were trying to reach is not found")
})
@RequestMapping(value = "/reciter/publication/manager/user/create", method = RequestMethod.POST, produces = "application/json")
@ResponseBody
public boolean createUser(@RequestParam(value = "username") String uid, @RequestParam(value = "name") String username, @RequestParam(value = "password") String password) {
    log.info("Creating user with username: " + uid);
    
    ApplicationUser appUser = new ApplicationUser(uid, username, password);
    if(applicationUserService.createUser(appUser)) {
    	return true;
    }
    return false;
}
 
Example #10
Source File: ExaminationController.java    From spring-microservice-exam with MIT License 6 votes vote down vote up
/**
  * 根据考试ID获取题目分页数据
  *
  * @param pageNum    pageNum
  * @param pageSize   pageSize
  * @param sort       sort
  * @param order      order
  * @param subjectDto subjectDto
  * @return PageInfo
  * @author tangyi
  * @date 2019/6/16 15:45
  */
 @RequestMapping("subjectList")
 @ApiOperation(value = "获取题目列表")
 @ApiImplicitParams({
         @ApiImplicitParam(name = CommonConstant.PAGE_NUM, value = "分页页码", defaultValue = CommonConstant.PAGE_NUM_DEFAULT, dataType = "String"),
         @ApiImplicitParam(name = CommonConstant.PAGE_SIZE, value = "分页大小", defaultValue = CommonConstant.PAGE_SIZE_DEFAULT, dataType = "String"),
         @ApiImplicitParam(name = CommonConstant.SORT, value = "排序字段", defaultValue = CommonConstant.PAGE_SORT_DEFAULT, dataType = "String"),
         @ApiImplicitParam(name = CommonConstant.ORDER, value = "排序方向", defaultValue = CommonConstant.PAGE_ORDER_DEFAULT, dataType = "String"),
         @ApiImplicitParam(name = "subjectDto", value = "题目信息", dataType = "SubjectDto")
 })
 public PageInfo<SubjectDto> subjectList(@RequestParam(value = CommonConstant.PAGE_NUM, required = false, defaultValue = CommonConstant.PAGE_NUM_DEFAULT) String pageNum,
                                         @RequestParam(value = CommonConstant.PAGE_SIZE, required = false, defaultValue = CommonConstant.PAGE_SIZE_DEFAULT) String pageSize,
                                         @RequestParam(value = CommonConstant.SORT, required = false, defaultValue = CommonConstant.PAGE_SORT_DEFAULT) String sort,
                                         @RequestParam(value = CommonConstant.ORDER, required = false, defaultValue = CommonConstant.PAGE_ORDER_DEFAULT) String order,
SubjectDto subjectDto) {
     return examinationService.findSubjectPageById(subjectDto, pageNum, pageSize, sort, order);
 }
 
Example #11
Source File: CatalogController.java    From logging-log4j-audit with Apache License 2.0 6 votes vote down vote up
@ApiImplicitParams( {@ApiImplicitParam(dataType = "String", name = "Authorization", paramType = "header")})
@ApiOperation(value = "Update a catalog Event", notes = "Updates a catalog event", tags = {"Catalog"})
@PutMapping(value = "/event", consumes=Versions.V1_0, produces=Versions.V1_0)
public ResponseEntity<Event> updateEvent(@ApiParam(value = "event", required = true) @RequestBody Event event) {
    if (event.getCatalogId() == null) {
        throw new IllegalArgumentException("A catalog id is required to update an event.");
    }
    if (DEFAULT_CATALOG.equals(event.getCatalogId())) {
        throw new IllegalArgumentException("The default catalog cannot be modified at run time.");
    }
    EventModel model;
    synchronized(this) {
        model = eventConverter.convert(event);
        model = eventService.saveEvent(model);
    }
    return new ResponseEntity<>(eventModelConverter.convert(model), HttpStatus.OK);
}
 
Example #12
Source File: GatewayIpLimitController.java    From open-cloud with MIT License 6 votes vote down vote up
/**
 * 编辑IP限制
 *
 * @param policyId   IP限制ID
 * @param policyName 策略名称
 * @param policyType 策略类型:0-拒绝/黑名单 1-允许/白名单
 * @param ipAddress  ip地址/IP段:多个用隔开;最多10个
 * @return
 */
@ApiOperation(value = "编辑IP限制", notes = "编辑IP限制")
@ApiImplicitParams({
        @ApiImplicitParam(name = "policyId", required = true, value = "接口Id", paramType = "form"),
        @ApiImplicitParam(name = "policyName", required = true, value = "策略名称", paramType = "form"),
        @ApiImplicitParam(name = "policyType", required = true, value = "策略类型:0-拒绝/黑名单 1-允许/白名单", allowableValues = "0,1", paramType = "form"),
        @ApiImplicitParam(name = "ipAddress", required = true, value = "ip地址/IP段:多个用隔开;最多10个", paramType = "form")
})
@PostMapping("/gateway/limit/ip/update")
public ResultBody updateIpLimit(
        @RequestParam("policyId") Long policyId,
        @RequestParam(value = "policyName") String policyName,
        @RequestParam(value = "policyType") Integer policyType,
        @RequestParam(value = "ipAddress") String ipAddress
) {
    GatewayIpLimit ipLimit = new GatewayIpLimit();
    ipLimit.setPolicyId(policyId);
    ipLimit.setPolicyName(policyName);
    ipLimit.setPolicyType(policyType);
    ipLimit.setIpAddress(ipAddress);
    gatewayIpLimitService.updateIpLimitPolicy(ipLimit);
    openRestTemplate.refreshGateway();
    return ResultBody.ok();
}
 
Example #13
Source File: ReCiterPubManagerController.java    From ReCiter with Apache License 2.0 6 votes vote down vote up
@ApiOperation(value = "Authenticate user for ReCiter publications manager", response = Boolean.class, notes = "This api checks for credentials for access to reciter publication manager app.")
@ApiImplicitParams({
	@ApiImplicitParam(name = "api-key", value = "api-key for this resource", paramType = "header")
})
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "User authenticated"),
        @ApiResponse(code = 401, message = "You are not authorized to view the resource"),
        @ApiResponse(code = 403, message = "Accessing the resource you were trying to reach is forbidden"),
        @ApiResponse(code = 404, message = "The resource you were trying to reach is not found")
})
@RequestMapping(value = "/reciter/publication/manager/authenticate", method = RequestMethod.POST, produces = "application/json")
@ResponseBody
public boolean authenticate(@RequestParam(value = "username") String uid, @RequestParam(value = "password") String password) {
    log.info("Authenticating user with username: " + uid);
    
    ApplicationUser appUser = new ApplicationUser(uid, "", password);
    if(applicationUserService.authenticateUser(appUser)) {
    	return true;
    }
    return false;
}
 
Example #14
Source File: PanelController.java    From poseidon with Apache License 2.0 6 votes vote down vote up
@ApiOperation(value = "点击商品分类,查看商品分类下的版块(包含商品)", response = PanelDto.class)
@ApiImplicitParams({
		@ApiImplicitParam(paramType = "query", dataType = "String", name = "cId", value = "商品分类id"),
		@ApiImplicitParam(paramType = "query", dataType = "Integer", name = "limit", value = "限制显示的商品数量")

})
@GetMapping(path = { "/cat/{cId}",
		"/cat/{cId}/{limit}" }, produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public Message panelWithItems(@PathVariable("cId") Long itemCatId,
		@PathVariable(value = "limit", required = false) Integer limit) {
	try {
		List<PanelDto> data = panelService.getPanelWithItemsByItemCatId(itemCatId,
				limit);
		return success(data);
	}
	catch (Exception e) {
		e.printStackTrace();
	}
	return failed();
}
 
Example #15
Source File: ItemController.java    From poseidon with Apache License 2.0 6 votes vote down vote up
@ApiOperation(value = "get item by id", response = ItemDto.class)
@ApiImplicitParams({
		@ApiImplicitParam(paramType = "query", dataType = "String", name = "id",
				value = "商品id", required = true),
		@ApiImplicitParam(paramType = "query", dataType = "int", name = "blob",
				value = "0代表不包含大字段信息,1表示包含大字段信息", required = true) })

@GetMapping(path = "/{id}/{blob}", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
public Message item(@PathVariable("id") String id, @PathVariable("blob") int blob) {
	try {
		ItemDto data = itemService.getById(id, blob);
		return success(data);
	}
	catch (Exception e) {
		e.printStackTrace();
	}
	return failed();
}
 
Example #16
Source File: BaseAuthorityController.java    From open-cloud with MIT License 6 votes vote down vote up
/**
 * 分配应用权限
 *
 * @param appId        应用Id
 * @param expireTime   授权过期时间
 * @param authorityIds 权限ID.多个以,隔开
 * @return
 */
@ApiOperation(value = "分配应用权限", notes = "分配应用权限")
@ApiImplicitParams({
        @ApiImplicitParam(name = "appId", value = "应用Id", defaultValue = "", required = true, paramType = "form"),
        @ApiImplicitParam(name = "expireTime", value = "过期时间.选填", defaultValue = "", required = false, paramType = "form"),
        @ApiImplicitParam(name = "authorityIds", value = "权限ID.多个以,隔开.选填", defaultValue = "", required = false, paramType = "form")
})
@PostMapping("/authority/app/grant")
public ResultBody grantAuthorityApp(
        @RequestParam(value = "appId") String appId,
        @RequestParam(value = "expireTime", required = false) @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") Date expireTime,
        @RequestParam(value = "authorityIds", required = false) String authorityIds
) {
    baseAuthorityService.addAuthorityApp(appId, expireTime, StringUtils.isNotBlank(authorityIds) ? authorityIds.split(",") : new String[]{});
    openRestTemplate.refreshGateway();
    return ResultBody.ok();
}
 
Example #17
Source File: UserController.java    From springboot-learn with MIT License 6 votes vote down vote up
@ApiOperation(value = "列表查询(分页)", notes = "列表查询(分页)")
@ApiImplicitParams({
        @ApiImplicitParam(name = "pageNum", value = "页码", required = true, defaultValue = "1", dataType = "int", paramType = "query"),
        @ApiImplicitParam(name = "pageSize", value = "每页记录数", required = true, defaultValue = "10", dataType = "int", paramType = "query"),
        @ApiImplicitParam(name = "orderBy", value = "排序", dataType = "int", paramType = "query", example = "updateTime desc, id asc"),
        @ApiImplicitParam(name = "name", value = "用户名称", dataType = "String", paramType = "query"),
})
@GetMapping("/list")
public Result list(@RequestParam(required = false) @ApiIgnore Map<String, Object> params) {
    PageInfo<?> pageInfo = PageBuiler.builder(params);
    Result result = userService.queryPage(params, pageInfo);
    Map<String, Object> data = (Map<String, Object>) result.getData();
    List<User> userList = (List<User>) data.get(Constants.LIST);
    if (userList != null && userList.size() > 0) {
        for (User user : userList) {
            user.setPassword("");
        }
    }
    return result;
}
 
Example #18
Source File: PostsController.java    From JavaQuarkBBS with Apache License 2.0 6 votes vote down vote up
@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;

}
 
Example #19
Source File: RnPackageController.java    From app-version with Apache License 2.0 6 votes vote down vote up
@ApiImplicitParams({
        @ApiImplicitParam(name = "Authorization", value = "用户登录凭证", paramType = "header", dataType = "string", defaultValue = "Bearer ", required = true),
})
@PutMapping("/{id}")
@OperationRecord(type = OperationRecordLog.OperationType.UPDATE, resource = OperationRecordLog.OperationResource.RN_PACKAGE, description = OperationRecordLog.OperationDescription.UPDATE_RN_PACKAGE)
public ServiceResult update(@PathVariable int id, @RequestBody RnPackageRequestDTO rnPackageRequestDTO) {
    if (id < 1) {
        return ServiceResultConstants.NEED_PARAMS;
    }
    //校验版本区间
    if (StringUtilsExt.hasNotBlank(rnPackageRequestDTO.getVersionMin(), rnPackageRequestDTO.getVersionMax()) && basicService.compareVersion(rnPackageRequestDTO.getVersionMax(), rnPackageRequestDTO.getVersionMin()) <= 0) {
        return ServiceResultConstants.MIN_BIG_THAN_MAX;
    }
    RnPackage rnPackage = new RnPackage();
    BeanUtils.copyProperties(rnPackageRequestDTO, rnPackage);
    rnPackage.setId(id);
    return rnPackageService.update(rnPackage);
}
 
Example #20
Source File: RnPackageController.java    From app-version with Apache License 2.0 6 votes vote down vote up
@ApiImplicitParams({
        @ApiImplicitParam(name = "Authorization", value = "用户登录凭证", paramType = "header", dataType = "string", defaultValue = "Bearer ", required = true),
})
@PostMapping
@OperationRecord(type = OperationRecordLog.OperationType.CREATE, resource = OperationRecordLog.OperationResource.RN_PACKAGE, description = OperationRecordLog.OperationDescription.CREATE_RN_PACKAGE)
public ServiceResult create(@RequestBody RnPackageRequestDTO rnPackageRequestDTO) {
    if (StringUtilsExt.hasEmpty(
            rnPackageRequestDTO.getRnName(),
            rnPackageRequestDTO.getRnNickName(),
            rnPackageRequestDTO.getResourceUrl(),
            rnPackageRequestDTO.getRnVersion(),
            rnPackageRequestDTO.getRnUpdateLog()
    )) {
        return ServiceResultConstants.NEED_PARAMS;
    }
    //校验版本区间
    if (StringUtilsExt.hasNotBlank(rnPackageRequestDTO.getVersionMin(), rnPackageRequestDTO.getVersionMax())) {
        if (basicService.compareVersion(rnPackageRequestDTO.getVersionMax(), rnPackageRequestDTO.getVersionMin()) <= 0) {
            return ServiceResultConstants.MIN_BIG_THAN_MAX;
        }
    }

    RnPackage rnPackage = new RnPackage();
    BeanUtils.copyProperties(rnPackageRequestDTO, rnPackage);
    return rnPackageService.create(rnPackage);
}
 
Example #21
Source File: AndroidController.java    From app-version with Apache License 2.0 6 votes vote down vote up
@ApiImplicitParams({
        @ApiImplicitParam(name = "Authorization", value = "用户登录凭证", paramType = "header", dataType = "string", defaultValue = "Bearer ", required = true),
})
@PutMapping("/{id}")
@OperationRecord(type = OperationRecordLog.OperationType.UPDATE, resource = OperationRecordLog.OperationResource.ANDROID_VERSION, description = OperationRecordLog.OperationDescription.UPDATE_ANDROID_VERSION)
public ServiceResult update(@RequestBody AndroidVersionRequestDTO androidVersionRequestDTO, @PathVariable int id) {
    if (id < 1) {
        return ServiceResultConstants.NEED_PARAMS;
    }

    String appVersion = androidVersionRequestDTO.getAppVersion();
    String allowLowestVersion = androidVersionRequestDTO.getAllowLowestVersion();
    //校验版本区间
    if (StringUtilsExt.hasNotBlank(allowLowestVersion, appVersion) && basicService.compareVersion(appVersion, allowLowestVersion) < 0) {
        return ServiceResultConstants.ALLOWLOWESTVERSION_BIG_THAN_APPVERSION;
    }
    AndroidVersion androidVersion = new AndroidVersion();
    BeanUtils.copyProperties(androidVersionRequestDTO, androidVersion);
    androidVersion.setId(id);
    return androidVersionService.updateAndroidVersion(androidVersion);
}
 
Example #22
Source File: SysUserController.java    From open-capacity-platform with Apache License 2.0 6 votes vote down vote up
/**
 *  修改用户状态
 * @param params
 * @return
 * @author gitgeek
 */
@ApiOperation(value = "修改用户状态")
@GetMapping("/users/updateEnabled")
@ApiImplicitParams({
        @ApiImplicitParam(name = "id", value = "用户id", required = true, dataType = "Integer"),
        @ApiImplicitParam(name = "enabled",value = "是否启用", required = true, dataType = "Boolean")
})
@LogAnnotation(module="user-center",recordRequestParam=false)
@PreAuthorize("hasAnyAuthority('user:get/users/updateEnabled' ,'user:put/users/me')")
public Result updateEnabled(@RequestParam Map<String, Object> params){
    Long id = MapUtils.getLong(params, "id");
    if (id == 1L){
        return Result.failed("超级管理员不给予修改");
    }
    return appUserService.updateEnabled(params);
}
 
Example #23
Source File: IosController.java    From app-version with Apache License 2.0 6 votes vote down vote up
@ApiImplicitParams({
        @ApiImplicitParam(name = "Authorization", value = "用户登录凭证", paramType = "header", dataType = "string", defaultValue = "Bearer ", required = true),
})
@PutMapping("/{id}")
@OperationRecord(type = OperationRecordLog.OperationType.UPDATE, resource = OperationRecordLog.OperationResource.IOS_VERSION, description = OperationRecordLog.OperationDescription.UPDATE_IOS_VERSION)
public ServiceResult update(@RequestBody IosVersionRequestDTO iosVersionRequestDTO, @PathVariable int id) {
    if (id < 1) {
        return ServiceResultConstants.NEED_PARAMS;
    }
    String appVersion = iosVersionRequestDTO.getAppVersion();
    String allowLowestVersion = iosVersionRequestDTO.getAllowLowestVersion();
    //校验版本区间
    if (StringUtilsExt.hasNotBlank(allowLowestVersion, appVersion)) {
        if (basicService.compareVersion(appVersion, allowLowestVersion) < 0) {
            return ServiceResultConstants.ALLOWLOWESTVERSION_BIG_THAN_APPVERSION;
        }
    }
    IosVersion iosVersion = new IosVersion();
    BeanUtils.copyProperties(iosVersionRequestDTO, iosVersion);
    iosVersion.setId(id);
    return iosVersionService.update(iosVersion);
}
 
Example #24
Source File: SieveQuotaRoutes.java    From james-project with Apache License 2.0 6 votes vote down vote up
@PUT
@ApiOperation(value = "Update global sieve quota size")
@ApiImplicitParams({
        @ApiImplicitParam(required = true, dataType = "long", name = REQUESTED_SIZE, paramType = "body")
})
@ApiResponses(value = {
        @ApiResponse(code = 200, message = "OK", response = Long.class),
        @ApiResponse(code = 400, message = "The body is not a positive integer."),
        @ApiResponse(code = 500, message = "Internal server error - Something went bad on the server side.")
})
public void defineUpdateGlobalSieveQuota(Service service) {
    service.put(DEFAULT_QUOTA_PATH, (request, response) -> {
        QuotaSizeLimit requestedSize = extractRequestedQuotaSizeFromRequest(request);
        sieveQuotaRepository.setDefaultQuota(requestedSize);
        return Responses.returnNoContent(response);
    }, jsonTransformer);
}
 
Example #25
Source File: MyOrderController.java    From mall4j with GNU Affero General Public License v3.0 5 votes vote down vote up
/**
 * 订单列表接口
 */
@GetMapping("/myOrder")
@ApiOperation(value = "订单列表信息", notes = "根据订单状态获取订单列表信息,状态为0时获取所有订单")
@ApiImplicitParams({
        @ApiImplicitParam(name = "status", value = "订单状态 1:待付款 2:待发货 3:待收货 4:待评价 5:成功 6:失败", required = false, dataType = "Integer")
})
public ResponseEntity<IPage<MyOrderDto>> myOrder(@RequestParam(value = "status") Integer status,PageParam<MyOrderDto> page) {

    String userId = SecurityUtils.getUser().getUserId();
    IPage<MyOrderDto> myOrderDtoIpage = myOrderService.pageMyOrderByUserIdAndStatus(page, userId, status);
    return ResponseEntity.ok(myOrderDtoIpage);
}
 
Example #26
Source File: BaseUserController.java    From open-cloud with MIT License 5 votes vote down vote up
/**
 * 获取登录账号信息
 *
 * @param username 登录名
 * @return
 */
@ApiOperation(value = "获取账号登录信息", notes = "仅限系统内部调用")
@ApiImplicitParams({
        @ApiImplicitParam(name = "username", required = true, value = "登录名", paramType = "path"),
})
@PostMapping("/user/login")
@Override
public ResultBody<UserAccount> userLogin(@RequestParam(value = "username") String username) {
    UserAccount account = baseUserService.login(username);
    return ResultBody.ok().data(account);
}
 
Example #27
Source File: FooController.java    From tutorials with MIT License 5 votes vote down vote up
@RequestMapping(method = RequestMethod.POST, value = "/foos")
@ResponseStatus(HttpStatus.CREATED)
@ResponseBody
@ApiImplicitParams({ @ApiImplicitParam(name = "foo", value = "List of strings", paramType = "body", dataType = "Foo") })
public Foo create(@RequestBody final Foo foo) {
    foo.setId(Long.parseLong(randomNumeric(2)));
    return foo;
}
 
Example #28
Source File: ExaminationController.java    From spring-microservice-exam with MIT License 5 votes vote down vote up
/**
 * 根据考试ID生成二维码
 * @param examinationId examinationId
 * @param response response
 * @author tangyi
 * @date 2020/3/15 1:16 下午
 */
@ApiOperation(value = "生成二维码", notes = "生成二维码")
@ApiImplicitParams({
        @ApiImplicitParam(name = "examinationId", value = "考试ID", required = true, dataType = "Long", paramType = "path")
})
@GetMapping("anonymousUser/generateQrCode/{examinationId}")
public void produceCode(@PathVariable Long examinationId, HttpServletResponse response) throws Exception {
    response.setHeader("Cache-Control", "no-store, no-cache");
    response.setContentType("image/jpeg");
    try (ByteArrayInputStream inputStream = new ByteArrayInputStream(examinationService.produceCode(examinationId)); ServletOutputStream out = response.getOutputStream()) {
        BufferedImage image = ImageIO.read(inputStream);
        ImageIO.write(image, "PNG", out);
    }
}
 
Example #29
Source File: DispatchController.java    From batch-scheduler with MIT License 5 votes vote down vote up
@RequestMapping(value = "/v1/dispatch/start", method = RequestMethod.GET)
@ResponseBody
@ApiOperation(value = "启动批次", notes = "启动批次时,需要两个参数,一个是域编码,另一个是批次编码")
@ApiImplicitParams({
        @ApiImplicitParam(required = true, name = "domain_id", value = "域编码"),
        @ApiImplicitParam(required = true, name = "batch_id", value = "批次编码"),
})
public String start(HttpServletResponse response, HttpServletRequest request) {

    String domainId = request.getParameter("domain_id");
    String batchId = request.getParameter("batch_id");

    if (domainId == null || batchId == null) {
        response.setStatus(421);
        log.info("batch id or domain jobKey is null ,batch jobKey is: {}, domain jobKey is: {}", batchId, domainId);
        return Hret.error(421, "domain_id is empty or batch_id is empty", null);
    }
    try {
        ResultBody retMsg =  taskExecutorFeign.start(batchId,domainId);
        if (retMsg == null){
            log.info("调用执行节点,返回值为空");
            return Hret.success();
        }
        return Hret.success(retMsg.getCode(), retMsg.getMessage(), retMsg.getData());
    } catch (Exception e) {
        e.printStackTrace();
        log.info("调用执行节点失败,失败原因是:{}", e.getMessage());
        return Hret.success();
    }
}
 
Example #30
Source File: UserController.java    From spring-boot-demo with MIT License 5 votes vote down vote up
@GetMapping
@ApiOperation(value = "条件查询(DONE)", notes = "备注")
@ApiImplicitParams({@ApiImplicitParam(name = "username", value = "用户名", dataType = DataType.STRING, paramType = ParamType.QUERY, defaultValue = "xxx")})
public ApiResponse<User> getByUserName(String username) {
    log.info("多个参数用  @ApiImplicitParams");
    return ApiResponse.<User>builder().code(200).message("操作成功").data(new User(1, username, "JAVA")).build();
}