| | |
| | | request.sortNo() == null ? 0 : request.sortNo()); |
| | | Long id = jdbcTemplate.queryForObject("select last_insert_id()", Long.class); |
| | | ensureParkingBenefit(id, request.merchantType()); |
| | | ensureFuelBenefit(id, request.merchantType(), request.serviceLabel()); |
| | | Long storeId = createDefaultStore(id, request.merchantName(), request.address()); |
| | | syncMerchantBusinessHours(id, storeId, request.businessHours()); |
| | | if (hasMerchantAppAccess(request)) { |
| | |
| | | id); |
| | | ensureUpdated(updated); |
| | | ensureParkingBenefit(id, request.merchantType()); |
| | | ensureFuelBenefit(id, request.merchantType(), request.serviceLabel()); |
| | | Long storeId = findOrCreateDefaultStore(id, request.merchantName(), request.address()); |
| | | syncMerchantBusinessHours(id, storeId, request.businessHours()); |
| | | if (request.loginPassword() != null && !request.loginPassword().isBlank()) { |
| | |
| | | """, merchantId, merchantId); |
| | | } |
| | | |
| | | private void ensureFuelBenefit(Long merchantId, String merchantType, String serviceLabel) { |
| | | if (!"加油服务".equals(merchantType) && !"fuel".equalsIgnoreCase(merchantType)) return; |
| | | String discountText = serviceLabel == null || serviceLabel.isBlank() ? "请咨询商户" : serviceLabel.trim(); |
| | | jdbcTemplate.update(""" |
| | | insert into transport_fuel_benefit( |
| | | merchant_id, talent_levels, discount_text, oil_types, single_limit_text, annual_limit_text, |
| | | available_time, usage_instructions, rule_text, status, deleted |
| | | ) |
| | | select ?, '卓越人才卡、杰出人才卡、菁英人才卡', ?, '请咨询商户', '请咨询商户', '请咨询商户', |
| | | '请咨询商户', '提交手机号后,工作人员将根据加油权益与您联系。', |
| | | '具体适用油品、优惠额度、可用时段和活动规则以加油站说明为准。', 1, 0 |
| | | where not exists (select 1 from transport_fuel_benefit where merchant_id = ? and deleted = 0) |
| | | """, merchantId, discountText, merchantId); |
| | | } |
| | | |
| | | @Transactional |
| | | public Map<String, Object> updateMerchantStatus(Long id, Byte status) { |
| | | int updated = jdbcTemplate.update("update merchant set status = ? where deleted = 0 and id = ?", status, id); |