From 86f2368f146af23c9e16507f790752e79858a29f Mon Sep 17 00:00:00 2001
From: Hentua <wangdoubleone@gmail.com>
Date: Thu, 22 Feb 2024 22:34:31 +0800
Subject: [PATCH] fix
---
src/main/java/cc/mrbird/febs/mall/controller/AdminMallTeamLeaderController.java | 121 +++++++++++++++++++++++++++++++++++++--
1 files changed, 113 insertions(+), 8 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 f1135fc..28e0f4c 100644
--- a/src/main/java/cc/mrbird/febs/mall/controller/AdminMallTeamLeaderController.java
+++ b/src/main/java/cc/mrbird/febs/mall/controller/AdminMallTeamLeaderController.java
@@ -4,20 +4,24 @@
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.AdminLeaderAddFenceDto;
import cc.mrbird.febs.mall.dto.AdminLeaderUpdateDto;
-import cc.mrbird.febs.mall.entity.MallGoodsCategory;
-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;
import org.springframework.validation.annotation.Validated;
-import org.springframework.web.bind.annotation.GetMapping;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.bind.annotation.RestController;
+import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
+import javax.validation.constraints.NotNull;
import java.util.List;
import java.util.Map;
@@ -30,6 +34,7 @@
private final IAdminMallTeamLeaderService iAdminMallTeamLeaderService;
+ private final DataDictionaryCustomMapper dataDictionaryCustomMapper;
/**
* 团长信息--列表
@@ -45,8 +50,36 @@
*/
@PostMapping("leaderUpdate")
@ControllerEndpoint(operation = "团长信息--审核", exceptionMessage = "审核失败")
- public FebsResponse leaderUpdate(@Valid AdminLeaderUpdateDto adminLeaderUpdateDto) {
- return iAdminMallTeamLeaderService.leaderUpdate(adminLeaderUpdateDto);
+ public FebsResponse leaderUpdate(@Valid MallTeamLeader mallTeamLeader) {
+ return iAdminMallTeamLeaderService.leaderUpdate(mallTeamLeader);
+ }
+
+ /**
+ * 团长-开启返利
+ */
+ @GetMapping("startProfit/{id}")
+ @ControllerEndpoint(operation = "团长-开启返利", exceptionMessage = "操作失败")
+ public FebsResponse startProfit(@NotNull(message = "{required}") @PathVariable Long id) {
+ return iAdminMallTeamLeaderService.startProfit(id);
+ }
+
+ /**
+ * 团长-关闭返利
+ */
+ @GetMapping("closeProfit/{id}")
+ @ControllerEndpoint(operation = "团长-关闭返利", exceptionMessage = "操作失败")
+ public FebsResponse closeProfit(@NotNull(message = "{required}") @PathVariable Long id) {
+ return iAdminMallTeamLeaderService.closeProfit(id);
+ }
+
+
+ /**
+ * 团长信息--新增
+ */
+ @PostMapping("addLeader")
+ @ControllerEndpoint(operation = "团长信息--新增", exceptionMessage = "新增失败")
+ public FebsResponse addLeader(@Valid AdminLeaderAddDto adminLeaderAddDto) {
+ return iAdminMallTeamLeaderService.addLeader(adminLeaderAddDto);
}
/**
@@ -57,4 +90,76 @@
return iAdminMallTeamLeaderService.selectList(mallTeamLeader);
}
+ /**
+ * 团长信息--取消团长
+ */
+ @GetMapping("leaderCancel/{id}")
+ @ControllerEndpoint(operation = "团长信息--取消团长", exceptionMessage = "取消团长失败")
+ public FebsResponse leaderCancel(@NotNull(message = "{required}") @PathVariable Long id) {
+ return iAdminMallTeamLeaderService.leaderCancel(id);
+ }
+
+ /**
+ * 团长信息-商品库存编辑
+ */
+ @GetMapping("/leaderGoodsUpdate")
+ public FebsResponse leaderGoodsUpdate(QueryRequest request, MallLeaderStock mallLeaderStock, Integer parentId) {
+ if (parentId == null) {
+ ViewMallTeamLeaderController.idLeaderGoodsUpdate = 0;
+ }
+ mallLeaderStock.setTeamLeaderId(ViewMallTeamLeaderController.idLeaderGoodsUpdate);
+ Map<String, Object> dataTable = getDataTable(iAdminMallTeamLeaderService.leaderGoodsUpdate(request, mallLeaderStock));
+ 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 = Double.parseDouble(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();
+ }
+
+
+ /**
+ * 团长--设置电子围栏
+ */
+ @PostMapping("addFence")
+ @ControllerEndpoint(operation = "团长信息--设置电子围栏", exceptionMessage = "设置失败")
+ public FebsResponse addFence(@Valid AdminLeaderAddFenceDto adminLeaderAddFenceDto) {
+ return iAdminMallTeamLeaderService.addFence(adminLeaderAddFenceDto);
+ }
+
+ /**
+ * 团长--在线
+ */
+ @GetMapping("startOnline/{id}")
+ @ControllerEndpoint(operation = "团长--在线", exceptionMessage = "操作失败")
+ public FebsResponse startOnline(@NotNull(message = "{required}") @PathVariable Long id) {
+ return iAdminMallTeamLeaderService.startOnline(id);
+ }
+
+ /**
+ * 团长--离线
+ */
+ @GetMapping("closeOnline/{id}")
+ @ControllerEndpoint(operation = "团长--离线", exceptionMessage = "操作失败")
+ public FebsResponse closeOnline(@NotNull(message = "{required}") @PathVariable Long id) {
+ return iAdminMallTeamLeaderService.closeOnline(id);
+ }
+
}
--
Gitblit v1.9.1