From 4e5c47ee19caf98810b4ee50661fc141c4d7478f Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期五, 28 三月 2025 08:51:19 +0800
Subject: [PATCH] fix: 11

---
 src/main/java/com/mzl/flower/service/supplier/SupplierService.java |   24 +++++++++++++++++++++++-
 1 files changed, 23 insertions(+), 1 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 67e2e99..c86491a 100644
--- a/src/main/java/com/mzl/flower/service/supplier/SupplierService.java
+++ b/src/main/java/com/mzl/flower/service/supplier/SupplierService.java
@@ -1,5 +1,6 @@
 package com.mzl.flower.service.supplier;
 
+import cn.hutool.core.util.StrUtil;
 import com.alibaba.fastjson.JSON;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
@@ -8,15 +9,21 @@
 import com.mzl.flower.constant.Constants;
 import com.mzl.flower.dto.request.supplier.*;
 import com.mzl.flower.dto.response.supplier.SupplierDTO;
-import com.mzl.flower.entity.customer.Customer;
 import com.mzl.flower.entity.supplier.Supplier;
 import com.mzl.flower.mapper.supplier.SupplierMapper;
+import com.mzl.flower.service.BaseService;
 import com.mzl.flower.utils.DateUtils;
 import org.apache.commons.lang3.StringUtils;
 import org.springframework.beans.BeanUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.security.oauth2.common.OAuth2AccessToken;
+import org.springframework.security.oauth2.common.OAuth2RefreshToken;
+import org.springframework.security.oauth2.provider.token.TokenStore;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
+import javax.annotation.Resource;
+import java.time.LocalDate;
 import java.time.LocalDateTime;
 import java.util.List;
 
@@ -29,6 +36,9 @@
     private final static String SUPPLIER_STATUS_REJECT = "R"; // 审核拒绝
 
     private final SupplierMapper supplierMapper;
+
+    @Resource
+    private BaseService baseService;
 
     public SupplierService(SupplierMapper supplierMapper) {
         this.supplierMapper = supplierMapper;
@@ -120,6 +130,12 @@
         return dto;
     }
 
+    public SupplierDTO findSupplierByPhone(String phone) {
+        SupplierDTO dto = supplierMapper.findSupplierByPhone(phone);
+        dto.setOverTime(LocalDate.from(dto.getPassTime()));
+        return dto;
+    }
+
     public void auditSupplier(AuditSupplierDTO dto) {
         Supplier supplier = supplierMapper.selectById(dto.getId());
         if(supplier==null){
@@ -196,10 +212,16 @@
         }
         if (supplier.getIsEnabled()) {
             supplier.setIsEnabled(false);
+            //强制下线
+            baseService.removeToken(supplier.getUserId());
         } else {
             supplier.setIsEnabled(true);
         }
         supplier.update(SecurityUtils.getUserId());
         supplierMapper.updateById(supplier);
     }
+
+    public Supplier getSupplierById(Long supplierId) {
+        return supplierMapper.selectById(supplierId);
+    }
 }

--
Gitblit v1.9.3