From ae1471f378f399f76518539ec8992e64a3673436 Mon Sep 17 00:00:00 2001
From: 陶杰 <1378534974@qq.com>
Date: 星期三, 08 一月 2025 15:26:06 +0800
Subject: [PATCH] 1.订单提交:订单最小金额配置
---
src/main/java/com/mzl/flower/service/supplier/SupplierService.java | 20 ++++++++++++++++++++
1 files changed, 20 insertions(+), 0 deletions(-)
diff --git a/src/main/java/com/mzl/flower/service/supplier/SupplierService.java b/src/main/java/com/mzl/flower/service/supplier/SupplierService.java
index 225c894..39e482a 100644
--- a/src/main/java/com/mzl/flower/service/supplier/SupplierService.java
+++ b/src/main/java/com/mzl/flower/service/supplier/SupplierService.java
@@ -10,7 +10,9 @@
import com.mzl.flower.dto.request.supplier.*;
import com.mzl.flower.dto.response.supplier.SupplierDTO;
import com.mzl.flower.entity.supplier.Supplier;
+import com.mzl.flower.entity.supplier.SupplierSub;
import com.mzl.flower.mapper.supplier.SupplierMapper;
+import com.mzl.flower.mapper.supplier.SupplierSubMapper;
import com.mzl.flower.service.BaseService;
import com.mzl.flower.utils.DateUtils;
import org.apache.commons.lang3.StringUtils;
@@ -21,6 +23,7 @@
import org.springframework.security.oauth2.provider.token.TokenStore;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.ObjectUtils;
import javax.annotation.Resource;
import java.time.LocalDateTime;
@@ -35,6 +38,9 @@
private final static String SUPPLIER_STATUS_REJECT = "R"; // 审核拒绝
private final SupplierMapper supplierMapper;
+
+ @Resource
+ private SupplierSubMapper supplierSubMapper;
@Resource
private BaseService baseService;
@@ -162,6 +168,16 @@
throw new ValidationException("当前登录用户不是供应商账号");
}
SupplierDTO dto = supplierMapper.getCurrentSupplier(SecurityUtils.getUserId());
+ //如果是空 查询子账号的供应商ID
+ if (ObjectUtils.isEmpty(dto)) {
+ SupplierSub sub = supplierSubMapper.getCurrentSupplier(SecurityUtils.getUserId());
+ if (!ObjectUtils.isEmpty(sub)) {
+ dto = supplierMapper.findSupplierDetail(sub.getSupplierId());
+ }
+ }
+ if(ObjectUtils.isEmpty(dto)){
+ throw new ValidationException("供应商信息不存在");
+ }
return dto;
}
@@ -213,4 +229,8 @@
supplier.update(SecurityUtils.getUserId());
supplierMapper.updateById(supplier);
}
+
+ public Supplier getSupplierById(Long supplierId) {
+ return supplierMapper.selectById(supplierId);
+ }
}
--
Gitblit v1.9.3