From 1c23bfe752fea2e815daa4bdd93859dee9e5b87c Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Thu, 22 Apr 2021 18:44:50 +0800
Subject: [PATCH] 20210422
---
src/main/java/com/xcong/excoin/modules/agent/controller/AgentController.java | 41 +++++++++++++++++++++++++++++++++++++----
1 files changed, 37 insertions(+), 4 deletions(-)
diff --git a/src/main/java/com/xcong/excoin/modules/agent/controller/AgentController.java b/src/main/java/com/xcong/excoin/modules/agent/controller/AgentController.java
index ddeacb2..96fcbba 100644
--- a/src/main/java/com/xcong/excoin/modules/agent/controller/AgentController.java
+++ b/src/main/java/com/xcong/excoin/modules/agent/controller/AgentController.java
@@ -1,5 +1,8 @@
package com.xcong.excoin.modules.agent.controller;
+import com.baomidou.mybatisplus.core.toolkit.StringPool;
+import com.xcong.excoin.common.annotation.ControllerEndpoint;
+import com.xcong.excoin.common.annotation.SubmitRepeat;
import com.xcong.excoin.common.controller.BaseController;
import com.xcong.excoin.common.entity.FebsResponse;
import com.xcong.excoin.common.entity.QueryRequest;
@@ -10,12 +13,11 @@
import lombok.extern.slf4j.Slf4j;
import org.apache.shiro.authz.annotation.RequiresPermissions;
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.NotBlank;
+import javax.validation.constraints.NotNull;
import java.util.Map;
/**
@@ -34,15 +36,46 @@
@GetMapping("getList")
@RequiresPermissions("agent:view")
public FebsResponse getList(AgentUser agentUser, QueryRequest queryRequest) {
+ User user = getCurrentUser();
+ agentUser.setRefererId(user.getInviteId());
Map<String, Object> map = getDataTable(agentService.findAgentList(agentUser, queryRequest));
return new FebsResponse().success().data(map);
}
+// @SubmitRepeat
@PostMapping("add")
@RequiresPermissions("agent:add")
+ @ControllerEndpoint(operation = "新增代理商", exceptionMessage = "新增代理商失败")
public FebsResponse add(@Valid AgentUser agentUser) {
User user = getCurrentUser();
+ log.info("{}添加代理商{}", user.getInviteId(), agentUser.getInviteId());
agentService.addAgent(agentUser, user);
return new FebsResponse().success();
}
+
+ @GetMapping("del/{ids}")
+ @RequiresPermissions("agent:del")
+ @ControllerEndpoint(operation = "删除代理商", exceptionMessage = "删除代理商失败")
+ public FebsResponse del(@NotBlank(message = "{required}") @PathVariable("ids") String ids) {
+ String[] idsArr = ids.split(StringPool.COMMA);
+ agentService.delAgent(idsArr);
+ return new FebsResponse().success();
+ }
+
+ @PostMapping("reset/{id}")
+ @RequiresPermissions("agent:password:reset")
+ @ControllerEndpoint(operation = "重置密码", exceptionMessage = "重置密码失败")
+ public FebsResponse reset(@NotNull(message = "{required}") @PathVariable("id") Long id) {
+ agentService.resetPwd(id);
+ return new FebsResponse().success();
+ }
+
+ @PostMapping("edit")
+ @RequiresPermissions("agent:edit")
+ @ControllerEndpoint(operation = "修改代理商", exceptionMessage = "修改代理商失败")
+ public FebsResponse edit(@Valid AgentUser agentUser) {
+ User user = getCurrentUser();
+ agentService.editAgent(agentUser, user);
+ return new FebsResponse().success();
+ }
}
--
Gitblit v1.9.1