|
@@ -457,7 +457,7 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
|
|
|
private String getImageUrl(StudentScoreEntity score, QuestionEntity q, Integer pageIndex) {
|
|
|
if (DataType.MARKING_CLOUD.equals(sysProperty.getDataType())) {
|
|
|
- return getImageUrlFromMarkingCloud(score,pageIndex);
|
|
|
+ return getImageUrlFromMarkingCloud(score, pageIndex);
|
|
|
} else if (DataType.TEACH_CLOUD.equals(sysProperty.getDataType())) {
|
|
|
return getImageUrlFromTeachCloud(score, q, pageIndex);
|
|
|
} else {
|
|
@@ -470,26 +470,34 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
getSuffix(score.getStudentCode()), score.getStudentCode(), pageIndex, "jpg");
|
|
|
}
|
|
|
|
|
|
- private String getSuffix(String input) {
|
|
|
+ private static String getSuffix(String input) {
|
|
|
return StringUtils.trimToEmpty(input).substring(Math.max(0, input.length() - 3));
|
|
|
}
|
|
|
|
|
|
private String getImageUrlFromTeachCloud(StudentScoreEntity score, QuestionEntity q, Integer pageIndex) {
|
|
|
- int paperNum=(pageIndex+1)/2;
|
|
|
- int page=1;
|
|
|
- if(pageIndex%2==0) {
|
|
|
- page=2;
|
|
|
+ int paperNum = (pageIndex + 1) / 2;
|
|
|
+ int page = 1;
|
|
|
+ if (pageIndex % 2 == 0) {
|
|
|
+ page = 2;
|
|
|
}
|
|
|
- return sysProperty.getImageServer() + "/" + getTeachCloudPath(score.getExamId(),
|
|
|
- score.getSubjectCode(), score.getStudentCode(),paperNum, page, "jpg");
|
|
|
+ return sysProperty.getImageServer() + "/" + getTeachCloudPath(score.getExamId(), score.getSubjectCode(),
|
|
|
+ score.getStudentCode(), paperNum, page, "jpg");
|
|
|
}
|
|
|
+
|
|
|
private String getTeachCloudPath(Object... param) {
|
|
|
return String.format("sheet/%d/%s/%s/%d-%d.%s", param);
|
|
|
}
|
|
|
- private String getMarkingCloudPath(Object... param) {
|
|
|
+
|
|
|
+ private static String getMarkingCloudPath(Object... param) {
|
|
|
return String.format("sheet/%d/%s/%s-%d.%s", param);
|
|
|
}
|
|
|
|
|
|
+ public static void main(String[] args) {
|
|
|
+ String s = "https://file.markingcloud.com/"
|
|
|
+ + getMarkingCloudPath(1342, getSuffix("2020302191191"), "2020302191191", 1, "jpg");
|
|
|
+ System.out.println(s);
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public StudentScoreImageDto pollStudentScoreImage() {
|
|
|
try {
|
|
@@ -507,7 +515,7 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
String ret = ocrDispose(dto, org);
|
|
|
if (ret != null) {
|
|
|
updateAnswer(dto.getStudentScoreId(), ret);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
ocrErr(dto, "ocr失败,返回null");
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
@@ -558,13 +566,12 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
studentService.updateStatus(dto.getStudentId(), DataStatus.FAILED);
|
|
|
}
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public List<StudentScoreEntity> findAllToAiMarking() {
|
|
|
QueryWrapper<StudentScoreEntity> wrapper = new QueryWrapper<>();
|
|
|
LambdaQueryWrapper<StudentScoreEntity> lw = wrapper.lambda();
|
|
|
lw.eq(StudentScoreEntity::getAnswerStatus, DataStatus.SUCCESS);
|
|
|
- lw.in(StudentScoreEntity::getScoreStatus, DataStatus.WAITING,DataStatus.FAILED);
|
|
|
+ lw.in(StudentScoreEntity::getScoreStatus, DataStatus.WAITING, DataStatus.FAILED);
|
|
|
return this.list(wrapper);
|
|
|
}
|
|
|
|
|
@@ -586,12 +593,12 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
req.setSubjectName(q.getSubjectName());
|
|
|
Double ret = aiMarkingDispose(dto, org, req);
|
|
|
if (ret != null) {
|
|
|
- updateScore(score.getId(), Calculator.multiply(q.getFullScore(), ret),ret);
|
|
|
+ updateScore(score.getId(), Calculator.multiply(q.getFullScore(), ret), ret);
|
|
|
} else {
|
|
|
updateScoreNone(score.getId(), 0.0, 0.0);
|
|
|
}
|
|
|
if (allSuccess(score.getStudentId())) {
|
|
|
- studentService.updateStatus(score.getStudentId(),DataStatus.SUCCESS);
|
|
|
+ studentService.updateStatus(score.getStudentId(), DataStatus.SUCCESS);
|
|
|
}
|
|
|
} catch (Exception e) {
|
|
|
aiScoreErr(dto, e.getMessage());
|
|
@@ -639,7 +646,7 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void updateScore(Long id, Double aiScore,Double scoreRatio) {
|
|
|
+ private void updateScore(Long id, Double aiScore, Double scoreRatio) {
|
|
|
UpdateWrapper<StudentScoreEntity> wrapper = new UpdateWrapper<>();
|
|
|
LambdaUpdateWrapper<StudentScoreEntity> lw = wrapper.lambda();
|
|
|
lw.set(StudentScoreEntity::getScoreStatus, DataStatus.SUCCESS);
|
|
@@ -649,8 +656,8 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
lw.eq(StudentScoreEntity::getId, id);
|
|
|
this.update(wrapper);
|
|
|
}
|
|
|
-
|
|
|
- private void updateScoreNone(Long id, Double aiScore,Double scoreRatio) {
|
|
|
+
|
|
|
+ private void updateScoreNone(Long id, Double aiScore, Double scoreRatio) {
|
|
|
UpdateWrapper<StudentScoreEntity> wrapper = new UpdateWrapper<>();
|
|
|
LambdaUpdateWrapper<StudentScoreEntity> lw = wrapper.lambda();
|
|
|
lw.set(StudentScoreEntity::getScoreStatus, DataStatus.SUCCESS);
|
|
@@ -664,7 +671,7 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
|
|
|
private void aiScoreErr(AiMarkingDto dto, String err) {
|
|
|
updateScoreErr(dto.getScoreInfo().getId(), err);
|
|
|
- studentService.updateStatus(dto.getScoreInfo().getStudentId(),DataStatus.FAILED);
|
|
|
+ studentService.updateStatus(dto.getScoreInfo().getStudentId(), DataStatus.FAILED);
|
|
|
}
|
|
|
|
|
|
private void updateScoreErr(Long id, String err) {
|
|
@@ -675,8 +682,7 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
lw.eq(StudentScoreEntity::getId, id);
|
|
|
this.update(wrapper);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
+
|
|
|
private void resetAnswerStatus() {
|
|
|
UpdateWrapper<StudentScoreEntity> wrapper = new UpdateWrapper<>();
|
|
|
LambdaUpdateWrapper<StudentScoreEntity> lw = wrapper.lambda();
|
|
@@ -684,6 +690,7 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
lw.eq(StudentScoreEntity::getAnswerStatus, DataStatus.PROCESSING);
|
|
|
this.update(wrapper);
|
|
|
}
|
|
|
+
|
|
|
private void resetScoreStatus() {
|
|
|
UpdateWrapper<StudentScoreEntity> wrapper = new UpdateWrapper<>();
|
|
|
LambdaUpdateWrapper<StudentScoreEntity> lw = wrapper.lambda();
|
|
@@ -691,18 +698,18 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
lw.eq(StudentScoreEntity::getScoreStatus, DataStatus.PROCESSING);
|
|
|
this.update(wrapper);
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@Override
|
|
|
public void resetStatus() {
|
|
|
resetAnswerStatus();
|
|
|
resetScoreStatus();
|
|
|
}
|
|
|
-
|
|
|
+
|
|
|
@Override
|
|
|
public int countBy(Long examId, DataStatus status) {
|
|
|
QueryWrapper<StudentScoreEntity> wrapper = new QueryWrapper<>();
|
|
|
LambdaQueryWrapper<StudentScoreEntity> lw = wrapper.lambda();
|
|
|
- if(status!=null) {
|
|
|
+ if (status != null) {
|
|
|
lw.eq(StudentScoreEntity::getScoreStatus, status);
|
|
|
}
|
|
|
lw.eq(StudentScoreEntity::getExamId, examId);
|
|
@@ -714,7 +721,7 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
public void removeBy(Long examId, String subjectCode) {
|
|
|
QueryWrapper<StudentScoreEntity> wrapper = new QueryWrapper<>();
|
|
|
LambdaQueryWrapper<StudentScoreEntity> lw = wrapper.lambda();
|
|
|
- if(subjectCode!=null) {
|
|
|
+ if (subjectCode != null) {
|
|
|
lw.eq(StudentScoreEntity::getSubjectCode, subjectCode);
|
|
|
}
|
|
|
lw.eq(StudentScoreEntity::getExamId, examId);
|
|
@@ -725,7 +732,7 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
public int countOcrBy(Long examId, DataStatus status) {
|
|
|
QueryWrapper<StudentScoreEntity> wrapper = new QueryWrapper<>();
|
|
|
LambdaQueryWrapper<StudentScoreEntity> lw = wrapper.lambda();
|
|
|
- if(status!=null) {
|
|
|
+ if (status != null) {
|
|
|
lw.eq(StudentScoreEntity::getAnswerStatus, status);
|
|
|
}
|
|
|
lw.eq(StudentScoreEntity::getExamId, examId);
|
|
@@ -737,7 +744,7 @@ public class StudentScoreServiceImpl extends ServiceImpl<StudentScoreDao, Studen
|
|
|
QueryWrapper<StudentScoreEntity> wrapper = new QueryWrapper<>();
|
|
|
LambdaQueryWrapper<StudentScoreEntity> lw = wrapper.lambda();
|
|
|
lw.eq(StudentScoreEntity::getExamId, examId);
|
|
|
- lw.eq(StudentScoreEntity::getSubjectCode , subjectCode);
|
|
|
+ lw.eq(StudentScoreEntity::getSubjectCode, subjectCode);
|
|
|
lw.eq(StudentScoreEntity::getMainNumber, mainNumber);
|
|
|
lw.eq(StudentScoreEntity::getSubNumber, subNumber);
|
|
|
return this.list(wrapper);
|