| | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.sales.dto.InvoiceLedgerDto; |
| | | import com.ruoyi.sales.dto.InvoiceRegistrationProductDto; |
| | | import com.ruoyi.sales.mapper.InvoiceLedgerFileMapper; |
| | |
| | | @RestController |
| | | @RequestMapping("/invoiceLedger") |
| | | @AllArgsConstructor |
| | | public class InvoiceLedgerController { |
| | | public class InvoiceLedgerController extends BaseController { |
| | | |
| | | private InvoiceLedgerService invoiceLedgerService; |
| | | private InvoiceLedgerFileMapper invoiceLedgerFileMapper; |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/saveOrUpdate") |
| | | public AjaxResult invoiceLedgerSaveOrUpdate(@RequestBody InvoiceRegistrationProductDto productDto) { |
| | | public R<?> invoiceLedgerSaveOrUpdate(@RequestBody InvoiceRegistrationProductDto productDto) { |
| | | invoiceLedgerService.invoiceLedgerSaveOrUpdate(productDto); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("/del") |
| | | public AjaxResult invoiceLedgerDel(@RequestBody List<Integer> ids) { |
| | | public R<?> invoiceLedgerDel(@RequestBody List<Integer> ids) { |
| | | invoiceLedgerService.invoiceLedgerDel(ids); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/page") |
| | | public AjaxResult invoiceLedgerPage(Page page, InvoiceLedgerDto invoiceLedgerDto) { |
| | | return AjaxResult.success(invoiceLedgerService.invoiceLedgerPage(page, invoiceLedgerDto)); |
| | | public R<?> invoiceLedgerPage(Page page, InvoiceLedgerDto invoiceLedgerDto) { |
| | | return R.ok(invoiceLedgerService.invoiceLedgerPage(page, invoiceLedgerDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/fileList") |
| | | public AjaxResult invoiceLedgerFileList(Integer invoiceLedgerId) { |
| | | return AjaxResult.success(invoiceLedgerService.invoiceLedgerFileList(invoiceLedgerId)); |
| | | public R<?> invoiceLedgerFileList(Integer invoiceLedgerId) { |
| | | return R.ok(invoiceLedgerService.invoiceLedgerFileList(invoiceLedgerId)); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @DeleteMapping("/delFile") |
| | | @Log(title = "开票台账", businessType = BusinessType.DELETE) |
| | | public AjaxResult invoiceLedgerDelFile(@RequestBody List<Integer> ids) { |
| | | if(Collections.isEmpty(ids)) return AjaxResult.error("请选择要删除的文件"); |
| | | public R<?> invoiceLedgerDelFile(@RequestBody List<Integer> ids) { |
| | | if(Collections.isEmpty(ids)) return R.fail("请选择要删除的文件"); |
| | | invoiceLedgerFileMapper.deleteBatchIds(ids); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/uploadFile") |
| | | public AjaxResult invoiceLedgerUploadFile(MultipartFile file) { |
| | | public R<?> invoiceLedgerUploadFile(MultipartFile file) { |
| | | try { |
| | | return AjaxResult.success(invoiceLedgerService.invoiceLedgerUploadFile(file)); |
| | | return R.ok(invoiceLedgerService.invoiceLedgerUploadFile(file)); |
| | | }catch (Exception e) { |
| | | return AjaxResult.error(e.getMessage()); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/info") |
| | | public AjaxResult invoiceLedgerInfo(Integer id) { |
| | | return AjaxResult.success(invoiceLedgerService.invoiceLedgerDetail(id)); |
| | | public R<?> invoiceLedgerInfo(Integer id) { |
| | | return R.ok(invoiceLedgerService.invoiceLedgerDetail(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @PostMapping("/commitFile") |
| | | public AjaxResult invoiceLedgerCommitFile(@RequestBody InvoiceLedgerDto invoiceLedgerDto) { |
| | | public R<?> invoiceLedgerCommitFile(@RequestBody InvoiceLedgerDto invoiceLedgerDto) { |
| | | try { |
| | | invoiceLedgerService.invoiceLedgerCommitFile(invoiceLedgerDto); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | }catch (Exception e) { |
| | | return AjaxResult.error(e.getMessage()); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/list") |
| | | public AjaxResult invoiceLedgerList(InvoiceLedgerDto invoiceLedgerDto) { |
| | | return AjaxResult.success(invoiceLedgerService.invoiceLedgerList(invoiceLedgerDto)); |
| | | public R<?> invoiceLedgerList(InvoiceLedgerDto invoiceLedgerDto) { |
| | | return R.ok(invoiceLedgerService.invoiceLedgerList(invoiceLedgerDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/salesAccount") |
| | | public AjaxResult invoiceLedgerSalesAccount(Page page, InvoiceLedgerDto invoiceLedgerDto) { |
| | | return AjaxResult.success(invoiceLedgerService.invoiceLedgerSalesAccount(page,invoiceLedgerDto)); |
| | | public R<?> invoiceLedgerSalesAccount(Page page, InvoiceLedgerDto invoiceLedgerDto) { |
| | | return R.ok(invoiceLedgerService.invoiceLedgerSalesAccount(page,invoiceLedgerDto)); |
| | | } |
| | | |
| | | /** |
| | | * 本月开票金额 |
| | | */ |
| | | @GetMapping("/getInvoiceAmount") |
| | | public AjaxResult getInvoiceAmount() { |
| | | public R<?> getInvoiceAmount() { |
| | | try { |
| | | BigDecimal amount = invoiceLedgerService.getInvoiceAmount(); |
| | | return AjaxResult.success(amount != null ? amount : BigDecimal.ZERO); |
| | | return R.ok(amount != null ? amount : BigDecimal.ZERO); |
| | | } catch (Exception e) { |
| | | return AjaxResult.error("获取开票金额失败:" + e.getMessage()); |
| | | return R.fail("获取开票金额失败:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/registrationProductPage") |
| | | public AjaxResult registrationProductPage(Page page, InvoiceRegistrationProductDto registrationProductDto) { |
| | | public R<?> registrationProductPage(Page page, InvoiceRegistrationProductDto registrationProductDto) { |
| | | |
| | | return AjaxResult.success(invoiceLedgerService.registrationProductPage(page,registrationProductDto)); |
| | | return R.ok(invoiceLedgerService.registrationProductPage(page,registrationProductDto)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @GetMapping("/invoiceLedgerProductInfo") |
| | | public AjaxResult invoiceLedgerProductDetail(Integer id) { |
| | | return AjaxResult.success(invoiceLedgerService.invoiceLedgerProductDetail(id)); |
| | | public R<?> invoiceLedgerProductDetail(Integer id) { |
| | | return R.ok(invoiceLedgerService.invoiceLedgerProductDetail(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * @return |
| | | */ |
| | | @DeleteMapping("delInvoiceLedger/{invoiceRegistrationProductId}") |
| | | public AjaxResult delInvoiceLedger(@PathVariable Integer invoiceRegistrationProductId) { |
| | | public R<?> delInvoiceLedger(@PathVariable Integer invoiceRegistrationProductId) { |
| | | try { |
| | | invoiceLedgerService.delInvoiceLedger(invoiceRegistrationProductId); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | }catch (Exception e) { |
| | | return AjaxResult.error(e.getMessage()); |
| | | return R.fail(e.getMessage()); |
| | | } |
| | | } |
| | | |