ソースを参照

提交后端代码

weiwenhai 6 年 前
コミット
004a12188e

+ 2 - 1
examcloud-core-questions-api-provider/src/main/java/cn/com/qmth/examcloud/core/questions/api/ExtractConfigController.java

@@ -10,6 +10,7 @@ import cn.com.qmth.examcloud.core.questions.base.enums.ExportWay;
 import cn.com.qmth.examcloud.core.questions.dao.entity.ExtractConfig;
 import cn.com.qmth.examcloud.core.questions.service.ExtractConfigFileService;
 import cn.com.qmth.examcloud.core.questions.service.ExtractConfigService;
+import cn.com.qmth.examcloud.core.questions.service.bean.CouresInfo;
 import cn.com.qmth.examcloud.core.questions.service.bean.dto.ExportPaperInfoModel;
 import io.swagger.annotations.ApiOperation;
 
@@ -96,7 +97,7 @@ public class ExtractConfigController extends ControllerSupport {
     	if(user == null){
     		throw new StatusException("Q-", "user is null");
     	}
-    	List<String> courseCodeList = extractConfigService.findCourseByExtractConfig(examId,user.getRootOrgId().toString());
+    	List<CouresInfo> courseCodeList = extractConfigService.findCourseByExtractConfig(examId,user.getRootOrgId().toString());
     	return new ResponseEntity<Object>(courseCodeList,HttpStatus.OK);
     }
 

+ 21 - 1
examcloud-core-questions-base/src/main/resources/xnjd_outline_paper_template.ftl

@@ -47,7 +47,27 @@
 								<w:sz w:val="48"/>
 								<w:szCs w:val="48"/>
 							</w:rPr>
-							<w:t>西南交通大学网络教育学院试卷</w:t>
+							<w:t>西南交通大学远程与继续教育学院</w:t>
+						</w:r>
+					</w:p>
+					<w:p w:rsidP="00165E69" w:rsidR="00D84CD3" w:rsidRDefault="00D84CD3" w:rsidRPr="00D84CD3">
+						<w:pPr>
+							<w:pStyle w:val="a3"/>
+							<w:spacing w:afterLines="50" w:beforeLines="70" w:line="360" w:lineRule="auto"/>
+							<w:rPr>
+								<w:b/>
+								<w:sz w:val="48"/>
+								<w:szCs w:val="48"/>
+							</w:rPr>
+						</w:pPr>
+						<w:r w:rsidRPr="00D84CD3">
+							<w:rPr>
+								<w:rFonts w:hint="eastAsia"/>
+								<w:b/>
+								<w:sz w:val="35"/>
+								<w:szCs w:val="35"/>
+							</w:rPr>
+							<w:t>大作业考试试卷</w:t>
 						</w:r>
 					</w:p>
 					<w:tbl>

+ 3 - 73
examcloud-core-questions-base/src/main/resources/xnjd_paper_template.ftl

@@ -553,7 +553,7 @@
 								<w:sz w:val="52"/>
 								<w:szCs w:val="52"/>
 							</w:rPr>
-							<w:t>西南交通大学</w:t>
+							<w:t>西南交通大学远程与</w:t>
 						</w:r>
 						<w:r w:rsidR="005672AE">
 							<w:rPr>
@@ -575,29 +575,7 @@
 								<w:sz w:val="52"/>
 								<w:szCs w:val="52"/>
 							</w:rPr>
-							<w:t>(</w:t>
-						</w:r>
-						<w:r w:rsidR="005672AE">
-							<w:rPr>
-								<w:rFonts w:eastAsia="黑体" w:hint="eastAsia"/>
-								<w:b/>
-								<w:bCs/>
-								<w:noProof/>
-								<w:sz w:val="52"/>
-								<w:szCs w:val="52"/>
-							</w:rPr>
-							<w:t>网络</w:t>
-						</w:r>
-						<w:r w:rsidR="005C564E" w:rsidRPr="004C6227">
-							<w:rPr>
-								<w:rFonts w:eastAsia="黑体" w:hint="eastAsia"/>
-								<w:b/>
-								<w:bCs/>
-								<w:noProof/>
-								<w:sz w:val="52"/>
-								<w:szCs w:val="52"/>
-							</w:rPr>
-							<w:t>)教育</w:t>
+							<w:t>教育学院</w:t>
 						</w:r>
 					</w:p>
 					<w:p w:rsidP="001A2234" w:rsidR="00D948E2" w:rsidRDefault="00FA0A97" w:rsidRPr="00771EF6">
@@ -613,54 +591,6 @@
 								<w:szCs w:val="36"/>
 							</w:rPr>
 						</w:pPr>
-						<w:r w:rsidRPr="00F52F72">
-							<w:rPr>
-								<w:rFonts w:eastAsia="黑体" w:hint="eastAsia"/>
-								<w:b/>
-								<w:bCs/>
-								<w:noProof/>
-								<w:color w:val="FF0000"/>
-								<w:sz w:val="36"/>
-								<w:szCs w:val="36"/>
-							</w:rPr>
-							<w:t>2017</w:t>
-						</w:r>
-						<w:r w:rsidRPr="00F52F72">
-							<w:rPr>
-								<w:rFonts w:eastAsia="黑体" w:hint="eastAsia"/>
-								<w:b/>
-								<w:bCs/>
-								<w:noProof/>
-								<w:color w:val="FF0000"/>
-								<w:sz w:val="36"/>
-								<w:szCs w:val="36"/>
-							</w:rPr>
-							<w:t>年</w:t>
-						</w:r>
-						<w:r w:rsidRPr="00F52F72">
-							<w:rPr>
-								<w:rFonts w:eastAsia="黑体" w:hint="eastAsia"/>
-								<w:b/>
-								<w:bCs/>
-								<w:noProof/>
-								<w:color w:val="FF0000"/>
-								<w:sz w:val="36"/>
-								<w:szCs w:val="36"/>
-							</w:rPr>
-							<w:t>12</w:t>
-						</w:r>
-						<w:r w:rsidRPr="00F52F72">
-							<w:rPr>
-								<w:rFonts w:eastAsia="黑体" w:hint="eastAsia"/>
-								<w:b/>
-								<w:bCs/>
-								<w:noProof/>
-								<w:color w:val="FF0000"/>
-								<w:sz w:val="36"/>
-								<w:szCs w:val="36"/>
-							</w:rPr>
-							<w:t>月</w:t>
-						</w:r>
 						<w:r w:rsidRPr="00092339">
 							<w:rPr>
 								<w:rFonts w:eastAsia="黑体" w:hint="eastAsia"/>
@@ -670,7 +600,7 @@
 								<w:sz w:val="36"/>
 								<w:szCs w:val="36"/>
 							</w:rPr>
-							<w:t>期末考试</w:t>
+							<w:t>大作业考试试卷</w:t>
 						</w:r>
 					</w:p>
 					<w:p w:rsidP="005E06FB" w:rsidR="001A2234" w:rsidRDefault="001A2234">

+ 2 - 5
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/ExtractConfigService.java

@@ -3,10 +3,6 @@ package cn.com.qmth.examcloud.core.questions.service;
 import java.util.List;
 import java.util.Map;
 
-
-
-
-
 import cn.com.qmth.examcloud.core.questions.base.question.PaperDto;
 
 import org.springframework.data.domain.Page;
@@ -16,6 +12,7 @@ import cn.com.qmth.examcloud.commons.web.security.bean.User;
 import cn.com.qmth.examcloud.core.questions.dao.entity.ExamPaper;
 import cn.com.qmth.examcloud.core.questions.dao.entity.ExtractConfig;
 import cn.com.qmth.examcloud.core.questions.dao.entity.Paper;
+import cn.com.qmth.examcloud.core.questions.service.bean.CouresInfo;
 import cn.com.qmth.examcloud.core.questions.base.enums.PaperType;
 
 /**
@@ -126,6 +123,6 @@ public interface ExtractConfigService {
 	 * @param examId
 	 * @return
 	 */
-	public List<String> findCourseByExtractConfig(Long examId,String orgId);
+	public List<CouresInfo> findCourseByExtractConfig(Long examId,String orgId);
 	
 }

+ 107 - 0
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/bean/CouresInfo.java

@@ -0,0 +1,107 @@
+package cn.com.qmth.examcloud.core.questions.service.bean;
+
+import cn.com.qmth.examcloud.commons.web.cloud.api.JsonSerializable;
+import cn.com.qmth.examcloud.examwork.api.bean.ExamCourseRelationBean;
+
+public class CouresInfo implements JsonSerializable{
+
+	private static final long serialVersionUID = 1487659956593385878L;
+	
+	private Long examId;
+
+	private Long courseId;
+
+	private String courseName;
+
+	private String courseCode;
+
+	private String courseLevel;
+
+	private Boolean courseEnable;
+	
+	public CouresInfo(){
+	}
+	
+	public CouresInfo(ExamCourseRelationBean bean){
+		this.examId = bean.getExamId();
+		this.courseCode = bean.getCourseCode();
+		this.courseId = bean.getCourseId();
+		this.courseEnable = bean.getCourseEnable();
+		this.courseName = bean.getCourseName();
+	}
+
+	public Long getExamId() {
+		return examId;
+	}
+
+	public void setExamId(Long examId) {
+		this.examId = examId;
+	}
+
+	public Long getCourseId() {
+		return courseId;
+	}
+
+	public void setCourseId(Long courseId) {
+		this.courseId = courseId;
+	}
+
+	public String getCourseName() {
+		return courseName;
+	}
+
+	public void setCourseName(String courseName) {
+		this.courseName = courseName;
+	}
+
+	public String getCourseCode() {
+		return courseCode;
+	}
+
+	public void setCourseCode(String courseCode) {
+		this.courseCode = courseCode;
+	}
+
+	public String getCourseLevel() {
+		return courseLevel;
+	}
+
+	public void setCourseLevel(String courseLevel) {
+		this.courseLevel = courseLevel;
+	}
+
+	public Boolean getCourseEnable() {
+		return courseEnable;
+	}
+
+	public void setCourseEnable(Boolean courseEnable) {
+		this.courseEnable = courseEnable;
+	}
+
+	@Override
+	public int hashCode() {
+		final int prime = 31;
+		int result = 1;
+		result = prime * result
+				+ ((courseCode == null) ? 0 : courseCode.hashCode());
+		return result;
+	}
+
+	@Override
+	public boolean equals(Object obj) {
+		if (this == obj)
+			return true;
+		if (obj == null)
+			return false;
+		if (getClass() != obj.getClass())
+			return false;
+		CouresInfo other = (CouresInfo) obj;
+		if (courseCode == null) {
+			if (other.courseCode != null)
+				return false;
+		} else if (!courseCode.equals(other.courseCode))
+			return false;
+		return true;
+	}
+
+}

+ 2 - 2
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/export/ExportPaperAbstractService.java

@@ -289,8 +289,8 @@ public abstract class ExportPaperAbstractService {
 			TJDX_OUTLINE_TEMPLATE_PAPER = CONFIGURATION.getTemplate("tjdx_outline_paper_template.ftl", ENCODING);
 			
 			XNJD_TEMPLATE_PAPER = CONFIGURATION.getTemplate("xnjd_paper_template.ftl", ENCODING);
-			XNJD_TEMPLATE_ANSWER = CONFIGURATION.getTemplate("xnjd_paper_template.ftl", ENCODING);
-			XNJD_OUTLINE_TEMPLATE_PAPER = CONFIGURATION.getTemplate("xnjd_paper_template.ftl", ENCODING);
+			XNJD_TEMPLATE_ANSWER = CONFIGURATION.getTemplate("xnjd_answer_template.ftl", ENCODING);
+			XNJD_OUTLINE_TEMPLATE_PAPER = CONFIGURATION.getTemplate("xnjd_outline_paper_template.ftl", ENCODING);
 			
 			SYDX_TEMPLATE_PAPER = CONFIGURATION.getTemplate("sydx_paper_template.ftl", ENCODING);
 			SYDX_TEMPLATE_ANSWER = CONFIGURATION.getTemplate("sydx_answer_template.ftl", ENCODING);

+ 1 - 1
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/ExtractConfigFileServiceImpl.java

@@ -1,6 +1,5 @@
 package cn.com.qmth.examcloud.core.questions.service.impl;
 
-import cn.com.qmth.examcloud.core.questions.base.core.ExamCourseDto;
 import cn.com.qmth.examcloud.commons.base.exception.StatusException;
 import cn.com.qmth.examcloud.commons.web.security.bean.User;
 import cn.com.qmth.examcloud.core.questions.base.CommonUtils;
@@ -400,6 +399,7 @@ public class ExtractConfigFileServiceImpl implements ExtractConfigFileService {
         List<ExamCourseRelationBean> examCourseDtoList = new ArrayList<ExamCourseRelationBean>();
         GetExamCourseListReq req = new GetExamCourseListReq();
         req.setExamId(Long.valueOf(examId));
+        req.setCourseEnable(true);
         Long start = 1l;
         int count = 0;
         while (true) {

+ 42 - 6
examcloud-core-questions-service/src/main/java/cn/com/qmth/examcloud/core/questions/service/impl/ExtractConfigServiceImpl.java

@@ -6,6 +6,7 @@ import java.util.regex.Matcher;
 import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
+import cn.com.qmth.examcloud.core.questions.service.bean.CouresInfo;
 import cn.com.qmth.examcloud.core.questions.service.bean.PaperDetailDtoAssembler;
 import cn.com.qmth.examcloud.core.questions.service.bean.PaperDetailUnitDtoAssembler;
 import cn.com.qmth.examcloud.core.questions.service.bean.PaperDtoAssembler;
@@ -29,6 +30,7 @@ import org.springframework.data.mongodb.core.query.Query;
 import org.springframework.data.redis.core.RedisTemplate;
 import org.springframework.stereotype.Service;
 import org.springframework.util.Assert;
+import org.springframework.util.CollectionUtils;
 
 import cn.com.qmth.examcloud.core.questions.base.question.PaperDetailDto;
 import cn.com.qmth.examcloud.core.questions.base.question.PaperDetailUnitDto;
@@ -67,7 +69,10 @@ import cn.com.qmth.examcloud.core.questions.base.enums.PaperType;
 import cn.com.qmth.examcloud.commons.base.exception.StatusException;
 import cn.com.qmth.examcloud.examwork.api.ExamCloudService;
 import cn.com.qmth.examcloud.examwork.api.bean.ExamBean;
+import cn.com.qmth.examcloud.examwork.api.bean.ExamCourseRelationBean;
+import cn.com.qmth.examcloud.examwork.api.request.GetExamCourseListReq;
 import cn.com.qmth.examcloud.examwork.api.request.GetExamReq;
+import cn.com.qmth.examcloud.examwork.api.response.GetExamCourseListResp;
 import cn.com.qmth.examcloud.examwork.api.response.GetExamResp;
 
 /**
@@ -982,7 +987,7 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
             	extractConfig.setExamType(bean.getExamType());
             }
         }
-		return new PageImpl<ExtractConfig>(extractConfigList,new PageRequest(currentPage,pageSize),count);
+		return new PageImpl<ExtractConfig>(extractConfigList,new PageRequest(currentPage - 1,pageSize),count);
 	}
 
 	@Override
@@ -1124,22 +1129,53 @@ public class ExtractConfigServiceImpl implements ExtractConfigService {
 	
 
 	@Override
-	public List<String> findCourseByExtractConfig(Long examId,String orgId) {
-		List<String> courseCodeList = new ArrayList<String>();
+	public List<CouresInfo> findCourseByExtractConfig(Long examId,String orgId) {
 		if(examId == null){
 			throw new StatusException("Q-","examId is null");
 		}
+		//从考务查询改考试下的所有开启课程
+		List<CouresInfo> courseInfoList = new ArrayList<CouresInfo>();
+		GetExamCourseListReq req = new GetExamCourseListReq();
+		req.setExamId(Long.valueOf(examId));
+        req.setCourseEnable(true);
+        Long start = 1l;
+        int count = 0;
+        while (true) {
+        	req.setStart(start);
+            GetExamCourseListResp resp = examCloudService.getExamCourseList(req);
+            for(ExamCourseRelationBean bean:resp.getRelationList()){
+            	CouresInfo info = new CouresInfo(bean);
+            	courseInfoList.add(info);
+            }
+            if(start.equals(resp.getNext())){
+            	break;
+            }else {
+            	start = resp.getNext();
+			}
+            count++;
+            if(count>1000){
+            	throw new StatusException("Q-", "考试下课程的数据量过大");
+            }
+		}
+		if(CollectionUtils.isEmpty(courseInfoList)){
+			return null;
+		}
+		//查询已经改考试下已经制定的课程的调卷规则
 		Query query = new Query();
 		query.addCriteria(Criteria.where("orgId").is(orgId));
 		query.addCriteria(Criteria.where("examId").is(examId));
         List<ExtractConfig> extractConfigList = this.mongoTemplate.find(query, ExtractConfig.class);
         if(extractConfigList != null && extractConfigList.size()>0){
         	for(ExtractConfig extractConfig:extractConfigList){
-        		courseCodeList.add(extractConfig.getCourseCode());
+        		CouresInfo info = new CouresInfo();
+        		info.setCourseCode(extractConfig.getCourseCode());
+        		if(courseInfoList.contains(info)){
+        			courseInfoList.remove(info);
+        		}
         	}
-        	return courseCodeList;
+        	return courseInfoList;
         }
-		return courseCodeList;
+		return courseInfoList;
 	}
 
 }