|
@@ -112,33 +112,31 @@ public class PaperDetailServiceImpl extends ServiceImpl<PaperDetailDao, PaperDet
|
|
if (total.indexOf(".")>=0&&total.indexOf(".") < total.length() - 2) {
|
|
if (total.indexOf(".")>=0&&total.indexOf(".") < total.length() - 2) {
|
|
throw new StatusException("试卷满分只能有一位小数");
|
|
throw new StatusException("试卷满分只能有一位小数");
|
|
}
|
|
}
|
|
- if (CollectionUtils.isEmpty(domain.getStructInfo())) {
|
|
|
|
- throw new StatusException("大题信息不能为空");
|
|
|
|
- }
|
|
|
|
- for (PaperDetail u : domain.getStructInfo()) {
|
|
|
|
- if (u.getNumber() == null || StringUtils.isBlank(u.getName())) {
|
|
|
|
- throw new StatusException("大题号、大题名称不能为空");
|
|
|
|
- }
|
|
|
|
- if (u.getNumber() <= 0) {
|
|
|
|
- throw new StatusException("大题号必须大于0");
|
|
|
|
- }
|
|
|
|
- if (CollectionUtils.isEmpty(u.getUnits())) {
|
|
|
|
- throw new StatusException("小题信息不能为空");
|
|
|
|
- }
|
|
|
|
- for (PaperDetailUnit unit : u.getUnits()) {
|
|
|
|
- if (unit.getNumber() == null || unit.getScore() == null || unit.getScoreStep() == null) {
|
|
|
|
- throw new StatusException("小题号、小题满分、给分间隔不能为空");
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(domain.getStructInfo())) {
|
|
|
|
+ for (PaperDetail u : domain.getStructInfo()) {
|
|
|
|
+ if (u.getNumber() == null || StringUtils.isBlank(u.getName())) {
|
|
|
|
+ throw new StatusException("大题号、大题名称不能为空");
|
|
}
|
|
}
|
|
- if (unit.getNumber() <= 0) {
|
|
|
|
- throw new StatusException("小题号必须大于0");
|
|
|
|
|
|
+ if (u.getNumber() <= 0) {
|
|
|
|
+ throw new StatusException("大题号必须大于0");
|
|
}
|
|
}
|
|
- String score = unit.getScore().toString();
|
|
|
|
- if (score.indexOf(".")>=0&&score.indexOf(".") < score.length() - 2) {
|
|
|
|
- throw new StatusException("小题满分只能有一位小数");
|
|
|
|
- }
|
|
|
|
- String scoreStep = unit.getScoreStep().toString();
|
|
|
|
- if (scoreStep.indexOf(".")>=0&&scoreStep.indexOf(".") < scoreStep.length() - 2) {
|
|
|
|
- throw new StatusException("给分间隔只能有一位小数");
|
|
|
|
|
|
+ if (CollectionUtils.isNotEmpty(u.getUnits())) {
|
|
|
|
+ for (PaperDetailUnit unit : u.getUnits()) {
|
|
|
|
+ if (unit.getNumber() == null || unit.getScore() == null || unit.getScoreStep() == null) {
|
|
|
|
+ throw new StatusException("小题号、小题满分、给分间隔不能为空");
|
|
|
|
+ }
|
|
|
|
+ if (unit.getNumber() <= 0) {
|
|
|
|
+ throw new StatusException("小题号必须大于0");
|
|
|
|
+ }
|
|
|
|
+ String score = unit.getScore().toString();
|
|
|
|
+ if (score.indexOf(".") >= 0 && score.indexOf(".") < score.length() - 2) {
|
|
|
|
+ throw new StatusException("小题满分只能有一位小数");
|
|
|
|
+ }
|
|
|
|
+ String scoreStep = unit.getScoreStep().toString();
|
|
|
|
+ if (scoreStep.indexOf(".") >= 0 && scoreStep.indexOf(".") < scoreStep.length() - 2) {
|
|
|
|
+ throw new StatusException("给分间隔只能有一位小数");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -178,7 +176,7 @@ public class PaperDetailServiceImpl extends ServiceImpl<PaperDetailDao, PaperDet
|
|
lw.eq(PaperDetailEntity::getPaperId, paperId);
|
|
lw.eq(PaperDetailEntity::getPaperId, paperId);
|
|
this.remove(wrapper);
|
|
this.remove(wrapper);
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public void structImport(StructDomain domain, User user) {
|
|
public void structImport(StructDomain domain, User user) {
|
|
if (domain.getPaperId() == null) {
|
|
if (domain.getPaperId() == null) {
|
|
@@ -191,7 +189,7 @@ public class PaperDetailServiceImpl extends ServiceImpl<PaperDetailDao, PaperDet
|
|
throw new StatusException("试卷满分必须大于0");
|
|
throw new StatusException("试卷满分必须大于0");
|
|
}
|
|
}
|
|
String total = domain.getTotalScore().toString();
|
|
String total = domain.getTotalScore().toString();
|
|
- if (total.indexOf(".")>=0&&total.indexOf(".") < total.length() - 2) {
|
|
|
|
|
|
+ if (total.indexOf(".") >= 0 && total.indexOf(".") < total.length() - 2) {
|
|
throw new StatusException("试卷满分只能有一位小数");
|
|
throw new StatusException("试卷满分只能有一位小数");
|
|
}
|
|
}
|
|
if (CollectionUtils.isEmpty(domain.getStructInfo())) {
|
|
if (CollectionUtils.isEmpty(domain.getStructInfo())) {
|
|
@@ -212,11 +210,11 @@ public class PaperDetailServiceImpl extends ServiceImpl<PaperDetailDao, PaperDet
|
|
throw new StatusException("小题号必须大于0");
|
|
throw new StatusException("小题号必须大于0");
|
|
}
|
|
}
|
|
String score = unit.getScore().toString();
|
|
String score = unit.getScore().toString();
|
|
- if (score.indexOf(".")>=0&&score.indexOf(".") < score.length() - 2) {
|
|
|
|
|
|
+ if (score.indexOf(".") >= 0 && score.indexOf(".") < score.length() - 2) {
|
|
throw new StatusException("小题满分只能有一位小数");
|
|
throw new StatusException("小题满分只能有一位小数");
|
|
}
|
|
}
|
|
String scoreStep = unit.getScoreStep().toString();
|
|
String scoreStep = unit.getScoreStep().toString();
|
|
- if (scoreStep.indexOf(".")>=0&&scoreStep.indexOf(".") < scoreStep.length() - 2) {
|
|
|
|
|
|
+ if (scoreStep.indexOf(".") >= 0 && scoreStep.indexOf(".") < scoreStep.length() - 2) {
|
|
throw new StatusException("给分间隔只能有一位小数");
|
|
throw new StatusException("给分间隔只能有一位小数");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -230,7 +228,7 @@ public class PaperDetailServiceImpl extends ServiceImpl<PaperDetailDao, PaperDet
|
|
if (!user.getRole().equals(Role.SUPER_ADMIN) && !user.getSchoolId().equals(paper.getSchoolId())) {
|
|
if (!user.getRole().equals(Role.SUPER_ADMIN) && !user.getSchoolId().equals(paper.getSchoolId())) {
|
|
throw new StatusException("没有权限");
|
|
throw new StatusException("没有权限");
|
|
}
|
|
}
|
|
- paperGroupService.groupClear(domain.getPaperId(),user);
|
|
|
|
|
|
+ paperGroupService.groupClear(domain.getPaperId(), user);
|
|
clearPaperSruct(domain.getPaperId());
|
|
clearPaperSruct(domain.getPaperId());
|
|
paper.setTotalScore(domain.getTotalScore());
|
|
paper.setTotalScore(domain.getTotalScore());
|
|
paper.setSubjectiveScore(domain.getTotalScore());
|
|
paper.setSubjectiveScore(domain.getTotalScore());
|
|
@@ -245,6 +243,7 @@ public class PaperDetailServiceImpl extends ServiceImpl<PaperDetailDao, PaperDet
|
|
paperDetailUnitService.saveUnit(e, pd.getUnits());
|
|
paperDetailUnitService.saveUnit(e, pd.getUnits());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
@Transactional
|
|
@Transactional
|
|
@Override
|
|
@Override
|
|
public void structSubmit(StructDomain domain, User user) {
|
|
public void structSubmit(StructDomain domain, User user) {
|
|
@@ -258,7 +257,7 @@ public class PaperDetailServiceImpl extends ServiceImpl<PaperDetailDao, PaperDet
|
|
throw new StatusException("试卷满分必须大于0");
|
|
throw new StatusException("试卷满分必须大于0");
|
|
}
|
|
}
|
|
String total = domain.getTotalScore().toString();
|
|
String total = domain.getTotalScore().toString();
|
|
- if (total.indexOf(".")>=0&&total.indexOf(".") < total.length() - 2) {
|
|
|
|
|
|
+ if (total.indexOf(".") >= 0 && total.indexOf(".") < total.length() - 2) {
|
|
throw new StatusException("试卷满分只能有一位小数");
|
|
throw new StatusException("试卷满分只能有一位小数");
|
|
}
|
|
}
|
|
if (CollectionUtils.isEmpty(domain.getStructInfo())) {
|
|
if (CollectionUtils.isEmpty(domain.getStructInfo())) {
|
|
@@ -279,11 +278,11 @@ public class PaperDetailServiceImpl extends ServiceImpl<PaperDetailDao, PaperDet
|
|
throw new StatusException("小题号必须大于0");
|
|
throw new StatusException("小题号必须大于0");
|
|
}
|
|
}
|
|
String score = unit.getScore().toString();
|
|
String score = unit.getScore().toString();
|
|
- if (score.indexOf(".")>=0&&score.indexOf(".") < score.length() - 2) {
|
|
|
|
|
|
+ if (score.indexOf(".") >= 0 && score.indexOf(".") < score.length() - 2) {
|
|
throw new StatusException("小题满分只能有一位小数");
|
|
throw new StatusException("小题满分只能有一位小数");
|
|
}
|
|
}
|
|
String scoreStep = unit.getScoreStep().toString();
|
|
String scoreStep = unit.getScoreStep().toString();
|
|
- if (scoreStep.indexOf(".")>=0&&scoreStep.indexOf(".") < scoreStep.length() - 2) {
|
|
|
|
|
|
+ if (scoreStep.indexOf(".") >= 0 && scoreStep.indexOf(".") < scoreStep.length() - 2) {
|
|
throw new StatusException("给分间隔只能有一位小数");
|
|
throw new StatusException("给分间隔只能有一位小数");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -326,5 +325,5 @@ public class PaperDetailServiceImpl extends ServiceImpl<PaperDetailDao, PaperDet
|
|
throw new StatusException("试卷满分与小题分不一致");
|
|
throw new StatusException("试卷满分与小题分不一致");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
}
|
|
}
|