From e1797a873bf114329f4870062201d388155ef014 Mon Sep 17 00:00:00 2001
From: 云 <2163098428@qq.com>
Date: 星期五, 14 八月 2026 13:39:51 +0800
Subject: [PATCH] refactor(erp): 移除采购来票审核流程并简化业务逻辑

---
 yudao-module-srm/src/main/java/cn/iocoder/yudao/module/srm/service/apply/SrmSupplierApplyServiceImpl.java |   40 ++++++++++++++++++++++++++++++++++++++++
 1 files changed, 40 insertions(+), 0 deletions(-)

diff --git a/yudao-module-srm/src/main/java/cn/iocoder/yudao/module/srm/service/apply/SrmSupplierApplyServiceImpl.java b/yudao-module-srm/src/main/java/cn/iocoder/yudao/module/srm/service/apply/SrmSupplierApplyServiceImpl.java
index c7a6914..9a1a9f3 100644
--- a/yudao-module-srm/src/main/java/cn/iocoder/yudao/module/srm/service/apply/SrmSupplierApplyServiceImpl.java
+++ b/yudao-module-srm/src/main/java/cn/iocoder/yudao/module/srm/service/apply/SrmSupplierApplyServiceImpl.java
@@ -145,6 +145,43 @@
 
     @Override
     @Transactional(rollbackFor = Exception.class)
+    public void ensureSupplierApproved(Long supplierId) {
+        if (supplierId == null) {
+            return;
+        }
+        // 鏍¢獙渚涘簲鍟嗗瓨鍦�
+        SrmSupplierDO supplier = supplierMapper.selectById(supplierId);
+        if (supplier == null) {
+            throw ServiceExceptionUtil.exception(ErrorCodeConstants.SUPPLIER_NOT_EXISTS);
+        }
+        // 宸插噯鍏ュ垯鏃犻渶澶勭悊
+        if (supplierApplyMapper.existsApprovedBySupplierId(supplierId)) {
+            return;
+        }
+        // 鑷姩鍒涘缓鍑嗗叆鐢宠骞剁洿鎺ョ疆涓哄凡閫氳繃
+        SrmSupplierApplyDO apply = new SrmSupplierApplyDO();
+        apply.setApplyNo(generateApplyNo());
+        apply.setSupplierId(supplierId);
+        apply.setSupplierName(supplier.getName());
+        apply.setSupplierType(supplier.getType());
+        apply.setCompanyNature(supplier.getCompanyNature());
+        apply.setRegisteredCapital(supplier.getRegisteredCapital());
+        apply.setBusinessLicenseNo(supplier.getBusinessLicenseNo());
+        apply.setTaxNo(supplier.getTaxNo());
+        apply.setAddress(supplier.getAddress());
+        apply.setBankName(supplier.getBankName());
+        apply.setBankAccount(supplier.getBankAccount());
+        apply.setContactName(supplier.getContactName());
+        apply.setContactMobile(supplier.getContactMobile());
+        apply.setContactEmail(supplier.getContactEmail());
+        apply.setRemark("涓爣鐢熸垚閲囪喘璁㈠崟鏃惰嚜鍔ㄥ噯鍏ュ苟閫氳繃");
+        apply.setApplyStatus(SupplierApplyStatusEnum.APPROVED.getCode());
+        apply.setApplyTime(LocalDateTime.now());
+        supplierApplyMapper.insert(apply);
+    }
+
+    @Override
+    @Transactional(rollbackFor = Exception.class)
     public void approve(Long id) {
         SrmSupplierApplyDO apply = validateApplyExists(id);
         if (!SupplierApplyStatusEnum.APPROVED.getCode().equals(apply.getApplyStatus())) {
@@ -159,9 +196,12 @@
             supplier.setBusinessLicenseNo(apply.getBusinessLicenseNo());
             supplier.setTaxNo(apply.getTaxNo());
             supplier.setAddress(apply.getAddress());
+            supplier.setBankName(apply.getBankName());
+            supplier.setBankAccount(apply.getBankAccount());
             supplier.setContactName(apply.getContactName());
             supplier.setContactMobile(apply.getContactMobile());
             supplier.setContactEmail(apply.getContactEmail());
+            supplier.setRemark(apply.getRemark());
             supplier.setStatus(0);
             supplierMapper.insert(supplier);
 

--
Gitblit v1.9.3