# RevenueRateFilterConfigController.java

    package cloud.wconnect.rateshop.controller.revenue;

    import cloud.wconnect.commonlib.annotation.ApiId;
    import cloud.wconnect.commonlib.component.SessionContext;
    import cloud.wconnect.rateshop.pojo.dto.revenue.RevenueRateFilterConfigDTO;
    import cloud.wconnect.rateshop.pojo.dto.revenue.SaveRevenueRateFilterConfigDTO;
    import cloud.wconnect.rateshop.service.revenue.IRevenueRateFilterConfigService;
    import com.google.common.collect.ImmutableMap;
    import jakarta.validation.Valid;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.web.bind.annotation.*;

    import java.util.Map;

    /**
     * <p>
     *  前端控制器
     * </p>
     *
     * @author yyt
     * @since 2025-08-27
     */
    @RestController
    @RequestMapping("/revenue/rate-filter-config")
    public class RevenueRateFilterConfigController {

        @Autowired
        private IRevenueRateFilterConfigService revenueRateFilterConfigService;
        @Autowired
        private SessionContext sessionContext;

        /**
         * 1582 - 查询房价筛选配置
         *
         * @param property 资产标识
         * @return 房价筛选配置
         * @author yyt
         * @date 2025/8/27
         **/
        @ApiId(1582)
        @GetMapping
        public RevenueRateFilterConfigDTO getDTO(String property) {
            return revenueRateFilterConfigService.getDTO(sessionContext.getPropertyId(property));
        }

        /**
         * 1583 - 保存房价筛选配置
         *
         * @param property                   资产标识
         * @param revenueRateFilterConfigDTO 房价筛选配置
         * @return 选择的数据源/平台是否有效
         * @author yyt
         * @date 2025/8/27
         **/
        @ApiId(1583)
        @PostMapping
        public Map<String, Object> save(String property, @Valid @RequestBody SaveRevenueRateFilterConfigDTO revenueRateFilterConfigDTO) {
            // 检查数据源/平台，是否跟资产配置一致
            int propertyId = sessionContext.getPropertyId(property);
            if (!revenueRateFilterConfigService.checkDatasourceAndPlatform(propertyId, revenueRateFilterConfigDTO)) {
                return ImmutableMap.of("effective", false);
            }

            revenueRateFilterConfigService.save(propertyId, revenueRateFilterConfigDTO, sessionContext.getLoginUserId());
            return ImmutableMap.of("effective", true);
        }

    }