From 8c8ff31cdca25f579d3c1f688f46c877bf28aaa1 Mon Sep 17 00:00:00 2001
From: liyong <18434998025@163.com>
Date: 星期二, 26 五月 2026 16:21:46 +0800
Subject: [PATCH] feat(approve): 重构审批流程配置功能
---
src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java | 65 ++++++++++++++------------------
1 files changed, 28 insertions(+), 37 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 570b2f5..04554fd 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/SalesLedgerServiceImpl.java
@@ -9,8 +9,9 @@
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.account.service.AccountIncomeService;
+import com.ruoyi.approve.bean.vo.ApproveProcessVO;
+import com.ruoyi.approve.service.IApproveProcessService;
import com.ruoyi.basic.mapper.CustomerMapper;
-import com.ruoyi.basic.mapper.ProductMapper;
import com.ruoyi.basic.mapper.ProductModelMapper;
import com.ruoyi.basic.pojo.Customer;
import com.ruoyi.common.enums.FileNameType;
@@ -25,7 +26,6 @@
import com.ruoyi.framework.web.domain.AjaxResult;
import com.ruoyi.other.mapper.TempFileMapper;
import com.ruoyi.other.pojo.TempFile;
-import com.ruoyi.production.mapper.*;
import com.ruoyi.production.service.ProductionProductMainService;
import com.ruoyi.project.system.domain.SysDept;
import com.ruoyi.project.system.domain.SysUser;
@@ -33,7 +33,6 @@
import com.ruoyi.project.system.mapper.SysUserMapper;
import com.ruoyi.purchase.dto.SimpleReturnOrderGroupDto;
import com.ruoyi.purchase.mapper.PurchaseReturnOrderProductsMapper;
-import com.ruoyi.quality.mapper.QualityInspectMapper;
import com.ruoyi.sales.dto.*;
import com.ruoyi.sales.mapper.*;
import com.ruoyi.sales.pojo.*;
@@ -43,7 +42,6 @@
import org.apache.commons.io.FilenameUtils;
import org.jetbrains.annotations.Nullable;
import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.script.DefaultRedisScript;
@@ -94,40 +92,17 @@
private final CommonFileServiceImpl commonFileService;
private final ShippingInfoMapper shippingInfoMapper;
private final InvoiceLedgerMapper invoiceLedgerMapper;
- private final SalesLedgerSchedulingMapper salesLedgerSchedulingMapper;
- private final SalesLedgerWorkMapper salesLedgerWorkMapper;
- private final SalesLedgerProductionAccountingMapper salesLedgerProductionAccountingMapper;
private final InvoiceRegistrationProductMapper invoiceRegistrationProductMapper;
private final InvoiceRegistrationMapper invoiceRegistrationMapper;
- private final ProductOrderMapper productOrderMapper;
- private final ProcessRouteMapper processRouteMapper;
- private final ProductProcessRouteMapper productProcessRouteMapper;
- private final ProcessRouteItemMapper processRouteItemMapper;
- private final ProductProcessRouteItemMapper productProcessRouteItemMapper;
- private final ProductWorkOrderMapper productWorkOrderMapper;
- private final ProductionProductMainMapper productionProductMainMapper;
- private final ProductionProductOutputMapper productionProductOutputMapper;
- private final ProductionProductInputMapper productionProductInputMapper;
- private final QualityInspectMapper qualityInspectMapper;
private final RedisTemplate<String, String> redisTemplate;
- @Autowired
- private SysDeptMapper sysDeptMapper;
+ private final IApproveProcessService approveProcessService;
+ private final SysDeptMapper sysDeptMapper;
@Value("${file.upload-dir}")
private String uploadDir;
- @Autowired
- private ProductModelMapper productModelMapper;
-
- @Autowired
- private ProductMapper productMapper;
- @Autowired
- private ProductStructureMapper productStructureMapper;
- @Autowired
- private ProductionProductMainService productionProductMainService;
- @Autowired
- private PurchaseReturnOrderProductsMapper purchaseReturnOrderProductsMapper;
- ;
- @Autowired
- private SysUserMapper sysUserMapper;
+ private final ProductModelMapper productModelMapper;
+ private final ProductionProductMainService productionProductMainService;
+ private final PurchaseReturnOrderProductsMapper purchaseReturnOrderProductsMapper;
+ private final SysUserMapper sysUserMapper;
@Override
public List<SalesLedger> selectSalesLedgerList(SalesLedgerDto salesLedgerDto) {
@@ -154,7 +129,7 @@
// 鏌ヨ閫�璐т俊鎭�
List<Long> productIds = salesLedgerProducts.stream().map(SalesLedgerProduct::getId).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::getSalesLedgerProductId, SimpleReturnOrderGroupDto::getSumReturnQuantity));
@@ -479,6 +454,8 @@
.eq(ShippingInfo::getSalesLedgerProductId, product.getId())
.orderByDesc(ShippingInfo::getCreateTime)
.last("limit 1"));
+ product.setShippingCarNumber(shippingInfo.getShippingCarNumber());
+ product.setShippingDate(shippingInfo.getShippingDate());
if (shippingInfo != null) {
product.setShippingStatus(shippingInfo.getStatus());
}
@@ -613,7 +590,7 @@
// 4. 澶勭悊瀛愯〃鏁版嵁
List<SalesLedgerProduct> productList = salesLedgerDto.getProductData();
if (productList != null && !productList.isEmpty()) {
- handleSalesLedgerProducts(salesLedger.getId(), productList, EnumUtil.fromCode(SaleEnum.class, salesLedgerDto.getType()));
+ handleSalesLedgerProducts(salesLedger.getId(), productList, EnumUtil.fromCode(SaleEnum.class, salesLedgerDto.getType()), salesLedger.getSalesContractNo());
updateMainContractAmount(
salesLedger.getId(),
productList,
@@ -711,7 +688,7 @@
// 鏂囦欢杩佺Щ鏂规硶
@Override
- public void handleSalesLedgerProducts(Long salesLedgerId, List<SalesLedgerProduct> products, SaleEnum type) {
+ public void handleSalesLedgerProducts(Long salesLedgerId, List<SalesLedgerProduct> products, SaleEnum type, String contractNo) {
// 鎸塈D鍒嗙粍锛屽尯鍒嗘柊澧炲拰鏇存柊鐨勮褰�
Map<Boolean, List<SalesLedgerProduct>> partitionedProducts = products.stream()
.peek(p -> p.setSalesLedgerId(salesLedgerId))
@@ -735,8 +712,22 @@
salesLedgerProduct.setNoInvoiceAmount(salesLedgerProduct.getTaxInclusiveTotalPrice());
salesLedgerProduct.setPendingInvoiceTotal(salesLedgerProduct.getTaxInclusiveTotalPrice());
salesLedgerProductMapper.insert(salesLedgerProduct);
+ //娣诲姞閿�鍞鎵� 瀹℃壒鎴愬姛涔嬪悗娣诲姞鐢熶骇鏁版嵁
+ ApproveProcessVO approveProcessVO = new ApproveProcessVO();
+ approveProcessVO.setApproveType(9);
+ approveProcessVO.setApproveDeptId(SecurityUtils.getDeptId()[0]);
+ approveProcessVO.setApproveReason(contractNo);
+ approveProcessVO.setRecordId(salesLedgerProduct.getId());
+ approveProcessVO.setApproveUser(SecurityUtils.getUserId());
+ approveProcessVO.setApproveTime(LocalDate.now().toString());
+ approveProcessVO.setApproveId(salesLedgerProduct.getId().toString());
+ try {
+ approveProcessService.addApprove(approveProcessVO);
+ }catch (Exception e) {
+ log.error("娣诲姞閿�鍞鎵瑰紓甯�", e);
+ }
// 娣诲姞鐢熶骇鏁版嵁
- salesLedgerProductServiceImpl.addProductionData(salesLedgerProduct);
+// salesLedgerProductServiceImpl.addProductionData(salesLedgerProduct);
}
}
}
--
Gitblit v1.9.3