| | |
| | | import com.ruoyi.sales.pojo.SalesLedger; |
| | | import com.ruoyi.sales.service.ICommonFileService; |
| | | import com.ruoyi.sales.service.ISalesLedgerService; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import io.swagger.annotations.ApiParam; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.math.BigDecimal; |
| | |
| | | @RestController |
| | | @RequestMapping("/sales/ledger") |
| | | @AllArgsConstructor |
| | | @Api(tags = "销售台账") |
| | | public class SalesLedgerController extends BaseController { |
| | | |
| | | private ISalesLedgerService salesLedgerService; |
| | |
| | | |
| | | @Autowired |
| | | private ReceiptPaymentMapper receiptPaymentMapper; |
| | | |
| | | /** |
| | | * 导入销售台账 |
| | | */ |
| | | @Log(title = "导入销售台账", businessType = BusinessType.INSERT) |
| | | @PostMapping("/import") |
| | | @ApiOperation("导入销售台账") |
| | | public AjaxResult importData(@RequestParam("file") |
| | | @ApiParam(value = "Excel文件", required = true) |
| | | MultipartFile file) { |
| | | return salesLedgerService.importData(file); |
| | | } |
| | | |
| | | /** |
| | | * 查询销售台账列表 |
| | |
| | | List<Long> salesLedgerIds = iPage.getRecords().stream().map(SalesLedger::getId).collect(Collectors.toList()); |
| | | List<InvoiceLedgerDto> invoiceLedgerDtoList = invoiceLedgerMapper.invoicedTotal(salesLedgerIds); |
| | | if(CollectionUtils.isEmpty(invoiceLedgerDtoList)){ |
| | | iPage.setTotal(iPage.getRecords().size()); |
| | | return iPage; |
| | | } |
| | | // 计算回款金额,待回款金额 |
| | |
| | | .in(ReceiptPayment::getInvoiceLedgerId, invoiceLedgers.stream().map(InvoiceLedger::getId).collect(Collectors.toList()))); |
| | | } |
| | | for (SalesLedger salesLedger : iPage.getRecords()) { |
| | | if(salesLedger.getShippingDate() != null){ |
| | | salesLedger.setShippingStatus("已发货"); |
| | | } |
| | | boolean existFlag = false; |
| | | BigDecimal noInvoiceAmountTotal = BigDecimal.ZERO; |
| | | BigDecimal invoiceTotal = BigDecimal.ZERO; |
| | |
| | | } |
| | | if (ObjectUtils.isNotEmpty(salesLedgerDto.getStatus())) { |
| | | if (salesLedgerDto.getStatus()) { |
| | | long count = iPage.getRecords().stream().filter(salesLedger -> Objects.equals(salesLedger.getNoInvoiceAmountTotal(), new BigDecimal("0.00"))).count(); |
| | | iPage.getRecords().removeIf(salesLedger -> Objects.equals(salesLedger.getNoInvoiceAmountTotal(), new BigDecimal("0.00"))); |
| | | iPage.setTotal(iPage.getTotal() - count); |
| | | } |
| | | } |
| | | iPage.setTotal(iPage.getRecords().size()); |
| | | |
| | | return iPage; |
| | | } |
| | | } |