fix(admin): 支持完整展示银行卡号 (bug #24230)
| | |
| | | @Transactional(readOnly = true) |
| | | public PageResult<Map<String, Object>> bankCards(int page, int size, String merchantName, String contactMobile, String merchantType, String status, String startDate, String endDate) { |
| | | PageResult<Map<String, Object>> result = page("select c.*, m.merchant_name, m.merchant_type, m.contact_mobile, s.store_name from merchant_bank_card c join merchant m on m.id = c.merchant_id join merchant_store s on s.id = c.store_id", "select count(*) from merchant_bank_card c join merchant m on m.id = c.merchant_id join merchant_store s on s.id = c.store_id", "c", page, size, merchantName, contactMobile, merchantType, status, startDate, endDate); |
| | | result.records().forEach(row -> row.put("cityName", bankCardCityName(row.get("cityCode")))); |
| | | result.records().forEach(row -> { |
| | | String encrypted = String.valueOf(row.remove("cardNoEncrypted")); |
| | | if (!encrypted.isBlank() && !"null".equals(encrypted)) row.put("cardMasked", sensitiveDataCrypto.decrypt(encrypted)); |
| | | row.put("cityName", bankCardCityName(row.get("cityCode"))); |
| | | }); |
| | | return result; |
| | | } |
| | | @Transactional(readOnly = true) |
| | |
| | | if (!same.isEmpty()) { |
| | | Map<String, Object> existing = same.get(0); |
| | | if (!"rejected".equals(clean(existing.get("status")))) return bankCard(existing); |
| | | jdbc.update("update merchant_bank_card set status='pending', reject_reason=null, provider_token_no=null, provider_apply_no=null, provider_request_no=null, provider_response_code=null, provider_response_message=null where id=?", existing.get("id")); |
| | | jdbc.update("update merchant_bank_card set status='pending', card_no_encrypted=?, reject_reason=null, provider_token_no=null, provider_apply_no=null, provider_request_no=null, provider_response_code=null, provider_response_message=null where id=?", sensitiveDataCrypto.encrypt(number), existing.get("id")); |
| | | submitBankCardToHuifu(principal, existing, number, branch); |
| | | return bankCard(rows("select * from merchant_bank_card where id = ?", existing.get("id")).get(0)); |
| | | } |
| | | jdbc.update("insert into merchant_bank_card(merchant_id, store_id, bank_name, branch_name, branch_code, city_code, card_tail, card_masked, card_hash, idempotency_key) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", principal.merchantId(), principal.storeId(), clean(branch.get("bankName")), clean(branch.get("branchName")), clean(branch.get("clearingCode")), request.cityCode().trim(), number.substring(number.length() - 4), "**** **** **** " + number.substring(number.length() - 4), hash, key.trim()); |
| | | jdbc.update("insert into merchant_bank_card(merchant_id, store_id, bank_name, branch_name, branch_code, city_code, card_tail, card_masked, card_hash, card_no_encrypted, idempotency_key) values (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", principal.merchantId(), principal.storeId(), clean(branch.get("bankName")), clean(branch.get("branchName")), clean(branch.get("clearingCode")), request.cityCode().trim(), number.substring(number.length() - 4), "**** **** **** " + number.substring(number.length() - 4), hash, sensitiveDataCrypto.encrypt(number), key.trim()); |
| | | Map<String, Object> card = rows("select * from merchant_bank_card where merchant_id = ? and card_hash = ?", principal.merchantId(), hash).get(0); |
| | | submitBankCardToHuifu(principal, card, number, branch); |
| | | return bankCard(rows("select * from merchant_bank_card where id = ?", card.get("id")).get(0)); |
| New file |
| | |
| | | alter table merchant_bank_card |
| | | add column card_no_encrypted varchar(1024) default null after card_hash; |