Commit 1f0332f0746d344ecaddb450ae5b03ff8e64b2fb
1 parent
ba0b5548
code review
Showing
1 changed file
with
34 additions
and
34 deletions
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 | +} | ... | ... |