package com.usoft.credit.service.person;

import com.usoft.credit.config.PyConfig;
import com.usoft.credit.modal.PersonQuery;
import com.usoft.credit.service.ErpQueryService;
import com.usoft.credit.util.QueryConditionUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 个人股东信息
 * created by shicr on 2018/6/15
 **/
@Service
public class PersonCorporationService {


    //查询类型
    private static String PERSONAL_SHAREHOLDER = "25136";

    //查询原因ID
    private static Integer QueryReasonID = 101;

    //收费子报告类型
    private static String SubreportIDs = "96002";


    @Autowired
    private ErpQueryService erpQueryService;

    @Autowired
    private PyConfig pyConfig;



    /**
     * 查询并保存返回查询json串
     *
     * @param query
     * @return
     */
    public String queryPersonCorporation(PersonQuery query) {
        //拼装查询的json
        String corporation = QueryConditionUtil.getPersonQuery(query, PERSONAL_SHAREHOLDER, SubreportIDs, QueryReasonID);
        //发起鹏元征信的请求
        String corporationResult = erpQueryService.requestApi(pyConfig.getHost(), pyConfig.getPathUnZip(), corporation);
        return corporationResult;

    }
}
