| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124 |
- package com.izouma.tcg.web.card;
- import com.izouma.tcg.dto.GroupDTO;
- import com.izouma.tcg.dto.cardCase.CardCaseDTO;
- import com.izouma.tcg.dto.cardCase.CardCaseInputDTO;
- import com.izouma.tcg.enums.CaseStatus;
- import com.izouma.tcg.web.BaseController;
- import com.izouma.tcg.domain.card.CardCase;
- import com.izouma.tcg.service.card.CardCaseService;
- import com.izouma.tcg.dto.PageQuery;
- import com.izouma.tcg.exception.BusinessException;
- import com.izouma.tcg.repo.card.CardCaseRepo;
- import com.izouma.tcg.utils.ObjUtils;
- import com.izouma.tcg.utils.excel.ExcelUtils;
- import io.swagger.annotations.ApiOperation;
- import io.swagger.annotations.Authorization;
- import lombok.AllArgsConstructor;
- import org.springframework.data.domain.Page;
- import org.springframework.data.domain.Pageable;
- import org.springframework.security.access.prepost.PreAuthorize;
- import org.springframework.web.bind.annotation.*;
- import javax.annotation.security.PermitAll;
- import javax.servlet.http.HttpServletResponse;
- import java.io.IOException;
- import java.math.BigDecimal;
- import java.time.LocalDateTime;
- import java.util.List;
- import java.util.Map;
- @RestController
- @RequestMapping("/cardCase")
- @AllArgsConstructor
- public class CardCaseController extends BaseController {
- private CardCaseService cardCaseService;
- private CardCaseRepo cardCaseRepo;
- //@PreAuthorize("hasRole('ADMIN')")
- @PostMapping("/save")
- public CardCase save(@RequestBody CardCaseInputDTO cardCaseInputDTO) {
- return cardCaseService.save(cardCaseInputDTO);
- }
- //@PreAuthorize("hasRole('ADMIN')")
- @PostMapping("/all")
- public Page<CardCase> all(@RequestBody PageQuery pageQuery) {
- return cardCaseService.all(pageQuery);
- }
- @GetMapping("/getCardCase")
- public CardCaseInputDTO getCardCase(Long id) {
- return cardCaseService.getCardCaseInputDTO(id);
- }
- @GetMapping("/get/{id}")
- public CardCase get(@PathVariable Long id) {
- return cardCaseRepo.findById(id).orElseThrow(new BusinessException("无记录"));
- }
- @PostMapping("/del/{id}")
- public void del(@PathVariable Long id) {
- cardCaseRepo.softDelete(id);
- }
- @GetMapping("/excel")
- @ResponseBody
- public void excel(HttpServletResponse response, Pageable pageable) throws IOException {
- List<CardCaseDTO> data = showCardCasesMA(null, null, null, 103L, pageable).getContent();
- ExcelUtils.export(response, data);
- }
- @PostMapping("/genNew")
- @ApiOperation("生成卡箱信息")
- public List<GroupDTO> genNew(Integer group, Integer groupCount, boolean special) {
- return cardCaseService.genNewCardCase(group, groupCount, special);
- }
- @GetMapping("/showCasesMA")
- @ApiOperation("获取卡箱列表")
- public Page<CardCaseDTO> showCardCasesMA(CaseStatus caseStatus, @RequestParam(required = false) Long collectionId,
- @RequestParam(required = false) String search, @RequestParam(required = true) Long seriesId, Pageable pageable) {
- return cardCaseService.showCardCasesMA(caseStatus, collectionId, search, seriesId, pageable);
- }
- @GetMapping("/showInfoMA")
- @ApiOperation(("获取拼箱详情"))
- public Map<String, Object> showCaseInfoMA(Long caseId) {
- return cardCaseService.showCaseInfoMA(caseId);
- }
- @GetMapping("/softDelete")
- @ApiOperation(("下架"))
- public void softDelete(Long caseId) {
- cardCaseService.softDelete(caseId);
- }
- @GetMapping("/multipleDelete")
- @ApiOperation(("批量下架"))
- public void multipleDelete(String caseIds) {
- cardCaseService.multipleDelete(caseIds);
- }
- @GetMapping("/revive")
- @ApiOperation(("恢复"))
- public void revive(Long caseId) {
- cardCaseService.revive(caseId);
- }
- @PostMapping("/cancel")
- @ApiOperation(("取消"))
- public void cancel(Long caseId) {
- cardCaseService.cancel(caseId);
- }
- @GetMapping("/showRoomCases")
- @ApiOperation(("展示直播拼箱"))
- public List<CardCaseDTO> showRoomCases(Long roomId, Long storeId) {
- return cardCaseService.showRoomCasesMA(roomId, storeId);
- }
- }
|