Search in sources :

Example 1 with FlashActivitiesQuery

use of com.actionworks.flashsale.app.model.query.FlashActivitiesQuery in project flash-sale by ThoughtsBeta.

the class FlashActivityController method getOnlineFlashActivities.

@GetMapping(value = "/flash-activities/online")
@SentinelResource("GetOnlineActivitiesResource")
public MultiResponse<FlashActivityResponse> getOnlineFlashActivities(@RequestAttribute Long userId, @RequestParam Integer pageSize, @RequestParam Integer pageNumber, @RequestParam(required = false) String keyword) {
    FlashActivitiesQuery flashActivitiesQuery = new FlashActivitiesQuery().setKeyword(keyword).setPageSize(pageSize).setPageNumber(pageNumber).setStatus(FlashActivityStatus.ONLINE.getCode());
    AppMultiResult<FlashActivityDTO> flashActivitiesResult = flashActivityAppService.getFlashActivities(userId, flashActivitiesQuery);
    if (!flashActivitiesResult.isSuccess() || flashActivitiesResult.getData() == null) {
        return ResponseBuilder.withMulti(flashActivitiesResult);
    }
    return MultiResponse.of(toFlashActivitiesResponse(flashActivitiesResult.getData()), flashActivitiesResult.getTotal());
}
Also used : FlashActivityDTO(com.actionworks.flashsale.app.model.dto.FlashActivityDTO) FlashActivitiesQuery(com.actionworks.flashsale.app.model.query.FlashActivitiesQuery) GetMapping(org.springframework.web.bind.annotation.GetMapping) SentinelResource(com.alibaba.csp.sentinel.annotation.SentinelResource)

Example 2 with FlashActivitiesQuery

use of com.actionworks.flashsale.app.model.query.FlashActivitiesQuery in project flash-sale by ThoughtsBeta.

the class FlashActivityController method getFlashActivities.

@GetMapping(value = "/flash-activities")
@SentinelResource("GetActivitiesResource")
public MultiResponse<FlashActivityResponse> getFlashActivities(@RequestAttribute Long userId, @RequestParam Integer pageSize, @RequestParam Integer pageNumber, @RequestParam(required = false) String keyword) {
    FlashActivitiesQuery flashActivitiesQuery = new FlashActivitiesQuery().setKeyword(keyword).setPageSize(pageSize).setPageNumber(pageNumber);
    AppMultiResult<FlashActivityDTO> flashActivitiesResult = flashActivityAppService.getFlashActivities(userId, flashActivitiesQuery);
    return ResponseBuilder.withMulti(flashActivitiesResult);
}
Also used : FlashActivityDTO(com.actionworks.flashsale.app.model.dto.FlashActivityDTO) FlashActivitiesQuery(com.actionworks.flashsale.app.model.query.FlashActivitiesQuery) GetMapping(org.springframework.web.bind.annotation.GetMapping) SentinelResource(com.alibaba.csp.sentinel.annotation.SentinelResource)

Aggregations

FlashActivityDTO (com.actionworks.flashsale.app.model.dto.FlashActivityDTO)2 FlashActivitiesQuery (com.actionworks.flashsale.app.model.query.FlashActivitiesQuery)2 SentinelResource (com.alibaba.csp.sentinel.annotation.SentinelResource)2 GetMapping (org.springframework.web.bind.annotation.GetMapping)2