io.swagger.annotations.ApiImplicitParam Java Examples

The following examples show how to use io.swagger.annotations.ApiImplicitParam. 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: CatalogController.java    From logging-log4j-audit with Apache License 2.0 10 votes vote down vote up
@ApiImplicitParams( {@ApiImplicitParam(dataType = "String", name = "Authorization", paramType = "header")})
@ApiOperation(value = "Update a catalog Product", notes = "Updates a catalog event", tags = {"Catalog"})
@PutMapping(value = "/product", consumes=Versions.V1_0, produces=Versions.V1_0)
public ResponseEntity<Product> updateProduct(@ApiParam(value = "product", required = true) @RequestBody Product product) {
    if (product.getCatalogId() == null) {
        throw new IllegalArgumentException("A catalog id is required to update a product.");
    }
    if (DEFAULT_CATALOG.equals(product.getCatalogId())) {
        throw new IllegalArgumentException("The default catalog cannot be modified at run time.");
    }
    ProductModel model = productConverter.convert(product);
    model = productService.saveProduct(model);
    return new ResponseEntity<>(productModelConverter.convert(model), HttpStatus.OK);
}
 
Example #2
Source File: RoleController.java    From spring-microservice-exam with MIT License 7 votes vote down vote up
/**
 * 角色分页查询
 *
 * @param pageNum  pageNum
 * @param pageSize pageSize
 * @param sort     sort
 * @param order    order
 * @param role     role
 * @return PageInfo
 * @author tangyi
 * @date 2018/10/24 22:13
 */
@GetMapping("roleList")
@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 = "role", value = "角色信息", dataType = "RoleVo")
})
public PageInfo<Role> roleList(@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,
                               Role role) {
    role.setTenantCode(SysUtil.getTenantCode());
    return roleService.findPage(PageUtil.pageInfo(pageNum, pageSize, sort, order), role);
}
 
Example #3
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 #4
Source File: PrivilegeApi.java    From MicroCommunity with Apache License 2.0 6 votes vote down vote up
@RequestMapping(path = "/editPrivilegeGroup",method= RequestMethod.POST)
@ApiOperation(value="编辑权限组", notes="test: 返回 200 表示服务受理成功,其他表示失败")
@ApiImplicitParam(paramType="query", name = "privilegeGroupInfo", value = "权限信息", required = true, dataType = "String")
public ResponseEntity<String> editPrivilegeGroup(@RequestBody String privilegeGroupInfo,HttpServletRequest request){
    ResponseEntity<String> responseEntity = null;

    try {
        responseEntity = privilegeSMOImpl.editPrivilegeGroup(privilegeGroupInfo);
    }catch (Exception e){
        logger.error("请求订单异常",e);
        responseEntity =  new ResponseEntity<String>("请求中心服务发生异常,"+e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
    }finally {
        logger.debug("订单服务返回报文为: {}",responseEntity);
        return responseEntity;
    }
}
 
Example #5
Source File: CustomApiController.java    From app-version with Apache License 2.0 6 votes vote down vote up
@ApiOperation(
        value = "查询自定义接口",
        notes = "根据应用ID、接口KEY、版本、平台获取自定义接口信息"
)
@ApiImplicitParams({
        @ApiImplicitParam(name = "tenantAppId", value = "应用appId", dataType = "string", defaultValue = "uc28ec7f8870a6e785", required = true),
        @ApiImplicitParam(name = "key", value = "自定义接口的key", required = true),
        @ApiImplicitParam(name = "platform", value = "平台,值应为 ios 或 android", required = true),
        @ApiImplicitParam(name = "version", value = "版本号", required = true),
})
@GetMapping("/{tenantAppId}/{key}/{version}/{platform}")
public ServiceResult custom(@PathVariable String tenantAppId,
                            @PathVariable String key,
                            @PathVariable String platform,
                            @PathVariable String version) {
    logger.info("version: " + version);
    if (StringUtilsExt.hasBlank(tenantAppId, key, platform, version)) {
        return ServiceResultConstants.NEED_PARAMS;
    }
    if (!platform.equalsIgnoreCase("ios") && !platform.equalsIgnoreCase("android")) {
        return ServiceResultConstants.PLATFORM_ERROR;
    }

    return customApiService.getCustomContent(tenantAppId, key, platform, version);
}
 
Example #6
Source File: UserRoutes.java    From james-project with Apache License 2.0 6 votes vote down vote up
@HEAD
@Path("/{username}")
@ApiOperation(value = "Testing an user existence")
@ApiImplicitParams({
    @ApiImplicitParam(required = true, dataType = "string", name = "username", paramType = "path")
})
@ApiResponses(value = {
    @ApiResponse(code = HttpStatus.OK_200, message = "OK. User exists."),
    @ApiResponse(code = HttpStatus.BAD_REQUEST_400, message = "Invalid input user."),
    @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "User does not exist."),
    @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500,
        message = "Internal server error - Something went bad on the server side.")
})
public void defineUserExist() {
    service.head(USERS + SEPARATOR + USER_NAME, this::userExist);
}
 
Example #7
Source File: UserController.java    From JavaQuarkBBS with Apache License 2.0 6 votes vote down vote up
@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;
}
 
Example #8
Source File: ContractController.java    From WeBASE-Front with Apache License 2.0 6 votes vote down vote up
/**
 * deploy locally not through sign
 */
@ApiOperation(value = "contract deploy locally", notes = "contract deploy")
@ApiImplicitParam(name = "reqDeploy", value = "contract info", required = true,
        dataType = "ReqDeploy")
@PostMapping("/deploy")
public String deployLocal(@Valid @RequestBody ReqDeploy reqDeploy, BindingResult result)
        throws Exception {
    log.info("contract deployLocal start. ReqDeploy:[{}]", JsonUtils.toJSONString(reqDeploy));
    checkParamResult(result);
    if (StringUtils.isBlank(reqDeploy.getUser())) {
        log.error("contract deployLocal error: user(address) is empty");
        throw new FrontException(ConstantCode.PARAM_FAIL_USER_IS_EMPTY);
    }
    String contractAddress = contractService.caseDeploy(reqDeploy, true);
    log.info("success deployLocal. result:{}", contractAddress);
    return contractAddress;
}
 
Example #9
Source File: AttachmentTestController.java    From zuihou-admin-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * 上传文件
 *
 * @param
 * @return
 * @author zuihou
 * @date 2019-05-06 16:28
 */
@ApiOperation(value = "附件上传", notes = "附件上传")
@ApiImplicitParams({
        @ApiImplicitParam(name = "appCode", value = "应用编码", dataType = "string", paramType = "query"),
        @ApiImplicitParam(name = "id", value = "文件id", dataType = "long", paramType = "query"),
        @ApiImplicitParam(name = "bizId", value = "业务id", dataType = "long", paramType = "query"),
        @ApiImplicitParam(name = "bizType", value = "业务类型", dataType = "long", paramType = "query"),
        @ApiImplicitParam(name = "file", value = "附件", dataType = "MultipartFile", allowMultiple = true, required = true),
})
@PostMapping(value = "/upload")
public R<AttachmentDTO> upload(
        @RequestParam(value = "file") MultipartFile file,
        @RequestParam(value = "isSingle", required = false, defaultValue = "false") Boolean isSingle,
        @RequestParam(value = "id", required = false) Long id,
        @RequestParam(value = "bizId", required = false) String bizId,
        @RequestParam(value = "bizType", required = false) String bizType) throws Exception {
    return attachmentApi.upload(file, isSingle, id, bizId, bizType);
}
 
Example #10
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 #11
Source File: SysRoleController.java    From hdw-dubbo with Apache License 2.0 6 votes vote down vote up
/**
 * 角色信息
 */
@ApiOperation(value = "角色信息", notes = "角色信息")
@ApiImplicitParam(paramType = "path", name = "roleId", value = "主键ID", dataType = "Integer", required = true)
@GetMapping("/info/{roleId}")
@RequiresPermissions("sys/role/info")
public CommonResult<SysRole> info(@PathVariable("roleId") Long roleId) {
    SysRole role = sysRoleService.getById(roleId);
    //查询角色对应的菜单
    List<Long> resourceIdList = sysRoleResourceService.selectResourceIdListByRoleId(roleId);
    role.setResourceIdList(resourceIdList);
    List<SysRoleResource> roleResourceList = sysRoleResourceService.selectResourceNodeListByRoleId(roleId);
    List<TreeNode> treeNodeList = Lists.newArrayList();
    if (!roleResourceList.isEmpty()) {
        roleResourceList.forEach(roleResource -> {
            TreeNode treeNode = new TreeNode();
            treeNode.setId(roleResource.getResourceId().toString());
            treeNode.setLabel(roleResource.getResource().getName());
            treeNodeList.add(treeNode);
        });
    }
    role.setResourceNodeList(treeNodeList);
    return CommonResult.success(role);
}
 
Example #12
Source File: HealthCheckRoutes.java    From james-project with Apache License 2.0 6 votes vote down vote up
@GET
@Path("/checks/{" + PARAM_COMPONENT_NAME + "}")
@ApiOperation(value = "Perform the component's health check")
@ApiImplicitParams({
    @ApiImplicitParam(
        name = PARAM_COMPONENT_NAME,
        required = true,
        paramType = "path",
        dataType = "String",
        defaultValue = "None",
        example = "/checks/Cassandra%20Backend",
        value = "The URL encoded name of the component to check.")
})
public Object performHealthCheckForComponent(Request request, Response response) {
    String componentName = request.params(PARAM_COMPONENT_NAME);
    HealthCheck healthCheck = healthChecks.stream()
        .filter(c -> c.componentName().getName().equals(componentName))
        .findFirst()
        .orElseThrow(() -> throw404(componentName));

    Result result = Mono.from(healthCheck.check()).block();
    logFailedCheck(result);
    response.status(getCorrespondingStatusCode(result.getStatus()));
    return new HealthCheckExecutionResultDto(result);
}
 
Example #13
Source File: MyOrderController.java    From mall4j with GNU Affero General Public License v3.0 6 votes vote down vote up
/**
 * 删除订单
 */
@DeleteMapping("/{orderNumber}")
@ApiOperation(value = "根据订单号删除订单", notes = "根据订单号删除订单")
@ApiImplicitParam(name = "orderNumber", value = "订单号", required = true, dataType = "String")
public ResponseEntity<String> delete(@PathVariable("orderNumber") String orderNumber) {
    String userId = SecurityUtils.getUser().getUserId();

    Order order = orderService.getOrderByOrderNumber(orderNumber);
    if (order == null) {
        throw new YamiShopBindException("该订单不存在");
    }
    if (!Objects.equals(order.getUserId(), userId)) {
        throw new YamiShopBindException("你没有权限获取该订单信息");
    }
    if (!Objects.equals(order.getStatus(), OrderStatus.SUCCESS.value()) || !Objects.equals(order.getStatus(), OrderStatus.CLOSE.value()) ) {
        throw new YamiShopBindException("订单未完成或未关闭,无法删除订单");
    }

    // 删除订单
    orderService.deleteOrders(Arrays.asList(order));

    return ResponseEntity.ok("删除成功");
}
 
Example #14
Source File: AdminController.java    From app-version with Apache License 2.0 6 votes vote down vote up
/**
 * 列出所有应用(带绑定信息)
 *
 * @return 应用列表
 */
@ApiOperation(
        value = "列出用户与所有应用的绑定关系(带绑定信息)",
        notes = "列出所有应用(带绑定信息)"
)
@ApiImplicitParams({
        @ApiImplicitParam(paramType = "header", dataType = "string", name = "Authorization", value = "用户凭证", required = true),
        @ApiImplicitParam(name = "page", value = "页数", defaultValue = "1"),
        @ApiImplicitParam(name = "pageSize", value = "每页显示数据条数", defaultValue = "10"),
        @ApiImplicitParam(name = "userId", value = "用户ID", required = true),
})
@GetMapping("/app/list/bind")
public ServiceResult listAppWithBindInfo(@RequestParam(required = false, defaultValue = "1") int page,
                                         @RequestParam(required = false, defaultValue = "10") int pageSize,
                                         @RequestParam String userId) {
    EntityWrapper<App> wrapper = new EntityWrapper<>();
    if (StringUtils.isEmpty(userId)) {
        return ServiceResultConstants.NEED_PARAMS;
    }
    wrapper.and().eq("del_flag", 0);
    return adminService.listAppWithBindInfo(page, pageSize, wrapper, userId);
}
 
Example #15
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 #16
Source File: AdminController.java    From app-version with Apache License 2.0 6 votes vote down vote up
/**
 * 绑定某个用户和APP
 *
 * @param userId 用户ID
 * @param appId  应用ID
 * @return 是否成功
 */
@ApiOperation(
        value = "绑定某个用户和APP",
        notes = "绑定某个用户和APP"
)
@ApiImplicitParams({
        @ApiImplicitParam(paramType = "header", dataType = "string", name = "Authorization", value = "用户凭证", required = true),
        @ApiImplicitParam(name = "userId", value = "用户ID", required = true),
        @ApiImplicitParam(name = "appId", value = "appId,应用ID(int型)", required = true),
})
@PutMapping("/{userId}/{appId}/bind")
@OperationRecord(type = OperationRecordLog.OperationType.CREATE, resource = OperationRecordLog.OperationResource.USER_APP_REL, description = OperationRecordLog.OperationDescription.CREATE_USER_APP_REL)
public ServiceResult bind(@PathVariable String userId, @PathVariable int appId) {
    if (StringUtils.isEmpty(userId) || appId < 1) {
        return ServiceResultConstants.NEED_PARAMS;
    }
    return adminService.bindUserAndApp(userId, appId);
}
 
Example #17
Source File: DomainsRoutes.java    From james-project with Apache License 2.0 6 votes vote down vote up
@PUT
@Path("/{destinationDomain}/aliases/{sourceDomain}")
@ApiOperation(value = "Add an alias for a specific domain")
@ApiImplicitParams({
    @ApiImplicitParam(required = true, dataType = "string", name = "sourceDomain", paramType = "path"),
    @ApiImplicitParam(required = true, dataType = "string", name = "destinationDomain", paramType = "path")
})
@ApiResponses(value = {
    @ApiResponse(code = HttpStatus.NO_CONTENT_204, message = "OK", response = List.class),
    @ApiResponse(code = HttpStatus.NOT_FOUND_404, message = "The domain does not exist."),
    @ApiResponse(code = HttpStatus.INTERNAL_SERVER_ERROR_500,
        message = "Internal server error - Something went bad on the server side.")
})
public void defineAddAlias(Service service) {
    service.put(SPECIFIC_ALIAS, this::addDomainAlias, jsonTransformer);
}
 
Example #18
Source File: CustomApiController.java    From app-version with Apache License 2.0 6 votes vote down vote up
@ApiOperation(
        value = "添加自定义接口",
        notes = "添加自定义接口"
)
@ApiImplicitParams({
        @ApiImplicitParam(name = "Authorization", value = "用户登录凭证", paramType = "header", dataType = "string", defaultValue = "Bearer ", required = true),
})
@PostMapping("/add")
@OperationRecord(type = OperationRecordLog.OperationType.CREATE, resource = OperationRecordLog.OperationResource.CUSTOM_API, description = OperationRecordLog.OperationDescription.CREATE_CUSTOM_API)
public ServiceResult addCustomApi(@Valid @RequestBody CustomApiRequestDTO customApiRequestDTO) {
    if (StringUtils.isBlank(customApiRequestDTO.getCustomKey())) {
        return ServiceResultConstants.NEED_PARAMS;
    }
    //校验版本区间
    ServiceResult serviceResult = basicService.checkVersion(customApiRequestDTO);
    if (serviceResult.getCode() != 200) {
        return serviceResult;
    }
    CustomApi customApi = new CustomApi();
    BeanUtils.copyProperties(customApiRequestDTO, customApi);
    customApi.setId(null);
    customApi.setDelFlag(null);
    return customApiService.createCustomApi(customApi);
}
 
Example #19
Source File: TestController.java    From RuoYi-Vue with MIT License 6 votes vote down vote up
@ApiOperation("更新用户")
@ApiImplicitParam(name = "userEntity", value = "新增用户信息", dataType = "UserEntity")
@PutMapping("/update")
public AjaxResult update(UserEntity user)
{
    if (StringUtils.isNull(user) || StringUtils.isNull(user.getUserId()))
    {
        return AjaxResult.error("用户ID不能为空");
    }
    if (users.isEmpty() || !users.containsKey(user.getUserId()))
    {
        return AjaxResult.error("用户不存在");
    }
    users.remove(user.getUserId());
    return AjaxResult.success(users.put(user.getUserId(), user));
}
 
Example #20
Source File: PetResource.java    From swagger-maven-plugin with Apache License 2.0 6 votes vote down vote up
@ApiOperation(value = "testingFormApiImplicitParam")
@RequestMapping(
        value = "/testingFormApiImplicitParam",
        method = RequestMethod.GET,
        produces = "application/json")
@ApiImplicitParams(value = {
        @ApiImplicitParam(
                name = "form-test-name",
                value = "form-test-value",
                allowMultiple = true,
                required = true,
                dataType = "string",
                paramType = "form",
                defaultValue = "form-test-defaultValue")

})
public String testingFormApiImplicitParam() {
    return "testing";
}
 
Example #21
Source File: BaseActionController.java    From open-cloud with MIT License 5 votes vote down vote up
/**
 * 获取功能按钮详情
 *
 * @param actionId
 * @return
 */
@ApiOperation(value = "获取功能按钮详情", notes = "获取功能按钮详情")
@ApiImplicitParams({
        @ApiImplicitParam(name = "actionId", required = true, value = "功能按钮Id", paramType = "path"),
})
@GetMapping("/action/{actionId}/info")
public ResultBody<AuthorityAction> getAction(@PathVariable("actionId") Long actionId) {
    return ResultBody.ok().data(baseActionService.getAction(actionId));
}
 
Example #22
Source File: SolcController.java    From WeBASE-Front with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "delete uploaded solc js", notes = "delete uploaded solc js file")
@ApiImplicitParam(name = "solcId", value = "solc info id", required = true,
		dataType = "Integer", paramType = "path")
@DeleteMapping("/{solcId}")
public BaseResponse deleteSolcFile(@PathVariable("solcId") Integer solcId) {

	boolean deleteRsp = solcService.deleteFile(solcId);
	return new BaseResponse(ConstantCode.RET_SUCCESS);
}
 
Example #23
Source File: BaseAppController.java    From open-cloud with MIT License 5 votes vote down vote up
/**
 * 删除应用信息
 *
 * @param appId
 * @return
 */
@ApiOperation(value = "删除应用信息", notes = "删除应用信息")
@ApiImplicitParams({
        @ApiImplicitParam(name = "appId", value = "应用Id", required = true, paramType = "form"),
})
@PostMapping("/app/remove")
public ResultBody removeApp(
        @RequestParam("appId") String appId
) {
    baseAppService.removeApp(appId);
    openRestTemplate.refreshGateway();
    return ResultBody.ok();
}
 
Example #24
Source File: ExamRecordController.java    From spring-microservice-exam with MIT License 5 votes vote down vote up
/**
 * 更新
 *
 * @param examRecord examRecord
 * @return ResponseBean
 * @author tangyi
 * @date 2018/11/10 21:34
 */
@PutMapping
@ApiOperation(value = "更新考试记录信息", notes = "根据考试记录id更新考试记录的基本信息")
@ApiImplicitParam(name = "examRecord", value = "考试记录实体examRecord", required = true, dataType = "ExamRecord")
@Log("更新考试记录")
public ResponseBean<Boolean> updateExamRecord(@RequestBody @Valid ExaminationRecord examRecord) {
    examRecord.setCommonValue(SysUtil.getUser(), SysUtil.getSysCode(), SysUtil.getTenantCode());
    return new ResponseBean<>(examRecordService.update(examRecord) > 0);
}
 
Example #25
Source File: TestSwaggerController.java    From spring-boot-projects with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "更新用户详细信息", notes = "")
@ApiImplicitParams({
        @ApiImplicitParam(name = "id", value = "用户id", required = true, dataType = "int"),
        @ApiImplicitParam(name = "user", value = "用户实体user", required = true, dataType = "User")
})
@PutMapping("/users/{id}")
public String putUser(@PathVariable Integer id, @RequestBody User user) {
    User tempUser = usersMap.get(id);
    tempUser.setName(user.getName());
    tempUser.setPassword(user.getPassword());
    usersMap.put(id, tempUser);
    return "更新成功";
}
 
Example #26
Source File: ItemCartController.java    From poseidon with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "更新购物车中多种商品状态信息为订单状态")
@ApiImplicitParam(paramType = "update", dataType = "List<Long>", name = "itemCartIds", value = "购物车条目的ids")
@PatchMapping(path = "")
public Message submitOrder(@RequestBody List<Long> itemCartIds) {
	if (itemCartService.submitOrder(itemCartIds)) {
		return Message.success();
	}
	else {
		return Message.failed();
	}
}
 
Example #27
Source File: ArticleController.java    From yyblog with MIT License 5 votes vote down vote up
@ApiOperation(value="文章查询接口")
@ApiImplicitParam(name = "id", value = "文章ID", required = true, dataType = "Long")
@GetMapping("/{id}")
public String index(Model model, @PathVariable("id") Long id) {
    try {
        articleService.updateViewsById(id);
    } catch (Exception ignore) {
    }
    List<SettingDO> settings = settingService.listAll();
    Map<String,Object> map = new HashMap<String,Object>();
    for (SettingDO setting : settings) {
        map.put(setting.getCode(), setting.getValue());
    }
    ArticleDO article = articleService.getArticleById(id);
    model.addAttribute("settings", map);
    model.addAttribute("cateList", cateService.listAllCate());
    model.addAttribute("article", article);
    model.addAttribute("tags", tagReferService.listNameByArticleId(article.getId()));
    model.addAttribute("author", userService.getNicknameById(article.getAuthorId()));
    //回头改
    model.addAttribute("articles",  articleMapper.listSimilarsArticle());
    model.addAttribute("similars", articleMapper.listSimilarsArticle());
    model.addAttribute("login", WebUtils.toMap(getUser()));
    CommentQuery query = new CommentQuery();
    query.setLimit(10);
    query.setPage(1);
    query.setArticleId(id);
    model.addAttribute("comments", commentService.listCommentByArticleId(query));
    return "frontend/article";
}
 
Example #28
Source File: ChatBotController.java    From app-version with Apache License 2.0 5 votes vote down vote up
@ApiOperation(value = "根据AppId找到绑定的机器人", notes = "根据AppId找到绑定的机器人")
@ApiImplicitParams({
        @ApiImplicitParam(paramType = "header", dataType = "string", name = "Authorization", value = "用户凭证", required = true)
})
@GetMapping("/getByAppId/{appId}")
public ServiceResult getByAppId(@PathVariable Integer appId){
    if(appId==null || appId==0){
        return ServiceResultConstants.NEED_PARAMS;
    }
    return chatBotService.getByAppId(appId);
}
 
Example #29
Source File: RoleController.java    From spring-microservice-boilerplate with MIT License 5 votes vote down vote up
@GetMapping
@ApiOperation(value = "List", httpMethod = "GET", response = RoleVO.class)
@ApiImplicitParams({
    @ApiImplicitParam(name = "Authorization", value = "token", paramType = "header", dataType = "string", required = true)
})
public ResponseEntity all() {
  try {
    return new ResponseEntity<>(roleDomain.all(), HttpStatus.OK);
  } catch (Exception e) {
    // Return unknown error and log the exception.
    return resultHelper.errorResp(logger, e, ErrorType.UNKNOWN, e.getMessage(), HttpStatus.INTERNAL_SERVER_ERROR);
  }
}
 
Example #30
Source File: WorksController.java    From SpringBootUnity with MIT License 5 votes vote down vote up
@ApiOperation(value = "根据id删除作品", notes = "根据id删除作品", httpMethod = "GET", produces = MediaType.APPLICATION_JSON_UTF8_VALUE)
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
@ApiImplicitParams({
        @ApiImplicitParam(name = "id", value = "唯一id", required = true, dataType = "Long", paramType = "path"),
})
public Result delete(@PathVariable Long id) {
    WorksModel model = service.findById(id);
    if (model == null) {
        return new Result(CodeConst.NULL_DATA.getResultCode(), CodeConst.NULL_DATA.getMessage());
    }
    service.del(id);
    return new Result<>(model);
}