Преглед на файлове

3.0.1-同步云阅卷bug修改

xiaof преди 3 години
родител
ревизия
5b2b34bed8

+ 5 - 2
distributed-print-business/src/main/java/com/qmth/distributed/print/business/service/impl/DataSyncServiceImpl.java

@@ -164,7 +164,7 @@ public class DataSyncServiceImpl implements DataSyncService {
         ExamPaperStructureStatusEnum structureStatus = ExamPaperStructureStatusEnum.INIT;
         // 同步初始参数
         TaskResultEnum result = null;
-        String errorMessage = null;
+        String errorMessage = "";
         try {
             String paperTypes = examPaperStructure.getPaperType();
             if (StringUtils.isBlank(paperTypes)) {
@@ -181,6 +181,7 @@ public class DataSyncServiceImpl implements DataSyncService {
             tbSyncTaskService.updateStatusAndResultById(tbSyncTask.getId(), examPaperStructure.getThirdRelateId(), TaskStatusEnum.RUNNING, null, null);
 
             // 同步主观题
+            errorMessage = "主观题";
             String subjectiveStructure = examPaperStructure.getSubjectiveStructure();
             if (StringUtils.isNotBlank(subjectiveStructure)) {
                 List<JSONObject> subjectiveJsons = JSONObject.parseArray(subjectiveStructure, JSONObject.class);
@@ -197,6 +198,7 @@ public class DataSyncServiceImpl implements DataSyncService {
             }
             structureStatus = ExamPaperStructureStatusEnum.SUBJECTIVE_FINISH;
 
+            errorMessage = "主观题分组";
             // 同步分组
             int countGroup = cloudMarkingTaskUtils.countGroup(schoolId, examId, subjectCode);
             // 如果存在分组,先删掉
@@ -237,6 +239,7 @@ public class DataSyncServiceImpl implements DataSyncService {
             structureStatus = ExamPaperStructureStatusEnum.GROUP_FINISH;
 
             // 同步绑定评卷员
+            errorMessage = "绑定评卷员";
             for (ExamPaperGroup examPaperGroup : examPaperGroups) {
                 List<ExamPaperGroupMarker> examPaperGroupMarkers = examPaperGroupMarkerService.listByGroupId(examPaperGroup.getId());
                 for (ExamPaperGroupMarker examPaperGroupMarker : examPaperGroupMarkers) {
@@ -247,7 +250,7 @@ public class DataSyncServiceImpl implements DataSyncService {
             result = TaskResultEnum.SUCCESS;
         } catch (ApiException e) {
             result = TaskResultEnum.ERROR;
-            errorMessage = e.getMessage();
+            errorMessage = errorMessage + e.getMessage();
         } finally {
             examPaperStructure.setStatus(structureStatus);
             examPaperStructureService.updateById(examPaperStructure);

+ 3 - 2
teachcloud-common/src/main/java/com/qmth/teachcloud/common/util/HttpKit.java

@@ -173,6 +173,7 @@ public class HttpKit {
         OutputStream out = null;
         BufferedReader reader = null;
         StringBuilder result = new StringBuilder();
+        int responseCode = 200;
         try {
             if (requestUrl == null || requestUrl.isEmpty()) {
                 return result.toString();
@@ -247,7 +248,7 @@ public class HttpKit {
             out.close();
 
 
-            int responseCode = connection.getResponseCode();
+            responseCode = connection.getResponseCode();
             if (responseCode >= 400) {
 //                reader = new BufferedReader(new InputStreamReader(connection.getErrorStream(), responseEncoding));
                 Map<String, List<String>> responseProperties = connection.getHeaderFields();
@@ -267,7 +268,7 @@ public class HttpKit {
                 result.append(line);
             }
         } catch (Exception e) {
-            throw ExceptionResultEnum.ERROR.exception("调用异常:" + e.getMessage());
+            throw ExceptionResultEnum.ERROR.exception("调用接口异常:错误码[" + responseCode + "],错误原因[" + e.getMessage() + "]");
         } finally {
             try {
                 if (out != null) {