# HotelKpiConfigController.java

    package cloud.wconnect.workperformance.controller.hotelkpi;

    import cloud.wconnect.commonlib.annotation.ApiId;
    import cloud.wconnect.commonlib.component.SessionContext;
    import cloud.wconnect.workperformance.pojo.dto.hotelkpi.kpiv2.HotelKpiMonthlyReportFieldConfigDTO;
    import cloud.wconnect.workperformance.service.hotelkpi.IHotelKpiMonthlyReportFieldConfigService;
    import jakarta.annotation.Resource;
    import jakarta.validation.Valid;
    import org.springframework.web.bind.annotation.*;

    import java.util.Collections;
    import java.util.Map;

    /**
     * <p>
     * Hotel KPI Config 前端控制器
     * </p>
     *
     * @author zc
     * @since 2025-08-26
     */
    @RestController
    @RequestMapping("/hotel-kpi")
    public class HotelKpiConfigController {

        @Resource
        private IHotelKpiMonthlyReportFieldConfigService monthlyReportFieldConfigService;
        @Resource
        private SessionContext sessionContext;

        /**
         * 获取 Monthly Report 字段映射配置
         *
         * @param property 资产标识
         * @return HotelKpiMonthlyReportFieldConfigDTO
         * @author zc
         * @date 2025/8/26
         */
        @ApiId(1580)
        @GetMapping("/monthly-report-field-config")
        public HotelKpiMonthlyReportFieldConfigDTO getMonthlyReportFieldConfig(@RequestParam String property) {
            int propertyId = sessionContext.getPropertyId(property);
            return monthlyReportFieldConfigService.get(propertyId);
        }

        /**
         * 保存 Monthly Report 字段映射配置
         *
         * @param property 资产标识
         * @return HotelKpiMonthlyReportFieldConfigDTO
         * @author zc
         * @date 2025/8/26
         */
        @ApiId(1581)
        @PostMapping("/monthly-report-field-config")
        public Map<Object, Object> saveMonthlyReportFieldConfig(@RequestParam String property,
                                                                @RequestBody @Valid HotelKpiMonthlyReportFieldConfigDTO saveDTO) {
            int propertyId = sessionContext.getPropertyId(property);
            monthlyReportFieldConfigService.save(propertyId, saveDTO, sessionContext.getLoginUserId());
            return Collections.emptyMap();
        }
    }