From 300248f6b0e237d6861304cec6e00180141148cd Mon Sep 17 00:00:00 2001
From: maven <2163098428@qq.com>
Date: 星期五, 19 九月 2025 15:21:37 +0800
Subject: [PATCH] yys
---
src/main/java/com/ruoyi/sales/service/impl/CommonFileServiceImpl.java | 22 +++++++++++++++-------
1 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/src/main/java/com/ruoyi/sales/service/impl/CommonFileServiceImpl.java b/src/main/java/com/ruoyi/sales/service/impl/CommonFileServiceImpl.java
index 464810e..06bd40e 100644
--- a/src/main/java/com/ruoyi/sales/service/impl/CommonFileServiceImpl.java
+++ b/src/main/java/com/ruoyi/sales/service/impl/CommonFileServiceImpl.java
@@ -42,11 +42,16 @@
@Override
public int deleteSalesLedgerByIds(Long[] ids) {
+ for (Long id : ids) {
+ if (id == null) {
+ return 1;
+ }
+ }
return commonFileMapper.deleteBatchIds(Arrays.asList(ids));
}
@Override
- public CommonFile uploadFile(MultipartFile file, Long id, String type) throws IOException {
+ public CommonFile uploadFile(MultipartFile file, Long id, Integer type) throws IOException {
// 1. 鐢熸垚姝e紡鏂囦欢ID鍜岃矾寰�
String tempId = UUID.randomUUID().toString();
Path tempFilePath = Paths.get(uploadDir, tempId + "_" + file.getOriginalFilename());
@@ -118,12 +123,15 @@
try {
// 鎵ц鏂囦欢杩佺Щ锛堜娇鐢ㄥ師瀛愭搷浣滅‘淇濆畨鍏ㄦ�э級
- Files.move(
- Paths.get(tempFile.getTempPath()),
- formalFilePath,
- StandardCopyOption.REPLACE_EXISTING,
- StandardCopyOption.ATOMIC_MOVE
- );
+// Files.move(
+// Paths.get(tempFile.getTempPath()),
+// formalFilePath,
+// StandardCopyOption.REPLACE_EXISTING,
+// StandardCopyOption.ATOMIC_MOVE
+// );
+ // 鍘熷瓙绉诲姩澶辫触锛屼娇鐢ㄥ鍒�+鍒犻櫎
+ Files.copy(Paths.get(tempFile.getTempPath()), formalFilePath, StandardCopyOption.REPLACE_EXISTING);
+ Files.deleteIfExists(Paths.get(tempFile.getTempPath()));
log.info("鏂囦欢杩佺Щ鎴愬姛: {} -> {}", tempFile.getTempPath(), formalFilePath);
// 鏇存柊鏂囦欢璁板綍锛堝叧鑱斿埌涓氬姟ID锛�
--
Gitblit v1.9.3