From ff8e8754b9f2503b8577201b013efd181517da26 Mon Sep 17 00:00:00 2001 From: lijinyu <3023846734@qq.com> Date: Fri, 28 Jul 2023 09:44:16 +0800 Subject: [PATCH] =?UTF-8?q?=E6=A8=A1=E5=9D=97=E7=AE=A1=E7=90=86=E5=AF=BC?= =?UTF-8?q?=E5=85=A5=E5=8A=9F=E8=83=BD=E4=BA=A4=E4=BA=92?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/ModulexServiceImpl.java | 33 +++++++++++++++++-- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java index 33c1f54..d0805df 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/modulex/service/impl/ModulexServiceImpl.java @@ -819,7 +819,16 @@ public class ModulexServiceImpl extends ServiceImpl impl webSocketUtils.sendMessage(loginUser.getId(), message); return Result.error("导入失败,任务时长不能为空"); }else { - double parseDouble = Double.parseDouble(duration); + double parseDouble = 0; + try { + parseDouble = Double.parseDouble(duration); + } catch (Exception e) { + message.put("isError", "true"); + message.put("status","导入失败,第" + (i+4) +"行" +"任务时长不规范"); + message.put("closeable","true"); + webSocketUtils.sendMessage(loginUser.getId(), message); + return Result.error("导入失败,任务时长不规范"); + } modulex.setDuration(parseDouble); } String startTime = modulexTemplate.getStartTime(); @@ -862,7 +871,16 @@ public class ModulexServiceImpl extends ServiceImpl impl webSocketUtils.sendMessage(loginUser.getId(), message); return Result.error("导入失败,实际时长不能为空"); }else { - double parseDouble = Double.parseDouble(realDuration); + double parseDouble = 0; + try { + parseDouble = Double.parseDouble(realDuration); + } catch (Exception e) { + message.put("isError", "true"); + message.put("status","导入失败,第" + (i+4) +"行" +"实际时长不规范"); + message.put("closeable","true"); + webSocketUtils.sendMessage(loginUser.getId(), message); + return Result.error("导入失败,实际时长不规范"); + } if(parseDouble<0.1){ message.put("isError", "true"); message.put("status","导入失败,第" + (i+4) +"行" +"最小时间0.1小时"); @@ -964,7 +982,16 @@ public class ModulexServiceImpl extends ServiceImpl impl webSocketUtils.sendMessage(loginUser.getId(), message); return Result.error("导入失败,版本号不能为空"); }else { - int parseInt = Integer.parseInt(verison); + int parseInt = 0; + try { + parseInt = Integer.parseInt(verison); + } catch (Exception e) { + message.put("isError", "true"); + message.put("status","导入失败,第" + (i+4) +"行" + "版本号不能规范"); + message.put("closeable","true"); + webSocketUtils.sendMessage(loginUser.getId(), message); + return Result.error("导入失败,版本号不能为空"); + } modulex.setVerison(parseInt); } modulexList.add(modulex);