package digital.laboratory.platform.inspetion.api.feign.fallback;

import cn.hutool.json.JSONObject;
import digital.laboratory.platform.inspetion.api.entity.IdentificationBookDTO;
import digital.laboratory.platform.inspetion.api.feign.RemoteTestToIdentifyService;
import digital.laboratory.platform.common.core.util.R;
import digital.laboratory.platform.inspetion.api.vo.TestRecordVo;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;

import java.util.List;
import java.util.Map;

/**
 * @author xy
 * @version 1.0
 * @title RemoteTestToIdentifyServiceFallbackImpl
 * @description
 * @create 2024/1/17 18:07
 */
@Slf4j
@Component
public class RemoteTestToIdentifyServiceFallbackImpl implements RemoteTestToIdentifyService {
    @Setter
    private Throwable cause;

    @Override
    public R getIdentifyBookDataByBusinessId(String businessId) {
        //log.error("feign 获取鉴定文书信息失败,请联系管理员:{}", identificationBookDTO.getCaseName(), cause);
        return null;
    }

    @Override
    public R getTestFinishBusinessData(List<String> synedIdList) {
        return null;
    }

    @Override
    public R<Map<String, TestRecordVo>> queryTestRecordInfoByBusinessId(List<String> businessIds) {
        log.error("feign 查询实验记录信息失败, businessIds: {}, 异常: {}", businessIds, cause != null ? cause.getMessage() : "未知错误");
        return R.failed("查询实验记录信息失败");
    }

    @Override
    public R<JSONObject> inspectRecord(String entrustId) {
        log.error("feign 获取检验记录失败, entrustId: {}, 异常: {}", entrustId, cause != null ? cause.getMessage() : "未知错误");
        return R.failed("获取检验记录失败");
    }
}
