Browse Source

Merge remote-tracking branch 'remotes/origin/dev_1.0.0' into release_1.0.0

xiatian 2 years ago
parent
commit
87818322b6

+ 4 - 4
src/main/java/cn/com/qmth/mps/service/impl/PaperDetailServiceImpl.java

@@ -109,7 +109,7 @@ public class PaperDetailServiceImpl extends ServiceImpl<PaperDetailDao, PaperDet
 			throw new StatusException("试卷满分必须大于0");
 		}
 		String total = domain.getTotalScore().toString();
-		if (total.indexOf(".") < total.length() - 2) {
+		if (total.indexOf(".")>=0&&total.indexOf(".") < total.length() - 2) {
 			throw new StatusException("试卷满分只能有一位小数");
 		}
 		if (CollectionUtils.isEmpty(domain.getStructInfo())) {
@@ -137,7 +137,7 @@ public class PaperDetailServiceImpl extends ServiceImpl<PaperDetailDao, PaperDet
 					throw new StatusException("小题满分只能有一位小数");
 				}
 				String scoreStep = unit.getScoreStep().toString();
-				if (scoreStep.indexOf(".") < scoreStep.length() - 2) {
+				if (scoreStep.indexOf(".")>=0&&scoreStep.indexOf(".") < scoreStep.length() - 2) {
 					throw new StatusException("给分间隔只能有一位小数");
 				}
 			}
@@ -192,7 +192,7 @@ public class PaperDetailServiceImpl extends ServiceImpl<PaperDetailDao, PaperDet
 			throw new StatusException("试卷满分必须大于0");
 		}
 		String total = domain.getTotalScore().toString();
-		if (total.indexOf(".") < total.length() - 2) {
+		if (total.indexOf(".")>=0&&total.indexOf(".") < total.length() - 2) {
 			throw new StatusException("试卷满分只能有一位小数");
 		}
 		if (CollectionUtils.isEmpty(domain.getStructInfo())) {
@@ -217,7 +217,7 @@ public class PaperDetailServiceImpl extends ServiceImpl<PaperDetailDao, PaperDet
 					throw new StatusException("小题满分只能有一位小数");
 				}
 				String scoreStep = unit.getScoreStep().toString();
-				if (scoreStep.indexOf(".") < scoreStep.length() - 2) {
+				if (scoreStep.indexOf(".")>=0&&scoreStep.indexOf(".") < scoreStep.length() - 2) {
 					throw new StatusException("给分间隔只能有一位小数");
 				}
 			}

+ 1 - 1
src/main/java/cn/com/qmth/mps/service/impl/PaperServiceImpl.java

@@ -438,7 +438,7 @@ public class PaperServiceImpl extends ServiceImpl<PaperDao, PaperEntity> impleme
 						if (n <= 0) {
 							msg.append("  间隔分不能小于0");
 						} else {
-							if (scoreStep.indexOf(".") < scoreStep.length() - 2) {
+							if (scoreStep.indexOf(".")>=0&&scoreStep.indexOf(".") < scoreStep.length() - 2) {
 								msg.append("小间隔分只能有一位小数");
 							} else {
 								imp.setScoreStep(n);