import request from "@/lib/request";
import realityRequest from "@/lib/request-reality";
import fileRequest from "@/lib/request-file";

// 查询订单基本信息
export function getOrderMsg(orderId) {
    return request({
        url: "outside/order/queryOrderBasicInfo?orderId=" + orderId,
        method: "get"
    });
}

// 根据订单id查询待检验产品基本信息接口
export function getPendingProductMsg(orderId) {
    return request({
        url: "outside/order/queryBasicInfo?orderId=" + orderId,
        method: "get"
        // headers:{'Content-Type':'multipart/form-data'},
    });
}

// 根据订单id查询真实性检验分析方法接口
export function getAnalyseMethod(orderId) {
    return request({
        url: "outside/validation/info/analyseMethod?orderId=" + orderId,
        method: "get"
    });
}

// 根据订单id查询订单关联的地面数据
export function getSamplesList(orderId) {
    return request({
        url: "outside/order/queryListLandDataAssociated/" + orderId,
        method: "get"
    });
}

// 根据订单id查询订单关联的地面数据
export function delSampleData(data) {
    return request({
        url: "outside/order/deleteSampleData",
        method: "post",
        headers: { "Content-Type": "multipart/form-data" },
        data
    });
}

// 更新订单的真实性检验方法（分析方法）
export function upDateAnalyseMethod(params) {
    return request({
        url: "outside/validation/info/upDateAnalyseMethod?" + params,
        method: "put"
    });
}

// 订单反馈
export function orderFeedback(data) {
    return request({
        url: "outside/order/orderFeedback",
        method: "post",
        headers: { "Content-Type": "multipart/form-data" },
        data
    });
}

// 订单状态更新
export function updateOrderStage(params) {
    return request({
        url: "outside/order/?" + params,
        method: "put"
    });
}

//根据订单ID展示真实性检验报告接口
export function getRealityCheckReport(orderId) {
    return request({
        url: "outside/validation/showRealityCheckReport?orderId=" + orderId,
        method: "get"
    });
}

// 获取抽样方法
export function getAllSampleFun() {
    return request({
        url: "outside/validation/info/sampleMethod",
        method: "get"
    });
}

// 同名点选取
export function setSamePoi(data) {
    return request({
        url: "outside/validation/sameNamePoint/select",
        headers: { "Content-Type": "multipart/form-data" },
        method: "post",
        data
    });
}

// 设置订单审核
export function setExamine(data) {
    return request({
        url: "outside/order/examine",
        method: "post",
        data
    });
}

// 查询订单审核结果
export function getExamine(orderId) {
    return request({
        url: "outside/order/examine/" + orderId,
        method: "get"
    });
}

// 存储检验结果接口
export function saveValidationRes(data) {
    return request({
        url: "outside/validation/result/saveValidationResult",
        data,
        method: "post"
    });
}

// 存储报告信息
export function saveReport(params) {
    return request({
        url: "outside/validation/result/saveReportPath",
        params,
        method: "get"
    });
}

// 根据抽样算法获取抽样后样本数据
export function getSampleData(data) {
    return realityRequest({
        url: "sampleGet/getSampleData",
        method: "post",
        headers: { "Content-Type": "multipart/form-data" },
        data
    });
}

// 分层抽样获取样本数据
export function getSamplesByLayer(data) {
    return realityRequest({
        url: "sampleGet/getSamplesByLayer",
        method: "post",
        headers: { "Content-Type": "multipart/form-data" },
        data
    });
}

// 真实性校验方法
export function checkReality(data) {
    return realityRequest({
        url: "check/reality",
        method: "post",
        headers: { "Content-Type": "multipart/form-data" },
        data
    });
}

// 导出pdf模板
export function exportWord(data, pdfName, productType) {
    return fileRequest({
        url:
            "importPDF/importWordAndPDF?reportName=" +
            pdfName +
            "&productType=" +
            productType,
        method: "post",
        // headers:{'Content-Type':'multipart/form-data'},
        data
    });
}

//下载PDF报告
export function downloadPdf(url) {
    return request({
        url: url,
        responseType: "blob",
        method: "GET"
    });
}

/**
 * @Descripttion 根据token获取用户信息
 * @param {*} token
 * @return {*}
 */
export async function getUserInfo(token) {
    return request({
        url: YUNGUAN_SERVER_URL + "/app/logincheck?token=" + token,
        method: "get",
    });
}
/**
 * 根据proj转换坐标
 * @param {*} options
 * @returns
 */
export function getProjPos(options) {
    return fileRequest({
        url: "importPDF/zbZh",
        method: "post",
        data: options
    });
}

// 重新检验
export function resetCheck(data) {
    return request({
        url: "validation/validation/restartInspection",
        method: "post",
        data
    });
}
// 获取地表覆盖类型
export function getFeatureMap(userId, orderId) {
    return request({
        url: "order/order/getLandCoverTypeImageSystemRelation?userId=" + userId + "&orderId=" + orderId,
        method: "get",
        withCredentials: true,
    });
}
// 获取产品像元值
export function getProductValue(data) {
    return request({
        url: "/product/geo/pixel/value/v2",
        method: "post",
        data
    });
}