Min 2 роки тому
батько
коміт
8d26945e84

+ 3 - 2
fhKeeper/formulahousekeeper/management-platform-import/src/main/java/com/management/platform/service/impl/ReportServiceImpl.java

@@ -3991,8 +3991,9 @@ public class ReportServiceImpl extends ServiceImpl<ReportMapper, Report> impleme
                 String stringCellValue = row.getCell(6).getStringCellValue();
                 double time=0;
                 if(!StringUtils.isEmpty(stringCellValue)){
-                    Pattern pattern= Pattern.compile("[0-9]*");
-                    if(!pattern.matcher(stringCellValue).matches()){
+                    Pattern isWholeNumber= Pattern.compile("[0-9]*");
+                    Pattern isDecimal= Pattern.compile("[-+]{0,1}\\d+\\.\\d*|[-+]{0,1}\\d*\\.\\d+");
+                    if(!isWholeNumber.matcher(stringCellValue).matches()&&!isDecimal.matcher(stringCellValue).matches()){
                         msg.setError("工作时长只能为数字");
                         return msg;
                     }