| | |
| | | String stationName = result.getStationName(); |
| | | Date now = new Date(); |
| | | String timeFormat = ThreadLocalUtil.format(ThreadLocalUtil.TIME_YYYY_MM_DD_HH_MM_SS_UNION, now); |
| | | String fileDirPath = CommonUtil.getRootFile() + "alarmInspection" + File.separator + stationName + "_" + timeFormat; |
| | | String dirMonth = ThreadLocalUtil.format(ThreadLocalUtil.TIME_YYYY_MM, now); |
| | | |
| | | String fileDirPath = CommonUtil.getRootFile() + "alarmInspection" + File.separator + dirMonth + File.separator + stationName + "_" + timeFormat; |
| | | File fileDir = new File(fileDirPath); |
| | | //如果文件夹不存在则创建 |
| | | if (!fileDir.exists()) { |
| | |
| | | } |
| | | StringBuilder pictureUrlSb = new StringBuilder(); |
| | | if (file != null && file.size() > 0) { |
| | | for (MultipartFile multipartFile : file) { |
| | | for (int j = 0; j < file.size(); j++) { |
| | | MultipartFile multipartFile = file.get(j); |
| | | String fileName = multipartFile.getOriginalFilename(); |
| | | //将fileName中可能存在的,去掉 |
| | | fileName = fileName.replace(",",""); |
| | |
| | | |
| | | multipartFile.transferTo(new File(filePath)); |
| | | String split = "pis_file"+File.separator+"alarmInspection"; |
| | | pictureUrlSb.append(File.separator + filePath.substring(filePath.indexOf(split))).append(","); |
| | | String picUrl = File.separator + filePath.substring(filePath.indexOf(split)); |
| | | //最后一个元素 |
| | | if (j == file.size() - 1) { |
| | | pictureUrlSb.append(picUrl); |
| | | }else { |
| | | pictureUrlSb.append(picUrl).append(","); |
| | | } |
| | | } |
| | | } |
| | | result.setPictureUrl(pictureUrlSb.toString()); |