package com.usoft.credit.service.enterprise;

import com.usoft.credit.config.PyConfig;
import com.usoft.credit.modal.EnterpriseQuery;
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/7
 **/
@Service
public class EnterpriseDeptService {

    @Autowired
    private ErpQueryService erpQueryService;

    @Autowired
    private PyConfig pyConfig;

    //查询类型
    private static String ENTERPRISE_DEPT = "25123";

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

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


    /**
     * 查询并保存返回查询json串
     *
     * @param query
     * @return
     */
    public String queryEnterpriseDept(EnterpriseQuery query) {
        String endept = QueryConditionUtil.getEnterpriseQuery(query, ENTERPRISE_DEPT, SubreportIDs, QueryReasonID);

        String endeptResult = erpQueryService.requestApi(pyConfig.getHost(), pyConfig.getPathUnZip(), endept);
        return endeptResult;
    }
}
