Accept Merge Request #130: (hyc -> master)

Merge Request: 【新增】mysql本地判分

Created By: @华允传
Accepted By: @华允传
URL: https://g-iswv8783.coding.net/p/education/d/pengchen-exam-java/git/merge/130?initial=true
This commit is contained in:
华允传
2025-06-24 10:35:16 +08:00
committed by Coding
12 changed files with 1989 additions and 57 deletions

View File

@@ -41,6 +41,7 @@ public interface ExamQuestionMapper extends BaseMapperX<ExamQuestion>
default PageResult<ExamQuestion> selectExamQuestionList(QuestionVo questionVo) { default PageResult<ExamQuestion> selectExamQuestionList(QuestionVo questionVo) {
return selectPage(questionVo, new LambdaQueryWrapperX<ExamQuestion>() return selectPage(questionVo, new LambdaQueryWrapperX<ExamQuestion>()
.likeIfPresent(ExamQuestion::getQuNum, questionVo.getQuNum()) .likeIfPresent(ExamQuestion::getQuNum, questionVo.getQuNum())
.likeIfPresent(ExamQuestion::getContent, questionVo.getContent())
.likeIfPresent(ExamQuestion::getQuId,questionVo.getQuId()) .likeIfPresent(ExamQuestion::getQuId,questionVo.getQuId())
.likeIfPresent(ExamQuestion::getKeywords,questionVo.getKeywords()) .likeIfPresent(ExamQuestion::getKeywords,questionVo.getKeywords())
.likeIfPresent(ExamQuestion::getQuLevel, questionVo.getQuLevel()) .likeIfPresent(ExamQuestion::getQuLevel, questionVo.getQuLevel())

View File

@@ -4,16 +4,16 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionKeywordMapper"> <mapper namespace="pc.exam.pp.module.exam.dal.mysql.question.ExamQuestionKeywordMapper">
<resultMap type="ExamQuestionKeyword" id="ExamQuestionKeywordResult"> <resultMap type="ExamQuestionKeyword" id="ExamQuestionKeywordResult">
<result property="keywordId" column="keyword_id" /> <result property="keywordId" column="keyword_id" />
<result property="quId" column="qu_id" /> <result property="quId" column="qu_id" />
<result property="keyword" column="keyword" /> <result property="keyword" column="keyword" />
<result property="scoreRate" column="score_rate" /> <result property="scoreRate" column="score_rate" />
</resultMap> </resultMap>
<sql id="selectExamQuestionKeywordVo"> <sql id="selectExamQuestionKeywordVo">
select keyword_id, qu_id, keyword, score_rate from exam_question_keyword select keyword_id, qu_id, keyword, score_rate from exam_question_keyword
</sql> </sql>
<select id="selectExamQuestionKeywordList" parameterType="ExamQuestionKeyword" resultMap="ExamQuestionKeywordResult"> <select id="selectExamQuestionKeywordList" parameterType="ExamQuestionKeyword" resultMap="ExamQuestionKeywordResult">
<include refid="selectExamQuestionKeywordVo"/> <include refid="selectExamQuestionKeywordVo"/>

View File

@@ -22,4 +22,4 @@ public interface ConfigMapper extends BaseMapperX<ConfigDO> {
.betweenIfPresent(ConfigDO::getCreateTime, reqVO.getCreateTime())); .betweenIfPresent(ConfigDO::getCreateTime, reqVO.getCreateTime()));
} }
} }

View File

@@ -2,18 +2,14 @@ package pc.exam.pp.module.judgement.controller.admin.Browser;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import pc.exam.pp.framework.common.pojo.CommonResult;
import pc.exam.pp.module.judgement.controller.service.browser.IBrowserServerice; import pc.exam.pp.module.judgement.controller.service.browser.IBrowserServerice;
import java.io.IOException;
@RestController @RestController
@RequestMapping("/tool/Browser") @RequestMapping("/tool/Browser")
public class BrowserComtroller { public class BrowserController {
@Autowired @Autowired
private IBrowserServerice browserServerice; private IBrowserServerice browserServerice;

View File

@@ -1,13 +1,14 @@
package pc.exam.pp.module.judgement.controller.admin.Mysql; package pc.exam.pp.module.judgement.controller.admin.Mysql;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import pc.exam.pp.framework.common.pojo.CommonResult; import pc.exam.pp.framework.common.pojo.CommonResult;
import pc.exam.pp.module.judgement.controller.admin.autoTools.vo.StuPaperReqVo;
import pc.exam.pp.module.judgement.controller.service.mysql.IMysqlLocalService;
import pc.exam.pp.module.judgement.controller.service.mysql.IMysqlServerice; import pc.exam.pp.module.judgement.controller.service.mysql.IMysqlServerice;
import java.io.IOException; import java.io.IOException;
import java.math.BigDecimal;
import java.sql.SQLException; import java.sql.SQLException;
@RestController @RestController
@@ -18,8 +19,18 @@ public class MysqlController {
@Autowired @Autowired
private IMysqlServerice mysqlServerice; private IMysqlServerice mysqlServerice;
@Autowired
private IMysqlLocalService mysqlLocalService;
/**
* 删除 本地学生的连接和库
* @param tName
* @throws Exception
*/
@GetMapping("/delMysqlConnect")
public void get(@RequestParam("tName") String tName) throws Exception {
mysqlLocalService.delMysqlConnect(tName);
}
/** /**
* Mysql判分 * Mysql判分

View File

@@ -50,14 +50,14 @@ public class BrowserServericeImpl implements IBrowserServerice {
List<ExamQuestionAnswer> answerList = examQuestionAnswerMapper.selectExamQuestionAnswerByQuId(question.getQuId()); List<ExamQuestionAnswer> answerList = examQuestionAnswerMapper.selectExamQuestionAnswerByQuId(question.getQuId());
//判断如果类型为1为添加到文件夹的html后缀加 .html //判断如果类型为1为添加到文件夹的html后缀加 .html
for (ExamQuestionAnswer answer : answerList) { // for (ExamQuestionAnswer answer : answerList) {
if ("添加到文件夹".equals(answer.getContentIn())) { // if ("添加到文件夹".equals(answer.getContentIn())) {
String fileName = answer.getContent(); // String fileName = answer.getContent();
if (!fileName.endsWith(".html")) { // if (!fileName.endsWith(".html")) {
answer.setContent(fileName + ".html"); // answer.setContent(fileName + ".html");
} // }
} // }
} // }

View File

@@ -0,0 +1,16 @@
package pc.exam.pp.module.judgement.controller.service.mysql;
import pc.exam.pp.framework.common.pojo.CommonResult;
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion;
import pc.exam.pp.module.judgement.service.auto_tools.vo.SourceAndText;
import java.io.File;
import java.io.IOException;
import java.sql.SQLException;
public interface IMysqlLocalService {
SourceAndText Judgement(double sorce, File file, ExamQuestion examQuestion, String judgementStr) throws IOException, SQLException;
void delMysqlConnect(String tName);
}

View File

@@ -1,6 +1,7 @@
package pc.exam.pp.module.judgement.controller.service.mysql; package pc.exam.pp.module.judgement.controller.service.mysql;
import pc.exam.pp.framework.common.pojo.CommonResult;
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion; import pc.exam.pp.module.exam.dal.dataobject.ExamQuestion;
import pc.exam.pp.module.exam.dal.dataobject.ExamQuestionAnswer; import pc.exam.pp.module.exam.dal.dataobject.ExamQuestionAnswer;
import pc.exam.pp.module.judgement.service.auto_tools.vo.SourceAndText; import pc.exam.pp.module.judgement.service.auto_tools.vo.SourceAndText;

View File

@@ -59,7 +59,7 @@ public class MysqlServericeImpl implements IMysqlServerice {
public SourceAndText Judgement(double score, File filepath, ExamQuestion examQuestion, String judgementStr) throws IOException, SQLException { public SourceAndText Judgement(double score, File filepath, ExamQuestion examQuestion, String judgementStr) throws IOException, SQLException {
SourceAndText sourceAndText = new SourceAndText(); SourceAndText sourceAndText = new SourceAndText();
double scoreTotal =0.0; double scoreTotal =0.0;
String fileUrl= examQuestionAnswerMapper.selectAnswerFile(examQuestion.getQuId()); String fileUrl= examQuestionAnswerMapper.selectAnswerFile(examQuestion.getQuId());
String path = ZipUtil.downloadStudentFile(fileUrl, "data"); String path = ZipUtil.downloadStudentFile(fileUrl, "data");
// 4、获取到得是zip文件需要解压 // 4、获取到得是zip文件需要解压
String stuFilePath = ZipUtil.unzipToNamedFolder(path); String stuFilePath = ZipUtil.unzipToNamedFolder(path);
@@ -835,11 +835,9 @@ public class MysqlServericeImpl implements IMysqlServerice {
} }
private static String compareTables(Set<Map<String, String>> standardSet, Set<Map<String, String>> studentSet, String dbTable, String tableName,String tableNameStu,String judgementStr) { private static String compareTables(Set<Map<String, String>> standardSet, Set<Map<String, String>> studentSet, String dbTable, String tableName,String tableNameStu,String judgementStr) {
String yuju="";
int index = 1; int index = 1;
// 判断表名是否一致 // 判断表名是否一致
String tableNameCheck = tableName.equalsIgnoreCase(tableNameStu) ? "" : "x"; String tableNameCheck = tableName.equalsIgnoreCase(tableNameStu) ? "" : "x";
// 输出 // 输出
System.out.printf("%02d.【数据表】【%s】【名称】【%s】【%s】\n", index, dbTable, tableName, tableNameCheck); System.out.printf("%02d.【数据表】【%s】【名称】【%s】【%s】\n", index, dbTable, tableName, tableNameCheck);
appendToFile(answerLogPath, "%02d.【数据表】【%s】【名称】【%s】【%s】\n", index, dbTable, tableName, tableNameCheck); appendToFile(answerLogPath, "%02d.【数据表】【%s】【名称】【%s】【%s】\n", index, dbTable, tableName, tableNameCheck);
@@ -855,45 +853,46 @@ public class MysqlServericeImpl implements IMysqlServerice {
String fullName = dbTable + "." + columnName; String fullName = dbTable + "." + columnName;
String nameCheck = stuCol != null ? "" : "x"; String nameCheck = stuCol != null ? "" : "x";
judgementStr = HtmlAppender.appendHtmlLineMysql(judgementStr, "%02d.【字段】【%s】【名称】【%s】【%s】\n", index++, fullName, columnName, nameCheck); System.out.printf("%02d.【字段】【%s】【名称】【%s】【%s】\n", ++index, fullName, columnName, nameCheck);
appendToFile(answerLogPath, "%02d.【字段】【%s】【名称】【%s】【%s】\n", index++, fullName, columnName, nameCheck); judgementStr = HtmlAppender.appendHtmlLineMysql(judgementStr, "%02d.【字段】【%s】【名称】【%s】【%s】\n", index, fullName, columnName, nameCheck);
appendToFile(answerLogPath, "%02d.【字段】【%s】【名称】【%s】【%s】\n", index, fullName, columnName, nameCheck);
if (stuCol != null) { if (stuCol != null) {
MysqlVo mysqlVo1 = compareField(index, fullName, "类型", stdCol.get("COLUMN_TYPE"), stuCol.get("COLUMN_TYPE"),judgementStr); MysqlVo mysqlVo1 = compareField(index, fullName, "类型", stdCol.get("COLUMN_TYPE"), stuCol.get("COLUMN_TYPE"),judgementStr);
index=mysqlVo1.getIndex(); index=mysqlVo1.getIndex();
yuju=mysqlVo1.getText(); judgementStr=mysqlVo1.getText();
MysqlVo mysqlVo2 = compareField(index, fullName, "允许为空", stdCol.get("IS_NULLABLE"), stuCol.get("IS_NULLABLE"),yuju); MysqlVo mysqlVo2 = compareField(index, fullName, "允许为空", stdCol.get("IS_NULLABLE"), stuCol.get("IS_NULLABLE"),judgementStr);
index=mysqlVo2.getIndex(); index=mysqlVo2.getIndex();
yuju=mysqlVo2.getText(); judgementStr=mysqlVo2.getText();
MysqlVo mysqlVo3 = compareField(index, fullName, "扩展", stdCol.get("EXTRA"), stuCol.get("EXTRA"),yuju); MysqlVo mysqlVo3 = compareField(index, fullName, "扩展", stdCol.get("EXTRA"), stuCol.get("EXTRA"),judgementStr);
index=mysqlVo3.getIndex(); index=mysqlVo3.getIndex();
yuju=mysqlVo3.getText(); judgementStr=mysqlVo3.getText();
MysqlVo mysqlVo4 = compareField(index, fullName, "键类型", stdCol.get("COLUMN_KEY"), stuCol.get("COLUMN_KEY"),yuju); MysqlVo mysqlVo4 = compareField(index, fullName, "键类型", stdCol.get("COLUMN_KEY"), stuCol.get("COLUMN_KEY"),judgementStr);
yuju=mysqlVo4.getText(); judgementStr=mysqlVo4.getText();
} else { } else {
// 缺失字段,直接输出所有属性错误 // 缺失字段,直接输出所有属性错误
MysqlVo mysqlVo1 = printMissing(index, fullName, "类型", stdCol.get("COLUMN_TYPE"),judgementStr); MysqlVo mysqlVo1 = printMissing(index, fullName, "类型", stdCol.get("COLUMN_TYPE"),judgementStr);
index=mysqlVo1.getIndex(); index=mysqlVo1.getIndex();
yuju=mysqlVo1.getText(); judgementStr=mysqlVo1.getText();
MysqlVo mysqlVo2 = printMissing(index, fullName, "允许为空", stdCol.get("IS_NULLABLE"),yuju); MysqlVo mysqlVo2 = printMissing(index, fullName, "允许为空", stdCol.get("IS_NULLABLE"),judgementStr);
index=mysqlVo2.getIndex(); index=mysqlVo2.getIndex();
yuju=mysqlVo2.getText(); judgementStr=mysqlVo2.getText();
MysqlVo mysqlVo3 = printMissing(index, fullName, "扩展", stdCol.get("EXTRA"),yuju); MysqlVo mysqlVo3 = printMissing(index, fullName, "扩展", stdCol.get("EXTRA"),judgementStr);
index=mysqlVo3.getIndex(); index=mysqlVo3.getIndex();
yuju=mysqlVo3.getText(); judgementStr=mysqlVo3.getText();
MysqlVo mysqlVo4 = printMissing(index, fullName, "键类型", stdCol.get("COLUMN_KEY"),yuju); MysqlVo mysqlVo4 = printMissing(index, fullName, "键类型", stdCol.get("COLUMN_KEY"),judgementStr);
yuju=mysqlVo4.getText(); judgementStr=mysqlVo4.getText();
} }
} }
return yuju; return judgementStr;
} }
private static MysqlVo compareField(int index, String fullName, String property, String stdValue, String stuValue, String judgementStr) { private static MysqlVo compareField(int index, String fullName, String property, String stdValue, String stuValue, String judgementStr) {
MysqlVo mysqlVo=new MysqlVo(); MysqlVo mysqlVo=new MysqlVo();
String mark = stdValue.equalsIgnoreCase(stuValue) ? "" : "x"; String mark = stdValue.equalsIgnoreCase(stuValue) ? "" : "x";
System.out.printf("%02d.【字段】【%s】【%s】【%s】【%s】\n", index, fullName, property, stuValue, mark); System.out.printf("%02d.【字段】【%s】【%s】【%s】【%s】\n", index + 1, fullName, property, stuValue, mark);
appendToFile(answerLogPath, "%02d.【字段】【%s】【%s】【%s】【%s】\n", index, fullName, property, stuValue, mark); appendToFile(answerLogPath, "%02d.【字段】【%s】【%s】【%s】【%s】\n", index + 1, fullName, property, stuValue, mark);
judgementStr = HtmlAppender.appendHtmlLineMysql(judgementStr, "%02d.【字段】【%s】【%s】【%s】【%s】\n", index, fullName, property, stuValue, mark); judgementStr = HtmlAppender.appendHtmlLineMysql(judgementStr, "%02d.【字段】【%s】【%s】【%s】【%s】\n", index + 1, fullName, property, stuValue, mark);
mysqlVo.setText(judgementStr); mysqlVo.setText(judgementStr);
mysqlVo.setIndex(index + 1); mysqlVo.setIndex(index + 1);
return mysqlVo; return mysqlVo;
@@ -901,9 +900,9 @@ public class MysqlServericeImpl implements IMysqlServerice {
private static MysqlVo printMissing(int index, String fullName, String property, String stdValue,String judgementStr) { private static MysqlVo printMissing(int index, String fullName, String property, String stdValue,String judgementStr) {
MysqlVo mysqlVo=new MysqlVo(); MysqlVo mysqlVo=new MysqlVo();
System.out.printf("%02d.【字段】【%s】【%s】【%s】【x】\n", index, fullName, property, stdValue); System.out.printf("%02d.【字段】【%s】【%s】【%s】【x】\n", index + 1, fullName, property, stdValue);
appendToFile(answerLogPath, "%02d.【字段】【%s】【%s】【%s】【x】\n", index, fullName, property, stdValue); appendToFile(answerLogPath, "%02d.【字段】【%s】【%s】【%s】【x】\n", index + 1, fullName, property, stdValue);
judgementStr = HtmlAppender.appendHtmlLineMysql(judgementStr, "%02d.【字段】【%s】【%s】【%s】【x】\n", index, fullName, property, stdValue); judgementStr = HtmlAppender.appendHtmlLineMysql(judgementStr, "%02d.【字段】【%s】【%s】【%s】【x】\n", index + 1, fullName, property, stdValue);
mysqlVo.setText(judgementStr); mysqlVo.setText(judgementStr);
mysqlVo.setIndex(index + 1); mysqlVo.setIndex(index + 1);
return mysqlVo; return mysqlVo;

View File

@@ -2,6 +2,7 @@ package pc.exam.pp.module.judgement.controller.service.mysql;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import pc.exam.pp.module.exam.dal.mysql.paper.EducationPaperMapper;
import pc.exam.pp.module.judgement.utils.EndStuMonitorUtils; import pc.exam.pp.module.judgement.utils.EndStuMonitorUtils;
@Service @Service
@@ -13,10 +14,9 @@ public class testServiceImpl implements testservice {
public boolean test() { public boolean test() {
String s = endStuMonitorUtils.endStuMonitor("160", "2bf4510550e34d85a852394cea61b455"); // String s = endStuMonitorUtils.endStuMonitor("160", "2bf4510550e34d85a852394cea61b455");
//
endStuMonitorUtils.endStuMonitor("160","2bf4510550e34d85a852394cea61b455",20.0); // endStuMonitorUtils.endStuMonitor("160","2bf4510550e34d85a852394cea61b455",20.0);
return true; return true;
} }

View File

@@ -0,0 +1,16 @@
package pc.exam.pp.module.judgement.controller.service.mysql.vo;
import lombok.Data;
@Data
public class MysqlBooleanVo {
/**
* 是否正确
*/
private boolean flag;
/**
* 文本
*/
private String text;
}