haogh 11 luni în urmă
părinte
comite
ed182ef855
100 a modificat fișierele cu 11324 adăugiri și 0 ștergeri
  1. 1 0
      .gitignore
  2. BIN
      features/Convert2Png.exe
  3. 6 0
      features/dbBackup.bat
  4. BIN
      features/emf2png.exe
  5. BIN
      features/录题模板.docx
  6. 313 0
      pom.xml
  7. 43 0
      sql/db_add_guid.sql
  8. 43 0
      sql/zk_tk.sql
  9. 1189 0
      sql/zk_tk_table.sql
  10. 11 0
      sql/创建视图.sql
  11. 34 0
      src/main/java/com/qmth/qrzk/analysis/controller/AnalysisController.java
  12. 21 0
      src/main/java/com/qmth/qrzk/analysis/controller/QrzkConfig.java
  13. 51 0
      src/main/java/com/qmth/qrzk/config/ScoreAnalysisController.java
  14. 10 0
      src/main/java/com/qmth/qrzk/dao/ICodeDao.java
  15. 14 0
      src/main/java/com/qmth/qrzk/dao/IQuestionAttachmentDao.java
  16. 42 0
      src/main/java/com/qmth/qrzk/dao/IQuestionDao.java
  17. 17 0
      src/main/java/com/qmth/qrzk/dao/IQuestionImportHistoryDao.java
  18. 14 0
      src/main/java/com/qmth/qrzk/dao/IQuestionOperationLogDao.java
  19. 15 0
      src/main/java/com/qmth/qrzk/dao/IQuestionOptionDao.java
  20. 19 0
      src/main/java/com/qmth/qrzk/dao/IQuestionPagerTimesDao.java
  21. 36 0
      src/main/java/com/qmth/qrzk/dao/IQuestionTypeDao.java
  22. 34 0
      src/main/java/com/qmth/qrzk/dao/IRoleDao.java
  23. 55 0
      src/main/java/com/qmth/qrzk/dao/IUserDao.java
  24. 26 0
      src/main/java/com/qmth/qrzk/dao/impl/CodeDaoImpl.java
  25. 37 0
      src/main/java/com/qmth/qrzk/dao/impl/QuestionAttachmentDaoImpl.java
  26. 118 0
      src/main/java/com/qmth/qrzk/dao/impl/QuestionDaoImpl.java
  27. 48 0
      src/main/java/com/qmth/qrzk/dao/impl/QuestionImportHistoryDaoImpl.java
  28. 39 0
      src/main/java/com/qmth/qrzk/dao/impl/QuestionOperationLogDaoImpl.java
  29. 46 0
      src/main/java/com/qmth/qrzk/dao/impl/QuestionOptionDaoImpl.java
  30. 44 0
      src/main/java/com/qmth/qrzk/dao/impl/QuestionPagerTimesDaoImpl.java
  31. 117 0
      src/main/java/com/qmth/qrzk/dao/impl/QuestionTypeDaoImpl.java
  32. 91 0
      src/main/java/com/qmth/qrzk/dao/impl/RoleDaoImpl.java
  33. 131 0
      src/main/java/com/qmth/qrzk/dao/impl/UserDaoImpl.java
  34. 48 0
      src/main/java/com/qmth/qrzk/repository/common/BaseExcetion.java
  35. 71 0
      src/main/java/com/qmth/qrzk/repository/common/ListSqlUtil.java
  36. 57 0
      src/main/java/com/qmth/qrzk/repository/common/SqlFuncUtil.java
  37. 183 0
      src/main/java/com/qmth/qrzk/repository/common/base/BaseDao.java
  38. 81 0
      src/main/java/com/qmth/qrzk/repository/common/base/Dialect.java
  39. 26 0
      src/main/java/com/qmth/qrzk/repository/common/enumeration/PaperStatusEnum.java
  40. 30 0
      src/main/java/com/qmth/qrzk/repository/common/enumeration/QuestionStatusEnum.java
  41. 20 0
      src/main/java/com/qmth/qrzk/repository/common/mapper/BookMapper.java
  42. 14 0
      src/main/java/com/qmth/qrzk/repository/common/mapper/CodeMapper.java
  43. 6 0
      src/main/java/com/qmth/qrzk/repository/common/mapper/CommonMapper.java
  44. 23 0
      src/main/java/com/qmth/qrzk/repository/common/mapper/CourseMapper.java
  45. 19 0
      src/main/java/com/qmth/qrzk/repository/common/mapper/CourseQuestionTypeMapper.java
  46. 11 0
      src/main/java/com/qmth/qrzk/repository/common/mapper/PaperCorrigendumMapper.java
  47. 27 0
      src/main/java/com/qmth/qrzk/repository/common/mapper/PaperSimilarityMapper.java
  48. 17 0
      src/main/java/com/qmth/qrzk/repository/common/mapper/QuestionAttachmentMapper.java
  49. 20 0
      src/main/java/com/qmth/qrzk/repository/common/mapper/QuestionImportHistoryMapper.java
  50. 48 0
      src/main/java/com/qmth/qrzk/repository/common/mapper/QuestionMapper.java
  51. 16 0
      src/main/java/com/qmth/qrzk/repository/common/mapper/QuestionOperationLogMapper.java
  52. 19 0
      src/main/java/com/qmth/qrzk/repository/common/mapper/QuestionOptionMapper.java
  53. 16 0
      src/main/java/com/qmth/qrzk/repository/common/mapper/QuestionPagerTimesMapper.java
  54. 22 0
      src/main/java/com/qmth/qrzk/repository/common/mapper/QuestionSimilarityMapper.java
  55. 35 0
      src/main/java/com/qmth/qrzk/repository/common/mapper/QuestionTypeMapper.java
  56. 28 0
      src/main/java/com/qmth/qrzk/repository/common/mapper/RoleMapper.java
  57. 20 0
      src/main/java/com/qmth/qrzk/repository/common/mapper/TaskBatchMapper.java
  58. 13 0
      src/main/java/com/qmth/qrzk/repository/common/mapper/UserCourseMapper.java
  59. 55 0
      src/main/java/com/qmth/qrzk/repository/common/mapper/UserMapper.java
  60. 25 0
      src/main/java/com/qmth/qrzk/repository/common/mapper/UserRoleMapper.java
  61. 20 0
      src/main/java/com/qmth/qrzk/repository/constants/WebConstants.java
  62. 30 0
      src/main/java/com/qmth/qrzk/repository/exception/BizException.java
  63. 31 0
      src/main/java/com/qmth/qrzk/repository/exp/BaseData.java
  64. 85 0
      src/main/java/com/qmth/qrzk/repository/exp/Book.java
  65. 53 0
      src/main/java/com/qmth/qrzk/repository/exp/Course.java
  66. 25 0
      src/main/java/com/qmth/qrzk/repository/exp/CourseBook.java
  67. 51 0
      src/main/java/com/qmth/qrzk/repository/exp/QuestionType.java
  68. 41 0
      src/main/java/com/qmth/qrzk/repository/exp/Teacher.java
  69. 62 0
      src/main/java/com/qmth/qrzk/repository/exp/TkjsBatchData.java
  70. 55 0
      src/main/java/com/qmth/qrzk/repository/exp/TkjsTask.java
  71. 59 0
      src/main/java/com/qmth/qrzk/repository/exp/TkjsTaskBatch.java
  72. 53 0
      src/main/java/com/qmth/qrzk/repository/explort/beans/ExportQuestion.java
  73. 26 0
      src/main/java/com/qmth/qrzk/repository/explort/beans/ExportQuestionAttachment.java
  74. 28 0
      src/main/java/com/qmth/qrzk/repository/explort/beans/ExportQuestionOptions.java
  75. 113 0
      src/main/java/com/qmth/qrzk/repository/explort/beans/ExportQuestionSet.java
  76. 62 0
      src/main/java/com/qmth/qrzk/repository/learnCenter/model/LearnCenter.java
  77. 45 0
      src/main/java/com/qmth/qrzk/repository/learnCenter/service/LearnCenterService.java
  78. 272 0
      src/main/java/com/qmth/qrzk/repository/pager/model/PagerConstruct.java
  79. 123 0
      src/main/java/com/qmth/qrzk/repository/pager/model/PagerConstructDetail.java
  80. 152 0
      src/main/java/com/qmth/qrzk/repository/pager/model/PagerConstructQtype.java
  81. 69 0
      src/main/java/com/qmth/qrzk/repository/pager/model/PagerTemplet.java
  82. 116 0
      src/main/java/com/qmth/qrzk/repository/pager/model/PaperDifficultyEstimateDetail.java
  83. 233 0
      src/main/java/com/qmth/qrzk/repository/pager/model/PaperSkeleton.java
  84. 158 0
      src/main/java/com/qmth/qrzk/repository/pager/model/PaperSkeletonDetail.java
  85. 472 0
      src/main/java/com/qmth/qrzk/repository/pager/model/PaperSkeletonDetailVO.java
  86. 124 0
      src/main/java/com/qmth/qrzk/repository/pager/model/SkelCfg.java
  87. 992 0
      src/main/java/com/qmth/qrzk/repository/pager/service/PagerConstructService.java
  88. 114 0
      src/main/java/com/qmth/qrzk/repository/pager/service/PaperDifficultyEstimateService.java
  89. 2882 0
      src/main/java/com/qmth/qrzk/repository/pager/service/ZujuanService.java
  90. 333 0
      src/main/java/com/qmth/qrzk/repository/quartz/LoadParamsQuartz.java
  91. 35 0
      src/main/java/com/qmth/qrzk/repository/service/query/AttachmentQueryParams.java
  92. 69 0
      src/main/java/com/qmth/qrzk/repository/service/query/AvailableQuesQueryParams.java
  93. 22 0
      src/main/java/com/qmth/qrzk/repository/service/query/CorrigendumQueryParams.java
  94. 24 0
      src/main/java/com/qmth/qrzk/repository/service/query/CourseQueryParams.java
  95. 89 0
      src/main/java/com/qmth/qrzk/repository/service/query/DbfPaperInfoQueryParams.java
  96. 55 0
      src/main/java/com/qmth/qrzk/repository/service/query/LearnCenterQueryParams.java
  97. 54 0
      src/main/java/com/qmth/qrzk/repository/service/query/PagerQueryParams.java
  98. 34 0
      src/main/java/com/qmth/qrzk/repository/service/query/PaperAnalysisParams.java
  99. 131 0
      src/main/java/com/qmth/qrzk/repository/service/query/PaperBatchParams.java
  100. 317 0
      src/main/java/com/qmth/qrzk/repository/service/query/PaperParams.java

+ 1 - 0
.gitignore

@@ -0,0 +1 @@
+/target/

BIN
features/Convert2Png.exe


+ 6 - 0
features/dbBackup.bat

@@ -0,0 +1,6 @@
+@echo off
+set time_hh=%time:~0,2%
+if /i %time_hh% LSS 10 (set time_hh=0%time:~1,1%)
+set mydate=%date:~,4%%date:~5,2%%date:~8,2%%time_hh%%time:~3,2%%time:~6,2%
+set MySQL_HOME="D:\DevelopTools\MySQL\MySQL Server 5.5"
+%MySQL_HOME%\bin\mysqldump --opt -u root --password=test qrzk_ksy_id_varchar > D:\qrzk\dbBak\qrzk_ksy_id_varchar_%mydate%.sql

BIN
features/emf2png.exe


BIN
features/录题模板.docx


+ 313 - 0
pom.xml

@@ -0,0 +1,313 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+	<modelVersion>4.0.0</modelVersion>
+	<groupId>com.qrzh</groupId>
+	<artifactId>qrzk</artifactId>
+	<packaging>war</packaging>
+	<version>0.0.1-SNAPSHOT</version>
+	<name>qrzk Maven Webapp</name>
+	<url>http://maven.apache.org</url>
+	<properties>
+		<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
+		<spring.version>3.2.5.RELEASE</spring.version>
+		<spring.security.version>3.1.1.RELEASE</spring.security.version>
+		<mybatis.version>3.2.7</mybatis.version>
+		<log4j.version>1.2.13</log4j.version>
+		<aspectj.version>1.6.5</aspectj.version>
+	</properties>
+	<repositories>
+        <repository>
+            <id>mvn-repo</id>
+            <url>http://maven.nlpcn.org/</url>
+        </repository>
+    </repositories>
+
+	<dependencies>
+		<dependency>
+			<groupId>junit</groupId>
+			<artifactId>junit</artifactId>
+			<version>3.8.1</version>
+			<scope>test</scope>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-webmvc</artifactId>
+			<version>${spring.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-orm</artifactId>
+			<version>${spring.version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-context-support</artifactId>
+			<version>${spring.version}</version>
+			<exclusions>
+				<exclusion>
+					<groupId>quartz</groupId>
+					<artifactId>quartz</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework</groupId>
+			<artifactId>spring-aop</artifactId>
+			<version>${spring.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>com.googlecode.ehcache-spring-annotations</groupId>
+			<artifactId>ehcache-spring-annotations</artifactId>
+			<version>1.1.3</version>
+			<exclusions>
+				<exclusion>
+					<groupId>cglib</groupId>
+					<artifactId>cglib</artifactId>
+				</exclusion>
+			</exclusions>
+		</dependency>
+
+		<!-- spring security -->
+		<dependency>
+			<groupId>org.springframework.security</groupId>
+			<artifactId>spring-security-core</artifactId>
+			<version>${spring.security.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.security</groupId>
+			<artifactId>spring-security-web</artifactId>
+			<version>${spring.security.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.security</groupId>
+			<artifactId>spring-security-config</artifactId>
+			<version>${spring.security.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>org.springframework.security</groupId>
+			<artifactId>spring-security-taglibs</artifactId>
+			<version>${spring.security.version}</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.quartz-scheduler</groupId>
+			<artifactId>quartz</artifactId>
+			<version>1.8.5</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.mybatis</groupId>
+			<artifactId>mybatis</artifactId>
+			<version>${mybatis.version}</version>
+		</dependency>
+		<dependency>
+			<groupId>mysql</groupId>
+			<artifactId>mysql-connector-java</artifactId>
+			<version>5.1.21</version>
+		</dependency>
+		<dependency>
+			<groupId>javax.servlet</groupId>
+			<artifactId>servlet-api</artifactId>
+			<version>2.5</version>
+		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-api</artifactId>
+			<version>1.7.7</version>
+		</dependency>
+		<dependency>
+			<groupId>org.slf4j</groupId>
+			<artifactId>slf4j-log4j12</artifactId>
+			<version>1.7.7</version>
+		</dependency>
+		<dependency>
+			<groupId>org.freemarker</groupId>
+			<artifactId>freemarker</artifactId>
+			<version>2.3.19</version>
+		</dependency>
+		<dependency>
+			<groupId>commons-dbcp</groupId>
+			<artifactId>commons-dbcp</artifactId>
+			<version>1.2.2</version>
+		</dependency>
+		<dependency>
+			<groupId>taglibs</groupId>
+			<artifactId>standard</artifactId>
+			<version>1.1.2</version>
+		</dependency>
+		<dependency>
+			<groupId>org.codehaus.jackson</groupId>
+			<artifactId>jackson-mapper-asl</artifactId>
+			<version>1.9.8</version>
+		</dependency>
+		<dependency>
+			<groupId>org.mybatis</groupId>
+			<artifactId>mybatis-spring</artifactId>
+			<version>1.2.2</version>
+		</dependency>
+		<dependency>
+			<groupId>net.sf.json-lib</groupId>
+			<artifactId>json-lib</artifactId>
+			<version>2.4</version>
+			<classifier>jdk15</classifier>
+		</dependency>
+		<dependency>
+			<groupId>commons-fileupload</groupId>
+			<artifactId>commons-fileupload</artifactId>
+			<version>1.2.1</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.commons</groupId>
+			<artifactId>commons-io</artifactId>
+			<version>1.3.2</version>
+		</dependency>
+		<dependency>
+			<groupId>org.jdom</groupId>
+			<artifactId>jdom</artifactId>
+			<version>1.1</version>
+		</dependency>
+		<dependency>
+			<groupId>jstl</groupId>
+			<artifactId>jstl</artifactId>
+			<version>1.2</version>
+		</dependency>
+		<dependency>
+			<groupId>ant</groupId>
+			<artifactId>ant</artifactId>
+			<version>1.6.5</version>
+		</dependency>
+		<dependency>
+			<groupId>org.aspectj</groupId>
+			<artifactId>aspectjweaver</artifactId>
+			<version>1.6.11</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.lucene</groupId>
+			<artifactId>lucene-core</artifactId>
+			<version>3.6.0</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.poi</groupId>
+			<artifactId>poi</artifactId>
+			<version>3.8</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.poi</groupId>
+			<artifactId>poi-ooxml</artifactId>
+			<version>3.8</version>
+		</dependency>
+		<dependency>
+			<groupId>org.apache.poi</groupId>
+			<artifactId>poi-ooxml-schemas</artifactId>
+			<version>3.8</version>
+		</dependency>
+
+		<dependency>
+			<groupId>org.htmlparser</groupId>
+			<artifactId>htmlparser</artifactId>
+			<version>2.1</version>
+		</dependency>
+
+		<dependency>
+			<groupId>net.arnx</groupId>
+			<artifactId>wmf2svg</artifactId>
+			<version>0.9.7</version>
+		</dependency>
+		
+		<dependency>
+		  <groupId>org.jsoup</groupId>
+		  <artifactId>jsoup</artifactId>
+		  <version>1.9.2</version>
+		</dependency>
+		
+		<dependency>
+			<groupId>org.apache.commons</groupId>
+	  		<artifactId>commons-lang3</artifactId>
+	  		<version>3.4</version>
+  		</dependency>
+  		
+  		<dependency>
+		    <groupId>net.sf.saxon</groupId>
+		    <artifactId>Saxon-HE</artifactId>
+		    <version>9.7.0-7</version>
+		</dependency>
+		
+		<dependency>
+            <groupId>org.ansj</groupId>
+            <artifactId>ansj_seg</artifactId>
+            <version>5.0.2</version>
+        </dependency>
+  		
+		</dependencies>
+	<build>
+		<finalName>qrzk</finalName>
+		<plugins>
+			<plugin>
+				<groupId>org.apache.maven.plugins</groupId>
+				<artifactId>maven-compiler-plugin</artifactId>
+				<version>2.3.2</version>
+				<configuration>
+					<source>1.6</source>
+					<target>1.6</target>
+					<encoding>utf8</encoding>
+				</configuration>
+			</plugin>
+		</plugins>
+		<pluginManagement>
+			<plugins>
+				<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on 
+					the Maven build itself. -->
+				<plugin>
+					<groupId>org.eclipse.m2e</groupId>
+					<artifactId>lifecycle-mapping</artifactId>
+					<version>1.0.0</version>
+					<configuration>
+						<lifecycleMappingMetadata>
+							<pluginExecutions>
+								<pluginExecution>
+									<pluginExecutionFilter>
+										<groupId>
+											org.apache.maven.plugins
+										</groupId>
+										<artifactId>
+											maven-compiler-plugin
+										</artifactId>
+										<versionRange>
+											[3.1,)
+										</versionRange>
+										<goals>
+											<goal>compile</goal>
+										</goals>
+									</pluginExecutionFilter>
+									<action>
+										<ignore></ignore>
+									</action>
+								</pluginExecution>
+							</pluginExecutions>
+						</lifecycleMappingMetadata>
+					</configuration>
+				</plugin>
+				<plugin>
+					<groupId>org.mortbay.jetty</groupId>
+					<artifactId>jetty-maven-plugin</artifactId>
+					<configuration>
+						<webApp>
+							<contextPath>/</contextPath>
+						</webApp>
+						<stopKey>qrzk</stopKey>
+						<stopPort>9999</stopPort>
+						<connectors>
+							<connector implementation="org.eclipse.jetty.server.nio.SelectChannelConnector">
+								<port>8090</port>
+								<maxIdleTime>60000</maxIdleTime>
+							</connector>
+						</connectors>
+						<systemProperties>
+						</systemProperties>
+					</configuration>
+				</plugin>
+			</plugins>
+		</pluginManagement>
+	</build>
+</project>

+ 43 - 0
sql/db_add_guid.sql

@@ -0,0 +1,43 @@
+##升级所有的表,添加唯一键:guid,通过UUID()给原来的数据赋值##
+ALTER TABLE `b_attachment` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE b_attachment set guid=UUID();ALTER TABLE `b_attachment` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `b_batch` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE b_batch set guid=UUID();ALTER TABLE `b_batch` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `b_book` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE b_book set guid=UUID();ALTER TABLE `b_book` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `b_course` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE b_course set guid=UUID();ALTER TABLE `b_course` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `b_course_book` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE b_course_book set guid=UUID();ALTER TABLE `b_course_book` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `b_course_question_type` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE b_course_question_type set guid=UUID();ALTER TABLE `b_course_question_type` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `b_question_type` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE b_question_type set guid=UUID();ALTER TABLE `b_question_type` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `qr_oper_log` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE qr_oper_log set guid=UUID();ALTER TABLE `qr_oper_log` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `qr_pager_construct` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE qr_pager_construct set guid=UUID();ALTER TABLE `qr_pager_construct` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `qr_pager_construct_detail` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE qr_pager_construct_detail set guid=UUID();ALTER TABLE `qr_pager_construct_detail` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `qr_pager_construct_qtype` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE qr_pager_construct_qtype set guid=UUID();ALTER TABLE `qr_pager_construct_qtype` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `qr_pager_templet` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE qr_pager_templet set guid=UUID();ALTER TABLE `qr_pager_templet` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `qr_paper` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE qr_paper set guid=UUID();ALTER TABLE `qr_paper` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `qr_paper_batch` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE qr_paper_batch set guid=UUID();ALTER TABLE `qr_paper_batch` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `qr_paper_dbf_paper_info` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE qr_paper_dbf_paper_info set guid=UUID();ALTER TABLE `qr_paper_dbf_paper_info` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `qr_paper_paper_batch` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE qr_paper_paper_batch set guid=UUID();ALTER TABLE `qr_paper_paper_batch` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `qr_paper_rel_dbf_paper_info` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE qr_paper_rel_dbf_paper_info set guid=UUID();ALTER TABLE `qr_paper_rel_dbf_paper_info` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `qr_paper_skeleton2` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE qr_paper_skeleton2 set guid=UUID();ALTER TABLE `qr_paper_skeleton2` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `qr_paper_skeleton2_detail` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE qr_paper_skeleton2_detail set guid=UUID();ALTER TABLE `qr_paper_skeleton2_detail` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `s_code` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE s_code set guid=UUID();ALTER TABLE `s_code` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `s_menu` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE s_menu set guid=UUID();ALTER TABLE `s_menu` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `s_role` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE s_role set guid=UUID();ALTER TABLE `s_role` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `s_role_menu` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE s_role_menu set guid=UUID();ALTER TABLE `s_role_menu` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `s_sys_param` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE s_sys_param set guid=UUID();ALTER TABLE `s_sys_param` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `s_user` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE s_user set guid=UUID();ALTER TABLE `s_user` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `s_user_course` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE s_user_course set guid=UUID();ALTER TABLE `s_user_course` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `s_user_role` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE s_user_role set guid=UUID();ALTER TABLE `s_user_role` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `tk_batch` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE tk_batch set guid=UUID();ALTER TABLE `tk_batch` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `tk_flow_log` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE tk_flow_log set guid=UUID();ALTER TABLE `tk_flow_log` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `tk_learn_center` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE tk_learn_center set guid=UUID();ALTER TABLE `tk_learn_center` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `tk_paper_difficulty_estimate` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE tk_paper_difficulty_estimate set guid=UUID();ALTER TABLE `tk_paper_difficulty_estimate` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `tk_paper_task` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE tk_paper_task set guid=UUID();ALTER TABLE `tk_paper_task` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `tk_teacher_assessment` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE tk_teacher_assessment set guid=UUID();ALTER TABLE `tk_teacher_assessment` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `tk_teacher_assessment_detail` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE tk_teacher_assessment_detail set guid=UUID();ALTER TABLE `tk_teacher_assessment_detail` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `tk_word_history` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE tk_word_history set guid=UUID();ALTER TABLE `tk_word_history` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `zk_import_question_history` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE zk_import_question_history set guid=UUID();ALTER TABLE `zk_import_question_history` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `zk_question` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE zk_question set guid=UUID();ALTER TABLE `zk_question` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `zk_question_attachment` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE zk_question_attachment set guid=UUID();ALTER TABLE `zk_question_attachment` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `zk_question_operation_log` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE zk_question_operation_log set guid=UUID();ALTER TABLE `zk_question_operation_log` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `zk_question_option` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE zk_question_option set guid=UUID();ALTER TABLE `zk_question_option` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `zk_question_option_version` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE zk_question_option_version set guid=UUID();ALTER TABLE `zk_question_option_version` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;
+ALTER TABLE `zk_question_version` ADD COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci UNIQUE;UPDATE zk_question_version set guid=UUID();ALTER TABLE `zk_question_version` MODIFY COLUMN `guid` varchar(40) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL;

Fișier diff suprimat deoarece este prea mare
+ 43 - 0
sql/zk_tk.sql


+ 1189 - 0
sql/zk_tk_table.sql

@@ -0,0 +1,1189 @@
+/*
+ Navicat Premium Data Transfer
+
+ Source Server         : mydb
+ Source Server Type    : MySQL
+ Source Server Version : 50172
+ Source Host           : localhost
+ Source Database       : zk_tk
+
+ Target Server Type    : MySQL
+ Target Server Version : 50172
+ File Encoding         : utf-8
+
+ Date: 02/20/2017 20:53:22 PM
+*/
+
+SET NAMES utf8;
+SET FOREIGN_KEY_CHECKS = 0;
+
+-- ----------------------------
+--  Table structure for `b_attachment`
+-- ----------------------------
+DROP TABLE IF EXISTS `b_attachment`;
+CREATE TABLE `b_attachment` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `original_name` varchar(500) NOT NULL COMMENT '原始文件名',
+  `cur_name` varchar(50) NOT NULL COMMENT '现在文件名',
+  `store_path` varchar(500) NOT NULL COMMENT '物理文件存放路径',
+  `file_length` double NOT NULL COMMENT '文件大小',
+  `status` varchar(20) NOT NULL COMMENT '附件状态:草稿 DRAFT 、正在使用 USING、已删除 DELETEED',
+  `created_time` datetime NOT NULL COMMENT '创建时间',
+  `created_by` int(11) NOT NULL COMMENT '创建人',
+  `updated_time` datetime DEFAULT NULL,
+  `updated_by` int(11) DEFAULT NULL,
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=759 DEFAULT CHARSET=utf8 COMMENT='附件表';
+
+-- ----------------------------
+--  Table structure for `b_batch`
+-- ----------------------------
+DROP TABLE IF EXISTS `b_batch`;
+CREATE TABLE `b_batch` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `code` varchar(30) DEFAULT NULL,
+  `name` varchar(200) DEFAULT NULL,
+  `start_date` varchar(10) DEFAULT NULL,
+  `end_date` varchar(10) DEFAULT NULL,
+  `status` int(11) DEFAULT NULL,
+  `master_id` int(11) DEFAULT NULL COMMENT '负责人id',
+  `remark` varchar(256) DEFAULT NULL,
+  `created_time` datetime DEFAULT NULL,
+  `created_by` int(11) DEFAULT NULL,
+  `updated_time` datetime DEFAULT NULL,
+  `updated_by` int(11) DEFAULT NULL,
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `b_book`
+-- ----------------------------
+DROP TABLE IF EXISTS `b_book`;
+CREATE TABLE `b_book` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `name` varchar(100) NOT NULL,
+  `code` varchar(50) DEFAULT NULL,
+  `editor` varchar(100) NOT NULL,
+  `press` varchar(100) NOT NULL,
+  `version` varchar(50) DEFAULT NULL,
+  `price` decimal(5,2) DEFAULT NULL,
+  `update_date` datetime DEFAULT NULL,
+  `status` int(11) DEFAULT NULL COMMENT '0停用 1启用',
+  `remark` varchar(255) DEFAULT NULL,
+  `chapter_size` int(11) DEFAULT NULL,
+  `enable_date` datetime DEFAULT NULL COMMENT '启用时间',
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=2267 DEFAULT CHARSET=utf8 COMMENT='教材';
+
+-- ----------------------------
+--  Table structure for `b_course`
+-- ----------------------------
+DROP TABLE IF EXISTS `b_course`;
+CREATE TABLE `b_course` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `code` varchar(10) NOT NULL,
+  `code_hubei` varchar(10) DEFAULT NULL,
+  `name` varchar(100) NOT NULL,
+  `score` float DEFAULT NULL,
+  `type` tinyint(1) DEFAULT NULL COMMENT '课程类型:0:省考;1:国考',
+  `remark` varchar(255) DEFAULT NULL,
+  `status` int(11) DEFAULT NULL COMMENT '0停考 1开考',
+  `open_edit` int(255) DEFAULT NULL COMMENT '是否开放编辑,如果为1,表示录入员可以强制修改此课程的所有试题',
+  `update_date` datetime DEFAULT NULL COMMENT '最近更新时间',
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE,
+  UNIQUE KEY `INDEX_B_COURSE_CODE_UNIQUE` (`code`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=1495 DEFAULT CHARSET=utf8 COMMENT='课程';
+
+-- ----------------------------
+--  Table structure for `b_course_book`
+-- ----------------------------
+DROP TABLE IF EXISTS `b_course_book`;
+CREATE TABLE `b_course_book` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `course_id` int(11) NOT NULL,
+  `book_id` int(11) NOT NULL,
+  `enable_date` varchar(10) DEFAULT NULL,
+  `disable_date` varchar(10) DEFAULT NULL,
+  `status` int(11) NOT NULL COMMENT '0停用 1启用 2未使用',
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE,
+  KEY `FK_Reference_21` (`course_id`) USING BTREE,
+  KEY `FK_Reference_22` (`book_id`) USING BTREE,
+  CONSTRAINT `b_course_book_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `b_course` (`id`),
+  CONSTRAINT `b_course_book_ibfk_2` FOREIGN KEY (`book_id`) REFERENCES `b_book` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=439 DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `b_course_question_type`
+-- ----------------------------
+DROP TABLE IF EXISTS `b_course_question_type`;
+CREATE TABLE `b_course_question_type` (
+  `course_id` int(11) DEFAULT NULL,
+  `question_type_id` int(11) DEFAULT NULL,
+  `sort_no` int(11) DEFAULT NULL COMMENT '排序值',
+  `guid` varchar(40) NOT NULL,
+  UNIQUE KEY `guid` (`guid`) USING BTREE,
+  KEY `course_id` (`course_id`) USING BTREE,
+  KEY `question_type_id` (`question_type_id`) USING BTREE,
+  CONSTRAINT `b_course_question_type_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `b_course` (`id`),
+  CONSTRAINT `b_course_question_type_ibfk_2` FOREIGN KEY (`question_type_id`) REFERENCES `b_question_type` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `b_question_type`
+-- ----------------------------
+DROP TABLE IF EXISTS `b_question_type`;
+CREATE TABLE `b_question_type` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `code` varchar(6) DEFAULT NULL,
+  `parent_code` varchar(6) DEFAULT NULL,
+  `name` varchar(100) DEFAULT NULL,
+  `correct_options_num` int(11) DEFAULT '0',
+  `status_code` int(16) DEFAULT NULL COMMENT '0停用 1启用',
+  `remark` varchar(256) DEFAULT NULL,
+  `created_time` datetime DEFAULT NULL,
+  `created_by` int(11) DEFAULT NULL,
+  `updated_time` datetime DEFAULT NULL,
+  `updated_by` int(11) DEFAULT NULL,
+  `default_score` int(11) DEFAULT NULL COMMENT '默认分值',
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE,
+  UNIQUE KEY `name` (`name`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=226 DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `b_skel_cfg`
+-- ----------------------------
+DROP TABLE IF EXISTS `b_skel_cfg`;
+CREATE TABLE `b_skel_cfg` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `course_id` int(11) NOT NULL,
+  `ability1_percent` double(10,2) NOT NULL,
+  `ability2_percent` double(10,2) NOT NULL,
+  `ability3_percent` double(10,2) NOT NULL,
+  `ability4_percent` double(10,2) NOT NULL,
+  `ability_offset` double(10,2) NOT NULL,
+  `estimate_difficulty1_percent` double(10,2) NOT NULL,
+  `estimate_difficulty2_percent` double(10,2) NOT NULL,
+  `estimate_difficulty3_percent` double(10,2) NOT NULL,
+  `estimate_difficulty4_percent` double(10,2) NOT NULL,
+  `estimate_difficulty_offset` double(10,2) NOT NULL,
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE,
+  KEY `b_skel_cfg_course_id` (`course_id`) USING BTREE,
+  CONSTRAINT `b_skel_cfg_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `b_course` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=96 DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `c_message`
+-- ----------------------------
+DROP TABLE IF EXISTS `c_message`;
+CREATE TABLE `c_message` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `sender_id` int(11) NOT NULL COMMENT '发送人',
+  `received_id` int(11) NOT NULL COMMENT '接收人',
+  `create_time` datetime NOT NULL COMMENT '创建时间',
+  `update_time` datetime DEFAULT NULL COMMENT '修改时间',
+  `status` int(11) NOT NULL COMMENT '状态 1-未读 2-已读',
+  `task_id` int(11) NOT NULL COMMENT '任务id',
+  `guid` varchar(40) NOT NULL,
+  `type` int(11) NOT NULL COMMENT '类型 1.任务',
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=50 DEFAULT CHARSET=utf8 COMMENT='消息表';
+
+-- ----------------------------
+--  Table structure for `qr_oper_log`
+-- ----------------------------
+DROP TABLE IF EXISTS `qr_oper_log`;
+CREATE TABLE `qr_oper_log` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `obj_id` int(11) DEFAULT NULL COMMENT '对象主键ID',
+  `obj_type` varchar(50) DEFAULT NULL COMMENT '对象类型,例如PagerConstruct',
+  `oper_code` varchar(50) DEFAULT NULL COMMENT '对象类型',
+  `remark` varchar(500) DEFAULT NULL COMMENT '操作备注',
+  `created_time` datetime DEFAULT NULL,
+  `created_by` int(11) DEFAULT NULL,
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=16441 DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `qr_pager_construct`
+-- ----------------------------
+DROP TABLE IF EXISTS `qr_pager_construct`;
+CREATE TABLE `qr_pager_construct` (
+  `ID` int(11) NOT NULL AUTO_INCREMENT,
+  `task_id` int(11) DEFAULT NULL COMMENT '试卷任务Id',
+  `name` varchar(100) DEFAULT NULL,
+  `skeleton_id` int(11) DEFAULT NULL,
+  `pager_templet_id` int(11) DEFAULT NULL,
+  `resourse` int(11) DEFAULT NULL COMMENT '1智能  2手工',
+  `status` int(11) DEFAULT NULL COMMENT '0草稿  1待审批   2审批通过 3启用',
+  `max_same_count` int(11) DEFAULT '0',
+  `created_time` datetime DEFAULT NULL COMMENT '创建时间',
+  `created_by` int(11) DEFAULT NULL COMMENT '创建人',
+  `updated_time` datetime DEFAULT NULL COMMENT '最近更新时间',
+  `updated_by` int(11) DEFAULT NULL COMMENT '最近更新人',
+  `max_old_count` int(11) DEFAULT '0',
+  `head` varchar(50) DEFAULT NULL COMMENT '试卷的题头信息,例如:2010年10月湖北省高等教育自学考试',
+  `last_paper_word` int(11) DEFAULT NULL COMMENT '最新的Word试卷',
+  `last_answer_word` int(11) DEFAULT NULL COMMENT '最新的Word标准答案',
+  `last_wangping_word` int(255) DEFAULT NULL COMMENT '最新的网评卷Word',
+  `last_tika_word` int(255) DEFAULT NULL COMMENT '最新的题卡Word',
+  `start_time` datetime DEFAULT NULL COMMENT '试卷启用时间',
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`ID`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE,
+  KEY `skeleton_id` (`skeleton_id`) USING BTREE,
+  KEY `pager_templet_id` (`pager_templet_id`) USING BTREE,
+  KEY `task_id` (`task_id`) USING BTREE,
+  KEY `last_paper_word` (`last_paper_word`) USING BTREE,
+  KEY `last_answer_word` (`last_answer_word`) USING BTREE,
+  KEY `last_wangping_word` (`last_wangping_word`) USING BTREE,
+  KEY `last_tika_word` (`last_tika_word`) USING BTREE,
+  CONSTRAINT `qr_pager_construct_ibfk_1` FOREIGN KEY (`skeleton_id`) REFERENCES `qr_paper_skeleton2` (`id`),
+  CONSTRAINT `qr_pager_construct_ibfk_2` FOREIGN KEY (`pager_templet_id`) REFERENCES `qr_pager_templet` (`ID`),
+  CONSTRAINT `qr_pager_construct_ibfk_3` FOREIGN KEY (`task_id`) REFERENCES `tk_paper_task` (`id`),
+  CONSTRAINT `qr_pager_construct_ibfk_4` FOREIGN KEY (`last_paper_word`) REFERENCES `b_attachment` (`id`),
+  CONSTRAINT `qr_pager_construct_ibfk_5` FOREIGN KEY (`last_answer_word`) REFERENCES `b_attachment` (`id`),
+  CONSTRAINT `qr_pager_construct_ibfk_6` FOREIGN KEY (`last_wangping_word`) REFERENCES `b_attachment` (`id`),
+  CONSTRAINT `qr_pager_construct_ibfk_7` FOREIGN KEY (`last_tika_word`) REFERENCES `b_attachment` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `qr_pager_construct_detail`
+-- ----------------------------
+DROP TABLE IF EXISTS `qr_pager_construct_detail`;
+CREATE TABLE `qr_pager_construct_detail` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `pager_construct_id` int(11) DEFAULT NULL,
+  `pager_qtype_id` int(11) DEFAULT NULL,
+  `question_id` int(11) DEFAULT NULL,
+  `sort_no` int(11) DEFAULT NULL,
+  `question_score` double DEFAULT NULL,
+  `created_time` datetime DEFAULT NULL COMMENT '创建时间',
+  `created_by` int(11) DEFAULT NULL COMMENT '创建人',
+  `updated_time` datetime DEFAULT NULL COMMENT '最近更新时间',
+  `updated_by` int(11) DEFAULT NULL COMMENT '最近更新人',
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE,
+  KEY `pager_qtype_id` (`pager_qtype_id`) USING BTREE,
+  CONSTRAINT `qr_pager_construct_detail_ibfk_1` FOREIGN KEY (`pager_qtype_id`) REFERENCES `qr_pager_construct_qtype` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=185 DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `qr_pager_construct_qtype`
+-- ----------------------------
+DROP TABLE IF EXISTS `qr_pager_construct_qtype`;
+CREATE TABLE `qr_pager_construct_qtype` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `pager_construct_id` int(11) DEFAULT NULL,
+  `name` varchar(100) DEFAULT NULL,
+  `question_type_id` int(11) DEFAULT NULL,
+  `sort_no` int(11) DEFAULT NULL,
+  `question_sum` int(11) DEFAULT NULL,
+  `question_scores` double DEFAULT NULL,
+  `created_time` datetime DEFAULT NULL COMMENT '创建时间',
+  `created_by` int(11) DEFAULT NULL COMMENT '创建人',
+  `updated_time` datetime DEFAULT NULL COMMENT '最近更新时间',
+  `updated_by` int(11) DEFAULT NULL COMMENT '最近更新人',
+  `remark` varchar(256) DEFAULT NULL,
+  `score` int(11) DEFAULT NULL,
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE,
+  KEY `pager_construct_id` (`pager_construct_id`) USING BTREE,
+  CONSTRAINT `qr_pager_construct_qtype_ibfk_1` FOREIGN KEY (`pager_construct_id`) REFERENCES `qr_pager_construct` (`ID`)
+) ENGINE=InnoDB AUTO_INCREMENT=25 DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `qr_pager_templet`
+-- ----------------------------
+DROP TABLE IF EXISTS `qr_pager_templet`;
+CREATE TABLE `qr_pager_templet` (
+  `ID` int(11) NOT NULL,
+  `name` varchar(100) DEFAULT NULL,
+  `path` varchar(200) DEFAULT NULL,
+  `xml_content` longtext,
+  `status` int(11) DEFAULT NULL COMMENT '0 停用  1启用',
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`ID`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `qr_paper`
+-- ----------------------------
+DROP TABLE IF EXISTS `qr_paper`;
+CREATE TABLE `qr_paper` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `code` varchar(30) NOT NULL COMMENT '试卷编号',
+  `course_id` int(11) DEFAULT NULL COMMENT '课程id',
+  `course_code` varchar(50) DEFAULT NULL,
+  `course_name` varchar(50) DEFAULT NULL,
+  `book_id` int(11) DEFAULT NULL COMMENT '教材id',
+  `book_name` varchar(100) DEFAULT NULL COMMENT '教材名称',
+  `book_author` varchar(30) CHARACTER SET utf8 COLLATE utf8_bin DEFAULT NULL COMMENT '教材编者',
+  `book_press` varchar(100) DEFAULT NULL COMMENT '教材出版社',
+  `book_press_year` varchar(10) DEFAULT NULL COMMENT '教材版次',
+  `school` varchar(100) DEFAULT NULL COMMENT '试卷出题学校',
+  `status` varchar(20) DEFAULT NULL COMMENT '状态',
+  `is_special_answer_sheet` tinyint(1) DEFAULT NULL,
+  `paper_path` varchar(200) DEFAULT NULL COMMENT '电子试卷地址',
+  `standard_answer_path` varchar(200) DEFAULT NULL COMMENT '标答地址',
+  `answer_sheet_path` varchar(100) DEFAULT NULL COMMENT '提卡地址',
+  `attachments_path` varchar(500) DEFAULT NULL COMMENT '附件地址,多个附件逗号隔开',
+  `pictures_path` varchar(500) DEFAULT NULL COMMENT '图片地址,多个图片逗号隔开',
+  `remark` varchar(200) DEFAULT NULL,
+  `reserved` varchar(100) DEFAULT NULL COMMENT '保留字段',
+  `created_dt` datetime DEFAULT NULL COMMENT '创建时间',
+  `created_by` int(11) DEFAULT NULL COMMENT '创建人',
+  `updated_dt` datetime DEFAULT NULL COMMENT '更新时间',
+  `updated_by` int(11) DEFAULT NULL COMMENT '更新人',
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE,
+  KEY `course_id` (`course_id`) USING BTREE,
+  KEY `book_id` (`book_id`) USING BTREE,
+  CONSTRAINT `qr_paper_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `b_course` (`id`),
+  CONSTRAINT `qr_paper_ibfk_2` FOREIGN KEY (`book_id`) REFERENCES `b_book` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `qr_paper_batch`
+-- ----------------------------
+DROP TABLE IF EXISTS `qr_paper_batch`;
+CREATE TABLE `qr_paper_batch` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `code` varchar(30) DEFAULT NULL COMMENT '批次代码',
+  `type` varchar(30) DEFAULT NULL COMMENT '批次类型:0:毛坯 1:清样 2:启用',
+  `status` varchar(30) DEFAULT NULL COMMENT '批次状态:0:未启动 1:启动 2:完成 3:取消',
+  `start_date` date DEFAULT NULL COMMENT '批次开始日期',
+  `end_date` date DEFAULT NULL COMMENT '批次结束日期',
+  `admin` varchar(100) DEFAULT NULL COMMENT '负责人',
+  `created_by` int(11) DEFAULT NULL,
+  `created_time` datetime DEFAULT NULL,
+  `updated_by` int(11) DEFAULT NULL,
+  `updated_time` datetime DEFAULT NULL,
+  `remark` varchar(256) DEFAULT NULL,
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `qr_paper_dbf_paper_info`
+-- ----------------------------
+DROP TABLE IF EXISTS `qr_paper_dbf_paper_info`;
+CREATE TABLE `qr_paper_dbf_paper_info` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `paper_batch_id` int(11) DEFAULT NULL,
+  `course_code` varchar(11) DEFAULT NULL,
+  `course_name` varchar(50) DEFAULT NULL,
+  `book_name` varchar(100) DEFAULT NULL,
+  `book_author` varchar(30) DEFAULT NULL,
+  `book_press` varchar(100) DEFAULT NULL,
+  `book_press_year` varchar(10) DEFAULT NULL,
+  `related_paper_ids` varchar(100) DEFAULT NULL,
+  `search_keyword` varchar(400) DEFAULT NULL,
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `qr_paper_paper_batch`
+-- ----------------------------
+DROP TABLE IF EXISTS `qr_paper_paper_batch`;
+CREATE TABLE `qr_paper_paper_batch` (
+  `paper_batch_id` int(11) NOT NULL COMMENT '批次id',
+  `paper_id` int(11) DEFAULT NULL COMMENT '试卷id',
+  `is_outbound_scanned` tinyint(1) DEFAULT NULL COMMENT '是否出库扫描',
+  `is_storage_scanned` tinyint(1) DEFAULT NULL COMMENT '是否入库扫描',
+  `is_paper_return` tinyint(1) DEFAULT NULL,
+  `is_standard_answer_return` tinyint(1) DEFAULT NULL,
+  `is_answer_sheet_return` tinyint(1) DEFAULT NULL,
+  `book_id` int(11) DEFAULT NULL COMMENT '教材id',
+  `book_name` varchar(100) DEFAULT NULL,
+  `book_author` varchar(100) DEFAULT NULL,
+  `book_press` varchar(100) DEFAULT NULL,
+  `book_press_year` varchar(10) DEFAULT NULL,
+  `school` varchar(100) DEFAULT NULL,
+  `remark` varchar(200) DEFAULT NULL,
+  `guid` varchar(40) NOT NULL,
+  UNIQUE KEY `guid` (`guid`) USING BTREE,
+  KEY `paper_batch_id` (`paper_batch_id`) USING BTREE,
+  KEY `paper_id` (`paper_id`) USING BTREE,
+  CONSTRAINT `qr_paper_paper_batch_ibfk_1` FOREIGN KEY (`paper_batch_id`) REFERENCES `qr_paper_batch` (`id`),
+  CONSTRAINT `qr_paper_paper_batch_ibfk_2` FOREIGN KEY (`paper_id`) REFERENCES `qr_paper` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `qr_paper_rel_dbf_paper_info`
+-- ----------------------------
+DROP TABLE IF EXISTS `qr_paper_rel_dbf_paper_info`;
+CREATE TABLE `qr_paper_rel_dbf_paper_info` (
+  `dbf_paper_info_id` int(11) NOT NULL,
+  `paper_id` int(11) NOT NULL,
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`dbf_paper_info_id`,`paper_id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `qr_paper_skeleton2`
+-- ----------------------------
+DROP TABLE IF EXISTS `qr_paper_skeleton2`;
+CREATE TABLE `qr_paper_skeleton2` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `task_id` int(11) DEFAULT NULL,
+  `name` varchar(100) NOT NULL COMMENT '蓝图名称',
+  `course_id` int(11) NOT NULL COMMENT '课程ID',
+  `book_id` int(11) NOT NULL COMMENT '教材ID',
+  `chapter_size` int(11) NOT NULL COMMENT '教材章数',
+  `key_chapters` varchar(500) DEFAULT NULL COMMENT '重点章组成的字符串,用逗号“,”隔开,例如:2,3,7',
+  `ques_type_scores` varchar(500) NOT NULL COMMENT '各题型分值组成的字符串,题型与分值用冒号“:”隔开,各个题型分值字符串再用逗号“,”隔开,例如:1:1,2:1,5:10',
+  `status` int(11) NOT NULL COMMENT '状态:  0草稿  1待审批   2审批通过 3启用 4审批拒绝',
+  `remark` varchar(500) DEFAULT NULL COMMENT '备注',
+  `created_time` datetime NOT NULL COMMENT '创建时间',
+  `created_by` int(11) NOT NULL COMMENT '创建人',
+  `updated_time` datetime DEFAULT NULL COMMENT '最近更新时间',
+  `updated_by` int(11) DEFAULT NULL COMMENT '最近更新人',
+  `guid` varchar(40) NOT NULL,
+  `key_template` int(1) DEFAULT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE,
+  KEY `course_id` (`course_id`) USING BTREE,
+  KEY `task_id` (`task_id`) USING BTREE,
+  CONSTRAINT `qr_paper_skeleton2_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `b_course` (`id`),
+  CONSTRAINT `qr_paper_skeleton2_ibfk_2` FOREIGN KEY (`task_id`) REFERENCES `tk_paper_task` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `qr_paper_skeleton2_detail`
+-- ----------------------------
+DROP TABLE IF EXISTS `qr_paper_skeleton2_detail`;
+CREATE TABLE `qr_paper_skeleton2_detail` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `skeleton_id` int(11) NOT NULL COMMENT '新版蓝图表的主键',
+  `ques_type_no` int(11) NOT NULL COMMENT '题型编号,从1开始,对应蓝图里面的题型顺序值',
+  `chapter_no` int(11) NOT NULL COMMENT '章序号值,从1开始',
+  `ques_num` int(11) NOT NULL COMMENT '题量',
+  `estimate_difficulty` int(11) NOT NULL COMMENT '预计难度:A.易;  B.中等偏易;  C.中等偏难;  D.难,对应数字:1,2,3,4,对应code表里面的:QUESTION_DIFFICULTY-10,20,30,40,这样处理是为了简化蓝图管理设计',
+  `ability` int(11) NOT NULL COMMENT '认知层次,即能力要求:I.识记;  II.领会;  III.简单应用;  IV.综合应用,对应数字:1,2,3,4,对应code表里面的:ABILITY-A,B,C,D,这样处理是为了简化蓝图管理设计',
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE,
+  KEY `skeleton_id` (`skeleton_id`) USING BTREE,
+  CONSTRAINT `qr_paper_skeleton2_detail_ibfk_1` FOREIGN KEY (`skeleton_id`) REFERENCES `qr_paper_skeleton2` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=185 DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `s_code`
+-- ----------------------------
+DROP TABLE IF EXISTS `s_code`;
+CREATE TABLE `s_code` (
+  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `item_type` varchar(30) NOT NULL COMMENT '类型',
+  `item_code` varchar(30) NOT NULL COMMENT 'Code',
+  `item_value` varchar(45) NOT NULL COMMENT '显示值',
+  `sequence` int(11) DEFAULT '0' COMMENT '序列号',
+  `status` char(1) NOT NULL COMMENT '状态\\n0 删除\\n1 正常',
+  `organization_id` int(11) DEFAULT '0' COMMENT '部门ID',
+  `created_time` datetime DEFAULT NULL COMMENT '创建时间',
+  `created_by` varchar(20) DEFAULT NULL COMMENT '创建人',
+  `updated_time` datetime DEFAULT NULL COMMENT '更新时间',
+  `updated_by` varchar(20) DEFAULT NULL COMMENT '更新人',
+  `reserve` varchar(45) DEFAULT NULL COMMENT '预留字段',
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=141 DEFAULT CHARSET=utf8 COMMENT='静态参数表';
+
+-- ----------------------------
+--  Table structure for `s_menu`
+-- ----------------------------
+DROP TABLE IF EXISTS `s_menu`;
+CREATE TABLE `s_menu` (
+  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `parent_no` varchar(11) NOT NULL COMMENT '父菜单号',
+  `menu_no` varchar(11) NOT NULL COMMENT '菜单号',
+  `type` char(1) NOT NULL COMMENT '菜单类型',
+  `name` varchar(45) NOT NULL COMMENT '菜单名称',
+  `disp_name` varchar(45) NOT NULL COMMENT '菜单显示名称',
+  `url` varchar(200) DEFAULT '' COMMENT '菜单地址',
+  `image` varchar(200) DEFAULT NULL COMMENT '菜单图片地址',
+  `created_time` datetime DEFAULT NULL COMMENT '创建时间',
+  `created_by` varchar(20) NOT NULL COMMENT '创建人',
+  `updated_time` datetime DEFAULT NULL COMMENT '更新时间',
+  `updated_by` varchar(20) DEFAULT NULL COMMENT '更新人',
+  `status` char(1) NOT NULL COMMENT '删除标记\\n1 删除\\n0 正常',
+  `reserve` varchar(45) DEFAULT NULL COMMENT '备用',
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`,`created_by`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=23 DEFAULT CHARSET=utf8 COMMENT='菜单表';
+
+-- ----------------------------
+--  Table structure for `s_role`
+-- ----------------------------
+DROP TABLE IF EXISTS `s_role`;
+CREATE TABLE `s_role` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `code` varchar(20) DEFAULT NULL,
+  `name` varchar(50) NOT NULL,
+  `remark` varchar(200) DEFAULT NULL,
+  `is_enabled` int(1) DEFAULT NULL,
+  `user_type` int(11) DEFAULT NULL,
+  `role_type` int(11) DEFAULT NULL,
+  `update_date` date DEFAULT NULL,
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=18 DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `s_role_menu`
+-- ----------------------------
+DROP TABLE IF EXISTS `s_role_menu`;
+CREATE TABLE `s_role_menu` (
+  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '主键',
+  `role_id` int(11) NOT NULL COMMENT '角色ID',
+  `menu_no` varchar(11) NOT NULL COMMENT '菜单NO',
+  `type` int(11) DEFAULT NULL COMMENT '状态---1:增加(add)2:删除(del)3:查看(view)4:修改(edit)',
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=513 DEFAULT CHARSET=utf8 COMMENT='角色菜单关系表';
+
+-- ----------------------------
+--  Table structure for `s_sys_param`
+-- ----------------------------
+DROP TABLE IF EXISTS `s_sys_param`;
+CREATE TABLE `s_sys_param` (
+  `PARAM_NAME` varchar(32) NOT NULL,
+  `PARAM_VALUE` varchar(2000) DEFAULT NULL,
+  `VALUE_TYPE` varchar(32) NOT NULL,
+  `PARAM_DESC` varchar(500) DEFAULT NULL,
+  `CREATED_TIME` datetime DEFAULT NULL,
+  `UPDATE_TIME` datetime DEFAULT NULL,
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`PARAM_NAME`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `s_user`
+-- ----------------------------
+DROP TABLE IF EXISTS `s_user`;
+CREATE TABLE `s_user` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `is_enabled` int(11) DEFAULT NULL,
+  `last_login_date` datetime DEFAULT NULL,
+  `name` varchar(50) DEFAULT NULL,
+  `password` varchar(200) NOT NULL,
+  `remark` varchar(255) DEFAULT NULL,
+  `update_date` datetime DEFAULT NULL,
+  `login_name` varchar(50) NOT NULL,
+  `certino` varchar(18) DEFAULT NULL COMMENT '身份证号',
+  `phone` varchar(50) DEFAULT NULL COMMENT '手机',
+  `office_phone` varchar(50) DEFAULT NULL COMMENT '办公电话',
+  `email` varchar(100) DEFAULT NULL,
+  `position` varchar(50) DEFAULT NULL COMMENT '职称',
+  `department` varchar(100) DEFAULT NULL COMMENT '院系',
+  `institute_id` int(11) DEFAULT NULL,
+  `user_type` int(11) DEFAULT '1',
+  `school` varchar(100) DEFAULT NULL COMMENT '单位',
+  `major` varchar(50) DEFAULT NULL COMMENT '专业',
+  `gender` varchar(5) DEFAULT NULL COMMENT '性别',
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=192 DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `s_user_course`
+-- ----------------------------
+DROP TABLE IF EXISTS `s_user_course`;
+CREATE TABLE `s_user_course` (
+  `user_id` int(11) NOT NULL,
+  `course_id` int(11) NOT NULL,
+  `remark` varchar(256) DEFAULT NULL,
+  `created_time` datetime DEFAULT NULL,
+  `created_by` int(11) DEFAULT NULL,
+  `updated_time` datetime DEFAULT NULL,
+  `updated_by` int(11) DEFAULT NULL,
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`user_id`,`course_id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE,
+  KEY `course_id` (`course_id`) USING BTREE,
+  CONSTRAINT `s_user_course_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `s_user` (`id`),
+  CONSTRAINT `s_user_course_ibfk_2` FOREIGN KEY (`course_id`) REFERENCES `b_course` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `s_user_role`
+-- ----------------------------
+DROP TABLE IF EXISTS `s_user_role`;
+CREATE TABLE `s_user_role` (
+  `user_id` int(11) NOT NULL,
+  `role_id` int(11) NOT NULL,
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`user_id`,`role_id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE,
+  CONSTRAINT `s_user_role_ibfk_1` FOREIGN KEY (`user_id`) REFERENCES `s_user` (`id`) ON DELETE CASCADE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `tk_audit_ques_task`
+-- ----------------------------
+DROP TABLE IF EXISTS `tk_audit_ques_task`;
+CREATE TABLE `tk_audit_ques_task` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `batch_id` int(11) NOT NULL,
+  `course_id` int(11) NOT NULL COMMENT '课程Id',
+  `remark` varchar(500) DEFAULT NULL,
+  `plan_start_time` datetime NOT NULL,
+  `plan_end_time` datetime NOT NULL,
+  `real_start_time` datetime DEFAULT NULL,
+  `real_end_time` datetime DEFAULT NULL,
+  `created_by` int(11) NOT NULL,
+  `created_time` datetime NOT NULL,
+  `updated_by` int(11) DEFAULT NULL,
+  `updated_time` datetime DEFAULT NULL,
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE,
+  KEY `tk_audit_ques_task_ibfk_1` (`batch_id`) USING BTREE,
+  KEY `tk_audit_ques_task_ibfk_2` (`course_id`) USING BTREE,
+  CONSTRAINT `tk_audit_ques_task_ibfk_1` FOREIGN KEY (`batch_id`) REFERENCES `tk_batch` (`id`),
+  CONSTRAINT `tk_audit_ques_task_ibfk_2` FOREIGN KEY (`course_id`) REFERENCES `b_course` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='审题任务表';
+
+-- ----------------------------
+--  Table structure for `tk_audit_ques_task_user_link`
+-- ----------------------------
+DROP TABLE IF EXISTS `tk_audit_ques_task_user_link`;
+CREATE TABLE `tk_audit_ques_task_user_link` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `audit_ques_task_id` int(11) NOT NULL COMMENT '审题任务Id',
+  `auditor_id` int(11) NOT NULL COMMENT '审核人员Id',
+  PRIMARY KEY (`id`),
+  KEY `tk_audit_ques_task_user_ibfk_1` (`audit_ques_task_id`) USING BTREE,
+  KEY `tk_audit_ques_task_user_ibfk_2` (`auditor_id`) USING BTREE,
+  CONSTRAINT `tk_audit_ques_task_user_link_ibfk_1` FOREIGN KEY (`audit_ques_task_id`) REFERENCES `tk_audit_ques_task` (`id`),
+  CONSTRAINT `tk_audit_ques_task_user_link_ibfk_2` FOREIGN KEY (`auditor_id`) REFERENCES `s_user` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COMMENT='审题任务课程关联用户表';
+
+-- ----------------------------
+--  Table structure for `tk_batch`
+-- ----------------------------
+DROP TABLE IF EXISTS `tk_batch`;
+CREATE TABLE `tk_batch` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `name` varchar(100) NOT NULL COMMENT '批次名称',
+  `plan_start_time` datetime NOT NULL COMMENT '计划开工时间',
+  `plan_end_time` datetime NOT NULL COMMENT '计划结束时间',
+  `created_by` int(11) NOT NULL COMMENT '创建人',
+  `created_time` datetime NOT NULL COMMENT '创建时间',
+  `updated_by` int(11) DEFAULT NULL COMMENT '最近修改人',
+  `updated_time` datetime DEFAULT NULL COMMENT '最近修改时间',
+  `batch_type` varchar(100) DEFAULT NULL COMMENT '批次类型',
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=62 DEFAULT CHARSET=utf8 COMMENT='任务批次表';
+
+-- ----------------------------
+--  Table structure for `tk_flow_log`
+-- ----------------------------
+DROP TABLE IF EXISTS `tk_flow_log`;
+CREATE TABLE `tk_flow_log` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `task_id` int(11) NOT NULL COMMENT '任务主键ID',
+  `task_type` varchar(50) NOT NULL COMMENT '任务类型',
+  `oper_name` varchar(100) NOT NULL,
+  `remark` varchar(1000) DEFAULT NULL COMMENT '备注',
+  `atts` varchar(200) DEFAULT NULL COMMENT '附件ID数组',
+  `created_time` datetime NOT NULL COMMENT '创建时间',
+  `created_by` int(11) NOT NULL COMMENT '创建人',
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=542 DEFAULT CHARSET=utf8 COMMENT='流程日志表';
+
+-- ----------------------------
+--  Table structure for `tk_input_ques_task`
+-- ----------------------------
+DROP TABLE IF EXISTS `tk_input_ques_task`;
+CREATE TABLE `tk_input_ques_task` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `batch_id` int(11) NOT NULL,
+  `course_id` int(11) NOT NULL COMMENT '课程Id',
+  `remark` varchar(500) DEFAULT NULL,
+  `plan_start_time` datetime NOT NULL,
+  `plan_end_time` datetime NOT NULL,
+  `real_start_time` datetime DEFAULT NULL,
+  `real_end_time` datetime DEFAULT NULL,
+  `created_by` int(11) NOT NULL,
+  `created_time` datetime NOT NULL,
+  `updated_by` int(11) DEFAULT NULL,
+  `updated_time` datetime DEFAULT NULL,
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE,
+  KEY `tk_input_ques_task_ibfk_1` (`batch_id`) USING BTREE,
+  KEY `tk_input_ques_task_ibfk_2` (`course_id`) USING BTREE,
+  CONSTRAINT `tk_input_ques_task_ibfk_1` FOREIGN KEY (`batch_id`) REFERENCES `tk_batch` (`id`),
+  CONSTRAINT `tk_input_ques_task_ibfk_2` FOREIGN KEY (`course_id`) REFERENCES `b_course` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='录题任务表';
+
+-- ----------------------------
+--  Table structure for `tk_input_ques_task_user_link`
+-- ----------------------------
+DROP TABLE IF EXISTS `tk_input_ques_task_user_link`;
+CREATE TABLE `tk_input_ques_task_user_link` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `input_ques_task_id` int(11) NOT NULL COMMENT '录题任务Id',
+  `inputer_id` int(11) NOT NULL COMMENT '录入员Id',
+  PRIMARY KEY (`id`),
+  KEY `tk_input_ques_task_user_link_ibfk_1` (`input_ques_task_id`) USING BTREE,
+  KEY `tk_input_ques_task_user_link_ibfk_2` (`inputer_id`) USING BTREE,
+  CONSTRAINT `tk_input_ques_task_user_link_ibfk_1` FOREIGN KEY (`input_ques_task_id`) REFERENCES `tk_input_ques_task` (`id`),
+  CONSTRAINT `tk_input_ques_task_user_link_ibfk_2` FOREIGN KEY (`inputer_id`) REFERENCES `s_user` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8 COMMENT='录题任务课程关联用户表';
+
+-- ----------------------------
+--  Table structure for `tk_learn_center`
+-- ----------------------------
+DROP TABLE IF EXISTS `tk_learn_center`;
+CREATE TABLE `tk_learn_center` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `category_code` varchar(60) DEFAULT NULL,
+  `category_name` varchar(90) DEFAULT NULL,
+  `html_content` text,
+  `attachment_id` varchar(300) DEFAULT NULL,
+  `course_code` varchar(30) DEFAULT NULL,
+  `keyword` varchar(300) DEFAULT NULL,
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=22 DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `tk_paper_difficulty_estimate`
+-- ----------------------------
+DROP TABLE IF EXISTS `tk_paper_difficulty_estimate`;
+CREATE TABLE `tk_paper_difficulty_estimate` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `paper_id` int(11) DEFAULT NULL,
+  `sort_no` int(11) DEFAULT NULL,
+  `question_id` int(11) DEFAULT NULL,
+  `question_type` varchar(100) DEFAULT NULL,
+  `estimate_difficulty` int(11) DEFAULT NULL,
+  `estimate_difficulty_value` float DEFAULT NULL,
+  `question_score` float DEFAULT NULL,
+  `created_time` datetime DEFAULT NULL,
+  `created_by` int(11) DEFAULT NULL,
+  `updated_time` datetime DEFAULT NULL,
+  `updated_by` int(11) DEFAULT NULL,
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=1508 DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `tk_paper_task`
+-- ----------------------------
+DROP TABLE IF EXISTS `tk_paper_task`;
+CREATE TABLE `tk_paper_task` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `task_no` varchar(50) NOT NULL COMMENT '任务单编号',
+  `title` varchar(100) NOT NULL COMMENT '标题',
+  `paper_name` varchar(100) NOT NULL COMMENT '试卷名称',
+  `batch_id` int(11) NOT NULL COMMENT '任务批次',
+  `course_id` int(4) DEFAULT NULL,
+  `book_id` int(4) DEFAULT NULL,
+  `plan_start_time` datetime NOT NULL COMMENT '计划开工时间',
+  `plan_end_time` datetime NOT NULL COMMENT '计划结束时间',
+  `real_start_time` datetime DEFAULT NULL COMMENT '实际开工时间',
+  `real_end_time` datetime DEFAULT NULL COMMENT '实际结束时间',
+  `remark` varchar(1000) DEFAULT NULL COMMENT '备注',
+  `proposition_teacher` int(4) DEFAULT NULL,
+  `audit_teacher` int(11) DEFAULT NULL COMMENT '审题教师',
+  `typesetter` int(11) DEFAULT NULL COMMENT '排版员',
+  `primary_secretary` int(11) DEFAULT NULL COMMENT '主学科秘书',
+  `assistant_secretary` int(4) DEFAULT NULL,
+  `cur_dealer` int(11) DEFAULT NULL COMMENT '当前处理人',
+  `status` varchar(50) DEFAULT NULL COMMENT '状态',
+  `atts` varchar(200) DEFAULT NULL COMMENT '附件ID数组',
+  `created_by` int(11) NOT NULL COMMENT '创建人',
+  `created_time` datetime NOT NULL COMMENT '创建时间',
+  `updated_by` int(11) DEFAULT NULL COMMENT '最近修改人',
+  `updated_time` datetime DEFAULT NULL COMMENT '最近修改时间',
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE,
+  KEY `batch_id` (`batch_id`) USING BTREE,
+  CONSTRAINT `tk_paper_task_ibfk_1` FOREIGN KEY (`batch_id`) REFERENCES `tk_batch` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=83 DEFAULT CHARSET=utf8 COMMENT='试卷任务表';
+
+-- ----------------------------
+--  Table structure for `tk_similar_paper`
+-- ----------------------------
+DROP TABLE IF EXISTS `tk_similar_paper`;
+CREATE TABLE `tk_similar_paper` (
+  `similarPaperNo` varchar(100) DEFAULT NULL,
+  `similarPaperBody` text,
+  `similarity` decimal(10,2) DEFAULT NULL,
+  `guid` varchar(40) DEFAULT NULL,
+  `courseName` varchar(50) DEFAULT NULL,
+  `bookName` varchar(50) DEFAULT NULL,
+  `createdBy` varchar(20) DEFAULT NULL,
+  `createdByName` varchar(50) DEFAULT NULL,
+  `taskId` varchar(50) DEFAULT NULL,
+  `taskNo` varchar(100) DEFAULT NULL,
+  `courseNo` varchar(50) DEFAULT NULL,
+  `id` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `tk_similar_paper_question`
+-- ----------------------------
+DROP TABLE IF EXISTS `tk_similar_paper_question`;
+CREATE TABLE `tk_similar_paper_question` (
+  `similarQuestionId` varchar(100) DEFAULT NULL,
+  `similarity` decimal(10,2) DEFAULT NULL,
+  `guid` varchar(40) DEFAULT NULL,
+  `similarPaperNo` varchar(100) DEFAULT NULL,
+  `id` int(10) DEFAULT NULL,
+  `similarPaperId` varchar(100) DEFAULT NULL,
+  `similarQuestionNo` varchar(100) DEFAULT NULL,
+  `whichQuestion` varchar(10) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `tk_similar_question`
+-- ----------------------------
+DROP TABLE IF EXISTS `tk_similar_question`;
+CREATE TABLE `tk_similar_question` (
+  `similarQuestionNo` varchar(100) DEFAULT NULL,
+  `similarQuestionName` varchar(200) DEFAULT NULL,
+  `similarQuestionBody` text,
+  `similarity` decimal(10,2) DEFAULT NULL,
+  `guid` varchar(40) DEFAULT NULL,
+  `courseName` varchar(50) DEFAULT NULL,
+  `bookName` varchar(50) DEFAULT NULL,
+  `typeName` varchar(50) DEFAULT NULL,
+  `similarQuestionId` varchar(50) DEFAULT NULL,
+  `courseId` int(11) DEFAULT NULL,
+  `courseNo` varchar(50) DEFAULT NULL,
+  `id` int(11) DEFAULT NULL
+) ENGINE=MyISAM DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `tk_teacher_assessment`
+-- ----------------------------
+DROP TABLE IF EXISTS `tk_teacher_assessment`;
+CREATE TABLE `tk_teacher_assessment` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `task_id` int(11) DEFAULT NULL,
+  `teacher_id` int(11) DEFAULT NULL,
+  `score` float DEFAULT NULL,
+  `remark` varchar(600) DEFAULT NULL,
+  `created_by` int(11) DEFAULT NULL,
+  `created_time` datetime DEFAULT NULL,
+  `updated_by` int(11) DEFAULT NULL,
+  `updated_time` datetime DEFAULT NULL,
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=10 DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `tk_teacher_assessment_detail`
+-- ----------------------------
+DROP TABLE IF EXISTS `tk_teacher_assessment_detail`;
+CREATE TABLE `tk_teacher_assessment_detail` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `teacher_assessment_id` int(11) DEFAULT NULL,
+  `assessment_sort_no` int(11) DEFAULT NULL,
+  `score` float DEFAULT NULL,
+  `remark` varchar(600) DEFAULT NULL,
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=235 DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `tk_word_history`
+-- ----------------------------
+DROP TABLE IF EXISTS `tk_word_history`;
+CREATE TABLE `tk_word_history` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `paper_id` int(11) NOT NULL COMMENT '试卷ID',
+  `att_id` int(11) NOT NULL COMMENT '附件ID',
+  `att_type` varchar(50) NOT NULL COMMENT '附件类型,PAPER 试卷Word;ANSWER 答案Word',
+  `created_time` datetime NOT NULL COMMENT '创建时间',
+  `created_by` int(11) NOT NULL COMMENT '创建人',
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE,
+  KEY `paper_id` (`paper_id`) USING BTREE,
+  KEY `att_id` (`att_id`) USING BTREE,
+  CONSTRAINT `tk_word_history_ibfk_1` FOREIGN KEY (`paper_id`) REFERENCES `qr_pager_construct` (`ID`),
+  CONSTRAINT `tk_word_history_ibfk_2` FOREIGN KEY (`att_id`) REFERENCES `b_attachment` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=5 DEFAULT CHARSET=utf8 COMMENT='试卷文档历史记录表(试卷Word、答案Word)';
+
+-- ----------------------------
+--  Table structure for `zk_import_question_history`
+-- ----------------------------
+DROP TABLE IF EXISTS `zk_import_question_history`;
+CREATE TABLE `zk_import_question_history` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `file_name` varchar(200) DEFAULT NULL,
+  `file_id` int(11) DEFAULT NULL COMMENT '关联附件表的id',
+  `question_count` int(11) DEFAULT NULL,
+  `remark` varchar(500) DEFAULT NULL,
+  `import_time` datetime DEFAULT NULL,
+  `import_by` int(11) DEFAULT NULL,
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=57 DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `zk_question`
+-- ----------------------------
+DROP TABLE IF EXISTS `zk_question`;
+CREATE TABLE `zk_question` (
+  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '试题id',
+  `question_no` varchar(50) DEFAULT NULL COMMENT '试题编号',
+  `course_id` int(11) NOT NULL COMMENT '课程id',
+  `type_id` int(11) NOT NULL COMMENT '题型id',
+  `book_id` int(11) DEFAULT NULL COMMENT '教材id',
+  `batch_id` int(11) DEFAULT NULL COMMENT '批次id',
+  `estimate_difficulty_value` double DEFAULT NULL COMMENT '预计难度值',
+  `estimate_difficulty_code` varchar(16) DEFAULT NULL COMMENT '预测难度',
+  `measured_difficulty_value` double DEFAULT NULL COMMENT '实测难度值',
+  `measured_difficulty_code` varchar(16) DEFAULT NULL COMMENT '实测难度',
+  `grade_code` varchar(16) DEFAULT NULL COMMENT '层次',
+  `ability_code` varchar(16) DEFAULT NULL COMMENT '能力要求',
+  `chapter` varchar(16) DEFAULT NULL COMMENT '知识点-章',
+  `section` varchar(16) DEFAULT NULL COMMENT '知识点-节',
+  `item` varchar(16) DEFAULT NULL COMMENT '知识点-目',
+  `page` varchar(16) DEFAULT NULL COMMENT '知识点-页',
+  `score` float DEFAULT NULL COMMENT '满分值',
+  `body_word` mediumblob COMMENT '题干word',
+  `body` longtext COMMENT '题干',
+  `body_summary` mediumtext COMMENT '题干摘要',
+  `answer_word` mediumblob,
+  `answer` longtext COMMENT '答案',
+  `answer_summary` mediumtext COMMENT '答案摘要',
+  `answersheet` longtext,
+  `status_code` varchar(30) DEFAULT '' COMMENT '状态编码',
+  `enable_time` datetime DEFAULT NULL COMMENT '启用时间',
+  `set_time` datetime DEFAULT NULL COMMENT '命题时间',
+  `set_by` int(11) DEFAULT NULL COMMENT '命题教师id',
+  `set_teacher_name` varchar(30) DEFAULT NULL COMMENT '命题教师姓名',
+  `remark` varchar(256) DEFAULT NULL COMMENT '备注',
+  `created_time` datetime DEFAULT NULL COMMENT '创建时间',
+  `created_by` int(11) DEFAULT NULL COMMENT '创建人',
+  `updated_time` datetime DEFAULT NULL COMMENT '最近更新时间',
+  `updated_by` int(11) DEFAULT NULL COMMENT '最近更新人',
+  `version` varchar(20) DEFAULT NULL,
+  `import_id` varchar(20) DEFAULT NULL,
+  `assessment_demand` varchar(16) DEFAULT NULL,
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE,
+  KEY `course_id` (`course_id`) USING BTREE,
+  KEY `type_id` (`type_id`) USING BTREE,
+  CONSTRAINT `zk_question_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `b_course` (`id`),
+  CONSTRAINT `zk_question_ibfk_2` FOREIGN KEY (`type_id`) REFERENCES `b_question_type` (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=26668 DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `zk_question_attachment`
+-- ----------------------------
+DROP TABLE IF EXISTS `zk_question_attachment`;
+CREATE TABLE `zk_question_attachment` (
+  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '附件id',
+  `parent_id` int(11) DEFAULT NULL COMMENT '引用对象id',
+  `parent_type` int(11) DEFAULT NULL COMMENT '引用对象类型: 1题干 2选项 3答案',
+  `extension` varchar(2048) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '附件扩展名',
+  `name` varchar(256) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '附件名',
+  `size` int(11) DEFAULT NULL COMMENT '附件大小',
+  `check_code` varchar(1024) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '校验码',
+  `content` mediumblob COMMENT '附件内容',
+  `created_time` datetime DEFAULT NULL COMMENT '创建时间',
+  `created_by` int(11) DEFAULT NULL COMMENT '创建人',
+  `guid` varchar(40) CHARACTER SET utf8 NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- ----------------------------
+--  Table structure for `zk_question_operation_log`
+-- ----------------------------
+DROP TABLE IF EXISTS `zk_question_operation_log`;
+CREATE TABLE `zk_question_operation_log` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `question_id` int(11) DEFAULT NULL,
+  `operation_code` varchar(30) DEFAULT NULL,
+  `question_version_id` int(11) DEFAULT NULL,
+  `remark` varchar(256) DEFAULT NULL,
+  `created_time` datetime DEFAULT NULL,
+  `created_by` int(11) DEFAULT NULL,
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `zk_question_option`
+-- ----------------------------
+DROP TABLE IF EXISTS `zk_question_option`;
+CREATE TABLE `zk_question_option` (
+  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '选项id',
+  `question_id` int(11) NOT NULL COMMENT '试题id',
+  `option_no` int(11) NOT NULL COMMENT '选项顺序',
+  `is_correct_option` tinyint(1) DEFAULT NULL COMMENT '是否为正确选项',
+  `summary` mediumtext COLLATE utf8_unicode_ci COMMENT '选项内容',
+  `content_word` mediumblob COMMENT '选项word',
+  `content` longtext COLLATE utf8_unicode_ci COMMENT '选项摘要',
+  `created_time` datetime DEFAULT NULL,
+  `created_by` int(11) DEFAULT NULL,
+  `updated_time` datetime DEFAULT NULL,
+  `updated_by` int(11) DEFAULT NULL,
+  `guid` varchar(40) CHARACTER SET utf8 NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB AUTO_INCREMENT=181930 DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- ----------------------------
+--  Table structure for `zk_question_option_version`
+-- ----------------------------
+DROP TABLE IF EXISTS `zk_question_option_version`;
+CREATE TABLE `zk_question_option_version` (
+  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '选项id',
+  `question_id` int(11) NOT NULL COMMENT '试题id',
+  `question_version_id` int(11) NOT NULL COMMENT '试题版本id',
+  `option_no` int(11) NOT NULL COMMENT '选项顺序',
+  `is_correct_option` tinyint(1) DEFAULT NULL COMMENT '是否为正确选项',
+  `content` longtext COLLATE utf8_unicode_ci COMMENT '选项内容',
+  `content_word` mediumblob COMMENT '选项word',
+  `summary` varchar(4096) COLLATE utf8_unicode_ci DEFAULT NULL COMMENT '选项摘要',
+  `created_time` datetime DEFAULT NULL,
+  `created_by` int(11) DEFAULT NULL,
+  `updated_time` datetime DEFAULT NULL,
+  `updated_by` int(11) DEFAULT NULL,
+  `guid` varchar(40) CHARACTER SET utf8 NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE
+) ENGINE=InnoDB DEFAULT CHARSET=utf8 COLLATE=utf8_unicode_ci;
+
+-- ----------------------------
+--  Table structure for `zk_question_pager_times`
+-- ----------------------------
+DROP TABLE IF EXISTS `zk_question_pager_times`;
+CREATE TABLE `zk_question_pager_times` (
+  `id` int(11) NOT NULL AUTO_INCREMENT,
+  `question_id` int(11) DEFAULT NULL,
+  `open_time` datetime DEFAULT NULL,
+  PRIMARY KEY (`id`)
+) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  Table structure for `zk_question_version`
+-- ----------------------------
+DROP TABLE IF EXISTS `zk_question_version`;
+CREATE TABLE `zk_question_version` (
+  `id` int(11) NOT NULL AUTO_INCREMENT COMMENT '试题id',
+  `question_id` int(11) NOT NULL,
+  `question_no` varchar(128) DEFAULT NULL COMMENT '试题编号',
+  `course_id` int(11) NOT NULL COMMENT '课程id',
+  `type_id` int(11) NOT NULL COMMENT '题型id',
+  `book_id` int(11) DEFAULT NULL COMMENT '教材id',
+  `batch_id` int(11) DEFAULT NULL COMMENT '批次id',
+  `estimate_difficulty_code` varchar(16) DEFAULT NULL COMMENT '预测难度',
+  `measured_difficulty_code` varchar(16) DEFAULT NULL COMMENT '实测难度',
+  `grade_code` varchar(16) DEFAULT NULL COMMENT '层次',
+  `ability_code` varchar(16) DEFAULT NULL COMMENT '能力要求',
+  `chapter` varchar(16) DEFAULT NULL COMMENT '知识点-章',
+  `section` varchar(16) DEFAULT NULL COMMENT '知识点-节',
+  `item` varchar(16) DEFAULT NULL COMMENT '知识点-目',
+  `page` varchar(16) DEFAULT NULL COMMENT '知识点-页',
+  `score` float DEFAULT NULL COMMENT '满分值',
+  `body_word` mediumblob,
+  `body` longtext COMMENT '题干',
+  `body_summary` varchar(1024) DEFAULT NULL COMMENT '题干摘要',
+  `answer_word` mediumblob,
+  `answer` longtext COMMENT '答案',
+  `answer_summary` varchar(1024) DEFAULT NULL COMMENT '答案摘要',
+  `status_code` varchar(16) DEFAULT NULL COMMENT '状态编码',
+  `enable_time` datetime DEFAULT NULL COMMENT '启用时间',
+  `set_time` datetime DEFAULT NULL COMMENT '命题时间',
+  `set_by` int(11) DEFAULT NULL COMMENT '命题教师id',
+  `set_teacher_name` varchar(30) DEFAULT NULL COMMENT '命题教师姓名',
+  `remark` varchar(256) DEFAULT NULL COMMENT '备注',
+  `created_time` datetime DEFAULT NULL COMMENT '创建时间',
+  `created_by` int(11) DEFAULT NULL COMMENT '创建人',
+  `version` int(11) NOT NULL,
+  `guid` varchar(40) NOT NULL,
+  PRIMARY KEY (`id`),
+  UNIQUE KEY `guid` (`guid`) USING BTREE,
+  KEY `course_id` (`course_id`) USING BTREE,
+  KEY `type_id` (`type_id`) USING BTREE,
+  CONSTRAINT `zk_question_version_ibfk_1` FOREIGN KEY (`course_id`) REFERENCES `b_course` (`id`),
+  CONSTRAINT `zk_question_version_ibfk_2` FOREIGN KEY (`type_id`) REFERENCES `b_question_type` (`id`)
+) ENGINE=InnoDB DEFAULT CHARSET=utf8;
+
+-- ----------------------------
+--  View structure for `v_question_3year`
+-- ----------------------------
+DROP VIEW IF EXISTS `v_question_3year`;
+CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `v_question_3year` AS select `quest`.`id` AS `id`,`quest`.`question_no` AS `question_no`,`quest`.`course_id` AS `course_id`,`quest`.`type_id` AS `type_id`,`quest`.`book_id` AS `book_id`,`quest`.`batch_id` AS `batch_id`,`quest`.`estimate_difficulty_value` AS `estimate_difficulty_value`,`quest`.`estimate_difficulty_code` AS `estimate_difficulty_code`,`quest`.`measured_difficulty_value` AS `measured_difficulty_value`,`quest`.`measured_difficulty_code` AS `measured_difficulty_code`,`quest`.`grade_code` AS `grade_code`,`quest`.`ability_code` AS `ability_code`,`quest`.`chapter` AS `chapter`,`quest`.`section` AS `section`,`quest`.`item` AS `item`,`quest`.`page` AS `page`,`quest`.`score` AS `score`,`quest`.`status_code` AS `status_code`,`quest`.`enable_time` AS `enable_time`,`quest`.`set_time` AS `set_time`,`quest`.`set_by` AS `set_by`,`quest`.`set_teacher_name` AS `set_teacher_name`,`quest`.`remark` AS `remark`,`quest`.`created_time` AS `created_time`,`quest`.`created_by` AS `created_by`,`quest`.`updated_time` AS `updated_time`,`quest`.`updated_by` AS `updated_by`,`quest`.`version` AS `version`,`quest`.`import_id` AS `import_id`,`quest`.`assessment_demand` AS `assessment_demand` from `zk_question` `quest` where `quest`.`id` in (select `detail`.`question_id` AS `question_id` from (`qr_pager_construct_detail` `detail` left join `qr_pager_construct` `pager` on(((`detail`.`pager_construct_id` = `pager`.`ID`) and (`pager`.`status` = 3) and (`pager`.`start_time` >= (curdate() + interval (-(3) * 365) day))))));
+
+-- ----------------------------
+--  View structure for `v_question_all`
+-- ----------------------------
+DROP VIEW IF EXISTS `v_question_all`;
+CREATE ALGORITHM=UNDEFINED DEFINER=`root`@`%` SQL SECURITY DEFINER VIEW `v_question_all` AS select `quest`.`id` AS `id`,`quest`.`question_no` AS `question_no`,`quest`.`course_id` AS `course_id`,`quest`.`type_id` AS `type_id`,`quest`.`book_id` AS `book_id`,`quest`.`batch_id` AS `batch_id`,`quest`.`estimate_difficulty_value` AS `estimate_difficulty_value`,`quest`.`estimate_difficulty_code` AS `estimate_difficulty_code`,`quest`.`measured_difficulty_value` AS `measured_difficulty_value`,`quest`.`measured_difficulty_code` AS `measured_difficulty_code`,`quest`.`grade_code` AS `grade_code`,`quest`.`ability_code` AS `ability_code`,`quest`.`chapter` AS `chapter`,`quest`.`section` AS `section`,`quest`.`item` AS `item`,`quest`.`page` AS `page`,`quest`.`score` AS `score`,`quest`.`status_code` AS `status_code`,`quest`.`enable_time` AS `enable_time`,`quest`.`set_time` AS `set_time`,`quest`.`set_by` AS `set_by`,`quest`.`set_teacher_name` AS `set_teacher_name`,`quest`.`remark` AS `remark`,`quest`.`created_time` AS `created_time`,`quest`.`created_by` AS `created_by`,`quest`.`updated_time` AS `updated_time`,`quest`.`updated_by` AS `updated_by`,`quest`.`version` AS `version`,`quest`.`import_id` AS `import_id`,`quest`.`assessment_demand` AS `assessment_demand` from `zk_question` `quest` where ((not((`quest`.`status_code` like '%REJECTED%'))) and (not(exists(select `detail`.`id`,`detail`.`question_id` from (`qr_pager_construct_detail` `detail` left join `qr_pager_construct` `pager` on((`detail`.`pager_construct_id` = `pager`.`ID`))) where ((`quest`.`id` = `detail`.`question_id`) and ((`pager`.`status` <> 3) or (`pager`.`start_time` <= (curdate() + interval (-(3) * 365) day))))))));
+
+-- ----------------------------
+--  Triggers structure for table zk_question
+-- ----------------------------
+DROP TRIGGER IF EXISTS `insert_question_opentime`;
+delimiter ;;
+CREATE TRIGGER `insert_question_opentime` AFTER INSERT ON `zk_question` FOR EACH ROW begin  
+	if  new.enable_time is not null   then  
+             insert into zk_question_pager_times(question_id,open_time)values(new.id,new.enable_time);
+	end if;  
+end
+ ;;
+delimiter ;
+DROP TRIGGER IF EXISTS `up_question_opentime`;
+delimiter ;;
+CREATE TRIGGER `up_question_opentime` AFTER UPDATE ON `zk_question` FOR EACH ROW begin  
+	if  new.enable_time is not null and  (new.enable_time<>old.enable_time or old.enable_time is  null)   then  
+             insert into zk_question_pager_times(question_id,open_time)values(new.id,new.enable_time);
+	end if;  
+end
+ ;;
+delimiter ;
+
+SET FOREIGN_KEY_CHECKS = 1;

+ 11 - 0
sql/创建视图.sql

@@ -0,0 +1,11 @@
+CREATE 
+VIEW `v_question_3year`AS 
+select `quest`.`id` AS `id`,`quest`.`question_no` AS `question_no`,`quest`.`course_id` AS `course_id`,`quest`.`type_id` AS `type_id`,`quest`.`book_id` AS `book_id`,`quest`.`batch_id` AS `batch_id`,`quest`.`estimate_difficulty_value` AS `estimate_difficulty_value`,`quest`.`estimate_difficulty_code` AS `estimate_difficulty_code`,`quest`.`measured_difficulty_value` AS `measured_difficulty_value`,`quest`.`measured_difficulty_code` AS `measured_difficulty_code`,`quest`.`grade_code` AS `grade_code`,`quest`.`ability_code` AS `ability_code`,`quest`.`chapter` AS `chapter`,`quest`.`section` AS `section`,`quest`.`item` AS `item`,`quest`.`page` AS `page`,`quest`.`score` AS `score`,`quest`.`status_code` AS `status_code`,`quest`.`enable_time` AS `enable_time`,`quest`.`set_time` AS `set_time`,`quest`.`set_by` AS `set_by`,`quest`.`set_teacher_name` AS `set_teacher_name`,`quest`.`remark` AS `remark`,`quest`.`created_time` AS `created_time`,`quest`.`created_by` AS `created_by`,`quest`.`updated_time` AS `updated_time`,`quest`.`updated_by` AS `updated_by`,`quest`.`version` AS `version`,`quest`.`import_id` AS `import_id`,`quest`.`assessment_demand` AS `assessment_demand` from `zk_question` `quest` where `quest`.`id` in (select `detail`.`question_id` AS `question_id` from (`qr_pager_construct_detail` `detail` left join `qr_pager_construct` `pager` on(((`detail`.`pager_construct_id` = `pager`.`ID`) and (`pager`.`status` = 3) and (`pager`.`start_time` >= (curdate() + interval (-(3) * 365) day))))));
+
+CREATE 
+VIEW `v_question_all`AS 
+select `quest`.`id` AS `id`,`quest`.`question_no` AS `question_no`,`quest`.`course_id` AS `course_id`,`quest`.`type_id` AS `type_id`,`quest`.`book_id` AS `book_id`,`quest`.`batch_id` AS `batch_id`,`quest`.`estimate_difficulty_value` AS `estimate_difficulty_value`,`quest`.`estimate_difficulty_code` AS `estimate_difficulty_code`,`quest`.`measured_difficulty_value` AS `measured_difficulty_value`,`quest`.`measured_difficulty_code` AS `measured_difficulty_code`,`quest`.`grade_code` AS `grade_code`,`quest`.`ability_code` AS `ability_code`,`quest`.`chapter` AS `chapter`,`quest`.`section` AS `section`,`quest`.`item` AS `item`,`quest`.`page` AS `page`,`quest`.`score` AS `score`,`quest`.`status_code` AS `status_code`,`quest`.`enable_time` AS `enable_time`,`quest`.`set_time` AS `set_time`,`quest`.`set_by` AS `set_by`,`quest`.`set_teacher_name` AS `set_teacher_name`,`quest`.`remark` AS `remark`,`quest`.`created_time` AS `created_time`,`quest`.`created_by` AS `created_by`,`quest`.`updated_time` AS `updated_time`,`quest`.`updated_by` AS `updated_by`,`quest`.`version` AS `version`,`quest`.`import_id` AS `import_id`,`quest`.`assessment_demand` AS `assessment_demand` from `zk_question` `quest` where ((not((`quest`.`status_code` like '%REJECTED%'))) and (not(exists(select `detail`.`id`,`detail`.`question_id` from (`qr_pager_construct_detail` `detail` left join `qr_pager_construct` `pager` on((`detail`.`pager_construct_id` = `pager`.`ID`))) where ((`quest`.`id` = `detail`.`question_id`) and ((`pager`.`status` <> 3) or (`pager`.`start_time` <= (curdate() + interval (-(3) * 365) day))))))));
+
+CREATE 
+VIEW `v_question_no`AS 
+select `detail`.`id` AS `id`,`detail`.`question_id` AS `question_id` from (`qr_pager_construct_detail` `detail` left join `qr_pager_construct` `pager` on(((`detail`.`pager_construct_id` = `pager`.`ID`) and ((`pager`.`status` <> 3) or (`pager`.`start_time` >= (curdate() + interval (-(3) * 365) day))))));

+ 34 - 0
src/main/java/com/qmth/qrzk/analysis/controller/AnalysisController.java

@@ -0,0 +1,34 @@
+package com.qmth.qrzk.analysis.controller;
+
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpSession;
+
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.servlet.ModelAndView;
+
+@Controller
+public class AnalysisController {
+	private static final String BASE_JSP_PATH = "analysis/";
+	
+	@RequestMapping(value = "/listPapers")
+	public ModelAndView listPapers(HttpServletRequest request, HttpSession session) {
+		return new ModelAndView(BASE_JSP_PATH + "listPapers");
+	}
+	
+	@RequestMapping(value = "/importExamResult")
+	public ModelAndView importExamResult(HttpServletRequest request, HttpSession session) {
+		return new ModelAndView(BASE_JSP_PATH + "importExamResult");
+	}
+	
+	@RequestMapping(value = "/viewExamResult")
+	public ModelAndView viewExamResult(HttpServletRequest request, HttpSession session) {
+		return new ModelAndView(BASE_JSP_PATH + "viewExamResult");
+	}
+	
+	@RequestMapping(value = "/viewPaperAnalysis")
+	public ModelAndView viewPaperAnalysis(HttpServletRequest request, HttpSession session) {
+		return new ModelAndView(BASE_JSP_PATH + "viewPaperAnalysis");
+	}
+	
+}

+ 21 - 0
src/main/java/com/qmth/qrzk/analysis/controller/QrzkConfig.java

@@ -0,0 +1,21 @@
+package com.qmth.qrzk.analysis.controller;
+
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+@Service
+public class QrzkConfig {
+	
+	@Value(value = "${zkfx.login.url}")
+	private String loginUrl;
+
+	public String getLoginUrl() {
+		return loginUrl;
+	}
+
+	public void setLoginUrl(String loginUrl) {
+		this.loginUrl = loginUrl;
+	}
+	
+
+}

+ 51 - 0
src/main/java/com/qmth/qrzk/config/ScoreAnalysisController.java

@@ -0,0 +1,51 @@
+package com.qmth.qrzk.config;
+
+import java.io.IOException;
+
+import javax.servlet.http.HttpServletResponse;
+import javax.servlet.http.HttpSession;
+
+import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Controller;
+import org.springframework.web.bind.annotation.RequestMapping;
+
+import com.qmth.qrzk.analysis.controller.QrzkConfig;
+import com.qmth.qrzk.repository.user.model.User;
+import com.qmth.qrzk.web.controller.BaseAjaxController;
+
+@Controller
+@RequestMapping("/scoreanalysis")
+public class ScoreAnalysisController extends BaseAjaxController {
+	
+	private static final Logger log = Logger.getLogger(ScoreAnalysisController.class);
+	
+	
+	@Autowired
+	QrzkConfig qrzkConfig;
+
+	@RequestMapping("/login")
+	public void getInputTaskCourses(HttpServletResponse response, HttpSession session) {
+		User user = getCurUser(session);
+		log.info("userid:" + user.getId() + "   username:" + user.getName() + " 登录成绩分析系统");
+		response.setContentType("text/html;charset=UTF-8");
+		response.setCharacterEncoding("UTF-8");
+		StringBuilder html = new StringBuilder();
+		html.append("<script language=\"javascript\">window.onload=function(){document.pay_form.submit();}</script>\n");
+		html.append("<form id=\"pay_form\" name=\"pay_form\"  action=\"").append(qrzkConfig.getLoginUrl())
+				.append("\" method=\"get\">\n");
+		html.append("<input type=\"hidden\" name=\"id\"  value=\"" + user.getId() + "\"/>\n"); // 主键id
+		html.append("<input type=\"hidden\" name=\"name\"  value=\"" + user.getName() + "\"/>\n"); // 用户名
+		html.append("<input type=\"hidden\" name=\"username\"  value=\"" + user.getLoginName() + "\"/>\n"); // 登录名
+		html.append("<input type=\"hidden\" name=\"role\"  value=\"qrzk\"/>\n"); // 用户类型
+		html.append("</form>\n");
+		try {
+			response.getWriter().write(html.toString());
+		} catch (IOException e) {
+
+		}
+		response.setStatus(HttpServletResponse.SC_OK);
+	}
+
+
+}

+ 10 - 0
src/main/java/com/qmth/qrzk/dao/ICodeDao.java

@@ -0,0 +1,10 @@
+package com.qmth.qrzk.dao;
+
+import java.util.List;
+
+import com.qmth.qrzk.repository.user.model.Code;
+
+public interface ICodeDao {
+
+	public List<Code> selectAll();
+}

+ 14 - 0
src/main/java/com/qmth/qrzk/dao/IQuestionAttachmentDao.java

@@ -0,0 +1,14 @@
+package com.qmth.qrzk.dao;
+
+import java.util.List;
+
+import com.qmth.qrzk.repository.user.model.QuestionAttachment;
+
+public interface IQuestionAttachmentDao {
+
+	public int insertAttachement(QuestionAttachment qa);
+	
+	public List<QuestionAttachment> selectByQuestionId(int id);
+	
+	public QuestionAttachment queryById(int id);
+}

+ 42 - 0
src/main/java/com/qmth/qrzk/dao/IQuestionDao.java

@@ -0,0 +1,42 @@
+package com.qmth.qrzk.dao;
+
+import java.util.List;
+
+import com.qmth.qrzk.repository.user.model.Question;
+
+public interface IQuestionDao {
+
+	public int addQuestion(Question question);
+	
+	public List<Question> selectQuestion(Question question,int showCount,int currentPage);
+	
+	public int getCount(Question question);
+	
+	public int importQuestion(Question question);
+	
+	public Question searchById(int id);
+	
+	public void updateQuestion(Question question);
+	
+	public List<Question> generatePaperQuestion(Question question);
+	
+	public int updateStatus(Question question);
+	
+	public int searchAuditCount(Question question,String condition1,String condition2);
+	
+	public List<Question> searchAudit(Question question,int showCount,int currentPage,String condition1,String condition2);
+	
+	public List<Question> findAll();
+	
+	public List<Question> getStatusCount();
+	
+	public int getMaxChapterByCourseId(int courseId);
+	
+	public int getCountByCondition(Question question);
+	
+	public int getCountByChapter(Question question);
+	
+	public List<Question> findRecent3YearQues(Question question);
+
+	public List<Question> queryQuestionKeyTJ(Question question);
+}

+ 17 - 0
src/main/java/com/qmth/qrzk/dao/IQuestionImportHistoryDao.java

@@ -0,0 +1,17 @@
+package com.qmth.qrzk.dao;
+
+import java.util.List;
+
+import com.qmth.qrzk.repository.service.query.QueryParams;
+import com.qmth.qrzk.repository.user.model.QuestionImportHistory;
+
+public interface IQuestionImportHistoryDao {
+
+	public int queryByUUId(String id);
+	
+	public void insertQuestionImportHistory(QuestionImportHistory qih);
+	
+	public List<QuestionImportHistory> queryHistories(QueryParams params);
+	
+	public int queryHistoriesCount(QueryParams params);
+}

+ 14 - 0
src/main/java/com/qmth/qrzk/dao/IQuestionOperationLogDao.java

@@ -0,0 +1,14 @@
+package com.qmth.qrzk.dao;
+
+import java.util.List;
+
+import com.qmth.qrzk.repository.user.model.QuestionOperationLog;
+
+public interface IQuestionOperationLogDao {
+
+	public int insert(QuestionOperationLog qol);
+	
+	public List<QuestionOperationLog> query(QuestionOperationLog qol);
+	
+	public List<QuestionOperationLog> queryLogs(int id);
+}

+ 15 - 0
src/main/java/com/qmth/qrzk/dao/IQuestionOptionDao.java

@@ -0,0 +1,15 @@
+package com.qmth.qrzk.dao;
+
+import java.util.List;
+
+import com.qmth.qrzk.repository.user.model.QuestionOption;
+
+public interface IQuestionOptionDao {
+	public int insertOption(QuestionOption qo);
+	
+	public List<QuestionOption> selectByQuestionId(int question_id);
+	
+	public int deleteById(int id);
+	
+	public int updateOption(QuestionOption qo);
+}

+ 19 - 0
src/main/java/com/qmth/qrzk/dao/IQuestionPagerTimesDao.java

@@ -0,0 +1,19 @@
+package com.qmth.qrzk.dao;
+
+import java.util.List;
+
+import com.qmth.qrzk.repository.user.model.QuestionPagerTimes;
+/**
+ * 试题启用时间日志接口
+ * 
+ * @author sunrao
+ *
+ */
+public interface IQuestionPagerTimesDao {
+
+	public int insert(QuestionPagerTimes qol);
+	
+	public List<QuestionPagerTimes> query(QuestionPagerTimes qol);
+	
+	public List<QuestionPagerTimes> queryTimesLogs(int id);
+}

+ 36 - 0
src/main/java/com/qmth/qrzk/dao/IQuestionTypeDao.java

@@ -0,0 +1,36 @@
+package com.qmth.qrzk.dao;
+
+import java.util.List;
+
+import com.qmth.qrzk.repository.service.query.QuestionTypeQueryParams;
+import com.qmth.qrzk.repository.user.model.CourseQuestionType;
+import com.qmth.qrzk.repository.user.model.QuestionType;
+
+public interface IQuestionTypeDao {
+
+	public List<QuestionType> findQuestionName(List<Integer> list);
+	
+	public List<CourseQuestionType> findCourseQuestionType(int courseId);
+	
+	public List<QuestionType> queryQuestionTypes(QuestionTypeQueryParams params);
+	
+	public int queryQuestionTypesCount(QuestionTypeQueryParams params);
+	
+	public QuestionType selectById(int id);
+	
+	public List<QuestionType> queryByCourseId(int courseId);
+	
+	public int deleteLink(int courseId);
+	
+	public int addCourseQuestionType(List<CourseQuestionType> list); 
+	
+	public int addCourseLinkQuestionType(CourseQuestionType cq); 
+	
+	public int addQuestionType(QuestionType questionType);
+	
+	public int updateQuestionType(QuestionType questionType);
+	
+	public List<QuestionType> findByName(String name);
+	
+	public int getCount(CourseQuestionType cq);
+}

+ 34 - 0
src/main/java/com/qmth/qrzk/dao/IRoleDao.java

@@ -0,0 +1,34 @@
+package com.qmth.qrzk.dao;
+
+import java.sql.SQLException;
+import java.util.List;
+
+import com.qmth.qrzk.repository.service.query.UserQueryParams;
+import com.qmth.qrzk.repository.user.model.Role;
+import com.qmth.qrzk.repository.user.model.UserRole;
+
+/**
+ * 角色接口,提供一系列的角色增删查改接口
+ * @author zhonghui
+ *
+ */
+public interface IRoleDao {
+	
+	public List<UserRole> selectRoleIdsByUserId(int userId);
+	
+	public List<Role> getRoleIds(List<Integer> ls) throws SQLException;
+	
+	public List<Role> getRolesByUserId(int userId) throws SQLException;
+	
+	public List<Role> getAllRoles(UserQueryParams params) throws SQLException;
+	
+	public int getAllRolesCount(UserQueryParams params);
+	
+	public void insert(UserRole userRole);
+	
+	public void delUserRoleByUserId(int user_id);
+	
+	public List<UserRole> findSECRETARYUserId();
+	
+	public void addLinkRole(List<UserRole> list);
+}

+ 55 - 0
src/main/java/com/qmth/qrzk/dao/IUserDao.java

@@ -0,0 +1,55 @@
+package com.qmth.qrzk.dao;
+
+import java.util.List;
+
+import com.qmth.qrzk.repository.service.query.UserQueryParams;
+import com.qmth.qrzk.repository.user.model.ImportBean;
+import com.qmth.qrzk.repository.user.model.User;
+
+/**
+ * 	用户接口  提供操作用户的方法
+ * @author 钟辉
+ *
+ */
+public interface IUserDao {
+
+	List<User> selectUser(User user) ;
+
+	void updateUser(User user);
+	
+	int updateLastLoginDate(User user);
+	
+	int updatePassword(User user);
+	
+	Integer deleteUser(User poUserTO);
+	
+	public User getLoginUserByUsername(String userName);
+	
+	public int queryNameFromList(List<ImportBean> list);
+	
+	public List<User> queryName(String name);
+	
+	public List<User> getUsersByCourse(List<Integer> ls);
+	
+	public List<User> queryUsers(UserQueryParams params);
+	
+	public int insertUser(User user);
+	
+	public int queryUserName(String name);
+	
+	public int updateStatus(User user);
+	
+	public User findUserById(int id);
+	
+	public int checkPassword(User user);
+	
+	public int insertUserList(List<User> list );
+	
+	/**
+	 * 查询能命题某个课程的的用户,即此用户的角色是“命题教师”或者“审题教师”
+	 * @param courseId 课程ID
+	 * @return
+	 */
+	public List<User> getCanSetByUsers(int courseId);
+	
+}

+ 26 - 0
src/main/java/com/qmth/qrzk/dao/impl/CodeDaoImpl.java

@@ -0,0 +1,26 @@
+package com.qmth.qrzk.dao.impl;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Repository;
+
+import com.qmth.qrzk.dao.ICodeDao;
+import com.qmth.qrzk.repository.common.mapper.CodeMapper;
+import com.qmth.qrzk.repository.user.model.Code;
+
+@Repository("codeDaoImpl")
+public class CodeDaoImpl implements ICodeDao{
+
+	@Autowired
+	@Qualifier("codeMapper")
+	private CodeMapper codeMapper;
+	
+	@Override
+	public List<Code> selectAll() {
+		// TODO Auto-generated method stub
+		return codeMapper.findAllCodes();
+	}
+
+}

+ 37 - 0
src/main/java/com/qmth/qrzk/dao/impl/QuestionAttachmentDaoImpl.java

@@ -0,0 +1,37 @@
+package com.qmth.qrzk.dao.impl;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.qmth.qrzk.dao.IQuestionAttachmentDao;
+import com.qmth.qrzk.repository.common.mapper.QuestionAttachmentMapper;
+import com.qmth.qrzk.repository.user.model.QuestionAttachment;
+
+@Repository("questionAttachmentDaoImpl")
+@Transactional
+public class QuestionAttachmentDaoImpl implements IQuestionAttachmentDao {
+
+	@Autowired
+	@Qualifier("questionAttachmentMapper")
+	private QuestionAttachmentMapper questionAttachmentMapper;
+	@Override
+	public int insertAttachement(QuestionAttachment qa) {
+		// TODO Auto-generated method stub
+		return questionAttachmentMapper.saveAttachment(qa);
+	}
+	@Override
+	public List<QuestionAttachment> selectByQuestionId(int id) {
+		// TODO Auto-generated method stub
+		return questionAttachmentMapper.selectByQuestionId(id);
+	}
+	@Override
+	public QuestionAttachment queryById(int id) {
+		// TODO Auto-generated method stub
+		return questionAttachmentMapper.queryById(id);
+	}
+
+}

+ 118 - 0
src/main/java/com/qmth/qrzk/dao/impl/QuestionDaoImpl.java

@@ -0,0 +1,118 @@
+package com.qmth.qrzk.dao.impl;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.qmth.qrzk.dao.IQuestionDao;
+import com.qmth.qrzk.repository.common.mapper.QuestionMapper;
+import com.qmth.qrzk.repository.user.model.Question;
+
+@Repository("questionDaoImpl")
+@Transactional
+public class QuestionDaoImpl implements IQuestionDao {
+
+	@Autowired
+	@Qualifier("questionMapper")
+	private QuestionMapper questionMapper;
+	
+	@Override
+	public int addQuestion(Question question) {
+		// TODO Auto-generated method stub
+		return questionMapper.saveQuestion(question);
+	}
+
+	@Override
+	public List<Question> selectQuestion(Question question,int showCount,int currentPage) {
+		// TODO Auto-generated method stub
+		return questionMapper.searchByCondition( question, showCount, currentPage);
+	}
+
+	@Override
+	public int getCount(Question question) {
+		// TODO Auto-generated method stub
+		return questionMapper.searchByConditionCount(question);
+	}
+
+	@Override
+	public int importQuestion(Question question) {
+		return questionMapper.importQuestion(question);
+	}
+
+	@Override
+	public Question searchById(int id) {
+		// TODO Auto-generated method stub
+		return questionMapper.searchById(id);
+	}
+
+	@Override
+	public void updateQuestion(Question question) {
+		questionMapper.updateQuestion(question);
+	}
+
+	@Override
+	public List<Question> generatePaperQuestion(Question question) {
+		return questionMapper.generatePaperQuestion(question);
+	}
+
+	@Override
+	public int updateStatus(Question question) {
+		// TODO Auto-generated method stub
+		return questionMapper.updateAudit(question);
+	}
+
+	@Override
+	public int searchAuditCount(Question question, String condition1,
+			String condition2) {
+		// TODO Auto-generated method stub
+		return questionMapper.searchAuditCount(question, condition1, condition2);
+	}
+
+	@Override
+	public List<Question> searchAudit(Question question, int showCount,
+			int currentPage, String condition1, String condition2) {
+		// TODO Auto-generated method stub
+		return questionMapper.searchAudit(question, showCount, currentPage, condition1, condition2);
+	}
+
+	@Override
+	public List<Question> findAll() {
+		// TODO Auto-generated method stub
+		return questionMapper.findAll();
+	}
+
+	@Override
+	public List<Question> getStatusCount() {
+		// TODO Auto-generated method stub
+		return questionMapper.getStatusCount();
+	}
+
+	@Override
+	public int getMaxChapterByCourseId(int courseId) {
+		// TODO Auto-generated method stub
+		return questionMapper.getMaxChapterByCourseId(courseId);
+	}
+
+	@Override
+	public int getCountByCondition(Question question) {
+		// TODO Auto-generated method stub
+		return questionMapper.getCountByCondition(question);
+	}
+
+	@Override
+	public int getCountByChapter(Question question) {
+		// TODO Auto-generated method stub
+		return questionMapper.getCountByChapter(question);
+	}
+	
+	public List<Question> findRecent3YearQues(Question question) {
+		return questionMapper.findRecent3YearQues(question);
+	}
+	
+	public List<Question> queryQuestionKeyTJ(Question question) {
+		return questionMapper.queryQuestionKeyTJ(question);
+	}
+}

+ 48 - 0
src/main/java/com/qmth/qrzk/dao/impl/QuestionImportHistoryDaoImpl.java

@@ -0,0 +1,48 @@
+package com.qmth.qrzk.dao.impl;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.qmth.qrzk.dao.IQuestionImportHistoryDao;
+import com.qmth.qrzk.repository.common.mapper.QuestionImportHistoryMapper;
+import com.qmth.qrzk.repository.service.query.QueryParams;
+import com.qmth.qrzk.repository.user.model.QuestionImportHistory;
+
+@Repository("questionImportHistoryDaoImpl")
+@Transactional
+public class QuestionImportHistoryDaoImpl implements IQuestionImportHistoryDao {
+
+	@Autowired
+	@Qualifier("questionImportHistoryMapper")
+	private QuestionImportHistoryMapper questionImportHistoryMapper;
+	
+	@Override
+	public int queryByUUId(String id) {
+		// TODO Auto-generated method stub
+		return questionImportHistoryMapper.queryByUUId(id);
+	}
+
+	@Override
+	public void insertQuestionImportHistory(QuestionImportHistory qih) {
+		// TODO Auto-generated method stub
+		questionImportHistoryMapper.insertQuestionImportHistor(qih);
+	}
+
+	@Override
+	public List<QuestionImportHistory> queryHistories(QueryParams params) {
+		// TODO Auto-generated method stub
+		return questionImportHistoryMapper.queryHistories(params);
+	}
+
+	@Override
+	public int queryHistoriesCount(QueryParams params) {
+		// TODO Auto-generated method stub
+		return questionImportHistoryMapper.queryHistoriesCount(params);
+	}
+
+	
+}

+ 39 - 0
src/main/java/com/qmth/qrzk/dao/impl/QuestionOperationLogDaoImpl.java

@@ -0,0 +1,39 @@
+package com.qmth.qrzk.dao.impl;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.qmth.qrzk.dao.IQuestionOperationLogDao;
+import com.qmth.qrzk.repository.common.mapper.QuestionOperationLogMapper;
+import com.qmth.qrzk.repository.user.model.QuestionOperationLog;
+
+@Repository("questionOperationLogDaoImpl")
+@Transactional
+public class QuestionOperationLogDaoImpl implements IQuestionOperationLogDao {
+
+	@Autowired
+	@Qualifier("questionOperationLogMapper")
+	private QuestionOperationLogMapper questionOperationLogMapper;
+	
+	@Override
+	public int insert(QuestionOperationLog qol) {
+		return questionOperationLogMapper.saveLog(qol);
+	}
+
+	@Override
+	public List<QuestionOperationLog> query(QuestionOperationLog qol) {
+		// TODO Auto-generated method stub
+		return questionOperationLogMapper.queryIds(qol);
+	}
+
+	@Override
+	public List<QuestionOperationLog> queryLogs(int id) {
+		// TODO Auto-generated method stub
+		return questionOperationLogMapper.queryLogs(id);
+	}
+
+}

+ 46 - 0
src/main/java/com/qmth/qrzk/dao/impl/QuestionOptionDaoImpl.java

@@ -0,0 +1,46 @@
+package com.qmth.qrzk.dao.impl;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.qmth.qrzk.dao.IQuestionOptionDao;
+import com.qmth.qrzk.repository.common.mapper.QuestionOptionMapper;
+import com.qmth.qrzk.repository.user.model.QuestionOption;
+
+@Repository("questionOptionDaoImpl")
+@Transactional
+public class QuestionOptionDaoImpl implements IQuestionOptionDao {
+
+	@Autowired
+	@Qualifier("questionOptionMapper")
+	private QuestionOptionMapper questionOptionMapper;
+	
+	@Override
+	public int insertOption(QuestionOption qo) {
+		// TODO Auto-generated method stub
+		return questionOptionMapper.saveOption(qo);
+	}
+
+	@Override
+	public List<QuestionOption> selectByQuestionId(int question_id) {
+		// TODO Auto-generated method stub
+		return questionOptionMapper.selectByQuestionId(question_id);
+	}
+
+	@Override
+	public int deleteById(int id) {
+		// TODO Auto-generated method stub
+		return questionOptionMapper.deleteById(id);
+	}
+
+	@Override
+	public int updateOption(QuestionOption qo) {
+		// TODO Auto-generated method stub
+		return questionOptionMapper.updateOption(qo);
+	}
+
+}

+ 44 - 0
src/main/java/com/qmth/qrzk/dao/impl/QuestionPagerTimesDaoImpl.java

@@ -0,0 +1,44 @@
+package com.qmth.qrzk.dao.impl;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.qmth.qrzk.dao.IQuestionOperationLogDao;
+import com.qmth.qrzk.dao.IQuestionPagerTimesDao;
+import com.qmth.qrzk.repository.common.mapper.QuestionPagerTimesMapper;
+import com.qmth.qrzk.repository.user.model.QuestionPagerTimes;
+/**
+ * 试题启用日志时间表
+ * @author sunrao
+ *
+ */
+@Repository("questionPagerTimesDaoImpl")
+@Transactional
+public class QuestionPagerTimesDaoImpl implements IQuestionPagerTimesDao {
+
+	@Autowired
+	@Qualifier("questionPagerTimesMapper")
+	private QuestionPagerTimesMapper questionPagerTimesMapper;
+	
+	@Override
+	public int insert(QuestionPagerTimes qol) {
+		return questionPagerTimesMapper.saveLog(qol);
+	}
+
+	@Override
+	public List<QuestionPagerTimes> query(QuestionPagerTimes qol) {
+		// TODO Auto-generated method stub
+		return questionPagerTimesMapper.queryIds(qol);
+	}
+
+	@Override
+	public List<QuestionPagerTimes> queryTimesLogs(int id) {
+		// TODO Auto-generated method stub
+		return questionPagerTimesMapper.queryTimesLogs(id);
+	}
+
+}

+ 117 - 0
src/main/java/com/qmth/qrzk/dao/impl/QuestionTypeDaoImpl.java

@@ -0,0 +1,117 @@
+package com.qmth.qrzk.dao.impl;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.qmth.qrzk.dao.IQuestionTypeDao;
+import com.qmth.qrzk.repository.common.mapper.CourseQuestionTypeMapper;
+import com.qmth.qrzk.repository.common.mapper.QuestionTypeMapper;
+import com.qmth.qrzk.repository.service.query.QuestionTypeQueryParams;
+import com.qmth.qrzk.repository.user.model.CourseQuestionType;
+import com.qmth.qrzk.repository.user.model.QuestionType;
+
+/**
+ * 题型接口实现类
+ * 
+ * @author 钟辉
+ * 
+ */
+@Repository("questionTypeDaoImpl")
+@Transactional
+public class QuestionTypeDaoImpl implements IQuestionTypeDao {
+
+	// 注入questionTypeMapper提供查询数据库
+	@Autowired
+	@Qualifier("questionTypeMapper")
+	private QuestionTypeMapper questionTypeMapper;
+
+	// 注入courseQuestionTypeMapper
+	@Autowired
+	@Qualifier("courseQuestionTypeMapper")
+	private CourseQuestionTypeMapper courseQuestionTypeMapper;
+
+	/**
+	 * 根据传入的对应id集合查询出所有的题型
+	 */
+	@Override
+	public List<QuestionType> findQuestionName(List<Integer> list) {
+		List<QuestionType> ls = questionTypeMapper.findAllByIds(list);
+		return ls;
+	}
+
+	/**
+	 * 根据课程id查询出所有相关联的题型
+	 */
+	@Override
+	public List<CourseQuestionType> findCourseQuestionType(int courseId) {
+		List<CourseQuestionType> list = courseQuestionTypeMapper
+				.findQuestionTypeIds(courseId);
+		return list;
+	}
+
+	@Override
+	public List<QuestionType> queryQuestionTypes(QuestionTypeQueryParams params) {
+		return questionTypeMapper.queryQuestionTypes(params);
+	}
+
+	@Override
+	public int queryQuestionTypesCount(QuestionTypeQueryParams params) {
+		return questionTypeMapper.queryQuestionTypesCount(params);
+	}
+
+	@Override
+	public QuestionType selectById(int id) {
+		// TODO Auto-generated method stub
+		return questionTypeMapper.selectById(id);
+	}
+
+	@Override
+	public List<QuestionType> queryByCourseId(int courseId) {
+		return questionTypeMapper.queryByCourseId(courseId);
+	}
+
+	@Override
+	public int deleteLink(int courseId) {
+		return courseQuestionTypeMapper.deleteLink(courseId);
+	}
+
+	@Override
+	public int addCourseQuestionType(List<CourseQuestionType> list) {
+		// TODO Auto-generated method stub
+		return questionTypeMapper.addCourseQuestionType(list);
+	}
+
+	@Override
+	public int addQuestionType(QuestionType questionType) {
+		// TODO Auto-generated method stub
+		return questionTypeMapper.addQuestionType(questionType);
+	}
+
+	@Override
+	public int updateQuestionType(QuestionType questionType) {
+		// TODO Auto-generated method stub
+		return questionTypeMapper.updateQuestionType(questionType);
+	}
+
+	@Override
+	public List<QuestionType>  findByName(String name) {
+		// TODO Auto-generated method stub
+		return questionTypeMapper.findByName(name);
+	}
+
+	@Override
+	public int getCount(CourseQuestionType cq) {
+		// TODO Auto-generated method stub
+		return courseQuestionTypeMapper.getCount(cq);
+	}
+
+	@Override
+	public int addCourseLinkQuestionType(CourseQuestionType cq) {
+		// TODO Auto-generated method stub
+		return questionTypeMapper.addCourseLinkQuestionType(cq);
+	}
+}

+ 91 - 0
src/main/java/com/qmth/qrzk/dao/impl/RoleDaoImpl.java

@@ -0,0 +1,91 @@
+package com.qmth.qrzk.dao.impl;
+
+import java.sql.SQLException;
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.qmth.qrzk.dao.IRoleDao;
+import com.qmth.qrzk.repository.common.mapper.RoleMapper;
+import com.qmth.qrzk.repository.common.mapper.UserRoleMapper;
+import com.qmth.qrzk.repository.service.query.UserQueryParams;
+import com.qmth.qrzk.repository.user.model.Role;
+import com.qmth.qrzk.repository.user.model.UserRole;
+
+/**
+ * 角色接口的实现类
+ * @author 钟辉
+ *
+ */
+@Repository("roleDaoImpl")
+@Transactional
+public class RoleDaoImpl implements IRoleDao {
+
+	//注入roleMapper提供操作数据库的sql语句
+	@Autowired
+	@Qualifier("roleMapper")
+	private RoleMapper roleMapper;
+	
+	@Autowired
+	@Qualifier("userRoleMapper")
+	private UserRoleMapper userRoleMapper;
+	
+	/**
+	 * 根据用户id从s_user_role表查出所有对应的UserRole对象集合
+	 */
+	@Override
+	public List<UserRole> selectRoleIdsByUserId(int user_id) {
+		return userRoleMapper.findByUserId(user_id);
+	}
+	
+	/**
+	 * 通过角色id集合查询出所有角色集合对象
+	 */
+	@Override
+	public List<Role> getRoleIds(List<Integer> ls) {
+		List<Role> list=roleMapper.getRoleNamesByRoleIds(ls);
+		return list;
+	}
+	@Override
+	public List<Role> getRolesByUserId(int userId) throws SQLException {
+		List<Role> list=roleMapper.getRolesByUserId(userId);
+		return list;
+	}
+
+	@Override
+	public List<Role> getAllRoles(UserQueryParams params) throws SQLException {
+		List<Role> list=roleMapper.getAllRoles(params);
+		return list;
+	}
+
+	@Override
+	public void insert(UserRole userRole) {
+		userRoleMapper.insert(userRole);
+	}
+
+	@Override
+	public void delUserRoleByUserId(int user_id) {
+		userRoleMapper.delUserRoleByUserId(user_id);
+	}
+
+	@Override
+	public List<UserRole> findSECRETARYUserId() {
+		// TODO Auto-generated method stub
+		return userRoleMapper.findSECRETARYUserId();
+	}
+
+	@Override
+	public int getAllRolesCount(UserQueryParams params) {
+		// TODO Auto-generated method stub
+		return roleMapper.getAllRolesCount(params);
+	}
+
+	@Override
+	public void addLinkRole(List<UserRole> list) {
+		// TODO Auto-generated method stub
+		userRoleMapper.addLinkRole(list);
+	}
+}

+ 131 - 0
src/main/java/com/qmth/qrzk/dao/impl/UserDaoImpl.java

@@ -0,0 +1,131 @@
+package com.qmth.qrzk.dao.impl;
+
+import java.util.List;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Repository;
+import org.springframework.transaction.annotation.Transactional;
+
+import com.qmth.qrzk.dao.IUserDao;
+import com.qmth.qrzk.repository.common.mapper.UserMapper;
+import com.qmth.qrzk.repository.service.query.UserQueryParams;
+import com.qmth.qrzk.repository.user.model.ImportBean;
+import com.qmth.qrzk.repository.user.model.User;
+import com.qmth.qrzk.security.LoginDao;
+
+/**
+ * 用户接口的实现类
+ * @author 钟辉
+ *
+ */
+@Repository("userDaoImpl")
+@Transactional
+public class UserDaoImpl implements IUserDao, LoginDao {
+
+	@Autowired
+	@Qualifier("userMapper")
+	private UserMapper userMapper;
+
+	public List<User> selectUser(User user) {
+		if (user == null) {
+			return null;
+		}
+		List<User> userList = userMapper.findUser(user);
+		return userList;
+	}
+
+	@Override
+	public void updateUser(User user) {
+		userMapper.updateUser(user);
+	}
+	@Override
+	public int updateLastLoginDate(User user) {
+		return userMapper.updateLastLoginDate(user);
+	}
+	
+	@Override
+	public int updatePassword(User user) {
+		return userMapper.updatePassword(user);
+	}
+
+	@Override
+	public User getLoginUserByUsername(String userName) {
+		if (userName == null) {
+			return null;
+		}
+		User user = userMapper.findUserByUsername(userName);
+		return user;
+	}
+
+	@Override
+	public Integer deleteUser(User poUserTO)  {
+		// TODO Auto-generated method stub
+		return null;
+	}
+
+	@Override
+	public List<User> getUsersByCourse(List<Integer> ls) {
+		return userMapper.findUserByCourseIds(ls);
+	}
+	
+	@Override
+	public List<User> queryUsers(UserQueryParams params) {
+		return userMapper.queryUsers(params);
+	}
+
+	@Override
+	public int insertUser(User user) {
+		// TODO Auto-generated method stub
+		return userMapper.insertUser(user);
+	}
+
+	@Override
+	public int queryUserName(String name) {
+		// TODO Auto-generated method stub
+		User u=new User(name);
+		return userMapper.checkUserName(u);
+	}
+
+	@Override
+	public int updateStatus(User user) {
+		return userMapper.updateStatus(user);
+	}
+
+	@Override
+	public User findUserById(int id) {
+		// TODO Auto-generated method stub
+		return userMapper.findUserById(id);
+	}
+
+	@Override
+	public int checkPassword(User user) {
+		
+		return userMapper.checkPassword(user);
+	}
+
+	@Override
+	public List<User> getCanSetByUsers(int courseId) {
+		return userMapper.getCanSetByUsers(courseId);
+	}
+
+	@Override
+	public int queryNameFromList(List<ImportBean> list) {
+		// TODO Auto-generated method stub
+		return userMapper.queryNameFromList(list);
+	}
+
+	@Override
+	public int insertUserList(List<User> list) {
+		// TODO Auto-generated method stub
+		return userMapper.insertUserList(list);
+	}
+
+
+	@Override
+	public List<User> queryName(String name) {
+		// TODO Auto-generated method stub
+		return userMapper.queryName(name);
+	}
+
+}

+ 48 - 0
src/main/java/com/qmth/qrzk/repository/common/BaseExcetion.java

@@ -0,0 +1,48 @@
+/* ==================================================================   
+ * $Id: codetemplates.xml,v 1.1 2006/04/24 09:18:57 饶国发 Exp $ 
+ * Created [2014-9-22 下午8:14:39] by 饶国发 
+ * ==================================================================  
+ * qrzk 
+ * ================================================================== 
+ * qrzk  License v1.0  
+ * Copyright (c) Wuhan G-Soft Technology CO.,LTD., 2010-2012 
+ * ================================================================== 
+ * 武汉威鹏科技有限公司拥有该文件的使用、复制、修改和分发的许可权
+ * 如果你想得到更多信息,请访问 <http://www.wptech.net.cn>
+ *
+ * Wuhan WP-Soft Technology CO.,LTD. owns permission to use, copy, modify and 
+ * distribute this documentation.
+ * For more information on qrzk, please 
+ * see <http://www.wptech.net.cn>.  
+ * ================================================================== 
+ */
+
+package com.qmth.qrzk.repository.common;
+
+/**
+ * <p> BaseExcetion.java </p>
+ * <p>
+ * </p>
+ * @author $Author: 饶国发 $
+ * @version $Revision: V5.1 $
+ */
+public class BaseExcetion {
+    String key="";
+    
+    String value="";
+    public String getKey() {
+        return key;
+    }
+    public void setKey(String key) {
+        this.key = key;
+    }
+    public String getValue() {
+        return value;
+    }
+    public void setValue(String value) {
+        this.value = value;
+    }
+    
+}
+
+	

+ 71 - 0
src/main/java/com/qmth/qrzk/repository/common/ListSqlUtil.java

@@ -0,0 +1,71 @@
+package com.qmth.qrzk.repository.common;
+
+import org.josql.Query;
+import org.josql.QueryResults;
+import java.util.*;
+
+/**
+ * <p>Title: ListSqlUtil.java</p>
+ * <p>Description: ListSqlUtil</p>
+ * <p>Copyright: Copyright 2005 COSTMA (SHEN ZHEN) INC.</p>
+ * <p>Company: COSTMA (SHEN ZHEN) INC.</p>
+ * @author <a href="mailto:sunrao@91bi.com">sunrao</a>
+ * @version 1.0
+ */
+
+public class ListSqlUtil {
+    public ListSqlUtil() {
+    }
+
+    /**
+     * 根据SQL查询对像
+     * @param list List
+     * @param sql String
+     * @return List
+     */
+    public static List getList(List list, String sql) {
+        List list_new = new ArrayList();
+        try {
+            Query q = new Query();
+            q.addFunctionHandler(new SqlFuncUtil());//注入方法
+            q.parse(sql);
+            QueryResults qr = q.execute(list);
+            list_new = qr.getResults();
+        } catch (Exception e) {
+            e.printStackTrace();
+            System.out.println("---SQL:ERROR----"+sql);
+        }
+        return list_new;
+    }
+
+    public List getGroup(List list,String sql,String keys) {
+        List listx= new ArrayList();
+        try {
+            Query q = new Query();
+            q.addFunctionHandler(new SqlFuncUtil());//注入方法
+            q.parse(sql);
+            QueryResults qr = q.execute(list);
+            Map m=qr.getGroupByResults();
+            Iterator iter = m.keySet().iterator();
+
+            String[] par=keys.split(",");
+            while (iter.hasNext()) {
+                List key = (List) iter.next();
+                List res = (List) m.get(key);
+                List s=(List)res.get(0);
+                Map mm=new HashMap();
+                for(int i=0;i<par.length;i++){
+                    mm.put(par[i],s.get(i));
+                }
+                listx.add(mm);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return listx;
+    }
+
+    public static void main(String[] args) {
+        ListSqlUtil listsqlutil = new ListSqlUtil();
+    }
+}

+ 57 - 0
src/main/java/com/qmth/qrzk/repository/common/SqlFuncUtil.java

@@ -0,0 +1,57 @@
+package com.qmth.qrzk.repository.common;
+
+import java.util.Map;
+
+import org.apache.taglibs.standard.functions.Functions;
+
+/**
+ *
+ * <p>Title: </p>
+ * <p>Description: 内存对像自定义方法</p>
+ * <p>Copyright: Copyright (c) 2005</p>
+ * <p>Company: </p>
+ *  * @author <a href="mailto:sunrao@91bi.com">sunrao</a>
+ * @author not attributable
+ * @version 1.0
+ */
+public class SqlFuncUtil {
+    public SqlFuncUtil() {
+    }
+
+    public static String getMapValue(Map map, String key) {
+            return map.get(key).toString();
+
+    }
+    public static Float Score_key(String value, String key,String key2) {
+            if(value.indexOf(key)==-1||value.indexOf(key2)==-1){
+               return 0f;
+            }
+            return Float.parseFloat(Functions.substringBefore(Functions.substringAfter(value, key),key2));
+
+    }
+
+
+    public static Float Scores_js(String value, String key,String flag) {
+        try {
+            return Float.parseFloat(Functions.substringBefore(Functions.substringAfter(value, key),";"));
+        } catch (Exception ex) {
+            if(flag!=null&&flag.equals("2"))
+              return Float.parseFloat("99999999");
+            else
+              return Float.parseFloat("0");
+        }
+    }
+
+
+    public  int parseInt(String s){
+        return Integer.parseInt(s);
+    }
+
+    public  float parseFloat(String s){
+        return Float.parseFloat(s);
+    }
+
+    public static void main(String[] args) {
+        SqlFuncUtil sqlfuncutil = new SqlFuncUtil();
+    }
+}

+ 183 - 0
src/main/java/com/qmth/qrzk/repository/common/base/BaseDao.java

@@ -0,0 +1,183 @@
+package com.qmth.qrzk.repository.common.base;
+
+import java.io.Serializable;
+import java.sql.Connection;
+import java.sql.PreparedStatement;
+import java.sql.ResultSet;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.ibatis.mapping.BoundSql;
+import org.apache.ibatis.mapping.MappedStatement;
+import org.apache.ibatis.mapping.ParameterMapping;
+import org.apache.ibatis.session.RowBounds;
+import org.mybatis.spring.MyBatisSystemException;
+import org.mybatis.spring.support.SqlSessionDaoSupport;
+
+import com.qmth.qrzk.repository.service.query.QueryParams;
+import com.qmth.qrzk.repository.utils.General;
+
+public class BaseDao extends SqlSessionDaoSupport{
+	
+	protected final Log logger = LogFactory.getLog(getClass());
+	
+	public int insert(String key, Object obj){
+		return this.getSqlSession().insert(key, obj);
+	}
+	
+	public int update(String key, Object obj){
+		return this.getSqlSession().update(key, obj);
+	}
+	  
+	public int delete(String key, Serializable obj){
+		return this.getSqlSession().delete(key, obj);
+	}
+	
+	public int  delete(String key, Object obj){
+		return this.getSqlSession().delete(key, obj);
+	}
+	
+	@SuppressWarnings("unchecked")
+	public <T> T get(String key, Object param){
+		return (T) this.getSqlSession().selectOne(key, param);
+	}
+	
+
+	public <T> T getObject(String key, Object param){
+		List<T> objList = this.getSqlSession().selectList(key, param);
+		if(objList==null || objList.size()==0){
+			return null;
+		}
+		return objList.get(0);
+	}
+	
+	public <T> List<T> getList(String key) {
+		return this.getSqlSession().selectList(key);
+	}
+	
+	public <T> List<T> getList(String key, Object param) {
+		return this.getSqlSession().selectList(key, param);
+	}
+	
+	public int getCount(String key, Map<String,Object> map){
+		MappedStatement statement = this.getSqlSession().getConfiguration().getMappedStatement(key);
+		BoundSql boundSql = statement.getBoundSql(map);
+		String sql = General.toCountSql(boundSql.getSql());// "SELECT COUNT(1) AS CNT FROM (" + boundSql.getSql() + ") t";
+		List<ParameterMapping> paramMappings = boundSql.getParameterMappings();
+		PreparedStatement ps = null;
+		ResultSet rs = null;
+		int index = 0;
+		Connection conn = null;
+		try {
+			conn = this.getSqlSession().getConnection();
+			ps = conn.prepareStatement(sql);
+			for(ParameterMapping parameterMapping : paramMappings) {
+				Object retObj = map.get(parameterMapping.getProperty());
+				ps.setObject(++index, retObj);
+			}
+			rs = ps.executeQuery();
+			if(rs.next()) return rs.getInt(1);
+		} catch(Exception e){
+			throw new MyBatisSystemException(e);
+		} finally {
+			General.close(rs);
+			General.close(ps);
+		}
+		return 0;
+	}
+	
+	public int getCount(String key, QueryParams param){
+		MappedStatement statement = this.getSqlSession().getConfiguration().getMappedStatement(key);
+		BoundSql boundSql = statement.getBoundSql(param);
+		String sql = General.toCountSql(boundSql.getSql());//"SELECT COUNT(1) AS CNT FROM (" + boundSql.getSql() + ") tt";
+		List<ParameterMapping> paramMappings = boundSql.getParameterMappings();
+		PreparedStatement ps = null;
+		ResultSet rs = null;
+		int index = 0;
+		Connection conn = null;
+		try {
+			conn = this.getSqlSession().getConnection();
+			ps = conn.prepareStatement(sql);
+			for(ParameterMapping parameterMapping : paramMappings) {
+				String getterMethodName = General.getterMethodName(parameterMapping.getProperty());
+				Object retObj = param.getClass().getMethod(getterMethodName, new Class[]{}).invoke(param, new Object[]{});
+				ps.setObject(++index, retObj);
+			}
+			rs = ps.executeQuery();
+			if(rs.next()) return rs.getInt(1);
+		} catch(Exception e){
+			throw new MyBatisSystemException(e);
+		} finally {
+			General.close(rs);
+			General.close(ps);
+//			General.close(conn);
+		}
+		return 0;
+	}
+	
+	/**
+	 * <p>分页查询,分页相关信息和查询条件都封装到在param里面。</p>
+	 * <b>注意:</b>
+	 * <p>
+	 * 1.不支持直接union的SQL语句,例如:select a.* from AAA a union select b.* from BBB b,
+	 * 但支持这样的SQL语句,例如:select c.* from (select a.* from AAA a union select b.* from BBB b) c;
+	 * </p>
+	 * <p>
+	 * 2.不支持直接DISTINCT的SQL语句,例如:select DISTINCT a.* from AAA a,
+	 * 但支持这样的SQL语句:select b.* from (select DISTINCT a.* from AAA a) b
+	 * </p>
+	 * <p>
+	 * 3.暂时不支持直接in list的SQL语句,例如:
+	 * select id,name from s_user where id in
+	 *	&lt;foreach collection="list" item="item" index="index" open="("
+	 *		separator="," close=")">#{item}
+	 *	&lt;/foreach>
+	 * </p>
+	 * @param key
+	 * @param param 继承QueryParams的查询类,分页相关信息和查询条件都在里面
+	 * @return
+	 */
+	public <T> List<T> getPagerList(String key, QueryParams param) {
+		List<T> list = this.getSqlSession().selectList(key, param, new RowBounds(param.getOffset(),param.getRows())); 
+		int totalNum = this.getCount(key,param);
+		param.setTotalNum(totalNum);
+		return list;
+	}
+	
+	/**
+	 * <p>分页查询,分页相关信息在pageInfo里面,查询条件在paramMap里面。</p>
+	 * <b>注意:</b>
+	 * <p>
+	 * 1.不支持直接union的SQL语句,例如:select a.* from AAA a union select b.* from BBB b,
+	 * 但支持这样的SQL语句,例如:select c.* from (select a.* from AAA a union select b.* from BBB b) c;
+	 * </p>
+	 * <p>
+	 * 2.不支持直接DISTINCT的SQL语句,例如:select DISTINCT a.* from AAA a,
+	 * 但支持这样的SQL语句:select b.* from (select DISTINCT a.* from AAA a) b
+	 * </p>
+	 * <p>
+	 * 3.暂时不支持直接in list的SQL语句,例如:
+	 * select id,name from s_user where id in
+	 *	&lt;foreach collection="list" item="item" index="index" open="("
+	 *		separator="," close=")">#{item}
+	 *	&lt;/foreach>
+	 * </p>
+	 * @param key
+	 * @param pageInfo 分页相关信息
+	 * @param paramMap 查询条件
+	 * @return
+	 */
+	public <T> List<T> getPagerList(
+			String key, 
+			QueryParams pageInfo,  
+			Map<String,Object> paramMap){
+		List<T> list = this.getSqlSession().selectList(key, paramMap, 
+				new RowBounds(pageInfo.getOffset(),pageInfo.getRows()));
+		int totalNum = this.getCount(key,paramMap);
+		pageInfo.setTotalNum(totalNum);
+		return list;
+	}
+	
+}

+ 81 - 0
src/main/java/com/qmth/qrzk/repository/common/base/Dialect.java

@@ -0,0 +1,81 @@
+package com.qmth.qrzk.repository.common.base;
+
+public class Dialect {
+	private static final String SQL_END_DELIMITER = ";";
+
+	public static String getLimitString(String dbName, String sql, int offset,int limit) {
+		dbName = dbName.toLowerCase();
+		String limitString = sql;
+		if (dbName.contains("mysql")) {
+			limitString = getMysqlLimitString(sql, offset, limit);
+		} else if (dbName.contains("microsoft sql server")) {
+			limitString = getMssqlLimitString(sql, offset, limit);
+		} else if (dbName.contains("oracle")) {
+			limitString = getOracleLimitString(sql, offset, limit);
+		} else {
+			throw new RuntimeException("当前分页查询功能不支持此数据库:" + dbName);
+		}
+		return limitString;
+	}
+
+	private static String getMysqlLimitString(String sql, int offset, int limit) {
+		sql = trim(sql);
+		StringBuffer sb = new StringBuffer(sql.length() + 20);
+		sb.append(sql);
+		if (offset > 0) {
+			sb.append(" limit ").append(offset).append(',').append(limit);
+		} else {
+			sb.append(" limit ").append(limit);
+		}
+		return sb.toString();
+	}
+
+	private static String getOracleLimitString(String sql, int offset, int limit) {
+		sql = trim(sql);
+		StringBuffer sb = new StringBuffer(sql.length() + 100);
+		if (offset > 0) {
+			sb.append("select * from ( select row_.*, rownum rownum_ from ( ")
+					.append(sql).append(" ) row_ where rownum <= ")
+					.append(offset + limit).append(") where rownum_ > ")
+					.append(offset);
+		} else {
+			sb.append("select * from ( ").append(sql)
+					.append(" ) where rownum <= ").append(limit);
+		}
+		return sb.toString();
+	}
+
+	private static String getMssqlLimitString(String sql, int offset, int limit) {
+		int orderByIndex = sql.toLowerCase().lastIndexOf("order by");
+		if (orderByIndex <= 0) {
+	    	throw new UnsupportedOperationException("must specify 'order by' statement to support limit operation with offset in sql server 2005");  
+	    }
+		String sqlOrderBy = sql.substring(orderByIndex + 8);
+		String sqlRemoveOrderBy = sql.substring(0, orderByIndex);
+		int insertPoint = getSqlAfterSelectInsertPoint(sql);
+		
+		return new StringBuffer(sql.length() + 100).append("with tempPagination as(").append(sqlRemoveOrderBy).insert(
+	    		insertPoint + 23, " ROW_NUMBER() OVER(ORDER BY " + sqlOrderBy + ") as RowNumber,").append(
+	    				") select * from tempPagination where RowNumber between " + (offset + 1) + " and " + (offset + limit)).toString();
+	}
+	
+	private static int getSqlAfterSelectInsertPoint(String sql) {
+		int selectIndex = sql.toLowerCase().indexOf("select");
+		int selectDistinctIndex = sql.toLowerCase().indexOf("select distinct");
+		return selectIndex + (selectDistinctIndex == selectIndex ? 15 : 6);
+	} 
+
+	private static String trim(String sql) {
+		sql = sql.trim();
+		if (sql.endsWith(SQL_END_DELIMITER)) {
+			sql = sql.substring(0,sql.length() - 1 - SQL_END_DELIMITER.length());
+		}
+		return sql;
+	}
+	
+	public static void main(String[] args) {
+		String sql = "select id,course_id from zk_question where 1=1 order by id";
+		String newSql = getMssqlLimitString(sql,0,3);
+		System.out.println(newSql);
+	}
+}

+ 26 - 0
src/main/java/com/qmth/qrzk/repository/common/enumeration/PaperStatusEnum.java

@@ -0,0 +1,26 @@
+package com.qmth.qrzk.repository.common.enumeration;
+
+public enum PaperStatusEnum {
+
+	PAPER_DRAFT("DRAFT","毛坯"),
+	PAPER_FORMAL_REMARK("FORMAL_REMARK","清样标记"),
+	PAPER_FORMAL_STORAGED("FORMAL_STORAGED","清样回库"),
+	PAPER_FORMAL("FORMAL","清样"),
+	PAPER_USED("USED","启用");
+	
+	private String key;
+	private String value;
+	private PaperStatusEnum(String key, String value) {
+		this.key = key;
+		this.value = value;
+	}
+	public String getKey() {
+		return key;
+	}
+	public String getValue() {
+		return value;
+	}
+
+	
+	
+}

+ 30 - 0
src/main/java/com/qmth/qrzk/repository/common/enumeration/QuestionStatusEnum.java

@@ -0,0 +1,30 @@
+package com.qmth.qrzk.repository.common.enumeration;
+
+
+public enum QuestionStatusEnum {
+	QUESTION_DRAFT("QUESTION_DRAFT","草稿"),									//草稿
+	QUESTION_APPROVED("QUESTION_APPROVED","审核通过"),						//初审通过
+	QUESTION_REJECTED("QUESTION_REJECTED","审核不通过"),						//初审不通过
+	QUESTION_FINAL_APPROVED("QUESTION_FINAL_APPROVED","终审通过"),			//终审通过
+	QUESTION_FINAL_REJECTED("QUESTION_FINAL_REJECTED","终审不通过");			//终审不通过
+	
+	private String key;
+	private String value;
+	
+	private QuestionStatusEnum(String key,String value){
+		this.key=key;
+		this.value=value;
+	};
+	
+	private QuestionStatusEnum(){
+		
+	}
+	
+	public String getKey() {
+		return key;
+	}
+
+	public String getValue() {
+		return value;
+	}
+}

+ 20 - 0
src/main/java/com/qmth/qrzk/repository/common/mapper/BookMapper.java

@@ -0,0 +1,20 @@
+package com.qmth.qrzk.repository.common.mapper;
+
+import java.util.List;
+
+import org.springframework.stereotype.Component;
+
+import com.qmth.qrzk.repository.service.query.QueryParams;
+import com.qmth.qrzk.repository.user.model.Book;
+
+@Component("bookMapper")
+public interface BookMapper extends CommonMapper{
+	
+	public List<Book> findBooks(List<Integer> ls);
+	
+	public List<Book> queryBooks(QueryParams params);
+	
+	public int queryBooksCount(QueryParams params);
+	
+	public Book queryById(int id);
+}

+ 14 - 0
src/main/java/com/qmth/qrzk/repository/common/mapper/CodeMapper.java

@@ -0,0 +1,14 @@
+package com.qmth.qrzk.repository.common.mapper;
+
+import java.util.List;
+
+import org.springframework.stereotype.Component;
+
+import com.qmth.qrzk.repository.user.model.Code;
+
+@Component("codeMapper")
+public interface CodeMapper extends CommonMapper{
+
+	public List<Code> findAllCodes();
+	
+}

+ 6 - 0
src/main/java/com/qmth/qrzk/repository/common/mapper/CommonMapper.java

@@ -0,0 +1,6 @@
+package com.qmth.qrzk.repository.common.mapper;
+
+
+public interface CommonMapper {
+
+}

+ 23 - 0
src/main/java/com/qmth/qrzk/repository/common/mapper/CourseMapper.java

@@ -0,0 +1,23 @@
+package com.qmth.qrzk.repository.common.mapper;
+
+import java.util.List;
+
+import org.springframework.stereotype.Component;
+
+import com.qmth.qrzk.repository.service.query.CourseQueryParams;
+import com.qmth.qrzk.repository.user.model.Course;
+
+@Component("courseMapper")
+public interface CourseMapper extends CommonMapper{
+
+	public List<Course> findCouseByCourseId(List<Integer> ls);
+	
+	public List<Course> queryCourses(CourseQueryParams params);
+	
+	public int queryCoursesCount(CourseQueryParams params);
+	
+	public Course findById(int courseId);
+	
+	public List<Course> findCourseByUserId(int userId);
+	
+}

+ 19 - 0
src/main/java/com/qmth/qrzk/repository/common/mapper/CourseQuestionTypeMapper.java

@@ -0,0 +1,19 @@
+package com.qmth.qrzk.repository.common.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Component;
+
+import com.qmth.qrzk.repository.user.model.CourseQuestionType;
+
+
+@Component("courseQuestionTypeMapper")
+public interface CourseQuestionTypeMapper extends CommonMapper{
+
+	public List<CourseQuestionType> findQuestionTypeIds(int courseId);
+	
+	public int deleteLink(@Param("courseId")int courseId);
+	
+	public int getCount(CourseQuestionType cq);
+}

+ 11 - 0
src/main/java/com/qmth/qrzk/repository/common/mapper/PaperCorrigendumMapper.java

@@ -0,0 +1,11 @@
+package com.qmth.qrzk.repository.common.mapper;
+
+import org.springframework.stereotype.Component;
+
+
+@Component("paperCorrigendumMapper")
+public interface PaperCorrigendumMapper extends CommonMapper{
+
+	
+	
+}

+ 27 - 0
src/main/java/com/qmth/qrzk/repository/common/mapper/PaperSimilarityMapper.java

@@ -0,0 +1,27 @@
+package com.qmth.qrzk.repository.common.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Component;
+
+import com.qmth.qrzk.repository.service.query.PaperSimilarityQueryParams;
+import com.qmth.qrzk.repository.user.model.SimilarPaper;
+import com.qmth.qrzk.repository.user.model.SimilarPaperQuestion;
+
+@Component("paperSimilarityMapper")
+public interface PaperSimilarityMapper extends CommonMapper{
+
+	public List<SimilarPaper> queryPaperSimilarity(PaperSimilarityQueryParams params);
+	
+	public int queryPaperSimilarityCount(PaperSimilarityQueryParams params);
+	
+	public int addPaperSimilarity(@Param("list")List<SimilarPaper> list); 
+	
+	public int addPaperQuestionSimilarity(@Param("list")List<SimilarPaperQuestion> list); 
+	
+	public int delAllPaperSimilarity();
+	
+	public int delAllPaperQuestionSimilarity();
+	
+}

+ 17 - 0
src/main/java/com/qmth/qrzk/repository/common/mapper/QuestionAttachmentMapper.java

@@ -0,0 +1,17 @@
+package com.qmth.qrzk.repository.common.mapper;
+
+import java.util.List;
+
+import org.springframework.stereotype.Component;
+
+import com.qmth.qrzk.repository.user.model.QuestionAttachment;
+
+@Component("questionAttachmentMapper")
+public interface QuestionAttachmentMapper extends CommonMapper{
+
+	public int saveAttachment(QuestionAttachment qa);
+	
+	public List<QuestionAttachment> selectByQuestionId(int question_id);
+	
+	public QuestionAttachment queryById(int id);
+}

+ 20 - 0
src/main/java/com/qmth/qrzk/repository/common/mapper/QuestionImportHistoryMapper.java

@@ -0,0 +1,20 @@
+package com.qmth.qrzk.repository.common.mapper;
+
+import java.util.List;
+
+import org.springframework.stereotype.Component;
+
+import com.qmth.qrzk.repository.service.query.QueryParams;
+import com.qmth.qrzk.repository.user.model.QuestionImportHistory;
+
+@Component("questionImportHistoryMapper")
+public interface QuestionImportHistoryMapper extends CommonMapper{
+
+	public int queryByUUId(String uuid);
+	
+	public void insertQuestionImportHistor(QuestionImportHistory qih);
+	
+	public List<QuestionImportHistory> queryHistories(QueryParams params);
+	
+	public int queryHistoriesCount(QueryParams params);
+}

+ 48 - 0
src/main/java/com/qmth/qrzk/repository/common/mapper/QuestionMapper.java

@@ -0,0 +1,48 @@
+package com.qmth.qrzk.repository.common.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Component;
+
+import com.qmth.qrzk.repository.user.model.Question;
+
+@Component("questionMapper")
+public interface QuestionMapper extends CommonMapper {
+
+	public int saveQuestion(Question question);
+	
+	public List<Question> searchByCondition(@Param("question")Question question,@Param("showCount")int showCount,@Param("currentPage")int currentPage);
+	
+	public int searchByConditionCount(Question question);
+	
+	public int importQuestion(Question question);
+	
+	public Question searchById(int id);
+	
+	public void updateQuestion(Question question);
+	
+	public List<Question> generatePaperQuestion(Question question);
+	
+	public int updateAudit(Question question);
+	
+	public int searchAuditCount(@Param("question")Question question,@Param("condition1")String condition1,@Param("condition2")String condition2);
+	
+	public List<Question> searchAudit(@Param("question")Question question,@Param("showCount")int showCount,@Param("currentPage")int currentPage,@Param("condition1")String condition1,@Param("condition2")String condition2);
+	
+	public List<Question> findAll();
+	
+	public List<Question> getStatusCount();
+	
+	public int getMaxChapterByCourseId(int courseId);
+	
+	public int getCountByCondition(Question question);
+	
+	public int getCountByChapter(Question question);
+	
+	public List<Question> searchPaperQuestionForSimilar(@Param("similarPaperNo")String similarPaperNo,@Param("whichQuestion")String whichQuestion);
+	
+	public List<Question> findRecent3YearQues(Question question);
+	
+	public List<Question> queryQuestionKeyTJ(Question question);
+}

+ 16 - 0
src/main/java/com/qmth/qrzk/repository/common/mapper/QuestionOperationLogMapper.java

@@ -0,0 +1,16 @@
+package com.qmth.qrzk.repository.common.mapper;
+
+import java.util.List;
+
+import org.springframework.stereotype.Component;
+
+import com.qmth.qrzk.repository.user.model.QuestionOperationLog;
+
+@Component("questionOperationLogMapper")
+public interface QuestionOperationLogMapper extends CommonMapper {
+	public int saveLog(QuestionOperationLog qol);
+	
+	public List<QuestionOperationLog> queryIds(QuestionOperationLog qol);
+	
+	public List<QuestionOperationLog> queryLogs(int id);
+}

+ 19 - 0
src/main/java/com/qmth/qrzk/repository/common/mapper/QuestionOptionMapper.java

@@ -0,0 +1,19 @@
+package com.qmth.qrzk.repository.common.mapper;
+
+import java.util.List;
+
+import org.springframework.stereotype.Component;
+
+import com.qmth.qrzk.repository.user.model.QuestionOption;
+
+@Component("questionOptionMapper")
+public interface QuestionOptionMapper extends CommonMapper {
+	
+	public int saveOption(QuestionOption qo);
+	
+	public List<QuestionOption> selectByQuestionId(int question_id);
+	
+	public int deleteById(int id);
+	
+	public int updateOption(QuestionOption qo);
+}

+ 16 - 0
src/main/java/com/qmth/qrzk/repository/common/mapper/QuestionPagerTimesMapper.java

@@ -0,0 +1,16 @@
+package com.qmth.qrzk.repository.common.mapper;
+
+import java.util.List;
+
+import org.springframework.stereotype.Component;
+
+import com.qmth.qrzk.repository.user.model.QuestionPagerTimes;
+
+@Component("questionPagerTimesMapper")
+public interface QuestionPagerTimesMapper extends CommonMapper {
+	public int saveLog(QuestionPagerTimes qol);
+	
+	public List<QuestionPagerTimes> queryIds(QuestionPagerTimes qol);
+	
+	public List<QuestionPagerTimes> queryTimesLogs(int id);
+}

+ 22 - 0
src/main/java/com/qmth/qrzk/repository/common/mapper/QuestionSimilarityMapper.java

@@ -0,0 +1,22 @@
+package com.qmth.qrzk.repository.common.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Component;
+
+import com.qmth.qrzk.repository.service.query.QuestionSimilarityQueryParams;
+import com.qmth.qrzk.repository.user.model.SimilarQuestion;
+
+@Component("questionSimilarityMapper")
+public interface QuestionSimilarityMapper extends CommonMapper{
+
+	public List<SimilarQuestion> queryQuestionSimilarity(QuestionSimilarityQueryParams params);
+	
+	public int queryQuestionSimilarityCount(QuestionSimilarityQueryParams params);
+	
+	public int addQuestionSimilarity(@Param("list")List<SimilarQuestion> list); 
+	
+	public int delAllQuestionSimilarity();
+	
+}

+ 35 - 0
src/main/java/com/qmth/qrzk/repository/common/mapper/QuestionTypeMapper.java

@@ -0,0 +1,35 @@
+package com.qmth.qrzk.repository.common.mapper;
+
+import java.util.List;
+
+import org.apache.ibatis.annotations.Param;
+import org.springframework.stereotype.Component;
+
+import com.qmth.qrzk.repository.service.query.QuestionTypeQueryParams;
+import com.qmth.qrzk.repository.user.model.CourseQuestionType;
+import com.qmth.qrzk.repository.user.model.QuestionType;
+
+@Component("questionTypeMapper")
+public interface QuestionTypeMapper extends CommonMapper{
+
+	public 	List<QuestionType> findAllByIds(List<Integer> list);
+	
+	public List<QuestionType> queryQuestionTypes(QuestionTypeQueryParams params);
+	
+	public int queryQuestionTypesCount(QuestionTypeQueryParams params);
+	
+	public QuestionType selectById(int id);
+	
+	public List<QuestionType> queryByCourseId(int courseId);
+	
+	public int addCourseQuestionType(@Param("list")List<CourseQuestionType> list); 
+	
+	public int addCourseLinkQuestionType(CourseQuestionType cq); 
+	
+	public int addQuestionType(QuestionType questionType);
+	
+	
+	public int updateQuestionType(QuestionType questionType);
+	
+	public List<QuestionType> findByName(String name);
+}

+ 28 - 0
src/main/java/com/qmth/qrzk/repository/common/mapper/RoleMapper.java

@@ -0,0 +1,28 @@
+package com.qmth.qrzk.repository.common.mapper;
+
+import java.util.List;
+
+import org.springframework.stereotype.Component;
+
+import com.qmth.qrzk.repository.service.query.UserQueryParams;
+import com.qmth.qrzk.repository.user.model.Role;
+
+
+/**
+ * 角色mapper对应src/main/resources/sqlmap下的role.xml配置文件
+ * @author 钟辉
+ *
+ */
+@Component("roleMapper")
+public interface RoleMapper extends CommonMapper{
+
+	public int[] getRoleIdsByUserId(int userId);
+	
+	public List<Role> getRoleNamesByRoleIds(List<Integer> ls);
+	
+	public List<Role> getRolesByUserId(int userId);
+	
+	public List<Role> getAllRoles(UserQueryParams params);
+	
+	public int getAllRolesCount(UserQueryParams params);
+}

+ 20 - 0
src/main/java/com/qmth/qrzk/repository/common/mapper/TaskBatchMapper.java

@@ -0,0 +1,20 @@
+package com.qmth.qrzk.repository.common.mapper;
+
+import java.util.List;
+
+import org.springframework.stereotype.Component;
+
+import com.qmth.qrzk.repository.task.TaskBatch;
+
+
+@Component("taskBatchMapper")
+public interface TaskBatchMapper extends CommonMapper{
+	
+	public int addTaskBatch(TaskBatch taskBath);
+	
+	public List<TaskBatch> queryTaskBatchs();
+	
+	public int queryTaskBatchsCount();
+	
+	
+}

+ 13 - 0
src/main/java/com/qmth/qrzk/repository/common/mapper/UserCourseMapper.java

@@ -0,0 +1,13 @@
+package com.qmth.qrzk.repository.common.mapper;
+
+import org.springframework.stereotype.Component;
+
+import com.qmth.qrzk.repository.user.model.UserCourse;
+
+@Component("userCourseMapper")
+public interface UserCourseMapper extends CommonMapper{
+	
+	public void insertUserCourse(UserCourse userCourse);
+	
+	public void delByUserId(int user_id);
+}

+ 55 - 0
src/main/java/com/qmth/qrzk/repository/common/mapper/UserMapper.java

@@ -0,0 +1,55 @@
+package com.qmth.qrzk.repository.common.mapper;
+
+import java.util.List;
+
+import org.springframework.stereotype.Component;
+
+import com.qmth.qrzk.repository.service.query.UserQueryParams;
+import com.qmth.qrzk.repository.user.model.ImportBean;
+import com.qmth.qrzk.repository.user.model.User;
+
+/**
+ * 用户mapper对应src/main/resources/sqlmap下的user.xml配置文件
+ * @author 钟辉
+ *
+ */
+@Component("userMapper")
+public interface UserMapper extends CommonMapper{
+	public List<User> findUser(User user);
+	
+	public int updateLastLoginDate(User user);
+	
+	public int updatePassword(User user);
+	
+	public User findUserByUsername(String userName);
+	
+	public List<User> getUserListByPaginationAndSort();
+	
+	public int getUserCount();
+	
+	public List<User> findUserByCourseIds(List<Integer> list);
+	
+	public int insertUserList(List<User> list );
+	
+	public int queryNameFromList(List<ImportBean> list);
+	
+	public List<User> queryName(String name);
+	
+	public List<User> queryUsers(UserQueryParams params);
+	
+	public int queryUsersCount(UserQueryParams params);
+	
+	public int insertUser(User user);
+	
+	public int checkUserName(User user);
+	
+	public int updateStatus(User user);
+	
+	public User findUserById(int id);
+	
+	public void updateUser(User user);
+	
+	public int checkPassword(User user);
+	
+	public List<User> getCanSetByUsers(int courseId);
+}

+ 25 - 0
src/main/java/com/qmth/qrzk/repository/common/mapper/UserRoleMapper.java

@@ -0,0 +1,25 @@
+package com.qmth.qrzk.repository.common.mapper;
+
+import java.util.List;
+
+import org.springframework.stereotype.Component;
+
+import com.qmth.qrzk.repository.user.model.UserRole;
+/**
+ * 用户角色mapper对应src/main/resources/sqlmap下的userRole.xml配置文件
+ * @author 钟辉
+ *
+ */
+@Component("userRoleMapper")
+public interface UserRoleMapper extends CommonMapper{
+
+	public List<UserRole> findByUserId(int user_id);
+	
+	public void insert(UserRole userRole);
+	
+	public void addLinkRole(List<UserRole> list);
+	
+	public void delUserRoleByUserId(int user_id);
+	
+	public List<UserRole> findSECRETARYUserId();
+}

+ 20 - 0
src/main/java/com/qmth/qrzk/repository/constants/WebConstants.java

@@ -0,0 +1,20 @@
+package com.qmth.qrzk.repository.constants;
+
+public class WebConstants {
+
+	public final static String WEB_SESSION_ALLROLES = "web_session_allroles";
+	
+	public final static String WEB_SESSION_ALLSUBJECTS = "web_session_allsubjects";
+	
+	public final static String WEB_SESSION_ALLKNOWLEDGES = "web_session_allknowledges";
+	
+    /**
+     * 在web session中的user
+     */
+    public final static String WEB_SESSION_USER = "web_session_user";
+    public final static String WEB_SESSION_ROLE = "web_session_role";
+    
+    public final static String WEB_SESSION_USER_LAST_LOGIN_DATE = "web_session_user_last_login_date";
+    
+    public final static String PASSWORD_SALT = "";
+}

+ 30 - 0
src/main/java/com/qmth/qrzk/repository/exception/BizException.java

@@ -0,0 +1,30 @@
+package com.qmth.qrzk.repository.exception;
+
+import java.sql.SQLException;
+
+import org.springframework.dao.DataAccessException;
+
+public class BizException extends Exception{
+
+	private static final long serialVersionUID = -4631737414207840876L;
+
+	public BizException(String message){
+		super(message);
+	}
+	
+	public BizException(SQLException e){
+		super(e);
+	}
+	
+	public BizException(DataAccessException e){
+		super(e);
+	}
+	
+	public BizException(Exception e){
+		super(e);
+	}
+	
+	public BizException(String message,Throwable e){
+		super(message, e);
+	}
+}

+ 31 - 0
src/main/java/com/qmth/qrzk/repository/exp/BaseData.java

@@ -0,0 +1,31 @@
+package com.qmth.qrzk.repository.exp;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * 为客户端导出的基础数据的Root类
+ * @author 马涛 2017-07-02
+ *
+ */
+@XmlRootElement
+public class BaseData{
+	private List<Teacher> teachers;
+
+	public List<Teacher> getTeachers() {
+		return teachers;
+	}
+
+	public void setTeachers(List<Teacher> teachers) {
+		this.teachers = teachers;
+	}
+
+	public BaseData() {
+		
+	}
+
+	public BaseData(List<Teacher> teachers) {
+		this.teachers = teachers;
+	}
+}

+ 85 - 0
src/main/java/com/qmth/qrzk/repository/exp/Book.java

@@ -0,0 +1,85 @@
+package com.qmth.qrzk.repository.exp;
+
+import java.util.Date;
+
+public class Book {
+	private String guid;
+	private String name;		//教材名称
+	private String code;		//书号
+	private String editor;		//作者
+	private String press;		//出版社
+	private String version;		//教材版次
+	private Double price;		//定价(元)
+	private Integer chapterSize; //章总数
+	private Date enableDate;	//启用时间
+	public String getGuid() {
+		return guid;
+	}
+	public void setGuid(String guid) {
+		this.guid = guid;
+	}
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public String getCode() {
+		return code;
+	}
+	public void setCode(String code) {
+		this.code = code;
+	}
+	public String getEditor() {
+		return editor;
+	}
+	public void setEditor(String editor) {
+		this.editor = editor;
+	}
+	public String getPress() {
+		return press;
+	}
+	public void setPress(String press) {
+		this.press = press;
+	}
+	public String getVersion() {
+		return version;
+	}
+	public void setVersion(String version) {
+		this.version = version;
+	}
+	public Double getPrice() {
+		return price;
+	}
+	public void setPrice(Double price) {
+		this.price = price;
+	}
+	public Integer getChapterSize() {
+		return chapterSize;
+	}
+	public void setChapterSize(Integer chapterSize) {
+		this.chapterSize = chapterSize;
+	}
+	public Date getEnableDate() {
+		return enableDate;
+	}
+	public void setEnableDate(Date enableDate) {
+		this.enableDate = enableDate;
+	}
+	public Book() {
+		//do nothing
+	}
+	public Book(String guid, String name, String code, String editor,
+			String press, String version, Double price, Integer chapterSize,
+			Date enableDate) {
+		this.guid = guid;
+		this.name = name;
+		this.code = code;
+		this.editor = editor;
+		this.press = press;
+		this.version = version;
+		this.price = price;
+		this.chapterSize = chapterSize;
+		this.enableDate = enableDate;
+	}
+}

+ 53 - 0
src/main/java/com/qmth/qrzk/repository/exp/Course.java

@@ -0,0 +1,53 @@
+package com.qmth.qrzk.repository.exp;
+
+import java.util.List;
+
+public class Course {
+	private String guid;
+	private String code;			//课程代码
+	private String name;			//课程名称
+	private List<CourseBook> courseBooks;
+	private List<String> questionTypeGuids;
+	
+	public String getGuid() {
+		return guid;
+	}
+	public void setGuid(String guid) {
+		this.guid = guid;
+	}
+	public String getCode() {
+		return code;
+	}
+	public void setCode(String code) {
+		this.code = code;
+	}
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public List<CourseBook> getCourseBooks() {
+		return courseBooks;
+	}
+	public void setCourseBooks(List<CourseBook> courseBooks) {
+		this.courseBooks = courseBooks;
+	}
+	public List<String> getQuestionTypeGuids() {
+		return questionTypeGuids;
+	}
+	public void setQuestionTypeGuids(List<String> questionTypeGuids) {
+		this.questionTypeGuids = questionTypeGuids;
+	}
+	public Course() {
+		//do nothing
+	}
+	public Course(String guid, String code, String name,
+			List<CourseBook> courseBooks, List<String> questionTypeGuids) {
+		this.guid = guid;
+		this.code = code;
+		this.name = name;
+		this.courseBooks = courseBooks;
+		this.questionTypeGuids = questionTypeGuids;
+	}
+}

+ 25 - 0
src/main/java/com/qmth/qrzk/repository/exp/CourseBook.java

@@ -0,0 +1,25 @@
+package com.qmth.qrzk.repository.exp;
+
+public class CourseBook {
+	private String bookGuid;
+	private Integer inCourseStatus;	//课程中的教材状态
+	public String getBookGuid() {
+		return bookGuid;
+	}
+	public void setBookGuid(String bookGuid) {
+		this.bookGuid = bookGuid;
+	}
+	public Integer getInCourseStatus() {
+		return inCourseStatus;
+	}
+	public void setInCourseStatus(Integer inCourseStatus) {
+		this.inCourseStatus = inCourseStatus;
+	}
+	public CourseBook() {
+		//do nothing
+	}
+	public CourseBook(String bookGuid, Integer inCourseStatus) {
+		this.bookGuid = bookGuid;
+		this.inCourseStatus = inCourseStatus;
+	}
+}

+ 51 - 0
src/main/java/com/qmth/qrzk/repository/exp/QuestionType.java

@@ -0,0 +1,51 @@
+package com.qmth.qrzk.repository.exp;
+
+
+public class QuestionType {
+	private String guid;
+	private String code;					//题型编码
+	private String name;					//题型名称
+	private Integer correctOptionsNum;			//正确选项数量
+	private Double defaultScore;			//默认分值
+	public String getGuid() {
+		return guid;
+	}
+	public void setGuid(String guid) {
+		this.guid = guid;
+	}
+	public String getCode() {
+		return code;
+	}
+	public void setCode(String code) {
+		this.code = code;
+	}
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public Integer getCorrectOptionsNum() {
+		return correctOptionsNum;
+	}
+	public void setCorrectOptionsNum(Integer correctOptionsNum) {
+		this.correctOptionsNum = correctOptionsNum;
+	}
+	public Double getDefaultScore() {
+		return defaultScore;
+	}
+	public void setDefaultScore(Double defaultScore) {
+		this.defaultScore = defaultScore;
+	}
+	public QuestionType() {
+		//do nothing
+	}
+	public QuestionType(String guid, String code, String name,
+			Integer correctOptionsNum, Double defaultScore) {
+		this.guid = guid;
+		this.code = code;
+		this.name = name;
+		this.correctOptionsNum = correctOptionsNum;
+		this.defaultScore = defaultScore;
+	}
+}

+ 41 - 0
src/main/java/com/qmth/qrzk/repository/exp/Teacher.java

@@ -0,0 +1,41 @@
+package com.qmth.qrzk.repository.exp;
+
+public class Teacher {
+	private String guid;
+	private String name;
+	private String loginName;
+	private String password;
+	
+	public String getGuid() {
+		return guid;
+	}
+	public void setGuid(String guid) {
+		this.guid = guid;
+	}
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public String getLoginName() {
+		return loginName;
+	}
+	public void setLoginName(String loginName) {
+		this.loginName = loginName;
+	}
+	public String getPassword() {
+		return password;
+	}
+	public void setPassword(String password) {
+		this.password = password;
+	}
+	public Teacher() {
+	}
+	public Teacher(String guid, String name, String loginName, String password) {
+		this.guid = guid;
+		this.name = name;
+		this.loginName = loginName;
+		this.password = password;
+	}
+}

+ 62 - 0
src/main/java/com/qmth/qrzk/repository/exp/TkjsBatchData.java

@@ -0,0 +1,62 @@
+package com.qmth.qrzk.repository.exp;
+
+import java.util.List;
+
+import javax.xml.bind.annotation.XmlRootElement;
+
+/**
+ * 为客户端导出的题库建设数据的Root类
+ * @author 马涛 2017-07-02
+ *
+ */
+@XmlRootElement
+public class TkjsBatchData{
+	private List<Book> books;
+	private List<QuestionType> questionTypes;
+	private List<Course> courses;
+	private TkjsTaskBatch tkjsTaskBatch;
+
+	public List<Book> getBooks() {
+		return books;
+	}
+
+	public void setBooks(List<Book> books) {
+		this.books = books;
+	}
+
+	public List<QuestionType> getQuestionTypes() {
+		return questionTypes;
+	}
+
+	public void setQuestionTypes(List<QuestionType> questionTypes) {
+		this.questionTypes = questionTypes;
+	}
+
+	public List<Course> getCourses() {
+		return courses;
+	}
+
+	public void setCourses(List<Course> courses) {
+		this.courses = courses;
+	}
+
+	public TkjsTaskBatch getTkjsTaskBatch() {
+		return tkjsTaskBatch;
+	}
+
+	public void setTkjsTaskBatch(TkjsTaskBatch tkjsTaskBatch) {
+		this.tkjsTaskBatch = tkjsTaskBatch;
+	}
+
+	public TkjsBatchData() {
+		//do nothing
+	}
+
+	public TkjsBatchData(List<Book> books, List<QuestionType> questionTypes,
+			List<Course> courses, TkjsTaskBatch tkjsTaskBatch) {
+		this.books = books;
+		this.questionTypes = questionTypes;
+		this.courses = courses;
+		this.tkjsTaskBatch = tkjsTaskBatch;
+	}
+}

+ 55 - 0
src/main/java/com/qmth/qrzk/repository/exp/TkjsTask.java

@@ -0,0 +1,55 @@
+package com.qmth.qrzk.repository.exp;
+
+import java.util.Date;
+import java.util.List;
+
+public class TkjsTask {
+	private String guid;
+	private Date planStartTime;//计划开工时间
+	private Date planEndTime;//计划结束时间
+	private String courseGuid;
+	private List<String> teacherGuids;
+	
+	public Date getPlanStartTime() {
+		return planStartTime;
+	}
+	public void setPlanStartTime(Date planStartTime) {
+		this.planStartTime = planStartTime;
+	}
+	public Date getPlanEndTime() {
+		return planEndTime;
+	}
+	public void setPlanEndTime(Date planEndTime) {
+		this.planEndTime = planEndTime;
+	}
+	public String getGuid() {
+		return guid;
+	}
+	public void setGuid(String guid) {
+		this.guid = guid;
+	}
+	public String getCourseGuid() {
+		return courseGuid;
+	}
+	public void setCourseGuid(String courseGuid) {
+		this.courseGuid = courseGuid;
+	}
+	public List<String> getTeacherGuids() {
+		return teacherGuids;
+	}
+	public void setTeacherGuids(List<String> teacherGuids) {
+		this.teacherGuids = teacherGuids;
+	}
+	public TkjsTask() {
+	}
+	public TkjsTask(String guid, Date planStartTime,
+			Date planEndTime, String courseGuid,
+			List<String> teacherGuids) {
+		this.guid = guid;
+		this.planStartTime = planStartTime;
+		this.planEndTime = planEndTime;
+		this.courseGuid = courseGuid;
+		this.teacherGuids = teacherGuids;
+	}
+
+}

+ 59 - 0
src/main/java/com/qmth/qrzk/repository/exp/TkjsTaskBatch.java

@@ -0,0 +1,59 @@
+package com.qmth.qrzk.repository.exp;
+
+import java.util.Date;
+import java.util.List;
+
+/**
+ * 任务批次
+ * @author 马涛 2017-07-02
+ *
+ */
+public class TkjsTaskBatch{
+	private String guid;
+	private String name;
+	private Date planStartTime;//计划开工时间
+	private Date planEndTime;//计划结束时间
+	private List<TkjsTask> tasks;
+	
+	public String getGuid() {
+		return guid;
+	}
+	public void setGuid(String guid) {
+		this.guid = guid;
+	}
+	public String getName() {
+		return name;
+	}
+	public void setName(String name) {
+		this.name = name;
+	}
+	public Date getPlanStartTime() {
+		return planStartTime;
+	}
+	public void setPlanStartTime(Date planStartTime) {
+		this.planStartTime = planStartTime;
+	}
+	public Date getPlanEndTime() {
+		return planEndTime;
+	}
+	public void setPlanEndTime(Date planEndTime) {
+		this.planEndTime = planEndTime;
+	}
+	public List<TkjsTask> getTasks() {
+		return tasks;
+	}
+	public void setTasks(List<TkjsTask> tasks) {
+		this.tasks = tasks;
+	}
+	public TkjsTaskBatch() {
+		//do nothing
+	}
+	public TkjsTaskBatch(String guid, String name, Date planStartTime,
+			Date planEndTime, List<TkjsTask> tasks) {
+		this.guid = guid;
+		this.name = name;
+		this.planStartTime = planStartTime;
+		this.planEndTime = planEndTime;
+		this.tasks = tasks;
+	}
+}

+ 53 - 0
src/main/java/com/qmth/qrzk/repository/explort/beans/ExportQuestion.java

@@ -0,0 +1,53 @@
+package com.qmth.qrzk.repository.explort.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 导入试题的试题类
+ * @author 钟辉
+ *
+ */
+public class ExportQuestion implements  Serializable{
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -700041572529097970L;
+	public int id;
+    public String question_no;
+    public int course_id;
+    public int type_id;
+    public int book_id;
+    public int batch_id;
+    public String estimate_difficulty_code;
+    public String measured_difficulty_code;
+    public String grade_code;
+    public String ability_code;
+    public String chapter;
+    public String section;
+    public String item;
+    public String page;
+    public int score;
+    public String body_word;
+    public String body;
+    public String body_summary;
+    public String answer_word;
+    public String answer;
+    public String answer_summary;
+    public String answerSheet;
+    public String status_code;
+    public Date enable_time;
+    public Date set_time;
+    public int set_by;
+    public String set_teacher_name;
+    public String remark;
+    public Date created_time;
+    public int created_by;
+    public Date updated_time;
+    public int updated_by;
+    
+    public int option_count;
+    public ExportQuestionOptions[] pop_option;
+    public int pop_attachment_count;
+    public ExportQuestionAttachment[] pop_attachment;
+}

+ 26 - 0
src/main/java/com/qmth/qrzk/repository/explort/beans/ExportQuestionAttachment.java

@@ -0,0 +1,26 @@
+package com.qmth.qrzk.repository.explort.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 导入试题的附件类  属性与QuestionAttachment一致
+ * @author 钟辉
+ *
+ */
+public class ExportQuestionAttachment implements  Serializable{
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 4654396872257509990L;
+	public int id;
+    public int parent_id;
+    public int parent_type;
+    public String extension;
+    public String name;
+    public int size;
+    public String check_code;
+    public String content;
+    public Date created_time;
+    public int created_by;
+}

+ 28 - 0
src/main/java/com/qmth/qrzk/repository/explort/beans/ExportQuestionOptions.java

@@ -0,0 +1,28 @@
+package com.qmth.qrzk.repository.explort.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 导入试题的选项类   包含选项信息 和QuestionOption作用相等
+ * @author 钟辉
+ *
+ */
+public class ExportQuestionOptions implements  Serializable{
+	
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = 3713441673013181805L;
+	public int id;
+    public int question_id;
+    public int option_no;
+    public boolean is_correct_option;
+    public String content;
+    public String content_word;
+    public String summary;
+    public Date created_time;
+    public int created_by;
+    public Date updated_time;
+    public int updated_by;
+}

+ 113 - 0
src/main/java/com/qmth/qrzk/repository/explort/beans/ExportQuestionSet.java

@@ -0,0 +1,113 @@
+package com.qmth.qrzk.repository.explort.beans;
+
+import java.io.Serializable;
+import java.util.Date;
+
+/**
+ * 导入试题的基类 包含试题类集合、选项类集合、附件类集合
+ * @author 钟辉
+ *
+ */
+public class ExportQuestionSet implements  Serializable{
+	/**
+	 * 
+	 */
+	private static final long serialVersionUID = -2846963953142443516L;
+
+	// 导出时间
+    public Date dt;
+
+    // 随机 uuID
+    public String uuid;
+    public String name; // 命题集名称
+
+    // 发送程序版本号, 必须与接受程序版本号一至
+    public String program_version;
+    // 暂为0
+    public String file_version;
+
+    // 展开口令 如果有加密则使用该口令对数据进行解密
+    public String expand_password;
+    // 以下为压缩加密内容
+    // 压缩类型 全小写 空为不压缩
+    // 压缩类型 "", "zip", "7z", "cab", "rar"
+    public String compression_type;
+
+    // 私有公有加密密钥 全大写 空为不加密
+    // 加密类型 "", "MD5" , "SHA1", "DES", "AES", "RSA"
+    public String encryption_type;
+    public String public_key;
+    public String private_key;
+
+    // 基础信息表 为XML格式, 为保证不同数据库的统一性
+    // <course>
+    //    <key field='name'>value</key>
+    // </course>
+    public String base_architecture;
+
+    // 本文件长度
+    public long file_size;
+
+    // hasmd5 校验, 最后写入
+    public String md5;
+
+    public ExportQuestion[] questions;
+
+	public Date getDt() {
+		return dt;
+	}
+
+	public String getUuid() {
+		return uuid;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public String getProgram_version() {
+		return program_version;
+	}
+
+	public String getFile_version() {
+		return file_version;
+	}
+
+	public String getExpand_password() {
+		return expand_password;
+	}
+
+	public String getCompression_type() {
+		return compression_type;
+	}
+
+	public String getEncryption_type() {
+		return encryption_type;
+	}
+
+	public String getPublic_key() {
+		return public_key;
+	}
+
+	public String getPrivate_key() {
+		return private_key;
+	}
+
+	public String getBase_architecture() {
+		return base_architecture;
+	}
+
+	public long getFile_size() {
+		return file_size;
+	}
+
+	public String getMd5() {
+		return md5;
+	}
+
+	public ExportQuestion[] getQuestions() {
+		return questions;
+	}
+    
+    
+}

+ 62 - 0
src/main/java/com/qmth/qrzk/repository/learnCenter/model/LearnCenter.java

@@ -0,0 +1,62 @@
+package com.qmth.qrzk.repository.learnCenter.model;
+
+public class LearnCenter {
+	private int id;								//编号
+	private String categoryCode;				//所属分类代码
+	private String categoryName;				//所属分类名称
+	private String htmlContent;					//富文本内容
+	private String attachmentId;					//附件id
+	private String courseCode; 					//课程代码
+	private String keyword;						//关键字
+	private String guid;
+	
+	public String getGuid() {
+		return guid;
+	}
+	public void setGuid(String guid) {
+		this.guid = guid;
+	}
+	public int getId() {
+		return id;
+	}
+	public void setId(int id) {
+		this.id = id;
+	}
+	public String getCategoryCode() {
+		return categoryCode;
+	}
+	public void setCategoryCode(String categoryCode) {
+		this.categoryCode = categoryCode;
+	}
+	public String getCategoryName() {
+		return categoryName;
+	}
+	public void setCategoryName(String categoryName) {
+		this.categoryName = categoryName;
+	}
+	public String getHtmlContent() {
+		return htmlContent;
+	}
+	public void setHtmlContent(String htmlContent) {
+		this.htmlContent = htmlContent;
+	}
+	public String getAttachmentId() {
+		return attachmentId;
+	}
+	public void setAttachmentId(String attachmentId) {
+		this.attachmentId = attachmentId;
+	}
+	public String getCourseCode() {
+		return courseCode;
+	}
+	public void setCourseCode(String courseCode) {
+		this.courseCode = courseCode;
+	}
+	public String getKeyword() {
+		return keyword;
+	}
+	public void setKeyword(String keyword) {
+		this.keyword = keyword;
+	}
+	
+}

+ 45 - 0
src/main/java/com/qmth/qrzk/repository/learnCenter/service/LearnCenterService.java

@@ -0,0 +1,45 @@
+package com.qmth.qrzk.repository.learnCenter.service;
+
+import java.util.List;
+
+import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.qmth.qrzk.repository.common.base.BaseDao;
+import com.qmth.qrzk.repository.learnCenter.model.LearnCenter;
+import com.qmth.qrzk.repository.service.query.LearnCenterQueryParams;
+
+@Service
+public class LearnCenterService {
+	private final static Logger log = Logger.getLogger(LearnCenterService.class);
+	
+	@Autowired
+	private BaseDao dao;
+	
+	public LearnCenter getLearnCenterByCategoryCode(String categoryCode){
+		return dao.get("getLearnCenterByCategoryCode", categoryCode);
+	}
+	
+	public List<LearnCenter> queryLearnCenters(LearnCenterQueryParams params){
+		return dao.getPagerList("queryLearnCenters", params);
+	}
+	
+	public void updateHtmlContent(LearnCenter learnCenter){
+		dao.update("updateLearnCenterHtmlContent", learnCenter);
+	}
+	
+	public void updateAttachment(LearnCenter learnCenter){
+		dao.update("updateLearnCenterAttachment", learnCenter);
+	}
+	
+	public void addLearnCenter(LearnCenter learnCenter){
+		dao.update("addLearnCenter", learnCenter);
+	}
+	
+	public void delete(String ids){
+		String[] idArray = ids.split(",");
+		
+		dao.delete("deleteLearnCenterByIds", idArray);
+	}
+}

+ 272 - 0
src/main/java/com/qmth/qrzk/repository/pager/model/PagerConstruct.java

@@ -0,0 +1,272 @@
+/* ==================================================================   
+ * $Id: codetemplates.xml,v 1.1 2006/04/24 09:18:57 饶国发 Exp $ 
+ * Created [2014-9-20 上午10:40:54] by 饶国发 
+ * ==================================================================  
+ * qrzk 
+ * ================================================================== 
+ * qrzk  License v1.0  
+ * Copyright (c) Wuhan G-Soft Technology CO.,LTD., 2010-2012 
+ * ================================================================== 
+ * 武汉威鹏科技有限公司拥有该文件的使用、复制、修改和分发的许可权
+ * 如果你想得到更多信息,请访问 <http://www.wptech.net.cn>
+ *
+ * Wuhan WP-Soft Technology CO.,LTD. owns permission to use, copy, modify and 
+ * distribute this documentation.
+ * For more information on qrzk, please 
+ * see <http://www.wptech.net.cn>.  
+ * ================================================================== 
+ */
+
+package com.qmth.qrzk.repository.pager.model;
+
+import java.util.Date;
+import java.util.List;
+
+import com.qmth.qrzk.repository.task.WordHistory;
+import com.qmth.qrzk.repository.utils.Consts;
+import com.qmth.qrzk.repository.utils.DateHelper;
+
+/**
+ * <p> PagerConstruct.java </p>
+ * <p>  试卷主表
+ * </p>
+ * @author $Author: 饶国发 $
+ * @version $Revision: V5.1 $
+ */
+public class PagerConstruct {
+    
+    private Integer id;             //id
+    private String name;        //试卷名称
+    private String head;		//试卷题头
+    private Integer skeletonId;        //细目表主表ID
+    private PaperSkeleton skeleton;		//细目表对象		马涛 2014-9-22 Add
+    private Integer pagerTempletId;      //试卷模板id
+    private Date startTime;			//试卷启用时间
+    private Integer status;         //状态   0草稿  1内容待审批   2内容审批通过 3启用 4内容审批拒绝
+    private Integer resourse;  //来源  1智能  2手工
+    private Date createdTime;  //创建日期
+    private Integer createdBy;                      //创建人
+    private String createdByName;				//创建人姓名
+    private Date updatedTime;					//最近更新时间
+    private Integer updatedBy;						//最近更新人
+    private Integer maxSameCount;       //同批试卷重复题数限制
+    private Integer maxOldCount;    //旧题限制数量
+    private Integer taskId;			//试卷任务Id
+    private Integer lastPaperWord;	//最新的Word试卷
+    private Integer lastWangpingWord;	//最新的网评卷Word
+    private Integer lastTikaWord;	//最新的题卡Word
+    private Integer lastAnswerWord;	//最新的Word标准答案
+    private String tikaType;	//题卡类型:通用题卡(NORMAL)、专用题卡(SPECIAL)
+    private Integer lastZhuanyinWord;	//最新的转印说明Word附件一
+    private Integer lastZhuanyinWord2;	//最新的转印说明Word附件二
+    private List<PagerConstructQtype> qtypeList;//题型列表
+    private List<WordHistory> paperWordHistories;//试卷Word历史版本记录
+    private List<WordHistory> wangpingWordHistories;//网评卷Word历史版本记录
+    private List<WordHistory> tikaWordHistories;//题卡Word历史版本记录
+    private List<WordHistory> answerWordHistories;//答案Word历史版本记录
+    private List<WordHistory> zhuanyinHistories;//转印说明历史版本记录
+	private String guid;
+	
+	public String getGuid() {
+		return guid;
+	}
+	public void setGuid(String guid) {
+		this.guid = guid;
+	}
+    
+	public Integer getId() {
+        return id;
+    }
+    public void setId(Integer id) {
+        this.id = id;
+    }
+    public String getName() {
+        return name;
+    }
+    public String getShowName(){
+    	if(name == null || name.equals("")){
+    		return Consts.DEFAULT_HEAD;
+    	}
+        return name;
+    }
+    public void setName(String name) {
+        this.name = name;
+    }
+    public String getHead() {
+		return head;
+	}
+	public void setHead(String head) {
+		this.head = head;
+	}
+	public Integer getSkeletonId() {
+        return skeletonId;
+    }
+    public void setSkeletonId(Integer skeletonId) {
+        this.skeletonId = skeletonId;
+    }
+    public Integer getPagerTempletId() {
+        return pagerTempletId;
+    }
+    public void setPagerTempletId(Integer pagerTempletId) {
+        this.pagerTempletId = pagerTempletId;
+    }
+    public Integer getStatus() {
+        return status;
+    }
+    public String getStatusName(){
+		return Consts.PaperStatus.dicMap.get(status);
+	}
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+    public Integer getResourse() {
+        return resourse;
+    }
+    public void setResourse(Integer resourse) {
+        this.resourse = resourse;
+    }
+    public Date getCreatedTime() {
+        return createdTime;
+    }
+    public String getCreatedTimeStr(){
+    	return DateHelper.formatDate(createdTime);
+    }
+    public void setCreatedTime(Date createdTime) {
+        this.createdTime = createdTime;
+    }
+    public Integer getCreatedBy() {
+        return createdBy;
+    }
+    public void setCreatedBy(Integer createdBy) {
+        this.createdBy = createdBy;
+    }
+	public PaperSkeleton getSkeleton() {
+		return skeleton;
+	}
+	public void setSkeleton(PaperSkeleton skeleton) {
+		this.skeleton = skeleton;
+	}
+	public String getCreatedByName() {
+		return createdByName;
+	}
+	public void setCreatedByName(String createdByName) {
+		this.createdByName = createdByName;
+	}
+    public Integer getMaxSameCount() {
+        return maxSameCount;
+    }
+    public void setMaxSameCount(Integer maxSameCount) {
+        this.maxSameCount = maxSameCount;
+    }
+    public Integer getMaxOldCount() {
+        return maxOldCount;
+    }
+    public void setMaxOldCount(Integer maxOldCount) {
+        this.maxOldCount = maxOldCount;
+    }
+	public Date getUpdatedTime() {
+		return updatedTime;
+	}
+	public void setUpdatedTime(Date updatedTime) {
+		this.updatedTime = updatedTime;
+	}
+	public Integer getUpdatedBy() {
+		return updatedBy;
+	}
+	public void setUpdatedBy(Integer updatedBy) {
+		this.updatedBy = updatedBy;
+	}
+	public Integer getTaskId() {
+		return taskId;
+	}
+	public void setTaskId(Integer taskId) {
+		this.taskId = taskId;
+	}
+	public Integer getLastPaperWord() {
+		return lastPaperWord;
+	}
+	public void setLastPaperWord(Integer lastPaperWord) {
+		this.lastPaperWord = lastPaperWord;
+	}
+	public Integer getLastAnswerWord() {
+		return lastAnswerWord;
+	}
+	public void setLastAnswerWord(Integer lastAnswerWord) {
+		this.lastAnswerWord = lastAnswerWord;
+	}
+	public Date getStartTime() {
+		return startTime;
+	}
+	public void setStartTime(Date startTime) {
+		this.startTime = startTime;
+	}
+    public String getTikaType() {
+		return tikaType;
+	}
+	public void setTikaType(String tikaType) {
+		this.tikaType = tikaType;
+	}
+	public Integer getLastZhuanyinWord() {
+		return lastZhuanyinWord;
+	}
+	public void setLastZhuanyinWord(Integer lastZhuanyinWord) {
+		this.lastZhuanyinWord = lastZhuanyinWord;
+	}
+	public Integer getLastZhuanyinWord2() {
+		return lastZhuanyinWord2;
+	}
+	public void setLastZhuanyinWord2(Integer lastZhuanyinWord2) {
+		this.lastZhuanyinWord2 = lastZhuanyinWord2;
+	}
+	public List<PagerConstructQtype> getQtypeList() {
+		return qtypeList;
+	}
+	public void setQtypeList(List<PagerConstructQtype> qtypeList) {
+		this.qtypeList = qtypeList;
+	}
+	public List<WordHistory> getPaperWordHistories() {
+		return paperWordHistories;
+	}
+	public void setPaperWordHistories(List<WordHistory> paperWordHistories) {
+		this.paperWordHistories = paperWordHistories;
+	}
+	public List<WordHistory> getAnswerWordHistories() {
+		return answerWordHistories;
+	}
+	public void setAnswerWordHistories(List<WordHistory> answerWordHistories) {
+		this.answerWordHistories = answerWordHistories;
+	}
+	public Integer getLastWangpingWord() {
+		return lastWangpingWord;
+	}
+	public void setLastWangpingWord(Integer lastWangpingWord) {
+		this.lastWangpingWord = lastWangpingWord;
+	}
+	public Integer getLastTikaWord() {
+		return lastTikaWord;
+	}
+	public void setLastTikaWord(Integer lastTikaWord) {
+		this.lastTikaWord = lastTikaWord;
+	}
+	public List<WordHistory> getWangpingWordHistories() {
+		return wangpingWordHistories;
+	}
+	public void setWangpingWordHistories(List<WordHistory> wangpingWordHistories) {
+		this.wangpingWordHistories = wangpingWordHistories;
+	}
+	public List<WordHistory> getTikaWordHistories() {
+		return tikaWordHistories;
+	}
+	public void setTikaWordHistories(List<WordHistory> tikaWordHistories) {
+		this.tikaWordHistories = tikaWordHistories;
+	}
+	public List<WordHistory> getZhuanyinHistories() {
+		return zhuanyinHistories;
+	}
+	public void setZhuanyinHistories(List<WordHistory> zhuanyinHistories) {
+		this.zhuanyinHistories = zhuanyinHistories;
+	}
+	
+}
+
+	

+ 123 - 0
src/main/java/com/qmth/qrzk/repository/pager/model/PagerConstructDetail.java

@@ -0,0 +1,123 @@
+/* ==================================================================   
+ * $Id: codetemplates.xml,v 1.1 2006/04/24 09:18:57 饶国发 Exp $ 
+ * Created [2014-9-20 上午10:44:43] by 饶国发 
+ * ==================================================================  
+ * qrzk 
+ * ================================================================== 
+ * qrzk  License v1.0  
+ * Copyright (c) Wuhan G-Soft Technology CO.,LTD., 2010-2012 
+ * ================================================================== 
+ * 武汉威鹏科技有限公司拥有该文件的使用、复制、修改和分发的许可权
+ * 如果你想得到更多信息,请访问 <http://www.wptech.net.cn>
+ *
+ * Wuhan WP-Soft Technology CO.,LTD. owns permission to use, copy, modify and 
+ * distribute this documentation.
+ * For more information on qrzk, please 
+ * see <http://www.wptech.net.cn>.  
+ * ================================================================== 
+ */
+
+package com.qmth.qrzk.repository.pager.model;
+
+import java.util.Date;
+
+import com.qmth.qrzk.repository.user.model.Question;
+
+/**
+ * <p> PagerConstructDetail.java </p>
+ * <p>试卷小题明细表
+ * </p>
+ * @author $Author: 饶国发 $
+ * @version $Revision: V5.1 $
+ */
+public class PagerConstructDetail {
+    private Integer id;             //id
+    private Integer questionId;        //小题ID
+    private Question question;			//对应的试题对象
+    private Integer pagerConstructId;//试卷ID
+    private Integer pagerQtypeId;//大题id
+    private Integer sortNo;//序号,题号
+    private Double questionScore;//题目分数
+    private Date createdTime;  //创建日期
+    private Integer createdBy;                      //创建人
+    private Date updatedTime;					//最近更新时间
+    private Integer updatedBy;						//最近更新人
+	private String guid;
+	
+	public String getGuid() {
+		return guid;
+	}
+	public void setGuid(String guid) {
+		this.guid = guid;
+	}
+    
+    public Integer getId() {
+        return id;
+    }
+    public void setId(Integer id) {
+        this.id = id;
+    }
+    public Integer getQuestionId() {
+        return questionId;
+    }
+    public void setQuestionId(Integer questionId) {
+        this.questionId = questionId;
+    }
+    public Integer getPagerConstructId() {
+        return pagerConstructId;
+    }
+    public void setPagerConstructId(Integer pagerConstructId) {
+        this.pagerConstructId = pagerConstructId;
+    }
+    public Integer getPagerQtypeId() {
+        return pagerQtypeId;
+    }
+    public void setPagerQtypeId(Integer pagerQtypeId) {
+        this.pagerQtypeId = pagerQtypeId;
+    }
+    public Integer getSortNo() {
+        return sortNo;
+    }
+    public void setSortNo(Integer sortNo) {
+        this.sortNo = sortNo;
+    }
+    public Double getQuestionScore() {
+        return questionScore;
+    }
+    public void setQuestionScore(Double questionScore) {
+        this.questionScore = questionScore;
+    }
+	public Question getQuestion() {
+		return question;
+	}
+	public void setQuestion(Question question) {
+		this.question = question;
+	}
+	public Date getCreatedTime() {
+		return createdTime;
+	}
+	public void setCreatedTime(Date createdTime) {
+		this.createdTime = createdTime;
+	}
+	public Integer getCreatedBy() {
+		return createdBy;
+	}
+	public void setCreatedBy(Integer createdBy) {
+		this.createdBy = createdBy;
+	}
+	public Date getUpdatedTime() {
+		return updatedTime;
+	}
+	public void setUpdatedTime(Date updatedTime) {
+		this.updatedTime = updatedTime;
+	}
+	public Integer getUpdatedBy() {
+		return updatedBy;
+	}
+	public void setUpdatedBy(Integer updatedBy) {
+		this.updatedBy = updatedBy;
+	}
+    
+}
+
+	

+ 152 - 0
src/main/java/com/qmth/qrzk/repository/pager/model/PagerConstructQtype.java

@@ -0,0 +1,152 @@
+/* ==================================================================   
+ * $Id: codetemplates.xml,v 1.1 2006/04/24 09:18:57 饶国发 Exp $ 
+ * Created [2014-9-20 上午10:42:56] by 饶国发 
+ * ==================================================================  
+ * qrzk 
+ * ================================================================== 
+ * qrzk  License v1.0  
+ * Copyright (c) Wuhan G-Soft Technology CO.,LTD., 2010-2012 
+ * ================================================================== 
+ * 武汉威鹏科技有限公司拥有该文件的使用、复制、修改和分发的许可权
+ * 如果你想得到更多信息,请访问 <http://www.wptech.net.cn>
+ *
+ * Wuhan WP-Soft Technology CO.,LTD. owns permission to use, copy, modify and 
+ * distribute this documentation.
+ * For more information on qrzk, please 
+ * see <http://www.wptech.net.cn>.  
+ * ================================================================== 
+ */
+
+package com.qmth.qrzk.repository.pager.model;
+
+import java.util.Date;
+import java.util.List;
+
+import com.qmth.qrzk.repository.user.model.QuestionType;
+
+/**
+ * <p> PagerConstructQtype.java </p>
+ * <p>试卷大题表
+ * </p>
+ * @author $Author: 饶国发 $
+ * @version $Revision: V5.1 $
+ */
+public class PagerConstructQtype {
+    private Integer id;             //id
+    private String name;        //大题名称
+    private Integer pagerConstructId;//试卷ID
+    private Integer questionTypeId;//大题的题型
+    private Integer sortNo;//序号,题号
+    private Integer questionSum;//小题总数
+    private Double score;//每题分数;
+    private Double questionScores;       //小题总分数
+    private String remark;//	题型说明
+    private Date createdTime;  //创建日期
+    private Integer createdBy;                      //创建人
+    private Date updatedTime;					//最近更新时间
+    private Integer updatedBy;						//最近更新人
+    private List<PagerConstructDetail> constructDetails;//试卷里面的试题详情
+    private QuestionType questionType;
+	private String guid;
+	
+	public String getGuid() {
+		return guid;
+	}
+	public void setGuid(String guid) {
+		this.guid = guid;
+	}
+    
+    public Integer getId() {
+        return id;
+    }
+    public void setId(Integer id) {
+        this.id = id;
+    }
+    public String getName() {
+        return name;
+    }
+    public void setName(String name) {
+        this.name = name;
+    }
+    public Integer getPagerConstructId() {
+        return pagerConstructId;
+    }
+    public void setPagerConstructId(Integer pagerConstructId) {
+        this.pagerConstructId = pagerConstructId;
+    }
+    public Integer getQuestionTypeId() {
+        return questionTypeId;
+    }
+    public void setQuestionTypeId(Integer questionTypeId) {
+        this.questionTypeId = questionTypeId;
+    }
+    public Integer getSortNo() {
+        return sortNo;
+    }
+    public void setSortNo(Integer sortNo) {
+        this.sortNo = sortNo;
+    }
+	public List<PagerConstructDetail> getConstructDetails() {
+		return constructDetails;
+	}
+	public void setConstructDetails(List<PagerConstructDetail> constructDetails) {
+		this.constructDetails = constructDetails;
+	}
+    public Integer getQuestionSum() {
+        return questionSum;
+    }
+    public void setQuestionSum(Integer questionSum) {
+        this.questionSum = questionSum;
+    }
+    public Double getQuestionScores() {
+        return questionScores;
+    }
+    public void setQuestionScores(Double questionScores) {
+        this.questionScores = questionScores;
+    }
+	public Date getCreatedTime() {
+		return createdTime;
+	}
+	public void setCreatedTime(Date createdTime) {
+		this.createdTime = createdTime;
+	}
+	public Integer getCreatedBy() {
+		return createdBy;
+	}
+	public void setCreatedBy(Integer createdBy) {
+		this.createdBy = createdBy;
+	}
+	public String getRemark() {
+		return remark;
+	}
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+    public Double getScore() {
+        return score;
+    }
+    public void setScore(Double score) {
+        this.score = score;
+    }
+	public Date getUpdatedTime() {
+		return updatedTime;
+	}
+	public void setUpdatedTime(Date updatedTime) {
+		this.updatedTime = updatedTime;
+	}
+	public Integer getUpdatedBy() {
+		return updatedBy;
+	}
+	public void setUpdatedBy(Integer updatedBy) {
+		this.updatedBy = updatedBy;
+	}
+	public QuestionType getQuestionType() {
+		return questionType;
+	}
+	public void setQuestionType(QuestionType questionType) {
+		this.questionType = questionType;
+	}
+	
+}
+
+	

+ 69 - 0
src/main/java/com/qmth/qrzk/repository/pager/model/PagerTemplet.java

@@ -0,0 +1,69 @@
+/* ==================================================================   
+ * $Id: codetemplates.xml,v 1.1 2006/04/24 09:18:57 饶国发 Exp $ 
+ * Created [2014-9-20 上午11:12:50] by 饶国发 
+ * ==================================================================  
+ * qrzk 
+ * ================================================================== 
+ * qrzk  License v1.0  
+ * Copyright (c) Wuhan G-Soft Technology CO.,LTD., 2010-2012 
+ * ================================================================== 
+ * 武汉威鹏科技有限公司拥有该文件的使用、复制、修改和分发的许可权
+ * 如果你想得到更多信息,请访问 <http://www.wptech.net.cn>
+ *
+ * Wuhan WP-Soft Technology CO.,LTD. owns permission to use, copy, modify and 
+ * distribute this documentation.
+ * For more information on qrzk, please 
+ * see <http://www.wptech.net.cn>.  
+ * ================================================================== 
+ */
+
+package com.qmth.qrzk.repository.pager.model;
+
+/**
+ * <p> PagerTemplet.java </p>
+ * <p>试卷排版模板表
+ * </p>
+ * @author $Author: 饶国发 $
+ * @version $Revision: V5.1 $
+ */
+public class PagerTemplet {
+    private Integer id;             //id
+    private String name;   //模板文件名称
+    private String path;  //doc模板的路径
+    private String xml_content;//doc 模板主演换成xml文件的内容
+    private Integer status;//状态  0 停用  1启用
+    public Integer getId() {
+        return id;
+    }
+    public void setId(Integer id) {
+        this.id = id;
+    }
+    public String getName() {
+        return name;
+    }
+    public void setName(String name) {
+        this.name = name;
+    }
+    public String getPath() {
+        return path;
+    }
+    public void setPath(String path) {
+        this.path = path;
+    }
+    public String getXml_content() {
+        return xml_content;
+    }
+    public void setXml_content(String xml_content) {
+        this.xml_content = xml_content;
+    }
+    public Integer getStatus() {
+        return status;
+    }
+    public void setStatus(Integer status) {
+        this.status = status;
+    }
+    
+    
+}
+
+	

+ 116 - 0
src/main/java/com/qmth/qrzk/repository/pager/model/PaperDifficultyEstimateDetail.java

@@ -0,0 +1,116 @@
+package com.qmth.qrzk.repository.pager.model;
+
+import java.util.Date;
+
+import com.qmth.qrzk.repository.user.model.Question;
+import com.qmth.qrzk.repository.utils.Consts;
+
+public class PaperDifficultyEstimateDetail {
+	private Integer id;             //id
+	private Integer pagerConstructId;//试卷ID
+    private Integer questionId;        //小题ID
+    private String questionType;        //题型名称
+	private Question question;			//对应的试题对象
+    private Integer sortNo;//序号,题号
+    private Double questionScore;//题目分数
+    private int estimateDifficulty;//预计难度
+    private Double estimateDifficultyValue;//预计难度值
+    private Date createdTime;  //创建日期
+    private Integer createdBy;                      //创建人
+    private Date updatedTime;					//最近更新时间
+    private Integer updatedBy;						//最近更新人
+	private String guid;
+	
+	public String getGuid() {
+		return guid;
+	}
+	public void setGuid(String guid) {
+		this.guid = guid;
+	}
+	public Integer getId() {
+		return id;
+	}
+	public void setId(Integer id) {
+		this.id = id;
+	}
+	public Integer getQuestionId() {
+		return questionId;
+	}
+	public void setQuestionId(Integer questionId) {
+		this.questionId = questionId;
+	}
+    public String getQuestionType() {
+		return questionType;
+	}
+	public void setQuestionType(String questionType) {
+		this.questionType = questionType;
+	}
+	public Question getQuestion() {
+		return question;
+	}
+	public void setQuestion(Question question) {
+		this.question = question;
+	}
+	public Integer getPagerConstructId() {
+		return pagerConstructId;
+	}
+	public void setPagerConstructId(Integer pagerConstructId) {
+		this.pagerConstructId = pagerConstructId;
+	}
+	public Integer getSortNo() {
+		return sortNo;
+	}
+	public void setSortNo(Integer sortNo) {
+		this.sortNo = sortNo;
+	}
+	public Double getQuestionScore() {
+		return questionScore;
+	}
+	public void setQuestionScore(Double questionScore) {
+		this.questionScore = questionScore;
+	}
+	public Double getEstimateDifficultyValue() {
+		return estimateDifficultyValue;
+	}
+	public void setEstimateDifficultyValue(Double estimateDifficultyValue) {
+		this.estimateDifficultyValue = estimateDifficultyValue;
+	}
+	public int getEstimateDifficulty() {
+		return estimateDifficulty;
+	}
+	public void setEstimateDifficulty(int estimateDifficulty) {
+		this.estimateDifficulty = estimateDifficulty;
+	}
+	public Date getCreatedTime() {
+		return createdTime;
+	}
+	public void setCreatedTime(Date createdTime) {
+		this.createdTime = createdTime;
+	}
+	public Integer getCreatedBy() {
+		return createdBy;
+	}
+	public void setCreatedBy(Integer createdBy) {
+		this.createdBy = createdBy;
+	}
+	public Date getUpdatedTime() {
+		return updatedTime;
+	}
+	public void setUpdatedTime(Date updatedTime) {
+		this.updatedTime = updatedTime;
+	}
+	public Integer getUpdatedBy() {
+		return updatedBy;
+	}
+	public void setUpdatedBy(Integer updatedBy) {
+		this.updatedBy = updatedBy;
+	}
+	
+    public String getEstimateDifficultyName(){
+    	return Consts.EstimateDifficulty.dicMap.get(this.estimateDifficulty);
+    }
+    
+    public void setEstimateDifficultyName(String s){
+    	
+    }
+}

+ 233 - 0
src/main/java/com/qmth/qrzk/repository/pager/model/PaperSkeleton.java

@@ -0,0 +1,233 @@
+package com.qmth.qrzk.repository.pager.model;
+
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.List;
+import java.util.Map;
+
+import com.qmth.qrzk.repository.user.model.Book;
+import com.qmth.qrzk.repository.user.model.Course;
+import com.qmth.qrzk.repository.user.model.QuestionType;
+import com.qmth.qrzk.repository.utils.Consts;
+
+/**
+ * 细目表
+ * @author shixb
+ *
+ */
+public class PaperSkeleton {
+	
+	private Integer id;				//编号
+	
+	private Integer taskId;			//试卷任务Id
+	
+	private String name;		//细目表名称
+	
+	private Integer courseId;		//课程ID
+	
+	private Course course;		//对应的课程对象
+	
+	private Integer bookId;		//教材ID
+	
+	private Book book;			//对应的教材对象
+	
+	private Integer chapterSize;		//教材章数
+	
+	private String keyChapters;		//重点章组成的字符串,用逗号“,”隔开,例如:2,3,7
+	
+	private String quesTypeScores;	//各题型分值组成的字符串,题型与分值用冒号“:”隔开,各个题型分值字符串再用逗号“,”隔开,例如:1:1,2:1,5:10
+	
+	private String remark;
+	
+	private Integer status;			//状态   0草稿  1待审批   2审批通过 3启用 4审批拒绝
+	
+	private Date createdTime;		//创建日期
+	
+	private Integer createdBy; //创建人
+	
+	private String createdUser;
+	
+	private Date updatedTime;		//最近更新时间
+	
+	private Integer updatedBy; //最近更新人
+	
+	private List<PaperSkeletonDetail> skeletonDetailArr = new ArrayList<PaperSkeletonDetail>();
+	
+	private List<QuestionType> quesTypeArr = new ArrayList<QuestionType>();
+	
+	private Map<String,Integer> skeletonDetailMap = null;
+	
+	private String guid;
+	
+	public String getGuid() {
+		return guid;
+	}
+	public void setGuid(String guid) {
+		this.guid = guid;
+	}
+
+	public Integer getId() {
+		return id;
+	}
+
+	public void setId(Integer id) {
+		this.id = id;
+	}
+
+	public Integer getTaskId() {
+		return taskId;
+	}
+
+	public void setTaskId(Integer taskId) {
+		this.taskId = taskId;
+	}
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public Integer getCourseId() {
+		return courseId;
+	}
+
+	public void setCourseId(Integer courseId) {
+		this.courseId = courseId;
+	}
+
+	public Course getCourse() {
+		return course;
+	}
+
+	public void setCourse(Course course) {
+		this.course = course;
+	}
+
+	public Integer getBookId() {
+		return bookId;
+	}
+
+	public void setBookId(Integer bookId) {
+		this.bookId = bookId;
+	}
+
+	public Book getBook() {
+		return book;
+	}
+
+	public void setBook(Book book) {
+		this.book = book;
+	}
+
+	public Integer getChapterSize() {
+		return chapterSize;
+	}
+
+	public void setChapterSize(Integer chapterSize) {
+		this.chapterSize = chapterSize;
+	}
+
+	public String getKeyChapters() {
+		return keyChapters;
+	}
+
+	public void setKeyChapters(String keyChapters) {
+		this.keyChapters = keyChapters;
+	}
+
+	public String getQuesTypeScores() {
+		return quesTypeScores;
+	}
+
+	public void setQuesTypeScores(String quesTypeScores) {
+		this.quesTypeScores = quesTypeScores;
+	}
+
+	public Integer getStatus() {
+		return status;
+	}
+	
+	public String getStatusName(){
+		return Consts.SkeletonStatus.dicMap.get(status);
+	}
+	
+	public void setStatus(Integer status) {
+		this.status = status;
+	}
+
+	public Date getCreatedTime() {
+		return createdTime;
+	}
+
+	public void setCreatedTime(Date createdTime) {
+		this.createdTime = createdTime;
+	}
+
+	public Integer getCreatedBy() {
+		return createdBy;
+	}
+
+	public void setCreatedBy(Integer createdBy) {
+		this.createdBy = createdBy;
+	}
+
+	public String getCreatedUser() {
+		return createdUser;
+	}
+
+	public void setCreatedUser(String createdUser) {
+		this.createdUser = createdUser;
+	}
+
+	public String getRemark() {
+		return remark;
+	}
+
+	public void setRemark(String remark) {
+		this.remark = remark;
+	}
+
+	public List<PaperSkeletonDetail> getSkeletonDetailArr() {
+		return skeletonDetailArr;
+	}
+
+	public void setSkeletonDetailArr(List<PaperSkeletonDetail> skeletonDetailArr) {
+		this.skeletonDetailArr = skeletonDetailArr;
+	}
+
+	public List<QuestionType> getQuesTypeArr() {
+		return quesTypeArr;
+	}
+
+	public void setQuesTypeArr(List<QuestionType> quesTypeArr) {
+		this.quesTypeArr = quesTypeArr;
+	}
+
+	public Date getUpdatedTime() {
+		return updatedTime;
+	}
+
+	public void setUpdatedTime(Date updatedTime) {
+		this.updatedTime = updatedTime;
+	}
+
+	public Integer getUpdatedBy() {
+		return updatedBy;
+	}
+
+	public void setUpdatedBy(Integer updatedBy) {
+		this.updatedBy = updatedBy;
+	}
+	
+	public Map<String, Integer> getSkeletonDetailMap() {
+		return skeletonDetailMap;
+	}
+	
+	public void setSkeletonDetailMap(Map<String, Integer> skeletonDetailMap) {
+		this.skeletonDetailMap = skeletonDetailMap;
+	}
+	
+}

+ 158 - 0
src/main/java/com/qmth/qrzk/repository/pager/model/PaperSkeletonDetail.java

@@ -0,0 +1,158 @@
+package com.qmth.qrzk.repository.pager.model;
+
+import com.qmth.qrzk.repository.utils.Consts;
+
+
+public class PaperSkeletonDetail {
+
+	private Integer id;				//编号
+	
+	private Integer skeletonId;		//细目表主表ID
+	
+	private Integer quesTypeNo;		//题型编号,从1开始,对应细目表里面的题型顺序值
+	
+	private String quesTypeName;	//题型名称,用于组卷时空题显示
+	
+	private Double score;			//每题分数,用于组卷时空题显示
+	
+	private Integer chapterNo;		//章序号值,从1开始
+	
+	private Integer quesNum;		//题目数量
+	
+	private Integer estimateDifficulty;		//预计难度:A.易;  B.中等偏易;  C.中等偏难;  D.难,对应数字:1,2,3,4,对应code表里面的:QUESTION_DIFFICULTY-10,20,30,40,这样处理是为了简化细目表管理设计
+	
+	private Integer ability;		//认知层次:I.识记;  II.理解;  III.简单应用;  IV.综合应用,对应数字:1,2,3,4,对应code表里面的:ABILITY-A,B,C,D,这样处理是为了简化细目表管理设计
+
+	private String guid;
+	
+	public String getGuid() {
+		return guid;
+	}
+	public void setGuid(String guid) {
+		this.guid = guid;
+	}
+	
+	public Integer getId() {
+		return id;
+	}
+
+	public void setId(Integer id) {
+		this.id = id;
+	}
+
+	public Integer getSkeletonId() {
+		return skeletonId;
+	}
+
+	public void setSkeletonId(Integer skeletonId) {
+		this.skeletonId = skeletonId;
+	}
+
+	public Integer getQuesTypeNo() {
+		return quesTypeNo;
+	}
+
+	public void setQuesTypeNo(Integer quesTypeNo) {
+		this.quesTypeNo = quesTypeNo;
+	}
+
+	public Integer getAbility() {
+		return ability;
+	}
+	
+	/**
+	 * 返回认知层次code表对应的code值。<br/>
+	 * 认知层次,即认知层次:I.识记;  II.理解;  III.简单应用;  IV.综合应用,对应数字:1,2,3,4,对应code表里面的:ABILITY-A,B,C,D,这样处理是为了简化细目表管理设计
+	 * @return
+	 */
+	public String getAbilityCode(){
+		switch (ability) {
+		case 1:
+			return "A";
+		case 2:
+			return "B";
+		case 3:
+			return "C";
+		default:
+			return "D";
+		}
+	}
+	
+	/**
+	 * 返回认知层次code表对应的显示值。<br/>
+	 * 认知层次,即认知层次:I.识记;  II.理解;  III.简单应用;  IV.综合应用,对应数字:1,2,3,4,对应code表里面的:ABILITY-A,B,C,D,这样处理是为了简化细目表管理设计
+	 * @return
+	 */
+	public String getAbilityText(){
+		return Consts.CodeTextMap.get("ABILITY-" + getAbilityCode());
+	}
+
+	public void setAbility(Integer ability) {
+		this.ability = ability;
+	}
+
+	public Integer getChapterNo() {
+		return chapterNo;
+	}
+
+	public void setChapterNo(Integer chapterNo) {
+		this.chapterNo = chapterNo;
+	}
+
+	public Integer getQuesNum() {
+		return quesNum;
+	}
+
+	public void setQuesNum(Integer quesNum) {
+		this.quesNum = quesNum;
+	}
+
+	public Integer getEstimateDifficulty() {
+		return estimateDifficulty;
+	}
+	
+	/**
+	 * 返回预计难度code表对应的code值。<br/>
+	 * 预计难度:A.易;  B.中等偏易;  C.中等偏难;  D.难,对应数字:1,2,3,4,对应code表里面的:QUESTION_DIFFICULTY-10,20,30,40,这样处理是为了简化细目表管理设计
+	 * @return
+	 */
+	public String getEstimateDifficultyCode(){
+		switch (estimateDifficulty) {
+		case 1:
+			return "10";
+		case 2:
+			return "20";
+		case 3:
+			return "30";
+		default:
+			return "40";
+		}
+	}
+	
+	/**
+	 * 返回预计难度code表对应的显示值。<br/>
+	 * 预计难度:A.易;  B.中等偏易;  C.中等偏难;  D.难,对应数字:1,2,3,4,对应code表里面的:QUESTION_DIFFICULTY-10,20,30,40,这样处理是为了简化细目表管理设计
+	 * @return
+	 */
+	public String getEstimateDifficultyText(){
+		return Consts.CodeTextMap.get("QUESTION_DIFFICULTY-" + getEstimateDifficultyCode());
+	}
+
+	public void setEstimateDifficulty(Integer estimateDifficulty) {
+		this.estimateDifficulty = estimateDifficulty;
+	}
+	
+	public String getQuesTypeName() {
+		return quesTypeName;
+	}
+	
+	public void setQuesTypeName(String quesTypeName) {
+		this.quesTypeName = quesTypeName;
+	}
+	public Double getScore() {
+		return score;
+	}
+	public void setScore(Double score) {
+		this.score = score;
+	}
+}

+ 472 - 0
src/main/java/com/qmth/qrzk/repository/pager/model/PaperSkeletonDetailVO.java

@@ -0,0 +1,472 @@
+package com.qmth.qrzk.repository.pager.model;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+
+public class PaperSkeletonDetailVO {
+
+	private Integer id;				//编号
+	
+	private Integer skeletonId;		//细目表主表ID
+	
+	private Integer questiontypeId;		//题型id
+	
+	private String name;  //题型名称
+	
+	private Integer chapter; //总章节
+	
+	private double questionScore;//小题分
+	
+	private Integer questionTypeTotalCount; //题量总计
+	
+	private Double questionTypeTotalScore;//题量分数总计
+
+	private List<PaperSkeletonDetail> list = new ArrayList<PaperSkeletonDetail>();
+	
+	
+	public Integer getId() {
+		return id;
+	}
+
+	public void setId(Integer id) {
+		this.id = id;
+	}
+
+	public Integer getSkeletonId() {
+		return skeletonId;
+	}
+
+	public void setSkeletonId(Integer skeletonId) {
+		this.skeletonId = skeletonId;
+	}
+
+	public Integer getQuestiontypeId() {
+		return questiontypeId;
+	}
+
+	public void setQuestiontypeId(Integer questiontypeId) {
+		this.questiontypeId = questiontypeId;
+	}
+
+
+	public String getName() {
+		return name;
+	}
+
+	public void setName(String name) {
+		this.name = name;
+	}
+
+	public List<PaperSkeletonDetail> getList() {
+		return list;
+	}
+
+	public void setList(List<PaperSkeletonDetail> list) {
+		this.list = list;
+	}
+
+	public Integer getChapter() {
+		return chapter;
+	}
+
+	public void setChapter(Integer chapter) {
+		this.chapter = chapter;
+	}
+
+	public double getQuestionScore() {
+		return questionScore;
+	}
+
+	public void setQuestionScore(double questionScore) {
+		this.questionScore = questionScore;
+	}
+
+	public Integer getQuestionTypeTotalCount() {
+		return questionTypeTotalCount;
+	}
+
+	public void setQuestionTypeTotalCount(Integer questionTypeTotalCount) {
+		this.questionTypeTotalCount = questionTypeTotalCount;
+	}
+
+	public Double getQuestionTypeTotalScore() {
+		return questionTypeTotalScore;
+	}
+
+	public void setQuestionTypeTotalScore(Double questionTypeTotalScore) {
+		this.questionTypeTotalScore = questionTypeTotalScore;
+	}
+
+	
+	private Integer questionCount1;
+	
+	private Integer questionCount2;
+
+	private Integer questionCount3;
+	
+	private Integer questionCount4;
+	
+	private Integer questionCount5;
+	
+	private Integer questionCount6;
+	
+	private Integer questionCount7;
+	private Integer questionCount8;
+	private Integer questionCount9;
+	private Integer questionCount10;
+	private Integer questionCount11;
+	private Integer questionCount12;
+	private Integer questionCount13;
+	private Integer questionCount14;
+	private Integer questionCount15;
+	private Integer questionCount16;
+	private Integer questionCount17;
+	private Integer questionCount18;
+	private Integer questionCount19;
+	private Integer questionCount20;
+	private Integer questionCount21;
+	private Integer questionCount22;
+	private Integer questionCount23;
+	private Integer questionCount24;
+	private Integer questionCount25;
+	private Integer questionCount26;
+	private Integer questionCount27;
+	private Integer questionCount28;
+	private Integer questionCount29;
+	private Integer questionCount30;
+	private Integer questionCount31;
+	private Integer questionCount32;
+	private Integer questionCount33;
+	private Integer questionCount34;
+	private Integer questionCount35;
+	private Integer questionCount36;
+	private Integer questionCount37;
+	private Integer questionCount38;
+	private Integer questionCount39;
+	private Integer questionCount40;
+
+
+	public Integer getQuestionCount1() {
+		return questionCount1;
+	}
+
+	public void setQuestionCount1(Integer questionCount1) {
+		this.questionCount1 = questionCount1;
+	}
+
+	public Integer getQuestionCount2() {
+		return questionCount2;
+	}
+
+	public void setQuestionCount2(Integer questionCount2) {
+		this.questionCount2 = questionCount2;
+	}
+
+	public Integer getQuestionCount3() {
+		return questionCount3;
+	}
+
+	public void setQuestionCount3(Integer questionCount3) {
+		this.questionCount3 = questionCount3;
+	}
+
+	public Integer getQuestionCount4() {
+		return questionCount4;
+	}
+
+	public void setQuestionCount4(Integer questionCount4) {
+		this.questionCount4 = questionCount4;
+	}
+
+	public Integer getQuestionCount5() {
+		return questionCount5;
+	}
+
+	public void setQuestionCount5(Integer questionCount5) {
+		this.questionCount5 = questionCount5;
+	}
+
+	public Integer getQuestionCount6() {
+		return questionCount6;
+	}
+
+	public void setQuestionCount6(Integer questionCount6) {
+		this.questionCount6 = questionCount6;
+	}
+
+	public Integer getQuestionCount7() {
+		return questionCount7;
+	}
+
+	public void setQuestionCount7(Integer questionCount7) {
+		this.questionCount7 = questionCount7;
+	}
+
+	public Integer getQuestionCount8() {
+		return questionCount8;
+	}
+
+	public void setQuestionCount8(Integer questionCount8) {
+		this.questionCount8 = questionCount8;
+	}
+
+	public Integer getQuestionCount9() {
+		return questionCount9;
+	}
+
+	public void setQuestionCount9(Integer questionCount9) {
+		this.questionCount9 = questionCount9;
+	}
+
+	public Integer getQuestionCount10() {
+		return questionCount10;
+	}
+
+	public void setQuestionCount10(Integer questionCount10) {
+		this.questionCount10 = questionCount10;
+	}
+
+	public Integer getQuestionCount11() {
+		return questionCount11;
+	}
+
+	public void setQuestionCount11(Integer questionCount11) {
+		this.questionCount11 = questionCount11;
+	}
+
+	public Integer getQuestionCount12() {
+		return questionCount12;
+	}
+
+	public void setQuestionCount12(Integer questionCount12) {
+		this.questionCount12 = questionCount12;
+	}
+
+	public Integer getQuestionCount13() {
+		return questionCount13;
+	}
+
+	public void setQuestionCount13(Integer questionCount13) {
+		this.questionCount13 = questionCount13;
+	}
+
+	public Integer getQuestionCount14() {
+		return questionCount14;
+	}
+
+	public void setQuestionCount14(Integer questionCount14) {
+		this.questionCount14 = questionCount14;
+	}
+
+	public Integer getQuestionCount15() {
+		return questionCount15;
+	}
+
+	public void setQuestionCount15(Integer questionCount15) {
+		this.questionCount15 = questionCount15;
+	}
+
+	public Integer getQuestionCount16() {
+		return questionCount16;
+	}
+
+	public void setQuestionCount16(Integer questionCount16) {
+		this.questionCount16 = questionCount16;
+	}
+
+	public Integer getQuestionCount17() {
+		return questionCount17;
+	}
+
+	public void setQuestionCount17(Integer questionCount17) {
+		this.questionCount17 = questionCount17;
+	}
+
+	public Integer getQuestionCount18() {
+		return questionCount18;
+	}
+
+	public void setQuestionCount18(Integer questionCount18) {
+		this.questionCount18 = questionCount18;
+	}
+
+	public Integer getQuestionCount19() {
+		return questionCount19;
+	}
+
+	public void setQuestionCount19(Integer questionCount19) {
+		this.questionCount19 = questionCount19;
+	}
+
+	public Integer getQuestionCount20() {
+		return questionCount20;
+	}
+
+	public void setQuestionCount20(Integer questionCount20) {
+		this.questionCount20 = questionCount20;
+	}
+
+	public Integer getQuestionCount21() {
+		return questionCount21;
+	}
+
+	public void setQuestionCount21(Integer questionCount21) {
+		this.questionCount21 = questionCount21;
+	}
+
+	public Integer getQuestionCount22() {
+		return questionCount22;
+	}
+
+	public void setQuestionCount22(Integer questionCount22) {
+		this.questionCount22 = questionCount22;
+	}
+
+	public Integer getQuestionCount23() {
+		return questionCount23;
+	}
+
+	public void setQuestionCount23(Integer questionCount23) {
+		this.questionCount23 = questionCount23;
+	}
+
+	public Integer getQuestionCount24() {
+		return questionCount24;
+	}
+
+	public void setQuestionCount24(Integer questionCount24) {
+		this.questionCount24 = questionCount24;
+	}
+
+	public Integer getQuestionCount25() {
+		return questionCount25;
+	}
+
+	public void setQuestionCount25(Integer questionCount25) {
+		this.questionCount25 = questionCount25;
+	}
+
+	public Integer getQuestionCount26() {
+		return questionCount26;
+	}
+
+	public void setQuestionCount26(Integer questionCount26) {
+		this.questionCount26 = questionCount26;
+	}
+
+	public Integer getQuestionCount27() {
+		return questionCount27;
+	}
+
+	public void setQuestionCount27(Integer questionCount27) {
+		this.questionCount27 = questionCount27;
+	}
+
+	public Integer getQuestionCount28() {
+		return questionCount28;
+	}
+
+	public void setQuestionCount28(Integer questionCount28) {
+		this.questionCount28 = questionCount28;
+	}
+
+	public Integer getQuestionCount29() {
+		return questionCount29;
+	}
+
+	public void setQuestionCount29(Integer questionCount29) {
+		this.questionCount29 = questionCount29;
+	}
+
+	public Integer getQuestionCount30() {
+		return questionCount30;
+	}
+
+	public void setQuestionCount30(Integer questionCount30) {
+		this.questionCount30 = questionCount30;
+	}
+
+	public Integer getQuestionCount31() {
+		return questionCount31;
+	}
+
+	public void setQuestionCount31(Integer questionCount31) {
+		this.questionCount31 = questionCount31;
+	}
+
+	public Integer getQuestionCount32() {
+		return questionCount32;
+	}
+
+	public void setQuestionCount32(Integer questionCount32) {
+		this.questionCount32 = questionCount32;
+	}
+
+	public Integer getQuestionCount33() {
+		return questionCount33;
+	}
+
+	public void setQuestionCount33(Integer questionCount33) {
+		this.questionCount33 = questionCount33;
+	}
+
+	public Integer getQuestionCount34() {
+		return questionCount34;
+	}
+
+	public void setQuestionCount34(Integer questionCount34) {
+		this.questionCount34 = questionCount34;
+	}
+
+	public Integer getQuestionCount35() {
+		return questionCount35;
+	}
+
+	public void setQuestionCount35(Integer questionCount35) {
+		this.questionCount35 = questionCount35;
+	}
+
+	public Integer getQuestionCount36() {
+		return questionCount36;
+	}
+
+	public void setQuestionCount36(Integer questionCount36) {
+		this.questionCount36 = questionCount36;
+	}
+
+	public Integer getQuestionCount37() {
+		return questionCount37;
+	}
+
+	public void setQuestionCount37(Integer questionCount37) {
+		this.questionCount37 = questionCount37;
+	}
+
+	public Integer getQuestionCount38() {
+		return questionCount38;
+	}
+
+	public void setQuestionCount38(Integer questionCount38) {
+		this.questionCount38 = questionCount38;
+	}
+
+	public Integer getQuestionCount39() {
+		return questionCount39;
+	}
+
+	public void setQuestionCount39(Integer questionCount39) {
+		this.questionCount39 = questionCount39;
+	}
+
+	public Integer getQuestionCount40() {
+		return questionCount40;
+	}
+
+	public void setQuestionCount40(Integer questionCount40) {
+		this.questionCount40 = questionCount40;
+	}
+
+	
+}

+ 124 - 0
src/main/java/com/qmth/qrzk/repository/pager/model/SkelCfg.java

@@ -0,0 +1,124 @@
+package com.qmth.qrzk.repository.pager.model;
+
+public class SkelCfg {
+	private Integer id;
+	private Integer courseId;
+	private Double ability1Percent;
+	private Double ability2Percent;
+	private Double ability3Percent;
+	private Double ability4Percent;
+	private Double abilityOffset;
+	
+	private Double estimateDifficulty1Percent;
+	private Double estimateDifficulty2Percent;
+	private Double estimateDifficulty3Percent;
+	private Double estimateDifficulty4Percent;
+	private Double estimateDifficultyOffset;
+	
+	private String guid;
+
+	public Integer getId() {
+		return id;
+	}
+
+	public void setId(Integer id) {
+		this.id = id;
+	}
+
+	public Integer getCourseId() {
+		return courseId;
+	}
+
+	public void setCourseId(Integer courseId) {
+		this.courseId = courseId;
+	}
+
+	public Double getAbility1Percent() {
+		return ability1Percent;
+	}
+
+	public void setAbility1Percent(Double ability1Percent) {
+		this.ability1Percent = ability1Percent;
+	}
+
+	public Double getAbility2Percent() {
+		return ability2Percent;
+	}
+
+	public void setAbility2Percent(Double ability2Percent) {
+		this.ability2Percent = ability2Percent;
+	}
+
+	public Double getAbility3Percent() {
+		return ability3Percent;
+	}
+
+	public void setAbility3Percent(Double ability3Percent) {
+		this.ability3Percent = ability3Percent;
+	}
+
+	public Double getAbility4Percent() {
+		return ability4Percent;
+	}
+
+	public void setAbility4Percent(Double ability4Percent) {
+		this.ability4Percent = ability4Percent;
+	}
+
+	public Double getAbilityOffset() {
+		return abilityOffset;
+	}
+
+	public void setAbilityOffset(Double abilityOffset) {
+		this.abilityOffset = abilityOffset;
+	}
+
+	public Double getEstimateDifficulty1Percent() {
+		return estimateDifficulty1Percent;
+	}
+
+	public void setEstimateDifficulty1Percent(Double estimateDifficulty1Percent) {
+		this.estimateDifficulty1Percent = estimateDifficulty1Percent;
+	}
+
+	public Double getEstimateDifficulty2Percent() {
+		return estimateDifficulty2Percent;
+	}
+
+	public void setEstimateDifficulty2Percent(Double estimateDifficulty2Percent) {
+		this.estimateDifficulty2Percent = estimateDifficulty2Percent;
+	}
+
+	public Double getEstimateDifficulty3Percent() {
+		return estimateDifficulty3Percent;
+	}
+
+	public void setEstimateDifficulty3Percent(Double estimateDifficulty3Percent) {
+		this.estimateDifficulty3Percent = estimateDifficulty3Percent;
+	}
+
+	public Double getEstimateDifficulty4Percent() {
+		return estimateDifficulty4Percent;
+	}
+
+	public void setEstimateDifficulty4Percent(Double estimateDifficulty4Percent) {
+		this.estimateDifficulty4Percent = estimateDifficulty4Percent;
+	}
+
+	public Double getEstimateDifficultyOffset() {
+		return estimateDifficultyOffset;
+	}
+
+	public void setEstimateDifficultyOffset(Double estimateDifficultyOffset) {
+		this.estimateDifficultyOffset = estimateDifficultyOffset;
+	}
+
+	public String getGuid() {
+		return guid;
+	}
+
+	public void setGuid(String guid) {
+		this.guid = guid;
+	}
+
+}

+ 992 - 0
src/main/java/com/qmth/qrzk/repository/pager/service/PagerConstructService.java

@@ -0,0 +1,992 @@
+/*
+ * ================================================================== $Id:
+ * codetemplates.xml,v 1.1 2006/04/24 09:18:57 饶国发 Exp $ Created [2014-9-20
+ * 上午11:18:43] by 饶国发
+ * ================================================================== qrzk
+ * ================================================================== qrzk
+ * License v1.0 Copyright (c) Wuhan G-Soft Technology CO.,LTD., 2010-2012
+ * ==================================================================
+ * 武汉威鹏科技有限公司拥有该文件的使用、复制、修改和分发的许可权 如果你想得到更多信息,请访问 <http://www.wptech.net.cn>
+ * 
+ * Wuhan WP-Soft Technology CO.,LTD. owns permission to use, copy, modify and
+ * distribute this documentation. For more information on qrzk, please see
+ * <http://www.wptech.net.cn>.
+ * ==================================================================
+ */
+
+package com.qmth.qrzk.repository.pager.service;
+
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+import java.util.Map.Entry;
+import java.util.Set;
+
+import org.apache.commons.lang.StringUtils;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Service;
+
+import com.qmth.qrzk.dao.IQuestionDao;
+import com.qmth.qrzk.repository.common.base.BaseDao;
+import com.qmth.qrzk.repository.common.mapper.PaperSimilarityMapper;
+import com.qmth.qrzk.repository.common.mapper.QuestionMapper;
+import com.qmth.qrzk.repository.exception.BizException;
+import com.qmth.qrzk.repository.pager.model.PagerConstruct;
+import com.qmth.qrzk.repository.pager.model.PagerConstructDetail;
+import com.qmth.qrzk.repository.pager.model.PagerConstructQtype;
+import com.qmth.qrzk.repository.pager.model.PaperSkeleton;
+import com.qmth.qrzk.repository.pager.model.PaperSkeletonDetail;
+import com.qmth.qrzk.repository.service.query.AvailableQuesQueryParams;
+import com.qmth.qrzk.repository.service.query.PagerQueryParams;
+import com.qmth.qrzk.repository.service.query.PaperSimilarityQueryParams;
+import com.qmth.qrzk.repository.task.PaperTask;
+import com.qmth.qrzk.repository.user.model.Code;
+import com.qmth.qrzk.repository.user.model.Question;
+import com.qmth.qrzk.repository.user.model.QuestionOption;
+import com.qmth.qrzk.repository.user.model.QuestionType;
+import com.qmth.qrzk.repository.user.model.SimilarPaper;
+import com.qmth.qrzk.repository.user.model.SimilarPaperQuestion;
+import com.qmth.qrzk.repository.user.model.SimilarQuestion;
+import com.qmth.qrzk.repository.user.model.User;
+import com.qmth.qrzk.repository.user.service.impl.PaperSkeletonService;
+import com.qmth.qrzk.repository.user.service.impl.QuestionServiceImpl;
+import com.qmth.qrzk.repository.utils.Consts;
+import com.qmth.qrzk.repository.utils.DateHelper;
+import com.qmth.qrzk.repository.utils.General;
+import com.qmth.qrzk.repository.utils.ParamUtils;
+import com.qmth.qrzk.repository.utils.StringSimilarityUtils;
+import com.qmth.qrzk.repository.utils.zujuan.OldQuestionSet;
+
+/**
+ * <p>
+ * PagerConstructService.java
+ * </p>
+ * <p>
+ * 组卷service(试卷)
+ * </p>
+ * 
+ * @author $Author: 饶国发 $
+ * @version $Revision: V5.1 $
+ */
+@Service
+public class PagerConstructService {
+
+	@Autowired
+	private BaseDao dao;
+
+	@Autowired
+	private PaperSkeletonService paperSkeletonSrv;
+
+	@Autowired
+	private ZujuanService zujuanService;
+
+	@Autowired
+	private QuestionServiceImpl questionService;
+	
+	@Autowired
+	@Qualifier("paperSimilarityMapper")
+	private PaperSimilarityMapper paperSimilarityMapper;
+	
+	@Autowired
+	@Qualifier("questionMapper")
+	private QuestionMapper questionMapper;
+	
+	@Autowired
+	@Qualifier("questionDaoImpl")
+	private IQuestionDao questionDao;
+
+	/***
+	 * 根据课程信息获取细目表
+	 * <p>
+	 * </p>
+	 * 
+	 * @param courseId
+	 * @return
+	 */
+	public List<PaperSkeleton> findSkectionsByCourse(int courseId, int bookId) {
+		Map<String, Integer> param = new HashMap<String, Integer>();
+		param.put("courseId", courseId);
+		param.put("bookId", bookId);
+		return dao.getList("findSkectionsByCourse", param);
+	}
+
+	public int countBlankQuesNum(int paperId) {
+		return dao.get("countBlankQuesNumByPaperId", paperId);
+	}
+
+	public PagerConstruct generateBlankPaper(PaperTask task, User curUser) {
+		PagerConstruct pager = task.getPagerConstruct();
+		if (pager == null) {
+			PaperSkeleton skel = paperSkeletonSrv.queryById(task.getPaperSkeleton().getId());
+			List<QuestionType> quesTypeArr = skel.getQuesTypeArr();
+			Map<String, List<PaperSkeletonDetail>> skelDetailMap = new HashMap<String, List<PaperSkeletonDetail>>();
+			for (PaperSkeletonDetail d : skel.getSkeletonDetailArr()) {
+				QuestionType qt = quesTypeArr.get(d.getQuesTypeNo() - 1);
+				String key = qt.getId() + "_" + qt.getDefaultScore();
+				List<PaperSkeletonDetail> dList = skelDetailMap.get(key);
+				if (dList == null) {
+					dList = new ArrayList<PaperSkeletonDetail>();
+					skelDetailMap.put(key, dList);
+				}
+				dList.add(d);
+			}
+
+			pager = new PagerConstruct();
+			pager.setTaskId(task.getId());
+			pager.setName(task.getTaskNo());
+			String head = Consts.DEFAULT_HEAD.replace("XXXX", DateHelper.formatDate(new Date(), "yyyy")).replace("XX",
+					DateHelper.formatDate(new Date(), "M"));
+			pager.setHead(head);
+			pager.setSkeletonId(skel.getId());
+			pager.setResourse(2);// 手工组卷
+			pager.setStatus(Consts.PaperStatus.DRAFT);// 草稿
+			pager.setCreatedBy(curUser.getId());
+
+			List<PagerConstructQtype> pcqtList = new ArrayList<PagerConstructQtype>();
+			pager.setQtypeList(pcqtList);
+			for (int j = 0; j < quesTypeArr.size(); j++) {
+				QuestionType qt = quesTypeArr.get(j);
+				PagerConstructQtype pcqt = new PagerConstructQtype();
+				pcqt.setName(qt.getName());
+				pcqt.setQuestionTypeId(qt.getId());
+				pcqt.setSortNo(j + 1);
+				pcqt.setScore(qt.getDefaultScore());
+				pcqt.setCreatedBy(curUser.getId());
+				List<PaperSkeletonDetail> dList = skelDetailMap.get(qt.getId() + "_" + qt.getDefaultScore());
+
+				List<PagerConstructDetail> pcdList = new ArrayList<PagerConstructDetail>();
+				pcqt.setConstructDetails(pcdList);
+				for (int m = 0; dList != null && m < dList.size(); m++) {
+					PaperSkeletonDetail detail = dList.get(m);
+					for (int t = 0; t < detail.getQuesNum(); t++) {
+						PagerConstructDetail pcDetail = new PagerConstructDetail();
+						pcDetail.setQuestionScore(qt.getDefaultScore());
+						pcDetail.setSortNo(m + 1);
+						pcDetail.setCreatedBy(curUser.getId());
+						pcDetail.setQuestionId(0);
+						pcdList.add(pcDetail);
+					}
+				}
+				pcqt.setQuestionSum(pcdList.size());
+				pcqt.setQuestionScores(pcqt.getQuestionSum() * pcqt.getScore());
+				pcqtList.add(pcqt);
+			}
+
+			/******************** 分割线,上面是组卷逻辑,下面就要开始保存组好试卷了 ******************/
+			dao.insert("addPagerConstruct", pager);
+			for (PagerConstructQtype pcqt : pager.getQtypeList()) {
+				pcqt.setPagerConstructId(pager.getId());
+				dao.insert("addPagerConstructQtype", pcqt);
+				for (PagerConstructDetail detail : pcqt.getConstructDetails()) {
+					detail.setPagerConstructId(pager.getId());
+					detail.setPagerQtypeId(pcqt.getId());
+					dao.insert("addPagerConstructDetail", detail);
+				}
+			}
+		}
+
+		pager = zujuanService.getWholePaperInfoForShow(pager.getId());
+		task.setPagerConstruct(pager);
+		return pager;
+	}
+
+	/**
+	 * 智能组一张试卷
+	 * 
+	 * @param task
+	 * @param curUser
+	 * @param enableLeak
+	 *            - 是否允许缺少试题
+	 * @return
+	 * @throws BizException
+	 */
+	public PagerConstruct autoAdd(PaperTask task, User curUser, boolean enableLeak) throws BizException {
+		PagerConstruct pager = task.getPagerConstruct();
+		if (pager == null) {
+			pager = autoZujuan(paperSkeletonSrv.queryById(task.getPaperSkeleton().getId()), 1, curUser, task.getId(),
+					task.getTaskNo(), Consts.DEFAULT_HEAD.replace("XXXX", DateHelper.formatDate(new Date(), "yyyy"))
+							.replace("XX", DateHelper.formatDate(new Date(), "M")),
+					enableLeak).get(0);
+			/******************** 分割线,上面是组卷逻辑,下面就要开始保存组好试卷了 ******************/
+			dao.insert("addPagerConstruct", pager);
+			for (PagerConstructQtype pcqt : pager.getQtypeList()) {
+				pcqt.setPagerConstructId(pager.getId());
+				dao.insert("addPagerConstructQtype", pcqt);
+				for (PagerConstructDetail detail : pcqt.getConstructDetails()) {
+					detail.setPagerConstructId(pager.getId());
+					detail.setPagerQtypeId(pcqt.getId());
+					dao.insert("addPagerConstructDetail", detail);
+				}
+			}
+		}
+		pager = zujuanService.getWholePaperInfoForShow(pager.getId());
+		task.setPagerConstruct(pager);
+		return pager;
+	}
+
+	/**
+	 * 
+	 * <p>
+	 * </p>
+	 * 组卷
+	 * 
+	 * @param skeleton_id
+	 *            ,细目表id
+	 * @param zj_sum
+	 *            ,组卷数量
+	 * @param i_same
+	 *            重复题限制数量(暂时未使用)
+	 * @param i_old
+	 *            旧题数量限制(暂时未使用)
+	 * @return
+	 * @throws BizException
+	 */
+	public List<PagerConstruct> dealZujuan(int skeleton_id, String head, int zj_sum, User user, int i_same, int i_old)
+			throws BizException {
+		PaperSkeleton skel = paperSkeletonSrv.queryById(skeleton_id);
+		List<PagerConstruct> paperList = autoZujuan(skel, zj_sum, user, null, null, head, false);
+		/******************** 分割线,上面是组卷逻辑,下面就要开始保存组好试卷了 ******************/
+		for (PagerConstruct pager : paperList) {
+			dao.insert("addPagerConstruct", pager);
+			for (PagerConstructQtype pcqt : pager.getQtypeList()) {
+				pcqt.setPagerConstructId(pager.getId());
+				dao.insert("addPagerConstructQtype", pcqt);
+				for (PagerConstructDetail detail : pcqt.getConstructDetails()) {
+					detail.setPagerConstructId(pager.getId());
+					detail.setPagerQtypeId(pcqt.getId());
+					dao.insert("addPagerConstructDetail", detail);
+				}
+			}
+		}
+		return paperList;
+	}
+
+	/**
+	 * 智能组卷通用方法
+	 * 
+	 * @param skel
+	 *            - 组卷细目表
+	 * @param number
+	 *            - 试卷数量
+	 * @param user
+	 *            - 当前用户
+	 * @param taskId
+	 *            - 任务ID
+	 * @param name
+	 *            - 试卷名称
+	 * @param header
+	 *            - 试卷抬头
+	 * @param enableLeak
+	 *            - 是否允许缺少试题,若不允许则直接抛出异常
+	 * @return
+	 * @throws BizException
+	 */
+	private List<PagerConstruct> autoZujuan(PaperSkeleton skel, int number, User user, Integer taskId, String name,
+			String header, boolean enableLeak) throws BizException {
+		List<QuestionType> quesTypeArr = skel.getQuesTypeArr();
+		Map<String, List<PaperSkeletonDetail>> skelDetailMap = new HashMap<String, List<PaperSkeletonDetail>>();
+		for (PaperSkeletonDetail d : skel.getSkeletonDetailArr()) {
+			QuestionType qt = quesTypeArr.get(d.getQuesTypeNo() - 1);
+			String key = qt.getId() + "_" + qt.getDefaultScore();
+			List<PaperSkeletonDetail> dList = skelDetailMap.get(key);
+			if (dList == null) {
+				dList = new ArrayList<PaperSkeletonDetail>();
+				skelDetailMap.put(key, dList);
+			}
+			dList.add(d);
+		}
+
+		List<Question> newQuestionList = this.dao.getList("queryNewQuestion", skel);// 所有可用的新题
+		Map<String, List<Question>> newQuestionMap = new HashMap<String, List<Question>>();
+		for (Question q : newQuestionList) {
+			String key = getZujuanKey(q);
+			List<Question> quesList = newQuestionMap.get(key);
+			if (quesList == null) {
+				quesList = new ArrayList<Question>();
+				newQuestionMap.put(key, quesList);
+			}
+			quesList.add(q);
+		}
+		List<Question> oldQuestionList = this.dao.getList("query3YearOldQuestion", skel);// 所有使用超过3年的旧题
+		OldQuestionSet oldSet = new OldQuestionSet(0.2);
+		for (Question q : oldQuestionList) {
+			oldSet.addQuestion(q, getZujuanKey(q));
+		}
+		Set<Integer> usedSet = new HashSet<Integer>();
+		Map<String, List<Question>> chosenQuesMap = new HashMap<String, List<Question>>();
+
+		List<PagerConstruct> paperList = new ArrayList<PagerConstruct>();
+		for (int i = 0; i < number; i++) {
+			// Set<Integer> quesIdSetForCurPager = new
+			// HashSet<Integer>();当前试卷中已被选中的试题
+			PagerConstruct pager = new PagerConstruct();
+			pager.setTaskId(taskId);
+			// 若没有指定名称,则取细目表名称+序号
+			pager.setName(name != null ? name : skel.getName() + General.toUpperLetter(i + 1));
+			pager.setHead(header);
+			pager.setSkeletonId(skel.getId());
+			pager.setResourse(1);// 智能组卷
+			pager.setStatus(Consts.PaperStatus.DRAFT);// 草稿
+			pager.setCreatedBy(user.getId());
+			pager.setMaxOldCount(0);
+			pager.setMaxSameCount(0);
+			paperList.add(pager);
+
+			List<PagerConstructQtype> pcqtList = new ArrayList<PagerConstructQtype>();
+			pager.setQtypeList(pcqtList);
+			for (int j = 0; j < quesTypeArr.size(); j++) {
+				QuestionType qt = quesTypeArr.get(j);
+				PagerConstructQtype pcqt = new PagerConstructQtype();
+				pcqt.setName(qt.getName());
+				pcqt.setQuestionTypeId(qt.getId());
+				pcqt.setSortNo(j + 1);
+				pcqt.setScore(qt.getDefaultScore());
+				pcqt.setCreatedBy(user.getId());
+				List<PaperSkeletonDetail> dList = skelDetailMap.get(qt.getId() + "_" + qt.getDefaultScore());
+
+				List<PagerConstructDetail> pcdList = new ArrayList<PagerConstructDetail>();
+				pcqt.setConstructDetails(pcdList);
+				for (int m = 0; dList != null && m < dList.size(); m++) {
+					PaperSkeletonDetail detail = dList.get(m);
+					for (int t = 0; t < detail.getQuesNum(); t++) {
+						PagerConstructDetail pcDetail = new PagerConstructDetail();
+						pcDetail.setQuestionScore(qt.getDefaultScore());
+						pcDetail.setSortNo(m + 1);
+						pcDetail.setCreatedBy(user.getId());
+						Random rand = new Random();
+						
+						String key = getZujuanKey(qt, detail);
+						Question ques = null;
+						{
+							List<Question> quesList = newQuestionMap.get(key);
+							// 循环从新题列表中取题尝试
+							while (quesList != null && quesList.size() > 0) {
+								//ques = quesList.remove(0);
+								ques = quesList.remove(rand.nextInt(quesList.size()));
+								if (usedSet.contains(ques.getId())) {
+									// 当前试题已用过,继续取下一题
+									continue;
+								} else {
+									break;//从新题列表中找到,并且已用题目里面没有,则跳出while
+								}
+							}
+						}
+						if (ques == null) {
+							// 循环从旧题列表中尝试取题
+							while (true) {
+								ques = oldSet.selectQuestion(key);
+								if (ques != null) {
+									if (usedSet.contains(ques.getId())) {
+										// 当前试题已用过,继续取下一题
+										continue;
+									} else {
+										break;
+									}
+								} else {
+									// 取题失败,直接退出
+									break;
+								}
+							}
+						}
+						if (ques == null) {
+							if (enableLeak) {
+								// 允许缺题的情况下,自动构建空白试题对象
+								ques = new Question();
+								ques.setId(0);
+							} else {
+								throw new BizException(getTip(qt, detail) + "的题量不够,请补充试题");
+							}
+							// 以下判断内容直接忽略,暂不考虑重复试题
+							// if (i == 0) {
+							// if (curOldQuesList == null ||
+							// curOldQuesList.size() == 0) {
+							// throw new BizException(getTip(qt, detail) +
+							// "的题量不够,请补充试题。");
+							// } else {
+							// throw new BizException("要使用的旧题量已超过了旧题数量限制");
+							// }
+							// } else {
+							// if (i_same > 0) {//
+							// 这个时候一定能在已选中的题中找到可用的题,因为第1套试卷已经组好了。
+							// List<Question> chosenQuesList =
+							// chosenQuesMap.get(key);
+							// for (Question q : chosenQuesList) {
+							// if (quesIdSetForCurPager.contains(q.getId())) {
+							// continue;
+							// } else {
+							// ques = q;
+							// i_same--;
+							// break;
+							// }
+							// }
+							// } else {
+							// throw new BizException("要重复使用的题量已超过了重复题限制数量");
+							// }
+							// }
+						} else {
+							// 取题成功,记录结果
+							usedSet.add(ques.getId());
+
+							List<Question> chosenQuesList = chosenQuesMap.get(key);
+							if (chosenQuesList == null) {
+								chosenQuesList = new ArrayList<Question>();
+								chosenQuesMap.put(key, chosenQuesList);
+							}
+							chosenQuesList.add(ques);
+						}
+						// quesIdSetForCurPager.add(ques.getId());
+						pcDetail.setQuestionId(ques.getId());
+						pcdList.add(pcDetail);
+					}
+				}
+				pcqt.setQuestionSum(pcdList.size());
+				pcqt.setQuestionScores(pcqt.getQuestionSum() * pcqt.getScore());
+				pcqtList.add(pcqt);
+			}
+		}
+
+		return paperList;
+	}
+
+	private static String getZujuanKey(Question q) {
+		StringBuilder key = new StringBuilder(String.valueOf(q.getTypeId()));
+		if (!ParamUtils.IgnoreScoreWhenZj) {
+			key.append("_score_").append(q.getScore());
+		}
+		if (!ParamUtils.IgnoreChapterWhenZj) {
+			key.append("_chapter_").append(q.getChapter());
+		}
+		if (!ParamUtils.IgnoreDiffWhenZj) {
+			key.append("_difficulty_").append(q.getEstimateDifficultyCode());
+		}
+		if (!ParamUtils.IgnoreAbilityWhenZj) {
+			key.append("_ability_").append(q.getAbilityCode());
+		}
+		return key.toString();
+	}
+
+	private static String getZujuanKey(QuestionType qt, PaperSkeletonDetail detail) {
+		StringBuilder key = new StringBuilder(String.valueOf(qt.getId()));
+		if (!ParamUtils.IgnoreScoreWhenZj) {
+			key.append("_score_").append(qt.getDefaultScore());
+		}
+		if (!ParamUtils.IgnoreChapterWhenZj) {
+			key.append("_chapter_").append(detail.getChapterNo());
+		}
+		if (!ParamUtils.IgnoreDiffWhenZj) {
+			key.append("_difficulty_").append(detail.getEstimateDifficultyCode());
+		}
+		if (!ParamUtils.IgnoreAbilityWhenZj) {
+			key.append("_ability_").append(detail.getAbilityCode());
+		}
+		return key.toString();
+	}
+
+	private static StringBuffer getTip(QuestionType qt, PaperSkeletonDetail detail) {
+		StringBuffer tip = new StringBuffer();
+		tip.append("题型为 ").append(qt.getName()).append(" ");
+		if (!ParamUtils.IgnoreScoreWhenZj) {
+			tip.append("、分值为 ").append(General.formatScore(qt.getDefaultScore())).append(" ");
+		}
+		if (!ParamUtils.IgnoreChapterWhenZj) {
+			tip.append("、章节为 ").append(detail.getChapterNo()).append(" ");
+		}
+		if (!ParamUtils.IgnoreDiffWhenZj) {
+			tip.append("、预计难度为 ").append(detail.getEstimateDifficultyText()).append(" ");
+		}
+		if (!ParamUtils.IgnoreAbilityWhenZj) {
+			tip.append("、认知层次为 ").append(detail.getAbilityText()).append(" ");
+		}
+		return tip;
+	}
+
+	public void savePaper(PagerConstruct paper) {
+		dao.update("updatePagerConstruct", paper);
+		for (PagerConstructQtype qt : paper.getQtypeList()) {
+			dao.update("updatePagerConstructQtype", qt);
+			for (PagerConstructDetail detail : qt.getConstructDetails()) {
+				dao.update("updatePagerConstructDetail", detail);
+			}
+		}
+	}
+
+	public List<Question> queryAvailableQues(AvailableQuesQueryParams queryParams) {
+		PagerConstructQtype pcqtype = dao.get("getPagerConstructQtypesById", queryParams.getPcqtId());
+		PagerConstruct construct = dao.get("findPagerConstructById", pcqtype.getPagerConstructId());
+		queryParams.setScore(pcqtype.getScore());
+		queryParams.setQtId(pcqtype.getQuestionTypeId());
+		queryParams.setCourseId(construct.getSkeleton().getCourseId());
+		queryParams.setBookId(construct.getSkeleton().getBookId());
+		queryParams.setConstructId(construct.getId());
+		List<Question> quesList = dao.getPagerList("queryAvailableQues", queryParams);
+		return quesList;
+	}
+
+	public Question randomQues(int pcqtId, int detailId, String curQuesIdListStr, String rndListStr) {
+		PagerConstructQtype pcqtype = dao.get("getPagerConstructQtypesById", pcqtId);
+		PagerConstruct paper = dao.get("findPagerConstructById", pcqtype.getPagerConstructId());
+		Question quesCondition = new Question();
+		quesCondition.setCourseId(paper.getSkeleton().getCourseId());
+		quesCondition.setBookId(paper.getSkeleton().getBookId());
+		quesCondition.setTypeId(pcqtype.getQuestionTypeId());
+		quesCondition.setScore(pcqtype.getScore());
+
+		List<Question> quesList = questionService.zjGetAllQuestions(quesCondition, paper.getId(),
+				Consts.QuesOperTypeForZj.CHANGE_INTO_PAPER, detailId);
+		if (quesList == null || quesList.size() == 0) {
+			return null;
+		}
+		Question ques = null;
+		String[] rndList = rndListStr.split(",");
+		List<Integer> rndedList = new ArrayList<Integer>();
+		for (String rnded : rndList) {
+			if (!General.isEmpty(rnded)) {
+				rndedList.add(Integer.parseInt(rnded));
+			}
+		}
+		if (rndedList.size() == 0) {// 如果之前没有取过,就取第一个
+			ques = quesList.get(0);
+		} else {
+			Map<Integer, Integer> repeatNumMap = new HashMap<Integer, Integer>();
+			Map<Integer, Question> quesMap = new HashMap<Integer, Question>();
+
+			for (Question q : quesList) {
+				repeatNumMap.put(q.getId(), 0);
+				quesMap.put(q.getId(), q);
+			}
+			List<Integer> curQuesIdList = new ArrayList<Integer>();
+			for (String qIdStr : curQuesIdListStr.split(",")) {
+				int qId = General.toInteger(qIdStr, 0);
+				if (!curQuesIdList.contains(qId)) {
+					curQuesIdList.add(qId);
+				}
+				repeatNumMap.remove(qId);// 把当前试题列表重复的试题从repeatNumMap去掉,保证随机取时不会取到重复的数据
+			}
+			if (repeatNumMap.size() == 0) {
+				return null;
+			}
+			for (int i = 0; i < rndedList.size() - 1; i++) {
+				int qIdTmp = rndedList.get(i);
+				if (!curQuesIdList.contains(qIdTmp)) {
+					Integer repeatNum = repeatNumMap.get(qIdTmp);
+					if (repeatNum == null) {
+						repeatNum = 0;
+					}
+					repeatNum++;
+					repeatNumMap.put(qIdTmp, repeatNum);
+				}
+			}
+			List<Map.Entry<Integer, Integer>> entryList = new ArrayList<Map.Entry<Integer, Integer>>(
+					repeatNumMap.entrySet());
+			Collections.sort(entryList, new Comparator<Map.Entry<Integer, Integer>>() {
+
+				@Override
+				public int compare(Entry<Integer, Integer> o1, Entry<Integer, Integer> o2) {
+					return o1.getValue() - o2.getValue();
+				}
+			});
+			ques = quesMap.get(entryList.get(0).getKey());
+		}
+		General.quesWordToHtmlForShow(ques);
+		return ques;
+	}
+
+	public Map<String, Object> questionStat(int paperId, int questionId) {
+		Map<String, Object> statResult = new HashMap<String, Object>();
+		{// 获取不在当前试卷下的其他试卷信息
+			Map<String, Object> param = new HashMap<String, Object>();
+			param.put("paperId", paperId);
+			param.put("questionId", questionId);
+			List<PagerConstruct> papers = dao.getList("statQuestionInPaper", param);
+			statResult.put("papers", papers);
+			statResult.put("papersSize", (papers != null) ? papers.size() : 0);
+		}
+		{// 获取试题的详情,为了传输熟虑考虑,去掉试题的题干和答案数据
+			Question qustion = dao.getObject("searchQuestionWithOptionsById", questionId);
+			// QuestionType qt = dao.get("selectQuestionTypeById",
+			// qustion.getTypeId());
+			List<Code> codeList = dao.getList("findAllCodes");
+			Map<String, String> codeMap = new HashMap<String, String>();
+			for (Code code : codeList) {
+				codeMap.put(code.getItemType() + "|" + code.getItemCode(), code.getItemValue());
+			}
+			qustion.setEstimateDifficultyText(
+					codeMap.get("QUESTION_DIFFICULTY|" + qustion.getEstimateDifficultyCode()));
+			qustion.setMeasuredDifficultyText(
+					codeMap.get("QUESTION_DIFFICULTY|" + qustion.getMeasuredDifficultyCode()));
+			qustion.setGradeText(codeMap.get("GRADE|" + qustion.getGradeCode()));
+			qustion.setAbilityText(codeMap.get("ABILITY|" + qustion.getAbilityCode()));
+			qustion.setAssessmentDemandText(codeMap.get("ASSESSMENT_DEMAND|" + qustion.getAssessmentDemand()));
+			qustion.setBodyWord(null);
+			qustion.setBody(null);
+			qustion.setBodySummary(null);
+
+			qustion.setAnswer(null);
+			qustion.setAnswerSummary(null);
+			qustion.setOptions(null);
+			qustion.setAnswerWord(null);
+			qustion.setAnswerSheet(null);
+			statResult.put("qustion", qustion);
+		}
+		return statResult;
+	}
+
+	/**
+	 * 启用试卷方法
+	 * 
+	 * @param quesId
+	 * @param date
+	 *            yyyy-mm
+	 * @return
+	 */
+	public void saveOpenPaper(String paperCode, String date) {
+		List<PagerConstruct> paperList = dao.getList("getPapersByPaperCode",paperCode);
+		for(PagerConstruct paper:paperList){
+			// 说明已经启用
+			if (paper.getStartTime() == null && General.isNotEmpty(date)) {
+				paper.setStartTime(DateHelper.parseYearString(date));
+				dao.update("updatePagerConstruct", paper);
+				// 同时更新所有试题启用时间
+				dao.update("updateQuestionStartTime", paper);
+			}
+		}
+	}
+
+	/**
+	 * <p>
+	 * 统计一张试卷中所有相似试题
+	 * </p>
+	 * @author songyue
+	 * @date 2016-05-12
+	 */
+	public List<SimilarQuestion> checkSimilarity(int paperId) {
+		List<SimilarQuestion> similarQuestionList = new ArrayList<SimilarQuestion>();
+		List<SimilarQuestion> resultList = new ArrayList<SimilarQuestion>();
+		PagerConstruct paper = zujuanService.findById(paperId);
+		if (paper == null) {
+			return null;
+		}
+		List<PagerConstructQtype> qtypes = dao.getList("findPagerConstructQtypesByPaperId", paperId);
+		for (PagerConstructQtype qt : qtypes) {
+			for (PagerConstructDetail pcd : qt.getConstructDetails()) {
+				Question ques = pcd.getQuestion();
+				if (ques != null && pcd.getQuestionId() != 0) {
+					List<QuestionOption> quesOption = ques.getOptions();
+					String option = "";
+					if (quesOption != null && quesOption.size() > 0) {
+						for (QuestionOption op : quesOption) {
+							option += op.getSummary();
+						}
+					}
+					SimilarQuestion simlarQuestion = new SimilarQuestion();
+					simlarQuestion.setSimilarQuestionName(qt.getName() + "-" + pcd.getSortNo().intValue());
+					simlarQuestion.setSimilarQuestionNo(ques.getQuestionNo());
+					simlarQuestion.setSimilarQuestionBody(ques.getBodySummary() + option);
+					similarQuestionList.add(simlarQuestion);
+				}
+			}
+		}
+		int size = similarQuestionList.size();
+		double similarity = 0;
+		for (int i = 0; i < size; i++) {
+			for (int j = i + 1; j < size; j++) {
+				SimilarQuestion similarques1 = similarQuestionList.get(i);
+				SimilarQuestion similarques2 = similarQuestionList.get(j);
+				if ((similarity = StringSimilarityUtils.getSimilarityWithCosinesBySeg(similarques1.getSimilarQuestionBody(),
+						similarques2.getSimilarQuestionBody()) * 100) >= 60) {
+					SimilarQuestion similarResult = new SimilarQuestion();
+					similarResult.setSimilarQuestionName(
+							similarques1.getSimilarQuestionName() + "," + similarques2.getSimilarQuestionName());
+					similarResult.setSimilarity(String.format("%.2f", similarity));
+					resultList.add(similarResult);
+				}
+			}
+		}
+		Collections.sort(resultList);
+		return resultList;
+	}
+	
+	/**
+	 * <p>
+	 * 检查试题选项相似度
+	 * </p>
+	 * @author songyue
+	 * @date 2016-08-12
+	 */
+	public List<SimilarQuestion> checkSimilarityOption(int quesId) {
+		long start = System.currentTimeMillis();
+		List<SimilarQuestion> similarQuestionList = new ArrayList<SimilarQuestion>();
+		List<SimilarQuestion> resultList = new ArrayList<SimilarQuestion>();
+		Question ques = questionMapper.searchById(quesId);
+		if (ques == null) {
+			return null;
+		}else if (ques != null) {
+			List<QuestionOption> quesOption = ques.getOptions();
+			if (quesOption != null && quesOption.size() > 0) {
+				for (QuestionOption op : quesOption) {
+					SimilarQuestion simlarQuestion = new SimilarQuestion();
+					simlarQuestion.setSimilarQuestionName(op.getOptionNoString() + "选项");
+					simlarQuestion.setSimilarQuestionNo(ques.getQuestionNo());
+					simlarQuestion.setSimilarQuestionBody(extratHtmlNew(op.getContentHtml()));
+					similarQuestionList.add(simlarQuestion);
+				}
+			} else {
+				return null;
+			}
+		}
+		int size = similarQuestionList.size();
+		double similarity = 0;
+		for (int i = 0; i < size; i++) {
+			for (int j = i + 1; j < size; j++) {
+				SimilarQuestion similarques1 = similarQuestionList.get(i);
+				SimilarQuestion similarques2 = similarQuestionList.get(j);
+				if ((similarity = StringSimilarityUtils.getSimilarityWithCosinesBySeg(similarques1.getSimilarQuestionBody(),
+						similarques2.getSimilarQuestionBody()) * 100) >= 0) {
+					SimilarQuestion similarResult = new SimilarQuestion();
+					similarResult.setSimilarQuestionName(
+							similarques1.getSimilarQuestionName() + "," + similarques2.getSimilarQuestionName());
+					similarResult.setSimilarity(String.format("%.2f", similarity));
+					resultList.add(similarResult);
+				}
+			}
+		}
+		Collections.sort(resultList);
+		long end = System.currentTimeMillis();
+		System.out.println("选项相似度检查耗时--->" + (end - start)/1000.0);
+		return resultList;
+	}
+	
+	public static String extratHtmlNew(String html){
+		String htmlStr = "";
+		htmlStr = General.repairHtmlFormula(html);
+		htmlStr = General.extractText(htmlStr);
+		return htmlStr;
+	}
+	
+	/**
+	 * <p>查询相似试卷</p>
+	 * @author songyue
+	 * @date 2016-05-20
+	 */
+	public List<SimilarPaper> queryPaperSimilarity(PaperSimilarityQueryParams paperparam) {
+		return paperSimilarityMapper.queryPaperSimilarity(paperparam);
+	}
+	
+	/**
+	 * <p>查询相似试卷试题</p>
+	 * @author songyue
+	 * @date 2016-08-08
+	 */
+	public List<Question> queryPaperQuestionSimilarity(String similarPaperNo,String whichQuestion) {
+		return questionMapper.searchPaperQuestionForSimilar(similarPaperNo, whichQuestion);
+	}
+	
+	/**
+	 * 
+	 * <p>查询相似试卷数量</p>
+	 * @author songyue
+	 * @date 2016-05-20
+	 */
+	public int queryPaperSimilarityCount(PaperSimilarityQueryParams paperparam) {
+		return paperSimilarityMapper.queryPaperSimilarityCount(paperparam);
+	}
+	
+	/**
+	 * <p>清空相似试卷</p>
+	 * @author songyue
+	 * @date 2016-05-20
+	 */
+	public int delAllPaperSimilarity(){
+		return dao.delete("delAllPaperSimilarity", null);
+	}
+	
+	/**
+	 * <p>清空相似试卷试题</p>
+	 * @author songyue
+	 * @date 2016-05-20
+	 */
+	public int delAllPaperQuestionSimilarity(){
+		return dao.delete("delAllPaperQuestionSimilarity", null);
+	}
+	
+	/**
+	 * <p>新增相似试卷</p>
+	 * @author songyue
+	 * @date 2016-05-20
+	 */
+	public int addPaperSimilarity(List<SimilarPaper> list){
+		return dao.insert("addPaperSimilarity", list);
+	}
+	
+	/**
+	 * <p>新增相似试卷试题</p>
+	 * @author songyue
+	 * @date 2016-08-03
+	 */
+	public int addPaperQuestionSimilarity(List<SimilarPaperQuestion> list){
+		return dao.insert("addPaperQuestionSimilarity", list);
+	}
+	
+	/**
+	 * 检查试卷相似度
+	 * @author songyue
+	 * @date 2016-05-20
+	 */
+	public List<SimilarPaper> checkSimilarity() {
+		List<PagerConstruct> paperList = zujuanService.queryPagers(new PagerQueryParams());
+		List<SimilarPaper> similarPaperList = new ArrayList<SimilarPaper>();
+		List<SimilarPaper> resultList = new ArrayList<SimilarPaper>();
+		for (PagerConstruct paper : paperList) {
+			List<Question> questionList = new ArrayList<Question>();
+			if (paper != null) {
+				List<PagerConstructQtype> qtypes = dao.getList("findPagerConstructQtypesByPaperId", paper.getId());
+				PaperTask task = dao.get("getPaperTaskById", paper.getTaskId());
+				String paperBody = "";
+				String courseName = "";
+				String bookName = "";
+				String courseCode = "";
+				for (PagerConstructQtype qt : qtypes) {
+					for (PagerConstructDetail pcd : qt.getConstructDetails()) {
+						Question ques = pcd.getQuestion();
+						//Question ques = questionDao.searchById(pcd.getQuestionId());
+						if(ques != null){
+							ques.setQuestionName(qt.getName() + pcd.getSortNo().toString());
+							ques.setTypeName(qt.getName());
+							questionList.add(ques);
+						}
+						if (ques != null && !StringUtils.isBlank(ques.getBodySummary()) && pcd.getQuestionId() != 0) {
+							paperBody += ques.getBodySummary();
+							List<QuestionOption> quesOption = ques.getOptions();
+							String option = "";
+							if (quesOption != null && quesOption.size() > 0) {
+								for (QuestionOption op : quesOption) {
+									option += op.getSummary();
+								}
+							}
+							paperBody += option;
+						}
+						courseName = task.getCourse().getName();
+						bookName = task.getBook().getName();
+						courseCode = task.getBook().getCode();
+					}
+				}
+				SimilarPaper similarPaper = new SimilarPaper();
+				similarPaper.setSimilarPaperNo(paper.getName());
+				similarPaper.setSimilarPaperBody(paperBody);
+				similarPaper.setBookName(bookName);
+				similarPaper.setCourseName(courseName);
+				similarPaper.setCreatedBy(paper.getCreatedBy().toString());
+				similarPaper.setCreatedByName(paper.getCreatedByName());
+				similarPaper.setTaskId(paper.getTaskId().toString());
+				similarPaper.setTaskNo(task.getTaskNo());
+				similarPaper.setCourseNo(courseCode);
+				similarPaper.setQuestionList(questionList);
+				similarPaperList.add(similarPaper);
+			}
+		}
+		paperList.removeAll(paperList);
+		paperList = null;
+		int size = similarPaperList.size();
+		double similarity = 0;
+		for (int i = 0; i < size; i++) {
+			for (int j = i + 1; j < size; j++) {
+				SimilarPaper similarPaper1 = similarPaperList.get(i);
+				SimilarPaper similarPaper2 = similarPaperList.get(j);
+				// 检查同课程、同教材的试卷相似度(全文比对)
+				if (!StringUtils.isBlank(similarPaper1.getSimilarPaperBody())
+						&& !StringUtils.isBlank(similarPaper2.getSimilarPaperBody())
+						&& similarPaper1.getCourseName().equals(similarPaper2.getCourseName())) {
+					if ((similarity = StringSimilarityUtils.getSimilarityWithCosinesBySeg(similarPaper1.getSimilarPaperBody(),
+							similarPaper2.getSimilarPaperBody()) * 100) >= 60) {
+						SimilarPaper similarResult = new SimilarPaper();
+						similarResult.setSimilarPaperNo(
+								similarPaper1.getSimilarPaperNo() + "," + similarPaper2.getSimilarPaperNo());
+						similarResult.setSimilarity(String.format("%.2f", similarity));
+						similarResult.setSimilarPaperBody(
+								similarPaper1.getSimilarPaperBody() + "||" + similarPaper2.getSimilarPaperBody());
+						similarResult.setCourseName(similarPaper1.getCourseName());
+						similarResult.setBookName(similarPaper1.getBookName());
+						similarResult.setCreatedBy(similarPaper1.getCreatedBy() + "," + similarPaper2.getCreatedBy());
+						similarResult.setCreatedByName(
+								similarPaper1.getCreatedByName() + "," + similarPaper2.getCreatedByName());
+						similarResult.setTaskId(similarPaper1.getTaskId() + "," + similarPaper2.getTaskId());
+						similarResult.setTaskNo(similarPaper1.getTaskNo() + "," + similarPaper2.getTaskNo());
+						similarResult.setCourseNo(similarPaper1.getCourseNo());
+						// 检查同课程、同教材的试卷相似度(具体试题比对)
+						int p1_size = similarPaper1.getQuestionList().size();
+						int p2_size = similarPaper2.getQuestionList().size();
+						List<Question> QuestionList1 = similarPaper1.getQuestionList();
+						List<Question> QuestionList2 = similarPaper2.getQuestionList();
+						List<SimilarPaperQuestion> similarQuestionList1 = new ArrayList<SimilarPaperQuestion>();
+						List<SimilarPaperQuestion> similarQuestionList2 = new ArrayList<SimilarPaperQuestion>();
+						for (int m = 0; m < p1_size; m++) {
+							for (int k = m + 1; k < p2_size; k++) {
+								// 检查试卷下的试题
+								Question similarques1 = QuestionList1.get(m);
+								Question similarques2 = QuestionList2.get(k);
+								
+								if (similarques1.getTypeName().equals(similarques2.getTypeName())) {
+									if ((similarity = StringSimilarityUtils.getSimilarityWithCosinesByWords(
+											getQuestionAllBody(similarques1), getQuestionAllBody(similarques2))
+											* 100) > 60) {
+										SimilarPaperQuestion similarPaperQuestion1 = new SimilarPaperQuestion();
+										SimilarPaperQuestion similarPaperQuestion2 = new SimilarPaperQuestion();
+										similarPaperQuestion1.setSimilarQuestionId(
+												similarques1.getId().toString());
+										similarPaperQuestion1.setSimilarQuestionNo(
+												similarques1.getQuestionName());
+										similarPaperQuestion1.setSimilarity(String.format("%.2f", similarity));
+										//similarPaperQuestion1.setSimilarPaperId(similarPaper1.getId()+","+similarPaper2.getId());
+										similarPaperQuestion1.setSimilarPaperNo(similarPaper1.getSimilarPaperNo()+","+similarPaper2.getSimilarPaperNo());
+										similarPaperQuestion1.setWhichQuestion("A");
+										similarPaperQuestion2.setSimilarQuestionId(
+												similarques2.getId().toString());
+										similarPaperQuestion2.setSimilarQuestionNo(
+												similarques2.getQuestionName());
+										similarPaperQuestion2.setSimilarity(String.format("%.2f", similarity));
+										//similarPaperQuestion2.setSimilarPaperId(similarPaper1.getId()+","+similarPaper2.getId());
+										similarPaperQuestion2.setSimilarPaperNo(similarPaper1.getSimilarPaperNo()+","+similarPaper2.getSimilarPaperNo());
+										similarPaperQuestion2.setWhichQuestion("B");
+										similarQuestionList1.add(similarPaperQuestion1);
+										similarQuestionList2.add(similarPaperQuestion2);
+									}
+								}
+							}
+						}
+						similarResult.setSimilarPaperQuesList1(similarQuestionList1);
+						similarResult.setSimilarPaperQuesList2(similarQuestionList2);
+						resultList.add(similarResult);
+					}
+				}
+				
+			}
+		}
+		similarPaperList.removeAll(similarPaperList);
+		similarPaperList = null;
+		Collections.sort(resultList);
+		return resultList;
+	}
+	
+	public String getQuestionAllBody(Question ques){
+		String questionBody = "";
+		if (ques != null && !StringUtils.isBlank(ques.getBodySummary()) && ques.getId() != 0) {
+			questionBody += ques.getBodySummary();
+			List<QuestionOption> quesOption = ques.getOptions();
+			String option = "";
+			if (quesOption != null && quesOption.size() > 0) {
+				for (QuestionOption op : quesOption) {
+					option += op.getSummary();
+				}
+			}
+			questionBody += option;
+		}
+		return questionBody;
+	}
+}

+ 114 - 0
src/main/java/com/qmth/qrzk/repository/pager/service/PaperDifficultyEstimateService.java

@@ -0,0 +1,114 @@
+package com.qmth.qrzk.repository.pager.service;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.qmth.qrzk.repository.common.base.BaseDao;
+import com.qmth.qrzk.repository.pager.model.PaperDifficultyEstimateDetail;
+
+@Service
+public class PaperDifficultyEstimateService {
+	
+	@Autowired
+    private BaseDao dao;
+	
+	public List<PaperDifficultyEstimateDetail> getByPaperId(int paperId){
+		/**
+		List<List<PaperDifficultyEstimateDetail>> result = new ArrayList<List<PaperDifficultyEstimateDetail>>();
+		
+		List<PaperDifficultyEstimateDetail> details = dao.getList("getPaperDifficultyEstimateByPaperId", paperId);
+		
+		String questionType = "";
+		for(PaperDifficultyEstimateDetail detail : details){
+			
+			if(detail.getQuestionType().equalsIgnoreCase(questionType)){
+				List<PaperDifficultyEstimateDetail> list = result.get(result.size()-1);
+				list.add(detail);
+			}else{
+				questionType = detail.getQuestionType();
+				List<PaperDifficultyEstimateDetail> list = new ArrayList<PaperDifficultyEstimateDetail>();
+				list.add(detail);
+				result.add(list);
+			}
+			
+		}
+			
+		return result;
+		**/
+		
+		return dao.getList("getPaperDifficultyEstimateByPaperId", paperId);
+	}
+	
+	/**
+	 * 查询试卷的预估难度表,用于对外访问:自考成绩分析,接口人:舒东辉。
+	 * @param paperCode
+	 * @return
+	 */
+	public List<Map<String,Object>> getByPaperNo(String paperCode){
+		List<PaperDifficultyEstimateDetail> pdeList = dao.getList("getPaperDifficultyEstimateByPaperCode", paperCode);
+		List<Map<String,Object>> details = new ArrayList<Map<String,Object>>(pdeList.size());
+		for(PaperDifficultyEstimateDetail pde:pdeList){
+			Map<String,Object> detail = new HashMap<String, Object>();
+			detail.put("questionType", pde.getQuestionType());
+			detail.put("sortNo", pde.getSortNo());
+			detail.put("questionScore", pde.getQuestionScore());
+			detail.put("estimateDifficultyValue", pde.getEstimateDifficultyValue());
+			detail.put("estimateDifficultyName", pde.getEstimateDifficultyName());
+			details.add(detail);
+		}
+		return details;
+	}
+	
+	public void createDifficultyEstimate(int userId, int paperId){
+		//先清除试卷下的预估表
+		deleteEstimateDifficultyByPaperId(paperId);
+		
+		List<PaperDifficultyEstimateDetail> estimates = dao.getList("queryPaperDetailInfo", paperId);
+		for(int i=0; i < estimates.size(); i++){
+			PaperDifficultyEstimateDetail item = estimates.get(i);
+			item.setSortNo(i+1);
+			item.setCreatedBy(userId);
+			item.setUpdatedBy(userId);
+		}
+		if(estimates.size() > 0){
+			dao.insert("insertDifficultyEstimates", estimates);
+		}
+	}
+
+	public void updateEstimateDifficultyValue(List<PaperDifficultyEstimateDetail> list){
+		if(list != null){
+			for(PaperDifficultyEstimateDetail d:list){
+				dao.update("updateEstimateDifficultyValue", d);
+			}
+		}
+	}
+	
+	public void updatePaperDifficultyEstimateByQuestion(PaperDifficultyEstimateDetail paperDifficultyEstimateDetail){
+		if(paperDifficultyEstimateDetail != null){
+			dao.update("updatePaperDifficultyEstimateByQuestion", paperDifficultyEstimateDetail);
+		}
+	}
+	
+	public void deleteEstimateDifficultyByPaperId(int paperId){
+		dao.delete("deleteEstimateDifficultyByPaperId", paperId);
+	}
+	
+	/**
+	 * <p>校验及格分数预估表是否需要重置: </p>
+	 * @author songyue
+	 * @date 2016-05-31
+	 */
+	public boolean checkPaperDifficultyEstimate(int paperId){
+		Integer count = dao.get("checkPaperDifficultyEstimate", paperId);
+		if(count > 0){
+			return true;
+		}else{
+			return false;
+		}
+	}
+}

+ 2882 - 0
src/main/java/com/qmth/qrzk/repository/pager/service/ZujuanService.java

@@ -0,0 +1,2882 @@
+package com.qmth.qrzk.repository.pager.service;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.Comparator;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Map;
+import java.util.UUID;
+
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.dom4j.Attribute;
+import org.dom4j.Document;
+import org.dom4j.DocumentException;
+import org.dom4j.DocumentHelper;
+import org.dom4j.Element;
+import org.dom4j.io.SAXReader;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import com.qmth.qrzk.repository.common.base.BaseDao;
+import com.qmth.qrzk.repository.exception.BizException;
+import com.qmth.qrzk.repository.pager.model.PagerConstruct;
+import com.qmth.qrzk.repository.pager.model.PagerConstructDetail;
+import com.qmth.qrzk.repository.pager.model.PagerConstructQtype;
+import com.qmth.qrzk.repository.service.query.PagerQueryParams;
+import com.qmth.qrzk.repository.task.PaperTask;
+import com.qmth.qrzk.repository.user.model.Attachment;
+import com.qmth.qrzk.repository.user.model.OperLog;
+import com.qmth.qrzk.repository.user.model.Question;
+import com.qmth.qrzk.repository.user.model.QuestionOption;
+import com.qmth.qrzk.repository.user.model.User;
+import com.qmth.qrzk.repository.user.service.impl.AttachmentService;
+import com.qmth.qrzk.repository.utils.Consts;
+import com.qmth.qrzk.repository.utils.DateHelper;
+import com.qmth.qrzk.repository.utils.General;
+import com.qmth.qrzk.repository.utils.ParamUtils;
+import com.qmth.qrzk.repository.utils.docx.DocxReader;
+import com.qmth.qrzk.repository.utils.docx.ResourceInfo;
+
+@Service
+public class ZujuanService {
+
+    private final static Logger log = Logger.getLogger(ZujuanService.class);
+
+    @Autowired
+    private BaseDao dao;
+    
+	@Autowired
+	private AttachmentService attachmentService;
+
+    public List<PagerConstruct> queryPagers(PagerQueryParams params) {
+        return dao.getPagerList("queryPagerConstructs", params);
+    }
+
+    public PagerConstruct findById(int paperId) {
+        return dao.getObject("findPagerConstructById", paperId);
+    }
+    
+    public void updatePagerConstruct(PagerConstruct pager) {
+    	dao.update("updatePagerConstruct", pager);
+    }
+
+    /**
+     * 获取完整的试卷信息,包括题型列表,题型下面的试题信息
+     * 
+     * @param courseId
+     * @return
+     */
+    public PagerConstruct getOriginalWholePaperInfo(int paperId) {
+        PagerConstruct paper = findById(paperId);
+        if (paper == null) {
+            return null;
+        }
+        List<PagerConstructQtype> qtypes = dao.getList("findPagerConstructQtypesByPaperId", paperId);
+        paper.setQtypeList(qtypes);
+        return paper;
+    }
+
+    /**
+     * 获取完整的试卷信息,包括题型列表,题型下面的试题信息,并把试题里面的Word数据转换成Html数据
+     * 
+     * @param courseId
+     * @return
+     */
+    public PagerConstruct getWholePaperInfoForShow(int paperId) {
+        PagerConstruct paper = findById(paperId);
+        if (paper == null) {
+            return null;
+        }
+        List<PagerConstructQtype> qtypes = dao.getList("findPagerConstructQtypesByPaperId", paperId);
+        for (PagerConstructQtype qt : qtypes) {
+            for (PagerConstructDetail pcd : qt.getConstructDetails()) {
+                Question ques = pcd.getQuestion();
+                if (ques != null) {
+                    General.quesWordToHtmlForShow(ques);
+                }
+            }
+        }
+        paper.setQtypeList(qtypes);
+        return paper;
+    }
+
+    public List<PagerConstruct> getPaperListByIdArr(int[] idArr) {
+        List<PagerConstruct> list = new ArrayList<PagerConstruct>();
+        for (int id : idArr) {
+            PagerConstruct paper = getWholePaperInfoForShow(id);
+            if (paper != null) {
+                list.add(paper);
+            }
+        }
+        return list;
+    }
+
+    public void delUserPagerByUserId(int user_id) {
+        dao.delete("delUserPagerByUserId", user_id);
+    }
+
+    public void sortSj(int paperId, User curUser) {
+        PagerConstruct paper = findById(paperId);
+        if (paper == null) {
+            return;
+        }
+        List<PagerConstructQtype> qtypes = dao.getList("findPagerConstructQtypesByPaperId", paperId);
+        for (PagerConstructQtype qt : qtypes) {
+            Collections.sort(qt.getConstructDetails(), new Comparator<PagerConstructDetail>() {
+
+                @Override
+                public int compare(PagerConstructDetail o1, PagerConstructDetail o2) {
+                    if (o1.getQuestion() == null && o2.getQuestion() == null) {
+                        return 0;
+                    }
+                    if (o1.getQuestion() == null) {
+                        return -1;
+                    }
+                    if (o2.getQuestion() == null) {
+                        return 1;
+                    }
+                    String diff1 = General.convertNullToEmpty(o1.getQuestion().getEstimateDifficultyCode());
+                    String chapter1 = General.convertNullToEmpty(o1.getQuestion().getChapter());
+
+                    String diff2 = General.convertNullToEmpty(o2.getQuestion().getEstimateDifficultyCode());
+                    String chapter2 = General.convertNullToEmpty(o2.getQuestion().getChapter());
+                    if (diff1.equals(diff2)) {
+                        return chapter1.compareTo(chapter2);
+                    } else {
+                        return diff1.compareTo(diff2);
+                    }
+                }
+            });
+            for (int i = 0; i < qt.getConstructDetails().size(); i++) {
+                PagerConstructDetail detail = qt.getConstructDetails().get(i);
+                detail.setSortNo(i + 1);
+                detail.setUpdatedBy(curUser.getId());
+                dao.update("updatePagerConstructDetail", detail);
+            }
+        }
+    }
+
+    public List<PagerConstruct> findPagersByUserId(int userId) {
+        return dao.getList("findPagerByUserId", userId);
+    }
+
+    public void submitAudit(int paperId, int userId) {
+        PagerConstruct paper = new PagerConstruct();
+        paper.setId(paperId);
+        paper.setStatus(Consts.PaperStatus.TOAPPROVE);
+        paper.setUpdatedBy(userId);
+        dao.update("updatePagerConstruct", paper);
+
+        OperLog ol = new OperLog();
+        ol.setObjId(paperId);
+        ol.setObjType(Consts.OperLogObjType.PagerConstruct);
+        ol.setOperCode("提交审核");
+        ol.setCreatedBy(userId);
+        dao.insert("addOperLog", ol);
+    }
+
+    public void saveAudit(int paperId, int userId, int auditResult, String remark) {
+        PagerConstruct paper = new PagerConstruct();
+        paper.setId(paperId);
+        paper.setStatus(auditResult);
+        paper.setUpdatedBy(userId);
+        dao.update("updatePagerConstruct", paper);
+
+        OperLog ol = new OperLog();
+        ol.setObjId(paperId);
+        ol.setObjType(Consts.OperLogObjType.PagerConstruct);
+        ol.setOperCode((auditResult == Consts.PaperStatus.APPROVED) ? "审核通过" : "审核拒绝");
+        ol.setRemark(remark);
+        ol.setCreatedBy(userId);
+        dao.insert("addOperLog", ol);
+    }
+
+    public List<OperLog> getAuditLogs(int paperId) {
+        Map<String, Object> param = new HashMap<String, Object>();
+        param.put("objId", paperId);
+        param.put("objType", Consts.OperLogObjType.PagerConstruct);
+        List<OperLog> list = dao.getList("queryOperLogsByObjIdAndType", param);
+        return list;
+    }
+
+    public void deletePaper(int paperId) {
+        dao.delete("deletePaperDetailsByPaperId", paperId);
+        dao.delete("deletePaperQtypesByPaperId", paperId);
+        // 还要删除WordHistory及附件
+        dao.delete("deletePaperById", paperId);
+    }
+
+    private static String toQuesNumStr(int quesNum) {
+        String numStr = quesNum + "";
+        if (numStr.length() == 1) {
+            numStr = " " + quesNum;
+        }
+        return numStr;
+    }
+	
+	public Attachment generalAnswerFileIntoAtt(int paperId,User curUser) throws BizException{
+		PagerConstruct paper = getOriginalWholePaperInfo(paperId);
+		File answerFile = generalAnswerFile(paper);
+		File newFile = General.newAttFile();
+		answerFile.renameTo(newFile);
+		Attachment att = new Attachment();
+		att.setCreatedBy(curUser.getId());
+		att.setOriginalName(paper.getName() + "N" + ".docx");
+		att.setCurName(newFile.getName());
+		att.setFileLength(newFile.length());
+		att.setStorePath(newFile.getAbsolutePath());
+		att.setStatus(Consts.AttachmentStatus.DRAFT);
+		dao.insert("addAttachment", att);
+		//更新试卷中的word附件
+		int oldAttId = paper.getLastAnswerWord() == null ? 0 : paper.getLastAnswerWord().intValue();
+		Attachment newAtt = attachmentService.getAttachmentByAttr(newFile.getAbsolutePath());
+		int newAttId = newAtt == null ? 0 : newAtt.getId().intValue();
+		if (oldAttId == 0) {
+			paper.setLastAnswerWord(newAttId);
+		} else {
+			Attachment oldAtt = attachmentService.getAttachmentById(oldAttId);
+			if (oldAtt != null) {
+				oldAtt.setStatus("DELETEED");
+				dao.update("updateAttachment", att);
+			}
+			paper.setLastAnswerWord(newAttId);
+		}
+		if (newAttId != 0) {
+			dao.update("updatePagerConstruct", paper);
+		}
+		return att;
+	}
+
+    public File generalAnswerFile(PagerConstruct paper) throws BizException {
+        File newDocx = null;
+        DocxReader templetDocxReader = null;
+        Map<String, ResourceInfo> needToUpdate = new HashMap<String, ResourceInfo>();
+        try {
+            {// 拷贝一份模板文件到临时文件夹里面
+                FileOutputStream fos = null;
+                InputStream is = null;
+                try {
+                    newDocx = new File(ParamUtils.TemporaryDirPath, UUID.randomUUID().toString().replace("-", ""));
+                    fos = new FileOutputStream(newDocx);
+                    is = ZujuanService.class.getResourceAsStream("/paperTmps/answerTmp1.docx");
+                    IOUtils.copyLarge(is, fos);
+                    fos.flush();
+                } finally {
+                    General.close(is);
+                    General.close(fos);
+                }
+            }
+
+            templetDocxReader = new DocxReader(newDocx);
+            templetDocxReader.doRead();
+            {
+                List<ResourceInfo> headersAndFooters = new ArrayList<ResourceInfo>();
+                headersAndFooters.addAll(templetDocxReader.getHeaders());
+                headersAndFooters.addAll(templetDocxReader.getFooters());
+                for (ResourceInfo info : headersAndFooters) {
+                    FileOutputStream fos = null;
+                    InputStream is = null;
+                    try {
+                        is = new FileInputStream(info.getFile());
+                        String docStr = IOUtils.toString(is, "UTF-8")
+                                .replace("##试卷名称##", General.XMLEncode(paper.getName()))
+                                .replace("##试卷题头##", General.XMLEncode(paper.getHead()))
+                                .replace("##课程名称##", General.XMLEncode(paper.getSkeleton().getCourse().getName()))
+                                .replace("##课程代码##", General.XMLEncode(paper.getSkeleton().getCourse().getCode()));
+                        fos = new FileOutputStream(info.getFile(), false);
+                        IOUtils.write(docStr, fos, "UTF-8");
+                    } finally {
+                        General.close(is);
+                        General.close(fos);
+                    }
+                    needToUpdate.put(info.getPathInZip(), info);
+                }
+            }
+            {
+                needToUpdate.put(templetDocxReader.getDocumentInfo().getPathInZip(),
+                        templetDocxReader.getDocumentInfo());
+                File document = templetDocxReader.getDocumentInfo().getFile();
+                FileOutputStream fos = null;
+                InputStream is = null;
+                try {
+                    is = new FileInputStream(document);
+                    String docStr = IOUtils.toString(is, "UTF-8")
+                            .replace("##试卷名称##", General.XMLEncode(paper.getName()))
+                            .replace("##试卷题头##", General.XMLEncode(paper.getHead()))
+                            .replace("##课程名称##", General.XMLEncode(paper.getSkeleton().getCourse().getName()))
+                            .replace("##课程代码##", General.XMLEncode(paper.getSkeleton().getCourse().getCode()));
+                    String xmlns_w15 = "xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\"";
+                    if (!docStr.contains(xmlns_w15)) {
+                        docStr = docStr.replace("<w:document ", "<w:document " + xmlns_w15 + " ");
+                    }
+                    String xmlns_a = "xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"";
+                    if (!docStr.contains(xmlns_a)) {
+                        docStr = docStr.replace("<w:document ", "<w:document " + xmlns_a + " ");
+                    }
+                    fos = new FileOutputStream(document, false);
+                    IOUtils.write(docStr, fos, "UTF-8");
+                } finally {
+                    General.close(is);
+                    General.close(fos);
+                }
+            }
+            {
+                File document = templetDocxReader.getDocumentInfo().getFile();
+                FileOutputStream fosNew = null;
+                FileOutputStream fos = null;
+                InputStream is = null;
+                try {
+                    is = new FileInputStream(document);
+                    String docStr = IOUtils.toString(is, "UTF-8");
+                    int index1 = docStr.indexOf("##试题开始##");// "##试题开始##"的位置
+                    int index2 = docStr.substring(0, index1).lastIndexOf("<w:p ");// "##试题开始##"对应的<w:p>标签的开始位置
+                    int index3 = index1 + docStr.substring(index1).indexOf("</w:p>");// "##试题开始##"对应的<w:p>标签的结束位置
+
+                    int index4 = docStr.indexOf("##试题结束##");// "##试题结束##"的位置
+                    int index5 = docStr.substring(0, index4).lastIndexOf("<w:p ");// "##试题结束##"对应的<w:p>标签的开始位置
+                    int index6 = index4 + docStr.substring(index4).indexOf("</w:p>");// "##试题结束##"对应的<w:p>标签的结束位置
+
+                    String head = docStr.substring(0, index2);// ##试题开始##"前面的部分
+                    String quTmpStr = docStr.substring(index3 + "</w:p>".length(), index5);// 题目模板
+                    String tail = docStr.substring(index6 + "</w:p>".length());// "##试题结束##"后面的部分
+
+                    int index7 = quTmpStr.indexOf("##答案项##");
+                    int index8 = quTmpStr.substring(0, index7).lastIndexOf("<w:p ");// 答案项对应的<w:p>标签的开始位置
+                    int index9 = index7 + quTmpStr.substring(index7).indexOf("</w:p>");// 答案项对应的<w:p>标签的结束位置
+
+                    // int index10 = quTmpStr.indexOf("##答题项##");
+                    // int index11 =
+                    // quTmpStr.substring(0,index10).lastIndexOf("<w:p ");//答题项对应的<w:p>标签的开始位置
+                    // int index12 = index10 +
+                    // quTmpStr.substring(index10).indexOf("</w:p>");//答题项对应的<w:p>标签的结束位置
+
+                    fosNew = new FileOutputStream(document, false);
+                    IOUtils.write(head, fosNew, "UTF-8");
+                    General.close(fosNew);
+
+                    fos = new FileOutputStream(document, true);
+
+                    String qtTmpHeadStr = quTmpStr.substring(0, index8);
+                    String qtTmpTailStr = quTmpStr.substring(index9 + "</w:p>".length());
+                    String xtTmpStr = quTmpStr.substring(index8, index9 + "</w:p>".length());
+
+                    // String anTmpStr = quTmpStr.substring(index11,index12 +
+                    // "</w:p>".length());
+                    int quNo = 0;
+                    for (int i = 0; i < paper.getQtypeList().size(); i++) {
+                        PagerConstructQtype qtyp = paper.getQtypeList().get(i);
+                        String str1= General.toCNLowerNum(i + 1) + "、" + General.XMLEncode(qtyp.getName())
+                        		+ ":本大题共" + qtyp.getQuestionSum() + "小题," + ((qtyp.getQuestionSum() > 1)?"每小题":"") 
+                        		+ General.formatScore(qtyp.getScore()) + "分" 
+                        		+ ((qtyp.getQuestionSum() > 1) ? ",共" + General.formatScore(qtyp.getQuestionScores()) + "分" : "")
+                        		+ "。";
+                        String qtypStr = qtTmpHeadStr
+                                .replace("##大题描述##", str1)
+                                .replace("##大题序号##", General.toCNLowerNum(i + 1))
+                                .replace("##大题名称##", General.XMLEncode(qtyp.getName()))
+                                .replace("##小题数##", "" + qtyp.getQuestionSum())
+                                .replace("##小题分##", "" + General.formatScore(qtyp.getScore()))
+                                .replace("##小题总分##", "" + General.formatScore(qtyp.getQuestionScores()))
+                                .replace("##题型说明##",
+                                        General.isNotEmpty(qtyp.getRemark()) ? ("(" + qtyp.getRemark() + ")") : "");
+                        IOUtils.write(qtypStr, fos, "UTF-8");
+                        String quesTypeName = qtyp.getName();
+                        if(quesTypeName.equals("单项选择题") || quesTypeName.equals("单选题") || quesTypeName.equals("单选")
+                				|| quesTypeName.equals("多项选择题") || quesTypeName.equals("多选题") || quesTypeName.equals("多选")){
+                            int lineSize = (qtyp.getConstructDetails().size() + 4) / 5;
+                            List<String> rowList = new LinkedList<String>();
+                            for (int lineIndex = 0; lineIndex < lineSize; lineIndex++) {
+                                String rowContent = Consts.OPT_TAB_5_TEMP;
+                                int columnIndex = 0;
+                                for (int quesIndex = lineIndex * 5; quesIndex < ((lineIndex + 1) * 5); quesIndex++,columnIndex++) {
+                                    int tabSpace = Consts.OPT_TAB_SPACE_ARR[columnIndex];
+                                    if(quNo >= 9){
+                                    	tabSpace = tabSpace - 105;
+                                    }
+                                    char a = 'A';
+                                    a = (char) (a + columnIndex);
+                                    rowContent = rowContent.replace(a + "_NUM", "" + tabSpace);
+                                    if (quesIndex >= qtyp.getConstructDetails().size()) {
+                                    	rowContent = rowContent.replace(a + "#" + a, "");
+                                        continue;
+                                    }
+                                    PagerConstructDetail d = qtyp.getConstructDetails().get(quesIndex);
+                                    quNo++;
+                                    Question qu = d.getQuestion();
+                                    if (qu == null) {
+                                        qu = new Question();
+                                    }
+                                    if (qu.getOptions() != null && qu.getOptions().size() > 0) {
+                                        String answer = "";
+                                        for (QuestionOption opt : qu.getOptions()) {
+                                            if (opt.getIsCorrectOption() == 1) {
+                                                answer = answer + opt.getOptionNoString() + " ";
+                                            }
+                                        }
+                                        if (answer.length() > 0) {
+                                            answer = answer.substring(0, answer.length() - 1);
+                                        }
+                                        qu.setAnswer(answer);
+                                    } else {
+                                        qu.setAnswer(null);
+                                    }
+                                    String answer = qu.getAnswer();
+                                    if (General.isEmpty(answer)) {
+                                        answer = "空";
+                                    }
+                                    rowContent = rowContent.replace(a + "#" + a, quNo + "." + answer);
+                                }
+                                rowList.add(rowContent);
+                            }
+                            System.out.println(StringUtils.join(rowList, ""));
+                            IOUtils.write(StringUtils.join(rowList, ""), fos, "UTF-8");
+                            IOUtils.write(qtTmpTailStr, fos, "UTF-8");
+                        } else {
+                            for (int j = 0; j < qtyp.getConstructDetails().size(); j++) {
+                                PagerConstructDetail d = qtyp.getConstructDetails().get(j);
+                                quNo++;
+                                Question qu = d.getQuestion();
+                                if (qu == null) {
+                                    qu = new Question();
+                                    qu.setAnswer("空");
+                                }
+                                log.info("正在处理试题:id = " + qu.getId());
+                                String answer = null;
+                                if ((qu.getAnswerWord() == null || qu.getAnswerWord().length == 0)
+                                        && General.isEmpty(qu.getAnswer())) {
+                                    answer = xtTmpStr.replace("##答案项##",
+                                            toQuesNumStr(quNo) + "." + General.XMLEncode(qu.getAnswerSummary()).trim());
+                                } else {
+                                    try {
+                                    	boolean isBlank = false;
+                                        byte[] wordBytes = null;
+                                        if ((qu.getAnswerWord() == null || qu.getAnswerWord().length == 0)
+                                                && !General.isEmpty(qu.getAnswer())) {
+                                        	if(General.isEmpty(General.extractText(qu.getAnswer()))){
+                                        		answer = xtTmpStr.replace("##答案项##",
+                                                        toQuesNumStr(quNo) + "." + General.toUnicode('<') + "无" + General.toUnicode('>'));
+                                        		isBlank = true;
+                                        	}else{
+                                        		wordBytes = General.htmlToDocx(qu.getAnswer());
+                                        	}
+                                        } else {
+                                            wordBytes = qu.getAnswerWord();
+                                        }
+                                        if(!isBlank){
+	                                        answer = General.dealWord(wordBytes, templetDocxReader, needToUpdate);
+	                                        
+	                                        int firstWtBeginIndex = answer.indexOf("<w:t>");
+	                                    	int firstWtBeginIndex2 = answer.indexOf("<w:t ");
+	                                    	firstWtBeginIndex = (firstWtBeginIndex < 0 || (firstWtBeginIndex2 >= 0 && firstWtBeginIndex > firstWtBeginIndex2))?firstWtBeginIndex2:firstWtBeginIndex;
+	                                        
+	                                        int nearestGtIndex = answer.indexOf('>', firstWtBeginIndex + 1);
+	
+	                                        String part1 = answer.substring(0, nearestGtIndex + 1).trim();
+	                                        String part2 = answer.substring(nearestGtIndex + 1).trim();
+	                                        answer = part1 + toQuesNumStr(quNo) + "." + part2;
+                                        }
+                                    } catch (Exception e) {
+                                        log.warn("获取试题[" + qu.getId() + "]的Word信息失败,原因:" + e.getMessage(), e);
+                                        answer = Consts.ERR_P_TMP.replace("XX",
+                                                quNo + "." + String.format(Consts.ERR_ANSWER_MSG, qu.getId() + ""));
+                                    }
+                                }
+                                //answer = dealFormula(answer);
+                                IOUtils.write(addBeforeLines(answer,0,0,(j == qtyp.getConstructDetails().size()-1)?10:0), fos, "UTF-8");
+                                IOUtils.write(qtTmpTailStr, fos, "UTF-8");
+                            }
+                        }
+                    }
+
+                    IOUtils.write(tail, fos, "UTF-8");
+                } finally {
+                    General.close(is);
+                    General.close(fosNew);
+                    General.close(fos);
+                }
+            }
+
+            {
+                File document = templetDocxReader.getDocumentInfo().getFile();
+                FileOutputStream fos = null;
+                InputStream is = null;
+                try {
+                    is = new FileInputStream(document);
+                    String docStr = IOUtils
+                            .toString(is, "UTF-8")
+                            .replace("<pic:pic>",
+                                    "<pic:pic xmlns:pic=\"http://schemas.openxmlformats.org/drawingml/2006/picture\">")
+                            .replace("<w15:collapsed w:val=\"false\"/>", "");
+
+                    // String xmlns_a =
+                    // "xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"";
+                    // if(!docStr.contains(xmlns_a)){
+                    // docStr = docStr.replace("<w:document ", "<w:document " +
+                    // xmlns_a + " ");
+                    // }
+                    fos = new FileOutputStream(document, false);
+                    IOUtils.write(docStr, fos, "UTF-8");
+                } finally {
+                    General.close(is);
+                    General.close(fos);
+                }
+            }
+
+            {
+                DocxReader.updateDocx(newDocx, needToUpdate);
+            }
+        } catch (Exception e) {
+            log.error("生成试卷[" + paper.getId() + "]的Word文档失败,原因:" + e.getMessage(), e);
+            throw new BizException(e.getMessage(), e);
+        } finally {
+            General.release(templetDocxReader);
+        }
+        if(ParamUtils.NeedCheckWordVersion){
+        	General.setDocxDefinedAttr(newDocx, Consts.DOCX_VERSION, "QMTH" + System.currentTimeMillis());// 往新生成的Word里面打个版本号:当前时间
+        }
+        return newDocx;
+    }
+	
+    //TODO 生成网评卷
+	public Attachment generalWangpingPaperFileIntoAtt(int paperId,User curUser) throws BizException{
+		PagerConstruct paper = getOriginalWholePaperInfo(paperId);
+		File paperFile = generalWangPingPaperFile(paper);
+		File newFile = General.newAttFile();
+		paperFile.renameTo(newFile);
+		Attachment att = new Attachment();
+		att.setCreatedBy(curUser.getId());
+		att.setOriginalName(paper.getName() + "网评卷" + ".docx");
+		att.setCurName(newFile.getName());
+		att.setFileLength(newFile.length());
+		att.setStorePath(newFile.getAbsolutePath());
+		att.setStatus(Consts.AttachmentStatus.DRAFT);
+		dao.insert("addAttachment", att);
+		//更新试卷中的word附件
+		int oldAttId = paper.getLastWangpingWord() == null ? 0 : paper.getLastWangpingWord().intValue();
+		Attachment newAtt = attachmentService.getAttachmentByAttr(newFile.getAbsolutePath());
+		int newAttId = newAtt == null ? 0 : newAtt.getId().intValue();
+		if (oldAttId == 0) {
+			paper.setLastWangpingWord(newAttId);
+		} else {
+			Attachment oldAtt = attachmentService.getAttachmentById(oldAttId);
+			if (oldAtt != null) {
+				oldAtt.setStatus("DELETEED");
+				dao.update("updateAttachment", att);
+			}
+			paper.setLastWangpingWord(newAttId);
+		}
+		if (newAttId != 0) {
+			dao.update("updatePagerConstruct", paper);
+		}
+		return att;
+	}
+	
+	//生成题卡
+	public Attachment generalTikaFileIntoAtt(int paperId,User curUser) throws BizException{
+		PagerConstruct paper = getOriginalWholePaperInfo(paperId);
+		int oldAttId = paper.getLastTikaWord() == null ? 0 : paper.getLastTikaWord().intValue();
+		PaperTask task = dao.get("getPaperTaskById", paper.getTaskId());
+		if(task.getStatus().equals(Consts.PaperTaskStatus.ARCHIVED) && oldAttId != 0){
+			return attachmentService.getAttachmentById(oldAttId);
+		}
+		File paperFile = generalTikaFile(paper);
+		File newFile = General.newAttFile();
+		paperFile.renameTo(newFile);
+		Attachment att = new Attachment();
+		att.setCreatedBy(curUser.getId());
+		att.setOriginalName(paper.getName() + "题卡" + ".docx");
+		att.setCurName(newFile.getName());
+		att.setFileLength(newFile.length());
+		att.setStorePath(newFile.getAbsolutePath());
+		att.setStatus(Consts.AttachmentStatus.USING);
+		dao.insert("addAttachment", att);
+		//更新试卷中的word附件
+//		Attachment newAtt = attachmentService.getAttachmentByAttr(newFile.getAbsolutePath());
+//		int newAttId = newAtt == null ? 0 : newAtt.getId().intValue();
+		if (oldAttId != 0) {
+			Attachment oldAtt = attachmentService.getAttachmentById(oldAttId);
+			if (oldAtt != null) {
+				oldAtt.setStatus("DELETEED");
+				dao.update("updateAttachment", att);
+			}
+		}
+		PagerConstruct paperTmp = new PagerConstruct();
+		paperTmp.setId(paperId);
+		paperTmp.setLastTikaWord(att.getId());
+		dao.update("updatePagerConstruct", paperTmp);
+		return att;
+	}
+	
+	private String getAbilityText(Question qu){
+		if(qu.getAbilityCode() != null){
+			return qu.getAbilityCode();
+		}else{
+			return "";
+		}
+	}
+	
+	private String getEstimateDifficultyText(Question qu){
+		if("10".equals(qu.getEstimateDifficultyCode())){
+			return "A";
+		}
+		if("20".equals(qu.getEstimateDifficultyCode())){
+			return "B";
+		}
+		if("30".equals(qu.getEstimateDifficultyCode())){
+			return "C";
+		}
+		if("40".equals(qu.getEstimateDifficultyCode())){
+			return "D";
+		}
+		return "";
+	}
+	
+	private String getAssessmentDemandText(Question qu){
+		if("A".equals(qu.getEstimateDifficultyCode())){
+			return "1";
+		}
+		if("B".equals(qu.getEstimateDifficultyCode())){
+			return "2";
+		}
+		if("C".equals(qu.getEstimateDifficultyCode())){
+			return "3";
+		}
+		return "";
+	}
+	
+    public File generalTikaFile(PagerConstruct paper) throws BizException {
+    	String paperType = paper.getName().charAt(paper.getName().length() - 1) + "";
+        File newDocx = null;
+        DocxReader templetDocxReader = null;
+        Map<String, ResourceInfo> needToUpdate = new HashMap<String, ResourceInfo>();
+        try {
+            {// 拷贝一份模板文件到临时文件夹里面
+                FileOutputStream fos = null;
+                InputStream is = null;
+                try {
+                    newDocx = new File(ParamUtils.TemporaryDirPath, UUID.randomUUID().toString().replace("-", ""));
+                    fos = new FileOutputStream(newDocx);
+                    is = ZujuanService.class.getResourceAsStream("/paperTmps/tikaTmp1.docx");
+                    IOUtils.copyLarge(is, fos);
+                    fos.flush();
+                } finally {
+                    General.close(is);
+                    General.close(fos);
+                }
+            }
+
+            templetDocxReader = new DocxReader(newDocx);
+            templetDocxReader.doRead();
+            {
+                List<ResourceInfo> headersAndFooters = new ArrayList<ResourceInfo>();
+                headersAndFooters.addAll(templetDocxReader.getHeaders());
+                headersAndFooters.addAll(templetDocxReader.getFooters());
+                for (ResourceInfo info : headersAndFooters) {
+                    FileOutputStream fos = null;
+                    InputStream is = null;
+                    try {
+                        is = new FileInputStream(info.getFile());
+                        String docStr = IOUtils.toString(is, "UTF-8")
+                                .replace("##试卷名称##", General.XMLEncode(paper.getName()))
+                                .replace("##试卷题头##", General.XMLEncode(paper.getHead()))
+                                .replace("##课程名称##", General.XMLEncode(paper.getSkeleton().getCourse().getName()))
+                                .replace("##课程代码##", General.XMLEncode(paper.getSkeleton().getCourse().getCode()))
+                                .replace("##满分##", "100");
+                        fos = new FileOutputStream(info.getFile(), false);
+                        IOUtils.write(docStr, fos, "UTF-8");
+                    } finally {
+                        General.close(is);
+                        General.close(fos);
+                    }
+                    needToUpdate.put(info.getPathInZip(), info);
+                }
+            }
+            {
+                needToUpdate.put(templetDocxReader.getDocumentInfo().getPathInZip(),
+                        templetDocxReader.getDocumentInfo());
+                File document = templetDocxReader.getDocumentInfo().getFile();
+                FileOutputStream fos = null;
+                InputStream is = null;
+                try {
+                    is = new FileInputStream(document);
+                    String docStr = IOUtils.toString(is, "UTF-8")
+                            .replace("##试卷名称##", General.XMLEncode(paper.getName()))
+                            .replace("##试卷题头##", General.XMLEncode(paper.getHead()))
+                            .replace("##课程名称##", General.XMLEncode(paper.getSkeleton().getCourse().getName()))
+                            .replace("##课程代码##", General.XMLEncode(paper.getSkeleton().getCourse().getCode()))
+                            .replace("##满分##", "100");
+                    String xmlns_w15 = "xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\"";
+                    if (!docStr.contains(xmlns_w15)) {
+                        docStr = docStr.replace("<w:document ", "<w:document " + xmlns_w15 + " ");
+                    }
+                    String xmlns_a = "xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"";
+                    if (!docStr.contains(xmlns_a)) {
+                        docStr = docStr.replace("<w:document ", "<w:document " + xmlns_a + " ");
+                    }
+                    fos = new FileOutputStream(document, false);
+                    IOUtils.write(docStr, fos, "UTF-8");
+                } finally {
+                    General.close(is);
+                    General.close(fos);
+                }
+            }
+            {
+                File document = templetDocxReader.getDocumentInfo().getFile();
+                FileOutputStream fosNew = null;
+                FileOutputStream fos = null;
+                InputStream is = null;
+                try {
+                    is = new FileInputStream(document);
+                    String docStr = IOUtils.toString(is, "UTF-8");
+                    int index1 = docStr.indexOf("##试题开始##");// "##试题开始##"的位置
+                    int index2 = docStr.substring(0, index1).lastIndexOf("<w:p ");// "##试题开始##"对应的<w:p>标签的开始位置
+                    int index3 = index1 + docStr.substring(index1).indexOf("</w:p>");// "##试题开始##"对应的<w:p>标签的结束位置
+
+                    int index4 = docStr.indexOf("##试题结束##");// "##试题结束##"的位置
+                    int index5 = docStr.substring(0, index4).lastIndexOf("<w:p ");// "##试题结束##"对应的<w:p>标签的开始位置
+                    int index6 = index4 + docStr.substring(index4).indexOf("</w:p>");// "##试题结束##"对应的<w:p>标签的结束位置
+
+                    String head = docStr.substring(0, index2);// ##试题开始##"前面的部分
+                    String quTmpStr = docStr.substring(index3 + "</w:p>".length(), index5);// 题目模板
+                    String tail = docStr.substring(index6 + "</w:p>".length());// "##试题结束##"后面的部分
+
+                    fosNew = new FileOutputStream(document, false);
+                    IOUtils.write(head, fosNew, "UTF-8");
+                    General.close(fosNew);
+
+                    fos = new FileOutputStream(document, true);
+
+                    int quNo = 0;
+                    for (int i = 0; i < paper.getQtypeList().size(); i++) {
+                        PagerConstructQtype qtyp = paper.getQtypeList().get(i);
+                        String quesTypeName = qtyp.getName();
+                        for (int j = 0; j < qtyp.getConstructDetails().size(); j++) {
+                            PagerConstructDetail d = qtyp.getConstructDetails().get(j);
+                            quNo++;
+                            Question qu = d.getQuestion();
+                            if (qu == null) {
+                                qu = new Question();
+                                qu.setBodySummary("空题");
+                            }
+                            String optAnswer = "";
+                            if (qu.getOptions() != null && qu.getOptions().size() > 0) {
+                                for (QuestionOption opt : qu.getOptions()) {
+                                    if (opt.getIsCorrectOption() == 1) {
+                                    	optAnswer = optAnswer + opt.getOptionNoString() + " ";
+                                    }
+                                }
+                                if (optAnswer.length() > 0) {
+                                	optAnswer = optAnswer.substring(0, optAnswer.length() - 1);
+                                }
+	                            if(optAnswer.length() == 0){
+	                            	optAnswer = "无";
+	                            }
+                            }
+                            String setTimeStr = "";
+                            if(qu.getSetTime() != null){
+                            	setTimeStr = DateHelper.formatDate(qu.getSetTime(), "yyyy 年 M 月 d 日");
+                            }
+                            log.info("正在处理试题:id = " + qu.getId());
+                            String xtXml = quTmpStr
+                            		.replace("##课程代码##", General.XMLEncode(paper.getSkeleton().getCourse().getCode()))
+                                    .replace("##课程名称##", General.XMLEncode(paper.getSkeleton().getCourse().getName()))
+                                    .replace("##AB卷##", General.XMLEncode(paperType))
+                                    .replace("##序列##", General.XMLEncode(toQuesNumStr(quNo)))
+                                    .replace("##试题编号##", General.null2String(qu.getQuestionNo(), ""))
+                                    .replace("##大题名称##", General.XMLEncode(quesTypeName))
+                                    .replace("##章##", General.XMLEncode(General.null2String(qu.getChapter(), "")))
+                                    .replace("##节##", General.XMLEncode(General.null2String(qu.getSection(), "")))
+                                    .replace("##目##", General.XMLEncode(General.null2String(qu.getItem(), "")))
+                                    .replace("##能力要求##", getAbilityText(qu))
+                                    .replace("##考核要求##", getAssessmentDemandText(qu))
+                                    .replace("##预计难度##", getEstimateDifficultyText(qu))
+                                    .replace("##小题分##", General.formatScore(qtyp.getScore()))
+                                    .replace("##选项答案##", optAnswer)
+                                    .replace("##命题教师##", General.XMLEncode(General.null2String(qu.getSetTeacherName(), "")))
+                                    .replace("##命题时间##", General.XMLEncode(setTimeStr));
+                            String contentXml = "";
+                            if ((qu.getBodyWord() == null || qu.getBodyWord().length == 0)
+                                    && General.isEmpty(qu.getBody())) {
+                            	contentXml = Consts.NORMAL_P_TMP.replace("XX", General.XMLEncode(qu.getBodySummary()).trim());
+                            } else {
+                                try {
+                                    byte[] wordBytes = null;
+                                    if ((qu.getBodyWord() == null || qu.getBodyWord().length == 0)
+                                            && !General.isEmpty(qu.getBody())) {
+                                        wordBytes = General.htmlToDocx(qu.getBody());
+                                    } else {
+                                        wordBytes = qu.getBodyWord();
+                                    }
+                                    contentXml = General.dealWord(wordBytes, templetDocxReader, needToUpdate);
+                                } catch (Exception e) {
+                                    log.warn("获取试题[" + qu.getId() + "]的Word信息失败,原因:" + e.getMessage(), e);
+                                    contentXml = Consts.ERR_P_TMP.replace("XX",
+                                            quNo + "." + String.format(Consts.ERR_QUS_MSG, qu.getId() + ""));
+                                }
+                            }
+                            contentXml = addBeforeLines(contentXml, 200, 0, 0);
+                            int optSize = (qu.getOptions() != null) ? qu.getOptions().size() : 0;
+                            if (optSize > 0) {
+                                int optTxtMaxLen = 0;
+                                for (QuestionOption opt : qu.getOptions()) {
+                                    String optTxt = General.convertNullToEmpty(opt.getSummary()).trim();
+                                    if (optTxt.length() > optTxtMaxLen) {
+                                        optTxtMaxLen = optTxt.length();
+                                    }
+                                }
+                                if (optTxtMaxLen == 0) {
+                                    optTxtMaxLen = 10;
+                                }
+                                String anTblTmp = null;
+                                if (optSize == 4) {
+                                    if (optTxtMaxLen <= 8) {
+                                        anTblTmp = Consts.OPT_TABLE_TMP_1;
+                                    } else if (optTxtMaxLen <= 16) {
+                                        anTblTmp = Consts.OPT_TABLE_TMP_2;
+                                    } else {
+                                    	anTblTmp = Consts.OPT_TABLE_TMP_4X1;
+                                    }
+                                } else if (optSize == 5) {
+                                    if (optTxtMaxLen <= 11) {
+                                        anTblTmp = Consts.OPT_TABLE_TMP_3;
+                                    }else{
+                                    	anTblTmp = Consts.OPT_TABLE_TMP_5X1;
+                                    }
+                                }
+
+                                String optsStr = null;
+                                /**暂时屏蔽表格方式显示选项
+                                if ((optSize == 4 || optSize == 5) && anTblTmp != null) {
+                                    optsStr = anTblTmp;
+                                } else {
+                                    optsStr = "";
+                                }
+                                **/
+                                optsStr = "";
+                                for (int m = 0; m < optSize; m++) {
+                                    QuestionOption opt = qu.getOptions().get(m);
+                                    String seqNum = String.valueOf(((char) ('A' + m)));
+                                    String prefixStr = "	" + seqNum + ".";
+                                    String anStr = null;
+                                    log.info("正在处理答题项:id = " + opt.getId());
+                                    if ((opt.getContentWord() == null || opt.getContentWord().length == 0)
+                                            && General.isEmpty(opt.getContent())) {
+                                        String optTxt = General.XMLEncode(opt.getSummary()).trim();
+                                        anStr = Consts.NORMAL_P_TMP.replace("XX", prefixStr + optTxt);
+                                    } else {
+                                        try {
+                                            byte[] wordBytes = null;
+                                            if ((opt.getContentWord() == null || opt.getContentWord().length == 0)
+                                                    && !General.isEmpty(opt.getContent())) {
+                                                wordBytes = General.htmlToDocx(opt.getContent());
+                                            } else {
+                                                wordBytes = opt.getContentWord();
+                                            }
+                                            anStr = General.dealWord(wordBytes, templetDocxReader, needToUpdate);
+                                            // int firstWtBeginIndex =
+                                            // anStr.indexOf("<w:t>");
+                                            int firstWtBeginIndex = -1;
+                                            if (firstWtBeginIndex < 0) {
+                                                int firstWpBeginIndex = anStr.indexOf(">");// 默认第一个节点是<w:p
+                                                                                           // ...>,不支持答题项第一个元素是表格
+                                                String part1 = anStr.substring(0, firstWpBeginIndex + ">".length()).trim();
+                                                String part2 = anStr.substring(firstWpBeginIndex + ">".length())
+                                                        .replace("\"center\"", "\"left\"")
+                                                        .replace("\"right\"", "\"left\"").trim();
+                                                anStr = part1 + "<w:r><w:t>" + prefixStr + "</w:t></w:r>" + part2;
+                                                /*****
+                                                 * 往anStr里面添加<w:jc
+                                                 * w:val="left"/>
+                                                 *****/
+                                                {
+                                                    if (!anStr.contains("<w:jc w:val=\"left\"/>")) {
+                                                        int pPrIndex = anStr.indexOf("<w:pPr>");
+                                                        if (pPrIndex < 0) {
+                                                            anStr = "<w:pPr><w:jc w:val=\"left\"/></w:pPr>" + anStr;
+                                                        } else {
+                                                            anStr = anStr.substring(0, pPrIndex + "<w:pPr>".length())
+                                                                    + "<w:jc w:val=\"left\"/>"
+                                                                    + anStr.substring(pPrIndex + "<w:pPr>".length());
+                                                        }
+                                                    }
+                                                }
+                                            } else {
+                                                // String part1 =
+                                                // anStr.substring(0,
+                                                // firstWtBeginIndex +
+                                                // "<w:t>".length());
+                                                // String part2 =
+                                                // anStr.substring(firstWtBeginIndex
+                                                // + "<w:t>".length());
+                                                // anStr = part1 + ((char)('A' +
+                                                // m)) + "." + part2;
+                                            }
+                                        } catch (Exception e) {
+                                            log.warn("获取试题选项[" + opt.getId() + "]的Word信息失败,原因:" + e.getMessage(), e);
+                                            anStr = Consts.ERR_P_TMP.replace("XX",
+                                                    prefixStr + String.format(Consts.ERR_QUS_OPT_MSG, qu.getId() + ""));
+                                        }
+                                    }
+                                    /**暂时屏蔽表格方式显示选项
+                                    if ((optSize == 4 || optSize == 5) && anTblTmp != null) {
+                                        optsStr = optsStr.replace(seqNum + "_" + seqNum + ".", anStr);
+                                    } else {
+                                        optsStr = optsStr + anStr;
+                                    }
+                                    **/
+                                    optsStr = optsStr + addBeforeLines(anStr,200,0,0);
+                                }
+                                contentXml = contentXml + optsStr;
+                            }
+                            xtXml = xtXml.replace("##试题内容##", contentXml);
+                            
+                            String answer = null;
+                            if ((qu.getAnswerWord() == null || qu.getAnswerWord().length == 0)
+                                    && General.isEmpty(qu.getAnswer())) {
+                                answer = Consts.NORMAL_P_TMP.replace("XX", General.XMLEncode(qu.getAnswerSummary()).trim());
+                            } else {
+                                try {
+                                	boolean isBlank = false;
+                                    byte[] wordBytes = null;
+                                    if ((qu.getAnswerWord() == null || qu.getAnswerWord().length == 0)
+                                            && !General.isEmpty(qu.getAnswer())) {
+                                    	if(General.isEmpty(General.extractText(qu.getAnswer()))){
+                                    		answer = Consts.NORMAL_P_TMP.replace("XX", General.toUnicode('<') + "无" + General.toUnicode('>'));
+                                    		isBlank = true;
+                                    	}else{
+                                    		wordBytes = General.htmlToDocx(qu.getAnswer());
+                                    	}
+                                    } else {
+                                        wordBytes = qu.getAnswerWord();
+                                    }
+                                    if(!isBlank){
+                                        answer = General.dealWord(wordBytes, templetDocxReader, needToUpdate);
+                                    }
+                                } catch (Exception e) {
+                                    log.warn("获取试题[" + qu.getId() + "]的Word信息失败,原因:" + e.getMessage(), e);
+                                    answer = Consts.ERR_P_TMP.replace("XX",
+                                            quNo + "." + String.format(Consts.ERR_ANSWER_MSG, qu.getId() + ""));
+                                }
+                            }
+                            answer = addBeforeLines(answer, 200, 0, 0);
+                            xtXml = Consts.BLANK_BR_TMP + xtXml.replace("##答案##", answer);
+                            if(i < paper.getQtypeList().size()-1 || j < qtyp.getConstructDetails().size()-1){
+                            	xtXml = xtXml + Consts.PAGE_BR_TMP;
+                            }
+                            IOUtils.write(xtXml, fos, "UTF-8");
+                        }
+                    }
+
+                    IOUtils.write(tail, fos, "UTF-8");
+                } finally {
+                    General.close(is);
+                    General.close(fosNew);
+                    General.close(fos);
+                }
+            }
+
+            {
+                File document = templetDocxReader.getDocumentInfo().getFile();
+                FileOutputStream fos = null;
+                InputStream is = null;
+                try {
+                    is = new FileInputStream(document);
+                    String docStr = IOUtils
+                            .toString(is, "UTF-8")
+                            .replace("<pic:pic>",
+                                    "<pic:pic xmlns:pic=\"http://schemas.openxmlformats.org/drawingml/2006/picture\">")
+                            .replace("<w15:collapsed w:val=\"false\"/>", "");
+
+                    // String xmlns_a =
+                    // "xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"";
+                    // if(!docStr.contains(xmlns_a)){
+                    // docStr = docStr.replace("<w:document ", "<w:document " +
+                    // xmlns_a + " ");
+                    // }
+                    fos = new FileOutputStream(document, false);
+                    IOUtils.write(docStr, fos, "UTF-8");
+                } finally {
+                    General.close(is);
+                    General.close(fos);
+                }
+            }
+
+            {
+                DocxReader.updateDocx(newDocx, needToUpdate);
+            }
+        } catch (Exception e) {
+            log.error("生成试卷[" + paper.getId() + "]的Word文档失败,原因:" + e.getMessage(), e);
+            throw new BizException(e.getMessage(), e);
+        } finally {
+            General.release(templetDocxReader);
+        }
+        if(ParamUtils.NeedCheckWordVersion){
+        	General.setDocxDefinedAttr(newDocx, Consts.DOCX_VERSION, "QMTH" + System.currentTimeMillis());// 往新生成的Word里面打个版本号:当前时间
+        }
+        return newDocx;
+    }
+	
+	public Attachment generalPaperFileIntoAtt(int paperId,User curUser) throws BizException{
+		PagerConstruct paper = getOriginalWholePaperInfo(paperId);
+		File paperFile = generalPaperFile(paper);
+		File newFile = General.newAttFile();
+		paperFile.renameTo(newFile);
+		Attachment att = new Attachment();
+		att.setCreatedBy(curUser.getId());
+		att.setOriginalName(paper.getName() + ".docx");
+		att.setCurName(newFile.getName());
+		att.setFileLength(newFile.length());
+		att.setStorePath(newFile.getAbsolutePath());
+		att.setStatus(Consts.AttachmentStatus.DRAFT);
+		dao.insert("addAttachment", att);
+		//更新试卷中的word附件
+		int oldAttId = paper.getLastPaperWord() == null ? 0 : paper.getLastPaperWord().intValue();
+		Attachment newAtt = attachmentService.getAttachmentByAttr(newFile.getAbsolutePath());
+		int newAttId = newAtt == null ? 0 : newAtt.getId().intValue();
+		if(oldAttId == 0){
+			paper.setLastPaperWord(newAttId);
+		}else{
+			Attachment oldAtt = attachmentService.getAttachmentById(oldAttId);
+			if(oldAtt != null){
+				oldAtt.setStatus("DELETEED");
+				dao.update("updateAttachment", att);
+			}
+			paper.setLastPaperWord(newAttId);
+		}
+		if(newAttId != 0){
+			dao.update("updatePagerConstruct", paper);
+		}
+		return att;
+	}
+
+    public File generalPaperFile(PagerConstruct paper) throws BizException {
+        File newDocx = null;
+        DocxReader templetDocxReader = null;
+        Map<String, ResourceInfo> needToUpdate = new HashMap<String, ResourceInfo>();
+        try {
+            {// 拷贝一份模板文件到临时文件夹里面
+                FileOutputStream fos = null;
+                InputStream is = null;
+                try {
+                    newDocx = new File(ParamUtils.TemporaryDirPath, UUID.randomUUID().toString().replace("-", ""));
+                    fos = new FileOutputStream(newDocx);
+                    is = ZujuanService.class.getResourceAsStream("/paperTmps/pagerTmp1.docx");
+                    IOUtils.copyLarge(is, fos);
+                    fos.flush();
+                } finally {
+                    General.close(is);
+                    General.close(fos);
+                }
+            }
+
+            templetDocxReader = new DocxReader(newDocx);
+            templetDocxReader.doRead();
+            {
+                List<ResourceInfo> headersAndFooters = new ArrayList<ResourceInfo>();
+                headersAndFooters.addAll(templetDocxReader.getHeaders());
+                headersAndFooters.addAll(templetDocxReader.getFooters());
+                for (ResourceInfo info : headersAndFooters) {
+                    FileOutputStream fos = null;
+                    InputStream is = null;
+                    try {
+                        is = new FileInputStream(info.getFile());
+                        String docStr = IOUtils.toString(is, "UTF-8")
+                                .replace("##试卷名称##", General.XMLEncode(paper.getName()))
+                                .replace("##试卷题头##", General.XMLEncode(paper.getHead()))
+                                .replace("##课程名称##", General.XMLEncode(paper.getSkeleton().getCourse().getName()))
+                                .replace("##课程代码##", General.XMLEncode(paper.getSkeleton().getCourse().getCode()))
+                                .replace("##满分##", "100");
+                        fos = new FileOutputStream(info.getFile(), false);
+                        IOUtils.write(docStr, fos, "UTF-8");
+                    } finally {
+                        General.close(is);
+                        General.close(fos);
+                    }
+                    needToUpdate.put(info.getPathInZip(), info);
+                }
+            }
+            {
+                needToUpdate.put(templetDocxReader.getDocumentInfo().getPathInZip(),
+                        templetDocxReader.getDocumentInfo());
+                File document = templetDocxReader.getDocumentInfo().getFile();
+                FileOutputStream fos = null;
+                InputStream is = null;
+                try {
+                    is = new FileInputStream(document);
+                    String docStr = IOUtils.toString(is, "UTF-8")
+                            .replace("##试卷名称##", General.XMLEncode(paper.getName()))
+                            .replace("##试卷题头##", General.XMLEncode(paper.getHead()))
+                            .replace("##课程名称##", General.XMLEncode(paper.getSkeleton().getCourse().getName()))
+                            .replace("##课程代码##", General.XMLEncode(paper.getSkeleton().getCourse().getCode()))
+                            .replace("##满分##", "100");
+                    String xmlns_w15 = "xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\"";
+                    if (!docStr.contains(xmlns_w15)) {
+                        docStr = docStr.replace("<w:document ", "<w:document " + xmlns_w15 + " ");
+                    }
+                    String xmlns_a = "xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"";
+                    if (!docStr.contains(xmlns_a)) {
+                        docStr = docStr.replace("<w:document ", "<w:document " + xmlns_a + " ");
+                    }
+                    fos = new FileOutputStream(document, false);
+                    IOUtils.write(docStr, fos, "UTF-8");
+                } finally {
+                    General.close(is);
+                    General.close(fos);
+                }
+            }
+            {
+                File document = templetDocxReader.getDocumentInfo().getFile();
+                FileOutputStream fosNew = null;
+                FileOutputStream fos = null;
+                InputStream is = null;
+                try {
+                    is = new FileInputStream(document);
+                    String docStr = IOUtils.toString(is, "UTF-8");
+                    int index1 = docStr.indexOf("##试题开始##");// "##试题开始##"的位置
+                    int index2 = docStr.substring(0, index1).lastIndexOf("<w:p ");// "##试题开始##"对应的<w:p>标签的开始位置
+                    int index3 = index1 + docStr.substring(index1).indexOf("</w:p>");// "##试题开始##"对应的<w:p>标签的结束位置
+
+                    int index4 = docStr.indexOf("##试题结束##");// "##试题结束##"的位置
+                    int index5 = docStr.substring(0, index4).lastIndexOf("<w:p ");// "##试题结束##"对应的<w:p>标签的开始位置
+                    int index6 = index4 + docStr.substring(index4).indexOf("</w:p>");// "##试题结束##"对应的<w:p>标签的结束位置
+
+                    String head = docStr.substring(0, index2);// ##试题开始##"前面的部分
+                    String quTmpStr = docStr.substring(index3 + "</w:p>".length(), index5);// 题目模板
+                    String tail = docStr.substring(index6 + "</w:p>".length());// "##试题结束##"后面的部分
+
+                    int index7 = quTmpStr.indexOf("##小题序号##");
+                    int index8 = quTmpStr.substring(0, index7).lastIndexOf("<w:p ");// 小题对应的<w:p>标签的开始位置
+                    int index9 = index7 + quTmpStr.substring(index7).indexOf("</w:p>");// 小题对应的<w:p>标签的结束位置
+
+                    int index10 = quTmpStr.indexOf("##答题项##");
+                    // int index11 =
+                    // quTmpStr.substring(0,index10).lastIndexOf("<w:p ");//答题项对应的<w:p>标签的开始位置
+                    int index12 = index10 + quTmpStr.substring(index10).indexOf("</w:p>");// 答题项对应的<w:p>标签的结束位置
+
+                    fosNew = new FileOutputStream(document, false);
+                    IOUtils.write(head, fosNew, "UTF-8");
+                    General.close(fosNew);
+
+                    fos = new FileOutputStream(document, true);
+
+                    String qtTmpHeadStr = quTmpStr.substring(0, index8);
+                    String qtTmpTailStr = quTmpStr.substring(index12 + "</w:p>".length());
+                    String xtTmpStr = quTmpStr.substring(index8, index9 + "</w:p>".length());
+
+                    // String anTmpStr = quTmpStr.substring(index11,index12 +
+                    // "</w:p>".length());
+                    int quNo = 0;
+                    for (int i = 0; i < paper.getQtypeList().size(); i++) {
+                        PagerConstructQtype qtyp = paper.getQtypeList().get(i);
+                        String str1= General.toCNLowerNum(i + 1) + "、" + General.XMLEncode(qtyp.getName())
+                        		+ ":本大题共" + qtyp.getQuestionSum() + "小题," + ((qtyp.getQuestionSum() > 1)?"每小题":"")  
+                        		+ General.formatScore(qtyp.getScore()) + "分" 
+                        		+ ((qtyp.getQuestionSum() > 1) ? ",共" + General.formatScore(qtyp.getQuestionScores()) + "分" : "")
+                        		+ "。";
+                        String qtypStr = qtTmpHeadStr
+                                .replace("##大题描述##", str1)
+                                .replace("##大题序号##", General.toCNLowerNum(i + 1))
+                                .replace("##大题名称##", General.XMLEncode(qtyp.getName()))
+                                .replace("##小题数##", "" + qtyp.getQuestionSum())
+                                .replace("##小题分##", "" + General.formatScore(qtyp.getScore()))
+                                .replace("##小题总分##", "" + General.formatScore(qtyp.getQuestionScores()))
+                                .replace("##题型说明##",General.convertNullToEmpty(qtyp.getQuestionType().getRemark()));
+                        IOUtils.write(qtypStr, fos, "UTF-8");
+                        for (int j = 0; j < qtyp.getConstructDetails().size(); j++) {
+                            PagerConstructDetail d = qtyp.getConstructDetails().get(j);
+                            quNo++;
+                            Question qu = d.getQuestion();
+                            if (qu == null) {
+                                qu = new Question();
+                                qu.setBodySummary("空题");
+                            }
+                            log.info("正在处理试题:id = " + qu.getId());
+                            String xtStr = null;
+                            if ((qu.getBodyWord() == null || qu.getBodyWord().length == 0)
+                                    && General.isEmpty(qu.getBody())) {
+                                xtStr = xtTmpStr.replace("##小题序号##", "" + toQuesNumStr(quNo)).replace("##题干##",
+                                        General.XMLEncode(qu.getBodySummary()).trim());
+                            } else {
+                                try {
+                                    byte[] wordBytes = null;
+                                    if ((qu.getBodyWord() == null || qu.getBodyWord().length == 0)
+                                            && !General.isEmpty(qu.getBody())) {
+                                        wordBytes = General.htmlToDocx(qu.getBody());
+                                    } else {
+                                        wordBytes = qu.getBodyWord();
+                                    }
+                                    xtStr = General.dealWord(wordBytes, templetDocxReader, needToUpdate);
+                                    
+                                	int firstWtBeginIndex = xtStr.indexOf("<w:t>");
+                                	int firstWtBeginIndex2 = xtStr.indexOf("<w:t ");
+                                	firstWtBeginIndex = (firstWtBeginIndex < 0 || (firstWtBeginIndex2 >= 0 && firstWtBeginIndex > firstWtBeginIndex2))?firstWtBeginIndex2:firstWtBeginIndex;
+                                    
+                                	int nearestGtIndex = xtStr.indexOf('>', firstWtBeginIndex + 1);
+
+                                    String part1 = xtStr.substring(0, nearestGtIndex + 1).trim();
+                                    String part2 = xtStr.substring(nearestGtIndex + 1).trim();
+                                    xtStr = part1 + toQuesNumStr(quNo) + "." + part2;
+                                } catch (Exception e) {
+                                    log.warn("获取试题[" + qu.getId() + "]的Word信息失败,原因:" + e.getMessage(), e);
+                                    xtStr = Consts.ERR_P_TMP.replace("XX",
+                                            quNo + "." + String.format(Consts.ERR_QUS_MSG, qu.getId() + ""));
+                                }
+                            }
+                            //xtStr = dealFormula(xtStr);
+                            int firstWtBeginIndex1 = xtStr.indexOf("<w:t>");
+                        	int firstWtBeginIndex2 = xtStr.indexOf("<w:t ");
+                        	int firstWtEndIndex1 = xtStr.indexOf("</w:t>");
+                        	firstWtBeginIndex1 = (firstWtBeginIndex1 < 0 || (firstWtBeginIndex2 >= 0 && firstWtBeginIndex1 > firstWtBeginIndex2))?firstWtBeginIndex2:firstWtBeginIndex1;
+                        	int nearestGtIndex = xtStr.indexOf('>', firstWtBeginIndex1 + 1);
+                        	//int wtLen = xtStr.substring(nearestGtIndex, firstWtEndIndex1).length();
+                        	//int wt_real_len = getQuestionBodyLength(xtStr.substring(nearestGtIndex, firstWtEndIndex1));
+                            int optSize = (qu.getOptions() != null) ? qu.getOptions().size() : 0;
+                            if (optSize > 0) {
+                            	String option_temp = null;
+								if (optSize <= 4) {
+									xtStr = xtStr.replaceAll("<w:pPr>", "<w:pPr><w:tabs><w:tab w:val=\"left\" w:pos=\"7329\"/></w:tabs>");
+									option_temp = "<w:r><w:tab/></w:r><w:r><w:t>【      】</w:t></w:r></w:p>";
+									String before_str = StringUtils.substringBeforeLast(xtStr, "</w:p>");
+									String after_str = StringUtils.substringAfterLast(xtStr, "</w:p>"); 
+									xtStr = before_str + option_temp + after_str;
+								} else {
+									xtStr = xtStr.replaceAll("<w:pPr>", "<w:pPr><w:tabs><w:tab w:val=\"left\" w:pos=\"7119\"/></w:tabs>");
+									option_temp = "<w:r><w:tab/></w:r><w:r><w:t>【        】</w:t></w:r></w:p>";
+									String before_str = StringUtils.substringBeforeLast(xtStr, "</w:p>");
+									String after_str = StringUtils.substringAfterLast(xtStr, "</w:p>"); 
+									xtStr = before_str + option_temp + after_str;
+								}
+							}
+                            IOUtils.write(addBeforeLines(xtStr,0,0,0), fos, "UTF-8");
+                            if (optSize > 0) {
+                                int optTxtMaxLen = 0;
+                                for (QuestionOption opt : qu.getOptions()) {
+                                    String optTxt = General.convertNullToEmpty(opt.getSummary()).trim();
+                                    if (optTxt.length() > optTxtMaxLen) {
+                                        optTxtMaxLen = optTxt.length();
+                                    }
+                                }
+                                if (optTxtMaxLen == 0) {
+                                    optTxtMaxLen = 10;
+                                }
+                                String anTblTmp = null;
+                                if (optSize == 4) {
+                                    if (optTxtMaxLen <= 8) {
+                                        anTblTmp = Consts.OPT_TABLE_TMP_1;
+                                    } else if (optTxtMaxLen <= 16) {
+                                        anTblTmp = Consts.OPT_TABLE_TMP_2;
+                                    } else {
+                                    	anTblTmp = Consts.OPT_TABLE_TMP_4X1;
+                                    }
+                                } else if (optSize == 5) {
+                                    if (optTxtMaxLen <= 11) {
+                                        anTblTmp = Consts.OPT_TABLE_TMP_3;
+                                    }else{
+                                    	anTblTmp = Consts.OPT_TABLE_TMP_5X1;
+                                    }
+                                }
+
+                                String optsStr = null;
+                                /**暂时屏蔽表格方式显示选项
+                                if ((optSize == 4 || optSize == 5) && anTblTmp != null) {
+                                    optsStr = anTblTmp;
+                                } else {
+                                    optsStr = "";
+                                }
+                                **/
+                                optsStr = "";
+                                for (int m = 0; m < optSize; m++) {
+                                    QuestionOption opt = qu.getOptions().get(m);
+                                    String seqNum = String.valueOf(((char) ('A' + m)));
+                                    String prefixStr = "	" + seqNum + ".";
+                                    String anStr = null;
+                                    log.info("正在处理答题项:id = " + opt.getId());
+                                    if ((opt.getContentWord() == null || opt.getContentWord().length == 0)
+                                            && General.isEmpty(opt.getContent())) {
+                                        String optTxt = General.XMLEncode(opt.getSummary()).trim();
+                                        anStr = Consts.NORMAL_P_TMP.replace("XX", prefixStr + optTxt);
+                                    } else {
+                                        try {
+                                            byte[] wordBytes = null;
+                                            if ((opt.getContentWord() == null || opt.getContentWord().length == 0)
+                                                    &&!General.isEmpty(opt.getContent())) {
+                                                wordBytes = General.htmlToDocx(opt.getContent());
+                                            } else {
+                                                wordBytes = opt.getContentWord();
+                                            }
+                                            anStr = General.dealWord(wordBytes, templetDocxReader, needToUpdate);
+                                            // int firstWtBeginIndex =
+                                            // anStr.indexOf("<w:t>");
+                                            int firstWtBeginIndex = -1;
+                                            if (firstWtBeginIndex < 0) {
+                                                int firstWpBeginIndex = anStr.indexOf(">");// 默认第一个节点是<w:p
+                                                // ...>,不支持答题项第一个元素是表格
+                                                String part1 = anStr.substring(0, firstWpBeginIndex + ">".length()).trim();
+                                                String part2 = anStr.substring(firstWpBeginIndex + ">".length())
+                                                        .replace("\"center\"", "\"left\"")
+                                                        .replace("\"right\"", "\"left\"").trim();
+                                                anStr = part1 + part2;
+                                                /*****
+                                                 * 往anStr里面添加<w:jc
+                                                 * w:val="left"/>
+                                                 *****/
+                                                {
+                                                    if (!anStr.contains("<w:jc w:val=\"left\"/>")) {
+                                                        int pPrIndex = anStr.indexOf("<w:pPr>");
+                                                        if (pPrIndex < 0) {
+                                                            anStr = part1 + "<w:pPr><w:jc w:val=\"left\"/></w:pPr>" + part2;
+                                                        } else {
+                                                            anStr = anStr.substring(0, pPrIndex + "<w:pPr>".length())
+                                                                    + "<w:jc w:val=\"left\"/>"
+                                                                    + anStr.substring(pPrIndex + "<w:pPr>".length());
+                                                        }
+                                                    }
+                                                }
+                                                anStr = anStr.replaceAll("</w:pPr>", "</w:pPr><w:r><w:t>" + prefixStr + "</w:t></w:r>");
+                                            } else {
+                                                // String part1 =
+                                                // anStr.substring(0,
+                                                // firstWtBeginIndex +
+                                                // "<w:t>".length());
+                                                // String part2 =
+                                                // anStr.substring(firstWtBeginIndex
+                                                // + "<w:t>".length());
+                                                // anStr = part1 + ((char)('A' +
+                                                // m)) + "." + part2;
+                                            }
+                                        } catch (Exception e) {
+                                            log.warn("获取试题选项[" + opt.getId() + "]的Word信息失败,原因:" + e.getMessage(), e);
+                                            anStr = Consts.ERR_P_TMP.replace("XX",
+                                                    prefixStr + String.format(Consts.ERR_QUS_OPT_MSG, qu.getId() + ""));
+                                        }
+                                    }
+                                    /**暂时屏蔽表格方式显示选项
+                                    if ((optSize == 4 || optSize == 5) && anTblTmp != null) {
+                                        optsStr = optsStr.replace(seqNum + "_" + seqNum + ".", anStr);
+                                    } else {
+                                        optsStr = optsStr + anStr;
+                                    }
+                                    **/
+                                    //anStr = dealFormula(anStr);
+                                    optsStr = optsStr + addBeforeLines(anStr,0,0,0);
+                                }
+                                optsStr = compressOption(optsStr, optSize);
+                                IOUtils.write(optsStr, fos, "UTF-8");
+                            }
+                            IOUtils.write(qtTmpTailStr, fos, "UTF-8");
+                        }
+                    }
+
+                    IOUtils.write(tail, fos, "UTF-8");
+                } finally {
+                    General.close(is);
+                    General.close(fosNew);
+                    General.close(fos);
+                }
+            }
+
+            {
+                File document = templetDocxReader.getDocumentInfo().getFile();
+                FileOutputStream fos = null;
+                InputStream is = null;
+                try {
+                    is = new FileInputStream(document);
+                    String docStr = IOUtils
+                            .toString(is, "UTF-8")
+                            .replace("<pic:pic>",
+                                    "<pic:pic xmlns:pic=\"http://schemas.openxmlformats.org/drawingml/2006/picture\">")
+                            .replace("<w15:collapsed w:val=\"false\"/>", "");
+
+                    // String xmlns_a =
+                    // "xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"";
+                    // if(!docStr.contains(xmlns_a)){
+                    // docStr = docStr.replace("<w:document ", "<w:document " +
+                    // xmlns_a + " ");
+                    // }
+                    fos = new FileOutputStream(document, false);
+                    IOUtils.write(docStr, fos, "UTF-8");
+                } finally {
+                    General.close(is);
+                    General.close(fos);
+                }
+            }
+
+            {
+                DocxReader.updateDocx(newDocx, needToUpdate);
+            }
+        } catch (Exception e) {
+            log.error("生成试卷[" + paper.getId() + "]的Word文档失败,原因:" + e.getMessage(), e);
+            throw new BizException(e.getMessage(), e);
+        } finally {
+            General.release(templetDocxReader);
+        }
+        if(ParamUtils.NeedCheckWordVersion){
+        	General.setDocxDefinedAttr(newDocx, Consts.DOCX_VERSION, "QMTH" + System.currentTimeMillis());// 往新生成的Word里面打个版本号:当前时间
+        }
+        return newDocx;
+    }
+    
+    /**
+     * <p>旧版本的网评卷导出,已作废</p>
+     * <p>新模板</p>
+     * @author songyue
+     * @date 2016-06-24
+     */
+    @Deprecated
+	public File generalWangPingPaperFile_disabled(PagerConstruct paper) throws BizException {
+		File newDocx = null;
+		DocxReader templetDocxReader = null;
+		Map<String, ResourceInfo> needToUpdate = new HashMap<String, ResourceInfo>();
+		try {
+			{// 拷贝一份模板文件到临时文件夹里面
+				FileOutputStream fos = null;
+				InputStream is = null;
+				try {
+					newDocx = new File(ParamUtils.TemporaryDirPath, UUID.randomUUID().toString().replace("-", ""));
+					fos = new FileOutputStream(newDocx);
+					is = ZujuanService.class.getResourceAsStream("/paperTmps/wangpingPagerTmp1.docx");
+					IOUtils.copyLarge(is, fos);
+					fos.flush();
+				} finally {
+					General.close(is);
+					General.close(fos);
+				}
+			}
+
+			templetDocxReader = new DocxReader(newDocx);
+			templetDocxReader.doRead();
+			{
+				List<ResourceInfo> headersAndFooters = new ArrayList<ResourceInfo>();
+				headersAndFooters.addAll(templetDocxReader.getHeaders());
+				headersAndFooters.addAll(templetDocxReader.getFooters());
+				for (ResourceInfo info : headersAndFooters) {
+					FileOutputStream fos = null;
+					InputStream is = null;
+					try {
+						is = new FileInputStream(info.getFile());
+						String docStr = IOUtils.toString(is, "UTF-8").replace("课程名称",
+								General.XMLEncode(paper.getSkeleton().getCourse().getName()));
+						fos = new FileOutputStream(info.getFile(), false);
+						IOUtils.write(docStr, fos, "UTF-8");
+					} finally {
+						General.close(is);
+						General.close(fos);
+					}
+					needToUpdate.put(info.getPathInZip(), info);
+				}
+			}
+			{
+				needToUpdate.put(templetDocxReader.getDocumentInfo().getPathInZip(),
+						templetDocxReader.getDocumentInfo());
+				File document = templetDocxReader.getDocumentInfo().getFile();
+				FileOutputStream fos = null;
+				InputStream is = null;
+				try {
+					is = new FileInputStream(document);
+					String docStr = IOUtils.toString(is, "UTF-8")
+							.replace("课程名称", General.XMLEncode(paper.getSkeleton().getCourse().getName()))
+							.replace("课程代码一", General.XMLEncode(paper.getSkeleton().getCourse().getCode()))
+							.replace("非选择题总分", General.formatScore(getQuestionScore(paper, "nonchoice")))
+							.replace("选择题总分", General.formatScore(getQuestionScore(paper, "choice")));
+
+					String xmlns_w15 = "xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\"";
+					if (!docStr.contains(xmlns_w15)) {
+						docStr = docStr.replace("<w:document ", "<w:document " + xmlns_w15 + " ");
+					}
+					String xmlns_a = "xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"";
+					if (!docStr.contains(xmlns_a)) {
+						docStr = docStr.replace("<w:document ", "<w:document " + xmlns_a + " ");
+					}
+					fos = new FileOutputStream(document, false);
+					IOUtils.write(docStr, fos, "UTF-8");
+				} finally {
+					General.close(is);
+					General.close(fos);
+				}
+			}
+			{
+				File document = templetDocxReader.getDocumentInfo().getFile();
+				FileOutputStream fosNew = null;
+				FileOutputStream fos = null;
+				InputStream is = null;
+				try {
+					is = new FileInputStream(document);
+					String docStr = IOUtils.toString(is, "UTF-8");
+					int index1 = docStr.indexOf("选择题开始");// "选择题开始"的位置
+					int index2 = docStr.substring(0, index1).lastIndexOf("<w:p ");// "选择题开始"对应的<w:p>标签的开始位置
+
+					int index4 = docStr.indexOf("非选择题结束");// "非选择题结束"的位置
+					int index6 = index4 + docStr.substring(index4).indexOf("</w:p>");// "非选择题结束"对应的<w:p>标签的结束位置
+
+					String head = docStr.substring(0, index2);// 选择题开始"前面的部分
+					String tail = docStr.substring(index6 + "</w:p>".length());// "非选择题结束"后面的部分
+
+					fosNew = new FileOutputStream(document, false);
+					IOUtils.write(head, fosNew, "UTF-8");
+					General.close(fosNew);
+
+					fos = new FileOutputStream(document, true);
+
+					int quNo = 0;
+					int choice_index1 = docStr.indexOf("选择题开始");// "选择题开始"的位置
+					int choice_index3 = choice_index1 + docStr.substring(choice_index1).indexOf("</w:p>");// "选择题开始"对应的<w:p>标签的结束位置
+					int choice_index4 = docStr.indexOf("选择题结束");// "选择题结束"的位置
+					int choice_index5 = docStr.substring(0, choice_index4).lastIndexOf("<w:p ");// "选择题结束"对应的<w:p>标签的开始位置
+					int choice_index6 = choice_index4 + docStr.substring(choice_index4).indexOf("</w:p>")
+							+ "</w:p>".length();// "选择题结束"的</w:p>位置
+					String choice_quTmpStr = docStr.substring(choice_index3 + "</w:p>".length(), choice_index5);// 选择题目模板
+					int choice_index7 = choice_quTmpStr.indexOf("小题序号");
+					int choice_index8 = choice_quTmpStr.substring(0, choice_index7).lastIndexOf("<w:p ");// 小题对应的<w:p>标签的开始位置
+					int choice_index9 = choice_index7 + choice_quTmpStr.substring(choice_index7).indexOf("</w:p>");// 小题对应的<w:p>标签的结束位置
+
+					int choice_index10 = choice_quTmpStr.indexOf("答题项");
+					int choice_index12 = choice_index10 + choice_quTmpStr.substring(choice_index10).indexOf("</w:p>");// 答题项对应的<w:p>标签的结束位置
+					String choice_qtTmpHeadStr = choice_quTmpStr.substring(0, choice_index8);
+					String choice_qtTmpTailStr = choice_quTmpStr.substring(choice_index12 + "</w:p>".length());
+					String choice_xtTmpStr = choice_quTmpStr.substring(choice_index8,
+							choice_index9 + "</w:p>".length());
+					// 选择题
+					for (int i = 0; i < paper.getQtypeList().size(); i++) {
+						PagerConstructQtype qtyp = paper.getQtypeList().get(i);
+
+						if (qtyp.getName().contains("选择题")) {
+							String choice_str1 = General.toCNLowerNum(i + 1) + "、" + General.XMLEncode(qtyp.getName())
+									+ ":本大题共" + qtyp.getQuestionSum() + "小题,"
+									+ ((qtyp.getQuestionSum() > 1) ? "每小题" : "") + General.formatScore(qtyp.getScore())
+									+ "分" + ((qtyp.getQuestionSum() > 1)
+											? ",共" + General.formatScore(qtyp.getQuestionScores()) + "分" : "")
+									+ "。";
+							String choice_qtypStr = choice_qtTmpHeadStr.replace("大题描述", choice_str1)
+									.replace("大题序号", General.toCNLowerNum(i + 1))
+									.replace("大题名称", General.XMLEncode(qtyp.getName()))
+									.replace("小题数", "" + qtyp.getQuestionSum())
+									.replace("小题分", "" + General.formatScore(qtyp.getScore()))
+									.replace("小题总分", "" + General.formatScore(qtyp.getQuestionScores()))
+									.replace("题型说明", General.convertNullToEmpty(qtyp.getQuestionType().getRemark()));
+							IOUtils.write(choice_qtypStr, fos, "UTF-8");
+							for (int j = 0; j < qtyp.getConstructDetails().size(); j++) {
+								PagerConstructDetail d = qtyp.getConstructDetails().get(j);
+								quNo++;
+								Question qu = d.getQuestion();
+								if (qu == null) {
+									qu = new Question();
+									qu.setBodySummary("空题");
+								}
+								log.info("正在处理试题:id = " + qu.getId());
+								String xtStr = null;
+								if ((qu.getBodyWord() == null || qu.getBodyWord().length == 0)
+										&& General.isEmpty(qu.getBody())) {
+									xtStr = choice_xtTmpStr.replace("小题序号", "" + toQuesNumStr(quNo)).replace("题干",
+											General.XMLEncode(qu.getBodySummary()).trim());
+								} else {
+									try {
+										byte[] wordBytes = null;
+										if ((qu.getBodyWord() == null || qu.getBodyWord().length == 0)
+												&& !General.isEmpty(qu.getBody())) {
+											wordBytes = General.htmlToDocx(qu.getBody());
+										} else {
+											wordBytes = qu.getBodyWord();
+										}
+										xtStr = General.dealWord(wordBytes, templetDocxReader, needToUpdate);
+
+										int firstWtBeginIndex = xtStr.indexOf("<w:t>");
+										int firstWtBeginIndex2 = xtStr.indexOf("<w:t ");
+										firstWtBeginIndex = (firstWtBeginIndex < 0
+												|| (firstWtBeginIndex2 >= 0 && firstWtBeginIndex > firstWtBeginIndex2))
+														? firstWtBeginIndex2 : firstWtBeginIndex;
+
+										int nearestGtIndex = xtStr.indexOf('>', firstWtBeginIndex + 1);
+
+										String part1 = xtStr.substring(0, nearestGtIndex + 1).trim();
+										String part2 = xtStr.substring(nearestGtIndex + 1).trim();
+										xtStr = part1 + toQuesNumStr(quNo) + "." + part2;
+									} catch (Exception e) {
+										log.warn("获取试题[" + qu.getId() + "]的Word信息失败,原因:" + e.getMessage(), e);
+										xtStr = Consts.ERR_P_TMP.replace("XX",
+												quNo + "." + String.format(Consts.ERR_QUS_MSG, qu.getId() + ""));
+									}
+								}
+								int firstWtBeginIndex1 = xtStr.indexOf("<w:t>");
+								int firstWtBeginIndex2 = xtStr.indexOf("<w:t ");
+								int firstWtEndIndex1 = xtStr.indexOf("</w:t>");
+								firstWtBeginIndex1 = (firstWtBeginIndex1 < 0
+										|| (firstWtBeginIndex2 >= 0 && firstWtBeginIndex1 > firstWtBeginIndex2))
+												? firstWtBeginIndex2 : firstWtBeginIndex1;
+								int nearestGtIndex = xtStr.indexOf('>', firstWtBeginIndex1 + 1);
+								//int wtLen = xtStr.substring(nearestGtIndex, firstWtEndIndex1).length();
+								//int wt_real_len = getQuestionBodyLength(xtStr.substring(nearestGtIndex, firstWtEndIndex1));
+								int optSize = (qu.getOptions() != null) ? qu.getOptions().size() : 0;
+								if (optSize > 0) {
+	                            	String option_temp = null;
+									if (optSize <= 4) {
+										xtStr = xtStr.replaceAll("<w:pPr>", "<w:pPr><w:tabs><w:tab w:val=\"left\" w:pos=\"7329\"/></w:tabs>");
+										option_temp = "<w:r><w:tab/></w:r><w:r><w:t>【      】</w:t></w:r></w:p>";
+										String before_str = StringUtils.substringBeforeLast(xtStr, "</w:p>");
+										String after_str = StringUtils.substringAfterLast(xtStr, "</w:p>"); 
+										xtStr = before_str + option_temp + after_str;
+									} else {
+										xtStr = xtStr.replaceAll("<w:pPr>", "<w:pPr><w:tabs><w:tab w:val=\"left\" w:pos=\"7119\"/></w:tabs>");
+										option_temp = "<w:r><w:tab/></w:r><w:r><w:t>【        】</w:t></w:r></w:p>";
+										String before_str = StringUtils.substringBeforeLast(xtStr, "</w:p>");
+										String after_str = StringUtils.substringAfterLast(xtStr, "</w:p>"); 
+										xtStr = before_str + option_temp + after_str;
+									}
+								}
+								//xtStr = dealFormula(xtStr);
+								IOUtils.write(addBeforeLines(xtStr, 0, 0, 0), fos, "UTF-8");
+								if (optSize > 0) {
+									String optsStr = "";
+									for (int m = 0; m < optSize; m++) {
+										QuestionOption opt = qu.getOptions().get(m);
+										String seqNum = String.valueOf(((char) ('A' + m)));
+										String prefixStr = "	" + seqNum + ".";
+										String anStr = null;
+										log.info("正在处理答题项:id = " + opt.getId());
+										if ((opt.getContentWord() == null || opt.getContentWord().length == 0)
+												&& General.isEmpty(opt.getContent())) {
+											String optTxt = General.XMLEncode(opt.getSummary()).trim();
+											anStr = Consts.NORMAL_P_TMP.replace("XX", prefixStr + optTxt);
+										} else {
+											try {
+												byte[] wordBytes = null;
+												if ((opt.getContentWord() == null || opt.getContentWord().length == 0)
+														&& !General.isEmpty(opt.getContent())) {
+													wordBytes = General.htmlToDocx(opt.getContent());
+												} else {
+													wordBytes = opt.getContentWord();
+												}
+												anStr = General.dealWord(wordBytes, templetDocxReader, needToUpdate);
+												int firstWtBeginIndex = -1;
+												if (firstWtBeginIndex < 0) {
+													int firstWpBeginIndex = anStr.indexOf(">");// 默认第一个节点是<w:p
+																								// ...>,不支持答题项第一个元素是表格
+													String part1 = anStr.substring(0, firstWpBeginIndex + ">".length())
+															.trim();
+													String part2 = anStr.substring(firstWpBeginIndex + ">".length())
+															.replace("\"center\"", "\"left\"")
+															.replace("\"right\"", "\"left\"").trim();
+													anStr = part1 + part2;
+													/*****
+													 * 往anStr里面添加
+													 * <w:jc w:val="left"/>
+													 *****/
+													{
+														if (!anStr.contains("<w:jc w:val=\"left\"/>")) {
+															int pPrIndex = anStr.indexOf("<w:pPr>");
+															if (pPrIndex < 0) {
+																anStr = part1 + "<w:pPr><w:jc w:val=\"left\"/></w:pPr>" + part2;
+															} else {
+																anStr = anStr.substring(0,
+																		pPrIndex + "<w:pPr>".length())
+																		+ "<w:jc w:val=\"left\"/>" + anStr.substring(
+																				pPrIndex + "<w:pPr>".length());
+															}
+														}
+													}
+													anStr = anStr.replaceAll("</w:pPr>", "</w:pPr><w:r><w:t>" + prefixStr + "</w:t></w:r>");
+												}
+											} catch (Exception e) {
+												log.warn("获取试题选项[" + opt.getId() + "]的Word信息失败,原因:" + e.getMessage(),
+														e);
+												anStr = Consts.ERR_P_TMP.replace("XX", prefixStr
+														+ String.format(Consts.ERR_QUS_OPT_MSG, qu.getId() + ""));
+											}
+										}
+										//anStr = dealFormula(anStr);
+										optsStr = optsStr + addBeforeLines(anStr, 0, 0, 0);
+									}
+									optsStr = compressOption(optsStr, optSize);
+									IOUtils.write(optsStr, fos, "UTF-8");
+								}
+								IOUtils.write(choice_qtTmpTailStr, fos, "UTF-8");
+							}
+						}
+					}
+					// 非选择题
+					int non_choice_index1 = docStr.indexOf("非选择题开始");// "非选择题开始"的位置
+					int non_choice_index2 = docStr.substring(0, non_choice_index1).lastIndexOf("<w:p ");// "非选择题开始"<w:p>的位置
+					String non_choice_head = docStr.substring(choice_index6, non_choice_index2);// 第二部分
+					IOUtils.write(non_choice_head, fos, "UTF-8");
+					for (int i = 0; i < paper.getQtypeList().size(); i++) {
+						PagerConstructQtype qtyp = paper.getQtypeList().get(i);
+						if (!qtyp.getName().contains("选择题")) {
+
+							int non_choice_index3 = non_choice_index1
+									+ docStr.substring(non_choice_index1).indexOf("</w:p>");// "非选择题开始"对应的<w:p>标签的结束位置
+
+							int non_choice_index4 = docStr.indexOf("非选择题结束");// "非选择题结束"的位置
+							int non_choice_index5 = docStr.substring(0, non_choice_index4).lastIndexOf("<w:p ");// "非选择题结束"对应的<w:p>标签的开始位置
+
+							String non_choice_quTmpStr = docStr.substring(non_choice_index3 + "</w:p>".length(),
+									non_choice_index5);// 非选择题目模板
+
+							int non_choice_index7 = non_choice_quTmpStr.indexOf("小题序号");
+							int non_choice_index8 = non_choice_quTmpStr.substring(0, non_choice_index7)
+									.lastIndexOf("<w:p ");// 小题对应的<w:p>标签的开始位置
+							int non_choice_index9 = non_choice_index7
+									+ non_choice_quTmpStr.substring(non_choice_index7).indexOf("</w:p>");// 小题对应的<w:p>标签的结束位置
+
+							int non_choice_index10 = non_choice_quTmpStr.indexOf("答题项");
+							int non_choice_index12 = non_choice_index10
+									+ non_choice_quTmpStr.substring(non_choice_index10).indexOf("</w:p>");// 答题项对应的<w:p>标签的结束位置
+							String non_choice_qtTmpHeadStr = non_choice_quTmpStr.substring(0, non_choice_index8);
+							String non_choice_qtTmpTailStr = non_choice_quTmpStr
+									.substring(non_choice_index12 + "</w:p>".length());
+							String non_choice_xtTmpStr = non_choice_quTmpStr.substring(non_choice_index8,
+									non_choice_index9 + "</w:p>".length());
+							String non_choice_str1 = General.toCNLowerNum(i + 1) + "、"
+									+ General.XMLEncode(qtyp.getName()) + ":本大题共" + qtyp.getQuestionSum() + "小题,"
+									+ ((qtyp.getQuestionSum() > 1) ? "每小题" : "") + General.formatScore(qtyp.getScore())
+									+ "分" + ((qtyp.getQuestionSum() > 1)
+											? ",共" + General.formatScore(qtyp.getQuestionScores()) + "分" : "")
+									+ "。";
+							String non_choice_qtypStr = non_choice_qtTmpHeadStr.replace("大题描述", non_choice_str1)
+									.replace("大题序号", General.toCNLowerNum(i + 1))
+									.replace("大题名称", General.XMLEncode(qtyp.getName()))
+									.replace("小题数", "" + qtyp.getQuestionSum())
+									.replace("小题分", "" + General.formatScore(qtyp.getScore()))
+									.replace("小题总分", "" + General.formatScore(qtyp.getQuestionScores()))
+									.replace("题型说明", General.convertNullToEmpty(qtyp.getQuestionType().getRemark()));
+							IOUtils.write(non_choice_qtypStr, fos, "UTF-8");
+							for (int j = 0; j < qtyp.getConstructDetails().size(); j++) {
+								PagerConstructDetail d = qtyp.getConstructDetails().get(j);
+								quNo++;
+								Question qu = d.getQuestion();
+								if (qu == null) {
+									qu = new Question();
+									qu.setBodySummary("空题");
+								}
+								log.info("正在处理试题:id = " + qu.getId());
+								String xtStr = null;
+								if ((qu.getBodyWord() == null || qu.getBodyWord().length == 0)
+										&& General.isEmpty(qu.getBody())) {
+									xtStr = non_choice_xtTmpStr.replace("小题序号", "" + toQuesNumStr(quNo)).replace("题干",
+											General.XMLEncode(qu.getBodySummary()).trim());
+								} else {
+									try {
+										byte[] wordBytes = null;
+										if ((qu.getBodyWord() == null || qu.getBodyWord().length == 0)
+												&& !General.isEmpty(qu.getBody())) {
+											wordBytes = General.htmlToDocx(qu.getBody());
+										} else {
+											wordBytes = qu.getBodyWord();
+										}
+										xtStr = General.dealWord(wordBytes, templetDocxReader, needToUpdate);
+
+										int firstWtBeginIndex = xtStr.indexOf("<w:t>");
+										int firstWtBeginIndex2 = xtStr.indexOf("<w:t ");
+										firstWtBeginIndex = (firstWtBeginIndex < 0
+												|| (firstWtBeginIndex2 >= 0 && firstWtBeginIndex > firstWtBeginIndex2))
+														? firstWtBeginIndex2 : firstWtBeginIndex;
+
+										int nearestGtIndex = xtStr.indexOf('>', firstWtBeginIndex + 1);
+
+										String part1 = xtStr.substring(0, nearestGtIndex + 1).trim();
+										String part2 = xtStr.substring(nearestGtIndex + 1).trim();
+										xtStr = part1 + toQuesNumStr(quNo) + "." + part2;
+									} catch (Exception e) {
+										log.warn("获取试题[" + qu.getId() + "]的Word信息失败,原因:" + e.getMessage(), e);
+										xtStr = Consts.ERR_P_TMP.replace("XX",
+												quNo + "." + String.format(Consts.ERR_QUS_MSG, qu.getId() + ""));
+									}
+								}
+								IOUtils.write(addBeforeLines(xtStr, 0, 0, 0), fos, "UTF-8");
+								IOUtils.write(non_choice_qtTmpTailStr, fos, "UTF-8");
+							}
+						}
+					}
+					IOUtils.write(tail, fos, "UTF-8");
+				} finally {
+					General.close(is);
+					General.close(fosNew);
+					General.close(fos);
+				}
+			}
+
+			{
+				File document = templetDocxReader.getDocumentInfo().getFile();
+				FileOutputStream fos = null;
+				InputStream is = null;
+				try {
+					is = new FileInputStream(document);
+					String docStr = IOUtils.toString(is, "UTF-8")
+							.replace("<pic:pic>",
+									"<pic:pic xmlns:pic=\"http://schemas.openxmlformats.org/drawingml/2006/picture\">")
+							.replace("<w15:collapsed w:val=\"false\"/>", "");
+					fos = new FileOutputStream(document, false);
+					IOUtils.write(docStr, fos, "UTF-8");
+				} finally {
+					General.close(is);
+					General.close(fos);
+				}
+			}
+
+			{
+				DocxReader.updateDocx(newDocx, needToUpdate);
+			}
+		} catch (Exception e) {
+			log.error("生成试卷[" + paper.getId() + "]的Word文档失败,原因:" + e.getMessage(), e);
+			throw new BizException(e.getMessage(), e);
+		} finally {
+			General.release(templetDocxReader);
+		}
+		if (ParamUtils.NeedCheckWordVersion) {
+			General.setDocxDefinedAttr(newDocx, Consts.DOCX_VERSION, "QMTH" + System.currentTimeMillis());// 往新生成的Word里面打个版本号:当前时间
+		}
+		return newDocx;
+	}
+    
+    /**
+     * <p>网评卷导出</p>
+     * <p>新模板</p>
+     * @author songyue
+     * @date 2016-06-24
+     */
+	public File generalWangPingPaperFile(PagerConstruct paper) throws BizException {
+		File newDocx = null;
+		DocxReader templetDocxReader = null;
+		Map<String, ResourceInfo> needToUpdate = new HashMap<String, ResourceInfo>();
+		try {
+			{// 拷贝一份模板文件到临时文件夹里面
+				FileOutputStream fos = null;
+				InputStream is = null;
+				try {
+					newDocx = new File(ParamUtils.TemporaryDirPath, UUID.randomUUID().toString().replace("-", ""));
+					fos = new FileOutputStream(newDocx);
+					is = ZujuanService.class.getResourceAsStream("/paperTmps/wangpingPagerTmp2.docx");
+					IOUtils.copyLarge(is, fos);
+					fos.flush();
+				} finally {
+					General.close(is);
+					General.close(fos);
+				}
+			}
+
+			templetDocxReader = new DocxReader(newDocx);
+			templetDocxReader.doRead();
+			{
+				List<ResourceInfo> headersAndFooters = new ArrayList<ResourceInfo>();
+				headersAndFooters.addAll(templetDocxReader.getHeaders());
+				headersAndFooters.addAll(templetDocxReader.getFooters());
+				for (ResourceInfo info : headersAndFooters) {
+					FileOutputStream fos = null;
+					InputStream is = null;
+					try {
+						is = new FileInputStream(info.getFile());
+						String docStr = IOUtils.toString(is, "UTF-8").replace("课程名称",
+								General.XMLEncode(paper.getSkeleton().getCourse().getName()));
+						fos = new FileOutputStream(info.getFile(), false);
+						IOUtils.write(docStr, fos, "UTF-8");
+					} finally {
+						General.close(is);
+						General.close(fos);
+					}
+					needToUpdate.put(info.getPathInZip(), info);
+				}
+			}
+			{
+				needToUpdate.put(templetDocxReader.getDocumentInfo().getPathInZip(),
+						templetDocxReader.getDocumentInfo());
+				File document = templetDocxReader.getDocumentInfo().getFile();
+				FileOutputStream fos = null;
+				InputStream is = null;
+				try {
+					is = new FileInputStream(document);
+					String docStr = IOUtils.toString(is, "UTF-8")
+							.replace("课程名称", General.XMLEncode(paper.getSkeleton().getCourse().getName()))
+							.replace("课程代码一", General.XMLEncode(paper.getSkeleton().getCourse().getCode()))
+							.replace("非选择题总分", General.formatScore(getQuestionScore(paper, "nonchoice")))
+							.replace("选择题总分", General.formatScore(getQuestionScore(paper, "choice")));
+
+					String xmlns_w15 = "xmlns:w15=\"http://schemas.microsoft.com/office/word/2012/wordml\"";
+					if (!docStr.contains(xmlns_w15)) {
+						docStr = docStr.replace("<w:document ", "<w:document " + xmlns_w15 + " ");
+					}
+					String xmlns_w14 = "xmlns:w14=\"http://schemas.microsoft.com/office/word/2010/wordml\"";
+					if (!docStr.contains(xmlns_w14)) {
+						docStr = docStr.replace("<w:document ", "<w:document " + xmlns_w14 + " ");
+					}
+					String xmlns_a = "xmlns:a=\"http://schemas.openxmlformats.org/drawingml/2006/main\"";
+					if (!docStr.contains(xmlns_a)) {
+						docStr = docStr.replace("<w:document ", "<w:document " + xmlns_a + " ");
+					}
+					fos = new FileOutputStream(document, false);
+					IOUtils.write(docStr, fos, "UTF-8");
+				} finally {
+					General.close(is);
+					General.close(fos);
+				}
+			}
+			{
+				File document = templetDocxReader.getDocumentInfo().getFile();
+				FileOutputStream fosNew = null;
+				FileOutputStream fos = null;
+				InputStream is = null;
+				try {
+					is = new FileInputStream(document);
+					String docStr = IOUtils.toString(is, "UTF-8");
+					int index1 = docStr.indexOf("选择题开始");// "选择题开始"的位置
+					int index2 = docStr.substring(0, index1).lastIndexOf("<w:p ");// "选择题开始"对应的<w:p>标签的开始位置
+
+					int index4 = docStr.indexOf("非选择题结束");// "非选择题结束"的位置
+					int index6 = index4 + docStr.substring(index4).indexOf("</w:p>");// "非选择题结束"对应的<w:p>标签的结束位置
+
+					String head = docStr.substring(0, index2);// 选择题开始"前面的部分
+					String tail = docStr.substring(index6 + "</w:p>".length());// "非选择题结束"后面的部分
+
+					fosNew = new FileOutputStream(document, false);
+					IOUtils.write(head, fosNew, "UTF-8");
+					General.close(fosNew);
+
+					fos = new FileOutputStream(document, true);
+
+					int quNo = 0;
+					int choice_index1 = docStr.indexOf("选择题开始");// "选择题开始"的位置
+					int choice_index3 = choice_index1 + docStr.substring(choice_index1).indexOf("</w:p>");// "选择题开始"对应的<w:p>标签的结束位置
+					int choice_index4 = docStr.indexOf("选择题结束");// "选择题结束"的位置
+					int choice_index5 = docStr.substring(0, choice_index4).lastIndexOf("<w:p ");// "选择题结束"对应的<w:p>标签的开始位置
+					int choice_index6 = choice_index4 + docStr.substring(choice_index4).indexOf("</w:p>")
+							+ "</w:p>".length();// "选择题结束"的</w:p>位置
+					String choice_quTmpStr = docStr.substring(choice_index3 + "</w:p>".length(), choice_index5);// 选择题目模板
+					int choice_index7 = choice_quTmpStr.indexOf("小题序号");
+					int choice_index8 = choice_quTmpStr.substring(0, choice_index7).lastIndexOf("<w:p ");// 小题对应的<w:p>标签的开始位置
+					int choice_index9 = choice_index7 + choice_quTmpStr.substring(choice_index7).indexOf("</w:p>");// 小题对应的<w:p>标签的结束位置
+
+					int choice_index10 = choice_quTmpStr.indexOf("答题项");
+					int choice_index12 = choice_index10 + choice_quTmpStr.substring(choice_index10).indexOf("</w:p>");// 答题项对应的<w:p>标签的结束位置
+					String choice_qtTmpHeadStr = choice_quTmpStr.substring(0, choice_index8);
+					String choice_qtTmpTailStr = choice_quTmpStr.substring(choice_index12 + "</w:p>".length());
+					String choice_xtTmpStr = choice_quTmpStr.substring(choice_index8,
+							choice_index9 + "</w:p>".length());
+					// 选择题
+					int qtypIndex = 0;
+					for (int index = 0; index < paper.getQtypeList().size(); index++) {
+						PagerConstructQtype qtyp = paper.getQtypeList().get(index);
+
+						if (qtyp.getName().contains("选择题")) {
+							String choice_str1 = General.toCNLowerNum(qtypIndex + 1) + "、" + General.XMLEncode(qtyp.getName())
+									+ ":本大题共" + qtyp.getQuestionSum() + "小题,"
+									+ ((qtyp.getQuestionSum() > 1) ? "每小题" : "") + General.formatScore(qtyp.getScore())
+									+ "分" + ((qtyp.getQuestionSum() > 1)
+											? ",共" + General.formatScore(qtyp.getQuestionScores()) + "分" : "")
+									+ "。";
+							if(qtyp.getName().equals("单项选择题")){
+								choice_str1 = choice_str1 + "在每小题列出的备选项中只有一项是最符合题目要求的,请将其选出。";
+							}else if(qtyp.getName().equals("多项选择题")){
+								choice_str1 = choice_str1 + "在每小题列出的备选项中至少有两项是符合题目要求的,请将其选出,错选、多选或少选均无分。";
+							}
+							String choice_qtypStr = choice_qtTmpHeadStr.replace("大题描述", choice_str1);
+							IOUtils.write(choice_qtypStr, fos, "UTF-8");
+							for (int j = 0; j < qtyp.getConstructDetails().size(); j++) {
+								PagerConstructDetail d = qtyp.getConstructDetails().get(j);
+								quNo++;
+								Question qu = d.getQuestion();
+								if (qu == null) {
+									qu = new Question();
+									qu.setBodySummary("空题");
+								}
+								log.info("正在处理试题:id = " + qu.getId());
+								String xtStr = null;
+								if ((qu.getBodyWord() == null || qu.getBodyWord().length == 0)
+										&& General.isEmpty(qu.getBody())) {
+									xtStr = choice_xtTmpStr.replace("小题序号", "" + toQuesNumStr(quNo)).replace("题干",
+											General.XMLEncode(qu.getBodySummary()).trim());
+								} else {
+									try {
+										byte[] wordBytes = null;
+										if ((qu.getBodyWord() == null || qu.getBodyWord().length == 0)
+												&& !General.isEmpty(qu.getBody())) {
+											wordBytes = General.htmlToDocx(qu.getBody());
+										} else {
+											wordBytes = qu.getBodyWord();
+										}
+										xtStr = General.dealWord(wordBytes, templetDocxReader, needToUpdate);
+
+										int firstWtBeginIndex = xtStr.indexOf("<w:t>");
+										int firstWtBeginIndex2 = xtStr.indexOf("<w:t ");
+										firstWtBeginIndex = (firstWtBeginIndex < 0
+												|| (firstWtBeginIndex2 >= 0 && firstWtBeginIndex > firstWtBeginIndex2))
+														? firstWtBeginIndex2 : firstWtBeginIndex;
+
+										int nearestGtIndex = xtStr.indexOf('>', firstWtBeginIndex + 1);
+
+										String part1 = xtStr.substring(0, nearestGtIndex + 1).trim();
+										String part2 = xtStr.substring(nearestGtIndex + 1).trim();
+										xtStr = part1 + toQuesNumStr(quNo) + "." + part2;
+									} catch (Exception e) {
+										log.warn("获取试题[" + qu.getId() + "]的Word信息失败,原因:" + e.getMessage(), e);
+										xtStr = Consts.ERR_P_TMP.replace("XX",
+												quNo + "." + String.format(Consts.ERR_QUS_MSG, qu.getId() + ""));
+									}
+								}
+								int firstWtBeginIndex1 = xtStr.indexOf("<w:t>");
+								int firstWtBeginIndex2 = xtStr.indexOf("<w:t ");
+//								int firstWtEndIndex1 = xtStr.indexOf("</w:t>");
+								firstWtBeginIndex1 = (firstWtBeginIndex1 < 0
+										|| (firstWtBeginIndex2 >= 0 && firstWtBeginIndex1 > firstWtBeginIndex2))
+												? firstWtBeginIndex2 : firstWtBeginIndex1;
+//								int nearestGtIndex = xtStr.indexOf('>', firstWtBeginIndex1 + 1);
+								//int wtLen = xtStr.substring(nearestGtIndex, firstWtEndIndex1).length();
+								//int wt_real_len = getQuestionBodyLength(xtStr.substring(nearestGtIndex, firstWtEndIndex1));
+								int optSize = (qu.getOptions() != null) ? qu.getOptions().size() : 0;
+								if (optSize > 0) {
+	                            	String option_temp = null;
+									if (optSize <= 4) {
+										xtStr = xtStr.replaceAll("<w:pPr>", "<w:pPr>");
+										option_temp = "</w:p>";
+										String before_str = StringUtils.substringBeforeLast(xtStr, "</w:p>");
+										String after_str = StringUtils.substringAfterLast(xtStr, "</w:p>"); 
+										xtStr = before_str + option_temp + after_str;
+									} else {
+										xtStr = xtStr.replaceAll("<w:pPr>", "<w:pPr>");
+//										option_temp = "<w:r><w:tab/></w:r><w:r><w:t>【        】</w:t></w:r></w:p>";
+										option_temp = "</w:p>";
+										String before_str = StringUtils.substringBeforeLast(xtStr, "</w:p>");
+										String after_str = StringUtils.substringAfterLast(xtStr, "</w:p>"); 
+										xtStr = before_str + option_temp + after_str;
+									}
+								}
+								//xtStr = dealFormula(xtStr);
+								IOUtils.write(addBeforeLines(xtStr, 0, 0, 0), fos, "UTF-8");
+								if (optSize > 0) {
+									String optsStr = "";
+									for (int m = 0; m < optSize; m++) {
+										QuestionOption opt = qu.getOptions().get(m);
+										String seqNum = String.valueOf(((char) ('A' + m)));
+										String prefixStr = "	" + seqNum + ".";
+										String anStr = null;
+										log.info("正在处理答题项:id = " + opt.getId());
+										if ((opt.getContentWord() == null || opt.getContentWord().length == 0)
+												&& General.isEmpty(opt.getContent())) {
+											String optTxt = General.XMLEncode(opt.getSummary()).trim();
+											anStr = Consts.NORMAL_P_TMP.replace("XX", prefixStr + optTxt);
+										} else {
+											try {
+												byte[] wordBytes = null;
+												if ((opt.getContentWord() == null || opt.getContentWord().length == 0)
+														&& !General.isEmpty(opt.getContent())) {
+													wordBytes = General.htmlToDocx(opt.getContent());
+												} else {
+													wordBytes = opt.getContentWord();
+												}
+												anStr = General.dealWord(wordBytes, templetDocxReader, needToUpdate);
+												int firstWtBeginIndex = -1;
+												if (firstWtBeginIndex < 0) {
+													int firstWpBeginIndex = anStr.indexOf(">");// 默认第一个节点是<w:p
+																								// ...>,不支持答题项第一个元素是表格
+													String part1 = anStr.substring(0, firstWpBeginIndex + ">".length())
+															.trim();
+													String part2 = anStr.substring(firstWpBeginIndex + ">".length())
+															.replace("\"center\"", "\"left\"")
+															.replace("\"right\"", "\"left\"").trim();
+													anStr = part1 + part2;
+													/*****
+													 * 往anStr里面添加
+													 * <w:jc w:val="left"/>
+													 *****/
+													{
+														if (!anStr.contains("<w:jc w:val=\"left\"/>")) {
+															int pPrIndex = anStr.indexOf("<w:pPr>");
+															if (pPrIndex < 0) {
+																anStr = part1 + "<w:pPr><w:jc w:val=\"left\"/></w:pPr>" + part2;
+															} else {
+																anStr = anStr.substring(0,
+																		pPrIndex + "<w:pPr>".length())
+																		+ "<w:jc w:val=\"left\"/>" + anStr.substring(
+																				pPrIndex + "<w:pPr>".length());
+															}
+														}
+													}
+													anStr = anStr.replaceAll("</w:pPr>", "</w:pPr><w:r><w:t>" + prefixStr + "</w:t></w:r>");
+												}
+											} catch (Exception e) {
+												log.warn("获取试题选项[" + opt.getId() + "]的Word信息失败,原因:" + e.getMessage(),
+														e);
+												anStr = Consts.ERR_P_TMP.replace("XX", prefixStr
+														+ String.format(Consts.ERR_QUS_OPT_MSG, qu.getId() + ""));
+											}
+										}
+										//anStr = dealFormula(anStr);
+										optsStr = optsStr + addBeforeLines(anStr, 0, 0, 0);
+									}
+									optsStr = compressOption(optsStr, optSize);
+									IOUtils.write(optsStr, fos, "UTF-8");
+								}
+								IOUtils.write(choice_qtTmpTailStr, fos, "UTF-8");
+							}
+							qtypIndex++;
+						}
+					}
+					// 非选择题
+					int non_choice_index1 = docStr.indexOf("非选择题开始");// "非选择题开始"的位置
+					int non_choice_index2 = docStr.substring(0, non_choice_index1).lastIndexOf("<w:p ");// "非选择题开始"<w:p>的位置
+					String non_choice_head = docStr.substring(choice_index6, non_choice_index2);// 第二部分
+					IOUtils.write(non_choice_head, fos, "UTF-8");
+					for (int index = 0; index < paper.getQtypeList().size(); index++) {
+						PagerConstructQtype qtyp = paper.getQtypeList().get(index);
+						if (!qtyp.getName().contains("选择题")) {
+
+							int non_choice_index3 = non_choice_index1
+									+ docStr.substring(non_choice_index1).indexOf("</w:p>");// "非选择题开始"对应的<w:p>标签的结束位置
+
+							int non_choice_index4 = docStr.indexOf("非选择题结束");// "非选择题结束"的位置
+							int non_choice_index5 = docStr.substring(0, non_choice_index4).lastIndexOf("<w:p ");// "非选择题结束"对应的<w:p>标签的开始位置
+
+							String non_choice_quTmpStr = docStr.substring(non_choice_index3 + "</w:p>".length(),
+									non_choice_index5);// 非选择题目模板
+
+							int non_choice_index7 = non_choice_quTmpStr.indexOf("小题序号");
+							int non_choice_index8 = non_choice_quTmpStr.substring(0, non_choice_index7)
+									.lastIndexOf("<w:p ");// 小题对应的<w:p>标签的开始位置
+							int non_choice_index9 = non_choice_index7
+									+ non_choice_quTmpStr.substring(non_choice_index7).indexOf("</w:p>");// 小题对应的<w:p>标签的结束位置
+
+							int non_choice_index10 = non_choice_quTmpStr.indexOf("答题项");
+							int non_choice_index12 = non_choice_index10
+									+ non_choice_quTmpStr.substring(non_choice_index10).indexOf("</w:p>");// 答题项对应的<w:p>标签的结束位置
+							String non_choice_qtTmpHeadStr = non_choice_quTmpStr.substring(0, non_choice_index8);
+							String non_choice_qtTmpTailStr = non_choice_quTmpStr
+									.substring(non_choice_index12 + "</w:p>".length());
+							String non_choice_xtTmpStr = non_choice_quTmpStr.substring(non_choice_index8,
+									non_choice_index9 + "</w:p>".length());
+							String non_choice_str1 = General.toCNLowerNum(qtypIndex + 1) + "、"
+									+ General.XMLEncode(qtyp.getName()) + ":本大题共" + qtyp.getQuestionSum() + "小题,"
+									+ ((qtyp.getQuestionSum() > 1) ? "每小题" : "") + General.formatScore(qtyp.getScore())
+									+ "分" + ((qtyp.getQuestionSum() > 1)
+											? ",共" + General.formatScore(qtyp.getQuestionScores()) + "分" : "")
+									+ "。";
+                            if(qtyp.getQuestionType().getRemark()!=null){
+                                non_choice_str1+=" "+qtyp.getQuestionType().getRemark();
+                            }
+							String non_choice_qtypStr = non_choice_qtTmpHeadStr.replace("大题描述", non_choice_str1);
+//                            if(qtyp.getQuestionType().getRemark()!=null){
+//                                non_choice_qtypStr+= "<w:p w:rsidR=\"00EA7945\" w:rsidRPr=\"008F10F9\" w:rsidRDefault=\"00EA7945\" w:rsidP=\"003217C2\"><w:pPr><w:adjustRightInd w:val=\"0\"/><w:snapToGrid w:val=\"0\"/><w:spacing w:line=\"260\" w:lineRule=\"exact\"/><w:ind w:left=\"420\" w:hangingChars=\"200\" w:hanging=\"420\"/><w:rPr><w:rFonts w:eastAsia=\"黑体\"/><w:color w:val=\"000000\"/><w:szCs w:val=\"21\"/></w:rPr></w:pPr><w:r w:rsidRPr=\"007253D9\"><w:rPr><w:rFonts w:eastAsia=\"黑体\" w:hint=\"eastAsia\"/><w:color w:val=\"000000\"/><w:szCs w:val=\"21\"/></w:rPr><w:t>"+qtyp.getQuestionType().getRemark()+"</w:t></w:r></w:p>";
+//                            }
+							IOUtils.write(non_choice_qtypStr, fos, "UTF-8");
+							for (int j = 0; j < qtyp.getConstructDetails().size(); j++) {
+								PagerConstructDetail d = qtyp.getConstructDetails().get(j);
+								quNo++;
+								Question qu = d.getQuestion();
+								if (qu == null) {
+									qu = new Question();
+									qu.setBodySummary("空题");
+								}
+								log.info("正在处理试题:id = " + qu.getId());
+								String xtStr = null;
+								if ((qu.getBodyWord() == null || qu.getBodyWord().length == 0)
+										&& General.isEmpty(qu.getBody())) {
+									xtStr = non_choice_xtTmpStr.replace("小题序号", "" + toQuesNumStr(quNo)).replace("题干",
+											General.XMLEncode(qu.getBodySummary()).trim());
+								} else {
+									try {
+										byte[] wordBytes = null;
+										if ((qu.getBodyWord() == null || qu.getBodyWord().length == 0)
+												&& !General.isEmpty(qu.getBody())) {
+											wordBytes = General.htmlToDocx(qu.getBody());
+										} else {
+											wordBytes = qu.getBodyWord();
+										}
+										xtStr = General.dealWord(wordBytes, templetDocxReader, needToUpdate);
+
+										int firstWtBeginIndex = xtStr.indexOf("<w:t>");
+										int firstWtBeginIndex2 = xtStr.indexOf("<w:t ");
+										firstWtBeginIndex = (firstWtBeginIndex < 0
+												|| (firstWtBeginIndex2 >= 0 && firstWtBeginIndex > firstWtBeginIndex2))
+														? firstWtBeginIndex2 : firstWtBeginIndex;
+
+										int nearestGtIndex = xtStr.indexOf('>', firstWtBeginIndex + 1);
+
+										String part1 = xtStr.substring(0, nearestGtIndex + 1).trim();
+										String part2 = xtStr.substring(nearestGtIndex + 1).trim();
+										xtStr = part1 + toQuesNumStr(quNo) + "." + part2;
+									} catch (Exception e) {
+										log.warn("获取试题[" + qu.getId() + "]的Word信息失败,原因:" + e.getMessage(), e);
+										xtStr = Consts.ERR_P_TMP.replace("XX",
+												quNo + "." + String.format(Consts.ERR_QUS_MSG, qu.getId() + ""));
+									}
+								}
+								IOUtils.write(addBeforeLines(xtStr, 0, 0, 0), fos, "UTF-8");
+								IOUtils.write(non_choice_qtTmpTailStr, fos, "UTF-8");
+							}
+							qtypIndex++;
+						}
+					}
+					IOUtils.write(tail, fos, "UTF-8");
+				} finally {
+					General.close(is);
+					General.close(fosNew);
+					General.close(fos);
+				}
+			}
+
+			{
+				File document = templetDocxReader.getDocumentInfo().getFile();
+				FileOutputStream fos = null;
+				InputStream is = null;
+				try {
+					is = new FileInputStream(document);
+					String docStr = IOUtils.toString(is, "UTF-8")
+							.replace("<pic:pic>",
+									"<pic:pic xmlns:pic=\"http://schemas.openxmlformats.org/drawingml/2006/picture\">")
+							.replace("<w15:collapsed w:val=\"false\"/>", "");
+					is.close();
+					fos = new FileOutputStream(document, false);
+					IOUtils.write(docStr, fos, "UTF-8");
+					fos.flush();
+					fos.close();
+					
+					{
+						SAXReader sax = new SAXReader();
+						is = new FileInputStream(document);
+				        Document documentNode = sax.read(is);
+				        Element root = documentNode.getRootElement();
+			        	List allParaIdNodes = (List) root.selectNodes("//@w14:paraId | //@w14:textId");//删掉无用的属性
+			        	for(Object pObj:allParaIdNodes){
+			        		if(pObj instanceof Attribute){
+			        			Attribute paraId = (Attribute)pObj;
+			        			paraId.getParent().remove(paraId);
+			        		}
+			        	}
+			        	String xtStr = documentNode.asXML();
+			        	is.close();
+						fos = new FileOutputStream(document, false);
+						IOUtils.write(xtStr, fos, "UTF-8");
+						fos.flush();
+						fos.close();
+					}
+				} finally {
+					General.close(is);
+					General.close(fos);
+				}
+			}
+
+			{
+				DocxReader.updateDocx(newDocx, needToUpdate);
+			}
+		} catch (Exception e) {
+			log.error("生成试卷[" + paper.getId() + "]的Word文档失败,原因:" + e.getMessage(), e);
+			throw new BizException(e.getMessage(), e);
+		} finally {
+			General.release(templetDocxReader);
+		}
+		if (ParamUtils.NeedCheckWordVersion) {
+			General.setDocxDefinedAttr(newDocx, Consts.DOCX_VERSION, "QMTH" + System.currentTimeMillis());// 往新生成的Word里面打个版本号:当前时间
+		}
+		return newDocx;
+	}
+
+    /**
+     * 给某段文字添加左侧多少个字符,前、后多少行距。
+     * @param xtStr
+     * @param leftChars leftChars/100=左侧字符数
+     * @param beforeLinesInt beforeLinesInt/100=段前行数
+     * @param afterLinesInt afterLinesInt/100=段后行数
+     * @return
+     * @throws UnsupportedEncodingException
+     * @throws DocumentException
+     */
+    @SuppressWarnings("rawtypes")
+	private static String addBeforeLines(String xtStr,int leftChars,int beforeLinesInt,int afterLinesInt) throws UnsupportedEncodingException, DocumentException {
+        xtStr = Consts.PAPERTMPBODY_START + xtStr + Consts.PAPERTMPBODY_END;
+        SAXReader sax = new SAXReader();
+        ByteArrayInputStream is = new ByteArrayInputStream(xtStr.getBytes("UTF-8"));
+        Document document = sax.read(is);
+        Element root = document.getRootElement();
+        {// 设置段前,0.5行
+            Element firstP = root.element("p");
+            Element pPr = firstP.element("pPr");
+            if (pPr == null) {
+                List children = firstP.elements();
+                pPr = DocumentHelper.createElement("w:pPr");
+                children.add(0, pPr);
+                firstP.setContent(children);
+            }
+            {//处理spacing
+	            Element spacing = pPr.element("spacing");
+	            if (spacing == null) {
+	                spacing = pPr.addElement("w:spacing");
+	            }
+	            Attribute before = spacing.attribute("before");
+	            if (before == null) {
+	                spacing.addAttribute("w:before", "0");
+	            } else {
+	                before.setValue("0");
+	            }
+	            Attribute beforeLines = spacing.attribute("beforeLines");
+	            if (beforeLines == null) {
+	                spacing.addAttribute("w:beforeLines", "" + beforeLinesInt);
+	            } else {
+	                beforeLines.setValue("" + beforeLinesInt);
+	            }
+            }
+            {//一定居左对齐
+            	Element jc = pPr.element("jc");
+            	if(jc != null){
+            		pPr.remove(jc);
+            	}
+            	jc = pPr.addElement("w:jc");
+            	jc.addAttribute("w:val", "left");
+            }
+            {//处理左边距
+            	Element ind = pPr.element("ind");
+            	if(ind != null){
+            		pPr.remove(ind);
+            	}
+            	ind = pPr.addElement("w:ind");
+            	ind.addAttribute("w:leftChars", leftChars + "");
+            }
+            {
+            	Element firstWt = (Element) firstP.selectSingleNode("*/w:t");
+            	if(firstWt != null){
+	            	Attribute spaceAttr = firstWt.attribute("space");
+	            	if(spaceAttr == null){
+	            		firstWt.addAttribute("xml:space", "preserve");
+	            	}else{
+	            		spaceAttr.setValue("preserve");
+	            	}
+            	}
+            }
+        }
+        {// 设置段后,0.1行
+            List pList = root.elements("p");
+            Element lastP = (Element) pList.get(pList.size() - 1);
+            Element pPr = lastP.element("pPr");
+            if (pPr == null) {
+                List children = lastP.elements();
+                pPr = DocumentHelper.createElement("w:pPr");
+                children.add(0, pPr);
+                lastP.setContent(children);
+            }
+            Element adjustRightInd = pPr.element("adjustRightInd");
+            if (adjustRightInd == null) {
+            	adjustRightInd = pPr.addElement("w:adjustRightInd");
+            }
+            {
+            	Attribute val = adjustRightInd.attribute("val");
+                if (val == null) {
+                	adjustRightInd.addAttribute("w:val", "0");
+                } else {
+                	val.setValue("0");
+                }
+            }
+            Element snapToGrid = pPr.element("snapToGrid");
+            if (snapToGrid == null) {
+            	snapToGrid = pPr.addElement("w:snapToGrid");
+            }
+            {
+            	Attribute val = snapToGrid.attribute("val");
+                if (val == null) {
+                	snapToGrid.addAttribute("w:val", "0");
+                } else {
+                	val.setValue("0");
+                }
+            }
+            Element spacing = pPr.element("spacing");
+            if (spacing == null) {
+                spacing = pPr.addElement("w:spacing");
+            }
+            Attribute before = spacing.attribute("after");
+            if (before == null) {
+                spacing.addAttribute("w:after", "0");
+            } else {
+                before.setValue("0");
+            }
+            Attribute afterLines = spacing.attribute("afterLines");
+            if (afterLines == null) {
+                spacing.addAttribute("w:afterLines", "" + afterLinesInt);
+            } else {
+            	afterLines.setValue("" + afterLinesInt);
+            }
+            Attribute line = spacing.attribute("line");
+            if (line == null) {
+                spacing.addAttribute("w:line", "280");
+            } else {
+            	line.setValue("280");
+            }
+        }
+        {
+        	List allWrNodes = (List) root.selectNodes("*/w:r");
+        	for(Object wrObj:allWrNodes){
+        		if(wrObj instanceof Element){
+        			Element wr = (Element)wrObj;
+        			Element rPr = wr.element("rPr");
+        			if (rPr == null) {
+                        List children = wr.elements();
+                        rPr = DocumentHelper.createElement("w:rPr");
+                        children.add(0, rPr);
+                        wr.setContent(children);
+                    }
+        			{
+	        			Element szCs  = rPr.element("szCs");
+	        			if(szCs == null){
+	        				List children = rPr.elements();
+	        				szCs = DocumentHelper.createElement("w:szCs");
+	                        children.add(szCs);
+	                        rPr.setContent(children);
+	        			}
+	        			Attribute val = szCs.attribute("val");
+	                    if (val == null) {
+	                    	szCs.addAttribute("w:val", "21");
+	                    } else {
+	                    	val.setValue("21");
+	                    }
+        			}
+        			{
+	        			Element szCs  = rPr.element("sz");
+	        			if(szCs == null){
+	        				List children = rPr.elements();
+	        				szCs = DocumentHelper.createElement("w:sz");
+	                        children.add(szCs);
+	                        rPr.setContent(children);
+	        			}
+	        			Attribute val = szCs.attribute("val");
+	                    if (val == null) {
+	                    	szCs.addAttribute("w:val", "21");
+	                    } else {
+	                    	val.setValue("21");
+	                    }
+        			}
+        		}
+        	}
+        }
+        xtStr = document.asXML();
+        xtStr = xtStr.substring(xtStr.indexOf(Consts.PAPERTMPBODY_START) + Consts.PAPERTMPBODY_START.length(),
+                xtStr.length() - Consts.PAPERTMPBODY_END.length());
+        return xtStr;
+    }
+    
+    /**
+     * 压缩试题选项
+     * @param xtStr 选项内容
+     * @param optSize 选项个数
+     * @author songyue
+     **/
+	@SuppressWarnings("unchecked")
+	private static String compressOption(String xtStr,int optSize) throws UnsupportedEncodingException, DocumentException {
+        String xtStr_temp = xtStr;
+		xtStr = Consts.PAPERTMPBODY_START + xtStr + Consts.PAPERTMPBODY_END;
+        SAXReader sax = new SAXReader();
+        ByteArrayInputStream is = new ByteArrayInputStream(xtStr.getBytes("UTF-8"));
+        Document document = sax.read(is);
+        Element root = document.getRootElement();
+        List pList = root.elements("p");
+        //获取所有选项元素
+        
+        Element pA = (Element)pList.get(0);
+        Element pPrA = pA.element("pPr");
+        List pArList = pA.elements("r");
+        Element pAr = null;
+        if(pArList.size() > 1){
+        	pAr = (Element)pArList.get(1);
+        }else{
+        	return xtStr_temp;
+        }
+        if(pAr.element("t")==null){
+        	return xtStr_temp;
+        }
+        int pA_len = pAr.element("t").getTextTrim().length();
+        int pA_real_len = getQuestionBodyLength(pAr.element("t").getTextTrim());
+        List pA_children = pA.elements();
+        
+        Element pB = (Element)pList.get(1);
+        Element pPrB = pA.element("pPr");
+        List pBrList = pB.elements("r");
+        Element pBr = null;
+        if(pBrList.size() > 1){
+        	pBr = (Element)pBrList.get(1);
+        }else{
+        	return xtStr_temp;
+        }
+        if(pBr.element("t")==null){
+        	return xtStr_temp;
+        }
+        int pB_len = pBr.element("t").getTextTrim().length();
+        int pB_real_len = getQuestionBodyLength(pBr.element("t").getTextTrim());
+        List pB_children = pB.elements();
+        
+        Element pC = (Element)pList.get(2);
+        Element pPrC = pA.element("pPr");
+        List pCrList = pC.elements("r");
+        Element pCr = null;
+        if(pCrList.size() > 1){
+        	pCr = (Element)pCrList.get(1);
+        }else{
+        	return xtStr_temp;
+        }
+        if(pCr.element("t")==null){
+        	return xtStr_temp;
+        }
+        int pC_len = pCr.element("t").getTextTrim().length();
+        int pC_real_len = getQuestionBodyLength(pCr.element("t").getTextTrim());
+        List pC_children = pC.elements();
+        
+        Element pD = (Element)pList.get(3);
+        Element pPrD = pA.element("pPr");
+        List pDrList = pD.elements("r");
+        Element pDr = null;
+        if(pDrList.size() > 1){
+        	pDr = (Element)pDrList.get(1);
+        }else{
+        	return xtStr_temp;
+        }
+        if(pDr.element("t")==null){
+        	return xtStr_temp;
+        }
+        int pD_len = pDr.element("t").getTextTrim().length();
+        int pD_real_len = getQuestionBodyLength(pDr.element("t").getTextTrim());
+        List pD_children = pD.elements();
+        
+        int pE_real_len = 0;
+        int pE_len = 0;
+       
+       Element rtab = DocumentHelper.createElement("w:r");
+       Element rPr = DocumentHelper.createElement("w:rPr");
+       Element szCs = DocumentHelper.createElement("w:szCs");
+       Element sz = DocumentHelper.createElement("w:sz");
+       {
+	       Attribute val = szCs.attribute("val");
+	       if (val == null) {
+	    	   szCs.addAttribute("w:val", "21");
+	       } else {
+	       	val.setValue("21");
+	       }
+       }
+       {
+	       Attribute val = sz.attribute("val");
+	       if (val == null) {
+	    	   sz.addAttribute("w:val", "21");
+	       } else {
+	       	val.setValue("21");
+	       }
+       }
+       rPr.add(szCs);
+       rPr.add(sz);
+       rtab.add(rPr);
+       rtab.addElement("w:tab","http://schemas.openxmlformats.org/wordprocessingml/2006/main");
+       
+        //处理单选题
+        if(optSize == 4){
+        	//一行4项
+//        	if((pA_real_len + pB_real_len + pC_real_len + pD_real_len) <= 25 && pA_real_len <= 6 && pB_real_len <= 6 && pC_real_len <= 6 && pD_real_len <= 6){
+//        		//pA_children.add(1,(Element)rtab.clone());
+//        		pB_children.add(1,(Element)rtab.clone());
+//        		pC_children.add(1,(Element)rtab.clone());
+//        		pD_children.add(1,(Element)rtab.clone());
+//        		detachPr(pB_children);
+//        		detachPr(pC_children);
+//        		detachPr(pD_children);
+//        		detachAll(pA_children);
+//        		detachAll(pB_children);
+//        		detachAll(pC_children);
+//        		detachAll(pD_children);
+//        		pA_children.addAll(pB_children);
+//        		pA_children.addAll(pC_children);
+//        		pA_children.addAll(pD_children);
+//        		pA.setContent(pA_children);
+//        		pB.detach();
+//        		pC.detach();
+//        		pD.detach();
+//        	}
+        	//一行2项
+        	if((pA_real_len + pB_real_len) <= 30 && (pC_real_len + pD_real_len) <= 30 && pA_real_len <= 15 && pB_real_len <= 15 && pC_real_len <= 15 && pD_real_len <= 15){
+        		//pA_children.add(1,(Element)rtab.clone());
+        		pB_children.add(1,(Element)rtab.clone());
+        		//pC_children.add(1,(Element)rtab.clone());
+        		pD_children.add(1,(Element)rtab.clone());
+        		detachPr(pB_children);
+        		detachPr(pD_children);
+        		detachAll(pA_children);
+        		detachAll(pB_children);
+        		detachAll(pC_children);
+        		detachAll(pD_children);
+        		pA_children.addAll(pB_children);
+        		pC_children.addAll(pD_children);
+        		pA.setContent(pA_children);
+        		pC.setContent(pC_children);
+        		pB.detach();
+        		pD.detach();
+        	}
+        //处理多选题	
+        }else if(optSize == 5){
+        	Element pE = (Element)pList.get(4);
+        	Element pPrE = pE.element("pPr");
+        	List pErList = pE.elements("r");
+        	Element pEr = null;
+            if(pErList.size() > 1){
+            	pEr = (Element)pErList.get(1);
+            }else{
+            	return xtStr_temp;
+            }
+            if(pEr.element("t") == null){
+            	return xtStr_temp;
+            }
+            pE_len = pEr.element("t").getTextTrim().length();
+            pE_real_len = getQuestionBodyLength(pEr.element("t").getTextTrim());
+        	List pE_children = pE.elements();
+        	//一行5项
+//        	if((pA_real_len + pB_real_len + pC_real_len + pD_real_len + pE_real_len) <= 10){
+//        		detachAll(pA_children);
+//        		detachAll(pB_children);
+//        		detachAll(pC_children);
+//        		detachAll(pD_children);
+//        		detachAll(pE_children);
+//        		pA_children.addAll(pB_children);
+//        		pA_children.addAll(pC_children);
+//        		pA_children.addAll(pD_children);
+//        		pA_children.addAll(pE_children);
+//        		pA.setContent(pA_children);
+//        		pB.detach();
+//        		pC.detach();
+//        		pD.detach();
+//        		pE.detach();
+//        	}
+        	//一行2项
+        	if((pA_real_len + pB_real_len ) <= 30 && (pC_real_len + pD_real_len) <= 30 && pA_real_len <= 15 && pB_real_len <= 15 && pC_real_len <= 15 && pD_real_len <= 15 && pE_real_len <= 15){
+        		//pA_children.add(1,(Element)rtab.clone());
+        		pB_children.add(1,(Element)rtab.clone());
+        		//pC_children.add(1,(Element)rtab.clone());
+        		pD_children.add(1,(Element)rtab.clone());
+        		//pE_children.add(1,(Element)rtab.clone());
+        		detachPr(pB_children);
+        		detachPr(pD_children);
+        		detachAll(pA_children);
+        		detachAll(pB_children);
+        		detachAll(pC_children);
+        		detachAll(pD_children);
+        		//detachAll(pE_children);
+        		pA_children.addAll(pB_children);
+        		pC_children.addAll(pD_children);
+        		pA.setContent(pA_children);
+        		pC.setContent(pC_children);
+        		pB.detach();
+        		pD.detach();
+        	}
+//        	//一行2项
+//        	else if((pA_real_len + pB_real_len) <= 20 && (pC_real_len + pD_real_len) <= 20){
+//        		detachAll(pA_children);
+//        		detachAll(pB_children);
+//        		detachAll(pC_children);
+//        		detachAll(pD_children);
+//        		addTab(pA_children, pC_children, pA_len, pC_len, tab);
+//        		pA_children.addAll(pB_children);
+//        		pC_children.addAll(pD_children);
+//        		pA.setContent(pA_children);
+//        		pC.setContent(pC_children);
+//        		pB.detach();
+//        		pD.detach();
+//        	}
+        }
+        
+        xtStr = document.asXML();
+        xtStr = xtStr.substring(xtStr.indexOf(Consts.PAPERTMPBODY_START) + Consts.PAPERTMPBODY_START.length(),
+                xtStr.length() - Consts.PAPERTMPBODY_END.length());
+        //增加tabs定义
+        if(optSize == 4){
+        	//一行4项
+//        	if((pA_real_len + pB_real_len + pC_real_len + pD_real_len) <= 25 && pA_real_len <= 6 && pB_real_len <= 6 && pC_real_len <= 6 && pD_real_len <= 6){
+//				xtStr = xtStr.replaceAll("<w:pPr>", "<w:pPr><w:tabs>"+ "<w:tab w:val=\"left\" w:pos=\"420\"/>"
+//						+ "<w:tab w:val=\"left\" w:pos=\"2210\"/>" 
+//						//+ "<w:tab w:val=\"left\" w:pos=\"4410\"/>"+ "<w:tab w:val=\"left\" w:pos=\"6510\"/>"
+//						+"</w:tabs>");
+//        	}
+        	//一行2项
+        	if((pA_real_len + pB_real_len) <= 30 && (pC_real_len + pD_real_len) <= 30 && pA_real_len <= 15 && pB_real_len <= 15 && pC_real_len <= 15 && pD_real_len <= 15){
+        		xtStr = xtStr.replaceAll("<w:pPr>", "<w:pPr><w:tabs>" + "<w:tab w:val=\"left\" w:pos=\"420\"/>"
+						+"<w:tab w:val=\"left\" w:pos=\"4410\"/></w:tabs>");
+        	}
+        }else if(optSize == 5){
+        	//一行2项
+        	if((pA_real_len + pB_real_len) <= 30 && (pC_real_len + pD_real_len) <= 30 && pA_real_len <= 15 && pB_real_len <= 15 && pC_real_len <= 15 && pD_real_len <= 15 && pE_real_len <= 15){
+        		xtStr = xtStr.replaceAll("<w:pPr>", "<w:pPr><w:tabs>"+ "<w:tab w:val=\"left\" w:pos=\"420\"/>"+"<w:tab w:val=\"left\" w:pos=\"4410\"/>" + "</w:tabs>");
+        	}
+        }
+        return xtStr;
+    }
+	
+	public static void detachAll(List<Element> eList){
+		for(Element e:eList){
+			e.detach();
+		}
+	}
+	
+	public static void detachPr(List<Element> eList){
+		Iterator<Element> iterator = eList.iterator();
+		while(iterator.hasNext()){
+			Element e = iterator.next();
+			if(e.getName().equals("pPr")){
+				iterator.remove();
+			}
+		}
+	}
+	
+	
+	/**
+	 * <p>
+	 * 增加tab缩进,上下对齐选项
+	 * </p>
+	 * @param upList
+	 *            上选项
+	 * @param downList
+	 *            下选项
+	 * @param tab
+	 *            缩进字符元素
+	 * @param differ_len
+	 *            相差tab数
+	 * @author songyue
+	 * @date 2016-07-11
+	 */
+	public static void addTab(List<Element> upList, List<Element> downList, int uplen, int downlen, Element tab) {
+		int differ_len = (uplen - downlen) >= 0 ? Math.round(((float) uplen - (float) downlen) / 4)
+				: (-1) * Math.round(((float) downlen - (float) uplen) / 4);
+		if (differ_len > 0) {
+			for (int i = 0; i < differ_len; i++) {
+				downList.add((Element) tab.clone());
+			}
+		} else if (differ_len < 0) {
+			for (int i = 0; i < Math.abs(differ_len); i++) {
+				upList.add((Element) tab.clone());
+			}
+		}
+	}
+	
+	/**
+	 * <p>获取试卷中题目的分值(选择题、非选择题)</p>
+	 * @author songyue
+	 * @date 2016-06-28
+	 */
+	public double getQuestionScore(PagerConstruct paper,String qtype){
+		double score = 0;
+		if(qtype.equals("choice")){
+			for (int i = 0; i < paper.getQtypeList().size(); i++) {
+				PagerConstructQtype qtyp = paper.getQtypeList().get(i);
+				if(qtyp.getName().contains("选择题")){
+					score += qtyp.getQuestionScores().doubleValue();
+				}
+			}
+		}else if(qtype.equals("nonchoice")){
+			for (int i = 0; i < paper.getQtypeList().size(); i++) {
+				PagerConstructQtype qtyp = paper.getQtypeList().get(i);
+				if(!qtyp.getName().contains("选择题")){
+					score += qtyp.getQuestionScores().doubleValue();
+				}
+			}
+		}
+		return score;
+	}
+	
+	/**
+	 * <p>获取题干实际长度</p>
+	 * @author songyue
+	 * @throws UnsupportedEncodingException 
+	 * @date 2016-07-11
+	 */
+	public static int getQuestionBodyLength(String str) throws UnsupportedEncodingException{
+		double real_len = 0;
+		String []str_split = str.split("");
+		for(String s:str_split){
+			double len = s.getBytes("UTF-8").length;
+			if(len == 1){
+				real_len += len / 2;
+			}else if(len >= 2){
+				real_len += 1;
+			}
+		}
+		return (int)Math.ceil(real_len);
+	}
+	
+//	/**
+//	 * <p>将word中的latex公式替换为omml</p>
+//	 * @author songyue
+//	 * @date
+//	 */
+//    @SuppressWarnings({ "rawtypes"})
+//	private static String dealFormula(String xtStr) throws UnsupportedEncodingException, DocumentException {
+//        String xtStr_temp = xtStr;
+//    	xtStr = Consts.PAPERTMPBODY_START + xtStr + Consts.PAPERTMPBODY_END;
+//        SAXReader sax = new SAXReader();
+//        ByteArrayInputStream is = new ByteArrayInputStream(xtStr.getBytes("UTF-8"));
+//        Document document = sax.read(is);
+//        General.close(is);
+//        Element root = document.getRootElement();
+//        List <Element>pList = root.elements("p");
+//        Element p = (Element)pList.get(0);
+//        List <Element>prList = p.elements("r");
+//        for(Element r: prList){
+//        	Element t = r.element("t");
+//        	if(t == null){
+//        		return xtStr_temp;
+//        	}
+//        	String text = t.getTextTrim();
+//        	if(text.contains("\\[")){
+//        		String omml = General.latex2OMML(text);
+//        		if(omml.equals("")){
+//        			return xtStr_temp;
+//        		}
+//        		List <Element>pchildren = r.getParent().content();
+//        		//omml = Consts.PAPERTMPBODY_START + omml + Consts.PAPERTMPBODY_END;
+//        		Document omml_doc = DocumentHelper.parseText(omml);
+//        		Element oMath = (Element)omml_doc.getRootElement();
+//        		if(oMath != null){
+//        			Attribute attr_mml = oMath.attribute("xmlns:mml");
+//        			Attribute attr_m = oMath.attribute("xmlns:m");
+//        			oMath.remove(attr_mml);
+//        			oMath.remove(attr_m);
+//        			pchildren.set(pchildren.indexOf(r), oMath);
+////	        		p.remove(r);
+////	        		p.add(oMath);
+//        		}
+//        	}
+//        }
+//        xtStr = document.asXML();
+//        xtStr = xtStr.substring(xtStr.indexOf(Consts.PAPERTMPBODY_START) + Consts.PAPERTMPBODY_START.length(),
+//                xtStr.length() - Consts.PAPERTMPBODY_END.length());
+//        return xtStr;
+//    }
+
+    public static void main(String[] args) {
+        String xtStr = "<w:p w:rsidR=\"0011633E\" w:rsidRDefault=\"0011633E\" w:rsidP=\"0048118D\"><w:r w:rsidRPr=\"00F43A3E\"><w:rPr><w:rFonts w:hint=\"eastAsia\"/></w:rPr><w:t>12312312312</w:t></w:r><w:r w:rsidR=\"00EE29F7\" w:rsidRPr=\"00F43A3E\"><w:rPr><w:rFonts w:hint=\"eastAsia\"/></w:rPr><w:t>$$x=\\frac {-b\\pm \\sqrt {{b}^{2}-4ac}} {2a}$$</w:t></w:r><w:r w:rsidRPr=\"00F43A3E\"><w:rPr><w:rFonts w:hint=\"eastAsia\"/></w:rPr><w:t xml:space=\"preserve\">123123123</w:t></w:r><w:r w:rsidR=\"00C275D3\" w:rsidRPr=\"00F43A3E\"><w:rPr><w:rFonts w:hint=\"eastAsia\"/></w:rPr><w:t>$$f(x)$$</w:t></w:r><w:r w:rsidR=\"00C275D3\" w:rsidRPr=\"005C45B7\"><w:rPr><w:rFonts w:hint=\"eastAsia\"/></w:rPr><w:t>##满分##</w:t></w:r><w:r w:rsidR=\"00C275D3\" w:rsidRPr=\"00F43A3E\"><w:rPr><w:rFonts w:hint=\"eastAsia\"/></w:rPr><w:t>分</w:t></w:r><w:r w:rsidRPr=\"00F43A3E\"><w:rPr><w:rFonts w:hint=\"eastAsia\"/></w:rPr><w:t xml:space=\"preserve\">   </w:t></w:r><w:r><w:rPr><w:rFonts w:hint=\"eastAsia\"/></w:rPr><w:t xml:space=\"preserve\">  </w:t></w:r><w:r w:rsidRPr=\"00F43A3E\"><w:rPr><w:rFonts w:hint=\"eastAsia\"/></w:rPr><w:t>考试时间:</w:t></w:r><w:r w:rsidRPr=\"00F43A3E\"><w:rPr><w:rFonts w:hint=\"eastAsia\"/></w:rPr><w:t>90</w:t></w:r><w:r w:rsidRPr=\"00F43A3E\"><w:rPr><w:rFonts w:hint=\"eastAsia\"/></w:rPr><w:t>分钟</w:t></w:r></w:p><w:p w:rsidR=\"0011633E\" w:rsidRPr=\"0011633E\" w:rsidRDefault=\"00C275D3\" w:rsidP=\"00D26082\"><w:r w:rsidRPr=\"008C75B3\"><w:rPr><w:rFonts w:hint=\"eastAsia\"/></w:rPr><w:t></w:t></w:r></w:p>";
+        // try {
+        // System.out.println(addBeforeLines(xtStr));
+        // } catch (UnsupportedEncodingException e) {
+        // e.printStackTrace();
+        // } catch (DocumentException e) {
+        // e.printStackTrace();
+        // }
+
+//        try {
+//        	File htmlFile = new File("E:/temp/htmls/1.html");
+//            String htmlStr = IOUtils.toString(new FileInputStream(htmlFile), "UTF-8");
+//            IOUtils.write(General.htmlToDocx(htmlStr), new FileOutputStream(new File(htmlFile.getPath() + ".docx")));
+//        } catch (Exception e) {
+//            e.printStackTrace();
+//        }
+//    	  try {
+//    		int len1 = getQuestionBodyLength("当代中国对人生价值观的评价标准是");
+//    		int len2 = getQuestionBodyLength("自明清以来的公文程式构成有什么");
+//    		int len3 = getQuestionBodyLength("【      】");
+//    		System.out.println(len3);
+//    		System.out.println(len1);
+//    		System.out.println(len2);
+//    		System.out.println((39 - len1 - 4)/ 2.0);
+//			System.out.println((int) Math.ceil((39 - len1 - 5) / 2));
+//			System.out.println((int) Math.ceil((39 - len2 - 5) / 2));
+//			
+//		} catch (UnsupportedEncodingException e) {
+//			// TODO Auto-generated catch block
+//			e.printStackTrace();
+//		}
+    	//System.out.println(General.repairHtmlFormula("<p>123<img class='kfformula' data-latex='\\sqrtsdfsdfsdf'></img>3333</p>"));
+    	//System.out.println(General.latex2MML("$$x=\\frac {-b\\pm \\sqrt {{b}^{2}-4ac}} {2a}$$"));
+    }
+}

+ 333 - 0
src/main/java/com/qmth/qrzk/repository/quartz/LoadParamsQuartz.java

@@ -0,0 +1,333 @@
+package com.qmth.qrzk.repository.quartz;
+
+import java.io.File;
+import java.io.FileFilter;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import org.apache.log4j.Logger;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Qualifier;
+import org.springframework.stereotype.Service;
+
+import com.qmth.qrzk.repository.common.base.BaseDao;
+import com.qmth.qrzk.repository.user.model.Code;
+import com.qmth.qrzk.repository.user.model.Question;
+import com.qmth.qrzk.repository.user.model.QuestionOption;
+import com.qmth.qrzk.repository.user.model.SysParam;
+import com.qmth.qrzk.repository.user.model.User;
+import com.qmth.qrzk.repository.user.service.ICodeSerivce;
+import com.qmth.qrzk.repository.user.service.IUserService;
+import com.qmth.qrzk.repository.user.service.impl.AttachmentService;
+import com.qmth.qrzk.repository.user.service.impl.QuestionOptionServiceImpl;
+import com.qmth.qrzk.repository.user.service.impl.QuestionServiceImpl;
+import com.qmth.qrzk.repository.user.service.impl.SysParamService;
+import com.qmth.qrzk.repository.utils.BeanHelper;
+import com.qmth.qrzk.repository.utils.Consts;
+import com.qmth.qrzk.repository.utils.DateHelper;
+import com.qmth.qrzk.repository.utils.General;
+import com.qmth.qrzk.repository.utils.ParamUtils;
+import com.qmth.qrzk.repository.utils.docx.HtmlCreator;
+
+@Service
+public class LoadParamsQuartz {
+	private static final Logger log = Logger.getLogger(LoadParamsQuartz.class);
+
+	@Autowired
+	private BaseDao dao;
+	
+	@Autowired
+	private SysParamService sysParamService;
+	
+	@Autowired
+	private IUserService userService;
+
+	@Autowired
+	private QuestionServiceImpl questionService;
+
+	@Autowired
+	private AttachmentService attachmentService;
+	
+	@Autowired
+	private QuestionOptionServiceImpl quesOptService;
+
+	@Autowired
+	@Qualifier("codeServiceImpl")
+	private ICodeSerivce codeSerivce;
+	
+	public void loadParamsAndCache(){
+		loadSysParams();
+		loadUsers();
+		loadCodeTextMap();
+		initCourseLastIndexMap();
+	}
+	
+	public void loadBaseData(){
+		loadSysParams();
+		loadUsers();
+		loadCodeTextMap();
+		releaseTmpFolder();
+		releaseOverdueAtts();
+	}
+	
+	private void loadSysParams(){
+		log.info("--开始加载系统配置信息," + DateHelper.toLongString() + "...");
+		Map<String, Object> map = new HashMap<String, Object>();
+		try {
+			for (SysParam t : sysParamService.getAllSysParams()) {
+				map.put(t.getParamName(), t.getParamValue());
+			}
+			BeanHelper.setStaticField(ParamUtils.class, map);
+			log.info("--加载系统配置信息完成。");
+			General.initSysDir();
+		} catch (Exception e) {
+			log.error("加载系统配置信息失败,原因:" + e.getMessage(),e);
+		}
+	}
+	
+	/**
+	 * 初始化用户信息
+	 * 
+	 */
+	private void loadUsers(){
+		log.info("--开始加载用户信息," + DateHelper.toLongString() + "...");
+		try{
+			List<User> users=userService.queryUsers(null);
+			for(User user:users){
+				user.setPassword("");
+				Consts.UserMap.put(user.getId(), user);
+			}
+			log.info("--加载用户信息完成。");
+		}catch(Exception e){
+			log.error("加载用户信息失败,原因:" + e.getMessage(),e);
+		}
+	}
+	
+	/**
+	 * 清空临时文件夹。清空超过半天的临时文件(夹)
+	 */
+	private void releaseTmpFolder(){
+		log.info("--开始清空临时文件夹(" + ParamUtils.TemporaryDirPath + ")," + DateHelper.toLongString() + "...");
+		try{
+			File tmpFolder = new File(ParamUtils.TemporaryDirPath);
+			File[] tmps = tmpFolder.listFiles(new FileFilter() {
+				@Override
+				public boolean accept(File file) {//找出超过半天的文件(夹)
+					return (System.currentTimeMillis() - file.lastModified() >= Consts.OVERDUE_TIME_MILLIS);
+				}
+			});
+			for(File file:tmps){
+				General.delete(file);
+			}
+			log.info("--清空临时文件夹完成,共清空:" + tmps.length + "个文件(夹)。");
+		}catch(Exception e){
+			log.error("清空临时文件夹失败,原因:" + e.getMessage(),e);
+		}
+	}
+	
+	/**
+	 * 清空过期的附件(草稿状态)
+	 */
+	private void releaseOverdueAtts(){
+		log.info("--开始清空过期的附件," + DateHelper.toLongString() + "...");
+		try{
+			int deletedAttsNum = attachmentService.releaseOverdueAtts(new Date(System.currentTimeMillis() - Consts.OVERDUE_TIME_MILLIS));
+			log.info("--清空过期的附件完成,共清空:" + deletedAttsNum + "个过期附件。");
+		}catch(Exception e){
+			e.printStackTrace();
+			log.error("清空过期的附件失败,原因:" + e.getMessage(),e);
+		}
+	}
+	
+	/**
+	 * 处理Lucene索引文件
+	 
+	public void loadLuceneIndex(){
+		File file=new File(ParamUtils.LuceneIndexURL);
+		//springmvc 是通过注入
+//		IQuestionService question=new QuestionServiceImpl();
+		
+		List<Question> list=questionService.findAll();
+		
+		//1.课程  2.教材  3.层次 4.预计难度  5.题型  6认知层次 7.状态需要处理的
+		
+		SimpleLuceneDB db=new SimpleLuceneDB(file.getPath());
+		try {
+			db.open(true);
+		} catch (IOException e) {
+			e.printStackTrace();
+		}
+		
+		
+		List<Document> documents=new ArrayList<Document>();
+		DocumentsUtil.Question2Document(list, documents);
+		try {
+			db.addDocument(documents);
+		} catch (CorruptIndexException e1) {
+			e1.printStackTrace();
+		} catch (IOException e1) {
+			e1.printStackTrace();
+		}
+		try {
+			db.commit();
+			db.close();
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+	*/
+	
+	public void repairQuestionData(){
+		String nullSummary = " ";
+		log.info("--开始修复数据不完整的试题及选项," + DateHelper.toLongString() + "...");
+		int quesNum = 0;
+		int optNum = 0;
+		long cur = System.currentTimeMillis();
+		for(Integer quesId : questionService.findAllQuestionIds()){
+			Question ques = questionService.searchQuestionWithOptionsById(quesId);
+			if(ques == null){
+				continue;
+			}
+			boolean hasModified = false;
+			if(ques.getBodyWord() != null && ques.getBodyWord().length > 0 && General.isEmpty(ques.getBody())){
+				try{
+					ques.setBody(HtmlCreator.covertToHtml(ques.getBodyWord()).toString());
+					ques.setBodySummary(null);
+					hasModified = true;
+				}catch(Exception e){
+					log.warn("试题[id=" + ques.getId() + "]的word数据无法转换成html代码,原因:" + e.getMessage(), e);
+				}
+			}else if ((ques.getBodyWord() == null || ques.getBodyWord().length == 0) && General.isNotEmpty(ques.getBody())) {
+				try{
+					ques.setBodyWord(General.htmlToDocx(ques.getBody()));
+					ques.setBodySummary(null);
+					hasModified = true;
+				}catch(Exception e){
+					log.warn("试题[id=" + ques.getId() + "]的html代码无法转换成word数据,原因:" + e.getMessage(), e);
+				}
+			}
+			if(General.isNotEmpty(ques.getBody()) && General.isEmpty(ques.getBodySummary())){
+				try{
+					ques.setBodySummary(General.extractText(ques.getBody()));
+					if(General.isEmpty(ques.getBodySummary())){
+						ques.setBodySummary(nullSummary);
+					}
+					hasModified = true;
+				}catch(Exception e){
+					log.warn("试题[id=" + ques.getId() + "]提取纯文本失败,原因:" + e.getMessage(), e);
+				}
+			}
+
+			if(ques.getAnswerWord() != null && ques.getAnswerWord().length > 0 && General.isEmpty(ques.getAnswer())){
+				try{
+					ques.setAnswer(HtmlCreator.covertToHtml(ques.getAnswerWord()).toString());
+					ques.setAnswerSummary(null);
+					hasModified = true;
+				}catch(Exception e){
+					log.warn("试题[id=" + ques.getId() + "]的word答案无法转换成html代码,原因:" + e.getMessage(), e);
+				}
+			}else if ((ques.getAnswerWord() == null || ques.getAnswerWord().length == 0) && General.isNotEmpty(ques.getAnswer())) {
+				try{
+					ques.setAnswerWord(General.htmlToDocx(ques.getAnswer()));
+					ques.setAnswerSummary(null);
+					hasModified = true;
+				}catch(Exception e){
+					log.warn("试题[id=" + ques.getId() + "]的html代码答案无法转换成word数据,原因:" + e.getMessage(), e);
+				}
+			}
+			if(General.isNotEmpty(ques.getAnswer()) && General.isEmpty(ques.getAnswerSummary())){
+				try{
+					ques.setAnswerSummary(General.extractText(ques.getAnswer()));
+					if(General.isEmpty(ques.getAnswerSummary())){
+						ques.setAnswerSummary(nullSummary);
+					}
+					hasModified = true;
+				}catch(Exception e){
+					log.warn("试题[id=" + ques.getId() + "]的答案提取纯文本失败,原因:" + e.getMessage(), e);
+				}
+			}
+			if(hasModified){
+				try{
+					questionService.update(ques);
+					quesNum++;
+					log.info("成功修复试题[id=" + ques.getId() + "]数据.");
+				}catch(Exception e){
+					log.warn("更新试题[id=" + ques.getId() + "]失败,原因:" + e.getMessage(), e);
+				}
+			}
+			
+			if(ques.getOptions() != null){
+				for(QuestionOption qo:ques.getOptions()){
+					boolean optHasModified = false;
+					if(qo.getContentWord() != null && qo.getContentWord().length > 0 && General.isEmpty(qo.getContent())){
+						try{
+							qo.setContent(HtmlCreator.covertToHtml(qo.getContentWord()).toString());
+							qo.setSummary(null);
+							optHasModified = true;
+						}catch(Exception e){
+							log.warn("试题[id=" + ques.getId() + "]下面的的选项[id=" + qo.getId() + "]word数据无法转换成html代码,原因:" + e.getMessage(), e);
+						}
+					}else if ((qo.getContentWord() == null || qo.getContentWord().length == 0) && General.isNotEmpty(qo.getContent())) {
+						try{
+							qo.setContentWord(General.htmlToDocx(qo.getContent()));
+							qo.setSummary(null);
+							optHasModified = true;
+						}catch(Exception e){
+							log.warn("试题[id=" + ques.getId() + "]下面的的选项[id=" + qo.getId() + "]html代码无法转换成word数据,原因:" + e.getMessage(), e);
+						}
+					}
+					if(General.isNotEmpty(qo.getContent()) && General.isEmpty(qo.getSummary())){
+						try{
+							qo.setSummary(General.extractText(qo.getContent()));
+							if(General.isEmpty(qo.getSummary())){
+								qo.setSummary(nullSummary);
+							}
+							optHasModified = true;
+						}catch(Exception e){
+							log.warn("试题[id=" + ques.getId() + "]下面的的选项[id=" + qo.getId() + "]提取纯文本失败,原因:" + e.getMessage(), e);
+						}
+					}
+					if(optHasModified){
+						try{
+							quesOptService.update(qo);
+							optNum++;
+							log.info("成功修复选项[id=" + qo.getId() + "]数据.");
+						}catch(Exception e){
+							log.warn("更新选项[id=" + qo.getId() + "]失败,原因:" + e.getMessage(), e);
+						}
+					}
+				}
+			}
+		}
+		log.info("--修复数据不完整的试题及选项完成,共修复试题:" + quesNum + "个,选项:" + optNum + "个,耗时:" + (System.currentTimeMillis() - cur)/1000.0 + "s.");
+	}
+	
+	/**
+	 * 初始化课程最大的题号索引值Map
+	 */
+	public void initCourseLastIndexMap(){
+		log.info("--开始初始化课程最大的题号索引值Map," + DateHelper.toLongString() + "...");
+		List<Map<String,Object>> statList = dao.getList("statMaxIndexByCourseCode");
+		for(Map<String,Object> stat:statList){
+			String courseCode = (String) stat.get("code");
+			int lastIndex = General.toInteger(stat.get("lastIndex"), 0);
+			Consts.CourseLastIndexMap.put(courseCode, lastIndex);
+			log.info(courseCode + "\t" + lastIndex);
+		}
+		log.info("--初始化课程最大的题号索引值Map完成。");
+	}
+	
+	/**
+	 * 加载字典值显示值字典,key为itemType-itemCode,value为itemValue。
+	 */
+	public void loadCodeTextMap(){
+		log.info("--开始加载字典值显示值字典," + DateHelper.toLongString() + "...");
+		List<Code> codes = codeSerivce.getAllCode();
+		for(Code c:codes){
+			Consts.CodeTextMap.put(c.getItemType() + "-" + c.getItemCode(), c.getItemValue());
+		}
+		log.info("--加载字典值显示值字典完成。");
+	}
+}

+ 35 - 0
src/main/java/com/qmth/qrzk/repository/service/query/AttachmentQueryParams.java

@@ -0,0 +1,35 @@
+package com.qmth.qrzk.repository.service.query;
+
+import java.util.Date;
+
+public class AttachmentQueryParams extends QueryParams {
+	private String originalName;//原始文件名
+	private String curName;//现在文件名
+	private String status;//附件状态:草稿 DRAFT 、正在使用 USING、已删除 DELETEED
+	private Date createdTime;
+	public String getOriginalName() {
+		return originalName;
+	}
+	public void setOriginalName(String originalName) {
+		this.originalName = originalName;
+	}
+	public String getCurName() {
+		return curName;
+	}
+	public void setCurName(String curName) {
+		this.curName = curName;
+	}
+	public String getStatus() {
+		return status;
+	}
+	public void setStatus(String status) {
+		this.status = status;
+	}
+	public Date getCreatedTime() {
+		return createdTime;
+	}
+	public void setCreatedTime(Date createdTime) {
+		this.createdTime = createdTime;
+	}
+
+}

+ 69 - 0
src/main/java/com/qmth/qrzk/repository/service/query/AvailableQuesQueryParams.java

@@ -0,0 +1,69 @@
+package com.qmth.qrzk.repository.service.query;
+
+public class AvailableQuesQueryParams  extends QueryParams {
+	
+	private Integer pcqtId;
+	private Integer detailId;
+	private double score;
+	
+	private Integer qtId;
+	private Integer courseId;
+	private Integer bookId;
+	private Integer constructId;
+
+	public Integer getPcqtId() {
+		return pcqtId;
+	}
+
+	public void setPcqtId(Integer pcqtId) {
+		this.pcqtId = pcqtId;
+	}
+
+	public Integer getQtId() {
+		return qtId;
+	}
+
+	public void setQtId(Integer qtId) {
+		this.qtId = qtId;
+	}
+
+	public Integer getCourseId() {
+		return courseId;
+	}
+
+	public void setCourseId(Integer courseId) {
+		this.courseId = courseId;
+	}
+
+	public Integer getBookId() {
+		return bookId;
+	}
+
+	public void setBookId(Integer bookId) {
+		this.bookId = bookId;
+	}
+
+	public Integer getConstructId() {
+		return constructId;
+	}
+
+	public void setConstructId(Integer constructId) {
+		this.constructId = constructId;
+	}
+
+	public Integer getDetailId() {
+		return detailId;
+	}
+
+	public void setDetailId(Integer detailId) {
+		this.detailId = detailId;
+	}
+
+	public double getScore() {
+		return score;
+	}
+
+	public void setScore(double score) {
+		this.score = score;
+	}
+}

+ 22 - 0
src/main/java/com/qmth/qrzk/repository/service/query/CorrigendumQueryParams.java

@@ -0,0 +1,22 @@
+package com.qmth.qrzk.repository.service.query;
+
+public class CorrigendumQueryParams extends QueryParams {
+	private String batch;
+	private Integer courseId;
+
+	public Integer getCourseId() {
+		return courseId;
+	}
+
+	public void setCourseId(Integer courseId) {
+		this.courseId = courseId;
+	}
+
+	public String getBatch() {
+		return batch;
+	}
+
+	public void setBatch(String batch) {
+		this.batch = batch;
+	}
+}

+ 24 - 0
src/main/java/com/qmth/qrzk/repository/service/query/CourseQueryParams.java

@@ -0,0 +1,24 @@
+package com.qmth.qrzk.repository.service.query;
+
+public class CourseQueryParams  extends QueryParams {
+	
+	private Integer type;
+	
+	private Integer status;
+	
+	public Integer getType() {
+		return type;
+	}
+
+	public void setType(Integer type) {
+		this.type = type;
+	}
+
+	public Integer getStatus() {
+		return status;
+	}
+
+	public void setStatus(Integer status) {
+		this.status = status;
+	}
+}

+ 89 - 0
src/main/java/com/qmth/qrzk/repository/service/query/DbfPaperInfoQueryParams.java

@@ -0,0 +1,89 @@
+package com.qmth.qrzk.repository.service.query;
+
+public class DbfPaperInfoQueryParams extends QueryParams {
+	private Integer paperBatchId;
+
+	private Integer dbfPaperInfoId;
+
+	private String courseCode;
+	private String courseName;
+	private String bookName;
+	private String bookAuthor;
+	private String bookPress;
+	private String bookPressYear;
+	
+	private Integer relatedPaperNum;
+
+	public Integer getPaperBatchId() {
+		return paperBatchId;
+	}
+
+	public void setPaperBatchId(Integer paperBatchId) {
+		this.paperBatchId = paperBatchId;
+	}
+
+	public String getCourseCode() {
+		return courseCode;
+	}
+
+	public void setCourseCode(String courseCode) {
+		this.courseCode = courseCode;
+	}
+
+	public String getCourseName() {
+		return courseName;
+	}
+
+	public void setCourseName(String courseName) {
+		this.courseName = courseName;
+	}
+
+	public String getBookName() {
+		return bookName;
+	}
+
+	public void setBookName(String bookName) {
+		this.bookName = bookName;
+	}
+
+	public String getBookAuthor() {
+		return bookAuthor;
+	}
+
+	public void setBookAuthor(String bookAuthor) {
+		this.bookAuthor = bookAuthor;
+	}
+
+	public String getBookPress() {
+		return bookPress;
+	}
+
+	public void setBookPress(String bookPress) {
+		this.bookPress = bookPress;
+	}
+
+	public String getBookPressYear() {
+		return bookPressYear;
+	}
+
+	public void setBookPressYear(String bookPressYear) {
+		this.bookPressYear = bookPressYear;
+	}
+
+	public Integer getDbfPaperInfoId() {
+		return dbfPaperInfoId;
+	}
+
+	public void setDbfPaperInfoId(Integer dbfPaperInfoId) {
+		this.dbfPaperInfoId = dbfPaperInfoId;
+	}
+
+	public Integer getRelatedPaperNum() {
+		return relatedPaperNum;
+	}
+
+	public void setRelatedPaperNum(Integer relatedPaperNum) {
+		this.relatedPaperNum = relatedPaperNum;
+	}
+
+}

+ 55 - 0
src/main/java/com/qmth/qrzk/repository/service/query/LearnCenterQueryParams.java

@@ -0,0 +1,55 @@
+package com.qmth.qrzk.repository.service.query;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import com.qmth.qrzk.repository.user.model.Course;
+
+public class LearnCenterQueryParams extends QueryParams {
+	private String categoryCode;
+	private String courseCode;
+	private List<Course> courses = new ArrayList<Course>();
+	private Boolean isDomesticConsumer; //是否为普通用户,普通用户只能查看公开的与相关课程的内容
+	private Integer userId;
+	
+	public Integer getUserId() {
+		return userId;
+	}
+
+	public void setUserId(Integer userId) {
+		this.userId = userId;
+	}
+
+	public Boolean getIsDomesticConsumer() {
+		return isDomesticConsumer;
+	}
+
+	public void setIsDomesticConsumer(Boolean isDomesticConsumer) {
+		this.isDomesticConsumer = isDomesticConsumer;
+	}
+
+	public String getCourseCode() {
+		return courseCode;
+	}
+
+	public List<Course> getCourses() {
+		return courses;
+	}
+
+	public void setCourses(List<Course> courses) {
+		this.courses = courses;
+	}
+
+	public void setCourseCode(String courseCode) {
+		this.courseCode = courseCode;
+	}
+
+	public String getCategoryCode() {
+		return categoryCode;
+	}
+
+	public void setCategoryCode(String categoryCode) {
+		this.categoryCode = categoryCode;
+	}
+	
+}

+ 54 - 0
src/main/java/com/qmth/qrzk/repository/service/query/PagerQueryParams.java

@@ -0,0 +1,54 @@
+package com.qmth.qrzk.repository.service.query;
+
+public class PagerQueryParams  extends QueryParams {
+	
+	private String courseKey;
+	
+	private String bookKey;
+	
+	private String pagerKey;
+	
+	private Integer status;//状态   0草稿  1待审批   2审批通过 3启用 4审批拒绝
+	
+	private Integer checkType;//审批类型 0 驳回  1通过
+
+	public String getCourseKey() {
+		return courseKey;
+	}
+
+	public void setCourseKey(String courseKey) {
+		this.courseKey = courseKey;
+	}
+
+	public String getBookKey() {
+		return bookKey;
+	}
+
+	public void setBookKey(String bookKey) {
+		this.bookKey = bookKey;
+	}
+
+	public String getPagerKey() {
+		return pagerKey;
+	}
+
+	public void setPagerKey(String pagerKey) {
+		this.pagerKey = pagerKey;
+	}
+
+	public Integer getStatus() {
+		return status;
+	}
+
+	public void setStatus(Integer status) {
+		this.status = status;
+	}
+
+	public Integer getCheckType() {
+		return checkType;
+	}
+
+	public void setCheckType(Integer checkType) {
+		this.checkType = checkType;
+	}
+}

+ 34 - 0
src/main/java/com/qmth/qrzk/repository/service/query/PaperAnalysisParams.java

@@ -0,0 +1,34 @@
+package com.qmth.qrzk.repository.service.query;
+
+public class PaperAnalysisParams extends QueryParams{
+
+	private Integer batch;
+
+	private String sort;
+
+	private String order;
+
+	public Integer getBatch() {
+		return batch;
+	}
+
+	public void setBatch(Integer batch) {
+		this.batch = batch;
+	}
+
+	public String getSort() {
+		return sort;
+	}
+
+	public void setSort(String sort) {
+		this.sort = sort;
+	}
+
+	public String getOrder() {
+		return order;
+	}
+
+	public void setOrder(String order) {
+		this.order = order;
+	}
+}

+ 131 - 0
src/main/java/com/qmth/qrzk/repository/service/query/PaperBatchParams.java

@@ -0,0 +1,131 @@
+package com.qmth.qrzk.repository.service.query;
+
+
+public class PaperBatchParams extends QueryParams{
+
+	private String code;
+	
+	private int paperBathId;
+	
+	private int paperId; 
+	
+	private int isOutBoundScanned;
+	
+	private int isStorageScanned;
+	
+	private int isPaperReturn;
+	
+	private int isStandardAnswerReturn;
+	
+	private int isAnswerSheetReturn;
+	
+	private String startDate;
+	
+	private String endDate;
+	
+	private String type;
+
+	public String getCode() {
+		return code;
+	}
+
+	public String getStartDate() {
+		return startDate;
+	}
+
+	public void setStartDate(String startDate) {
+		this.startDate = startDate;
+	}
+
+	public String getEndDate() {
+		return endDate;
+	}
+
+	public void setEndDate(String endDate) {
+		this.endDate = endDate;
+	}
+
+	public int getPaperBathId() {
+		return paperBathId;
+	}
+
+	public void setPaperBathId(int paperBathId) {
+		this.paperBathId = paperBathId;
+	}
+
+	public String getType() {
+		return type;
+	}
+
+	public void setType(String type) {
+		this.type = type;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	public int getPaperId() {
+		return paperId;
+	}
+
+	public void setPaperId(int paperId) {
+		this.paperId = paperId;
+	}
+
+	public int getIsOutBoundScanned() {
+		return isOutBoundScanned;
+	}
+
+	public void setIsOutBoundScanned(int isOutBoundScanned) {
+		this.isOutBoundScanned = isOutBoundScanned;
+	}
+
+	public int getIsStorageScanned() {
+		return isStorageScanned;
+	}
+
+	public void setIsStorageScanned(int isStorageScanned) {
+		this.isStorageScanned = isStorageScanned;
+	}
+
+	public int getIsPaperReturn() {
+		return isPaperReturn;
+	}
+
+	public void setIsPaperReturn(int isPaperReturn) {
+		this.isPaperReturn = isPaperReturn;
+	}
+
+	public int getIsStandardAnswerReturn() {
+		return isStandardAnswerReturn;
+	}
+
+	public void setIsStandardAnswerReturn(int isStandardAnswerReturn) {
+		this.isStandardAnswerReturn = isStandardAnswerReturn;
+	}
+
+	public int getIsAnswerSheetReturn() {
+		return isAnswerSheetReturn;
+	}
+
+	public void setIsAnswerSheetReturn(int isAnswerSheetReturn) {
+		this.isAnswerSheetReturn = isAnswerSheetReturn;
+	}
+
+	public PaperBatchParams(String code, String startDate, String endDate,
+			String type) {
+		super();
+		this.code = code;
+		this.startDate = startDate;
+		this.endDate = endDate;
+		this.type = type;
+	}
+
+	public PaperBatchParams() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	
+}

+ 317 - 0
src/main/java/com/qmth/qrzk/repository/service/query/PaperParams.java

@@ -0,0 +1,317 @@
+package com.qmth.qrzk.repository.service.query;
+
+public class PaperParams extends QueryParams{
+
+	private int batchId;
+	
+	private int paperId;
+	
+	private String code;
+	
+	private String courseName;
+	
+	private String courseCode;
+	
+	private String status;
+	
+	private int isOutBoundScanned;		//出库扫描
+	
+	private int isStoreageScanned;		//入库扫描
+	
+	private int isReturn;			//试卷回库
+	
+	private int rukuType;
+	
+	private String bookName;
+	private String bookAuthor;
+	private String bookPress;
+	private String bookPressYear;
+	
+	private String school;
+	
+	
+	private String paperPath;
+	
+	private String standardAnswerPath;
+	
+	private String answerSheetPath;
+	
+	private String attachmentsPath;
+	
+	private String picturesPath;
+	
+	private String[] array;
+	
+	private String[] arrCode;
+	
+	
+	
+
+	public String[] getArrCode() {
+		return arrCode;
+	}
+
+	public void setArrCode(String[] arrCode) {
+		this.arrCode = arrCode;
+	}
+
+	public String[] getArray() {
+		return array;
+	}
+
+	public void setArray(String[] array) {
+		this.array = array;
+	}
+
+	public int getBatchId() {
+		return batchId;
+	}
+
+	public void setBatchId(int batchId) {
+		this.batchId = batchId;
+	}
+
+	
+	public String getCourseCode() {
+		return courseCode;
+	}
+
+	public void setCourseCode(String courseCode) {
+		this.courseCode = courseCode;
+	}
+
+	public int getRukuType() {
+		return rukuType;
+	}
+
+	public void setRukuType(int rukuType) {
+		this.rukuType = rukuType;
+	}
+
+	public int getPaperId() {
+		return paperId;
+	}
+
+	public void setPaperId(int paperId) {
+		this.paperId = paperId;
+	}
+
+	public String getStatus() {
+		return status;
+	}
+
+	public void setStatus(String status) {
+		this.status = status;
+	}
+
+	public int getIsOutBoundScanned() {
+		return isOutBoundScanned;
+	}
+
+	public void setIsOutBoundScanned(int isOutBoundScanned) {
+		this.isOutBoundScanned = isOutBoundScanned;
+	}
+
+	public int getIsStoreageScanned() {
+		return isStoreageScanned;
+	}
+
+	public void setIsStoreageScanned(int isStoreageScanned) {
+		this.isStoreageScanned = isStoreageScanned;
+	}
+
+	public int getIsReturn() {
+		return isReturn;
+	}
+
+	public void setIsReturn(int isReturn) {
+		this.isReturn = isReturn;
+	}
+
+	public PaperParams(int batchId, int paperId) {
+		super();
+		this.batchId = batchId;
+		this.paperId = paperId;
+	}
+
+	public PaperParams(int batchId) {
+		super();
+		this.batchId = batchId;
+	}
+
+	
+	
+	public String getCode() {
+		return code;
+	}
+
+	public void setCode(String code) {
+		this.code = code;
+	}
+
+	
+	public PaperParams(String code, String courseCode, int rukuType) {
+		super();
+		this.code = code;
+		this.courseCode = courseCode;
+		this.rukuType = rukuType;
+	}
+
+	public String getPaperPath() {
+		return paperPath;
+	}
+
+	public void setPaperPath(String paperPath) {
+		this.paperPath = paperPath;
+	}
+
+	public String getStandardAnswerPath() {
+		return standardAnswerPath;
+	}
+
+	public void setStandardAnswerPath(String standardAnswerPath) {
+		this.standardAnswerPath = standardAnswerPath;
+	}
+
+	public String getAnswerSheetPath() {
+		return answerSheetPath;
+	}
+
+	public void setAnswerSheetPath(String answerSheetPath) {
+		this.answerSheetPath = answerSheetPath;
+	}
+
+	public String getAttachmentsPath() {
+		return attachmentsPath;
+	}
+
+	public void setAttachmentsPath(String attachmentsPath) {
+		this.attachmentsPath = attachmentsPath;
+	}
+
+	public String getPicturesPath() {
+		return picturesPath;
+	}
+
+	public void setPicturesPath(String picturesPath) {
+		this.picturesPath = picturesPath;
+	}
+
+	public PaperParams() {
+		super();
+		// TODO Auto-generated constructor stub
+	}
+
+	
+	public String getCourseName() {
+		return courseName;
+	}
+
+	public void setCourseName(String courseName) {
+		this.courseName = courseName;
+	}
+
+	public String getBookName() {
+		return bookName;
+	}
+
+	public void setBookName(String bookName) {
+		this.bookName = bookName;
+	}
+
+	public String getSchool() {
+		return school;
+	}
+
+	public void setSchool(String school) {
+		this.school = school;
+	}
+
+	public PaperParams(String code, String paperPath,
+			String standardAnswerPath, String answerSheetPath,
+			String attachmentsPath, String picturesPath) {
+		super();
+		this.code = code;
+		this.paperPath = paperPath;
+		this.standardAnswerPath = standardAnswerPath;
+		this.answerSheetPath = answerSheetPath;
+		this.attachmentsPath = attachmentsPath;
+		this.picturesPath = picturesPath;
+	}
+
+	public PaperParams(String code, String courseName, String bookName,
+			String school) {
+		super();
+		this.code = code;
+		this.courseName = courseName;
+		this.bookName = bookName;
+		this.school = school;
+	}
+
+	public PaperParams(int batchId, String code) {
+		super();
+		this.batchId = batchId;
+		this.code = code;
+	}
+
+	public PaperParams(String code, String courseCode, String status,
+			int isOutBoundScanned, int isStoreageScanned, int isReturn) {
+		super();
+		this.code = code;
+		this.courseCode = courseCode;
+		this.status = status;
+		this.isOutBoundScanned = isOutBoundScanned;
+		this.isStoreageScanned = isStoreageScanned;
+		this.isReturn = isReturn;
+	}
+
+	public PaperParams(int batchId, String code, String courseName,
+			String status, String bookName, String school) {
+		super();
+		this.batchId = batchId;
+		this.code = code;
+		this.courseName = courseName;
+		this.status = status;
+		this.bookName = bookName;
+		this.school = school;
+	}
+
+	public PaperParams(int batchId, String[] array) {
+		super();
+		this.batchId = batchId;
+		this.array = array;
+	}
+
+	public PaperParams(int batchId, String[] array, String[] arrCode) {
+		super();
+		this.batchId = batchId;
+		this.array = array;
+		this.arrCode = arrCode;
+	}
+
+	public String getBookAuthor() {
+		return bookAuthor;
+	}
+
+	public void setBookAuthor(String bookAuthor) {
+		this.bookAuthor = bookAuthor;
+	}
+
+	public String getBookPress() {
+		return bookPress;
+	}
+
+	public void setBookPress(String bookPress) {
+		this.bookPress = bookPress;
+	}
+
+	public String getBookPressYear() {
+		return bookPressYear;
+	}
+
+	public void setBookPressYear(String bookPressYear) {
+		this.bookPressYear = bookPressYear;
+	}
+	
+	
+}

Unele fișiere nu au fost afișate deoarece prea multe fișiere au fost modificate în acest diff