From b7abdf9e6a3ddb71c8ce2ebcf6d26c4414dbb614 Mon Sep 17 00:00:00 2001 From: lxw <810412026@qq.com> Date: 星期二, 14 六月 2022 16:53:35 +0800 Subject: [PATCH] 告警工单修改 --- src/main/java/com/whyc/service/UserWorkService.java | 28 +++++++++++++++++----------- 1 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/whyc/service/UserWorkService.java b/src/main/java/com/whyc/service/UserWorkService.java index 82e89b1..5d1fab8 100644 --- a/src/main/java/com/whyc/service/UserWorkService.java +++ b/src/main/java/com/whyc/service/UserWorkService.java @@ -125,14 +125,14 @@ } catch (IOException e) { e.printStackTrace(); } finally { - if(in != null){ + if (in != null) { try { in.close(); } catch (IOException e) { e.printStackTrace(); } } - if(out != null){ + if (out != null) { try { out.close(); } catch (IOException e) { @@ -141,31 +141,37 @@ } } } - public void createFilefolderIFNotExist(String filePath){ + + public void createFilefolderIFNotExist(String filePath) { File f = new File(filePath); - if(!f.exists()){ - if(!f.getParentFile().exists()){ + if (!f.exists()) { + if (!f.getParentFile().exists()) { f.getParentFile().mkdirs(); } } } - public void deleteAlarmFile(){ + public Response deleteAlarmFile(String fileNames, int stationId, String afterOrBefore) { + String names[] = fileNames.split(","); String fileDirName = ""; int configType = Integer.parseInt(environment.getProperty("configFile.type")); ApplicationHome applicationHome = new ApplicationHome(getClass()); File jarFile = applicationHome.getDir(); //娴嬭瘯鐗� - if(configType==1){ + if (configType == 1) { fileDirName = jarFile.getParentFile().toString(); - }else{ + } else { //鎵撳寘鐗� fileDirName = jarFile.toString(); } -// String root=fileDirName+"/stationsrc/alarm"+ param.getStationId() + "/" + param.getAfterOrBefore() + "/"; - + String root = fileDirName + "/stationsrc/alarm/" + stationId + File.separator + afterOrBefore + File.separator; + for (String name : names) { + String targetFilePath = root + name; + File file = new File(targetFilePath); + file.delete(); + } + return new Response().set(1, "鍒犻櫎鎴愬姛"); } - } -- Gitblit v1.9.1