提交 c69ec67a 作者: 张小凤

Auth(update)

上级 d8e2aa8b
...@@ -403,6 +403,7 @@ public enum ResultEnum implements BaseErrorInfoInterface { ...@@ -403,6 +403,7 @@ public enum ResultEnum implements BaseErrorInfoInterface {
FAILED_TO_CHARGE_MONEY("2015", "只有后台账号才能给小程序客户端充值"), FAILED_TO_CHARGE_MONEY("2015", "只有后台账号才能给小程序客户端充值"),
NO_WALLET_FUNCTION("2016", "后台账号无钱包功能"), NO_WALLET_FUNCTION("2016", "后台账号无钱包功能"),
THE_ORDER_HAS_BEEN_PAID("2017", "订单已支付/订单编号错误"), THE_ORDER_HAS_BEEN_PAID("2017", "订单已支付/订单编号错误"),
THE_CURRENT_AMOUNT_IS_INSUFFICIENT("2019", "当前余额不足,请充值再支付"),
THE_TOKEN_CANNOT_BE_NULL("2018", "token不能为null"); THE_TOKEN_CANNOT_BE_NULL("2018", "token不能为null");
/** /**
......
...@@ -133,6 +133,14 @@ public class RepoCashController extends BaseController { ...@@ -133,6 +133,14 @@ public class RepoCashController extends BaseController {
} }
@ApiOperation(value = "通过用户获取用户钱包")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = RepoCashDTO.class)})
@GetMapping("userWallet")
public ResultBody<RepoWalletDTO> userWallet(HttpServletRequest request) {
return repoCashService.userWallet(this.getCurrentAccount(request));
}
@ApiOperation(value = "退款金额---用户后台内部调用前端不使用") @ApiOperation(value = "退款金额---用户后台内部调用前端不使用")
@ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)}) @ApiResponses({@ApiResponse(code = 200, message = "OK", response = ResultBody.class)})
@GetMapping("amountOfRefund") @GetMapping("amountOfRefund")
......
...@@ -47,4 +47,6 @@ public interface RepoCashDao { ...@@ -47,4 +47,6 @@ public interface RepoCashDao {
Integer findWalletUsers(WalletUsersQO properties); Integer findWalletUsers(WalletUsersQO properties);
List<CashTypeDO> cashType(); List<CashTypeDO> cashType();
RepoWalletDO userWallet(Integer userAccountId);
} }
...@@ -354,15 +354,19 @@ public class RepoCashServiceImpl implements RepoCashService { ...@@ -354,15 +354,19 @@ public class RepoCashServiceImpl implements RepoCashService {
if (wallet == null) { if (wallet == null) {
return ResultBody.error(ResultEnum.WALLET_NOT_FIND_ERROR); return ResultBody.error(ResultEnum.WALLET_NOT_FIND_ERROR);
} }
if (!currentAccount.getUserAccountId().equals(currentAccount.getUserAccountId())) {
return ResultBody.error(ResultEnum.WALLET_NOT_FIND_ERROR);
}
if (wallet.getCashAmt().compareTo(actualPay) == -1) {
return ResultBody.error(ResultEnum.THE_CURRENT_AMOUNT_IS_INSUFFICIENT);
}
BigDecimal newCashAmt = BigDecimal newCashAmt =
(wallet.getCashAmt().add(negate)).setScale(2, BigDecimal.ROUND_DOWN); (wallet.getCashAmt().add(negate)).setScale(2, BigDecimal.ROUND_DOWN);
repoCashDO.setAmtPaid(negate); repoCashDO.setAmtPaid(negate);
repoCashDO.setCashAmt(newCashAmt); repoCashDO.setCashAmt(newCashAmt);
repoCashDao.orderPayment(repoCashDO); repoCashDao.orderPayment(repoCashDO);
repoCashDao.updateRepoWalletAmt(currentAccount.getUserAccountId(), negate); repoCashDao.updateRepoWalletAmt(currentAccount.getUserAccountId(), negate);
if (!currentAccount.getUserAccountId().equals(currentAccount.getUserAccountId())) {
return ResultBody.error(ResultEnum.WALLET_NOT_FIND_ERROR);
}
orderStatusChanges(currentAccount.getToken(), orderNo); orderStatusChanges(currentAccount.getToken(), orderNo);
return ResultBody.success(); return ResultBody.success();
} }
...@@ -517,6 +521,16 @@ public class RepoCashServiceImpl implements RepoCashService { ...@@ -517,6 +521,16 @@ public class RepoCashServiceImpl implements RepoCashService {
return ResultBody.success(collect); return ResultBody.success(collect);
} }
@Override
public ResultBody userWallet(BaseAccountDTO currentAccount) {
RepoWalletDO repoWalletDO = repoCashDao.userWallet(currentAccount.getUserAccountId());
if (null == repoWalletDO) {
return ResultBody.error("当前账号没有钱包");
}
RepoWalletDTO repoWalletDTO = repoWalletDO.buildRepoWalletDTO();
return ResultBody.success(repoWalletDTO);
}
public List<RepoWalletDTO> listWalletInfo(UserCashQO param) { public List<RepoWalletDTO> listWalletInfo(UserCashQO param) {
if (CollectionUtils.isEmpty(param.getAccountIds())) { if (CollectionUtils.isEmpty(param.getAccountIds())) {
......
...@@ -49,4 +49,6 @@ public interface RepoCashService { ...@@ -49,4 +49,6 @@ public interface RepoCashService {
ResultBody walletUsers(WalletUsersVO walletUsersVO); ResultBody walletUsers(WalletUsersVO walletUsersVO);
ResultBody cashType(); ResultBody cashType();
ResultBody userWallet(BaseAccountDTO currentAccount);
} }
...@@ -251,4 +251,20 @@ ...@@ -251,4 +251,20 @@
select id, `type` select id, `type`
from cash_type from cash_type
</select> </select>
<select id="userWallet" resultType="com.mmc.payment.entity.repo.RepoWalletDO">
SELECT id,
repo_account_id AS repoAccountId,
cash_amt AS cashAmt,
cash_paid AS cashPaid,
cash_paid,
cash_freeze AS cashFreeze,
remark,
rcd_rebate_amt AS rcdRebateAmt,
rebate_wdl AS rebateWdl,
rebate_freeze AS rebateFreeze,
update_time AS updateTime,
create_time AS createTime
FROM repo_wallet
where repo_account_id = #{userAccountId}
</select>
</mapper> </mapper>
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论