Merge remote-tracking branch 'origin/dev' into dev

# Conflicts:
#	service/trade-service-others/trade-service-others-account/src/main/java/com/hchbox/module/controller/AuthorizationController.java
master
bynt 3 years ago
commit 5002eb4004

@ -26,7 +26,7 @@ public class RequestCore {
* @param pageable * @param pageable
* @return * @return
*/ */
public CommonResult<Object> getParentAccount(@RequestParam(value = "sellerNick") String sellerNick, Pageable pageable) { public CommonResult<Object> getParentAccount(String sellerNick, Pageable pageable) {
String reqUrl = url + API_PREFIX + "/account/parentAccounts" + "?" + "sellerNick=" + sellerNick + "&pageNumber=" + pageable.getPageNumber() + "&pageSize=" + pageable.getPageSize(); String reqUrl = url + API_PREFIX + "/account/parentAccounts" + "?" + "sellerNick=" + sellerNick + "&pageNumber=" + pageable.getPageNumber() + "&pageSize=" + pageable.getPageSize();
return requestApi(reqUrl); return requestApi(reqUrl);
} }
@ -49,20 +49,19 @@ public class RequestCore {
* @param payTemplateId * @param payTemplateId
* @return * @return
*/ */
CommonResult<Object> authorizeChildrenAccount(@RequestParam(value = "childrenAccountId") Long childrenAccountId, @RequestParam(value = "payTemplateId") Long payTemplateId) { public CommonResult<Object> authorizeChildrenAccount(Long childrenAccountId, @RequestParam(value = "payTemplateId") Long payTemplateId) {
String reqUrl = url + API_PREFIX + "/account/authorize" + "?" + "childrenAccountId=" + childrenAccountId + "&payTemplateId=" + payTemplateId; String reqUrl = url + API_PREFIX + "/account/authorize" + "?" + "childrenAccountId=" + childrenAccountId + "&payTemplateId=" + payTemplateId;
return requestApi(reqUrl); return requestApi(reqUrl);
} }
private CommonResult<Object> requestApi(String url) { private CommonResult<Object> requestApi(String url) {
JSONObject results;
String getResult = HttpUtil String getResult = HttpUtil
.createGet(url) .createGet(url)
.execute() .execute()
.charset("utf-8") .charset("utf-8")
.body(); .body();
JSONObject o = JSONUtil.parseObj(getResult); JSONObject o = JSONUtil.parseObj(getResult);
results = o.getJSONObject("data"); return new CommonResult<>().success(JSONUtil.toJsonStr(o));
return new CommonResult<>().success(results);
} }
} }

@ -50,20 +50,20 @@ public class AccountInfoController {
public CommonResult<Object> getParentAccount(@RequestParam(value = "sellerNick") String sellerNick, Pageable pageable) { public CommonResult<Object> getParentAccount(@RequestParam(value = "sellerNick") String sellerNick, Pageable pageable) {
return requestCore.getParentAccount(sellerNick, pageable); return requestCore.getParentAccount(sellerNick, pageable);
} }
//
// @GetMapping("/pay/template") @GetMapping("/pay/template")
// @ApiOperation("查询套餐") @ApiOperation("查询套餐")
// public CommonResult<Object> getPayTemplate() { public CommonResult<Object> getPayTemplate() {
// return aliPayClient.getPayTemplate(); return requestCore.getPayTemplate();
// } }
//
// @GetMapping("/account/authorize") @GetMapping("/account/authorize")
// @ApiOperation("对子账号授权") @ApiOperation("对子账号授权")
// public CommonResult<Object> authorizeChildrenAccount(Long childrenAccountId, Long payTemplateId) { public CommonResult<Object> authorizeChildrenAccount(Long childrenAccountId, Long payTemplateId) {
// if (childrenAccountId == DefaultNumberConstants.ZERO_NUMBER || payTemplateId == DefaultNumberConstants.ZERO_NUMBER) { if (childrenAccountId == DefaultNumberConstants.ZERO_NUMBER || payTemplateId == DefaultNumberConstants.ZERO_NUMBER) {
// return new CommonResult<>().validateFailed("参数错误"); return new CommonResult<>().validateFailed("参数错误");
// } }
// return aliPayClient.authorizeChildrenAccount(childrenAccountId, payTemplateId); return requestCore.authorizeChildrenAccount(childrenAccountId, payTemplateId);
// } }
} }

@ -71,6 +71,8 @@ public class AuthorizationController {
private final LoginProperties loginProperties; private final LoginProperties loginProperties;
private final OnlineUserService onlineUserService; private final OnlineUserService onlineUserService;
private final AuthenticationManagerBuilder authenticationManagerBuilder; private final AuthenticationManagerBuilder authenticationManagerBuilder;
@Resource
private LoginProperties loginProperties;
@ApiOperation("登录授权") @ApiOperation("登录授权")
@AnonymousPostMapping(value = "/login") @AnonymousPostMapping(value = "/login")
@ -121,7 +123,7 @@ public class AuthorizationController {
} }
@ApiOperation("退出登录") @ApiOperation("退出登录")
@AnonymousDeleteMapping(value = "/logout") @DeleteMapping(value = "/logout")
public ResponseEntity<Object> logout(HttpServletRequest request) { public ResponseEntity<Object> logout(HttpServletRequest request) {
onlineUserService.logout(tokenProvider.getToken(request)); onlineUserService.logout(tokenProvider.getToken(request));
return new ResponseEntity<>(HttpStatus.OK); return new ResponseEntity<>(HttpStatus.OK);

@ -82,12 +82,13 @@ public class SellerAccountController {
@GetMapping("/parentAccounts") @GetMapping("/parentAccounts")
@ApiOperation("分页查询主账号") @ApiOperation("分页查询主账号")
public CommonResult<Page<SellerAccount>> getParentAccount(@RequestParam("sellerNick") String sellerNick, Pageable pageable) { public CommonResult<Page<SellerAccount>> getParentAccount(@RequestParam("sellerNick") String sellerNick, Pageable pageable) {
log.info("sellerNick=={}", sellerNick);
return sellerAccountService.getParentAccount(sellerNick, pageable); return sellerAccountService.getParentAccount(sellerNick, pageable);
} }
@GetMapping("/authorize") @GetMapping("/authorize")
@ApiOperation("子账号授权") @ApiOperation("子账号授权")
public CommonResult<Object> authorizeChildrenAccount(@RequestParam("childrenAccountId")Long childrenAccountId,@RequestParam("payTemplateId") Long payTemplateId) { public CommonResult<Object> authorizeChildrenAccount(@RequestParam("childrenAccountId") Long childrenAccountId, @RequestParam("payTemplateId") Long payTemplateId) {
if (childrenAccountId == DefaultNumberConstants.ZERO_NUMBER || payTemplateId == DefaultNumberConstants.ZERO_NUMBER) { if (childrenAccountId == DefaultNumberConstants.ZERO_NUMBER || payTemplateId == DefaultNumberConstants.ZERO_NUMBER) {
return new CommonResult<>().validateFailed("参数错误"); return new CommonResult<>().validateFailed("参数错误");
} }

@ -342,18 +342,21 @@ public class SellerAccountServiceImpl implements SellerAccountService {
@Override @Override
public CommonResult<Page<SellerAccount>> getParentAccount(String sellerNick, Pageable pageable) { public CommonResult<Page<SellerAccount>> getParentAccount(String sellerNick, Pageable pageable) {
AccountSearchVo accountSearchVo = new AccountSearchVo(); AccountSearchVo accountSearchVo = new AccountSearchVo();
if (StrUtil.isNotEmpty(sellerNick)) { if (!Objects.equals(sellerNick, "") && sellerNick != null) {
accountSearchVo.setNickname(sellerNick); accountSearchVo.setNickname(sellerNick);
} }
accountSearchVo.setParentId((long) DefaultNumberConstants.ZERO_NUMBER); accountSearchVo.setParentId((long) DefaultNumberConstants.ZERO_NUMBER);
log.info("accountSearchVo ==" + accountSearchVo);
Page<SellerAccount> sellerAccounts = sellerAccountRepository.findAll( Page<SellerAccount> sellerAccounts = sellerAccountRepository.findAll(
((root, criteriaQuery, cb) -> ((root, criteriaQuery, cb) ->
QueryHelp.getPredicate(root, accountSearchVo, cb)), pageable); QueryHelp.getPredicate(root, accountSearchVo, cb)), pageable);
log.info("sellerAccounts =======" + sellerAccounts);
return new CommonResult<Page<SellerAccount>>().success( return new CommonResult<Page<SellerAccount>>().success(
PageUtil.toPage(sellerAccounts.getContent(), sellerAccounts.getTotalElements())); PageUtil.toPage(sellerAccounts.getContent(), sellerAccounts.getTotalElements()));
} }
@Override @Override
@Transactional(rollbackFor = Exception.class)
public CommonResult<Object> authorizeChildrenAccount(Long childrenAccountId, Long payTemplateId) { public CommonResult<Object> authorizeChildrenAccount(Long childrenAccountId, Long payTemplateId) {
//验证是否为子账号 //验证是否为子账号
SellerAccount sellerAccount = sellerAccountRepository.findSellerAccountById(childrenAccountId); SellerAccount sellerAccount = sellerAccountRepository.findSellerAccountById(childrenAccountId);

@ -37,10 +37,6 @@ public class BasePayTemplate implements Serializable {
@JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8") @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = DatePattern.NORM_DATETIME_PATTERN, timezone = "GMT+8")
private Date updateTime; private Date updateTime;
@Column(name = "template_code")
@ApiModelProperty("套餐code")
private String templateCode;
@Column(name = "package_name") @Column(name = "package_name")
@ApiModelProperty("套餐名") @ApiModelProperty("套餐名")
private String packageName; private String packageName;

Loading…
Cancel
Save