deason 1 år sedan
förälder
incheckning
29c76b5bee
3 ändrade filer med 97 tillägg och 55 borttagningar
  1. 92 50
      file/临时.txt
  2. 2 2
      pom.xml
  3. 3 3
      src/main/java/cn/com/qmth/export/ExportPaperByCourseCode.java

+ 92 - 50
file/临时.txt

@@ -1,3 +1,94 @@
+#必要步骤
+
+1、将云开数据库 导入 本地
+
+2、建要处理的科目临时表
+CREATE TABLE `temp_subject` (
+  `ec_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
+  `yun_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
+  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
+) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
+学校提供待导入的科目,将Excel填入该表
+
+3、检查是否有包含公式的题
+select q.id,q.question_type,q.topic,q.answer,an.answer_text
+					from wq_question_bank_subject t left join wq_subject sub on t.subject_id=sub.id
+					left join wq_question_bank b on t.question_bank_id=b.id
+					left join wq_question_question_bank f on t.question_bank_id=f.question_bank_id
+					left join wq_question q on f.question_id=q.id 
+					left join wq_question_answer_item an on q.id=an.question_id
+where 1=1
+and sub.subject_code in (select yun_code from temp_subject)
+and b.rent_id=811 and b.is_deleted=0 and q.is_deleted=0 and q.rent_id=811
+and (q.topic like '%$$%' or q.answer like '%$$%' or an.answer_text like '%$$%');
+若存在 公式题 则继续执行下面继续处理步骤;若无,则忽略公式处理。
+{
+    处理公式的临时表
+    CREATE TABLE `temp_gs` (
+      `id` bigint NOT NULL,
+      `content1` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin,
+      `content2` text COLLATE utf8mb4_bin,
+      `content3` text COLLATE utf8mb4_bin,
+      `content4` text COLLATE utf8mb4_bin,
+      PRIMARY KEY (`id`)
+    ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
+
+    查询 存在公式关键字的字段,并将结果集导出至Excel,使用公式处理工具“formula-analysis 1.0.1.exe”
+    将Excel的内容执行处理后,复制至临时表“temp_gs”,然后执行update语句。
+    select id,topic from wq_question where topic like '%$$%';
+    update wq_question INNER JOIN temp_gs on wq_question.id=temp_gs.id
+    set wq_question.topic= CONCAT_WS('',temp_gs.content1,temp_gs.content2,temp_gs.content3,temp_gs.content4);
+    执行完update后,清空“temp_gs”。
+
+    同上
+    select id,answer from wq_question where answer like '%$$%';
+    update wq_question INNER JOIN temp_gs on wq_question.id=temp_gs.id
+    set wq_question.answer= CONCAT_WS('',temp_gs.content1,temp_gs.content2,temp_gs.content3,temp_gs.content4);
+
+    同上
+    select id,answer_text from wq_question_answer_item where answer_text like '%$$%';
+    update wq_question_answer_item INNER JOIN temp_gs on wq_question_answer_item.id=temp_gs.id
+    set wq_question_answer_item.answer_text= CONCAT_WS('',temp_gs.content1,temp_gs.content2,temp_gs.content3,temp_gs.content4);
+}
+
+4、云开数据库中 本地化的表“wq_knowledge_system”需要新加的字段root_id,
+再在yunkai-export代码“SetRootId.java”中更新属性树(修改本地化:dbName和账号)
+
+
+5、检查是否存在 非标准格式的 套题,若存在,直接当作 单独的题 处理,执行以下分析脚本。
+insert into wq_question_question_bank (question_bank_id,question_id)
+select f.question_bank_id,t.id 
+from wq_question t left join wq_question_question_bank f on t.question_id=f.question_id
+where t.question_id!=-1 and t.rent_id=811 
+and f.question_bank_id is not null;
+
+6、执行yunkai-export代码“ExportProperty.java”(修改本地化:dbName和账号、学校存放的文件目录)
+学校存放的文件目录 提前置入 相关Excel文件 ,然后才可执行!!!
+
+
+7、执行yunkai-export代码“ExportPaperByCourseCode.java”(修改本地化:dbName和账号、试卷前缀)
+MyConsumer.java内的paperDir需要修改正确 ,然后才可执行!!!
+
+8、执行yunkai-import代码“ExportPaperByCourseCode.java”(修改本地化:dbName和账号、试卷前缀)
+{
+a、云平台管理端导入课程
+b、导入课程属性,执行ImportPropByCourse(修改sourceDir、host、rootOrgId、key、token)
+c、导入试卷,执行ImportPaperByCourse(修改sourceDir、host、rootOrgId、key、token)
+}
+
+9、执行去重 examcloud-oe-tool
+
+End
+===============================================================================
+
+
+辅助分析脚本:
+#查询wq_question表中question_id!=-1的数据,将有效的question补入wq_question_question_bank。将套题作为单独的题处理
+#insert into wq_question_question_bank (question_bank_id,question_id)
+#select question_bank_id,question_id from temp_childer;
+
+
+
 选项就一个的查询
 var total=0;
 db.getCollection('question').find({
@@ -11,7 +102,7 @@ db.getCollection('question').find({
 }).forEach(function(ques){
 	total++;
 	//print(ques._id+" "+ques.questionType+" "+ques.course.code);
-	
+
 	db.getCollection('paperDetailUnit').find({
 	"question.$id":ques._id,
 	"paperType":"IMPORT"
@@ -65,55 +156,6 @@ set wq_question.topic= temp_old_data.content;
 update wq_question_answer_item INNER JOIN temp_old_data on wq_question_answer_item.id=temp_old_data.id
 set wq_question_answer_item.answer_text= temp_old_data.content;
 
-#必要步骤
-建要处理的科目临时表
-CREATE TABLE `temp_subject` (
-  `ec_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
-  `yun_code` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL,
-  `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin DEFAULT NULL
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-检查是否有包含公式的题
-select q.id,q.question_type,q.topic,q.answer,an.answer_text
-					from wq_question_bank_subject t left join wq_subject sub on t.subject_id=sub.id
-					left join wq_question_bank b on t.question_bank_id=b.id
-					left join wq_question_question_bank f on t.question_bank_id=f.question_bank_id
-					left join wq_question q on f.question_id=q.id 
-					left join wq_question_answer_item an on q.id=an.question_id
-where 1=1
-and sub.subject_code in (select yun_code from temp_subject)
-and b.rent_id=811 and b.is_deleted=0 and q.is_deleted=0 and q.rent_id=811
-and (q.topic like '%$$%' or q.answer like '%$$%' or an.answer_text like '%$$%');
-
-处理公式的临时表
-CREATE TABLE `temp_gs` (
-  `id` bigint NOT NULL,
-  `content1` text CHARACTER SET utf8mb4 COLLATE utf8mb4_bin,
-  `content2` text COLLATE utf8mb4_bin,
-  `content3` text COLLATE utf8mb4_bin,
-  `content4` text COLLATE utf8mb4_bin,
-  PRIMARY KEY (`id`)
-) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_bin;
-
-update wq_question INNER JOIN temp_gs on wq_question.id=temp_gs.id
-set wq_question.topic= CONCAT_WS('',temp_gs.content1,temp_gs.content2,temp_gs.content3,temp_gs.content4);
-
-update wq_question INNER JOIN temp_gs on wq_question.id=temp_gs.id
-set wq_question.answer= CONCAT_WS('',temp_gs.content1,temp_gs.content2,temp_gs.content3,temp_gs.content4);
 
-update wq_question_answer_item INNER JOIN temp_gs on wq_question_answer_item.id=temp_gs.id
-set wq_question_answer_item.answer_text= CONCAT_WS('',temp_gs.content1,temp_gs.content2,temp_gs.content3,temp_gs.content4);
-
-java代码更新属性树wq_knowledge_system新加的字段root_id
-
-
-#查询wq_question表中question_id!=-1的数据,将有效的question补入wq_question_question_bank。将套题作为单独的题处理
-#insert into wq_question_question_bank (question_bank_id,question_id)
-#select question_bank_id,question_id from temp_childer;
-
-insert into wq_question_question_bank (question_bank_id,question_id)
-select f.question_bank_id,t.id 
-from wq_question t left join wq_question_question_bank f on t.question_id=f.question_id
-where t.question_id!=-1 and t.rent_id=811 
-and f.question_bank_id is not null;
 
 

+ 2 - 2
pom.xml

@@ -115,8 +115,8 @@
 				<groupId>org.apache.maven.plugins</groupId>
 				<artifactId>maven-compiler-plugin</artifactId>
 				<configuration>
-					<source>1.6</source>
-					<target>1.6</target>
+					<source>1.8</source>
+					<target>1.8</target>
 					<compilerArgument>-proc:none</compilerArgument>
 				</configuration>
 			</plugin>

+ 3 - 3
src/main/java/cn/com/qmth/export/ExportPaperByCourseCode.java

@@ -10,8 +10,8 @@ import org.apache.log4j.Logger;
 
 public class ExportPaperByCourseCode {
 	private static Logger logger = LogManager.getLogger(ExportPaperByCourseCode.class);
-	//试卷
-	private static String paperSuff = "(240612)";
+	//试卷
+	private static String paperPrefix = "(240612)";
 	//数据库名
 	private static String dbName="yunkai_240612";
 	private static AtomicInteger count=new AtomicInteger(0);
@@ -22,7 +22,7 @@ public class ExportPaperByCourseCode {
 		try {
 			MyProducer pro=new MyProducer();
 			Map<String, Object> param=new HashMap<>();
-			param.put("paperSuff", paperSuff);
+			param.put("paperSuff", paperPrefix);
 			param.put("dbName", dbName);
 			pro.startDispose(MyConsumer.class, 8, param);
 		} catch (Exception e) {