//package com.qmth.jkserver.service;
//
//import com.alibaba.fastjson.JSON;
//import com.qmth.jkserver.common.FileMD5Utils;
//import com.qmth.jkserver.constant.SystemConstant;
//import com.qmth.jkserver.params.callApi.SaveExamParams;
//import com.qmth.jkserver.params.callApi.SaveStudentParams;
//import com.qmth.jkserver.params.callApi.SaveSubjectParams;
//import com.qmth.jkserver.params.callApi.fileUpload.JsonFileParams;
//import com.qmth.jkserver.params.callApi.fileUpload.PaperFileParams;
//import org.junit.Test;
//import org.junit.runner.RunWith;
//import org.springframework.boot.test.context.SpringBootTest;
//import org.springframework.test.context.junit4.SpringRunner;
//
//import javax.annotation.Resource;
//
//import java.io.File;
//import java.io.IOException;
//import java.math.BigDecimal;
//import java.util.HashMap;
//import java.util.List;
//import java.util.Map;
//import java.util.stream.Collectors;
//
//import static org.junit.Assert.*;
//
///**
// * @Description: 请求云阅卷接口测试类
// * @Author: CaoZixuan
// * @Date: 2021-05-08
// */
//@SpringBootTest
//@RunWith(SpringRunner.class)
//public class CallYunMarkApiServiceTest {
//    @Resource
//    private CallYunMarkApiService callYunMarkApiService;
//
//    @Test
//    public void callStudentScore() throws IOException {
//        Map<String,String> map = new HashMap<>();
//        map.put(SystemConstant.ACCESS_KEY,"c2465f31918e498b99f8d55d06b206fd");
//        map.put(SystemConstant.ACCESS_SECRET,"cqqEQy3n5kDsOCCX9gTKTIcp");
//
//        List<Map> result = callYunMarkApiService.callStudentScoreApi((long) 1,null,map);
//        System.out.println(JSON.toJSONString(result.stream().limit(10).collect(Collectors.toList())));
//    }
//    @Test
//    public void callExamSaveApi() throws IOException, IllegalAccessException {
//        Map<String,String> map = new HashMap<>();
//        map.put(SystemConstant.ACCESS_KEY,"c2465f31918e498b99f8d55d06b206fd");
//        map.put(SystemConstant.ACCESS_SECRET,"cqqEQy3n5kDsOCCX9gTKTIcp");
//
//        SaveExamParams saveExamParams = new SaveExamParams();
//        saveExamParams.setCode("qmth3");
//        saveExamParams.setName("test");
//        saveExamParams.setExamTime("2018-12-31 16:00:00");
//        saveExamParams.setType("MULTI_MEDIA");
//        int examId = callYunMarkApiService.callExamSaveApi(saveExamParams,map);
//        System.out.println("examId = " + examId);
//    }
//
//    @Test
//    public void callSubjectSaveApi() throws IOException, IllegalAccessException {
//        Map<String,String> map = new HashMap<>();
//        map.put(SystemConstant.ACCESS_KEY,"c2465f31918e498b99f8d55d06b206fd");
//        map.put(SystemConstant.ACCESS_SECRET,"cqqEQy3n5kDsOCCX9gTKTIcp");
//
//        SaveSubjectParams saveSubjectParams = new SaveSubjectParams();
//        saveSubjectParams.setExamId(26);
//        saveSubjectParams.setCode("Chinese");
//        saveSubjectParams.setName("语文");
//        saveSubjectParams.setRemark("12");
//        String updateTime = callYunMarkApiService.callSubjectSaveApi(saveSubjectParams,map);
//        System.out.println("updateTime = " + updateTime);
//    }
//
//    @Test
//    public void callStudentSaveApi() throws IOException, IllegalAccessException {
//        Map<String,String> map = new HashMap<>();
//        map.put(SystemConstant.ACCESS_KEY,"c2465f31918e498b99f8d55d06b206fd");
//        map.put(SystemConstant.ACCESS_SECRET,"cqqEQy3n5kDsOCCX9gTKTIcp");
//
//        SaveStudentParams saveStudentParams = new SaveStudentParams();
//        saveStudentParams.setExamId(3);
//        saveStudentParams.setExamNumber("123458");
//        saveStudentParams.setStudentCode("123458");
//        saveStudentParams.setName("王五");
//        saveStudentParams.setCollege("文学院");
//        saveStudentParams.setClassName("语文一班");
//        saveStudentParams.setTeacher("老师1");
//        saveStudentParams.setSubjectCode("Chinese2");
//        saveStudentParams.setSubjectName("语文2");
//        String updateTime = callYunMarkApiService.callStudentSaveApi(saveStudentParams,map);
//        System.out.println("updateTime = " + updateTime);
//    }
//
//    @Test
//    public void callFileUploadJsonApi() throws IOException, IllegalAccessException {
//        Map<String,String> map = new HashMap<>();
//        map.put(SystemConstant.ACCESS_KEY,"c2465f31918e498b99f8d55d06b206fd");
//        map.put(SystemConstant.ACCESS_SECRET,"cqqEQy3n5kDsOCCX9gTKTIcp");
//
//        JsonFileParams jsonFileParams = new JsonFileParams();
//        jsonFileParams.setExamId(20);
//        jsonFileParams.setExamNumber("000001-3-014615110068");
//        File file = new File("E:/temp/paperAnswer/420001_1.json");
//        System.out.println("文件是否存在？" + file.exists());
//        System.out.println("文件大小 : " + BigDecimal.valueOf(file.length()));
//        String md5Value = FileMD5Utils.encrypt(file);
//        jsonFileParams.setFile(file);
////        jsonFileParams.setMd5(md5Value);
//        System.out.println(callYunMarkApiService.callFileUploadApi(jsonFileParams,map));
//    }
//
//    @Test
//    public void callFileUploadPaperApi() throws IOException, IllegalAccessException {
//        Map<String,String> map = new HashMap<>();
//        map.put(SystemConstant.ACCESS_KEY,"c2465f31918e498b99f8d55d06b206fd");
//        map.put(SystemConstant.ACCESS_SECRET,"cqqEQy3n5kDsOCCX9gTKTIcp");
//
//        PaperFileParams paperFileParams = new PaperFileParams();
//        paperFileParams.setExamId(20);
//        paperFileParams.setSubjectCode("0005-6");
//        paperFileParams.setFormat("json");
//        File file = new File("E:/temp/paperAnswer/420001_1.json");
//        System.out.println("文件是否存在？" + file.exists());
//        System.out.println("文件大小 : " + BigDecimal.valueOf(file.length()));
//        paperFileParams.setFile(file);
////        jsonFileParams.setMd5(md5Value);
//        System.out.println(callYunMarkApiService.callFileUploadApi(paperFileParams,map));
//    }
//}