| | |
| | | Map<String, Object> merchant = one(""" |
| | | select id, merchant_name, contact_mobile, address, cover_url, service_label, rights_text, merchant_rights_config, status |
| | | from merchant |
| | | where id = ? and merchant_type in ('carWash', '自主洗车', '自助洗车') and deleted = 0 |
| | | where id = ? and merchant_type_code = 'carWash' and deleted = 0 |
| | | """, merchantId); |
| | | Map<String, Object> service = one(""" |
| | | List<Map<String, Object>> serviceRows = query(""" |
| | | select id, talent_levels, service_point_text, tip_text, external_link_type, |
| | | external_mini_program_app_id, external_mini_program_path, external_web_url, |
| | | unavailable_reason, status |
| | |
| | | where merchant_id = ? and deleted = 0 |
| | | order by id asc limit 1 |
| | | """, merchantId); |
| | | Map<String, Object> service = serviceRows.isEmpty() ? Map.of() : serviceRows.get(0); |
| | | String cardLevel = talentCardId == null ? "" : talentCardLevel(talentCardId); |
| | | List<Map<String, Object>> rights = parseList(merchant.get("merchantRightsConfig")); |
| | | Map<String, Object> right = matchingRight(rights, cardLevel); |
| | | boolean hasCardRightsConfig = !rights.isEmpty() && !cardLevel.isBlank(); |
| | | boolean available = number(merchant.get("status")) == 1 |
| | | && number(service.get("status")) == 1 |
| | | && (serviceRows.isEmpty() || number(service.get("status")) == 1) |
| | | && (!hasCardRightsConfig || right != null) |
| | | && (right == null || booleanValue(right.get("enabled"))); |
| | | Map<String, Object> result = new LinkedHashMap<>(); |
| | |
| | | String consumeDesc = text(right.get("consumeDesc"), ""); |
| | | if (!consumeDesc.isBlank()) return consumeDesc; |
| | | } |
| | | return text(service.get("tipText"), "请按现场指引操作"); |
| | | return text(service.get("tipText"), "到店后按现场指引操作,可直接享受洗车权益。"); |
| | | } |
| | | |
| | | private String rightsText(Map<String, Object> merchant, Map<String, Object> right, Map<String, Object> service) { |