| | |
| | | return page("select a.*, m.merchant_name, m.merchant_type, m.contact_mobile, s.store_name from merchant_onboarding_application a join merchant m on m.id = a.merchant_id join merchant_store s on s.id = a.store_id", "select count(*) from merchant_onboarding_application a join merchant m on m.id = a.merchant_id join merchant_store s on s.id = a.store_id", "a", page, size, merchantName, contactMobile, merchantType, status, startDate, endDate); |
| | | } |
| | | @Transactional(readOnly = true) |
| | | public Map<String, Object> onboarding(Long id) { |
| | | List<Map<String, Object>> rows = rows("select a.*, m.merchant_name, m.merchant_type, m.contact_mobile, s.store_name from merchant_onboarding_application a join merchant m on m.id = a.merchant_id join merchant_store s on s.id = a.store_id where a.id = ?", id); |
| | | if (rows.isEmpty()) throw new BusinessException(ErrorCode.NOT_FOUND, "商户进件不存在"); |
| | | return rows.get(0); |
| | | } |
| | | @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) { |
| | | return 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); |
| | | 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")))); |
| | | return result; |
| | | } |
| | | @Transactional(readOnly = true) |
| | | public PageResult<Map<String, Object>> withdrawals(int page, int size, String merchantName, String contactMobile, String merchantType, String status, String startDate, String endDate) { |
| | |
| | | private void addLike(StringBuilder where, List<Object> args, String column, String value) { if (value != null && !value.trim().isEmpty()) { where.append(" and ").append(column).append(" like ?"); args.add("%" + value.trim() + "%"); } } |
| | | private void addEqual(StringBuilder where, List<Object> args, String column, String value) { if (value != null && !value.trim().isEmpty()) { where.append(" and ").append(column).append(" = ?"); args.add(value.trim()); } } |
| | | private void addDate(StringBuilder where, List<Object> args, String column, String value, boolean start) { if (value != null && value.matches("\\d{4}-\\d{2}-\\d{2}")) { where.append(" and ").append(column).append(start ? " >= ?" : " < date_add(?, interval 1 day)"); args.add(value); } } |
| | | private String bankCardCityName(Object cityCode) { |
| | | return switch (cityCode == null ? "" : String.valueOf(cityCode).trim()) { |
| | | case "510100" -> "四川省|成都市"; |
| | | case "510300" -> "四川省|自贡市"; |
| | | case "510400" -> "四川省|攀枝花市"; |
| | | case "510500" -> "四川省|泸州市"; |
| | | case "510600" -> "四川省|德阳市"; |
| | | case "510700" -> "四川省|绵阳市"; |
| | | case "510800" -> "四川省|广元市"; |
| | | case "510900" -> "四川省|遂宁市"; |
| | | case "511000" -> "四川省|内江市"; |
| | | case "511100" -> "四川省|乐山市"; |
| | | case "511300" -> "四川省|南充市"; |
| | | case "511400" -> "四川省|眉山市"; |
| | | case "511500" -> "四川省|宜宾市"; |
| | | case "511600" -> "四川省|广安市"; |
| | | case "511700" -> "四川省|达州市"; |
| | | case "511800" -> "四川省|雅安市"; |
| | | case "511900" -> "四川省|巴中市"; |
| | | case "512000" -> "四川省|资阳市"; |
| | | case "513200" -> "四川省|阿坝藏族羌族自治州"; |
| | | case "513300" -> "四川省|甘孜藏族自治州"; |
| | | case "513400" -> "四川省|凉山彝族自治州"; |
| | | default -> cityCode == null ? "" : String.valueOf(cityCode).trim(); |
| | | }; |
| | | } |
| | | private Map<String, Object> update(String table, Long id, String status, String reason, String label) { |
| | | String value = status == null ? "" : status.trim().toLowerCase(); |
| | | if (!List.of("approved", "rejected", "paid", "failed").contains(value)) throw new BusinessException(ErrorCode.BAD_REQUEST, "审核状态无效"); |