From 10f1422bc8f401b06b1e55ee63b23016d74abce8 Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期三, 28 二月 2024 11:34:09 +0800
Subject: [PATCH] 优化商户发券逻辑
---
ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopProportionServiceImpl.java | 45 ++++++++++++++++++++++++++++++++++++++++++++-
1 files changed, 44 insertions(+), 1 deletions(-)
diff --git a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopProportionServiceImpl.java b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopProportionServiceImpl.java
index 8f2f8f0..2596193 100644
--- a/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopProportionServiceImpl.java
+++ b/ruoyi-modules/ruoyi-shop/src/main/java/com/ruoyi/shop/service/impl/shop/ShopProportionServiceImpl.java
@@ -1,10 +1,16 @@
package com.ruoyi.shop.service.impl.shop;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ruoyi.shop.domain.dto.MgtShopProportionEditDto;
+import com.ruoyi.shop.domain.pojo.shop.ShopAuthentication;
import com.ruoyi.shop.domain.pojo.shop.ShopProportion;
import com.ruoyi.shop.mapper.shop.ShopProportionMapper;
import com.ruoyi.shop.service.shop.ShopProportionService;
-import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
+
+import java.util.Date;
/**
* <p>
@@ -17,4 +23,41 @@
@Service
public class ShopProportionServiceImpl extends ServiceImpl<ShopProportionMapper, ShopProportion> implements ShopProportionService {
+
+ /**
+ * @description 修改商户分成
+ * @author jqs
+ * @date 2023/6/8 9:52
+ * @param mgtShopProportionEditDto
+ * @return void
+ */
+ @Override
+ public void editMgtShopProportion(MgtShopProportionEditDto mgtShopProportionEditDto){
+ //删除旧分成
+ ShopProportion shopProportionOld = this.getById(mgtShopProportionEditDto.getProportionId());
+ if(shopProportionOld!=null){
+ shopProportionOld.setDelFlag(1);
+ shopProportionOld.setUpdateUserId(mgtShopProportionEditDto.getUserId());
+ shopProportionOld.setUpdateTime(new Date());
+ this.saveOrUpdate(shopProportionOld);
+ }
+ //创建新分成
+ ShopProportion shopProportionNew = new ShopProportion();
+ shopProportionNew.setDelFlag(0);
+ shopProportionNew.setShopId(shopProportionOld.getShopId());
+ shopProportionNew.setShopType(shopProportionOld.getShopType());
+ shopProportionNew.setProportionPercent(mgtShopProportionEditDto.getProportionPercent());
+ shopProportionNew.setUpdateTime(new Date());
+ shopProportionNew.setUpdateUserId(mgtShopProportionEditDto.getUserId());
+ this.saveOrUpdate(shopProportionNew);
+ }
+
+ @Override
+ public ShopProportion getByShopId(Long shopId) {
+ LambdaQueryWrapper<ShopProportion> queryWrapper = Wrappers.lambdaQuery();
+ queryWrapper.eq(ShopProportion::getShopId, shopId)
+ .eq(ShopProportion::getDelFlag, 0)
+ .last(" limit 1 ");
+ return this.getOne(queryWrapper);
+ }
}
--
Gitblit v1.7.1