From c6908e1d2efd4f3a1fcfdb1af7f1b78156d07d91 Mon Sep 17 00:00:00 2001
From: Cui Zhi Feng <7426394+wuxixiaocui@user.noreply.gitee.com>
Date: 星期三, 23 十月 2024 09:15:58 +0800
Subject: [PATCH] 统计 待发货 在售商品 待审核商品 待售后处理
---
src/main/java/com/mzl/flower/service/supplier/SupplierService.java | 28 +++++++++++++++++++++++++++-
1 files changed, 27 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 c5516c6..225c894 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,20 @@
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.LocalDateTime;
import java.util.List;
@@ -29,6 +35,9 @@
private final static String SUPPLIER_STATUS_REJECT = "R"; // 审核拒绝
private final SupplierMapper supplierMapper;
+
+ @Resource
+ private BaseService baseService;
public SupplierService(SupplierMapper supplierMapper) {
this.supplierMapper = supplierMapper;
@@ -50,6 +59,7 @@
supplier.create(SecurityUtils.getUserId());
supplier.setShowed(true);
supplier.setStatus(SUPPLIER_STATUS_AUDIT);
+ supplier.setIsEnabled(true);
supplierMapper.insert(supplier);
}else{//重新修改
supplier = supplierMapper.selectById(dto.getId());
@@ -187,4 +197,20 @@
supplier.update(SecurityUtils.getUserId());
supplierMapper.updateById(supplier);
}
+
+ public void isEnable(Long id) {
+ Supplier supplier = supplierMapper.selectById(id);
+ if (supplier == null) {
+ throw new ValidationException("供应商信息不存在");
+ }
+ if (supplier.getIsEnabled()) {
+ supplier.setIsEnabled(false);
+ //强制下线
+ baseService.removeToken(supplier.getUserId());
+ } else {
+ supplier.setIsEnabled(true);
+ }
+ supplier.update(SecurityUtils.getUserId());
+ supplierMapper.updateById(supplier);
+ }
}
--
Gitblit v1.9.3