|
@@ -0,0 +1,96 @@
|
|
|
|
+package com.citu.module.member.controller.app.invoice;
|
|
|
|
+
|
|
|
|
+import com.citu.module.member.controller.app.invoice.vo.InvoiceListPageReqVO;
|
|
|
|
+import com.citu.module.member.controller.app.invoice.vo.InvoiceListRespVO;
|
|
|
|
+import com.citu.module.member.controller.app.invoice.vo.InvoiceListSaveReqVO;
|
|
|
|
+import com.citu.module.member.dal.dataobject.invoice.InvoiceListDO;
|
|
|
|
+import com.citu.module.member.service.invoice.InvoiceListService;
|
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
|
+import org.springframework.security.access.prepost.PreAuthorize;
|
|
|
|
+import io.swagger.v3.oas.annotations.tags.Tag;
|
|
|
|
+import io.swagger.v3.oas.annotations.Parameter;
|
|
|
|
+import io.swagger.v3.oas.annotations.Operation;
|
|
|
|
+
|
|
|
|
+import javax.validation.constraints.*;
|
|
|
|
+import javax.validation.*;
|
|
|
|
+import javax.servlet.http.*;
|
|
|
|
+import java.util.*;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+
|
|
|
|
+import com.citu.framework.common.pojo.PageParam;
|
|
|
|
+import com.citu.framework.common.pojo.PageResult;
|
|
|
|
+import com.citu.framework.common.pojo.CommonResult;
|
|
|
|
+import com.citu.framework.common.util.object.BeanUtils;
|
|
|
|
+import static com.citu.framework.common.pojo.CommonResult.success;
|
|
|
|
+
|
|
|
|
+import com.citu.framework.excel.core.util.ExcelUtils;
|
|
|
|
+
|
|
|
|
+import com.citu.framework.apilog.core.annotation.ApiAccessLog;
|
|
|
|
+import static com.citu.framework.apilog.core.enums.OperateTypeEnum.*;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+@Tag(name = " 发票清单")
|
|
|
|
+@RestController
|
|
|
|
+@RequestMapping("/member/invoice-list")
|
|
|
|
+@Validated
|
|
|
|
+public class InvoiceListController {
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private InvoiceListService invoiceListService;
|
|
|
|
+
|
|
|
|
+ @PostMapping("/create")
|
|
|
|
+ @Operation(summary = "创建发票")
|
|
|
|
+ public CommonResult<String> createInvoiceList(@Valid @RequestBody InvoiceListSaveReqVO createReqVO) {
|
|
|
|
+ return success(invoiceListService.createInvoiceList(createReqVO));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @PutMapping("/update")
|
|
|
|
+ @Operation(summary = "更新发票清单")
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('member:invoice-list:update')")
|
|
|
|
+ public CommonResult<Boolean> updateInvoiceList(@Valid @RequestBody InvoiceListSaveReqVO updateReqVO) {
|
|
|
|
+ invoiceListService.updateInvoiceList(updateReqVO);
|
|
|
|
+ return success(true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @DeleteMapping("/delete")
|
|
|
|
+ @Operation(summary = "删除发票清单")
|
|
|
|
+ @Parameter(name = "id", description = "编号", required = true)
|
|
|
|
+ public CommonResult<Boolean> deleteInvoiceList(@RequestParam("id") String id) {
|
|
|
|
+ invoiceListService.deleteInvoiceList(id);
|
|
|
|
+ return success(true);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @GetMapping("/get")
|
|
|
|
+ @Operation(summary = "获得发票清单")
|
|
|
|
+ @Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
|
+ @PreAuthorize("@ss.hasPermission('member:invoice-list:query')")
|
|
|
|
+ public CommonResult<InvoiceListRespVO> getInvoiceList(@RequestParam("id") String id) {
|
|
|
|
+ InvoiceListDO invoiceList = invoiceListService.getInvoiceList(id);
|
|
|
|
+ return success(BeanUtils.toBean(invoiceList, InvoiceListRespVO.class));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @GetMapping("/page")
|
|
|
|
+ @Operation(summary = "获得发票清单分页")
|
|
|
|
+// @PreAuthorize("@ss.hasPermission('member:invoice-list:query')")
|
|
|
|
+ public CommonResult<PageResult<InvoiceListRespVO>> getInvoiceListPage(@Valid InvoiceListPageReqVO pageReqVO) {
|
|
|
|
+ PageResult<InvoiceListDO> pageResult = invoiceListService.getInvoiceListPage(pageReqVO);
|
|
|
|
+ return success(BeanUtils.toBean(pageResult, InvoiceListRespVO.class));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @GetMapping("/export-excel")
|
|
|
|
+ @Operation(summary = "导出发票清单 Excel")
|
|
|
|
+// @PreAuthorize("@ss.hasPermission('member:invoice-list:export')")
|
|
|
|
+ @ApiAccessLog(operateType = EXPORT)
|
|
|
|
+ public void exportInvoiceListExcel(@Valid InvoiceListPageReqVO pageReqVO,
|
|
|
|
+ HttpServletResponse response) throws IOException {
|
|
|
|
+ pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
|
|
|
+ List<InvoiceListDO> list = invoiceListService.getInvoiceListPage(pageReqVO).getList();
|
|
|
|
+ // 导出 Excel
|
|
|
|
+ ExcelUtils.write(response, "发票清单.xls", "数据", InvoiceListRespVO.class,
|
|
|
|
+ BeanUtils.toBean(list, InvoiceListRespVO.class));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+}
|