From 10b88a7ff17caf92f3d4e8a550c1085a70c2517a Mon Sep 17 00:00:00 2001
From: gongchunyi <deslre0381@gmail.com>
Date: 星期四, 28 五月 2026 17:43:26 +0800
Subject: [PATCH] Merge dev_New_pro into dev_山西_晋和园_pro
---
src/main/java/com/ruoyi/aftersalesservice/service/impl/AfterSalesServiceServiceImpl.java | 57 +++++++++++++++++++++++++++++++++++++++++++--------------
1 files changed, 43 insertions(+), 14 deletions(-)
diff --git a/src/main/java/com/ruoyi/aftersalesservice/service/impl/AfterSalesServiceServiceImpl.java b/src/main/java/com/ruoyi/aftersalesservice/service/impl/AfterSalesServiceServiceImpl.java
index 68dfa7f..b1c7490 100644
--- a/src/main/java/com/ruoyi/aftersalesservice/service/impl/AfterSalesServiceServiceImpl.java
+++ b/src/main/java/com/ruoyi/aftersalesservice/service/impl/AfterSalesServiceServiceImpl.java
@@ -11,6 +11,8 @@
import com.ruoyi.aftersalesservice.service.AfterSalesServiceService;
import com.ruoyi.common.utils.OrderUtils;
import com.ruoyi.common.utils.SecurityUtils;
+
+import java.time.LocalDateTime;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.project.system.domain.SysDept;
import com.ruoyi.project.system.domain.SysUser;
@@ -21,9 +23,9 @@
import com.ruoyi.sales.pojo.SalesLedgerProduct;
import com.ruoyi.sales.service.ISalesLedgerProductService;
import com.ruoyi.sales.service.ISalesLedgerService;
+import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
@@ -36,20 +38,15 @@
*/
@Service
@Slf4j
+@RequiredArgsConstructor
public class AfterSalesServiceServiceImpl extends ServiceImpl<AfterSalesServiceMapper, AfterSalesService> implements AfterSalesServiceService {
- @Autowired
- private AfterSalesServiceMapper afterSalesServiceMapper;
-
- @Autowired
- private SysDeptMapper sysDeptMapper;
-
- @Autowired
- private SysUserMapper sysUserMapper;
- @Autowired
- private ISalesLedgerProductService salesLedgerProductService;
- @Autowired
- private ISalesLedgerService salesLedgerService;
+ private final AfterSalesServiceMapper afterSalesServiceMapper;
+ private final SysDeptMapper sysDeptMapper;
+ private final SysUserMapper sysUserMapper;
+ private final ISalesLedgerProductService salesLedgerProductService;
+ private final ISalesLedgerService salesLedgerService;
+ private final com.ruoyi.sales.mapper.ShippingInfoMapper shippingInfoMapper;
@Override
public IPage<AfterSalesServiceNewDto> listPage(Page page, AfterSalesServiceNewDto afterSalesService) {
@@ -75,7 +72,7 @@
if(sysUser == null) throw new RuntimeException("瀹℃牳浜轰笉瀛樺湪");
afterSalesServiceNewDto.setCheckNickName(sysUser.getNickName());
if (StringUtils.isEmpty(afterSalesServiceNewDto.getAfterSalesServiceNo())) {
- String string = OrderUtils.countAfterServiceTodayByCreateTime(afterSalesServiceMapper, "SH_");
+ String string = OrderUtils.countAfterServiceTodayByCreateTime(afterSalesServiceMapper, "SH_", afterSalesServiceNewDto.getCreateTime() != null ? afterSalesServiceNewDto.getCreateTime() : LocalDateTime.now());
afterSalesServiceNewDto.setAfterSalesServiceNo(string);
}
return this.save(afterSalesServiceNewDto);
@@ -87,6 +84,38 @@
SalesLedger byId = salesLedgerService.getById(afterSalesService.getSalesLedgerId());
List<Long> collect = Arrays.stream(afterSalesService.getProductModelIds().split(",")).map(Long::valueOf).collect(Collectors.toList());
List<SalesLedgerProduct> list = salesLedgerProductService.list(new QueryWrapper<SalesLedgerProduct>().lambda().in(SalesLedgerProduct::getId, collect));
+
+ if (StringUtils.isNotEmpty(afterSalesService.getProductModelQuantities())) {
+ String[] quantities = afterSalesService.getProductModelQuantities().split(",");
+ for (int i = 0; i < collect.size(); i++) {
+ Long productId = collect.get(i);
+ for (SalesLedgerProduct product : list) {
+ if (product.getId().equals(productId)) {
+ if (i < quantities.length && StringUtils.isNotEmpty(quantities[i])) {
+ product.setQuantity(new java.math.BigDecimal(quantities[i]));
+ }
+ break;
+ }
+ }
+ }
+ }
+
+ for (SalesLedgerProduct product : list) {
+ com.ruoyi.sales.pojo.ShippingInfo shippingInfo = shippingInfoMapper.selectOne(
+ new com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper<com.ruoyi.sales.pojo.ShippingInfo>()
+ .eq(com.ruoyi.sales.pojo.ShippingInfo::getSalesLedgerProductId, product.getId())
+ .orderByDesc(com.ruoyi.sales.pojo.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());
+ }
+ }
+
AfterSalesServiceNewDto afterSalesServiceNewDto = new AfterSalesServiceNewDto();
BeanUtils.copyProperties(afterSalesService, afterSalesServiceNewDto);
SalesLedgerDto salesLedgerDto = new SalesLedgerDto();
--
Gitblit v1.9.3