caozixuan 3 éve
szülő
commit
da054107ad

+ 1 - 1
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/AnalyzeForReportService.java

@@ -69,7 +69,7 @@ public interface AnalyzeForReportService {
      * @param courseCode 课程编号
      * @param courseCode 课程编号
      * @return 结果
      * @return 结果
      */
      */
-    String AnalyzePointScoreRate(Long examId, String courseCode) throws Exception;
+    String buildAnalyzePointScoreRate(Long examId, String courseCode) throws Exception;
 
 
     /**
     /**
      * 构建考试课程考查学院维度分析表
      * 构建考试课程考查学院维度分析表

+ 2 - 2
teachcloud-report-business/src/main/java/com/qmth/teachcloud/report/business/service/impl/AnalyzeForReportServiceImpl.java

@@ -548,7 +548,7 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
 
 
     @Transactional(rollbackFor = Exception.class)
     @Transactional(rollbackFor = Exception.class)
     @Override
     @Override
-    public String AnalyzePointScoreRate(Long examId, String courseCode) throws Exception {
+    public String buildAnalyzePointScoreRate(Long examId, String courseCode) throws Exception {
         Long schoolId = tbExamService.findSchoolIdByExamId(examId);
         Long schoolId = tbExamService.findSchoolIdByExamId(examId);
         // 可分析有效课程信息
         // 可分析有效课程信息
         List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId, courseCode);
         List<String> effectiveCourseCodeList = tbExamCourseService.findEffectiveByExamId(examId, courseCode);
@@ -1976,7 +1976,7 @@ public class AnalyzeForReportServiceImpl implements AnalyzeForReportService {
         analyzeForReportService.buildAnalyzeExamCourseRecord(examId, courseCode);
         analyzeForReportService.buildAnalyzeExamCourseRecord(examId, courseCode);
         analyzeForReportService.buildAnalyzeExamCourseCollegeInspect(examId, courseCode);
         analyzeForReportService.buildAnalyzeExamCourseCollegeInspect(examId, courseCode);
         analyzeForReportService.buildAnalyzeExamCourseClazz(examId, courseCode);
         analyzeForReportService.buildAnalyzeExamCourseClazz(examId, courseCode);
-        analyzeForReportService.AnalyzePointScoreRate(examId, courseCode);
+        analyzeForReportService.buildAnalyzePointScoreRate(examId, courseCode);
         analyzeForReportService.buildAnalyzeExamCourseCollegeInspectDio(examId, courseCode);
         analyzeForReportService.buildAnalyzeExamCourseCollegeInspectDio(examId, courseCode);
         analyzeForReportService.buildAnalyzeExamCourseTeacherDio(examId, courseCode);
         analyzeForReportService.buildAnalyzeExamCourseTeacherDio(examId, courseCode);
         analyzeForReportService.buildAnalyzePaperStruct(examId, courseCode);
         analyzeForReportService.buildAnalyzePaperStruct(examId, courseCode);

+ 0 - 1
teachcloud-report/src/main/java/com/qmth/teachcloud/report/api/StudentReportController.java

@@ -8,7 +8,6 @@ import com.qmth.teachcloud.common.contant.SystemConstant;
 import com.qmth.teachcloud.common.util.Result;
 import com.qmth.teachcloud.common.util.Result;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.common.util.ResultUtil;
 import com.qmth.teachcloud.report.business.bean.result.TBExamStudentResult;
 import com.qmth.teachcloud.report.business.bean.result.TBExamStudentResult;
-import com.qmth.teachcloud.report.business.enums.SemesterEnum;
 import com.qmth.teachcloud.report.business.service.TBExamStudentService;
 import com.qmth.teachcloud.report.business.service.TBExamStudentService;
 import com.qmth.teachcloud.report.business.utils.EncrypAES;
 import com.qmth.teachcloud.report.business.utils.EncrypAES;
 import io.swagger.annotations.*;
 import io.swagger.annotations.*;

+ 60 - 1
teachcloud-report/src/test/java/com/qmth/teachcloud/report/AnalyzeForStudentServiceTest.java

@@ -1,13 +1,25 @@
 package com.qmth.teachcloud.report;
 package com.qmth.teachcloud.report;
 
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
+import com.qmth.boot.tools.signature.SignatureEntity;
+import com.qmth.boot.tools.signature.SignatureType;
+import com.qmth.teachcloud.common.config.DictionaryConfig;
+import com.qmth.teachcloud.common.contant.SystemConstant;
+import com.qmth.teachcloud.common.enums.ExceptionResultEnum;
+import com.qmth.teachcloud.common.util.HttpUtil;
+import com.qmth.teachcloud.report.business.entity.TBCloudExam;
 import com.qmth.teachcloud.report.business.enums.PublishStatusEnum;
 import com.qmth.teachcloud.report.business.enums.PublishStatusEnum;
 import com.qmth.teachcloud.report.business.service.AnalyzeForReportService;
 import com.qmth.teachcloud.report.business.service.AnalyzeForReportService;
+import org.apache.commons.lang3.StringEscapeUtils;
 import org.junit.Test;
 import org.junit.Test;
 import org.junit.runner.RunWith;
 import org.junit.runner.RunWith;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.boot.test.context.SpringBootTest;
 import org.springframework.test.context.junit4.SpringRunner;
 import org.springframework.test.context.junit4.SpringRunner;
 
 
 import javax.annotation.Resource;
 import javax.annotation.Resource;
+import java.io.IOException;
+import java.util.*;
 
 
 /**
 /**
  * @Description:
  * @Description:
@@ -19,6 +31,10 @@ import javax.annotation.Resource;
 public class AnalyzeForStudentServiceTest {
 public class AnalyzeForStudentServiceTest {
     @Resource
     @Resource
     private AnalyzeForReportService analyzeForReportService;
     private AnalyzeForReportService analyzeForReportService;
+    @Resource
+    DictionaryConfig dictionaryConfig;
+
+
     @Test
     @Test
     public void buildAnalyzeExamCourse() {
     public void buildAnalyzeExamCourse() {
         Long examId = 2L;
         Long examId = 2L;
@@ -52,7 +68,7 @@ public class AnalyzeForStudentServiceTest {
     public void analyzePointScoreRate() throws Exception {
     public void analyzePointScoreRate() throws Exception {
         Long examId = 1L;
         Long examId = 1L;
         String courseCode = "1013";
         String courseCode = "1013";
-        analyzeForReportService.AnalyzePointScoreRate(examId,courseCode);
+        analyzeForReportService.buildAnalyzePointScoreRate(examId,courseCode);
     }
     }
 
 
     @Test
     @Test
@@ -160,4 +176,47 @@ public class AnalyzeForStudentServiceTest {
         String courseCode = null;
         String courseCode = null;
         System.out.println(analyzeForReportService.buildAnalyzeTeacherCollegePaperStruct(examId,courseCode));
         System.out.println(analyzeForReportService.buildAnalyzeTeacherCollegePaperStruct(examId,courseCode));
     }
     }
+
+    @Test
+    public void syncCloudExam() throws IOException {
+        // 三个参数
+        Long examId = 263L;
+        String accessKey = "a8599fce46fd4e0192d2d13c7b258931";
+        String accessSecret = "Sl9xiXAphY04eE8ojuTqRgcv";
+
+        String url = dictionaryConfig.yunMarkDomain().getUrl() + dictionaryConfig.yunMarkDomain().getStudentScoreApi();
+        Map<String, Object> params = new HashMap<>();
+        params.put("examId", examId);
+
+
+        int pageNumber = 1;
+        int pageSize = 100;
+        List<Map> students = null;
+        for (; ; ) {
+            params.put("pageNumber", pageNumber);
+            params.put("pageSize", pageSize);
+            Long timestamp = System.currentTimeMillis();
+            String accessToken = SignatureEntity.build(SignatureType.SECRET, SystemConstant.METHOD, dictionaryConfig.yunMarkDomain().getStudentScoreApi(), timestamp, accessKey, accessSecret);
+            String result = HttpUtil.post(url, params, accessToken, timestamp);
+            result = StringEscapeUtils.unescapeHtml4(result);
+            if (Objects.nonNull(result)) {
+                if (result.contains("HTTP")) {
+                    throw ExceptionResultEnum.ERROR.exception("云阅卷鉴权失败");
+                }
+                List<Map> tempList = JSONObject.parseArray(JSONObject.toJSON(result).toString(), Map.class);
+                if (Objects.nonNull(tempList) && tempList.size() > 0) {
+                    if (Objects.isNull(students)) {
+                        students = new ArrayList<>();
+                    }
+                    students.addAll(tempList);
+                    pageNumber++;
+                } else {
+                    break;
+                }
+            } else {
+                break;
+            }
+        }
+        System.out.println(JSON.toJSONString(students));
+    }
 }
 }