From dee1b9a3b5410a6dc1b271c4c9ff6b28d060a4ce Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期四, 11 六月 2026 19:30:35 +0800
Subject: [PATCH] fix: 销售台账订单号使用D开头

---
 src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java |   33 ++++++++++++++++++++-------------
 1 files changed, 20 insertions(+), 13 deletions(-)

diff --git a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
index 7610fa8..c94f411 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -150,7 +150,7 @@
             // 鏌ヨ閫�璐т俊鎭�
             List<Long> productIds = salesLedgerProducts.stream().map(SalesLedgerProduct::getProductModelId).collect(Collectors.toList());
             List<SimpleReturnOrderGroupDto> groupListByProductIds = new ArrayList<>();
-            if(CollectionUtils.isNotEmpty(productIds)){
+            if (CollectionUtils.isNotEmpty(productIds)) {
                 groupListByProductIds = purchaseReturnOrderProductsMapper.getReturnOrderGroupListByProductIds(productIds);
             }
             Map<Long, BigDecimal> returnOrderGroupDtoMap = groupListByProductIds.stream().collect(Collectors.toMap(SimpleReturnOrderGroupDto::getProductModelId, SimpleReturnOrderGroupDto::getSumReturnQuantity));
@@ -185,7 +185,11 @@
                     .orderByDesc(ShippingInfo::getCreateTime)
                     .last("limit 1"));
             if (shippingInfo != null) {
+                product.setShippingCarNumber(shippingInfo.getShippingCarNumber());
+                product.setShippingDate(shippingInfo.getShippingDate());
                 product.setShippingStatus(shippingInfo.getStatus());
+                product.setExpressCompany(shippingInfo.getExpressCompany());
+                product.setExpressNumber(shippingInfo.getExpressNumber());
             }
         }
 
@@ -297,7 +301,7 @@
             dto.setReceiptAmount(totalIncome);
             //寮�绁ㄩ噾棰�
             List<AccountInvoiceApplication> accountInvoiceApplications = accountInvoiceApplicationMapper.selectList(new LambdaQueryWrapper<AccountInvoiceApplication>()
-                            .eq(AccountInvoiceApplication::getStatus,1)
+                    .eq(AccountInvoiceApplication::getStatus, 1)
                     .between(AccountInvoiceApplication::getApplyDate, startTime, endTime));
             BigDecimal totalInvoiceAmount = Optional.of(
                     accountInvoiceApplications.stream()
@@ -445,17 +449,19 @@
             productWrapper.eq(SalesLedgerProduct::getType, 1);
             List<SalesLedgerProduct> products = salesLedgerProductMapper.selectList(productWrapper);
             for (SalesLedgerProduct product : products) {
-               product.setRegister(SecurityUtils.getLoginUser().getUser().getNickName());
+                product.setRegister(SecurityUtils.getLoginUser().getUser().getNickName());
                 product.setRegisterDate(LocalDateTime.now());
                 // 鍙戣揣淇℃伅
                 ShippingInfo shippingInfo = shippingInfoMapper.selectOne(new LambdaQueryWrapper<ShippingInfo>()
                         .eq(ShippingInfo::getSalesLedgerProductId, product.getId())
                         .orderByDesc(ShippingInfo::getCreateTime)
                         .last("limit 1"));
-                product.setShippingCarNumber(shippingInfo.getShippingCarNumber());
-                product.setShippingDate(shippingInfo.getShippingDate());
                 if (shippingInfo != null) {
+                    product.setShippingCarNumber(shippingInfo.getShippingCarNumber());
+                    product.setShippingDate(shippingInfo.getShippingDate());
                     product.setShippingStatus(shippingInfo.getStatus());
+                    product.setExpressCompany(shippingInfo.getExpressCompany());
+                    product.setExpressNumber(shippingInfo.getExpressNumber());
                 }
             }
             // 杩囨护鍙繚鐣欏彂璐ц褰�
@@ -650,14 +656,15 @@
             }
 
             // 2. 鏌ヨ褰撳ぉ/鍏徃宸插瓨鍦ㄧ殑搴忓垪鍙凤紙涓庡師閫昏緫涓�鑷达級
-            Long tenantId = SecurityUtils.getLoginUser().getTenantId();
-            if (null != tenantId) {
-                //鑾峰彇鍏徃缂栧彿
-                SysDept sysDept = sysDeptMapper.selectDeptById(tenantId.longValue());
-                if (!ObjectUtils.isEmpty(sysDept)) {
-                    datePart = (StringUtils.isEmpty(sysDept.getDeptNick()) ? "" : sysDept.getDeptNick()) + datePart;
-                }
-            }
+//            Long tenantId = SecurityUtils.getLoginUser().getTenantId();
+//            if (null != tenantId) {
+            //鑾峰彇鍏徃缂栧彿
+//                SysDept sysDept = sysDeptMapper.selectDeptById(tenantId.longValue());
+//                if (!ObjectUtils.isEmpty(sysDept)) {
+//                    datePart = (StringUtils.isEmpty(sysDept.getDeptNick()) ? "" : sysDept.getDeptNick()) + datePart;
+//                }
+//            }
+            datePart = "D" + datePart;
             List<Integer> existingSequences = salesLedgerMapper.selectSequencesByDate(datePart);
             int nextSequence = findFirstMissingSequence(existingSequences);
 

--
Gitblit v1.9.3