| | |
| | | primaryCardId = longValue(primary, "primaryCardId"); |
| | | cardLevel = text(primary, "cardLevel"); |
| | | } |
| | | List<String> files = request.proofFiles().stream().map(this::clean).filter(v -> !v.isBlank()).distinct().toList(); |
| | | if (files.isEmpty()) throw new BusinessException(ErrorCode.BAD_REQUEST, "请上传洗车凭证或消费截图"); |
| | | List<String> files = request.proofFiles() == null ? List.of() : request.proofFiles().stream().map(this::clean).filter(v -> !v.isBlank()).distinct().toList(); |
| | | for (String file : files) { |
| | | if (!(file.startsWith("/uploads/") || file.startsWith("https://"))) { |
| | | throw new BusinessException(ErrorCode.BAD_REQUEST, "凭证文件地址不正确"); |
| | |
| | | } |
| | | |
| | | private void requireMerchant(Long merchantId) { |
| | | if (merchantId == null || merchantId <= 0 || number(configMapper.countCarWashMerchant(merchantId)).longValue() == 0) throw new BusinessException(ErrorCode.NOT_FOUND, "洗车商家不存在"); |
| | | if (merchantId == null || merchantId <= 0 || number(configMapper.countCarWashMerchant(merchantId)).longValue() == 0) |
| | | throw new BusinessException(ErrorCode.NOT_FOUND, "洗车商家不存在"); |
| | | } |
| | | private void validateStatus(Integer status) { if (status != null && (status < 0 || status > 3)) throw new BusinessException(ErrorCode.BAD_REQUEST, "洗车凭证状态不正确"); } |
| | | private Number number(Object value) { return value instanceof Number number ? number : 0L; } |