Ver Fonte

feat(customer): 优化供应商信息管理功能

- 修改CustomerInfoServiceImpl中的客户销售信息更新逻辑,改为先更新客户信息再处理销售信息
- 在SupplierLevelService和SupplierTypeService接口中添加按名称查询方法
- 新增RemoteSupplierLevelService远程服务接口及其实现类
- 为SupplierImportListener导入监听器添加远程服务依赖注入
- 修改供应商导入功能,在导入过程中验证并关联所属公司、采购员、供应商类型和等级
- 调整SupplierInfo实体类中cooperateLevel字段类型从String改为Long
- 在SupplierInfoServiceImpl中添加供应商采购信息的事务处理逻辑
- 优化供应商信息导入功能,支持更多字段映射和数据验证
hurx há 1 semana atrás
pai
commit
62b99f21a6
18 ficheiros alterados com 356 adições e 47 exclusões
  1. 8 0
      ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/RemoteSupplierLevelService.java
  2. 3 0
      ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/RemoteSupplierTypeService.java
  3. 28 0
      ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/domain/vo/RemoteSupplierLevelVo.java
  4. 5 0
      ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/domain/vo/RemoteSupplierTypeVo.java
  5. 19 3
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/controller/SupplierInfoController.java
  6. 3 1
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/SupplierInfo.java
  7. 5 1
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/bo/SupplierInfoBo.java
  8. 1 0
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/bo/SupplierProcurementBo.java
  9. 116 1
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/vo/SupplierInfoImportVo.java
  10. 56 2
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/listener/SupplierImportListener.java
  11. 13 5
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/CustomerInfoServiceImpl.java
  12. 29 14
      ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/SupplierInfoServiceImpl.java
  13. 24 0
      ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/dubbo/RemoteSupplierLevelServiceImpl.java
  14. 12 1
      ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/dubbo/RemoteSupplierTypeServiceImpl.java
  15. 3 1
      ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISupplierLevelService.java
  16. 3 1
      ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISupplierTypeService.java
  17. 18 13
      ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SupplierLevelServiceImpl.java
  18. 10 4
      ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SupplierTypeServiceImpl.java

+ 8 - 0
ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/RemoteSupplierLevelService.java

@@ -0,0 +1,8 @@
+package org.dromara.system.api;
+
+import org.dromara.system.api.domain.vo.RemoteSupplierLevelVo;
+
+public interface RemoteSupplierLevelService {
+
+    RemoteSupplierLevelVo selectByLevelName(String levelName);
+}

+ 3 - 0
ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/RemoteSupplierTypeService.java

@@ -11,4 +11,7 @@ import java.util.List;
 public interface RemoteSupplierTypeService {
 
     List<RemoteSupplierTypeVo> queryList();
+
+    RemoteSupplierTypeVo selectByTypeName(String typeName);
+
 }

+ 28 - 0
ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/domain/vo/RemoteSupplierLevelVo.java

@@ -0,0 +1,28 @@
+package org.dromara.system.api.domain.vo;
+
+import cn.idev.excel.annotation.ExcelProperty;
+import lombok.Data;
+
+import java.io.Serial;
+import java.io.Serializable;
+
+@Data
+public class RemoteSupplierLevelVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
+    private Long id;
+
+    /**
+     * 编号
+     */
+    @ExcelProperty(value = "编号")
+    private String supplierLevelNo;
+
+    /**
+     * 名称
+     */
+    @ExcelProperty(value = "名称")
+    private String supplierLevelName;
+}

+ 5 - 0
ruoyi-api/ruoyi-api-system/src/main/java/org/dromara/system/api/domain/vo/RemoteSupplierTypeVo.java

@@ -2,6 +2,7 @@ package org.dromara.system.api.domain.vo;
 
 import lombok.Data;
 
+import java.io.Serial;
 import java.io.Serializable;
 
 /**
@@ -10,6 +11,10 @@ import java.io.Serializable;
  */
 @Data
 public class RemoteSupplierTypeVo implements Serializable {
+
+    @Serial
+    private static final long serialVersionUID = 1L;
+
     private long id;
 
     private String typeId;

+ 19 - 3
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/controller/SupplierInfoController.java

@@ -6,6 +6,7 @@ import jakarta.servlet.http.HttpServletResponse;
 import jakarta.validation.constraints.NotEmpty;
 import jakarta.validation.constraints.NotNull;
 import lombok.RequiredArgsConstructor;
+import org.apache.dubbo.config.annotation.DubboReference;
 import org.dromara.common.core.domain.R;
 import org.dromara.common.core.validate.AddGroup;
 import org.dromara.common.core.validate.EditGroup;
@@ -18,13 +19,15 @@ import org.dromara.common.mybatis.core.page.PageQuery;
 import org.dromara.common.mybatis.core.page.TableDataInfo;
 import org.dromara.common.web.core.BaseController;
 import org.dromara.customer.domain.bo.SupplierInfoBo;
-import org.dromara.customer.domain.vo.CustomerInfoImportVo;
 import org.dromara.customer.domain.vo.SupplierInfoImportVo;
 import org.dromara.customer.domain.vo.SupplierInfoVo;
-import org.dromara.customer.listener.CustomerImportListener;
 import org.dromara.customer.listener.SupplierImportListener;
 import org.dromara.customer.service.ISupplierInfoService;
 import org.dromara.customer.service.ISupplierProcurementService;
+import org.dromara.system.api.RemoteComCompanyService;
+import org.dromara.system.api.RemoteComStaffService;
+import org.dromara.system.api.RemoteSupplierLevelService;
+import org.dromara.system.api.RemoteSupplierTypeService;
 import org.springframework.http.MediaType;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.validation.annotation.Validated;
@@ -49,6 +52,19 @@ import java.util.stream.Collectors;
 @RequestMapping("/info")
 public class SupplierInfoController extends BaseController {
 
+    @DubboReference
+    private RemoteComCompanyService remoteComCompanyService;
+
+    @DubboReference
+    private RemoteComStaffService remoteComStaffService;
+
+    @DubboReference
+    private RemoteSupplierTypeService remoteSupplierTypeService;
+
+    @DubboReference
+    private RemoteSupplierLevelService remoteSupplierLevelService;
+
+
     private final ISupplierInfoService supplierInfoService;
 
     private final ISupplierProcurementService supplierProcurementService;
@@ -226,7 +242,7 @@ public class SupplierInfoController extends BaseController {
     @Log(title = "供应商信息", businessType = BusinessType.IMPORT)
     @PostMapping(value = "/importData", consumes = MediaType.MULTIPART_FORM_DATA_VALUE)
     public R<Void> importData(@RequestPart("file") MultipartFile file, boolean updateSupport) throws Exception {
-        ExcelResult<SupplierInfoImportVo> result = ExcelUtil.importExcel(file.getInputStream(), SupplierInfoImportVo.class, new SupplierImportListener(updateSupport));
+        ExcelResult<SupplierInfoImportVo> result = ExcelUtil.importExcel(file.getInputStream(), SupplierInfoImportVo.class, new SupplierImportListener(updateSupport, remoteComCompanyService, remoteComStaffService, remoteSupplierTypeService, remoteSupplierLevelService));
         return R.ok(result.getAnalysis());
     }
 

+ 3 - 1
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/SupplierInfo.java

@@ -5,7 +5,9 @@ import com.baomidou.mybatisplus.annotation.*;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import org.dromara.common.translation.annotation.Translation;
+
 import java.util.Date;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
 import org.dromara.common.translation.constant.TransConstant;
 
@@ -204,7 +206,7 @@ public class SupplierInfo extends BaseEntity {
     /**
      * 合作等级
      */
-    private String cooperateLevel;
+    private Long cooperateLevel;
 
     /**
      * 合同到期时间

+ 5 - 1
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/bo/SupplierInfoBo.java

@@ -9,7 +9,9 @@ import lombok.Data;
 import lombok.EqualsAndHashCode;
 import jakarta.validation.constraints.*;
 import org.dromara.common.translation.annotation.Translation;
+
 import java.util.Date;
+
 import com.fasterxml.jackson.annotation.JsonFormat;
 import org.dromara.common.translation.constant.TransConstant;
 
@@ -247,7 +249,7 @@ public class SupplierInfoBo extends BaseEntity {
     /**
      * 合作等级
      */
-    private String cooperateLevel;
+    private Long cooperateLevel;
 
     /**
      * 合同到期时间
@@ -377,5 +379,7 @@ public class SupplierInfoBo extends BaseEntity {
 
     private String city;
 
+    private String settlementMethod;
+
 
 }

+ 1 - 0
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/bo/SupplierProcurementBo.java

@@ -40,5 +40,6 @@ public class SupplierProcurementBo extends BaseEntity {
      */
     private String purchaser;
 
+    private String settlementMethod;
 
 }

+ 116 - 1
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/domain/vo/SupplierInfoImportVo.java

@@ -9,11 +9,16 @@ import java.io.Serializable;
 @Data
 @NoArgsConstructor
 public class SupplierInfoImportVo implements Serializable {
+    @ExcelProperty(value = "公司")
+    private String companyCode;
+
+    @ExcelProperty(value = "名称")
+    private String ownedCompanyName;
 
     /**
      * 供应商编号
      */
-    @ExcelProperty(value = "供应商编号")
+    @ExcelProperty(value = "编号")
     private String supplierNo;
 
     /**
@@ -21,4 +26,114 @@ public class SupplierInfoImportVo implements Serializable {
      */
     @ExcelProperty(value = "供应商名称")
     private String enterpriseName;
+
+    /**
+     * 工商名称
+     */
+    @ExcelProperty(value = "工商名称")
+    private String businessCustomerName;
+
+    /**
+     * 简称
+     */
+    @ExcelProperty(value = "简称")
+    private String shortName;
+
+    /**
+     * 统一社会信用代码
+     */
+    @ExcelProperty(value = "统一社会信用代码")
+    private String socialCreditCode;
+
+    /**
+     * 供应商类型
+     */
+    @ExcelProperty(value = "类别")
+    private String supplierTypeNo;
+
+    /**
+     * 供应商类型
+     */
+    @ExcelProperty(value = "供应商类别名称")
+    private String supplierTypeName;
+
+    /**
+     * 采购员
+     */
+    @ExcelProperty(value = "采购人员")
+    private String buyerNo;
+
+    /**
+     * 采购员
+     */
+    @ExcelProperty(value = "姓名")
+    private String buyerName;
+
+    /**
+     * 付款类型
+     */
+    @ExcelProperty(value = "付款类型")
+    private String buyType;
+
+    /**
+     * 供应商等级
+     */
+    @ExcelProperty(value = "供应商等级")
+    private String supplierLevelNo;
+
+    /**
+     * 供应商等级名称
+     */
+    @ExcelProperty(value = "供应商等级名称")
+    private String supplierLevelName;
+
+    /**
+     * 采购开票类型
+     */
+    @ExcelProperty(value = "采购开票类型")
+    private String invoiceTypeNo;
+
+    /**
+     * 开票类型名称
+     */
+    @ExcelProperty(value = "开票类型名称")
+    private String invoiceType;
+
+    /**
+     * 办公电话
+     */
+    @ExcelProperty(value = "办公电话")
+    private String fixedPhone;
+
+    /**
+     * 联系地址
+     */
+    @ExcelProperty(value = "联系地址")
+    private String officeAddress;
+
+    /**
+     * 单价含税
+     */
+    @ExcelProperty(value = "单价含税")
+    private String unitPrice;
+
+    /**
+     * 税码
+     */
+    @ExcelProperty(value = "税码")
+    private String rateName;
+
+    /**
+     * 交易币别
+     */
+    @ExcelProperty(value = "交易币别")
+    private String dealCurrency;
+
+
+    /**
+     * 账款归属
+     */
+    @ExcelProperty(value = "账款归属")
+    private String accountBelong;
+
 }

+ 56 - 2
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/listener/SupplierImportListener.java

@@ -18,6 +18,14 @@ import org.dromara.customer.domain.bo.SupplierInfoBo;
 import org.dromara.customer.domain.vo.SupplierInfoImportVo;
 import org.dromara.customer.domain.vo.SupplierInfoVo;
 import org.dromara.customer.service.ISupplierInfoService;
+import org.dromara.system.api.RemoteComCompanyService;
+import org.dromara.system.api.RemoteComStaffService;
+import org.dromara.system.api.RemoteSupplierLevelService;
+import org.dromara.system.api.RemoteSupplierTypeService;
+import org.dromara.system.api.domain.vo.RemoteComCompanyVo;
+import org.dromara.system.api.domain.vo.RemoteComStaffVo;
+import org.dromara.system.api.domain.vo.RemoteSupplierLevelVo;
+import org.dromara.system.api.domain.vo.RemoteSupplierTypeVo;
 
 import java.util.List;
 
@@ -27,6 +35,13 @@ public class SupplierImportListener extends AnalysisEventListener<SupplierInfoIm
 
     private final ISupplierInfoService supplierInfoService;
 
+    private RemoteComCompanyService remoteComCompanyService;
+
+    private RemoteComStaffService remoteComStaffService;
+    private RemoteSupplierTypeService remoteSupplierTypeService;
+
+    private RemoteSupplierLevelService remoteSupplierLevelService;
+
     private final Boolean isUpdateSupport;
 
     private final Long operUserId;
@@ -36,8 +51,17 @@ public class SupplierImportListener extends AnalysisEventListener<SupplierInfoIm
     private final StringBuilder successMsg = new StringBuilder();
     private final StringBuilder failureMsg = new StringBuilder();
 
-    public SupplierImportListener(Boolean isUpdateSupport) {
+    public SupplierImportListener(Boolean isUpdateSupport,
+                                  RemoteComCompanyService remoteComCompanyService,
+                                  RemoteComStaffService remoteComStaffService,
+                                  RemoteSupplierTypeService remoteSupplierTypeService,
+                                  RemoteSupplierLevelService remoteSupplierLevelService
+    ) {
         this.supplierInfoService = SpringUtils.getBean(ISupplierInfoService.class);
+        this.remoteComCompanyService = remoteComCompanyService;
+        this.remoteComStaffService = remoteComStaffService;
+        this.remoteSupplierTypeService = remoteSupplierTypeService;
+        this.remoteSupplierLevelService = remoteSupplierLevelService;
         this.isUpdateSupport = isUpdateSupport;
         this.operUserId = LoginHelper.getLoginUser().getUserId();
     }
@@ -57,11 +81,29 @@ public class SupplierImportListener extends AnalysisEventListener<SupplierInfoIm
                 failureMsg.append("<br/>").append(failureNum).append("、第 ").append(analysisContext.readRowHolder().getRowIndex() + 1).append(" 行,供应商称不能为空");
                 return;
             }
+            RemoteComCompanyVo remoteComCompanyVo = remoteComCompanyService.selectByCompanyName(supplierInfoImportVo.getOwnedCompanyName());
+            RemoteComStaffVo buyer = remoteComStaffService.selectStaffByStaffName(supplierInfoImportVo.getBuyerName());
+            RemoteSupplierTypeVo remoteSupplierTypeVo = remoteSupplierTypeService.selectByTypeName(supplierInfoImportVo.getSupplierTypeName());
+            RemoteSupplierLevelVo remoteSupplierLevelVo = remoteSupplierLevelService.selectByLevelName(supplierInfoImportVo.getSupplierLevelName());
+
             // 验证是否存在这个供应商
             if (ObjectUtil.isNull(supplierInfoVo)) {
                 SupplierInfoBo supplierInfoBo = BeanUtil.toBean(supplierInfoImportVo, SupplierInfoBo.class);
                 ValidatorUtils.validate(supplierInfoBo);
                 supplierInfoBo.setCreateBy(operUserId);
+                supplierInfoBo.setSettlementMethod(supplierInfoImportVo.getBuyType());
+                if (ObjectUtil.isNotEmpty(remoteComCompanyVo)) {
+                    supplierInfoBo.setOwnedCompany(remoteComCompanyVo.getId());
+                }
+                if (ObjectUtil.isNotEmpty(buyer)) {
+                    supplierInfoBo.setBuyer(buyer.getStaffId());
+                }
+                if (ObjectUtil.isNotEmpty(remoteSupplierTypeVo)) {
+                    supplierInfoBo.setSupplierType(remoteSupplierTypeVo.getId());
+                }
+                if (ObjectUtil.isNotEmpty(remoteSupplierLevelVo)) {
+                    supplierInfoBo.setCooperateLevel(remoteSupplierLevelVo.getId());
+                }
                 supplierInfoService.addSupplierInfo(supplierInfoBo);
                 successNum++;
                 successMsg.append("<br/>").append(successNum).append("、供应商名称 ").append(supplierInfoBo.getEnterpriseName()).append(" 导入成功");
@@ -70,8 +112,20 @@ public class SupplierImportListener extends AnalysisEventListener<SupplierInfoIm
                 SupplierInfoBo supplierInfoBo = BeanUtil.toBean(supplierInfoImportVo, SupplierInfoBo.class);
                 supplierInfoBo.setId(supplierId);
                 ValidatorUtils.validate(supplierInfoBo);
-
+                supplierInfoBo.setSettlementMethod(supplierInfoImportVo.getBuyType());
                 supplierInfoBo.setUpdateBy(operUserId);
+                if (ObjectUtil.isNotEmpty(remoteComCompanyVo)) {
+                    supplierInfoBo.setOwnedCompany(remoteComCompanyVo.getId());
+                }
+                if (ObjectUtil.isNotEmpty(buyer)) {
+                    supplierInfoBo.setBuyer(buyer.getStaffId());
+                }
+                if (ObjectUtil.isNotEmpty(remoteSupplierTypeVo)) {
+                    supplierInfoBo.setSupplierType(remoteSupplierTypeVo.getId());
+                }
+                if (ObjectUtil.isNotEmpty(remoteSupplierLevelVo)) {
+                    supplierInfoBo.setCooperateLevel(remoteSupplierLevelVo.getId());
+                }
                 supplierInfoService.updateSupplierInfo(supplierInfoBo);
                 successNum++;
                 successMsg.append("<br/>").append(successNum).append("、供应商名称 ").append(supplierInfoBo.getEnterpriseName()).append(" 更新成功");

+ 13 - 5
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/CustomerInfoServiceImpl.java

@@ -1245,11 +1245,19 @@ public class CustomerInfoServiceImpl extends ServiceImpl<CustomerInfoMapper, Cus
     public Boolean updateCustomerInfo(CustomerInfoBo bo) {
         CustomerInfo update = MapstructUtils.convert(bo, CustomerInfo.class);
         validEntityBeforeSave(update);
-        CustomerSalesInfoBo customerSalesInfoBo = bo.getCustomerSalesInfoBo();
-        customerSalesInfoBo.setCustomerId(update.getId());
-        CustomerSalesInfo bean = BeanUtil.toBean(customerSalesInfoBo, CustomerSalesInfo.class);
-        customerSalesInfoMapper.insert(bean);
-        return baseMapper.updateById(update) > 0;
+        boolean flag = baseMapper.updateById(update) > 0;
+        if (flag) {
+            CustomerSalesInfoBo customerSalesInfoBo = bo.getCustomerSalesInfoBo();
+            CustomerSalesInfo customerSalesInfo = customerSalesInfoMapper.selectOne(new LambdaQueryWrapper<CustomerSalesInfo>().eq(CustomerSalesInfo::getCustomerId, update.getId()));
+            if (customerSalesInfo != null) {
+                customerSalesInfo.setSalesPersonId(customerSalesInfoBo.getSalesPersonId());
+                customerSalesInfo.setServiceStaffId(customerSalesInfoBo.getServiceStaffId());
+                customerSalesInfo.setCreditLevelId(customerSalesInfoBo.getCreditLevelId());
+                customerSalesInfoMapper.updateById(customerSalesInfo);
+            }
+        }
+
+        return flag;
     }
 
     @Override

+ 29 - 14
ruoyi-modules/ruoyi-customer/src/main/java/org/dromara/customer/service/impl/SupplierInfoServiceImpl.java

@@ -1,36 +1,38 @@
 package org.dromara.customer.service.impl;
 
+import cn.hutool.core.bean.BeanUtil;
 import cn.hutool.core.util.ObjectUtil;
 import cn.hutool.crypto.digest.BCrypt;
-import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
-import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
 import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.core.toolkit.IdWorker;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import com.fasterxml.jackson.core.JsonProcessingException;
 import com.fasterxml.jackson.core.type.TypeReference;
 import com.fasterxml.jackson.databind.ObjectMapper;
+import lombok.RequiredArgsConstructor;
+import lombok.extern.slf4j.Slf4j;
 import org.apache.dubbo.config.annotation.DubboReference;
 import org.dromara.common.core.constant.GlobalConstants;
 import org.dromara.common.core.exception.ServiceException;
 import org.dromara.common.core.utils.DateUtils;
 import org.dromara.common.core.utils.MapstructUtils;
 import org.dromara.common.core.utils.StringUtils;
-import org.dromara.common.mybatis.core.page.TableDataInfo;
 import org.dromara.common.mybatis.core.page.PageQuery;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
-import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
-import com.baomidou.mybatisplus.core.toolkit.Wrappers;
-import lombok.RequiredArgsConstructor;
-import lombok.extern.slf4j.Slf4j;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
 import org.dromara.common.redis.utils.RedisUtils;
 import org.dromara.common.satoken.utils.LoginHelper;
 import org.dromara.customer.domain.*;
 import org.dromara.customer.domain.bo.*;
 import org.dromara.customer.domain.vo.*;
 import org.dromara.customer.enums.SupplierStatusEnum;
-import org.dromara.customer.mapper.*;
+import org.dromara.customer.mapper.SupplierBusinessInfoMapper;
+import org.dromara.customer.mapper.SupplierContactMapper;
+import org.dromara.customer.mapper.SupplierInfoMapper;
+import org.dromara.customer.mapper.SupplyAreaMapper;
 import org.dromara.customer.service.*;
 import org.dromara.customer.utils.qcc.QccUtils;
 import org.dromara.customer.utils.qcc.domain.CompanyInfoResponse;
@@ -44,9 +46,6 @@ import org.dromara.system.api.domain.bo.RemoteUserBo;
 import org.dromara.system.api.domain.vo.RemoteSupplierTypeVo;
 import org.springframework.beans.BeanUtils;
 import org.springframework.stereotype.Service;
-import org.dromara.customer.domain.vo.SupplierInfoVo;
-import org.dromara.customer.domain.SupplierInfo;
-import org.dromara.customer.mapper.SupplierInfoMapper;
 import org.springframework.transaction.annotation.Transactional;
 import org.springframework.util.CollectionUtils;
 
@@ -2064,7 +2063,6 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Sup
         lqw.eq(StringUtils.isNotBlank(bo.getInvoiceLandline()), SupplierInfo::getInvoiceLandline, bo.getInvoiceLandline());
         lqw.eq(StringUtils.isNotBlank(bo.getScopeSupply()), SupplierInfo::getScopeSupply, bo.getScopeSupply());
         lqw.eq(bo.getCooperateWay() != null, SupplierInfo::getCooperateWay, bo.getCooperateWay());
-        lqw.eq(StringUtils.isNotBlank(bo.getCooperateLevel()), SupplierInfo::getCooperateLevel, bo.getCooperateLevel());
         lqw.eq(bo.getContractEndTime() != null, SupplierInfo::getContractEndTime, bo.getContractEndTime());
         lqw.eq(bo.getSupplyStatus() != null, SupplierInfo::getSupplyStatus, bo.getSupplyStatus());
         lqw.eq(bo.getSupplyScore() != null, SupplierInfo::getSupplyScore, bo.getSupplyScore());
@@ -2329,11 +2327,18 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Sup
      * @return 是否新增成功
      */
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public Boolean addSupplierInfo(SupplierInfoBo bo) {
         SupplierInfo add = MapstructUtils.convert(bo, SupplierInfo.class);
         boolean flag = baseMapper.insert(add) > 0;
         if (flag) {
             bo.setId(add.getId());
+            SupplierProcurement procurement = new SupplierProcurement();
+            procurement.setSupplierId(add.getId());
+            procurement.setSupplierNo(add.getSupplierNo());
+            procurement.setPurchaser(bo.getBuyer());
+            procurement.setSettlementMethod(bo.getSettlementMethod());
+            supplierProcurementService.insertByBo(BeanUtil.toBean(procurement, SupplierProcurementBo.class));
         }
         return flag;
     }
@@ -2345,9 +2350,19 @@ public class SupplierInfoServiceImpl extends ServiceImpl<SupplierInfoMapper, Sup
      * @return 是否修改成功
      */
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public Boolean updateSupplierInfo(SupplierInfoBo bo) {
         SupplierInfo update = MapstructUtils.convert(bo, SupplierInfo.class);
-        return baseMapper.updateById(update) > 0;
+        boolean flag = baseMapper.updateById(update) > 0;
+        if (flag) {
+            SupplierProcurement procurement = new SupplierProcurement();
+            procurement.setSupplierId(update.getId());
+            procurement.setSupplierNo(update.getSupplierNo());
+            procurement.setPurchaser(bo.getBuyer());
+            procurement.setSettlementMethod(bo.getSettlementMethod());
+            supplierProcurementService.updateByBo(BeanUtil.toBean(procurement, SupplierProcurementBo.class));
+        }
+        return flag;
     }
 
     @Override

+ 24 - 0
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/dubbo/RemoteSupplierLevelServiceImpl.java

@@ -0,0 +1,24 @@
+package org.dromara.system.dubbo;
+
+import cn.hutool.core.bean.BeanUtil;
+import lombok.RequiredArgsConstructor;
+import org.apache.dubbo.config.annotation.DubboService;
+import org.dromara.system.api.RemoteSupplierLevelService;
+import org.dromara.system.api.domain.vo.RemoteSupplierLevelVo;
+import org.dromara.system.domain.vo.SupplierLevelVo;
+import org.dromara.system.service.ISupplierLevelService;
+import org.springframework.stereotype.Service;
+
+@RequiredArgsConstructor
+@Service
+@DubboService
+public class RemoteSupplierLevelServiceImpl implements RemoteSupplierLevelService {
+
+    private final ISupplierLevelService supplierLevelService;
+
+    @Override
+    public RemoteSupplierLevelVo selectByLevelName(String levelName) {
+        SupplierLevelVo supplierLevelVo = supplierLevelService.selectByLevelName(levelName);
+        return BeanUtil.toBean(supplierLevelVo, RemoteSupplierLevelVo.class);
+    }
+}

+ 12 - 1
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/dubbo/RemoteSupplierTypeServiceImpl.java

@@ -1,11 +1,14 @@
 package org.dromara.system.dubbo;
 
+import cn.hutool.core.bean.BeanUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import lombok.RequiredArgsConstructor;
 import org.apache.dubbo.config.annotation.DubboService;
 import org.dromara.system.api.RemoteSupplierTypeService;
 import org.dromara.system.api.domain.vo.RemoteSupplierTypeVo;
 import org.dromara.system.domain.SupplierType;
+import org.dromara.system.domain.vo.SupplierTypeVo;
+import org.dromara.system.service.ISupplierTypeService;
 import org.dromara.system.service.impl.SupplierTypeServiceImpl;
 import org.springframework.stereotype.Service;
 
@@ -22,12 +25,14 @@ import java.util.List;
 public class RemoteSupplierTypeServiceImpl implements RemoteSupplierTypeService {
     private final SupplierTypeServiceImpl supplierTypeService;
 
+    private final ISupplierTypeService iSupplierTypeService;
+
     @Override
     public List<RemoteSupplierTypeVo> queryList() {
         LambdaQueryWrapper<SupplierType> lqw = new LambdaQueryWrapper<>();
         lqw.eq(SupplierType::getDataSource, "youyi");
         List<SupplierType> list = supplierTypeService.list(lqw);
-        List<RemoteSupplierTypeVo> vos =new ArrayList<>();
+        List<RemoteSupplierTypeVo> vos = new ArrayList<>();
         list.forEach(item -> {
             RemoteSupplierTypeVo vo = new RemoteSupplierTypeVo();
             vo.setId(item.getId());
@@ -37,4 +42,10 @@ public class RemoteSupplierTypeServiceImpl implements RemoteSupplierTypeService
         });
         return vos;
     }
+
+    @Override
+    public RemoteSupplierTypeVo selectByTypeName(String typeName) {
+        SupplierTypeVo supplierTypeVo = iSupplierTypeService.selectByTypeName(typeName);
+        return BeanUtil.toBean(supplierTypeVo, RemoteSupplierTypeVo.class);
+    }
 }

+ 3 - 1
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISupplierLevelService.java

@@ -16,7 +16,7 @@ import java.util.List;
  * @author ljy
  * @date 2026-01-12
  */
-public interface ISupplierLevelService extends IService<SupplierLevel>{
+public interface ISupplierLevelService extends IService<SupplierLevel> {
 
     /**
      * 查询供应商等级
@@ -59,6 +59,8 @@ public interface ISupplierLevelService extends IService<SupplierLevel>{
      */
     Boolean updateByBo(SupplierLevelBo bo);
 
+    SupplierLevelVo selectByLevelName(String levelName);
+
     /**
      * 校验并批量删除供应商等级信息
      *

+ 3 - 1
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/ISupplierTypeService.java

@@ -16,7 +16,7 @@ import java.util.List;
  * @author LionLi
  * @date 2026-01-12
  */
-public interface ISupplierTypeService extends IService<SupplierType>{
+public interface ISupplierTypeService extends IService<SupplierType> {
 
     /**
      * 查询供应商类别
@@ -59,6 +59,8 @@ public interface ISupplierTypeService extends IService<SupplierType>{
      */
     Boolean updateByBo(SupplierTypeBo bo);
 
+    SupplierTypeVo selectByTypeName(String typeName);
+
     /**
      * 校验并批量删除供应商类别信息
      *

+ 18 - 13
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SupplierLevelServiceImpl.java

@@ -1,25 +1,25 @@
 package org.dromara.system.service.impl;
 
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
-import org.dromara.common.core.utils.MapstructUtils;
-import org.dromara.common.core.utils.StringUtils;
-import org.dromara.common.mybatis.core.page.TableDataInfo;
-import org.dromara.common.mybatis.core.page.PageQuery;
-import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
-import org.springframework.stereotype.Service;
+import org.dromara.common.core.utils.MapstructUtils;
+import org.dromara.common.core.utils.StringUtils;
+import org.dromara.common.mybatis.core.page.PageQuery;
+import org.dromara.common.mybatis.core.page.TableDataInfo;
+import org.dromara.system.domain.SupplierLevel;
 import org.dromara.system.domain.bo.SupplierLevelBo;
 import org.dromara.system.domain.vo.SupplierLevelVo;
-import org.dromara.system.domain.SupplierLevel;
 import org.dromara.system.mapper.SupplierLevelMapper;
 import org.dromara.system.service.ISupplierLevelService;
+import org.springframework.stereotype.Service;
 
+import java.util.Collection;
 import java.util.List;
 import java.util.Map;
-import java.util.Collection;
 
 /**
  * 供应商等级Service业务层处理
@@ -30,7 +30,7 @@ import java.util.Collection;
 @Slf4j
 @RequiredArgsConstructor
 @Service
-public class SupplierLevelServiceImpl  extends ServiceImpl<SupplierLevelMapper, SupplierLevel> implements ISupplierLevelService {
+public class SupplierLevelServiceImpl extends ServiceImpl<SupplierLevelMapper, SupplierLevel> implements ISupplierLevelService {
 
     private final SupplierLevelMapper baseMapper;
 
@@ -41,7 +41,7 @@ public class SupplierLevelServiceImpl  extends ServiceImpl<SupplierLevelMapper,
      * @return 供应商等级
      */
     @Override
-    public SupplierLevelVo queryById(Long id){
+    public SupplierLevelVo queryById(Long id) {
         return baseMapper.selectVoById(id);
     }
 
@@ -107,10 +107,15 @@ public class SupplierLevelServiceImpl  extends ServiceImpl<SupplierLevelMapper,
         return baseMapper.updateById(update) > 0;
     }
 
+    @Override
+    public SupplierLevelVo selectByLevelName(String levelName) {
+        return baseMapper.selectVoOne(new LambdaQueryWrapper<SupplierLevel>().eq(SupplierLevel::getSupplierLevelName, levelName));
+    }
+
     /**
      * 保存前的数据校验
      */
-    private void validEntityBeforeSave(SupplierLevel entity){
+    private void validEntityBeforeSave(SupplierLevel entity) {
         //TODO 做一些数据校验,如唯一约束
     }
 
@@ -123,7 +128,7 @@ public class SupplierLevelServiceImpl  extends ServiceImpl<SupplierLevelMapper,
      */
     @Override
     public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
-        if(isValid){
+        if (isValid) {
             //TODO 做一些业务上的校验,判断是否需要校验
         }
         return baseMapper.deleteByIds(ids) > 0;

+ 10 - 4
ruoyi-modules/ruoyi-system/src/main/java/org/dromara/system/service/impl/SupplierTypeServiceImpl.java

@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
+import org.dromara.system.domain.ComCurrency;
 import org.springframework.stereotype.Service;
 import org.dromara.system.domain.bo.SupplierTypeBo;
 import org.dromara.system.domain.vo.SupplierTypeVo;
@@ -30,7 +31,7 @@ import java.util.Collection;
 @Slf4j
 @RequiredArgsConstructor
 @Service
-public class SupplierTypeServiceImpl  extends ServiceImpl<SupplierTypeMapper, SupplierType> implements ISupplierTypeService {
+public class SupplierTypeServiceImpl extends ServiceImpl<SupplierTypeMapper, SupplierType> implements ISupplierTypeService {
 
     private final SupplierTypeMapper baseMapper;
 
@@ -41,7 +42,7 @@ public class SupplierTypeServiceImpl  extends ServiceImpl<SupplierTypeMapper, Su
      * @return 供应商类别
      */
     @Override
-    public SupplierTypeVo queryById(Long id){
+    public SupplierTypeVo queryById(Long id) {
         return baseMapper.selectVoById(id);
     }
 
@@ -107,10 +108,15 @@ public class SupplierTypeServiceImpl  extends ServiceImpl<SupplierTypeMapper, Su
         return baseMapper.updateById(update) > 0;
     }
 
+    @Override
+    public SupplierTypeVo selectByTypeName(String typeName) {
+        return baseMapper.selectVoOne(new LambdaQueryWrapper<SupplierType>().eq(SupplierType::getSupplierTypeName, typeName));
+    }
+
     /**
      * 保存前的数据校验
      */
-    private void validEntityBeforeSave(SupplierType entity){
+    private void validEntityBeforeSave(SupplierType entity) {
         //TODO 做一些数据校验,如唯一约束
     }
 
@@ -123,7 +129,7 @@ public class SupplierTypeServiceImpl  extends ServiceImpl<SupplierTypeMapper, Su
      */
     @Override
     public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
-        if(isValid){
+        if (isValid) {
             //TODO 做一些业务上的校验,判断是否需要校验
         }
         return baseMapper.deleteByIds(ids) > 0;