| | |
| | | import com.ruoyi.framework.aspectj.lang.annotation.Log; |
| | | import com.ruoyi.framework.aspectj.lang.enums.BusinessType; |
| | | import com.ruoyi.framework.web.controller.BaseController; |
| | | import com.ruoyi.framework.web.domain.AjaxResult; |
| | | import com.ruoyi.framework.web.domain.R; |
| | | import com.ruoyi.framework.web.page.TableDataInfo; |
| | | import com.ruoyi.purchase.dto.PurchaseLedgerDto; |
| | | import com.ruoyi.purchase.mapper.PurchaseLedgerTemplateMapper; |
| | |
| | | import com.ruoyi.sales.pojo.SalesLedgerProduct; |
| | | import com.ruoyi.sales.service.ISalesLedgerProductService; |
| | | import com.ruoyi.sales.service.ISalesLedgerService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.v3.oas.annotations.tags.Tag; |
| | | import io.swagger.v3.oas.annotations.Operation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.AllArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | |
| | | @RestController |
| | | @RequestMapping("/purchase/ledger") |
| | | @AllArgsConstructor |
| | | @Api(tags = "采购台账") |
| | | @Tag(name = "采购台账") |
| | | @Slf4j |
| | | public class PurchaseLedgerController extends BaseController { |
| | | private IPurchaseLedgerService purchaseLedgerService; |
| | |
| | | */ |
| | | @Log(title = "导入采购台账", businessType = BusinessType.INSERT) |
| | | @PostMapping("/import") |
| | | @ApiOperation("导入采购台账") |
| | | public AjaxResult importData(@RequestParam("file") |
| | | @Operation(summary = "导入采购台账") |
| | | public R<?> importData(@RequestParam("file") |
| | | @ApiParam(value = "Excel文件", required = true) |
| | | MultipartFile file) { |
| | | return purchaseLedgerService.importData(file); |
| | | } |
| | | |
| | | @ApiOperation("导出采购台账模板") |
| | | @Operation(summary = "导出采购台账模板") |
| | | @PostMapping("/exportTemplate") |
| | | public void exportTemplate(HttpServletResponse response) { |
| | | // 1. 模板文件在resources/static下的路径 |
| | |
| | | */ |
| | | @Log(title = "采购台账", businessType = BusinessType.INSERT) |
| | | @PostMapping("/addOrEditPurchase") |
| | | public AjaxResult addOrEditPurchase(@RequestBody PurchaseLedgerDto purchaseLedgerDto) throws Exception { |
| | | return toAjax(purchaseLedgerService.addOrEditPurchase(purchaseLedgerDto)); |
| | | public R<?> addOrEditPurchase(@RequestBody PurchaseLedgerDto purchaseLedgerDto) throws Exception { |
| | | purchaseLedgerService.addOrEditPurchase(purchaseLedgerDto); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | | * 查询采购模板 |
| | | */ |
| | | @ApiOperation("/查询采购模板") |
| | | @Operation(summary = "/查询采购模板") |
| | | @GetMapping("/getPurchaseTemplateList") |
| | | public AjaxResult getPurchaseTemplateList() { |
| | | public R<?> getPurchaseTemplateList() { |
| | | List<PurchaseLedgerTemplate> purchaseLedgers = purchaseLedgerTemplateMapper.selectList(null); |
| | | purchaseLedgers.forEach(purchaseLedgerDto1 -> { |
| | | LambdaQueryWrapper<SalesLedgerProductTemplate> queryWrapper = new LambdaQueryWrapper<>(); |
| | |
| | | purchaseLedgerDto1.setProductList(list); |
| | | } |
| | | }); |
| | | return AjaxResult.success(purchaseLedgers); |
| | | return R.ok(purchaseLedgers); |
| | | } |
| | | /** |
| | | * 修改采购台账审批状态 |
| | | */ |
| | | @PostMapping("/updateApprovalStatus") |
| | | public AjaxResult addOrEditPurchase(@RequestBody PurchaseLedger purchaseLedger){ |
| | | return toAjax(purchaseLedgerService.updateById(purchaseLedger)); |
| | | public R<?> addOrEditPurchase(@RequestBody PurchaseLedger purchaseLedger){ |
| | | purchaseLedgerService.updateById(purchaseLedger); |
| | | return R.ok(); |
| | | } |
| | | /** |
| | | * 查询采购台账和产品父子列表 |
| | |
| | | */ |
| | | @Log(title = "采购台账", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delPurchase") |
| | | public AjaxResult remove(@RequestBody Long[] ids) { |
| | | return toAjax(purchaseLedgerService.deletePurchaseLedgerByIds(ids)); |
| | | public R<?> remove(@RequestBody Long[] ids) { |
| | | purchaseLedgerService.deletePurchaseLedgerByIds(ids); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | * 根据销售合同查询产品信息 |
| | | */ |
| | | @GetMapping("/getProductBySalesNo") |
| | | public AjaxResult getProductBySalesNo(Long id) { |
| | | return AjaxResult.success(purchaseLedgerService.getProductBySalesNo(id)); |
| | | public R<?> getProductBySalesNo(Long id) { |
| | | return R.ok(purchaseLedgerService.getProductBySalesNo(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * 根据id查询采购合同号 |
| | | */ |
| | | @GetMapping("/getPurchaseNoById") |
| | | public AjaxResult getPurchaseNoById(Long id) { |
| | | return AjaxResult.success(purchaseLedgerService.getPurchaseNoById(id)); |
| | | public R<?> getPurchaseNoById(Long id) { |
| | | return R.ok(purchaseLedgerService.getPurchaseNoById(id)); |
| | | } |
| | | |
| | | /** |
| | |
| | | * 根据采购合同号查询产品 |
| | | */ |
| | | @GetMapping("/getInfo") |
| | | public AjaxResult getInfo(PurchaseLedgerDto purchaseLedgerDto) { |
| | | return AjaxResult.success(purchaseLedgerService.getInfo(purchaseLedgerDto)); |
| | | public R<?> getInfo(PurchaseLedgerDto purchaseLedgerDto) { |
| | | return R.ok(purchaseLedgerService.getInfo(purchaseLedgerDto)); |
| | | } |
| | | |
| | | /** |
| | | * 查询采购台账列表 |
| | | */ |
| | | @GetMapping("/listPage") |
| | | public AjaxResult listPage(Page page, PurchaseLedgerDto purchaseLedger) { |
| | | return AjaxResult.success(purchaseLedgerService.selectPurchaseLedgerListPage(page, purchaseLedger)); |
| | | public R<?> listPage(Page page, PurchaseLedgerDto purchaseLedger) { |
| | | return R.ok(purchaseLedgerService.selectPurchaseLedgerListPage(page, purchaseLedger)); |
| | | } |
| | | |
| | | @ApiOperation("生成采购序列号") |
| | | @Operation(summary = "生成采购序列号") |
| | | @GetMapping("/createPurchaseNo") |
| | | @Log(title = "生成采购序列号", businessType = BusinessType.OTHER) |
| | | public AjaxResult createPurchaseNo() { |
| | | return AjaxResult.success("生成成功",purchaseLedgerService.getPurchaseNo()); |
| | | public R<?> createPurchaseNo() { |
| | | return R.ok(purchaseLedgerService.getPurchaseNo(), "生成成功"); |
| | | } |
| | | } |