package com.heyu.api.controller.certificate;


import com.heyu.api.baidu.handle.certificate.BBusinesslicenseVerificationDetailedHandle;
import com.heyu.api.baidu.request.certificate.BBusinesslicenseVerificationDetailedRequest;
import com.heyu.api.baidu.response.certificate.BBusinesslicenseVerificationDetailedResp;
import com.heyu.api.controller.BaseController;
import com.heyu.api.data.annotation.CacheResult;
import com.heyu.api.data.annotation.NotIntercept;
import com.heyu.api.data.utils.ApiR;
import com.heyu.api.data.utils.R;
import com.heyu.api.request.certificate.BusinesslicenseVerificationDetailedReq;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/***
 * https://console.bce.baidu.com/support/?_=1740219852952&timestamp=1742562052573#/api?product=AI&project=%E6%96%87%E5%AD%97%E8%AF%86%E5%88%AB&parent=%E5%8D%A1%E8%AF%81OCR&api=rest%2F2.0%2Focr%2Fv1%2Fbusinesslicense_verification_detailed&method=post
 *
 *
 *企业工商信息查询（高。。。
 *
 *
 * 传入企业名称、注册号、统一社会信用代码中的任意一种，具体返回企业全维度信息，包括工商基本信息、分支机构信息、企业变更信息、纳税信
 * 息、联系信息、企业高管信息、经营异常信息、动产抵押信息、曾用名信息、股东信息、行政处罚信息、行政许可信息、股权出资信息、失信信息、
 * 被执行信息等。
 *
 * 注：目前支持工商注册的企业认证，事业单位、律师事务所等信息暂不支持验证，发生工商变更或刚注册的企业信息，预计在企业公示的核准日期
 * T+3个工作日后可进行验证。
 *
 *
 *
 *
 */
@Slf4j
@RestController
@RequestMapping("/businesslicense")
@NotIntercept
public class BusinesslicenseVerificationDetailedController extends BaseController {

    @Autowired
    private BBusinesslicenseVerificationDetailedHandle bBusinesslicenseVerificationDetailedHandle;

    @RequestMapping("/berification")
    @CacheResult
    public R recognize(BusinesslicenseVerificationDetailedReq request) {
        BBusinesslicenseVerificationDetailedRequest bBusinesslicenseVerificationDetailedRequest = new BBusinesslicenseVerificationDetailedRequest();
        bBusinesslicenseVerificationDetailedRequest.setVerifyNum(request.getVerifyNum());
        ApiR<BBusinesslicenseVerificationDetailedResp> bR = bBusinesslicenseVerificationDetailedHandle.handle(bBusinesslicenseVerificationDetailedRequest);
        if (bR.isSuccess()) {
            BBusinesslicenseVerificationDetailedResp bBusinesslicenseVerificationDetailedResp = bR.getData();
            return R.ok().setData(bBusinesslicenseVerificationDetailedResp.getWordsResult());
        }

        return R.error(bR.getErrorMsg());
    }
}
