From 9f345310a755f35dcd06424b3923b119686365af Mon Sep 17 00:00:00 2001
From: cloudroam <cloudroam>
Date: 星期一, 09 九月 2024 16:14:33 +0800
Subject: [PATCH] add:合伙人账号启用/禁用;供应商启用/禁用;花店端账号禁用/启用

---
 src/main/java/com/mzl/flower/service/partner/PartnerService.java |   16 ++++++++++++++++
 1 files changed, 16 insertions(+), 0 deletions(-)

diff --git a/src/main/java/com/mzl/flower/service/partner/PartnerService.java b/src/main/java/com/mzl/flower/service/partner/PartnerService.java
index 609684c..15f9a26 100644
--- a/src/main/java/com/mzl/flower/service/partner/PartnerService.java
+++ b/src/main/java/com/mzl/flower/service/partner/PartnerService.java
@@ -10,6 +10,7 @@
 import com.mzl.flower.dto.request.partner.*;
 import com.mzl.flower.dto.response.partner.PartnerDTO;
 import com.mzl.flower.entity.partner.Partner;
+import com.mzl.flower.entity.supplier.Supplier;
 import com.mzl.flower.mapper.partner.PartnerMapper;
 import com.mzl.flower.service.UploadService;
 import com.mzl.flower.utils.DateUtils;
@@ -59,6 +60,7 @@
             partner.setIdCards(JSON.toJSONString(dto.getIdCards()));
             partner.create(SecurityUtils.getUserId());
             partner.setStatus(PARTNER_STATUS_AUDIT);
+            partner.setIsEnabled(true);
             partnerMapper.insert(partner);
         }else{//重新修改
             partner = partnerMapper.selectById(dto.getId());
@@ -161,4 +163,18 @@
         partner.update(SecurityUtils.getUserId());
         partnerMapper.updateById(partner);
     }
+
+    public void isEnable(Long id) {
+        Partner partner = partnerMapper.selectById(id);
+        if (partner == null) {
+            throw new ValidationException("合伙人信息不存在");
+        }
+        if (partner.getIsEnabled()) {
+            partner.setIsEnabled(false);
+        } else {
+            partner.setIsEnabled(true);
+        }
+        partner.update(SecurityUtils.getUserId());
+        partnerMapper.updateById(partner);
+    }
 }

--
Gitblit v1.9.3