xiatian 1 年之前
父節點
當前提交
d2ab8c3f84

+ 1 - 1
src/main/java/cn/com/qmth/am/config/FillMetaObjectHandler.java

@@ -10,7 +10,7 @@ public class FillMetaObjectHandler implements MetaObjectHandler {
 
 
 	@Override
 	@Override
 	public void insertFill(MetaObject metaObject) {
 	public void insertFill(MetaObject metaObject) {
-		this.setFieldValByName("creationTime", new Date(), metaObject);
+		this.setFieldValByName("createTime", new Date(), metaObject);
 		this.setFieldValByName("updateTime", new Date(), metaObject);
 		this.setFieldValByName("updateTime", new Date(), metaObject);
 	}
 	}
 
 

+ 15 - 0
src/main/java/cn/com/qmth/am/config/InitData.java

@@ -13,6 +13,9 @@ import org.springframework.stereotype.Component;
 import com.qmth.boot.core.solar.model.OrgInfo;
 import com.qmth.boot.core.solar.model.OrgInfo;
 import com.qmth.boot.core.solar.service.SolarService;
 import com.qmth.boot.core.solar.service.SolarService;
 
 
+import cn.com.qmth.am.service.StudentScoreService;
+import cn.com.qmth.am.service.StudentService;
+
 @Component
 @Component
 public class InitData implements CommandLineRunner {
 public class InitData implements CommandLineRunner {
 	private static final Logger log = LoggerFactory.getLogger(InitData.class);
 	private static final Logger log = LoggerFactory.getLogger(InitData.class);
@@ -20,6 +23,13 @@ public class InitData implements CommandLineRunner {
 	private SysProperty sysProperty;
 	private SysProperty sysProperty;
 	@Autowired
 	@Autowired
 	private SolarService solarService;
 	private SolarService solarService;
+	
+	@Autowired
+	private StudentScoreService studentScoreService;
+	
+	@Autowired
+	private StudentService studentService;
+	
 	@Override
 	@Override
 	public void run(String... args) throws Exception {
 	public void run(String... args) throws Exception {
 		List<OrgInfo> orgs = null;
 		List<OrgInfo> orgs = null;
@@ -49,7 +59,12 @@ public class InitData implements CommandLineRunner {
 		if(!mscoreImpDir.exists()) {
 		if(!mscoreImpDir.exists()) {
 			mscoreImpDir.mkdir();
 			mscoreImpDir.mkdir();
 		}
 		}
+		resetTaskStatus();
 	}
 	}
 	
 	
+	private void resetTaskStatus() {
+		studentScoreService.resetStatus();
+		studentService.resetStatus();
+	}
 
 
 }
 }

+ 1 - 1
src/main/java/cn/com/qmth/am/entity/QuestionEntity.java

@@ -9,7 +9,7 @@ import cn.com.qmth.am.bean.ImageSlice;
 import cn.com.qmth.am.entity.base.IdEntity;
 import cn.com.qmth.am.entity.base.IdEntity;
 import cn.com.qmth.am.handle.ImageSliceListTypeHandler;
 import cn.com.qmth.am.handle.ImageSliceListTypeHandler;
 
 
-@TableName("am_question")
+@TableName(value = "am_question", autoResultMap = true)
 public class QuestionEntity extends IdEntity {
 public class QuestionEntity extends IdEntity {
 
 
 	private static final long serialVersionUID = -6261302618070108336L;
 	private static final long serialVersionUID = -6261302618070108336L;

+ 2 - 0
src/main/java/cn/com/qmth/am/service/StudentScoreService.java

@@ -34,4 +34,6 @@ public interface StudentScoreService  extends IService<StudentScoreEntity> {
 
 
 	void aiMarking(StudentScoreEntity score);
 	void aiMarking(StudentScoreEntity score);
 
 
+	void resetStatus();
+
 }
 }

+ 2 - 0
src/main/java/cn/com/qmth/am/service/StudentService.java

@@ -32,5 +32,7 @@ public interface StudentService  extends IService<StudentEntity> {
 
 
 	void updateStatus(Long id, DataStatus from, DataStatus to);
 	void updateStatus(Long id, DataStatus from, DataStatus to);
 
 
+	void resetStatus();
+
 
 
 }
 }

+ 17 - 9
src/main/java/cn/com/qmth/am/service/impl/QuestionServiceImpl.java

@@ -35,7 +35,7 @@ import cn.com.qmth.am.service.QuestionService;
 @Service
 @Service
 public class QuestionServiceImpl extends ServiceImpl<QuestionDao, QuestionEntity> implements QuestionService {
 public class QuestionServiceImpl extends ServiceImpl<QuestionDao, QuestionEntity> implements QuestionService {
 
 
-	private static final String[] EXCEL_HEADER = new String[] { "考试ID", "科目代码", "大题号", "小题号", "满分", "试题内容", "试题答案","作答坐标" };
+	private static final String[] EXCEL_HEADER = new String[] { "考试ID", "科目代码","科目名称", "大题号", "小题号", "满分", "试题内容", "试题答案","作答坐标" };
 	@Autowired
 	@Autowired
 	private SysProperty sysProperty;
 	private SysProperty sysProperty;
 	@Autowired
 	@Autowired
@@ -96,7 +96,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionDao, QuestionEntity
 				if (msgFile.exists()) {
 				if (msgFile.exists()) {
 					msgFile.delete();
 					msgFile.delete();
 				}
 				}
-				FileUtils.write(msgFile, ret.getCountInfo(), "UFT-8");
+				FileUtils.write(msgFile, ret.getCountInfo(), "utf-8");
 			} else {
 			} else {
 				File sucDir = new File(dir.getAbsoluteFile() + "/failed/");
 				File sucDir = new File(dir.getAbsoluteFile() + "/failed/");
 				if (!sucDir.exists()) {
 				if (!sucDir.exists()) {
@@ -113,7 +113,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionDao, QuestionEntity
 				if (msgFile.exists()) {
 				if (msgFile.exists()) {
 					msgFile.delete();
 					msgFile.delete();
 				}
 				}
-				FileUtils.writeLines(msgFile, ret.getErrMsg(), "UFT-8");
+				FileUtils.writeLines(msgFile, ret.getErrMsg(), "utf-8");
 			}
 			}
 		} catch (IOException e) {
 		} catch (IOException e) {
 			throw new StatusException("文件处理出错", e);
 			throw new StatusException("文件处理出错", e);
@@ -182,8 +182,16 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionDao, QuestionEntity
 				msg.append("  科目代码不能超过100个字符");
 				msg.append("  科目代码不能超过100个字符");
 			}
 			}
 			imp.setSubjectCode(subjectCode);
 			imp.setSubjectCode(subjectCode);
+			
+			String subjectName = trimAndNullIfBlank(line.get(EXCEL_HEADER[2]));
+			if (StringUtils.isBlank(subjectName)) {
+				msg.append("  科目名称不能为空");
+			} else if (subjectName.length() > 100) {
+				msg.append("  科目名称不能超过100个字符");
+			}
+			imp.setSubjectName(subjectName);
 
 
-			String mainNum = trimAndNullIfBlank(line.get(EXCEL_HEADER[2]));
+			String mainNum = trimAndNullIfBlank(line.get(EXCEL_HEADER[3]));
 			if (StringUtils.isBlank(mainNum)) {
 			if (StringUtils.isBlank(mainNum)) {
 				msg.append("  大题号不能为空");
 				msg.append("  大题号不能为空");
 			} else if (mainNum.length() > 10) {
 			} else if (mainNum.length() > 10) {
@@ -200,7 +208,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionDao, QuestionEntity
 				}
 				}
 			}
 			}
 
 
-			String subNum = trimAndNullIfBlank(line.get(EXCEL_HEADER[3]));
+			String subNum = trimAndNullIfBlank(line.get(EXCEL_HEADER[4]));
 			if (StringUtils.isBlank(subNum)) {
 			if (StringUtils.isBlank(subNum)) {
 				msg.append("  小题号不能为空");
 				msg.append("  小题号不能为空");
 			} else if (subNum.length() > 10) {
 			} else if (subNum.length() > 10) {
@@ -208,7 +216,7 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionDao, QuestionEntity
 			} 
 			} 
 			imp.setSubNumber(subNum);
 			imp.setSubNumber(subNum);
 
 
-			String fullScore = trimAndNullIfBlank(line.get(EXCEL_HEADER[4]));
+			String fullScore = trimAndNullIfBlank(line.get(EXCEL_HEADER[5]));
 			if (StringUtils.isBlank(fullScore)) {
 			if (StringUtils.isBlank(fullScore)) {
 				msg.append("  满分不能为空");
 				msg.append("  满分不能为空");
 			} else if (fullScore.length() > 10) {
 			} else if (fullScore.length() > 10) {
@@ -225,20 +233,20 @@ public class QuestionServiceImpl extends ServiceImpl<QuestionDao, QuestionEntity
 				}
 				}
 			}
 			}
 
 
-			String content = trimAndNullIfBlank(line.get(EXCEL_HEADER[5]));
+			String content = trimAndNullIfBlank(line.get(EXCEL_HEADER[6]));
 			if (StringUtils.isBlank(content)) {
 			if (StringUtils.isBlank(content)) {
 				msg.append("  试题内容不能为空");
 				msg.append("  试题内容不能为空");
 			}
 			}
 			imp.setContent(content);
 			imp.setContent(content);
 
 
-			String answer = trimAndNullIfBlank(line.get(EXCEL_HEADER[6]));
+			String answer = trimAndNullIfBlank(line.get(EXCEL_HEADER[7]));
 			if (StringUtils.isBlank(answer)) {
 			if (StringUtils.isBlank(answer)) {
 				msg.append("  试题答案不能为空");
 				msg.append("  试题答案不能为空");
 			}
 			}
 			imp.setAnswer(answer);
 			imp.setAnswer(answer);
 
 
 
 
-			String imageSlice = trimAndNullIfBlank(line.get(EXCEL_HEADER[7]));
+			String imageSlice = trimAndNullIfBlank(line.get(EXCEL_HEADER[8]));
 			if (StringUtils.isBlank(imageSlice)) {
 			if (StringUtils.isBlank(imageSlice)) {
 				msg.append("  作答坐标不能为空");
 				msg.append("  作答坐标不能为空");
 			} else if (imageSlice.length() > 1000) {
 			} else if (imageSlice.length() > 1000) {

+ 25 - 2
src/main/java/cn/com/qmth/am/service/impl/StudentScoreServiceImpl.java

@@ -138,7 +138,7 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
 				if (msgFile.exists()) {
 				if (msgFile.exists()) {
 					msgFile.delete();
 					msgFile.delete();
 				}
 				}
-				FileUtils.write(msgFile, ret.getCountInfo(), "UFT-8");
+				FileUtils.write(msgFile, ret.getCountInfo(), "utf-8");
 			} else {
 			} else {
 				File sucDir = new File(dir.getAbsoluteFile() + "/failed/");
 				File sucDir = new File(dir.getAbsoluteFile() + "/failed/");
 				if (!sucDir.exists()) {
 				if (!sucDir.exists()) {
@@ -155,7 +155,7 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
 				if (msgFile.exists()) {
 				if (msgFile.exists()) {
 					msgFile.delete();
 					msgFile.delete();
 				}
 				}
-				FileUtils.writeLines(msgFile, ret.getErrMsg(), "UFT-8");
+				FileUtils.writeLines(msgFile, ret.getErrMsg(), "utf-8");
 			}
 			}
 		} catch (IOException e) {
 		} catch (IOException e) {
 			throw new StatusException("文件处理出错", e);
 			throw new StatusException("文件处理出错", e);
@@ -328,6 +328,7 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
 		for (QuestionEntity q : quetions.values()) {
 		for (QuestionEntity q : quetions.values()) {
 			StudentScoreEntity s = new StudentScoreEntity();
 			StudentScoreEntity s = new StudentScoreEntity();
 			adds.add(s);
 			adds.add(s);
+			s.setQuestionId(q.getId());
 			s.setExamId(student.getExamId());
 			s.setExamId(student.getExamId());
 			s.setAnswerStatus(DataStatus.WAITING);
 			s.setAnswerStatus(DataStatus.WAITING);
 			s.setMainNumber(q.getMainNumber());
 			s.setMainNumber(q.getMainNumber());
@@ -600,4 +601,26 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
 		lw.eq(StudentScoreEntity::getId, id);
 		lw.eq(StudentScoreEntity::getId, id);
 		this.update(wrapper);
 		this.update(wrapper);
 	}
 	}
+	
+	
+	private void resetAnswerStatus() {
+		UpdateWrapper<StudentScoreEntity> wrapper = new UpdateWrapper<>();
+		LambdaUpdateWrapper<StudentScoreEntity> lw = wrapper.lambda();
+		lw.set(StudentScoreEntity::getAnswerStatus, DataStatus.WAITING);
+		lw.eq(StudentScoreEntity::getAnswerStatus, DataStatus.PROCESSING);
+		this.update(wrapper);
+	}
+	private void resetScoreStatus() {
+		UpdateWrapper<StudentScoreEntity> wrapper = new UpdateWrapper<>();
+		LambdaUpdateWrapper<StudentScoreEntity> lw = wrapper.lambda();
+		lw.set(StudentScoreEntity::getScoreStatus, DataStatus.WAITING);
+		lw.eq(StudentScoreEntity::getScoreStatus, DataStatus.PROCESSING);
+		this.update(wrapper);
+	}
+	
+	@Override
+	public void resetStatus() {
+		resetAnswerStatus();
+		resetScoreStatus();
+	}
 }
 }

+ 11 - 3
src/main/java/cn/com/qmth/am/service/impl/StudentServiceImpl.java

@@ -109,7 +109,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
 				if(msgFile.exists()) {
 				if(msgFile.exists()) {
 					msgFile.delete();
 					msgFile.delete();
 				}
 				}
-				FileUtils.write(msgFile, ret.getCountInfo(), "UFT-8");
+				FileUtils.write(msgFile, ret.getCountInfo(), "utf-8");
 			}else {
 			}else {
 				File sucDir=new File(dir.getAbsoluteFile()+"/failed/");
 				File sucDir=new File(dir.getAbsoluteFile()+"/failed/");
 				if(!sucDir.exists()) {
 				if(!sucDir.exists()) {
@@ -126,7 +126,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
 				if(msgFile.exists()) {
 				if(msgFile.exists()) {
 					msgFile.delete();
 					msgFile.delete();
 				}
 				}
-				FileUtils.writeLines(msgFile, ret.getErrMsg(), "UFT-8");
+				FileUtils.writeLines(msgFile, ret.getErrMsg(), "utf-8");
 			}
 			}
 		} catch (IOException e) {
 		} catch (IOException e) {
 			throw new StatusException("文件处理出错", e);
 			throw new StatusException("文件处理出错", e);
@@ -175,6 +175,7 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
 			StringBuilder msg = new StringBuilder();
 			StringBuilder msg = new StringBuilder();
 
 
 			StudentEntity imp = new StudentEntity();
 			StudentEntity imp = new StudentEntity();
+			imp.setDataStatus(DataStatus.WAITING);
 			String examId = trimAndNullIfBlank(line.get(EXCEL_HEADER[0]));
 			String examId = trimAndNullIfBlank(line.get(EXCEL_HEADER[0]));
 			if (StringUtils.isBlank(examId)) {
 			if (StringUtils.isBlank(examId)) {
 				msg.append("  考试ID不能为空");
 				msg.append("  考试ID不能为空");
@@ -314,5 +315,12 @@ public class StudentServiceImpl extends ServiceImpl<StudentDao, StudentEntity> i
 		lw.eq(StudentEntity::getDataStatus, from);
 		lw.eq(StudentEntity::getDataStatus, from);
 		this.update(wrapper);
 		this.update(wrapper);
 	}
 	}
-
+	@Override
+	public void resetStatus() {
+		UpdateWrapper<StudentEntity> wrapper = new UpdateWrapper<>();
+		LambdaUpdateWrapper<StudentEntity> lw = wrapper.lambda();
+		lw.set(StudentEntity::getDataStatus, DataStatus.WAITING);
+		lw.eq(StudentEntity::getDataStatus, DataStatus.PROCESSING);
+		this.update(wrapper);
+	}
 }
 }

二進制
template/question-import.xlsx