package com.tuoheng.admin.service;

import com.alibaba.fastjson.JSONObject;
import com.tuoheng.admin.dto.RoadSectionDto;
import com.tuoheng.admin.entity.RoadInformation;
import com.tuoheng.admin.entity.Section;
import com.tuoheng.admin.mapper.RoadInformationMapper;
import com.tuoheng.admin.mapper.SectionMapper;
import com.tuoheng.admin.request.dept.AddDeptRequest;
import com.tuoheng.admin.request.dept.EditDeptRequest;
import com.tuoheng.admin.request.third.DspCallbackRequest;
import com.tuoheng.admin.request.third.QuestionFile;
import com.tuoheng.admin.service.dept.IDeptService;
import com.tuoheng.admin.service.dept.query.QueryListTreeService;
import com.tuoheng.admin.service.third.dsp.IDspCallbackService;
import com.tuoheng.common.core.utils.DateUtils;
import com.tuoheng.common.core.utils.JsonResult;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Locale;

@Slf4j
@RunWith(SpringRunner.class)
@SpringBootTest
public class DspCallbackServiceTest {

    @Autowired
    private IDspCallbackService dspCallbackService;

    @Test
    public void testGetOneById() {
        String requestId = "369567d311de473886c40a5c85305493";
        DspCallbackRequest dspCallbackRequest = new DspCallbackRequest();
        dspCallbackRequest.setAnalyseStatus(2);
        dspCallbackRequest.setType(1);

        List<QuestionFile> questionFiles = new ArrayList<>();
        QuestionFile questionFile = new QuestionFile();
        questionFile.setFileCode("PVR2024010815484594512");
        questionFile.setFileName("2024-01-08-15-48-45_frame-52-332_type_20240108154845591880-1-003-1_AI.jpg");
        questionFile.setFileOriginalUrl("https://image.t-aaron.com/369567d311de473886c40a5c85305493/2024-01-08-15-48-45_frame-52-332_type_20240108154845581518-1-0-0_OR.jpg");
        questionFile.setFileMarkerUrl("https://image.t-aaron.com/369567d311de473886c40a5c85305493/2024-01-08-15-48-45_frame-52-332_type_20240108154845591880-1-003-1_AI.jpg");
        questionFile.setAnalyseTime(DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, "2024-01-08 15:48:45"));
        questionFile.setQuestionName("车辆");
        questionFile.setQuestionCode("003008");
        questionFiles.add(questionFile);
        dspCallbackRequest.setQuestionFiles(questionFiles);
        dspCallbackService.saveCallbackData(requestId, dspCallbackRequest);
    }

}
