| | |
| | | package com.ruoyi.sales.controller; |
| | | |
| | | import java.util.*; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import com.ruoyi.sales.service.ISalesLedgerService; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.*; |
| | | 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.page.TableDataInfo; |
| | | import com.ruoyi.sales.dto.SalesLedgerDto; |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import com.ruoyi.sales.service.ICommonFileService; |
| | | import com.ruoyi.sales.service.ISalesLedgerService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | | import java.util.List; |
| | | |
| | | /** |
| | | * 销售台账Controller |
| | |
| | | */ |
| | | @RestController |
| | | @RequestMapping("/sales/ledger") |
| | | @AllArgsConstructor |
| | | public class SalesLedgerController extends BaseController { |
| | | @Autowired |
| | | |
| | | private ISalesLedgerService salesLedgerService; |
| | | |
| | | private ICommonFileService commonFileService; |
| | | |
| | | /** |
| | | * 查询销售台账列表 |
| | |
| | | |
| | | /** |
| | | * 查询销售台账不分页 |
| | | * |
| | | * @param salesLedgerDto |
| | | * @return |
| | | */ |
| | | @GetMapping("/listNoPage") |
| | | public AjaxResult listNoPage(SalesLedgerDto salesLedgerDto){ |
| | | public AjaxResult listNoPage(SalesLedgerDto salesLedgerDto) { |
| | | List<SalesLedger> list = salesLedgerService.selectSalesLedgerList(salesLedgerDto); |
| | | return AjaxResult.success(list); |
| | | } |
| | | |
| | | /** |
| | | * 销售台账附件删除 |
| | | */ |
| | | @Log(title = "销售台账附件删除", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/delLedgerFile") |
| | | public AjaxResult delLedgerFile(@RequestBody Long[] ids) { |
| | | if (ids == null || ids.length == 0) { |
| | | return AjaxResult.error("请传入要删除的ID"); |
| | | } |
| | | return toAjax(commonFileService.deleteSalesLedgerByIds(ids)); |
| | | } |
| | | |
| | | /** |
| | | * 本月销售合同金额 |
| | | */ |
| | | @GetMapping("/getContractAmount") |
| | | public AjaxResult getContractAmount() { |
| | | try { |
| | | BigDecimal contractAmount = salesLedgerService.getContractAmount(); |
| | | return AjaxResult.success(contractAmount != null ? contractAmount : BigDecimal.ZERO); |
| | | } catch (Exception e) { |
| | | return AjaxResult.error("获取合同金额失败:" + e.getMessage()); |
| | | } |
| | | } |
| | | |
| | | /** |
| | | * 客户合同金额TOP5统计 |
| | | */ |
| | | @GetMapping("/getTopFiveList") |
| | | public AjaxResult getTopFiveList() { |
| | | return AjaxResult.success(salesLedgerService.getTopFiveList()); |
| | | } |
| | | |
| | | /** |
| | | * 近半年开票,回款金额 |
| | | */ |
| | | @GetMapping("/getAmountHalfYear") |
| | | public AjaxResult getAmountHalfYear() { |
| | | return AjaxResult.success(salesLedgerService.getAmountHalfYear()); |
| | | } |
| | | } |