package com.dsk.web.controller.search.controller;

import com.alibaba.fastjson2.JSONObject;
import com.dsk.common.core.domain.AjaxResult;
import com.dsk.common.dtos.ComposeQueryDto;
import com.dsk.system.searchService.BusinessOpportunityRadarService;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


/**
 * 商机雷达 查询接口
 * @author Administrator
 *
 */
@RequestMapping("/radar")
@RestController
public class BusinessOpportunityRadarController {


    @Resource
    BusinessOpportunityRadarService opportunityRadarService;

    /*
     * 公招标讯
     */
    @RequestMapping("/jskBidPage")
    public AjaxResult jskBidPage(@RequestBody JSONObject object) {
        ComposeQueryDto compose = JSONObject.parseObject(object.toJSONString(), ComposeQueryDto.class);
        if (PageQueryLimit.pageLimit(compose.getPage())){
            return AjaxResult.error("翻页已达到上限");
        }
        return opportunityRadarService.jskBidPage(object);
    }

    /*
     * 土地交易
     */
    @RequestMapping("/landMarketPage")
    public AjaxResult landMarketPage(@RequestBody JSONObject object) {
        ComposeQueryDto compose = JSONObject.parseObject(object.toJSONString(), ComposeQueryDto.class);
        if (PageQueryLimit.pageLimit(compose.getPage())){
            return AjaxResult.error("翻页已达到上限");
        }
        return opportunityRadarService.landMarketPage(object);
    }

    /*
     * 拟建项目
     */
    @RequestMapping("/establishmentPage")
    public AjaxResult establishmentPage(@RequestBody JSONObject object) {
        ComposeQueryDto compose = JSONObject.parseObject(object.toJSONString(), ComposeQueryDto.class);
        if (PageQueryLimit.pageLimit(compose.getPage())){
            return AjaxResult.error("翻页已达到上限");
        }
        return opportunityRadarService.establishmentPage(object);
    }

    /*
     * 开标记录
     */
    @RequestMapping("/jskBidTenderPage")
    public AjaxResult jskBidTenderPage(@RequestBody JSONObject object) {
        ComposeQueryDto compose = JSONObject.parseObject(object.toJSONString(), ComposeQueryDto.class);
        if (PageQueryLimit.pageLimit(compose.getPage())){
            return AjaxResult.error("翻页已达到上限");
        }
        return opportunityRadarService.jskBidTenderPage(object);
    }


    /*
     * 标讯pro
     */
    @RequestMapping("/jskBidNewsPage")
    public AjaxResult jskBidNewsPage(@RequestBody JSONObject object) {
        ComposeQueryDto compose = JSONObject.parseObject(object.toJSONString(), ComposeQueryDto.class);
        if (PageQueryLimit.pageLimit(compose.getPage())){
            return AjaxResult.error("翻页已达到上限");
        }
        return opportunityRadarService.jskBidNewsPage(object);
    }

    /*
     * 标讯pro   商机项目关联查询
     */
    @RequestMapping("/jskBidNewsPage/findByName")
    public AjaxResult findByName(@RequestBody JSONObject object) {
        ComposeQueryDto compose = JSONObject.parseObject(object.toJSONString(), ComposeQueryDto.class);
        if (PageQueryLimit.pageLimit(compose.getPage())){
            return AjaxResult.error("翻页已达到上限");
        }
        return opportunityRadarService.findByName(object);
    }


    /*
     * 专项债查询
     */
    @RequestMapping("/bondProjectPage")
    public AjaxResult bondProjectPage(@RequestBody JSONObject object) {
        ComposeQueryDto compose = JSONObject.parseObject(object.toJSONString(), ComposeQueryDto.class);
        if (PageQueryLimit.pageLimit(compose.getPage())){
            return AjaxResult.error("翻页已达到上限");
        }
        return opportunityRadarService.bondProjectPage(object);
    }

    /*
     * 投标计划查询
     */
    @RequestMapping("/jskBidPlanPage")
    public AjaxResult jskBidPlanPage(@RequestBody JSONObject object) {
        ComposeQueryDto compose = JSONObject.parseObject(object.toJSONString(), ComposeQueryDto.class);
        if (PageQueryLimit.pageLimit(compose.getPage())){
            return AjaxResult.error("翻页已达到上限");
        }
        return opportunityRadarService.jskBidPlanPage(object);
    }

    /*
     * 投标计划查询
     */
    @RequestMapping("/jskBidPlan/getCapitalSourceSelect")
    public AjaxResult getCapitalSourceSelect() {
        return opportunityRadarService.getCapitalSourceSelect();
    }

    /*
     * 推荐关键词
     */
    @RequestMapping("/keywordList")
    public AjaxResult keywordList() {
        return opportunityRadarService.keywordList();
    }

    /*
     * 招标来源网站
     */
    @RequestMapping("/bidSourceList")
    public AjaxResult bidSourceList(@RequestBody JSONObject object) {
        return opportunityRadarService.bidSourceList(object);
    }

    /*
     * 重点项目清单
     */
    @RequestMapping("/importantPage")
    public AjaxResult importantPage(@RequestBody JSONObject object) {
        ComposeQueryDto compose = JSONObject.parseObject(object.toJSONString(), ComposeQueryDto.class);
        if (PageQueryLimit.pageLimit(compose.getPage())){
            return AjaxResult.error("翻页已达到上限");
        }
        return opportunityRadarService.importantPage(object);
    }
}
