|
@@ -55,6 +55,9 @@ public class WithdrawRecordApiController {
|
|
@Resource
|
|
@Resource
|
|
private AuthService authService;
|
|
private AuthService authService;
|
|
|
|
|
|
|
|
+ @Resource
|
|
|
|
+ private AccountService accountService;
|
|
|
|
+
|
|
@Resource
|
|
@Resource
|
|
private BizLogService bizLogService;
|
|
private BizLogService bizLogService;
|
|
|
|
|
|
@@ -106,6 +109,14 @@ public class WithdrawRecordApiController {
|
|
String rate = openRedEnvelopeRate.getData().getValueInfo();
|
|
String rate = openRedEnvelopeRate.getData().getValueInfo();
|
|
BigDecimal fee = param.getAmount().multiply(new BigDecimal(rate)).divide(BigDecimal.valueOf(100),2, RoundingMode.DOWN);
|
|
BigDecimal fee = param.getAmount().multiply(new BigDecimal(rate)).divide(BigDecimal.valueOf(100),2, RoundingMode.DOWN);
|
|
|
|
|
|
|
|
+ Account account = accountService.getAccount(userId, param.getAccountType());
|
|
|
|
+ if (account == null){
|
|
|
|
+ return ResultGenerator.genFailResult(ResultCode.ACCOUNT_IS_NULL);
|
|
|
|
+ }
|
|
|
|
+ if (account.getEffectiveBalance().compareTo(param.getAmount().add(fee)) <0) {
|
|
|
|
+ return ResultGenerator.genFailResult(ResultCode.EFFECTIVE_BALANCE_IS_INSUFFICIENT);
|
|
|
|
+ }
|
|
|
|
+
|
|
String orderNo = sequenceService.genSerialNumber("withdraw_rule",null);
|
|
String orderNo = sequenceService.genSerialNumber("withdraw_rule",null);
|
|
|
|
|
|
WithdrawRecord withdrawRecord = new WithdrawRecord();
|
|
WithdrawRecord withdrawRecord = new WithdrawRecord();
|
|
@@ -187,7 +198,7 @@ public class WithdrawRecordApiController {
|
|
|
|
|
|
@GetMapping("/callback")
|
|
@GetMapping("/callback")
|
|
@ApiOperation(value = "三方回调",httpMethod = "GET")
|
|
@ApiOperation(value = "三方回调",httpMethod = "GET")
|
|
- public Result<RechargeRecord> detail(@RequestParam String data) {
|
|
|
|
|
|
+ public Result<RechargeRecord> callback(@RequestParam String data) {
|
|
//TODO 回调成功
|
|
//TODO 回调成功
|
|
JSONObject json = JSONUtil.parseObj(data);
|
|
JSONObject json = JSONUtil.parseObj(data);
|
|
String orderNo = json.getStr("orderNo");
|
|
String orderNo = json.getStr("orderNo");
|