lxw
2023-08-15 160e150009b51a39fa95d9462c3798ba28d51a09
src/main/java/com/whyc/service/UserWorkService.java
@@ -61,11 +61,11 @@
    public Response searchByCondition(UserWork userWork){
        QueryWrapper<UserWork> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq(userWork.getUserId()!=null||userWork.getUserId()!=0,"userId",userWork.getUserId());
        queryWrapper.eq(userWork.getManagerId()!=null||userWork.getManagerId()!=0,"managerId",userWork.getManagerId());
        queryWrapper.eq(userWork.getWorkId()!=null||userWork.getWorkId()!=0,"workId",userWork.getWorkId());
        queryWrapper.eq(userWork.getUserId() != null && userWork.getUserId() != 0, "userId", userWork.getUserId());
        queryWrapper.eq(userWork.getManagerId() != null && userWork.getManagerId() != 0, "managerId", userWork.getManagerId());
        queryWrapper.eq(userWork.getWorkId() != null && userWork.getWorkId() != 0, "workId", userWork.getWorkId());
        List<UserWork> list = mapper.selectList(queryWrapper);
        return new Response().set(1,list,"查询成功");
        return new Response().set(1, list, "查询成功");
    }
@@ -82,7 +82,7 @@
            //打包版
            fileDirName = jarFile.toString();
        }
        String root=fileDirName+"/stationsrc/alarm/"+ param.getStationId() + "/" + param.getAfterOrBefore() + "/";
        String root=fileDirName+"/fg_photo/stationsrc/alarm/"+ param.getStationId() + "/" + param.getAfterOrBefore() + "/";
        List<String> filePathList = new ArrayList<>();
        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
        boolean isSuccess = false;
@@ -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 + "/fg_photo/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, "删除成功");
    }
}