diff --git a/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/api/RequestCore.java b/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/api/RequestCore.java index 214f291..cb0efd4 100644 --- a/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/api/RequestCore.java +++ b/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/api/RequestCore.java @@ -26,7 +26,7 @@ public class RequestCore { * @param pageable * @return */ - public CommonResult getParentAccount(@RequestParam(value = "sellerNick") String sellerNick, Pageable pageable) { + public CommonResult getParentAccount(String sellerNick, Pageable pageable) { String reqUrl = url + API_PREFIX + "/account/parentAccounts" + "?" + "sellerNick=" + sellerNick + "&pageNumber=" + pageable.getPageNumber() + "&pageSize=" + pageable.getPageSize(); return requestApi(reqUrl); } @@ -49,20 +49,19 @@ public class RequestCore { * @param payTemplateId * @return */ - CommonResult authorizeChildrenAccount(@RequestParam(value = "childrenAccountId") Long childrenAccountId, @RequestParam(value = "payTemplateId") Long payTemplateId) { + public CommonResult authorizeChildrenAccount(Long childrenAccountId, @RequestParam(value = "payTemplateId") Long payTemplateId) { String reqUrl = url + API_PREFIX + "/account/authorize" + "?" + "childrenAccountId=" + childrenAccountId + "&payTemplateId=" + payTemplateId; return requestApi(reqUrl); } private CommonResult requestApi(String url) { - JSONObject results; + String getResult = HttpUtil .createGet(url) .execute() .charset("utf-8") .body(); JSONObject o = JSONUtil.parseObj(getResult); - results = o.getJSONObject("data"); - return new CommonResult<>().success(results); + return new CommonResult<>().success(JSONUtil.toJsonStr(o)); } } diff --git a/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/controller/AccountInfoController.java b/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/controller/AccountInfoController.java index 9852470..d400a72 100644 --- a/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/controller/AccountInfoController.java +++ b/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/controller/AccountInfoController.java @@ -50,20 +50,20 @@ public class AccountInfoController { public CommonResult getParentAccount(@RequestParam(value = "sellerNick") String sellerNick, Pageable pageable) { return requestCore.getParentAccount(sellerNick, pageable); } -// -// @GetMapping("/pay/template") -// @ApiOperation("查询套餐") -// public CommonResult getPayTemplate() { -// return aliPayClient.getPayTemplate(); -// } -// -// @GetMapping("/account/authorize") -// @ApiOperation("对子账号授权") -// public CommonResult authorizeChildrenAccount(Long childrenAccountId, Long payTemplateId) { -// if (childrenAccountId == DefaultNumberConstants.ZERO_NUMBER || payTemplateId == DefaultNumberConstants.ZERO_NUMBER) { -// return new CommonResult<>().validateFailed("参数错误"); -// } -// return aliPayClient.authorizeChildrenAccount(childrenAccountId, payTemplateId); -// } + + @GetMapping("/pay/template") + @ApiOperation("查询套餐") + public CommonResult getPayTemplate() { + return requestCore.getPayTemplate(); + } + + @GetMapping("/account/authorize") + @ApiOperation("对子账号授权") + public CommonResult authorizeChildrenAccount(Long childrenAccountId, Long payTemplateId) { + if (childrenAccountId == DefaultNumberConstants.ZERO_NUMBER || payTemplateId == DefaultNumberConstants.ZERO_NUMBER) { + return new CommonResult<>().validateFailed("参数错误"); + } + return requestCore.authorizeChildrenAccount(childrenAccountId, payTemplateId); + } } diff --git a/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/controller/AuthorizationController.java b/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/controller/AuthorizationController.java index 16168ce..18ca64e 100644 --- a/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/controller/AuthorizationController.java +++ b/service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/controller/AuthorizationController.java @@ -71,6 +71,8 @@ public class AuthorizationController { private final LoginProperties loginProperties; private final OnlineUserService onlineUserService; private final AuthenticationManagerBuilder authenticationManagerBuilder; + @Resource + private LoginProperties loginProperties; @ApiOperation("登录授权") @AnonymousPostMapping(value = "/login") @@ -121,7 +123,7 @@ public class AuthorizationController { } @ApiOperation("退出登录") - @AnonymousDeleteMapping(value = "/logout") + @DeleteMapping(value = "/logout") public ResponseEntity logout(HttpServletRequest request) { onlineUserService.logout(tokenProvider.getToken(request)); return new ResponseEntity<>(HttpStatus.OK); diff --git a/service/trade-service-source/trade-service-source-core/src/main/java/com/hchbox/controller/SellerAccountController.java b/service/trade-service-source/trade-service-source-core/src/main/java/com/hchbox/controller/SellerAccountController.java index 8b68551..c624d30 100644 --- a/service/trade-service-source/trade-service-source-core/src/main/java/com/hchbox/controller/SellerAccountController.java +++ b/service/trade-service-source/trade-service-source-core/src/main/java/com/hchbox/controller/SellerAccountController.java @@ -82,12 +82,13 @@ public class SellerAccountController { @GetMapping("/parentAccounts") @ApiOperation("分页查询主账号") public CommonResult> getParentAccount(@RequestParam("sellerNick") String sellerNick, Pageable pageable) { + log.info("sellerNick=={}", sellerNick); return sellerAccountService.getParentAccount(sellerNick, pageable); } @GetMapping("/authorize") @ApiOperation("子账号授权") - public CommonResult authorizeChildrenAccount(@RequestParam("childrenAccountId")Long childrenAccountId,@RequestParam("payTemplateId") Long payTemplateId) { + public CommonResult authorizeChildrenAccount(@RequestParam("childrenAccountId") Long childrenAccountId, @RequestParam("payTemplateId") Long payTemplateId) { if (childrenAccountId == DefaultNumberConstants.ZERO_NUMBER || payTemplateId == DefaultNumberConstants.ZERO_NUMBER) { return new CommonResult<>().validateFailed("参数错误"); } diff --git a/service/trade-service-source/trade-service-source-taobao/src/main/java/com/hchbox/service/impl/SellerAccountServiceImpl.java b/service/trade-service-source/trade-service-source-taobao/src/main/java/com/hchbox/service/impl/SellerAccountServiceImpl.java index c33d690..5639c85 100644 --- a/service/trade-service-source/trade-service-source-taobao/src/main/java/com/hchbox/service/impl/SellerAccountServiceImpl.java +++ b/service/trade-service-source/trade-service-source-taobao/src/main/java/com/hchbox/service/impl/SellerAccountServiceImpl.java @@ -342,18 +342,21 @@ public class SellerAccountServiceImpl implements SellerAccountService { @Override public CommonResult> getParentAccount(String sellerNick, Pageable pageable) { AccountSearchVo accountSearchVo = new AccountSearchVo(); - if (StrUtil.isNotEmpty(sellerNick)) { + if (!Objects.equals(sellerNick, "") && sellerNick != null) { accountSearchVo.setNickname(sellerNick); } accountSearchVo.setParentId((long) DefaultNumberConstants.ZERO_NUMBER); + log.info("accountSearchVo ==" + accountSearchVo); Page sellerAccounts = sellerAccountRepository.findAll( ((root, criteriaQuery, cb) -> QueryHelp.getPredicate(root, accountSearchVo, cb)), pageable); + log.info("sellerAccounts =======" + sellerAccounts); return new CommonResult>().success( PageUtil.toPage(sellerAccounts.getContent(), sellerAccounts.getTotalElements())); } @Override + @Transactional(rollbackFor = Exception.class) public CommonResult authorizeChildrenAccount(Long childrenAccountId, Long payTemplateId) { //验证是否为子账号 SellerAccount sellerAccount = sellerAccountRepository.findSellerAccountById(childrenAccountId); diff --git a/trade-common/src/main/java/com/hchbox/model/entity/BasePayTemplate.java b/trade-common/src/main/java/com/hchbox/model/entity/BasePayTemplate.java index 8f1fe0d..ea0c54a 100644 --- a/trade-common/src/main/java/com/hchbox/model/entity/BasePayTemplate.java +++ b/trade-common/src/main/java/com/hchbox/model/entity/BasePayTemplate.java @@ -37,10 +37,6 @@ public class BasePayTemplate implements Serializable { @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8") private Date updateTime; - @Column(name = "template_code") - @ApiModelProperty("套餐code") - private String templateCode; - @Column(name = "package_name") @ApiModelProperty("套餐名") private String packageName;