From ca27c0a260a8cd728d278af16fb234ae089dc1c6 Mon Sep 17 00:00:00 2001 From: wzy <wzy19931122ai@163.com> Date: Fri, 17 Jul 2020 20:24:34 +0800 Subject: [PATCH] modify --- src/main/java/com/xcong/excoin/modules/agent/controller/AgentController.java | 38 ++++++++++++++++++++++++++++++++++---- 1 files changed, 34 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..375f44d 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,7 @@ 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.controller.BaseController; import com.xcong.excoin.common.entity.FebsResponse; import com.xcong.excoin.common.entity.QueryRequest; @@ -10,12 +12,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 +35,44 @@ @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); } @PostMapping("add") @RequiresPermissions("agent:add") + @ControllerEndpoint(operation = "新增代理商", exceptionMessage = "新增代理商失败") public FebsResponse add(@Valid AgentUser agentUser) { User user = getCurrentUser(); 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