From 3064a503bc6d0030c1f812d57c4ba2cb7a650fea Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Fri, 02 Sep 2022 14:27:45 +0800
Subject: [PATCH] 20220822

---
 src/main/java/cc/mrbird/febs/mall/controller/AdminMallTeamLeaderController.java |   44 ++++++++++++++++++++++++++++++++++++++++----
 1 files changed, 40 insertions(+), 4 deletions(-)

diff --git a/src/main/java/cc/mrbird/febs/mall/controller/AdminMallTeamLeaderController.java b/src/main/java/cc/mrbird/febs/mall/controller/AdminMallTeamLeaderController.java
index 9a42352..add177a 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/AdminMallTeamLeaderController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/AdminMallTeamLeaderController.java
@@ -4,12 +4,15 @@
 import cc.mrbird.febs.common.controller.BaseController;
 import cc.mrbird.febs.common.entity.FebsResponse;
 import cc.mrbird.febs.common.entity.QueryRequest;
+import cc.mrbird.febs.common.enumerates.DataDictionaryEnum;
+import cc.mrbird.febs.mall.dto.AdminLeaderAddDto;
 import cc.mrbird.febs.mall.dto.AdminLeaderUpdateDto;
-import cc.mrbird.febs.mall.entity.MallGoodsCategory;
-import cc.mrbird.febs.mall.entity.MallLeaderStock;
-import cc.mrbird.febs.mall.entity.MallMember;
-import cc.mrbird.febs.mall.entity.MallTeamLeader;
+import cc.mrbird.febs.mall.dto.ApiApplayLeaderDto;
+import cc.mrbird.febs.mall.entity.*;
+import cc.mrbird.febs.mall.mapper.DataDictionaryCustomMapper;
 import cc.mrbird.febs.mall.service.IAdminMallTeamLeaderService;
+import cc.mrbird.febs.mall.vo.AdminLeaderBonusSettingVo;
+import cc.mrbird.febs.mall.vo.AdminRangeSettingVo;
 import cc.mrbird.febs.mall.vo.AdminSelectListLeaderVo;
 import lombok.RequiredArgsConstructor;
 import lombok.extern.slf4j.Slf4j;
@@ -30,6 +33,7 @@
 
 
     private final IAdminMallTeamLeaderService iAdminMallTeamLeaderService;
+    private final DataDictionaryCustomMapper dataDictionaryCustomMapper;
 
     /**
      * 团长信息--列表
@@ -47,6 +51,16 @@
     @ControllerEndpoint(operation = "团长信息--审核", exceptionMessage = "审核失败")
     public FebsResponse leaderUpdate(@Valid AdminLeaderUpdateDto adminLeaderUpdateDto) {
         return iAdminMallTeamLeaderService.leaderUpdate(adminLeaderUpdateDto);
+    }
+
+
+    /**
+     * 团长信息--新增
+     */
+    @PostMapping("addLeader")
+    @ControllerEndpoint(operation = "团长信息--新增", exceptionMessage = "新增失败")
+    public FebsResponse addLeader(@Valid AdminLeaderAddDto adminLeaderAddDto) {
+        return iAdminMallTeamLeaderService.addLeader(adminLeaderAddDto);
     }
 
     /**
@@ -79,4 +93,26 @@
         return new FebsResponse().success().data(dataTable);
     }
 
+
+
+    /**
+     * 团长每日分成设置 -- 更新
+     */
+    @PostMapping(value = "/leaderBonusSetUpdate")
+    public FebsResponse leaderBonusSetUpdate(AdminLeaderBonusSettingVo adminLeaderBonusSettingVo) {
+        Integer bonusSwitch = adminLeaderBonusSettingVo.getBonusSwitch();
+        DataDictionaryCustom bonusSwitchDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.BONUS_SWITCH.getType(), DataDictionaryEnum.BONUS_SWITCH.getCode());
+        bonusSwitchDic.setValue(bonusSwitch.toString());
+        dataDictionaryCustomMapper.updateById(bonusSwitchDic);
+
+        Double bonusPercent = adminLeaderBonusSettingVo.getBonusPercent();
+        if(1 <= bonusPercent || 0 >= bonusPercent){
+            return new FebsResponse().fail().message("请输入合适的百分比小数");
+        }
+        DataDictionaryCustom bonusPercentDic = dataDictionaryCustomMapper.selectDicDataByTypeAndCode(DataDictionaryEnum.BONUS_PERCENT.getType(), DataDictionaryEnum.BONUS_PERCENT.getCode());
+        bonusPercentDic.setValue(bonusPercent.toString());
+        dataDictionaryCustomMapper.updateById(bonusPercentDic);
+        return new FebsResponse().success();
+    }
+
 }

--
Gitblit v1.9.1