|
@@ -1,23 +1,30 @@
|
|
|
package com.tour.api.controller;
|
|
|
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.tour.api.service.ApiAgentCenterService;
|
|
|
+import com.tour.api.vo.AgentVo;
|
|
|
import com.tour.common.annotation.AccessToken;
|
|
|
import com.tour.common.core.controller.BaseController;
|
|
|
import com.tour.common.core.domain.BaseResult;
|
|
|
import com.tour.module.domain.*;
|
|
|
+import com.tour.module.domain.dto.OmsOrderDto;
|
|
|
+import com.tour.module.domain.dto.SystemOrderDto;
|
|
|
+import com.tour.module.service.IAgentService;
|
|
|
import com.tour.module.service.IContactsService;
|
|
|
import com.tour.module.service.IOrderService;
|
|
|
+import com.tour.module.vo.CardListVo;
|
|
|
import com.tour.module.vo.CardVo;
|
|
|
import com.tour.module.vo.OrderCommissonVo;
|
|
|
-import io.swagger.annotations.Api;
|
|
|
-import io.swagger.annotations.ApiImplicitParam;
|
|
|
-import io.swagger.annotations.ApiImplicitParams;
|
|
|
-import io.swagger.annotations.ApiOperation;
|
|
|
+import io.swagger.annotations.*;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
|
|
|
@@ -30,57 +37,75 @@ public class AgentCenterApi extends BaseController {
|
|
|
|
|
|
private final IOrderService orderService;
|
|
|
private final ApiAgentCenterService apiAgentCenterService;
|
|
|
-
|
|
|
+ private final IAgentService agentService;
|
|
|
|
|
|
@ApiOperation("订单列表")
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(required = true, paramType = "query", name = "status", value = " 0 待出行 1出行中 2 已完成 -1取消")
|
|
|
+ @ApiImplicitParam(required = true, paramType = "query", name = "status", value = " 0 待出行 1出行中 3 已完成 -1取消"),
|
|
|
+ @ApiImplicitParam(required = true, paramType = "query", name = "id", value = " 代理id")
|
|
|
})
|
|
|
- @PostMapping(value = "/list")
|
|
|
- @AccessToken
|
|
|
- public BaseResult getList(@RequestParam ("status") Integer status) {
|
|
|
- Order order = new Order();
|
|
|
+ @GetMapping(value = "/list")
|
|
|
+// @AccessToken
|
|
|
+ public BaseResult<List<OmsOrderDto>> getList(@RequestParam("status") Integer status, @RequestParam("id") Long id) {
|
|
|
+ SystemOrderDto order = new SystemOrderDto();
|
|
|
order.setStatus(status);
|
|
|
- order.setAgentId(getLoginId());
|
|
|
- order.setKeyWord(order.getKeyWord());
|
|
|
- return BaseResult.success(orderService.queryList(order));
|
|
|
+ List<Long> agentIds = agentService.getIds(id);
|
|
|
+ order.setAgentIds(agentIds);
|
|
|
+ return BaseResult.success(orderService.queryOrderList(order));
|
|
|
}
|
|
|
|
|
|
+ @ApiOperation("代理商订单状态数量")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(required = true, paramType = "query", name = "id", value = " 代理id")
|
|
|
+ })
|
|
|
+ @GetMapping(value = "/getOrderStatus")
|
|
|
+ @ApiResponses({
|
|
|
+ @ApiResponse(code = 200, message = "waitNum 待出行数量,hasTravel 出行中数量 finishNum 完成数量 cancelNum 取消数量")
|
|
|
+ })
|
|
|
+ @AccessToken
|
|
|
+ public BaseResult getOrderStatus(@RequestParam("id") Long agentId) {
|
|
|
+ return BaseResult.success(orderService.getAgentOrderStatusNum(agentId));
|
|
|
+ }
|
|
|
|
|
|
@ApiOperation("激活和未激活卡数量")
|
|
|
@GetMapping(value = "/cardNum")
|
|
|
- @AccessToken
|
|
|
- public BaseResult cardNum() {
|
|
|
- Map map = apiAgentCenterService.getUseCard(getLoginId());
|
|
|
+ @ApiResponses({
|
|
|
+ @ApiResponse(code = 200, message = "noUseNum 未激活数量,useNum 已激活数量 totalNum 全部数量")
|
|
|
+ })
|
|
|
+// @AccessToken
|
|
|
+ public BaseResult cardNum(@RequestParam("id") Long agentId) {
|
|
|
+ Map map = apiAgentCenterService.getUseCard(agentId);
|
|
|
return BaseResult.success(map);
|
|
|
}
|
|
|
|
|
|
|
|
|
@ApiOperation("旅游卡列表")
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(required = true, paramType = "query", name = "status", value = " 0 待激活 1 激活 10全部")
|
|
|
+ @ApiImplicitParam(required = true, paramType = "query", name = "status", value = " 0 待激活 1 激活 10全部"),
|
|
|
+ @ApiImplicitParam(required = true, paramType = "query", name = "id", value = " 代理id")
|
|
|
})
|
|
|
@GetMapping(value = "/cardList")
|
|
|
- @AccessToken
|
|
|
- public BaseResult cardList(@RequestParam("status") String status) {
|
|
|
- List<Card> list = apiAgentCenterService.cardList(getLoginId(), status);
|
|
|
+// @AccessToken
|
|
|
+ public BaseResult<List<CardListVo>> cardList(@RequestParam("status") String status, @RequestParam("id") Long agentId) {
|
|
|
+ List<CardListVo> list = apiAgentCenterService.cardList(agentId, status);
|
|
|
return BaseResult.success(list);
|
|
|
}
|
|
|
|
|
|
@ApiOperation("激活详情")
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(required = true, paramType = "query", name = "cardKey", value = "卡密")
|
|
|
+ @ApiImplicitParam(required = true, paramType = "query", name = "cardKey", value = "卡密"),
|
|
|
+ @ApiImplicitParam(required = true, paramType = "query", name = "id", value = " 代理id")
|
|
|
})
|
|
|
@PostMapping(value = "/getCardOrder")
|
|
|
- @AccessToken
|
|
|
- public BaseResult getCardOrder(@RequestParam("cardKey") String cardKey) {
|
|
|
+ // @AccessToken
|
|
|
+ public BaseResult<CardVo> getCardOrder(String cardKey, Long id) {
|
|
|
CardVo vo = apiAgentCenterService.getCardOrder(cardKey);
|
|
|
return BaseResult.success(vo);
|
|
|
}
|
|
|
|
|
|
@ApiOperation("提现申请")
|
|
|
@PostMapping(value = "/withDrawal")
|
|
|
- @AccessToken
|
|
|
+ // @AccessToken
|
|
|
public BaseResult withDrawal(@RequestBody AgentWithdrawal agentWithdrawal) {
|
|
|
Boolean result = apiAgentCenterService.withDrawal(agentWithdrawal);
|
|
|
return result ? BaseResult.success() : BaseResult.error("提现申请失败");
|
|
@@ -89,29 +114,74 @@ public class AgentCenterApi extends BaseController {
|
|
|
|
|
|
@ApiOperation("提现记录")
|
|
|
@ApiImplicitParams({
|
|
|
- @ApiImplicitParam(required = true, paramType = "query", name = "status", value = " 0审核中 1审核通过 2 拒绝 10全部")
|
|
|
+ @ApiImplicitParam(required = true, paramType = "query", name = "status", value = " 0审核中 1审核通过 2 拒绝 10全部"),
|
|
|
+ @ApiImplicitParam(required = true, paramType = "query", name = "id", value = " 代理id")
|
|
|
})
|
|
|
@GetMapping(value = "/withDrawalList")
|
|
|
- @AccessToken
|
|
|
- public BaseResult withDrawalList(@RequestParam("status") Integer status) {
|
|
|
- List<AgentWithdrawal> list =apiAgentCenterService.withDrawalList(getLoginId(),status);
|
|
|
- return BaseResult.success(list) ;
|
|
|
+// @AccessToken
|
|
|
+ public BaseResult withDrawalList(@RequestParam("status") Integer status, @RequestParam("id") Long agentId) {
|
|
|
+ List<AgentWithdrawal> list = apiAgentCenterService.withDrawalList(agentId, status);
|
|
|
+ return BaseResult.success(list);
|
|
|
}
|
|
|
|
|
|
|
|
|
@ApiOperation("佣金记录")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(required = true, paramType = "query", name = "id", value = " 代理id")
|
|
|
+ })
|
|
|
@GetMapping(value = "/commissonList")
|
|
|
- @AccessToken
|
|
|
- public BaseResult commissonList() {
|
|
|
- List<OrderCommissonVo> list =apiAgentCenterService.commissonList(getLoginId());
|
|
|
+// @AccessToken
|
|
|
+ public BaseResult commissonList(@RequestParam("id") Long agentId) {
|
|
|
+ List<OrderCommissonVo> list = apiAgentCenterService.commissonList(agentId);
|
|
|
return BaseResult.success(list);
|
|
|
}
|
|
|
|
|
|
@ApiOperation("团队成员")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(required = true, paramType = "query", name = "id", value = " 代理id")
|
|
|
+ })
|
|
|
@GetMapping(value = "/getGroupUser")
|
|
|
@AccessToken
|
|
|
- public BaseResult getGroupUser() {
|
|
|
- List<Agent> list =apiAgentCenterService.getGroupUser(getLoginId());
|
|
|
+ public BaseResult<List<AgentVo>> getGroupUser(@RequestParam("id") Long agentId) {
|
|
|
+ List<AgentVo> list = apiAgentCenterService.getGroupUser(agentId);
|
|
|
return BaseResult.success(list);
|
|
|
}
|
|
|
+
|
|
|
+ @ApiOperation("获取代理商信息")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(required = true, paramType = "query", name = "id", value = " 代理id")
|
|
|
+ })
|
|
|
+ @GetMapping(value = "/getInfo")
|
|
|
+// @AccessToken
|
|
|
+ public BaseResult getInfo(@RequestParam("id") Long agentId) {
|
|
|
+ Agent agent = agentService.getById(agentId);
|
|
|
+ BigDecimal totalAmount = agent.getAmount().add(agent.getWithdrawalAmount());
|
|
|
+ agent.setTotalAmount(totalAmount);
|
|
|
+ List<Agent> subAgents = agentService.list(new QueryWrapper<Agent>().eq("pid", agentId));
|
|
|
+ if (!CollectionUtils.isEmpty(subAgents)) {
|
|
|
+ agent.setHasSub(true);
|
|
|
+ } else {
|
|
|
+ agent.setHasSub(false);
|
|
|
+ }
|
|
|
+ return BaseResult.success(agent);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("修改密码")
|
|
|
+ @ApiImplicitParams({
|
|
|
+ @ApiImplicitParam(required = true, paramType = "query", name = "id", value = " 代理id"),
|
|
|
+ @ApiImplicitParam(required = true, paramType = "query", name = "oldPassword", value = "旧密码"),
|
|
|
+ @ApiImplicitParam(required = true, paramType = "query", name = "password", value = "新密码")
|
|
|
+ })
|
|
|
+ @PostMapping(value = "/updatePass")
|
|
|
+// @AccessToken
|
|
|
+ public BaseResult updatePass(@RequestBody String body) {
|
|
|
+ JSONObject json = JSON.parseObject(body);
|
|
|
+ Long agentId = json.getLongValue("id");
|
|
|
+ String oldPassword = json.getString("oldPassword");
|
|
|
+ String password = json.getString("password");
|
|
|
+ int result = apiAgentCenterService.updateAgentPass(agentId, oldPassword, password);
|
|
|
+ return result > 0 ? BaseResult.success() : BaseResult.error("修改失败");
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
}
|