Gogs 2 maanden geleden
bovenliggende
commit
58d71525b3

+ 0 - 6
dtm-admin/pom.xml

@@ -50,12 +50,6 @@
             <artifactId>dtm-framework</artifactId>
         </dependency>
 
-        <!-- 定时任务-->
-        <dependency>
-            <groupId>com.dtm</groupId>
-            <artifactId>dtm-order</artifactId>
-        </dependency>
-
         <dependency>
             <groupId>com.dtm</groupId>
             <artifactId>dtm-storage</artifactId>

+ 2 - 1
dtm-order/src/main/java/com/dtm/order/controller/AnalysisController.java → dtm-admin/src/main/java/com/dtm/web/controller/order/AnalysisController.java

@@ -1,4 +1,4 @@
-package com.dtm.order.controller;
+package com.dtm.web.controller.order;
 
 import com.dtm.common.annotation.Anonymous;
 import com.dtm.order.dto.CoPurchaseDTO;
@@ -166,3 +166,4 @@ public class AnalysisController {
         }
     }
 }
+

+ 6 - 9
dtm-order/src/main/java/com/dtm/order/DataImportController.java → dtm-admin/src/main/java/com/dtm/web/controller/order/DataImportController.java

@@ -1,4 +1,4 @@
-package com.dtm.order;
+package com.dtm.web.controller.order;
 
 import com.dtm.common.annotation.Anonymous;
 import com.dtm.order.service.OrderDataStore;
@@ -8,8 +8,8 @@ import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -65,22 +65,19 @@ public class DataImportController {
             int loadedCount = orderDataStore.reloadFromUploads(files);
             if (loadedCount <= 0) {
                 response.put("success", false);
-                response.put("message", "导入失败,请检查是否上传了有效的 CSV 文件。");
+                response.put("message", "Import failed. Please upload valid CSV files.");
                 response.put("debug", orderDataStore.getLastDebug());
                 return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(response);
             }
             response.put("success", true);
-            response.put("message", "上传并导入成功。");
+            response.put("message", "Upload and import succeeded.");
             response.put("loadedRows", loadedCount);
             response.put("debug", orderDataStore.getLastDebug());
             return ResponseEntity.ok(response);
         } catch (Exception e) {
             response.put("success", false);
-            response.put("message", "上传导入失败: " + e.getMessage());
+            response.put("message", "Upload import failed: " + e.getMessage());
             return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(response);
         }
     }
-}
-
-
-
+}

+ 6 - 10
dtm-order/src/main/java/com/dtm/order/shop/Controller/ShopDataImportController.java → dtm-admin/src/main/java/com/dtm/web/controller/order/shop/ShopDataImportController.java

@@ -1,4 +1,4 @@
-package com.dtm.order.shop.Controller;
+package com.dtm.web.controller.order.shop;
 
 import com.dtm.common.annotation.Anonymous;
 import com.dtm.order.shop.service.ShopAnalysisService;
@@ -8,8 +8,8 @@ import org.springframework.http.HttpStatus;
 import org.springframework.http.ResponseEntity;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.RestController;
 import org.springframework.web.multipart.MultipartFile;
 
@@ -68,19 +68,19 @@ public class ShopDataImportController {
 
             if (importedCount <= 0) {
                 response.put("success", false);
-                response.put("message", "上传导入失败,请检查文件编码或列格式(需为CSV且前10列可解析)。");
+                response.put("message", "Upload import failed. Check encoding or CSV columns.");
                 response.put("debug", shopAnalysisService.getLastUploadDebug());
                 return ResponseEntity.status(HttpStatus.BAD_REQUEST).body(response);
             }
 
             response.put("success", true);
-            response.put("message", "上传并导入成功。");
+            response.put("message", "Upload and import succeeded.");
             response.put("importedRows", importedCount);
             response.put("debug", shopAnalysisService.getLastUploadDebug());
             return ResponseEntity.ok(response);
         } catch (Exception e) {
             response.put("success", false);
-            response.put("message", "上传导入失败: " + e.getMessage());
+            response.put("message", "Upload import failed: " + e.getMessage());
             return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(response);
         }
     }
@@ -273,8 +273,4 @@ public class ShopDataImportController {
             return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR).body(response);
         }
     }
-}
-
-
-
-
+}

+ 18 - 1
dtm-system/pom.xml

@@ -28,6 +28,23 @@
             <artifactId>spring-web</artifactId>
         </dependency>
 
+        <dependency>
+            <groupId>org.apache.commons</groupId>
+            <artifactId>commons-csv</artifactId>
+            <version>1.10.0</version>
+        </dependency>
+
+        <dependency>
+            <groupId>org.apache.poi</groupId>
+            <artifactId>poi-ooxml</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>javax.annotation</groupId>
+            <artifactId>javax.annotation-api</artifactId>
+            <version>1.3.2</version>
+        </dependency>
+
     </dependencies>
 
-</project>
+</project>

+ 0 - 0
dtm-order/src/main/java/com/dtm/order/dto/CoPurchaseDTO.java → dtm-system/src/main/java/com/dtm/order/dto/CoPurchaseDTO.java


+ 0 - 0
dtm-order/src/main/java/com/dtm/order/dto/ProductDTO.java → dtm-system/src/main/java/com/dtm/order/dto/ProductDTO.java


+ 0 - 0
dtm-order/src/main/java/com/dtm/order/service/AnalysisService.java → dtm-system/src/main/java/com/dtm/order/service/AnalysisService.java


+ 0 - 0
dtm-order/src/main/java/com/dtm/order/service/OrderDataStore.java → dtm-system/src/main/java/com/dtm/order/service/OrderDataStore.java


+ 0 - 0
dtm-order/src/main/java/com/dtm/order/service/OrderRecord.java → dtm-system/src/main/java/com/dtm/order/service/OrderRecord.java


+ 0 - 0
dtm-order/src/main/java/com/dtm/order/shop/dto/ShopSalesDTO.java → dtm-system/src/main/java/com/dtm/order/shop/dto/ShopSalesDTO.java


+ 0 - 0
dtm-order/src/main/java/com/dtm/order/shop/service/ShopAnalysisService.java → dtm-system/src/main/java/com/dtm/order/shop/service/ShopAnalysisService.java


+ 0 - 0
dtm-order/src/main/java/com/dtm/order/shop/service/ShopSalesDataStore.java → dtm-system/src/main/java/com/dtm/order/shop/service/ShopSalesDataStore.java


+ 0 - 0
dtm-order/src/main/java/com/dtm/order/shop/service/ShopSalesRecord.java → dtm-system/src/main/java/com/dtm/order/shop/service/ShopSalesRecord.java