diff --git a/src/main/java/com/example/zxweb/service/impl/ZxCelueServiceImpl.java b/src/main/java/com/example/zxweb/service/impl/ZxCelueServiceImpl.java index 4567dd2..9ba39a6 100644 --- a/src/main/java/com/example/zxweb/service/impl/ZxCelueServiceImpl.java +++ b/src/main/java/com/example/zxweb/service/impl/ZxCelueServiceImpl.java @@ -209,10 +209,19 @@ public class ZxCelueServiceImpl extends ServiceImpl impl //获取执行时段 if (StringUtils.isNotBlank(zxCelue.getTriggereTime())) { String[] s = zxCelue.getTriggereTime().split(" "); - String s2 = new DecimalFormat("00").format(Integer.parseInt(s[2])); - String s1 = new DecimalFormat("00").format(Integer.parseInt(s[1])); - String s0 = new DecimalFormat("00").format(Integer.parseInt(s[0])); - String exeTime=s2+":"+s1+":"+s0; + String exeTime=null; + if (s.length==6) { + //有秒 + String s2 = new DecimalFormat("00").format(Integer.parseInt(s[2])); + String s1 = new DecimalFormat("00").format(Integer.parseInt(s[1])); + String s0 = new DecimalFormat("00").format(Integer.parseInt(s[0])); + exeTime=s2+":"+s1+":"+s0; + }else { + //没有秒 + String s1 = new DecimalFormat("00").format(Integer.parseInt(s[1])); + String s0 = new DecimalFormat("00").format(Integer.parseInt(s[0])); + exeTime=s1+":"+s0+":00"; + } zxCelueDTO.setExeTime(exeTime); } return zxCelueDTO;