src/main/java/com/ruoyi/basic/controller/CustomerController.java
@@ -1,24 +1,18 @@ package com.ruoyi.basic.controller; import java.util.List; import javax.servlet.http.HttpServletResponse; import com.ruoyi.basic.pojo.Customer; import com.ruoyi.basic.service.ICustomerService; import lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.DeleteMapping; import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RestController; import com.ruoyi.common.utils.poi.ExcelUtil; 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.common.utils.poi.ExcelUtil; import com.ruoyi.framework.web.page.TableDataInfo; import lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.util.List; /** * å®¢æ·æ¡£æ¡Controller src/main/java/com/ruoyi/basic/controller/ProductController.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,85 @@ package com.ruoyi.basic.controller; import com.ruoyi.basic.dto.ProductDto; import com.ruoyi.basic.dto.ProductModelDto; import com.ruoyi.basic.dto.ProductTreeDto; import com.ruoyi.basic.pojo.ProductModel; import com.ruoyi.basic.service.IProductModelService; import com.ruoyi.basic.service.IProductService; 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 lombok.AllArgsConstructor; import org.springframework.web.bind.annotation.*; import java.util.List; @RestController @AllArgsConstructor @RequestMapping("/basic/product") public class ProductController extends BaseController { private IProductService productService; private IProductModelService productModelService; /** * æ¥è¯¢äº§å */ @GetMapping("/list") public List<ProductTreeDto> selectProductList(ProductDto productDto) { return productService.selectProductList(productDto); } /** * æ ¹æ®idæ¥è¯¢äº§åè§æ ¼ */ @GetMapping("/modelList") public List<ProductModel> selectModelList(ProductDto productDto) { return productModelService.selectModelList(productDto); } /** * æ°å¢æ´æ°äº§å */ @Log(title = "产å", businessType = BusinessType.INSERT) @PostMapping("/addOrEditProduct") public AjaxResult addOrEditProduct(@RequestBody ProductDto productDto) { return toAjax(productService.addOrEditProduct(productDto)); } /** * æ°å¢æ´æ°äº§åè§æ ¼åå· */ @Log(title = "产åè§æ ¼åå·", businessType = BusinessType.INSERT) @PostMapping("/addOrEditProductModel") public AjaxResult addOrEditProductModel(@RequestBody ProductModelDto productModelDto) { return toAjax(productModelService.addOrEditProductModel(productModelDto)); } /** * å é¤ */ @Log(title = "产å", businessType = BusinessType.DELETE) @DeleteMapping("/delProduct") public AjaxResult remove(@RequestBody Long[] ids) { if (ids == null || ids.length == 0) { return AjaxResult.error("è¯·ä¼ å ¥è¦å é¤çID"); } return toAjax(productService.delProductByIds(ids)); } /** * å é¤äº§åè§æ ¼åå· */ @Log(title = "产åè§æ ¼åå·", businessType = BusinessType.DELETE) @DeleteMapping("/delProductModel") public AjaxResult delProductModel(@RequestBody Long[] ids) { if (ids == null || ids.length == 0) { return AjaxResult.error("è¯·ä¼ å ¥è¦å é¤çID"); } return toAjax(productModelService.delProductModel(ids)); } } src/main/java/com/ruoyi/basic/dto/ProductDto.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,13 @@ package com.ruoyi.basic.dto; import com.ruoyi.basic.pojo.Product; import com.ruoyi.basic.pojo.ProductModel; import lombok.Data; import java.util.List; @Data public class ProductDto extends Product { private List<ProductModel> productModelList; } src/main/java/com/ruoyi/basic/dto/ProductModelDto.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,8 @@ package com.ruoyi.basic.dto; import com.ruoyi.basic.pojo.ProductModel; import lombok.Data; @Data public class ProductModelDto extends ProductModel { } src/main/java/com/ruoyi/basic/dto/ProductTreeDto.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,14 @@ package com.ruoyi.basic.dto; import lombok.Data; import java.util.List; @Data public class ProductTreeDto { private Long id; private Long parentId; private String productName; private String label; // ç¨äºæ å½¢ç»æçæ¾ç¤ºåç§° private List<ProductTreeDto> children; } src/main/java/com/ruoyi/basic/mapper/ProductMapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,8 @@ package com.ruoyi.basic.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.basic.pojo.Product; public interface ProductMapper extends BaseMapper<Product> { } src/main/java/com/ruoyi/basic/mapper/ProductModelMapper.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,15 @@ package com.ruoyi.basic.mapper; import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.ruoyi.basic.pojo.ProductModel; /** * ã请填ååè½åç§°ãMapperæ¥å£ * * @author ruoyi * @date 2025-05-19 */ public interface ProductModelMapper extends BaseMapper<ProductModel> { } src/main/java/com/ruoyi/basic/pojo/Product.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,29 @@ package com.ruoyi.basic.pojo; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @Data @TableName("product") public class Product { private static final long serialVersionUID = 1L; /** * åºå· */ @TableId(type = IdType.AUTO) private Long id; /** * ç¶ID */ private Long parentId; /** * 产ååç§° */ private String productName; } src/main/java/com/ruoyi/basic/pojo/ProductModel.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,29 @@ package com.ruoyi.basic.pojo; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.annotation.TableId; import com.baomidou.mybatisplus.annotation.TableName; import lombok.Data; @Data @TableName("product_model") public class ProductModel { private static final long serialVersionUID = 1L; /** * åºå· */ @TableId(type = IdType.AUTO) private Long id; /** * å ³è产åid */ private Long productId; /** * è§æ ¼åå· */ private String model; } src/main/java/com/ruoyi/basic/service/IProductModelService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,24 @@ package com.ruoyi.basic.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.basic.dto.ProductDto; import com.ruoyi.basic.dto.ProductModelDto; import com.ruoyi.basic.pojo.ProductModel; import java.util.List; /** * ã请填ååè½åç§°ãServiceæ¥å£ * * @author ruoyi * @date 2025-05-19 */ public interface IProductModelService extends IService<ProductModel> { int addOrEditProductModel(ProductModelDto productModelDto); int delProductModel(Long[] ids); List<ProductModel> selectModelList(ProductDto productDto); } src/main/java/com/ruoyi/basic/service/IProductService.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,18 @@ package com.ruoyi.basic.service; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.basic.dto.ProductDto; import com.ruoyi.basic.dto.ProductTreeDto; import com.ruoyi.basic.pojo.Product; import java.util.List; public interface IProductService extends IService<Product> { int addOrEditProduct(ProductDto productDto); int delProductByIds(Long[] ids); List<ProductTreeDto> selectProductList(ProductDto productDto); } src/main/java/com/ruoyi/basic/service/impl/ProductModelServiceImpl.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,52 @@ package com.ruoyi.basic.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.basic.dto.ProductDto; import com.ruoyi.basic.dto.ProductModelDto; import com.ruoyi.basic.mapper.ProductModelMapper; import com.ruoyi.basic.pojo.ProductModel; import com.ruoyi.basic.service.IProductModelService; import com.ruoyi.common.utils.bean.BeanUtils; import lombok.AllArgsConstructor; import org.springframework.stereotype.Service; import java.util.Arrays; import java.util.List; /** * ã请填ååè½åç§°ãServiceä¸å¡å±å¤ç * * @author ruoyi * @date 2025-05-19 */ @Service @AllArgsConstructor public class ProductModelServiceImpl extends ServiceImpl<ProductModelMapper, ProductModel> implements IProductModelService { private ProductModelMapper productModelMapper; @Override public int addOrEditProductModel(ProductModelDto productModelDto) { if (productModelDto.getId() == null) { ProductModel productModel = new ProductModel(); BeanUtils.copyProperties(productModelDto,productModel); return productModelMapper.insert(productModel); } else { return productModelMapper.updateById(productModelDto); } } @Override public int delProductModel(Long[] ids) { return productModelMapper.deleteBatchIds(Arrays.asList(ids)); } @Override public List<ProductModel> selectModelList(ProductDto productDto) { LambdaQueryWrapper<ProductModel> queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(ProductModel::getProductId, productDto.getId()); return productModelMapper.selectList(queryWrapper); } } src/main/java/com/ruoyi/basic/service/impl/ProductServiceImpl.java
¶Ô±ÈÐÂÎļþ @@ -0,0 +1,118 @@ package com.ruoyi.basic.service.impl; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.basic.dto.ProductDto; import com.ruoyi.basic.dto.ProductTreeDto; import com.ruoyi.basic.mapper.ProductMapper; import com.ruoyi.basic.mapper.ProductModelMapper; import com.ruoyi.basic.pojo.Product; import com.ruoyi.basic.pojo.ProductModel; import com.ruoyi.basic.service.IProductService; import com.ruoyi.common.utils.bean.BeanUtils; import lombok.AllArgsConstructor; import org.springframework.stereotype.Service; import java.util.ArrayList; import java.util.Arrays; import java.util.List; @Service @AllArgsConstructor public class ProductServiceImpl extends ServiceImpl<ProductMapper, Product> implements IProductService { private ProductMapper productMapper; private ProductModelMapper productModelMapper; @Override public List<ProductTreeDto> selectProductList(ProductDto productDto) { // æ¥è¯¢æ ¹èç¹ï¼parentId 为 nullï¼ LambdaQueryWrapper<Product> queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.isNull(Product::getParentId); // 妿æäº§ååç§°æ¡ä»¶ï¼æ·»å å°æ¥è¯¢ä¸ if (productDto.getProductName() != null && !productDto.getProductName().isEmpty()) { queryWrapper.like(Product::getProductName, productDto.getProductName()); } // æ¥è¯¢æ ¹èç¹å表 List<Product> rootProducts = productMapper.selectList(queryWrapper); // 转æ¢ä¸ºæ èç¹å¹¶éå½æå»ºåæ List<ProductTreeDto> tree = new ArrayList<>(); for (Product product : rootProducts) { ProductTreeDto node = convertToTreeDto(product); node.setChildren(buildChildrenNodes(product.getId())); tree.add(node); } return tree; } // éå½æå»ºåèç¹ private List<ProductTreeDto> buildChildrenNodes(Long parentId) { // æ¥è¯¢å½åç¶èç¹çåèç¹ LambdaQueryWrapper<Product> queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.eq(Product::getParentId, parentId); List<Product> childProducts = productMapper.selectList(queryWrapper); // 转æ¢åèç¹å¹¶éå½æå»ºå®ä»¬çåæ List<ProductTreeDto> children = new ArrayList<>(); for (Product child : childProducts) { ProductTreeDto childNode = convertToTreeDto(child); childNode.setChildren(buildChildrenNodes(child.getId())); children.add(childNode); } return children; } // å° Product 转æ¢ä¸º ProductTreeDto private ProductTreeDto convertToTreeDto(Product product) { ProductTreeDto dto = new ProductTreeDto(); BeanUtils.copyProperties(product, dto); dto.setLabel(product.getProductName()); // 设置 label 为产ååç§° dto.setChildren(new ArrayList<>()); return dto; } @Override public int addOrEditProduct(ProductDto productDto) { if (productDto.getId() == null) { // æ°å¢äº§åé»è¾ if (productDto.getParentId() == null) { // è¥æªæå®ç¶èç¹ï¼é»è®¤ä¸ºæ ¹èç¹ï¼parentId 设为 nullï¼ productDto.setParentId(null); } else { // æ£æ¥ç¶èç¹æ¯å¦åå¨ï¼å¯éï¼æ ¹æ®ä¸å¡éæ±ï¼ Product parent = productMapper.selectById(productDto.getParentId()); if (parent == null) { throw new IllegalArgumentException("ç¶èç¹ä¸åå¨ï¼æ æ³æ·»å å产å"); } } return productMapper.insert(productDto); } else { // ç¼è¾äº§åé»è¾ // æ£æ¥äº§åæ¯å¦åå¨ï¼å¯éï¼æ ¹æ®ä¸å¡éæ±ï¼ Product existingProduct = productMapper.selectById(productDto.getId()); if (existingProduct == null) { throw new IllegalArgumentException("è¦ç¼è¾ç产åä¸åå¨"); } return productMapper.updateById(productDto); } } @Override public int delProductByIds(Long[] ids) { // 1. å é¤å表 product_model ä¸å ³èçæ°æ® LambdaQueryWrapper<ProductModel> queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.in(ProductModel::getProductId, ids); productModelMapper.delete(queryWrapper); // 2. å é¤ä¸»è¡¨ product æ°æ® int deleteCount = productMapper.deleteBatchIds(Arrays.asList(ids)); return deleteCount; } } src/main/java/com/ruoyi/sales/controller/InvoiceLedgerController.java
@@ -9,6 +9,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import java.math.BigDecimal; import java.util.List; @RestController @@ -132,4 +133,17 @@ return AjaxResult.success(invoiceLedgerService.invoiceLedgerSalesAccount(page,invoiceLedgerDto)); } /** * æ¬æå¼ç¥¨éé¢ */ @GetMapping("/getInvoiceAmount") public AjaxResult getInvoiceAmount() { try { BigDecimal amount = invoiceLedgerService.getInvoiceAmount(); return AjaxResult.success(amount != null ? amount : BigDecimal.ZERO); } catch (Exception e) { return AjaxResult.error("è·åå¼ç¥¨éé¢å¤±è´¥ï¼" + e.getMessage()); } } } src/main/java/com/ruoyi/sales/controller/ReceiptPaymentController.java
@@ -8,6 +8,7 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; import java.math.BigDecimal; import java.util.List; @RestController @@ -69,5 +70,16 @@ return AjaxResult.success(receiptPaymentService.receiptPaymentInfo(id)); } /** * æ¬æåæ¬¾éé¢ */ @GetMapping("/getReceiptAmount") public AjaxResult getReceiptAmount() { try { BigDecimal amount = receiptPaymentService.getReceiptAmount(); return AjaxResult.success(amount != null ? amount : BigDecimal.ZERO); } catch (Exception e) { return AjaxResult.error("è·åååéé¢å¤±è´¥ï¼" + e.getMessage()); } } } src/main/java/com/ruoyi/sales/controller/SalesLedgerController.java
@@ -14,6 +14,7 @@ import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletResponse; import java.math.BigDecimal; import java.util.List; /** @@ -83,11 +84,12 @@ /** * æ¥è¯¢éå®å°è´¦ä¸å页 * * @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); } @@ -103,4 +105,25 @@ } return toAjax(commonFileService.deleteSalesLedgerByIds(ids)); } /** * æ¬æéå®ååéé¢ */ @GetMapping("/getContractAmount") public AjaxResult getContractAmount() { try { BigDecimal amount = salesLedgerService.getContractAmount(); return AjaxResult.success(amount != null ? amount : BigDecimal.ZERO); } catch (Exception e) { return AjaxResult.error("è·åååéé¢å¤±è´¥ï¼" + e.getMessage()); } } /** * 客æ·ååéé¢TOP5ç»è®¡ */ @GetMapping("/getTopFiveList") public AjaxResult getTopFiveList() { return AjaxResult.success(salesLedgerService.getTopFiveList()); } } src/main/java/com/ruoyi/sales/service/ISalesLedgerService.java
@@ -1,10 +1,11 @@ package com.ruoyi.sales.service; import java.util.List; import com.baomidou.mybatisplus.extension.service.IService; import com.ruoyi.sales.dto.SalesLedgerDto; import com.ruoyi.sales.pojo.SalesLedger; import java.math.BigDecimal; import java.util.List; /** * éå®å°è´¦Serviceæ¥å£ @@ -23,4 +24,8 @@ SalesLedgerDto getSalesLedgerWithProducts(SalesLedgerDto salesLedgerDto); List getSalesNo(); BigDecimal getContractAmount(); List getTopFiveList(); } src/main/java/com/ruoyi/sales/service/InvoiceLedgerService.java
@@ -2,13 +2,13 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.ruoyi.basic.dto.SupplierManageDto; import com.ruoyi.common.vo.FileVo; import com.ruoyi.sales.dto.InvoiceLedgerDto; import com.ruoyi.sales.pojo.InvoiceLedgerFile; import org.springframework.web.multipart.MultipartFile; import javax.servlet.http.HttpServletResponse; import java.math.BigDecimal; import java.util.List; public interface InvoiceLedgerService { @@ -85,4 +85,6 @@ * @return */ IPage<InvoiceLedgerDto> invoiceLedgerSalesAccount(Page page, InvoiceLedgerDto invoiceLedgerDto); BigDecimal getInvoiceAmount(); } src/main/java/com/ruoyi/sales/service/ReceiptPaymentService.java
@@ -5,6 +5,7 @@ import com.ruoyi.sales.dto.ReceiptPaymentDto; import com.ruoyi.sales.pojo.ReceiptPayment; import java.math.BigDecimal; import java.util.List; public interface ReceiptPaymentService { @@ -44,4 +45,6 @@ * @return */ ReceiptPaymentDto receiptPaymentInfo(Integer id); BigDecimal getReceiptAmount(); } src/main/java/com/ruoyi/sales/service/impl/InvoiceLedgerServiceImpl.java
@@ -5,7 +5,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.ruoyi.basic.dto.SupplierManageDto; import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.common.vo.FileVo; import com.ruoyi.sales.dto.InvoiceLedgerDto; @@ -29,8 +28,10 @@ import javax.servlet.http.HttpServletResponse; import java.io.File; import java.math.BigDecimal; import java.util.Collections; import java.time.LocalDate; import java.time.YearMonth; import java.util.List; import java.util.Objects; import java.util.UUID; import java.util.stream.Collectors; @@ -242,4 +243,25 @@ return invoiceLedgerDtoIPage; } @Override public BigDecimal getInvoiceAmount() { LocalDate now = LocalDate.now(); YearMonth currentMonth = YearMonth.from(now); // å建LambdaQueryWrapper LambdaQueryWrapper<InvoiceLedger> queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.ge(InvoiceLedger::getInvoiceDate, currentMonth.atDay(1).atStartOfDay()) // 大äºçäºæ¬æç¬¬ä¸å¤© .lt(InvoiceLedger::getInvoiceDate, currentMonth.plusMonths(1).atDay(1).atStartOfDay()); // å°äºä¸æç¬¬ä¸å¤© // æ§è¡æ¥è¯¢å¹¶è®¡ç®æ»å List<InvoiceLedger> invoiceLedgers = invoiceLedgerMapper.selectList(queryWrapper); BigDecimal totalContractAmount = invoiceLedgers.stream() .map(InvoiceLedger::getInvoiceAmount) .filter(Objects::nonNull) .reduce(BigDecimal.ZERO, BigDecimal::add); return totalContractAmount; } } src/main/java/com/ruoyi/sales/service/impl/ReceiptPaymentServiceImpl.java
@@ -11,7 +11,11 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import java.math.BigDecimal; import java.time.LocalDate; import java.time.YearMonth; import java.util.List; import java.util.Objects; @Service public class ReceiptPaymentServiceImpl extends ServiceImpl<ReceiptPaymentMapper,ReceiptPayment> implements ReceiptPaymentService { @@ -75,4 +79,25 @@ public ReceiptPaymentDto receiptPaymentInfo(Integer id) { return receiptPaymentMapper.receiptPaymentInfo(id); } @Override public BigDecimal getReceiptAmount() { LocalDate now = LocalDate.now(); YearMonth currentMonth = YearMonth.from(now); // å建LambdaQueryWrapper LambdaQueryWrapper<ReceiptPayment> queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.ge(ReceiptPayment::getReceiptPaymentDate, currentMonth.atDay(1).atStartOfDay()) // 大äºçäºæ¬æç¬¬ä¸å¤© .lt(ReceiptPayment::getReceiptPaymentDate, currentMonth.plusMonths(1).atDay(1).atStartOfDay()); // å°äºä¸æç¬¬ä¸å¤© // æ§è¡æ¥è¯¢å¹¶è®¡ç®æ»å List<ReceiptPayment> receiptPayments = receiptPaymentMapper.selectList(queryWrapper); BigDecimal totalContractAmount = receiptPayments.stream() .map(ReceiptPayment::getReceiptPaymentAmount) .filter(Objects::nonNull) .reduce(BigDecimal.ZERO, BigDecimal::add); return totalContractAmount; } } src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -32,9 +32,13 @@ import java.io.IOException; import java.lang.reflect.Field; import java.math.BigDecimal; import java.nio.file.*; import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.nio.file.StandardCopyOption; import java.time.LocalDate; import java.time.LocalDateTime; import java.time.YearMonth; import java.time.format.DateTimeFormatter; import java.util.*; import java.util.concurrent.TimeUnit; @@ -124,6 +128,33 @@ ).collect(Collectors.toList()); } @Override public BigDecimal getContractAmount() { LocalDate now = LocalDate.now(); YearMonth currentMonth = YearMonth.from(now); // å建LambdaQueryWrapper LambdaQueryWrapper<SalesLedger> queryWrapper = new LambdaQueryWrapper<>(); queryWrapper.ge(SalesLedger::getEntryDate, currentMonth.atDay(1).atStartOfDay()) // 大äºçäºæ¬æç¬¬ä¸å¤© .lt(SalesLedger::getEntryDate, currentMonth.plusMonths(1).atDay(1).atStartOfDay()); // å°äºä¸æç¬¬ä¸å¤© // æ§è¡æ¥è¯¢å¹¶è®¡ç®æ»å List<SalesLedger> salesLedgers = salesLedgerMapper.selectList(queryWrapper); BigDecimal totalContractAmount = salesLedgers.stream() .map(SalesLedger::getContractAmount) .filter(Objects::nonNull) .reduce(BigDecimal.ZERO, BigDecimal::add); return totalContractAmount; } @Override public List getTopFiveList() { return null; } /** * ä¸å线å½å转驼峰å½å */ @@ -192,7 +223,7 @@ // 4. å¤çåè¡¨æ°æ® List<SalesLedgerProduct> productList = salesLedgerDto.getProductData(); if (productList != null && !productList.isEmpty()) { handleSalesLedgerProducts(salesLedger.getId(), productList,salesLedgerDto.getType()); handleSalesLedgerProducts(salesLedger.getId(), productList, salesLedgerDto.getType()); updateMainContractAmount( salesLedger.getId(), productList, @@ -287,7 +318,7 @@ } private void handleSalesLedgerProducts(Long salesLedgerId, List<SalesLedgerProduct> products,Integer type) { private void handleSalesLedgerProducts(Long salesLedgerId, List<SalesLedgerProduct> products, Integer type) { // æIDåç»ï¼åºåæ°å¢åæ´æ°çè®°å½ Map<Boolean, List<SalesLedgerProduct>> partitionedProducts = products.stream() .peek(p -> p.setSalesLedgerId(salesLedgerId))