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/8
 **/
@Service
public class PersonalService {


    //查询类型
    private static String PERSONAL_IDENTITY = "25160";

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

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


    @Autowired
    private ErpQueryService erpQueryService;

    @Autowired
    private PyConfig pyConfig;


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