提交 80b5a91f authored 作者: huyufan's avatar huyufan

Merge remote-tracking branch 'origin/v6.5_transport_open_20231115' into test

package com.clx.performance.controller.app; package com.clx.performance.controller.app;
import com.clx.performance.service.settle.NetworkDriverAccountService;
import com.clx.user.feign.PaymentServiceFeign; import com.clx.user.feign.PaymentServiceFeign;
import com.clx.user.vo.feign.WalletResidueCardVO; import com.clx.user.vo.feign.WalletResidueCardVO;
import com.msl.common.convertor.aspect.UnitCovert; import com.msl.common.convertor.aspect.UnitCovert;
...@@ -23,17 +24,15 @@ import org.springframework.web.bind.annotation.RestController; ...@@ -23,17 +24,15 @@ import org.springframework.web.bind.annotation.RestController;
@Api(tags = "APP-司机资金管理") @Api(tags = "APP-司机资金管理")
public class AppDriverAccountController { public class AppDriverAccountController {
private final NetworkDriverAccountService networkDriverAccountService;
private final PaymentServiceFeign paymentServiceFeign;
@ApiOperation(value = "APP司机账户", notes = "<br>By:胡宇帆") @ApiOperation(value = "APP司机账户", notes = "<br>By:胡宇帆")
@PostMapping("/account") @PostMapping("/account")
@UnitCovert(param = false) @UnitCovert(param = false)
public Result<Object> account(@RequestParam(value = "userCode") Integer userCode) { public Result<WalletResidueCardVO> account(@RequestParam(value = "userCode") Integer userCode) {
Long userNo = TokenUtil.getLoginUserInfo().getUserNo(); WalletResidueCardVO walletResidueCardVO = networkDriverAccountService.account(userCode);
Result<WalletResidueCardVO> wallet = paymentServiceFeign.getWallet(userCode); return Result.ok(walletResidueCardVO);
return Result.ok(wallet);
} }
} }
...@@ -10,7 +10,12 @@ import com.clx.performance.param.pc.PageNetworkAccountListParam; ...@@ -10,7 +10,12 @@ import com.clx.performance.param.pc.PageNetworkAccountListParam;
import com.clx.performance.param.pc.driver.NetworkDriverAccountParam; import com.clx.performance.param.pc.driver.NetworkDriverAccountParam;
import com.clx.performance.service.settle.NetworkDriverAccountService; import com.clx.performance.service.settle.NetworkDriverAccountService;
import com.clx.performance.vo.pc.NetworkDriverAccountVO; import com.clx.performance.vo.pc.NetworkDriverAccountVO;
import com.clx.user.feign.PaymentServiceFeign;
import com.clx.user.vo.feign.WalletResidueCardVO;
import com.msl.common.base.Optional; import com.msl.common.base.Optional;
import com.msl.common.result.Result;
import com.msl.user.data.UserSessionData;
import com.msl.user.utils.TokenUtil;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -31,6 +36,8 @@ public class NetworkDriverAccountServiceImpl implements NetworkDriverAccountServ ...@@ -31,6 +36,8 @@ public class NetworkDriverAccountServiceImpl implements NetworkDriverAccountServ
private final IdGenerateSnowFlake idGenerateSnowFlake; private final IdGenerateSnowFlake idGenerateSnowFlake;
private final PaymentServiceFeign paymentServiceFeign;
@Override @Override
public IPage<NetworkDriverAccountVO> networkAccountList(PageNetworkAccountListParam param) { public IPage<NetworkDriverAccountVO> networkAccountList(PageNetworkAccountListParam param) {
return networkDriverAccountDao.networkAccountList(param); return networkDriverAccountDao.networkAccountList(param);
...@@ -55,4 +62,19 @@ public class NetworkDriverAccountServiceImpl implements NetworkDriverAccountServ ...@@ -55,4 +62,19 @@ public class NetworkDriverAccountServiceImpl implements NetworkDriverAccountServ
.walletCode(walletCode).build(); .walletCode(walletCode).build();
networkDriverAccountDao.saveEntity(entity); networkDriverAccountDao.saveEntity(entity);
} }
@Override
public WalletResidueCardVO account(Integer userCode) {
UserSessionData loginUserInfo = TokenUtil.getLoginUserInfo();
Result<WalletResidueCardVO> result = paymentServiceFeign.getWallet(userCode);
WalletResidueCardVO data = result.getData();
NetworkDriverAccount account = networkDriverAccountDao.getOneByField(NetworkDriverAccount::getDriverUserNo, loginUserInfo.getUserNo()).get();
data.setAssetSum(data.getAssetSum().add(account.getAccountBalance().movePointLeft(2)));
data.setFrozen(new BigDecimal(data.getFrozen()).add(account.getFrozenBalance().movePointLeft(2)).longValue());
data.setResidue(new BigDecimal(data.getResidue()).add(account.getUsableBalance().movePointLeft(2)).longValue());
return data;
}
} }
...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage; ...@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.clx.performance.param.pc.PageNetworkAccountListParam; import com.clx.performance.param.pc.PageNetworkAccountListParam;
import com.clx.performance.param.pc.driver.NetworkDriverAccountParam; import com.clx.performance.param.pc.driver.NetworkDriverAccountParam;
import com.clx.performance.vo.pc.NetworkDriverAccountVO; import com.clx.performance.vo.pc.NetworkDriverAccountVO;
import com.clx.user.vo.feign.WalletResidueCardVO;
/** /**
* @author kavin * @author kavin
...@@ -15,4 +16,6 @@ public interface NetworkDriverAccountService { ...@@ -15,4 +16,6 @@ public interface NetworkDriverAccountService {
IPage<NetworkDriverAccountVO> networkAccountList(PageNetworkAccountListParam param); IPage<NetworkDriverAccountVO> networkAccountList(PageNetworkAccountListParam param);
void createNetworkDriverAccount(NetworkDriverAccountParam param); void createNetworkDriverAccount(NetworkDriverAccountParam param);
WalletResidueCardVO account(Integer userCode);
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论