deason 3 år sedan
förälder
incheckning
209798081b
2 ändrade filer med 26 tillägg och 9 borttagningar
  1. 18 8
      exportformarking/exportExamRecord.py
  2. 8 1
      exportformarking/exportjsonfile.py

+ 18 - 8
exportformarking/exportExamRecord.py

@@ -3,13 +3,13 @@
   时间:2020/03/17
   author:pengchen
 """
+import csv
+import os
+
 import cloudservice
 import config
-import os
-import json
-import logger
 import htmlhandler
-import csv
+import logger
 
 questionlist = []
 solvelist = []
@@ -53,8 +53,15 @@ def handleRecordData(courseId, next):
         examRecordForMarkingBeanList = result["examRecordForMarkingBeanList"]
         if len(examRecordForMarkingBeanList) > 0:
             for examRecordForMarking in examRecordForMarkingBeanList:
+
+                # examRecordDataId = str(examRecordForMarking["examRecordDataId"]);
+                # if examRecordDataId != "39881554" and examRecordDataId != "39879641":
+                #     # logger.info("不用处理,跳过!examRecordDataId = %s" % examRecordDataId)
+                #     continue
+
+                print("开始处理 examRecordDataId = %s" % str(examRecordForMarking["examRecordDataId"]))
+
                 # 取试卷题目
-                logger.info("examRecordId %s handle start" % (str(examRecordForMarking["examRecordDataId"])))
                 course = cloudservice.getCourse(examRecordForMarking['courseId'])["courseList"][0]
                 examstudent = cloudservice.queryExamStudent(examRecordForMarking["examStudentId"])
                 mediaimportlist.append(
@@ -62,21 +69,24 @@ def handleRecordData(courseId, next):
                 examstudentlist.append([examstudent["courseCode"], examstudent["courseName"],
                                         examRecordForMarking["examRecordDataId"], examstudent["identityNumber"],
                                         examstudent["studentName"]])
+
                 output = config.outputpath + "/" + str(config.examId) + "/" + str(course["code"]) + "-" + \
                          examRecordForMarking["paperType"]
                 if not os.path.exists(output):
                     os.makedirs(output)
                 savepath = output + "/" + str(examRecordForMarking["examRecordDataId"]) + ".json"
+
                 if course["code"] in solvelist:
-                    logger.info("已包含%s" % (course["code"]))
+                    logger.info("已包含课程代码:%s" % (course["code"]))
                 else:
-                    logger.info("开始处理" + str(course["code"]))
+                    print("开始处理课程代码:" + str(course["code"]))
                     solvelist.append(course["code"])
                     handlePaperStruct(course["code"], examRecordForMarking["paperType"],
                                       examRecordForMarking["basePaperId"], course["name"])
                 if os.path.exists(savepath):
-                    logger.info("已有%s记录不再次进行处理" % str(examRecordForMarking["examRecordDataId"]))
+                    logger.info("已处理,跳过!examRecordDataId = %s" % str(examRecordForMarking["examRecordDataId"]))
                     continue
+
                 # #取每个人试卷的内容
                 # subjectdetail = cloudservice.querySubjectInfo(examRecordForMarking["examRecordDataId"])
                 # questionbeanlist=handleStudentPaperDetail(examRecordForMarking["examRecordDataId"],subjectdetail,course["code"],examRecordForMarking["paperType"])

+ 8 - 1
exportformarking/exportjsonfile.py

@@ -7,6 +7,7 @@ import time
 import hashlib
 import requests
 import config
+import logger
 import json
 import os
 from bs4 import BeautifulSoup
@@ -63,6 +64,12 @@ def queryExamValidRecordData(courseId, pageNo):
         examRecordForMarkingBeanList = result.json()['examRecordForMarkingBeanList']
         if len(examRecordForMarkingBeanList) > 0:
             for examRecordForMarkingBean in examRecordForMarkingBeanList:
+
+                # examRecordDataId = str(examRecordForMarkingBean["examRecordDataId"]);
+                # if examRecordDataId != "39881554" and examRecordDataId != "39879641":
+                #     # logger.info("不用处理,跳过!examRecordDataId = %s" % examRecordDataId)
+                #     continue
+
                 # 取试卷题目
                 course = getCourse(courseId)
                 output = config.outputpath + "/" + str(config.examId) + "/" + str(course["code"]) + "-" + \
@@ -71,7 +78,7 @@ def queryExamValidRecordData(courseId, pageNo):
                     os.makedirs(output)
                 savepath = output + "/" + str(examRecordForMarkingBean["examRecordDataId"]) + ".json"
                 if os.path.exists(savepath):
-                    print("已有%s记录不再次进行处理" % str(examRecordForMarkingBean["examRecordDataId"]))
+                    logger.info("已处理,跳过!examRecordDataId = %s" % str(examRecordForMarkingBean["examRecordDataId"]))
                     continue
                 questionbeanlist = querySubjectInfo(examRecordForMarkingBean["examRecordDataId"],
                                                     examRecordForMarkingBean["paperType"], course["code"])