| | |
| | | |
| | | private void handleTransferResponse(GuideWithdrawal withdrawal, Map<String, Object> response) { |
| | | if (transactionSucceeded(response)) { |
| | | stateService.markTransferred(withdrawal.getId(), value(response, "hf_seq_id")); |
| | | stateService.markTransferred(withdrawal.getId(), value(response, "hf_seq_id", "trans_seq_id")); |
| | | submitCash(withdrawal.getId()); |
| | | return; |
| | | } |
| | |
| | | Map<String, Object> response = fenZhangUtil.queryFenzhang( |
| | | withdrawal.getTransferReqSeqId(), withdrawal.getTransferReqDate()); |
| | | if (transactionSucceeded(response)) { |
| | | stateService.markTransferred(withdrawal.getId(), value(response, "hf_seq_id")); |
| | | stateService.markTransferred(withdrawal.getId(), value(response, "hf_seq_id", "trans_seq_id")); |
| | | submitCash(withdrawal.getId()); |
| | | } else if (transactionFailed(response)) { |
| | | stateService.markTransferFailed(withdrawal.getId(), |
| | |
| | | stateService.markCashRetry(withdrawal.getId(), "导游账户取现失败:" + message(response)); |
| | | return; |
| | | } |
| | | stateService.markCashPending(withdrawal.getId(), value(response, "hf_seq_id"), |
| | | stateService.markCashPending(withdrawal.getId(), |
| | | value(response, "hf_seq_id", "trans_seq_id", "cash_hf_seq_id"), |
| | | "导游账户取现已受理:" + message(response)); |
| | | } |
| | | |
| | | private void resolveCash(GuideWithdrawal withdrawal) { |
| | | GuideWithdrawalAccount account = settlementService.requireApprovedCard( |
| | | withdrawal.getGuideId(), withdrawal.getBankCardId()); |
| | | JSONObject response = withdrawBiz.query(account.getHuifuId(), |
| | | withdrawal.getCashReqDate(), withdrawal.getCashReqSeqId()); |
| | | JSONObject response = StringUtils.hasText(withdrawal.getCashHfSeqId()) |
| | | ? withdrawBiz.query(account.getHuifuId(), withdrawal.getCashReqDate(), |
| | | withdrawal.getCashReqSeqId(), withdrawal.getCashHfSeqId()) |
| | | : withdrawBiz.query(account.getHuifuId(), withdrawal.getCashReqDate(), |
| | | withdrawal.getCashReqSeqId()); |
| | | if (transactionSucceeded(response)) { |
| | | stateService.markApproved(withdrawal.getId(), value(response, "hf_seq_id")); |
| | | stateService.markApproved(withdrawal.getId(), |
| | | value(response, "hf_seq_id", "trans_seq_id", "cash_hf_seq_id")); |
| | | } else if (transactionFailed(response)) { |
| | | stateService.markCashRetry(withdrawal.getId(), "导游账户取现失败:" + message(response)); |
| | | } else { |
| | | stateService.markCashPending(withdrawal.getId(), value(response, "hf_seq_id"), |
| | | stateService.markCashPending(withdrawal.getId(), |
| | | value(response, "hf_seq_id", "trans_seq_id", "cash_hf_seq_id"), |
| | | (businessRejected(response) ? "导游账户取现查询失败:" : "导游账户取现结果待确认:") |
| | | + message(response)); |
| | | } |
| | | } |
| | | |
| | | private boolean transactionSucceeded(Map<String, ?> response) { |
| | | String status = value(response, "trans_stat", "cash_stat", "status"); |
| | | String status = value(response, "trans_stat", "cash_stat", "cash_status", |
| | | "trans_status", "status"); |
| | | return "S".equalsIgnoreCase(status) || "SUCCESS".equalsIgnoreCase(status) |
| | | || "SUCCEEDED".equalsIgnoreCase(status); |
| | | } |
| | | |
| | | private boolean transactionFailed(Map<String, ?> response) { |
| | | String status = value(response, "trans_stat", "cash_stat", "status"); |
| | | String status = value(response, "trans_stat", "cash_stat", "cash_status", |
| | | "trans_status", "status"); |
| | | return "F".equalsIgnoreCase(status) || "FAIL".equalsIgnoreCase(status) |
| | | || "FAILED".equalsIgnoreCase(status); |
| | | } |
| | |
| | | } |
| | | Object data = response.get("data"); |
| | | if (data instanceof Map) return value((Map<String, ?>) data, keys); |
| | | if (data instanceof String && StringUtils.hasText((String) data)) { |
| | | try { |
| | | JSONObject nested = JSONObject.parseObject((String) data); |
| | | return value(nested, keys); |
| | | } catch (RuntimeException ignored) { |
| | | // 非 JSON 包装直接按字段缺失处理。 |
| | | } |
| | | } |
| | | return null; |
| | | } |
| | | } |