|
@@ -30,6 +30,7 @@ import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
import com.qmth.boot.core.ai.client.OcrApiClient;
|
|
import com.qmth.boot.core.ai.client.OcrApiClient;
|
|
import com.qmth.boot.core.ai.model.llm.AutoScoreRequest;
|
|
import com.qmth.boot.core.ai.model.llm.AutoScoreRequest;
|
|
|
|
+import com.qmth.boot.core.ai.model.llm.AutoScoreResult;
|
|
import com.qmth.boot.core.ai.model.ocr.OcrType;
|
|
import com.qmth.boot.core.ai.model.ocr.OcrType;
|
|
import com.qmth.boot.core.ai.service.AiService;
|
|
import com.qmth.boot.core.ai.service.AiService;
|
|
import com.qmth.boot.core.exception.StatusException;
|
|
import com.qmth.boot.core.exception.StatusException;
|
|
@@ -60,7 +61,6 @@ import cn.com.qmth.am.enums.ImportFileName;
|
|
import cn.com.qmth.am.service.QuestionService;
|
|
import cn.com.qmth.am.service.QuestionService;
|
|
import cn.com.qmth.am.service.StudentScoreService;
|
|
import cn.com.qmth.am.service.StudentScoreService;
|
|
import cn.com.qmth.am.service.StudentService;
|
|
import cn.com.qmth.am.service.StudentService;
|
|
-import cn.com.qmth.am.utils.Calculator;
|
|
|
|
import cn.com.qmth.am.utils.ImageUtil;
|
|
import cn.com.qmth.am.utils.ImageUtil;
|
|
|
|
|
|
@Service
|
|
@Service
|
|
@@ -494,9 +494,29 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
}
|
|
}
|
|
|
|
|
|
public static void main(String[] args) {
|
|
public static void main(String[] args) {
|
|
- String code = "2022301052070";
|
|
|
|
- String s = "https://file.markingcloud.com/" + getMarkingCloudPath(1342, getSuffix(code), code, 1, "jpg");
|
|
|
|
- System.out.println(s);
|
|
|
|
|
|
+// Pattern pattern = Pattern.compile("\\[\\[([0-9](.[0-9]+){0,1})分\\]\\]");
|
|
|
|
+// String code = "2022301052070";
|
|
|
|
+// String s = "https://file.markingcloud.com/" + getMarkingCloudPath(1342, getSuffix(code), code, 1, "jpg");
|
|
|
|
+// String d="[[1.1分]]中国共产党是中国特色社会主义事业的坚强领导核心。\n"
|
|
|
|
+// + "[[1.2分]]中国共产党的领导地位是在历史奋斗中形成的。\n"
|
|
|
|
+// + "[[1.3分]]中国共产党领导是人民当家作主的可靠保障。\n"
|
|
|
|
+// + "[[1.4分]]中国共产党领导关系中国特色社会主义的性质、方向和命运。\n"
|
|
|
|
+// + "[[2分]]中国共产党领导是实现中华民族伟大复兴的根本保证。";
|
|
|
|
+// Matcher matcher = pattern.matcher(d);
|
|
|
|
+// int start=0;
|
|
|
|
+// double score=0.0;
|
|
|
|
+// while (matcher.find()) {
|
|
|
|
+// if(start!=0) {
|
|
|
|
+// System.out.println(score+d.substring(start,matcher.start()));
|
|
|
|
+// }
|
|
|
|
+// score=Double.valueOf(matcher.group(1));
|
|
|
|
+// start=matcher.end();
|
|
|
|
+// }
|
|
|
|
+// if(start<d.length()) {
|
|
|
|
+// System.out.println(score+d.substring(start,d.length()));
|
|
|
|
+// }
|
|
|
|
+// String[] items = d.split("\\[\\[[0-9](.[0-9]+){0,1}分\\]\\]");
|
|
|
|
+// System.out.println(s);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
@@ -592,9 +612,9 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
req.setStandardAnswer(q.getAnswer());
|
|
req.setStandardAnswer(q.getAnswer());
|
|
req.setStudentAnswer(score.getAnswer());
|
|
req.setStudentAnswer(score.getAnswer());
|
|
req.setSubjectName(q.getSubjectName());
|
|
req.setSubjectName(q.getSubjectName());
|
|
- Double ret = aiMarkingDispose(dto, org, req);
|
|
|
|
|
|
+ AutoScoreResult ret = aiMarkingDispose(dto, org, req);
|
|
if (ret != null) {
|
|
if (ret != null) {
|
|
- updateScore(score.getId(), Calculator.multiply(q.getFullScore(), ret), ret);
|
|
|
|
|
|
+ updateScore(score.getId(), ret.getTotalScore(), null);
|
|
} else {
|
|
} else {
|
|
updateScoreNone(score.getId(), 0.0, 0.0);
|
|
updateScoreNone(score.getId(), 0.0, 0.0);
|
|
}
|
|
}
|
|
@@ -619,7 +639,7 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|
|
- private Double aiMarkingDispose(AiMarkingDto dto, OrgInfo org, AutoScoreRequest req) {
|
|
|
|
|
|
+ private AutoScoreResult aiMarkingDispose(AiMarkingDto dto, OrgInfo org, AutoScoreRequest req) {
|
|
SignatureInfo signature = SignatureInfo.secret(org.getAccessKey(), org.getAccessSecret());
|
|
SignatureInfo signature = SignatureInfo.secret(org.getAccessKey(), org.getAccessSecret());
|
|
try {
|
|
try {
|
|
return aiService.autoScore(req, signature);
|
|
return aiService.autoScore(req, signature);
|