|
|
|
@ -1,21 +1,15 @@
|
|
|
|
|
package com.hchbox.module.controller;
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
|
|
|
|
|
import cn.hutool.json.JSONObject;
|
|
|
|
|
import com.hchbox.api.RequestCore;
|
|
|
|
|
import com.hchbox.constant.AuthConstants;
|
|
|
|
|
import com.hchbox.constant.DefaultNumberConstants;
|
|
|
|
|
import com.hchbox.module.entity.SellerAccount;
|
|
|
|
|
import com.hchbox.module.entity.vo.AccountInfoVO;
|
|
|
|
|
import com.hchbox.module.feign.AliPayClient;
|
|
|
|
|
import com.hchbox.model.param.CommonResult;
|
|
|
|
|
import com.hchbox.module.service.AccountInfoService;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import org.springframework.data.domain.Page;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import org.springframework.data.domain.Pageable;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
@ -27,29 +21,17 @@ import org.springframework.web.bind.annotation.*;
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
|
@Api(tags = "账号信息")
|
|
|
|
|
@RequestMapping("/api")
|
|
|
|
|
@Slf4j
|
|
|
|
|
public class AccountInfoController {
|
|
|
|
|
private final AliPayClient aliPayClient;
|
|
|
|
|
private final AccountInfoService accountInfoService;
|
|
|
|
|
@Resource
|
|
|
|
|
private RequestCore requestCore;
|
|
|
|
|
|
|
|
|
|
@GetMapping("/list")
|
|
|
|
|
@ApiOperation("查询主账号下的子账号")
|
|
|
|
|
public CommonResult<Page<SellerAccount>> getAccountAll(HttpServletRequest request, Pageable pageable) {
|
|
|
|
|
String token = request.getParameter(AuthConstants.TAO_MI_TOKEN);
|
|
|
|
|
Long accountId = aliPayClient.checkSellAccountByPurchaser(token);
|
|
|
|
|
if (accountId == DefaultNumberConstants.ZERO_NUMBER) {
|
|
|
|
|
return new CommonResult<Page<SellerAccount>>().forbidden();
|
|
|
|
|
}
|
|
|
|
|
AccountInfoVO accountInfoVO = new AccountInfoVO();
|
|
|
|
|
accountInfoVO.setParentId(accountId);
|
|
|
|
|
return accountInfoService.getAccountAll(accountInfoVO, pageable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/parent/accounts")
|
|
|
|
|
@ApiOperation("查询主账号")
|
|
|
|
|
public CommonResult<Object> getParentAccount(@RequestParam(value = "sellerNick", required = false) String sellerNick, Pageable pageable) {
|
|
|
|
|
return requestCore.getParentAccount(sellerNick, pageable);
|
|
|
|
|
public CommonResult<Object> getParentAccount(@RequestParam(value = "nickName", required = false) String nickName, Pageable pageable) {
|
|
|
|
|
log.info("====={}", nickName);
|
|
|
|
|
return requestCore.getParentAccount(nickName, pageable);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/account/subAccount")
|
|
|
|
|