|
@@ -5,7 +5,6 @@ import java.io.FileInputStream;
|
|
|
import java.io.FileNotFoundException;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
-import java.math.BigDecimal;
|
|
|
import java.nio.charset.StandardCharsets;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Arrays;
|
|
@@ -25,14 +24,12 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSONArray;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
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.AutoScoreResult;
|
|
|
import com.qmth.boot.core.ai.model.ocr.OcrType;
|
|
|
import com.qmth.boot.core.ai.service.AiService;
|
|
@@ -49,6 +46,7 @@ import com.qmth.boot.tools.models.ByteArray;
|
|
|
|
|
|
import cn.com.qmth.am.bean.AiMarkingDto;
|
|
|
import cn.com.qmth.am.bean.AnswerImageDto;
|
|
|
+import cn.com.qmth.am.bean.AutoScoreEnRequest;
|
|
|
import cn.com.qmth.am.bean.ImageSlice;
|
|
|
import cn.com.qmth.am.bean.ImportResult;
|
|
|
import cn.com.qmth.am.bean.StudentInfo;
|
|
@@ -573,8 +571,8 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
// System.out.println(score+d.substring(start,d.length()));
|
|
|
// }
|
|
|
// String[] items = d.split("\\[\\[[0-9](.[0-9]+){0,1}分\\]\\]");
|
|
|
- String code = "2021113801";
|
|
|
- String s = "https://file.markingcloud.com/" + getMarkingCloudPath(1379, getSuffix(code), code, 1, "jpg");
|
|
|
+ String code = "23635174";
|
|
|
+ String s = "https://file.markingcloud.com/" + getMarkingCloudPath(725, getSuffix(code), code, 2, "jpg");
|
|
|
System.out.println(s);
|
|
|
}
|
|
|
|
|
@@ -699,22 +697,17 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
if (CollectionUtils.isEmpty(q.getAnswer())) {
|
|
|
return;
|
|
|
}
|
|
|
- AutoScoreRequest req = new AutoScoreRequest();
|
|
|
+ AutoScoreEnRequest req = new AutoScoreEnRequest();
|
|
|
req.setQuestionBody(q.getContent());
|
|
|
req.setStandardAnswer(q.getAnswer());
|
|
|
req.setStudentAnswer(score.getAnswer());
|
|
|
req.setSubjectName(q.getSubjectName());
|
|
|
req.setTotalScore(q.getFullScore());
|
|
|
- req.setIntervalScore(0.5);
|
|
|
+ req.setIntervalScore(0.1);
|
|
|
+ req.setQuestionTitle(q.getTitle());
|
|
|
AutoScoreResult ret = aiMarkingDispose(dto, org, req);
|
|
|
if (ret != null) {
|
|
|
- List<Double> stepScore = new ArrayList<>();
|
|
|
- for (Double d : ret.getStepScore()) {
|
|
|
- stepScore.add(d);
|
|
|
- }
|
|
|
- double total = Arrays.stream(ret.getStepScore()).mapToObj(BigDecimal::valueOf)
|
|
|
- .reduce(BigDecimal.ZERO, BigDecimal::add).doubleValue();
|
|
|
- updateScore(score.getId(), total, stepScore);
|
|
|
+ updateScore(score.getId(), ret.getTotalScore());
|
|
|
} else {
|
|
|
updateScoreNone(score.getId(), 0.0);
|
|
|
}
|
|
@@ -723,7 +716,7 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private AutoScoreResult aiMarkingDispose(AiMarkingDto dto, OrgInfo org, AutoScoreRequest req) {
|
|
|
+ private AutoScoreResult aiMarkingDispose(AiMarkingDto dto, OrgInfo org, AutoScoreEnRequest req) {
|
|
|
SignatureInfo signature = null;
|
|
|
if (ModelTypeBak.solar.getCode().equals(sysProperty.getMarkingModel())) {
|
|
|
signature = SignatureInfo.secret(org.getAccessKey(), org.getAccessSecret());
|
|
@@ -759,12 +752,11 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void updateScore(Long id, Double aiScore, List<Double> scoreStep) {
|
|
|
+ private void updateScore(Long id, Double aiScore) {
|
|
|
UpdateWrapper<StudentScoreEntity> wrapper = new UpdateWrapper<>();
|
|
|
LambdaUpdateWrapper<StudentScoreEntity> lw = wrapper.lambda();
|
|
|
lw.set(StudentScoreEntity::getScoreStatus, DataStatus.SUCCESS);
|
|
|
lw.set(StudentScoreEntity::getAiScore, aiScore);
|
|
|
- lw.set(StudentScoreEntity::getStepScore, JSONArray.toJSONString(scoreStep));
|
|
|
lw.set(StudentScoreEntity::getErrMsg, null);
|
|
|
lw.set(StudentScoreEntity::getScoreNone, false);
|
|
|
lw.eq(StudentScoreEntity::getId, id);
|