| | |
| | | .collect(Collectors.joining(",")); |
| | | supervision.setImages(image); |
| | | } |
| | | |
| | | |
| | | supervisionMapper.insert(supervision); |
| | | return result; |
| | | } |
| | |
| | | |
| | | //如果上传了图片,就覆盖之前图片,删除服务器中图片 |
| | | if (files.size() > 0) { |
| | | //删除服务器中的原来督办单中图片 |
| | | String[] oldImages = supervisionMapper.selectById(supervision.getId()).getImages().split(","); |
| | | for (String image : oldImages) { |
| | | String realPath = path + File.separator + image; |
| | | File file = new File(realPath); |
| | | if (file.exists() && file.isFile()) { |
| | | file.delete(); |
| | | } |
| | | } |
| | | |
| | | |
| | | for (MultipartFile file : files) { |
| | | //判断上传文件格式 |
| | | String fileType = file.getContentType(); |
| | |
| | | |
| | | |
| | | if (!ObjectUtils.isEmpty(images)) { |
| | | //删除服务器中的原来督办单中图片 |
| | | for (String image : images) { |
| | | String realPath = path + File.separator + image; |
| | | File file = new File(realPath); |
| | | if (file.exists() && file.isFile()) { |
| | | file.delete(); |
| | | } |
| | | } |
| | | |
| | | String image = images.stream() |
| | | .map(String::valueOf) |
| | | .collect(Collectors.joining(",")); |