package com.trade.client.thirdparty;

import com.trade.common.core.domain.ResponseResult;
import com.trade.service.thirdparty.qichacha.dto.EcBasicDetailDto;
import com.trade.service.thirdparty.qichacha.dto.EcBasicInfoDto;
import com.trade.service.thirdparty.qichacha.service.QichachaService;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 企查查企业信息查询
 */
@RestController
@RequestMapping("/qcc")
public class QichachaController {

    @Resource
    private QichachaService qichachaService;

    /**
     * 企业关键字模糊查询
     */
    @GetMapping("/getEnterpriseKeySearch")
    public ResponseResult<List<EcBasicInfoDto>> findBusinessName(
            @RequestParam(value = "keyword", required = true) String keyword) {
        List<EcBasicInfoDto> depts = qichachaService.findBusinessName(keyword);
        return ResponseResult.success(depts);
    }

    /**
     * 企业工商照面查询(注册地址、注册资本)
     * 
     * @param keyword 企业名称（完成名称）
     */
    @GetMapping(value = "/getBasicDetailsByName")
    public ResponseResult<EcBasicDetailDto> getBasicDetailsByName(
            @RequestParam(value = "keyword", required = true) String keyword) {
        EcBasicDetailDto basicDetailDto = qichachaService.getBasicDetailsByName(keyword);
        return ResponseResult.success(basicDetailDto);
    }
}
