package com.talentcard.server.business.portal;
|
|
import java.util.Map;
|
|
import com.talentcard.server.business.PageResult;
|
import com.talentcard.server.common.ApiResponse;
|
import io.swagger.v3.oas.annotations.Operation;
|
import io.swagger.v3.oas.annotations.Parameter;
|
import io.swagger.v3.oas.annotations.tags.Tag;
|
import jakarta.validation.Valid;
|
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.RequestBody;
|
import org.springframework.web.bind.annotation.RequestHeader;
|
import org.springframework.web.bind.annotation.RequestMapping;
|
import org.springframework.web.bind.annotation.RestController;
|
|
@Tag(name = "App-停车服务商", description = "停车服务商详情、停车场和车牌登记接口")
|
@RestController
|
@RequestMapping("/api/app/parking-merchants")
|
public class ParkingMerchantPortalController {
|
private final ParkingMerchantPortalService service;
|
|
public ParkingMerchantPortalController(ParkingMerchantPortalService service) {
|
this.service = service;
|
}
|
|
@Operation(summary = "停车服务商详情", description = "返回停车服务商基础信息、停车场位置和人才权益配置")
|
@GetMapping("/{merchantId}")
|
public ApiResponse<Map<String, Object>> detail(
|
@Parameter(description = "停车服务商ID") @PathVariable Long merchantId,
|
@Parameter(description = "人才卡ID;用于匹配对应人才卡等级的权益配置") @RequestParam(required = false) Long talentCardId
|
) {
|
return ApiResponse.success(service.detail(merchantId, talentCardId));
|
}
|
|
@GetMapping("/{merchantId}/parking-lots")
|
public ApiResponse<PageResult<Map<String, Object>>> parkingLots(
|
@PathVariable Long merchantId,
|
@org.springframework.web.bind.annotation.RequestParam(required = false) String keyword,
|
@org.springframework.web.bind.annotation.RequestParam(defaultValue = "1") int page,
|
@org.springframework.web.bind.annotation.RequestParam(defaultValue = "10") int size
|
) {
|
return ApiResponse.success(service.parkingLots(merchantId, keyword, page, size));
|
}
|
|
@PostMapping("/{merchantId}/registrations")
|
public ApiResponse<Map<String, Object>> registerPlate(
|
@PathVariable Long merchantId,
|
@Valid @RequestBody ParkingPlateRegistrationRequest request,
|
@RequestHeader(value = "X-Idempotency-Key", required = false) String idempotencyKey
|
) {
|
return ApiResponse.success(service.registerPlate(merchantId, request, idempotencyKey));
|
}
|
}
|