Commit 12b6f34e7aeca1fecf2925f4721e31a43eac8ea3

Authored by zhangxing
2 parents 5d444814 b3d92023
src/main/java/com/diligrp/xtrade/order/rpc/feign/AccountResolver.java
1   -package com.diligrp.xtrade.order.rpc.feign;
2   -
3   -import javax.annotation.Resource;
4   -
5   -import org.springframework.http.HttpStatus;
6   -import org.springframework.stereotype.Component;
7   -
8   -import com.diligrp.xtrade.order.domain.dto.AccountDto;
9   -import com.diligrp.xtrade.order.exception.OrderException;
10   -import com.diligrp.xtrade.shared.domain.Message;
11   -
12   -/**
13   - * @ClassName: AccountResolver
14   - * @Description 远程卡务调用解析
15   - * @author zhangxing
16   - * @date 2020年4月22日
17   - */
18   -@Component
19   -public class AccountResolver {
20   -
21   - @Resource
22   - private AccountRPC accountRPC;
23   -
24   - /**
25   - * 根据id获取账户信息
26   - */
27   - public AccountDto getAccount(Long accountId) {
28   - Message<AccountDto> message = accountRPC.getDltAccount(accountId);
29   - if (!HttpStatus.OK.equals(message.getCode())) {
30   - throw new OrderException(message.getMessage());
31   - }
32   - return message.getData();
33   - }
34   -}
  1 +package com.diligrp.xtrade.order.rpc.feign;
  2 +
  3 +import javax.annotation.Resource;
  4 +
  5 +import org.springframework.http.HttpStatus;
  6 +import org.springframework.stereotype.Component;
  7 +
  8 +import com.diligrp.xtrade.order.domain.dto.AccountDto;
  9 +import com.diligrp.xtrade.order.exception.OrderException;
  10 +import com.diligrp.xtrade.shared.domain.Message;
  11 +
  12 +/**
  13 + * @ClassName: AccountResolver
  14 + * @Description 远程卡务调用解析
  15 + * @author zhangxing
  16 + * @date 2020年4月22日
  17 + */
  18 +@Component
  19 +public class AccountResolver {
  20 +
  21 + @Resource
  22 + private AccountRPC accountRPC;
  23 +
  24 + /**
  25 + * 根据id获取账户信息
  26 + */
  27 + public AccountDto getAccount(Long accountId) {
  28 + Message<AccountDto> message = accountRPC.getDltAccount(accountId);
  29 + if (HttpStatus.OK.value() != message.getCode()) {
  30 + throw new OrderException(message.getMessage());
  31 + }
  32 + return message.getData();
  33 + }
  34 +}
... ...