2 Commity ce0f7d9ab2 ... 51e0a08a00

Autor SHA1 Wiadomość Data
  Zhu Jiaqi 51e0a08a00 Merge branch 'master' of http://106.14.194.251:3000/dtm/dtm_java 2 tygodni temu
  Zhu Jiaqi 0486d3cb65 生命周期模块前端阶段建议卡片添加、数据上传模块完成8种数据文件的上传功能 2 tygodni temu
42 zmienionych plików z 1625 dodań i 0 usunięć
  1. 52 0
      dtm-admin/src/main/java/com/dtm/web/controller/upload/PreparedDataUploadController.java
  2. 19 0
      dtm-system/src/main/java/com/dtm/upload/domain/DtmAssemblyRecord.java
  3. 17 0
      dtm-system/src/main/java/com/dtm/upload/domain/DtmBomList.java
  4. 50 0
      dtm-system/src/main/java/com/dtm/upload/domain/DtmOrderMain.java
  5. 25 0
      dtm-system/src/main/java/com/dtm/upload/domain/DtmProduct.java
  6. 35 0
      dtm-system/src/main/java/com/dtm/upload/domain/DtmPurchaseReceipt.java
  7. 19 0
      dtm-system/src/main/java/com/dtm/upload/domain/DtmSemiFinishedProduct.java
  8. 32 0
      dtm-system/src/main/java/com/dtm/upload/domain/DtmStore.java
  9. 11 0
      dtm-system/src/main/java/com/dtm/upload/domain/DtmSupplier.java
  10. 15 0
      dtm-system/src/main/java/com/dtm/upload/mapper/DtmAssemblyRecordMapper.java
  11. 15 0
      dtm-system/src/main/java/com/dtm/upload/mapper/DtmBomListMapper.java
  12. 14 0
      dtm-system/src/main/java/com/dtm/upload/mapper/DtmOrderMainMapper.java
  13. 14 0
      dtm-system/src/main/java/com/dtm/upload/mapper/DtmProductMapper.java
  14. 14 0
      dtm-system/src/main/java/com/dtm/upload/mapper/DtmPurchaseReceiptMapper.java
  15. 14 0
      dtm-system/src/main/java/com/dtm/upload/mapper/DtmSemiFinishedProductMapper.java
  16. 15 0
      dtm-system/src/main/java/com/dtm/upload/mapper/DtmStoreMapper.java
  17. 14 0
      dtm-system/src/main/java/com/dtm/upload/mapper/DtmSupplierMapper.java
  18. 14 0
      dtm-system/src/main/java/com/dtm/upload/service/IDtmAssemblyRecordService.java
  19. 14 0
      dtm-system/src/main/java/com/dtm/upload/service/IDtmBomListService.java
  20. 14 0
      dtm-system/src/main/java/com/dtm/upload/service/IDtmOrderMainService.java
  21. 14 0
      dtm-system/src/main/java/com/dtm/upload/service/IDtmProductService.java
  22. 14 0
      dtm-system/src/main/java/com/dtm/upload/service/IDtmPurchaseReceiptService.java
  23. 14 0
      dtm-system/src/main/java/com/dtm/upload/service/IDtmSemiFinishedProductService.java
  24. 14 0
      dtm-system/src/main/java/com/dtm/upload/service/IDtmStoreService.java
  25. 14 0
      dtm-system/src/main/java/com/dtm/upload/service/IDtmSupplierService.java
  26. 591 0
      dtm-system/src/main/java/com/dtm/upload/service/PreparedDataUploadService.java
  27. 31 0
      dtm-system/src/main/java/com/dtm/upload/service/impl/DtmAssemblyRecordServiceImpl.java
  28. 31 0
      dtm-system/src/main/java/com/dtm/upload/service/impl/DtmBomListServiceImpl.java
  29. 28 0
      dtm-system/src/main/java/com/dtm/upload/service/impl/DtmOrderMainServiceImpl.java
  30. 28 0
      dtm-system/src/main/java/com/dtm/upload/service/impl/DtmProductServiceImpl.java
  31. 28 0
      dtm-system/src/main/java/com/dtm/upload/service/impl/DtmPurchaseReceiptServiceImpl.java
  32. 28 0
      dtm-system/src/main/java/com/dtm/upload/service/impl/DtmSemiFinishedProductServiceImpl.java
  33. 31 0
      dtm-system/src/main/java/com/dtm/upload/service/impl/DtmStoreServiceImpl.java
  34. 28 0
      dtm-system/src/main/java/com/dtm/upload/service/impl/DtmSupplierServiceImpl.java
  35. 34 0
      dtm-system/src/main/resources/mapper/upload/DtmAssemblyRecordMapper.xml
  36. 34 0
      dtm-system/src/main/resources/mapper/upload/DtmBomListMapper.xml
  37. 47 0
      dtm-system/src/main/resources/mapper/upload/DtmOrderMainMapper.xml
  38. 40 0
      dtm-system/src/main/resources/mapper/upload/DtmProductMapper.xml
  39. 42 0
      dtm-system/src/main/resources/mapper/upload/DtmPurchaseReceiptMapper.xml
  40. 39 0
      dtm-system/src/main/resources/mapper/upload/DtmSemiFinishedProductMapper.xml
  41. 43 0
      dtm-system/src/main/resources/mapper/upload/DtmStoreMapper.xml
  42. 35 0
      dtm-system/src/main/resources/mapper/upload/DtmSupplierMapper.xml

+ 52 - 0
dtm-admin/src/main/java/com/dtm/web/controller/upload/PreparedDataUploadController.java

@@ -0,0 +1,52 @@
+package com.dtm.web.controller.upload;
+
+import com.dtm.common.annotation.Anonymous;
+import com.dtm.common.core.domain.AjaxResult;
+import com.dtm.upload.service.PreparedDataUploadService;
+import org.springframework.web.bind.annotation.GetMapping;
+import org.springframework.web.bind.annotation.PathVariable;
+import org.springframework.web.bind.annotation.PostMapping;
+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;
+
+@Anonymous
+@RestController
+@RequestMapping("/api/upload-data")
+public class PreparedDataUploadController {
+    private final PreparedDataUploadService uploadService;
+
+    public PreparedDataUploadController(PreparedDataUploadService uploadService) {
+        this.uploadService = uploadService;
+    }
+
+    @GetMapping("/supported")
+    public AjaxResult supported() {
+        return AjaxResult.success(uploadService.listSupportedItems());
+    }
+
+    @PostMapping("/{key}")
+    public AjaxResult upload(@PathVariable("key") String key,
+                             @RequestParam("file") MultipartFile file) {
+        try {
+            return AjaxResult.success("上传成功", uploadService.upload(key, file));
+        } catch (IllegalArgumentException e) {
+            return AjaxResult.error(e.getMessage());
+        } catch (Exception e) {
+            return AjaxResult.error("上传失败:" + e.getMessage());
+        }
+    }
+
+    @PostMapping("/{key}/preview")
+    public AjaxResult preview(@PathVariable("key") String key,
+                              @RequestParam("file") MultipartFile file) {
+        try {
+            return AjaxResult.success(uploadService.preview(key, file));
+        } catch (IllegalArgumentException e) {
+            return AjaxResult.error(e.getMessage());
+        } catch (Exception e) {
+            return AjaxResult.error("预览失败:" + e.getMessage());
+        }
+    }
+}

+ 19 - 0
dtm-system/src/main/java/com/dtm/upload/domain/DtmAssemblyRecord.java

@@ -0,0 +1,19 @@
+package com.dtm.upload.domain;
+
+import java.util.Date;
+
+public class DtmAssemblyRecord {
+    private Long id;
+    private String productCode;
+    private Date assemblyDate;
+    private Integer quantity;
+
+    public Long getId() { return id; }
+    public void setId(Long id) { this.id = id; }
+    public String getProductCode() { return productCode; }
+    public void setProductCode(String productCode) { this.productCode = productCode; }
+    public Date getAssemblyDate() { return assemblyDate; }
+    public void setAssemblyDate(Date assemblyDate) { this.assemblyDate = assemblyDate; }
+    public Integer getQuantity() { return quantity; }
+    public void setQuantity(Integer quantity) { this.quantity = quantity; }
+}

+ 17 - 0
dtm-system/src/main/java/com/dtm/upload/domain/DtmBomList.java

@@ -0,0 +1,17 @@
+package com.dtm.upload.domain;
+
+public class DtmBomList {
+    private Long id;
+    private String finishedSku;
+    private String semiSku;
+    private Integer quantity;
+
+    public Long getId() { return id; }
+    public void setId(Long id) { this.id = id; }
+    public String getFinishedSku() { return finishedSku; }
+    public void setFinishedSku(String finishedSku) { this.finishedSku = finishedSku; }
+    public String getSemiSku() { return semiSku; }
+    public void setSemiSku(String semiSku) { this.semiSku = semiSku; }
+    public Integer getQuantity() { return quantity; }
+    public void setQuantity(Integer quantity) { this.quantity = quantity; }
+}

+ 50 - 0
dtm-system/src/main/java/com/dtm/upload/domain/DtmOrderMain.java

@@ -0,0 +1,50 @@
+package com.dtm.upload.domain;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+public class DtmOrderMain {
+    private String orderId;
+    private String title;
+    private BigDecimal price;
+    private Integer quantity;
+    private String sku;
+    private String attrs;
+    private String orderStatus;
+    private String payNumber;
+    private BigDecimal payAmount;
+    private BigDecimal paidAmount;
+    private String refundStatus;
+    private String refundAmount;
+    private Date createTime;
+    private Date payTime;
+
+    public String getOrderId() { return orderId; }
+    public void setOrderId(String orderId) { this.orderId = orderId; }
+    public String getTitle() { return title; }
+    public void setTitle(String title) { this.title = title; }
+    public BigDecimal getPrice() { return price; }
+    public void setPrice(BigDecimal price) { this.price = price; }
+    public Integer getQuantity() { return quantity; }
+    public void setQuantity(Integer quantity) { this.quantity = quantity; }
+    public String getSku() { return sku; }
+    public void setSku(String sku) { this.sku = sku; }
+    public String getAttrs() { return attrs; }
+    public void setAttrs(String attrs) { this.attrs = attrs; }
+    public String getOrderStatus() { return orderStatus; }
+    public void setOrderStatus(String orderStatus) { this.orderStatus = orderStatus; }
+    public String getPayNumber() { return payNumber; }
+    public void setPayNumber(String payNumber) { this.payNumber = payNumber; }
+    public BigDecimal getPayAmount() { return payAmount; }
+    public void setPayAmount(BigDecimal payAmount) { this.payAmount = payAmount; }
+    public BigDecimal getPaidAmount() { return paidAmount; }
+    public void setPaidAmount(BigDecimal paidAmount) { this.paidAmount = paidAmount; }
+    public String getRefundStatus() { return refundStatus; }
+    public void setRefundStatus(String refundStatus) { this.refundStatus = refundStatus; }
+    public String getRefundAmount() { return refundAmount; }
+    public void setRefundAmount(String refundAmount) { this.refundAmount = refundAmount; }
+    public Date getCreateTime() { return createTime; }
+    public void setCreateTime(Date createTime) { this.createTime = createTime; }
+    public Date getPayTime() { return payTime; }
+    public void setPayTime(Date payTime) { this.payTime = payTime; }
+}

+ 25 - 0
dtm-system/src/main/java/com/dtm/upload/domain/DtmProduct.java

@@ -0,0 +1,25 @@
+package com.dtm.upload.domain;
+
+import java.math.BigDecimal;
+
+public class DtmProduct {
+    private String sku;
+    private String spu;
+    private String productName;
+    private String attributes;
+    private String bomLevelId;
+    private BigDecimal productPrice;
+
+    public String getSku() { return sku; }
+    public void setSku(String sku) { this.sku = sku; }
+    public String getSpu() { return spu; }
+    public void setSpu(String spu) { this.spu = spu; }
+    public String getProductName() { return productName; }
+    public void setProductName(String productName) { this.productName = productName; }
+    public String getAttributes() { return attributes; }
+    public void setAttributes(String attributes) { this.attributes = attributes; }
+    public String getBomLevelId() { return bomLevelId; }
+    public void setBomLevelId(String bomLevelId) { this.bomLevelId = bomLevelId; }
+    public BigDecimal getProductPrice() { return productPrice; }
+    public void setProductPrice(BigDecimal productPrice) { this.productPrice = productPrice; }
+}

+ 35 - 0
dtm-system/src/main/java/com/dtm/upload/domain/DtmPurchaseReceipt.java

@@ -0,0 +1,35 @@
+package com.dtm.upload.domain;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+public class DtmPurchaseReceipt {
+    private String receiptId;
+    private String sku;
+    private String supplierId;
+    private Integer quantity;
+    private Date receiptDate;
+    private BigDecimal actualAmount;
+    private String status;
+    private String warehouseCode;
+    private BigDecimal unitprice;
+
+    public String getReceiptId() { return receiptId; }
+    public void setReceiptId(String receiptId) { this.receiptId = receiptId; }
+    public String getSku() { return sku; }
+    public void setSku(String sku) { this.sku = sku; }
+    public String getSupplierId() { return supplierId; }
+    public void setSupplierId(String supplierId) { this.supplierId = supplierId; }
+    public Integer getQuantity() { return quantity; }
+    public void setQuantity(Integer quantity) { this.quantity = quantity; }
+    public Date getReceiptDate() { return receiptDate; }
+    public void setReceiptDate(Date receiptDate) { this.receiptDate = receiptDate; }
+    public BigDecimal getActualAmount() { return actualAmount; }
+    public void setActualAmount(BigDecimal actualAmount) { this.actualAmount = actualAmount; }
+    public String getStatus() { return status; }
+    public void setStatus(String status) { this.status = status; }
+    public String getWarehouseCode() { return warehouseCode; }
+    public void setWarehouseCode(String warehouseCode) { this.warehouseCode = warehouseCode; }
+    public BigDecimal getUnitprice() { return unitprice; }
+    public void setUnitprice(BigDecimal unitprice) { this.unitprice = unitprice; }
+}

+ 19 - 0
dtm-system/src/main/java/com/dtm/upload/domain/DtmSemiFinishedProduct.java

@@ -0,0 +1,19 @@
+package com.dtm.upload.domain;
+
+import java.math.BigDecimal;
+
+public class DtmSemiFinishedProduct {
+    private String sku;
+    private String semiName;
+    private BigDecimal price;
+    private String bomLevelId;
+
+    public String getSku() { return sku; }
+    public void setSku(String sku) { this.sku = sku; }
+    public String getSemiName() { return semiName; }
+    public void setSemiName(String semiName) { this.semiName = semiName; }
+    public BigDecimal getPrice() { return price; }
+    public void setPrice(BigDecimal price) { this.price = price; }
+    public String getBomLevelId() { return bomLevelId; }
+    public void setBomLevelId(String bomLevelId) { this.bomLevelId = bomLevelId; }
+}

+ 32 - 0
dtm-system/src/main/java/com/dtm/upload/domain/DtmStore.java

@@ -0,0 +1,32 @@
+package com.dtm.upload.domain;
+
+import java.math.BigDecimal;
+import java.util.Date;
+
+public class DtmStore {
+    private String storeCode;
+    private String storeName;
+    private String deptName;
+    private String channelName;
+    private Date recordStartDate;
+    private Date recordEndDate;
+    private Integer salesQty;
+    private BigDecimal salesAmount;
+
+    public String getStoreCode() { return storeCode; }
+    public void setStoreCode(String storeCode) { this.storeCode = storeCode; }
+    public String getStoreName() { return storeName; }
+    public void setStoreName(String storeName) { this.storeName = storeName; }
+    public String getDeptName() { return deptName; }
+    public void setDeptName(String deptName) { this.deptName = deptName; }
+    public String getChannelName() { return channelName; }
+    public void setChannelName(String channelName) { this.channelName = channelName; }
+    public Date getRecordStartDate() { return recordStartDate; }
+    public void setRecordStartDate(Date recordStartDate) { this.recordStartDate = recordStartDate; }
+    public Date getRecordEndDate() { return recordEndDate; }
+    public void setRecordEndDate(Date recordEndDate) { this.recordEndDate = recordEndDate; }
+    public Integer getSalesQty() { return salesQty; }
+    public void setSalesQty(Integer salesQty) { this.salesQty = salesQty; }
+    public BigDecimal getSalesAmount() { return salesAmount; }
+    public void setSalesAmount(BigDecimal salesAmount) { this.salesAmount = salesAmount; }
+}

+ 11 - 0
dtm-system/src/main/java/com/dtm/upload/domain/DtmSupplier.java

@@ -0,0 +1,11 @@
+package com.dtm.upload.domain;
+
+public class DtmSupplier {
+    private String supplierId;
+    private String supplierName;
+
+    public String getSupplierId() { return supplierId; }
+    public void setSupplierId(String supplierId) { this.supplierId = supplierId; }
+    public String getSupplierName() { return supplierName; }
+    public void setSupplierName(String supplierName) { this.supplierName = supplierName; }
+}

+ 15 - 0
dtm-system/src/main/java/com/dtm/upload/mapper/DtmAssemblyRecordMapper.java

@@ -0,0 +1,15 @@
+package com.dtm.upload.mapper;
+
+import com.dtm.upload.domain.DtmAssemblyRecord;
+import java.util.List;
+
+public interface DtmAssemblyRecordMapper {
+    DtmAssemblyRecord selectDtmAssemblyRecordById(Long id);
+    List<DtmAssemblyRecord> selectDtmAssemblyRecordList(DtmAssemblyRecord record);
+    int insertDtmAssemblyRecord(DtmAssemblyRecord record);
+    int updateDtmAssemblyRecord(DtmAssemblyRecord record);
+    int deleteDtmAssemblyRecordById(Long id);
+    int deleteDtmAssemblyRecordByIds(Long[] ids);
+    int deleteAllDtmAssemblyRecord();
+    int batchInsertDtmAssemblyRecord(List<DtmAssemblyRecord> list);
+}

+ 15 - 0
dtm-system/src/main/java/com/dtm/upload/mapper/DtmBomListMapper.java

@@ -0,0 +1,15 @@
+package com.dtm.upload.mapper;
+
+import com.dtm.upload.domain.DtmBomList;
+import java.util.List;
+
+public interface DtmBomListMapper {
+    DtmBomList selectDtmBomListById(Long id);
+    List<DtmBomList> selectDtmBomListList(DtmBomList bomList);
+    int insertDtmBomList(DtmBomList bomList);
+    int updateDtmBomList(DtmBomList bomList);
+    int deleteDtmBomListById(Long id);
+    int deleteDtmBomListByIds(Long[] ids);
+    int deleteAllDtmBomList();
+    int batchInsertDtmBomList(List<DtmBomList> list);
+}

+ 14 - 0
dtm-system/src/main/java/com/dtm/upload/mapper/DtmOrderMainMapper.java

@@ -0,0 +1,14 @@
+package com.dtm.upload.mapper;
+
+import com.dtm.upload.domain.DtmOrderMain;
+import java.util.List;
+
+public interface DtmOrderMainMapper {
+    DtmOrderMain selectDtmOrderMainById(String orderId);
+    List<DtmOrderMain> selectDtmOrderMainList(DtmOrderMain order);
+    int insertDtmOrderMain(DtmOrderMain order);
+    int updateDtmOrderMain(DtmOrderMain order);
+    int deleteDtmOrderMainById(String orderId);
+    int deleteDtmOrderMainByIds(String[] orderIds);
+    int batchUpsertDtmOrderMain(List<DtmOrderMain> list);
+}

+ 14 - 0
dtm-system/src/main/java/com/dtm/upload/mapper/DtmProductMapper.java

@@ -0,0 +1,14 @@
+package com.dtm.upload.mapper;
+
+import com.dtm.upload.domain.DtmProduct;
+import java.util.List;
+
+public interface DtmProductMapper {
+    DtmProduct selectDtmProductById(String sku);
+    List<DtmProduct> selectDtmProductList(DtmProduct product);
+    int insertDtmProduct(DtmProduct product);
+    int updateDtmProduct(DtmProduct product);
+    int deleteDtmProductById(String sku);
+    int deleteDtmProductByIds(String[] skus);
+    int batchUpsertDtmProduct(List<DtmProduct> list);
+}

+ 14 - 0
dtm-system/src/main/java/com/dtm/upload/mapper/DtmPurchaseReceiptMapper.java

@@ -0,0 +1,14 @@
+package com.dtm.upload.mapper;
+
+import com.dtm.upload.domain.DtmPurchaseReceipt;
+import java.util.List;
+
+public interface DtmPurchaseReceiptMapper {
+    DtmPurchaseReceipt selectDtmPurchaseReceiptById(String receiptId);
+    List<DtmPurchaseReceipt> selectDtmPurchaseReceiptList(DtmPurchaseReceipt receipt);
+    int insertDtmPurchaseReceipt(DtmPurchaseReceipt receipt);
+    int updateDtmPurchaseReceipt(DtmPurchaseReceipt receipt);
+    int deleteDtmPurchaseReceiptById(String receiptId);
+    int deleteDtmPurchaseReceiptByIds(String[] receiptIds);
+    int batchUpsertDtmPurchaseReceipt(List<DtmPurchaseReceipt> list);
+}

+ 14 - 0
dtm-system/src/main/java/com/dtm/upload/mapper/DtmSemiFinishedProductMapper.java

@@ -0,0 +1,14 @@
+package com.dtm.upload.mapper;
+
+import com.dtm.upload.domain.DtmSemiFinishedProduct;
+import java.util.List;
+
+public interface DtmSemiFinishedProductMapper {
+    DtmSemiFinishedProduct selectDtmSemiFinishedProductById(String sku);
+    List<DtmSemiFinishedProduct> selectDtmSemiFinishedProductList(DtmSemiFinishedProduct product);
+    int insertDtmSemiFinishedProduct(DtmSemiFinishedProduct product);
+    int updateDtmSemiFinishedProduct(DtmSemiFinishedProduct product);
+    int deleteDtmSemiFinishedProductById(String sku);
+    int deleteDtmSemiFinishedProductByIds(String[] skus);
+    int batchUpsertDtmSemiFinishedProduct(List<DtmSemiFinishedProduct> list);
+}

+ 15 - 0
dtm-system/src/main/java/com/dtm/upload/mapper/DtmStoreMapper.java

@@ -0,0 +1,15 @@
+package com.dtm.upload.mapper;
+
+import com.dtm.upload.domain.DtmStore;
+import java.util.List;
+
+public interface DtmStoreMapper {
+    DtmStore selectDtmStoreById(String storeCode);
+    List<DtmStore> selectDtmStoreList(DtmStore store);
+    int insertDtmStore(DtmStore store);
+    int updateDtmStore(DtmStore store);
+    int deleteDtmStoreById(String storeCode);
+    int deleteDtmStoreByIds(String[] storeCodes);
+    int deleteAllDtmStore();
+    int batchInsertDtmStore(List<DtmStore> list);
+}

+ 14 - 0
dtm-system/src/main/java/com/dtm/upload/mapper/DtmSupplierMapper.java

@@ -0,0 +1,14 @@
+package com.dtm.upload.mapper;
+
+import com.dtm.upload.domain.DtmSupplier;
+import java.util.List;
+
+public interface DtmSupplierMapper {
+    DtmSupplier selectDtmSupplierById(String supplierId);
+    List<DtmSupplier> selectDtmSupplierList(DtmSupplier supplier);
+    int insertDtmSupplier(DtmSupplier supplier);
+    int updateDtmSupplier(DtmSupplier supplier);
+    int deleteDtmSupplierById(String supplierId);
+    int deleteDtmSupplierByIds(String[] supplierIds);
+    int batchUpsertDtmSupplier(List<DtmSupplier> list);
+}

+ 14 - 0
dtm-system/src/main/java/com/dtm/upload/service/IDtmAssemblyRecordService.java

@@ -0,0 +1,14 @@
+package com.dtm.upload.service;
+
+import com.dtm.upload.domain.DtmAssemblyRecord;
+import java.util.List;
+
+public interface IDtmAssemblyRecordService {
+    DtmAssemblyRecord selectDtmAssemblyRecordById(Long id);
+    List<DtmAssemblyRecord> selectDtmAssemblyRecordList(DtmAssemblyRecord record);
+    int insertDtmAssemblyRecord(DtmAssemblyRecord record);
+    int updateDtmAssemblyRecord(DtmAssemblyRecord record);
+    int deleteDtmAssemblyRecordById(Long id);
+    int deleteDtmAssemblyRecordByIds(Long[] ids);
+    int replaceDtmAssemblyRecord(List<DtmAssemblyRecord> list);
+}

+ 14 - 0
dtm-system/src/main/java/com/dtm/upload/service/IDtmBomListService.java

@@ -0,0 +1,14 @@
+package com.dtm.upload.service;
+
+import com.dtm.upload.domain.DtmBomList;
+import java.util.List;
+
+public interface IDtmBomListService {
+    DtmBomList selectDtmBomListById(Long id);
+    List<DtmBomList> selectDtmBomListList(DtmBomList bomList);
+    int insertDtmBomList(DtmBomList bomList);
+    int updateDtmBomList(DtmBomList bomList);
+    int deleteDtmBomListById(Long id);
+    int deleteDtmBomListByIds(Long[] ids);
+    int replaceDtmBomList(List<DtmBomList> list);
+}

+ 14 - 0
dtm-system/src/main/java/com/dtm/upload/service/IDtmOrderMainService.java

@@ -0,0 +1,14 @@
+package com.dtm.upload.service;
+
+import com.dtm.upload.domain.DtmOrderMain;
+import java.util.List;
+
+public interface IDtmOrderMainService {
+    DtmOrderMain selectDtmOrderMainById(String orderId);
+    List<DtmOrderMain> selectDtmOrderMainList(DtmOrderMain order);
+    int insertDtmOrderMain(DtmOrderMain order);
+    int updateDtmOrderMain(DtmOrderMain order);
+    int deleteDtmOrderMainById(String orderId);
+    int deleteDtmOrderMainByIds(String[] orderIds);
+    int batchSaveDtmOrderMain(List<DtmOrderMain> list);
+}

+ 14 - 0
dtm-system/src/main/java/com/dtm/upload/service/IDtmProductService.java

@@ -0,0 +1,14 @@
+package com.dtm.upload.service;
+
+import com.dtm.upload.domain.DtmProduct;
+import java.util.List;
+
+public interface IDtmProductService {
+    DtmProduct selectDtmProductById(String sku);
+    List<DtmProduct> selectDtmProductList(DtmProduct product);
+    int insertDtmProduct(DtmProduct product);
+    int updateDtmProduct(DtmProduct product);
+    int deleteDtmProductById(String sku);
+    int deleteDtmProductByIds(String[] skus);
+    int batchSaveDtmProduct(List<DtmProduct> list);
+}

+ 14 - 0
dtm-system/src/main/java/com/dtm/upload/service/IDtmPurchaseReceiptService.java

@@ -0,0 +1,14 @@
+package com.dtm.upload.service;
+
+import com.dtm.upload.domain.DtmPurchaseReceipt;
+import java.util.List;
+
+public interface IDtmPurchaseReceiptService {
+    DtmPurchaseReceipt selectDtmPurchaseReceiptById(String receiptId);
+    List<DtmPurchaseReceipt> selectDtmPurchaseReceiptList(DtmPurchaseReceipt receipt);
+    int insertDtmPurchaseReceipt(DtmPurchaseReceipt receipt);
+    int updateDtmPurchaseReceipt(DtmPurchaseReceipt receipt);
+    int deleteDtmPurchaseReceiptById(String receiptId);
+    int deleteDtmPurchaseReceiptByIds(String[] receiptIds);
+    int batchSaveDtmPurchaseReceipt(List<DtmPurchaseReceipt> list);
+}

+ 14 - 0
dtm-system/src/main/java/com/dtm/upload/service/IDtmSemiFinishedProductService.java

@@ -0,0 +1,14 @@
+package com.dtm.upload.service;
+
+import com.dtm.upload.domain.DtmSemiFinishedProduct;
+import java.util.List;
+
+public interface IDtmSemiFinishedProductService {
+    DtmSemiFinishedProduct selectDtmSemiFinishedProductById(String sku);
+    List<DtmSemiFinishedProduct> selectDtmSemiFinishedProductList(DtmSemiFinishedProduct product);
+    int insertDtmSemiFinishedProduct(DtmSemiFinishedProduct product);
+    int updateDtmSemiFinishedProduct(DtmSemiFinishedProduct product);
+    int deleteDtmSemiFinishedProductById(String sku);
+    int deleteDtmSemiFinishedProductByIds(String[] skus);
+    int batchSaveDtmSemiFinishedProduct(List<DtmSemiFinishedProduct> list);
+}

+ 14 - 0
dtm-system/src/main/java/com/dtm/upload/service/IDtmStoreService.java

@@ -0,0 +1,14 @@
+package com.dtm.upload.service;
+
+import com.dtm.upload.domain.DtmStore;
+import java.util.List;
+
+public interface IDtmStoreService {
+    DtmStore selectDtmStoreById(String storeCode);
+    List<DtmStore> selectDtmStoreList(DtmStore store);
+    int insertDtmStore(DtmStore store);
+    int updateDtmStore(DtmStore store);
+    int deleteDtmStoreById(String storeCode);
+    int deleteDtmStoreByIds(String[] storeCodes);
+    int replaceDtmStore(List<DtmStore> list);
+}

+ 14 - 0
dtm-system/src/main/java/com/dtm/upload/service/IDtmSupplierService.java

@@ -0,0 +1,14 @@
+package com.dtm.upload.service;
+
+import com.dtm.upload.domain.DtmSupplier;
+import java.util.List;
+
+public interface IDtmSupplierService {
+    DtmSupplier selectDtmSupplierById(String supplierId);
+    List<DtmSupplier> selectDtmSupplierList(DtmSupplier supplier);
+    int insertDtmSupplier(DtmSupplier supplier);
+    int updateDtmSupplier(DtmSupplier supplier);
+    int deleteDtmSupplierById(String supplierId);
+    int deleteDtmSupplierByIds(String[] supplierIds);
+    int batchSaveDtmSupplier(List<DtmSupplier> list);
+}

+ 591 - 0
dtm-system/src/main/java/com/dtm/upload/service/PreparedDataUploadService.java

@@ -0,0 +1,591 @@
+package com.dtm.upload.service;
+
+import com.dtm.common.utils.StringUtils;
+import com.dtm.storage.util.ExcelSheet;
+import com.dtm.storage.util.ExcelUtils;
+import com.dtm.upload.domain.DtmAssemblyRecord;
+import com.dtm.upload.domain.DtmBomList;
+import com.dtm.upload.domain.DtmOrderMain;
+import com.dtm.upload.domain.DtmProduct;
+import com.dtm.upload.domain.DtmPurchaseReceipt;
+import com.dtm.upload.domain.DtmSemiFinishedProduct;
+import com.dtm.upload.domain.DtmStore;
+import com.dtm.upload.domain.DtmSupplier;
+import org.apache.commons.csv.CSVFormat;
+import org.apache.commons.csv.CSVParser;
+import org.apache.commons.csv.CSVRecord;
+import org.springframework.stereotype.Service;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
+import java.math.BigDecimal;
+import java.nio.charset.Charset;
+import java.nio.charset.StandardCharsets;
+import java.security.MessageDigest;
+import java.sql.Date;
+import java.sql.Timestamp;
+import java.time.LocalDate;
+import java.time.LocalDateTime;
+import java.time.format.DateTimeFormatter;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+@Service
+public class PreparedDataUploadService {
+    private static final Charset CSV_CHARSET = Charset.forName("GB18030");
+    private static final List<String> SUPPORTED_EXTENSIONS = Arrays.asList(".csv", ".xls", ".xlsx");
+
+    private final IDtmSupplierService supplierService;
+    private final IDtmSemiFinishedProductService semiFinishedProductService;
+    private final IDtmProductService productService;
+    private final IDtmBomListService bomListService;
+    private final IDtmPurchaseReceiptService purchaseReceiptService;
+    private final IDtmOrderMainService orderMainService;
+    private final IDtmAssemblyRecordService assemblyRecordService;
+    private final IDtmStoreService storeService;
+    private final Map<String, UploadConfig> configs;
+
+    public PreparedDataUploadService(IDtmSupplierService supplierService,
+                                     IDtmSemiFinishedProductService semiFinishedProductService,
+                                     IDtmProductService productService,
+                                     IDtmBomListService bomListService,
+                                     IDtmPurchaseReceiptService purchaseReceiptService,
+                                     IDtmOrderMainService orderMainService,
+                                     IDtmAssemblyRecordService assemblyRecordService,
+                                     IDtmStoreService storeService) {
+        this.supplierService = supplierService;
+        this.semiFinishedProductService = semiFinishedProductService;
+        this.productService = productService;
+        this.bomListService = bomListService;
+        this.purchaseReceiptService = purchaseReceiptService;
+        this.orderMainService = orderMainService;
+        this.assemblyRecordService = assemblyRecordService;
+        this.storeService = storeService;
+        this.configs = buildConfigs();
+    }
+
+    public List<Map<String, Object>> listSupportedItems() {
+        List<Map<String, Object>> items = new ArrayList<>();
+        for (UploadConfig config : configs.values()) {
+            Map<String, Object> item = new LinkedHashMap<>();
+            item.put("key", config.key);
+            item.put("label", config.label);
+            item.put("replaceBeforeInsert", config.replaceBeforeInsert);
+            items.add(item);
+        }
+        return items;
+    }
+
+    public Map<String, Object> upload(String key, MultipartFile file) {
+        UploadConfig config = configs.get(key);
+        validateFile(config, file);
+
+        try {
+            FileRows fileRows = readRows(file, resolveExtension(file.getOriginalFilename()));
+            List<FieldRequirement> missingFields = getMissingFields(config, fileRows.headers);
+            if (!missingFields.isEmpty()) {
+                throw new IllegalArgumentException("文件缺少必要内容:" + joinFieldLabels(missingFields));
+            }
+
+            int affected = writeRows(config, fileRows.rows);
+
+            Map<String, Object> result = new LinkedHashMap<>();
+            result.put("key", key);
+            result.put("label", config.label);
+            result.put("fileName", file.getOriginalFilename());
+            result.put("totalRows", fileRows.rows.size());
+            result.put("affectedRows", affected);
+            result.put("message", config.label + "处理完成,共读取 " + fileRows.rows.size() + " 行");
+            return result;
+        } catch (IllegalArgumentException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new IllegalStateException("上传处理失败: " + e.getMessage(), e);
+        }
+    }
+
+    public Map<String, Object> preview(String key, MultipartFile file) {
+        UploadConfig config = configs.get(key);
+        validateFile(config, file);
+
+        try {
+            FileRows fileRows = readRows(file, resolveExtension(file.getOriginalFilename()));
+            List<FieldRequirement> missingFields = getMissingFields(config, fileRows.headers);
+            Map<String, Object> result = new LinkedHashMap<>();
+            result.put("key", key);
+            result.put("label", config.label);
+            result.put("fileName", file.getOriginalFilename());
+            result.put("totalRows", fileRows.rows.size());
+            result.put("headers", fileRows.headers);
+            result.put("columns", buildPreviewColumns(fileRows.headers));
+            result.put("sampleRows", fileRows.rows.subList(0, Math.min(fileRows.rows.size(), 20)));
+            result.put("missingFields", missingFields);
+            result.put("valid", missingFields.isEmpty());
+            return result;
+        } catch (IllegalArgumentException e) {
+            throw e;
+        } catch (Exception e) {
+            throw new IllegalStateException("文件预览失败: " + e.getMessage(), e);
+        }
+    }
+
+    private void validateFile(UploadConfig config, MultipartFile file) {
+        if (config == null) {
+            throw new IllegalArgumentException("这项资料暂未整理完成,暂不支持上传");
+        }
+        if (file == null || file.isEmpty()) {
+            throw new IllegalArgumentException("请选择要上传的文件");
+        }
+        String extension = resolveExtension(file.getOriginalFilename());
+        if (!SUPPORTED_EXTENSIONS.contains(extension)) {
+            throw new IllegalArgumentException("文件格式不支持,请上传 CSV、XLS 或 XLSX 文件");
+        }
+    }
+
+    private int writeRows(UploadConfig config, List<Map<String, String>> rows) {
+        if (rows.isEmpty()) {
+            throw new IllegalArgumentException("文件中没有可导入的数据");
+        }
+        return config.writer.write(rows);
+    }
+
+    private FileRows readRows(MultipartFile file, String extension) throws Exception {
+        if (".csv".equals(extension)) {
+            return readCsv(file);
+        }
+        return readExcel(file);
+    }
+
+    private FileRows readCsv(MultipartFile file) throws Exception {
+        try (BufferedReader reader = new BufferedReader(new InputStreamReader(file.getInputStream(), CSV_CHARSET));
+             CSVParser parser = CSVFormat.DEFAULT.builder()
+                     .setHeader()
+                     .setSkipHeaderRecord(true)
+                     .setIgnoreEmptyLines(true)
+                     .setTrim(true)
+                     .build()
+                     .parse(reader)) {
+            List<String> headers = normalizeHeaders(new ArrayList<>(parser.getHeaderMap().keySet()));
+            List<Map<String, String>> rows = new ArrayList<>();
+            for (CSVRecord record : parser) {
+                Map<String, String> row = new HashMap<>();
+                boolean hasValue = false;
+                for (int i = 0; i < headers.size() && i < record.size(); i++) {
+                    String value = clean(record.get(i));
+                    if (StringUtils.isNotEmpty(value)) {
+                        hasValue = true;
+                    }
+                    row.put(headers.get(i), value);
+                }
+                if (hasValue) {
+                    rows.add(row);
+                }
+            }
+            return new FileRows(headers, rows);
+        }
+    }
+
+    private FileRows readExcel(MultipartFile file) throws Exception {
+        java.nio.file.Path temp = java.nio.file.Files.createTempFile("prepared-data-upload-", resolveExtension(file.getOriginalFilename()));
+        try {
+            file.transferTo(temp.toFile());
+            ExcelSheet sheet = ExcelUtils.readSheet(temp, 0);
+            List<String> headers = normalizeHeaders(sheet.getHeaders());
+            List<Map<String, String>> rows = new ArrayList<>();
+            for (List<Object> values : sheet.getRows()) {
+                Map<String, String> row = new HashMap<>();
+                boolean hasValue = false;
+                for (int i = 0; i < headers.size() && i < values.size(); i++) {
+                    String value = clean(values.get(i));
+                    if (StringUtils.isNotEmpty(value)) {
+                        hasValue = true;
+                    }
+                    row.put(headers.get(i), value);
+                }
+                if (hasValue) {
+                    rows.add(row);
+                }
+            }
+            return new FileRows(headers, rows);
+        } finally {
+            java.nio.file.Files.deleteIfExists(temp);
+        }
+    }
+
+    private Map<String, UploadConfig> buildConfigs() {
+        Map<String, UploadConfig> map = new LinkedHashMap<>();
+        map.put("supplier", new UploadConfig("supplier", "供应商资料", false, fields(
+                field("supplier_id", "供应商编号"), field("supplier_name", "供应商名称")),
+                rows -> supplierService.batchSaveDtmSupplier(mapRows(rows, this::mapSupplierRow))));
+        map.put("semi_finished_product", new UploadConfig("semi_finished_product", "半成品资料", false, fields(
+                field("sku", "半成品编码"), field("semi_name", "半成品名称"), field("price", "单价")),
+                rows -> semiFinishedProductService.batchSaveDtmSemiFinishedProduct(mapRows(rows, this::mapSemiFinishedProductRow))));
+        map.put("product", new UploadConfig("product", "产品资料", false, fields(
+                field("sku", "产品编码"), field("product_name", "产品名称"), field("product_price", "产品价格")),
+                rows -> productService.batchSaveDtmProduct(mapRows(rows, this::mapProductRow))));
+        map.put("bom_list", new UploadConfig("bom_list", "组合清单资料", true, fields(
+                field("finished_sku", "成品编码"), field("semi_sku", "半成品编码"), field("quantity", "数量")),
+                rows -> bomListService.replaceDtmBomList(mapRows(rows, this::mapBomListRow))));
+        map.put("purchase_receipt", new UploadConfig("purchase_receipt", "采购入库资料", false, fields(
+                field("receipt_id", "入库单号"), field("product_code", "产品编码"), field("supplier_id", "供应商编号"),
+                field("quantity", "数量"), field("receipt_date", "入库日期")),
+                rows -> purchaseReceiptService.batchSaveDtmPurchaseReceipt(mapRows(rows, this::mapPurchaseReceiptRow))));
+        map.put("order_main", new UploadConfig("order_main", "订单资料", false, fields(
+                field("order_id", "订单编号"), field("price", "单价"), field("quantity", "数量")),
+                rows -> orderMainService.batchSaveDtmOrderMain(mapRows(rows, this::mapOrderMainRow))));
+        map.put("assembly_record", new UploadConfig("assembly_record", "组装记录资料", true, fields(
+                field("assembly_date", "组装日期"), field("product_code", "产品编码"), field("quantity", "数量")),
+                rows -> assemblyRecordService.replaceDtmAssemblyRecord(mapRows(rows, this::mapAssemblyRecordRow))));
+        map.put("store", new UploadConfig("store", "店铺资料", true, fields(
+                field("business_unit_name", "事业部"), field("channel_name", "渠道"), field("platform_name", "店铺名称"),
+                field("stat_year", "年份"), field("stat_month", "月份"), field("stat_day", "日期"),
+                field("quantity", "数量"), field("sales_amount", "销售金额")),
+                rows -> storeService.replaceDtmStore(mapRows(rows, this::mapStoreRow))));
+        return map;
+    }
+
+    private List<FieldRequirement> getMissingFields(UploadConfig config, List<String> headers) {
+        List<FieldRequirement> missingFields = new ArrayList<>();
+        for (FieldRequirement field : config.requiredFields) {
+            if (!headers.contains(field.name)) {
+                missingFields.add(field);
+            }
+        }
+        return missingFields;
+    }
+
+    private String joinFieldLabels(List<FieldRequirement> fields) {
+        List<String> labels = new ArrayList<>();
+        for (FieldRequirement field : fields) {
+            labels.add(field.label + "(" + field.name + ")");
+        }
+        return String.join("、", labels);
+    }
+
+    private List<Map<String, Object>> buildPreviewColumns(List<String> headers) {
+        List<Map<String, Object>> columns = new ArrayList<>();
+        for (String header : headers) {
+            Map<String, Object> column = new LinkedHashMap<>();
+            column.put("prop", header);
+            column.put("label", header);
+            column.put("minWidth", 140);
+            columns.add(column);
+        }
+        return columns;
+    }
+
+    private static List<FieldRequirement> fields(FieldRequirement... fields) {
+        return Arrays.asList(fields);
+    }
+
+    private static FieldRequirement field(String name, String label) {
+        return new FieldRequirement(name, label);
+    }
+
+    private DtmSupplier mapSupplierRow(Map<String, String> row) {
+        DtmSupplier supplier = new DtmSupplier();
+        supplier.setSupplierId(text(row, "supplier_id", 32));
+        supplier.setSupplierName(text(row, "supplier_name", 100));
+        return supplier;
+    }
+
+    private DtmSemiFinishedProduct mapSemiFinishedProductRow(Map<String, String> row) {
+        DtmSemiFinishedProduct product = new DtmSemiFinishedProduct();
+        product.setSku(text(row, "sku", 64));
+        product.setSemiName(text(row, "semi_name", 100));
+        product.setPrice(decimal(row, "price"));
+        product.setBomLevelId(nullableText(row, "bom_level_id", 32));
+        return product;
+    }
+
+    private DtmProduct mapProductRow(Map<String, String> row) {
+        DtmProduct product = new DtmProduct();
+        product.setSku(text(row, "sku", 64));
+        product.setProductName(text(row, "product_name", 128));
+        product.setSpu(nullableText(row, "spu", 64));
+        product.setProductPrice(decimal(row, "product_price"));
+        product.setAttributes(nullableText(row, "attributes", 32));
+        product.setBomLevelId(nullableText(row, "bom_level_id", 32));
+        return product;
+    }
+
+    private DtmBomList mapBomListRow(Map<String, String> row) {
+        DtmBomList bom = new DtmBomList();
+        bom.setFinishedSku(text(row, "finished_sku", 64));
+        bom.setSemiSku(text(row, "semi_sku", 64));
+        bom.setQuantity(integer(row, "quantity"));
+        return bom;
+    }
+
+    private DtmPurchaseReceipt mapPurchaseReceiptRow(Map<String, String> row) {
+        DtmPurchaseReceipt receipt = new DtmPurchaseReceipt();
+        receipt.setReceiptId(text(row, "receipt_id", 32));
+        receipt.setSku(text(row, "product_code", 64));
+        receipt.setSupplierId(text(row, "supplier_id", 32));
+        receipt.setWarehouseCode(nullableText(row, "warehouse_code", 32));
+        receipt.setUnitprice(decimal(row, "unitprice"));
+        receipt.setActualAmount(decimal(row, "actual_amount"));
+        receipt.setQuantity(integer(row, "quantity"));
+        receipt.setReceiptDate(date(row, "receipt_date"));
+        receipt.setStatus(nullableText(row, "status", 16));
+        return receipt;
+    }
+
+    private DtmOrderMain mapOrderMainRow(Map<String, String> row) {
+        DtmOrderMain order = new DtmOrderMain();
+        order.setOrderId(text(row, "order_id", 64));
+        order.setTitle(nullableText(row, "title", 255));
+        order.setPrice(decimal(row, "price"));
+        order.setQuantity(integer(row, "quantity"));
+        order.setSku(nullableText(row, "sku", 32));
+        order.setAttrs(nullableText(row, "attrs", 500));
+        order.setOrderStatus(nullableText(row, "order_status", 32));
+        order.setPayNumber(nullableText(row, "pay_number", 32));
+        order.setPayAmount(decimal(row, "pay_amount"));
+        order.setPaidAmount(decimal(row, "paid_amount"));
+        order.setRefundStatus(nullableText(row, "refund_status", 32));
+        order.setRefundAmount(nullableText(row, "refund_amount", 32));
+        order.setCreateTime(timestamp(row, "create_time"));
+        order.setPayTime(timestamp(row, "pay_time"));
+        return order;
+    }
+
+    private DtmAssemblyRecord mapAssemblyRecordRow(Map<String, String> row) {
+        DtmAssemblyRecord record = new DtmAssemblyRecord();
+        record.setAssemblyDate(date(row, "assembly_date"));
+        record.setProductCode(text(row, "product_code", 64));
+        record.setQuantity(integer(row, "quantity"));
+        return record;
+    }
+
+    private DtmStore mapStoreRow(Map<String, String> row) {
+        String deptName = text(row, "business_unit_name", 32);
+        String channelName = text(row, "channel_name", 32);
+        String storeName = text(row, "platform_name", 32);
+        LocalDate date = dateFromParts(row);
+
+        DtmStore store = new DtmStore();
+        store.setStoreCode(buildStoreCode(row, deptName, channelName, storeName, date));
+        store.setStoreName(storeName);
+        store.setDeptName(deptName);
+        store.setChannelName(channelName);
+        store.setRecordStartDate(Date.valueOf(date));
+        store.setRecordEndDate(Date.valueOf(date));
+        store.setSalesQty(integer(row, "quantity"));
+        store.setSalesAmount(decimal(row, "sales_amount"));
+        return store;
+    }
+
+    private <T> List<T> mapRows(List<Map<String, String>> rows, RowMapper<T> mapper) {
+        List<T> list = new ArrayList<>();
+        for (Map<String, String> row : rows) {
+            T item = mapper.map(row);
+            if (item != null) {
+                list.add(item);
+            }
+        }
+        return list;
+    }
+
+    private LocalDate dateFromParts(Map<String, String> row) {
+        int year = safeInt(value(row, "stat_year"), 1970);
+        int month = safeInt(value(row, "stat_month"), 1);
+        int day = safeInt(value(row, "stat_day"), 1);
+        return LocalDate.of(year, month, day);
+    }
+
+    private String buildStoreCode(Map<String, String> row, String deptName, String channelName, String storeName, LocalDate date) {
+        String raw = deptName + "|" + channelName + "|" + storeName + "|" + date + "|"
+                + value(row, "product_code") + "|" + value(row, "quantity") + "|" + value(row, "sales_amount");
+        return "ST" + md5(raw).substring(0, 14).toUpperCase(Locale.ROOT);
+    }
+
+    private String md5(String raw) {
+        try {
+            MessageDigest digest = MessageDigest.getInstance("MD5");
+            byte[] bytes = digest.digest(raw.getBytes(StandardCharsets.UTF_8));
+            StringBuilder builder = new StringBuilder();
+            for (byte b : bytes) {
+                builder.append(String.format("%02x", b));
+            }
+            return builder.toString();
+        } catch (Exception e) {
+            return Integer.toHexString(raw.hashCode());
+        }
+    }
+
+    private List<String> normalizeHeaders(List<String> headers) {
+        List<String> result = new ArrayList<>();
+        if (headers == null) {
+            return result;
+        }
+        for (String header : headers) {
+            result.add(clean(header).toLowerCase(Locale.ROOT));
+        }
+        return result;
+    }
+
+    private static String text(Map<String, String> row, String key, int maxLength) {
+        String value = value(row, key);
+        if (StringUtils.isEmpty(value)) {
+            throw new IllegalArgumentException("缺少必填内容: " + key);
+        }
+        return limit(value, maxLength);
+    }
+
+    private static String nullableText(Map<String, String> row, String key, int maxLength) {
+        String value = value(row, key);
+        return StringUtils.isEmpty(value) ? null : limit(value, maxLength);
+    }
+
+    private static Integer integer(Map<String, String> row, String key) {
+        String value = value(row, key);
+        if (StringUtils.isEmpty(value)) {
+            return null;
+        }
+        return new BigDecimal(value.replace(",", "")).intValue();
+    }
+
+    private static int safeInt(String value, int fallback) {
+        if (StringUtils.isEmpty(value)) {
+            return fallback;
+        }
+        try {
+            return new BigDecimal(value.replace(",", "")).intValue();
+        } catch (Exception e) {
+            return fallback;
+        }
+    }
+
+    private static BigDecimal decimal(Map<String, String> row, String key) {
+        String value = value(row, key);
+        if (StringUtils.isEmpty(value) || "无退款金额".equals(value)) {
+            return null;
+        }
+        return new BigDecimal(value.replace(",", ""));
+    }
+
+    private static Date date(Map<String, String> row, String key) {
+        String value = value(row, key);
+        if (StringUtils.isEmpty(value)) {
+            return null;
+        }
+        return Date.valueOf(parseDate(value));
+    }
+
+    private static Timestamp timestamp(Map<String, String> row, String key) {
+        String value = value(row, key);
+        if (StringUtils.isEmpty(value)) {
+            return null;
+        }
+        String normalized = value.trim().replace('/', '-');
+        if (normalized.length() <= 10) {
+            return Timestamp.valueOf(LocalDate.parse(normalized, DateTimeFormatter.ofPattern("yyyy-M-d")).atStartOfDay());
+        }
+        List<DateTimeFormatter> formatters = Arrays.asList(
+                DateTimeFormatter.ofPattern("yyyy-M-d H:m:s"),
+                DateTimeFormatter.ofPattern("yyyy-M-d H:m")
+        );
+        for (DateTimeFormatter formatter : formatters) {
+            try {
+                return Timestamp.valueOf(LocalDateTime.parse(normalized, formatter));
+            } catch (Exception ignored) {
+            }
+        }
+        throw new IllegalArgumentException("无法解析时间: " + value);
+    }
+
+    private static LocalDate parseDate(String value) {
+        String normalized = value.trim().replace('/', '-');
+        return LocalDate.parse(normalized, DateTimeFormatter.ofPattern("yyyy-M-d"));
+    }
+
+    private static String value(Map<String, String> row, String key) {
+        return clean(row.get(key.toLowerCase(Locale.ROOT)));
+    }
+
+    private static String clean(Object value) {
+        if (value == null) {
+            return "";
+        }
+        String text = String.valueOf(value).trim();
+        if (text.startsWith("\uFEFF")) {
+            text = text.substring(1);
+        }
+        return text;
+    }
+
+    private static String limit(String value, int maxLength) {
+        if (value == null || value.length() <= maxLength) {
+            return value;
+        }
+        return value.substring(0, maxLength);
+    }
+
+    private String resolveExtension(String fileName) {
+        if (fileName == null) {
+            return "";
+        }
+        int idx = fileName.lastIndexOf('.');
+        return idx < 0 ? "" : fileName.substring(idx).toLowerCase(Locale.ROOT);
+    }
+
+    private interface UploadWriter {
+        int write(List<Map<String, String>> rows);
+    }
+
+    private interface RowMapper<T> {
+        T map(Map<String, String> row);
+    }
+
+    private static class FileRows {
+        private final List<String> headers;
+        private final List<Map<String, String>> rows;
+
+        private FileRows(List<String> headers, List<Map<String, String>> rows) {
+            this.headers = headers;
+            this.rows = rows;
+        }
+    }
+
+    private static class FieldRequirement {
+        private final String name;
+        private final String label;
+
+        private FieldRequirement(String name, String label) {
+            this.name = name;
+            this.label = label;
+        }
+
+        public String getName() {
+            return name;
+        }
+
+        public String getLabel() {
+            return label;
+        }
+    }
+
+    private static class UploadConfig {
+        private final String key;
+        private final String label;
+        private final boolean replaceBeforeInsert;
+        private final List<FieldRequirement> requiredFields;
+        private final UploadWriter writer;
+
+        private UploadConfig(String key, String label, boolean replaceBeforeInsert,
+                             List<FieldRequirement> requiredFields, UploadWriter writer) {
+            this.key = key;
+            this.label = label;
+            this.replaceBeforeInsert = replaceBeforeInsert;
+            this.requiredFields = requiredFields;
+            this.writer = writer;
+        }
+    }
+}

+ 31 - 0
dtm-system/src/main/java/com/dtm/upload/service/impl/DtmAssemblyRecordServiceImpl.java

@@ -0,0 +1,31 @@
+package com.dtm.upload.service.impl;
+
+import com.dtm.upload.domain.DtmAssemblyRecord;
+import com.dtm.upload.mapper.DtmAssemblyRecordMapper;
+import com.dtm.upload.service.IDtmAssemblyRecordService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import java.util.List;
+
+@Service
+public class DtmAssemblyRecordServiceImpl implements IDtmAssemblyRecordService {
+    private final DtmAssemblyRecordMapper mapper;
+    public DtmAssemblyRecordServiceImpl(DtmAssemblyRecordMapper mapper) { this.mapper = mapper; }
+    public DtmAssemblyRecord selectDtmAssemblyRecordById(Long id) { return mapper.selectDtmAssemblyRecordById(id); }
+    public List<DtmAssemblyRecord> selectDtmAssemblyRecordList(DtmAssemblyRecord record) { return mapper.selectDtmAssemblyRecordList(record); }
+    public int insertDtmAssemblyRecord(DtmAssemblyRecord record) { return mapper.insertDtmAssemblyRecord(record); }
+    public int updateDtmAssemblyRecord(DtmAssemblyRecord record) { return mapper.updateDtmAssemblyRecord(record); }
+    public int deleteDtmAssemblyRecordById(Long id) { return mapper.deleteDtmAssemblyRecordById(id); }
+    public int deleteDtmAssemblyRecordByIds(Long[] ids) { return mapper.deleteDtmAssemblyRecordByIds(ids); }
+    @Transactional
+    public int replaceDtmAssemblyRecord(List<DtmAssemblyRecord> list) {
+        mapper.deleteAllDtmAssemblyRecord();
+        return batch(list, mapper::batchInsertDtmAssemblyRecord);
+    }
+    private <T> int batch(List<T> list, java.util.function.ToIntFunction<List<T>> consumer) {
+        if (list == null || list.isEmpty()) return 0;
+        int total = 0;
+        for (int i = 0; i < list.size(); i += 500) total += consumer.applyAsInt(list.subList(i, Math.min(i + 500, list.size())));
+        return total;
+    }
+}

+ 31 - 0
dtm-system/src/main/java/com/dtm/upload/service/impl/DtmBomListServiceImpl.java

@@ -0,0 +1,31 @@
+package com.dtm.upload.service.impl;
+
+import com.dtm.upload.domain.DtmBomList;
+import com.dtm.upload.mapper.DtmBomListMapper;
+import com.dtm.upload.service.IDtmBomListService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import java.util.List;
+
+@Service
+public class DtmBomListServiceImpl implements IDtmBomListService {
+    private final DtmBomListMapper mapper;
+    public DtmBomListServiceImpl(DtmBomListMapper mapper) { this.mapper = mapper; }
+    public DtmBomList selectDtmBomListById(Long id) { return mapper.selectDtmBomListById(id); }
+    public List<DtmBomList> selectDtmBomListList(DtmBomList bomList) { return mapper.selectDtmBomListList(bomList); }
+    public int insertDtmBomList(DtmBomList bomList) { return mapper.insertDtmBomList(bomList); }
+    public int updateDtmBomList(DtmBomList bomList) { return mapper.updateDtmBomList(bomList); }
+    public int deleteDtmBomListById(Long id) { return mapper.deleteDtmBomListById(id); }
+    public int deleteDtmBomListByIds(Long[] ids) { return mapper.deleteDtmBomListByIds(ids); }
+    @Transactional
+    public int replaceDtmBomList(List<DtmBomList> list) {
+        mapper.deleteAllDtmBomList();
+        return batch(list, mapper::batchInsertDtmBomList);
+    }
+    private <T> int batch(List<T> list, java.util.function.ToIntFunction<List<T>> consumer) {
+        if (list == null || list.isEmpty()) return 0;
+        int total = 0;
+        for (int i = 0; i < list.size(); i += 500) total += consumer.applyAsInt(list.subList(i, Math.min(i + 500, list.size())));
+        return total;
+    }
+}

+ 28 - 0
dtm-system/src/main/java/com/dtm/upload/service/impl/DtmOrderMainServiceImpl.java

@@ -0,0 +1,28 @@
+package com.dtm.upload.service.impl;
+
+import com.dtm.upload.domain.DtmOrderMain;
+import com.dtm.upload.mapper.DtmOrderMainMapper;
+import com.dtm.upload.service.IDtmOrderMainService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import java.util.List;
+
+@Service
+public class DtmOrderMainServiceImpl implements IDtmOrderMainService {
+    private final DtmOrderMainMapper mapper;
+    public DtmOrderMainServiceImpl(DtmOrderMainMapper mapper) { this.mapper = mapper; }
+    public DtmOrderMain selectDtmOrderMainById(String orderId) { return mapper.selectDtmOrderMainById(orderId); }
+    public List<DtmOrderMain> selectDtmOrderMainList(DtmOrderMain order) { return mapper.selectDtmOrderMainList(order); }
+    public int insertDtmOrderMain(DtmOrderMain order) { return mapper.insertDtmOrderMain(order); }
+    public int updateDtmOrderMain(DtmOrderMain order) { return mapper.updateDtmOrderMain(order); }
+    public int deleteDtmOrderMainById(String orderId) { return mapper.deleteDtmOrderMainById(orderId); }
+    public int deleteDtmOrderMainByIds(String[] orderIds) { return mapper.deleteDtmOrderMainByIds(orderIds); }
+    @Transactional
+    public int batchSaveDtmOrderMain(List<DtmOrderMain> list) { return batch(list, mapper::batchUpsertDtmOrderMain); }
+    private <T> int batch(List<T> list, java.util.function.ToIntFunction<List<T>> consumer) {
+        if (list == null || list.isEmpty()) return 0;
+        int total = 0;
+        for (int i = 0; i < list.size(); i += 500) total += consumer.applyAsInt(list.subList(i, Math.min(i + 500, list.size())));
+        return total;
+    }
+}

+ 28 - 0
dtm-system/src/main/java/com/dtm/upload/service/impl/DtmProductServiceImpl.java

@@ -0,0 +1,28 @@
+package com.dtm.upload.service.impl;
+
+import com.dtm.upload.domain.DtmProduct;
+import com.dtm.upload.mapper.DtmProductMapper;
+import com.dtm.upload.service.IDtmProductService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import java.util.List;
+
+@Service
+public class DtmProductServiceImpl implements IDtmProductService {
+    private final DtmProductMapper mapper;
+    public DtmProductServiceImpl(DtmProductMapper mapper) { this.mapper = mapper; }
+    public DtmProduct selectDtmProductById(String sku) { return mapper.selectDtmProductById(sku); }
+    public List<DtmProduct> selectDtmProductList(DtmProduct product) { return mapper.selectDtmProductList(product); }
+    public int insertDtmProduct(DtmProduct product) { return mapper.insertDtmProduct(product); }
+    public int updateDtmProduct(DtmProduct product) { return mapper.updateDtmProduct(product); }
+    public int deleteDtmProductById(String sku) { return mapper.deleteDtmProductById(sku); }
+    public int deleteDtmProductByIds(String[] skus) { return mapper.deleteDtmProductByIds(skus); }
+    @Transactional
+    public int batchSaveDtmProduct(List<DtmProduct> list) { return batch(list, mapper::batchUpsertDtmProduct); }
+    private <T> int batch(List<T> list, java.util.function.ToIntFunction<List<T>> consumer) {
+        if (list == null || list.isEmpty()) return 0;
+        int total = 0;
+        for (int i = 0; i < list.size(); i += 500) total += consumer.applyAsInt(list.subList(i, Math.min(i + 500, list.size())));
+        return total;
+    }
+}

+ 28 - 0
dtm-system/src/main/java/com/dtm/upload/service/impl/DtmPurchaseReceiptServiceImpl.java

@@ -0,0 +1,28 @@
+package com.dtm.upload.service.impl;
+
+import com.dtm.upload.domain.DtmPurchaseReceipt;
+import com.dtm.upload.mapper.DtmPurchaseReceiptMapper;
+import com.dtm.upload.service.IDtmPurchaseReceiptService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import java.util.List;
+
+@Service
+public class DtmPurchaseReceiptServiceImpl implements IDtmPurchaseReceiptService {
+    private final DtmPurchaseReceiptMapper mapper;
+    public DtmPurchaseReceiptServiceImpl(DtmPurchaseReceiptMapper mapper) { this.mapper = mapper; }
+    public DtmPurchaseReceipt selectDtmPurchaseReceiptById(String receiptId) { return mapper.selectDtmPurchaseReceiptById(receiptId); }
+    public List<DtmPurchaseReceipt> selectDtmPurchaseReceiptList(DtmPurchaseReceipt receipt) { return mapper.selectDtmPurchaseReceiptList(receipt); }
+    public int insertDtmPurchaseReceipt(DtmPurchaseReceipt receipt) { return mapper.insertDtmPurchaseReceipt(receipt); }
+    public int updateDtmPurchaseReceipt(DtmPurchaseReceipt receipt) { return mapper.updateDtmPurchaseReceipt(receipt); }
+    public int deleteDtmPurchaseReceiptById(String receiptId) { return mapper.deleteDtmPurchaseReceiptById(receiptId); }
+    public int deleteDtmPurchaseReceiptByIds(String[] receiptIds) { return mapper.deleteDtmPurchaseReceiptByIds(receiptIds); }
+    @Transactional
+    public int batchSaveDtmPurchaseReceipt(List<DtmPurchaseReceipt> list) { return batch(list, mapper::batchUpsertDtmPurchaseReceipt); }
+    private <T> int batch(List<T> list, java.util.function.ToIntFunction<List<T>> consumer) {
+        if (list == null || list.isEmpty()) return 0;
+        int total = 0;
+        for (int i = 0; i < list.size(); i += 500) total += consumer.applyAsInt(list.subList(i, Math.min(i + 500, list.size())));
+        return total;
+    }
+}

+ 28 - 0
dtm-system/src/main/java/com/dtm/upload/service/impl/DtmSemiFinishedProductServiceImpl.java

@@ -0,0 +1,28 @@
+package com.dtm.upload.service.impl;
+
+import com.dtm.upload.domain.DtmSemiFinishedProduct;
+import com.dtm.upload.mapper.DtmSemiFinishedProductMapper;
+import com.dtm.upload.service.IDtmSemiFinishedProductService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import java.util.List;
+
+@Service
+public class DtmSemiFinishedProductServiceImpl implements IDtmSemiFinishedProductService {
+    private final DtmSemiFinishedProductMapper mapper;
+    public DtmSemiFinishedProductServiceImpl(DtmSemiFinishedProductMapper mapper) { this.mapper = mapper; }
+    public DtmSemiFinishedProduct selectDtmSemiFinishedProductById(String sku) { return mapper.selectDtmSemiFinishedProductById(sku); }
+    public List<DtmSemiFinishedProduct> selectDtmSemiFinishedProductList(DtmSemiFinishedProduct product) { return mapper.selectDtmSemiFinishedProductList(product); }
+    public int insertDtmSemiFinishedProduct(DtmSemiFinishedProduct product) { return mapper.insertDtmSemiFinishedProduct(product); }
+    public int updateDtmSemiFinishedProduct(DtmSemiFinishedProduct product) { return mapper.updateDtmSemiFinishedProduct(product); }
+    public int deleteDtmSemiFinishedProductById(String sku) { return mapper.deleteDtmSemiFinishedProductById(sku); }
+    public int deleteDtmSemiFinishedProductByIds(String[] skus) { return mapper.deleteDtmSemiFinishedProductByIds(skus); }
+    @Transactional
+    public int batchSaveDtmSemiFinishedProduct(List<DtmSemiFinishedProduct> list) { return batch(list, mapper::batchUpsertDtmSemiFinishedProduct); }
+    private <T> int batch(List<T> list, java.util.function.ToIntFunction<List<T>> consumer) {
+        if (list == null || list.isEmpty()) return 0;
+        int total = 0;
+        for (int i = 0; i < list.size(); i += 500) total += consumer.applyAsInt(list.subList(i, Math.min(i + 500, list.size())));
+        return total;
+    }
+}

+ 31 - 0
dtm-system/src/main/java/com/dtm/upload/service/impl/DtmStoreServiceImpl.java

@@ -0,0 +1,31 @@
+package com.dtm.upload.service.impl;
+
+import com.dtm.upload.domain.DtmStore;
+import com.dtm.upload.mapper.DtmStoreMapper;
+import com.dtm.upload.service.IDtmStoreService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import java.util.List;
+
+@Service
+public class DtmStoreServiceImpl implements IDtmStoreService {
+    private final DtmStoreMapper mapper;
+    public DtmStoreServiceImpl(DtmStoreMapper mapper) { this.mapper = mapper; }
+    public DtmStore selectDtmStoreById(String storeCode) { return mapper.selectDtmStoreById(storeCode); }
+    public List<DtmStore> selectDtmStoreList(DtmStore store) { return mapper.selectDtmStoreList(store); }
+    public int insertDtmStore(DtmStore store) { return mapper.insertDtmStore(store); }
+    public int updateDtmStore(DtmStore store) { return mapper.updateDtmStore(store); }
+    public int deleteDtmStoreById(String storeCode) { return mapper.deleteDtmStoreById(storeCode); }
+    public int deleteDtmStoreByIds(String[] storeCodes) { return mapper.deleteDtmStoreByIds(storeCodes); }
+    @Transactional
+    public int replaceDtmStore(List<DtmStore> list) {
+        mapper.deleteAllDtmStore();
+        return batch(list, mapper::batchInsertDtmStore);
+    }
+    private <T> int batch(List<T> list, java.util.function.ToIntFunction<List<T>> consumer) {
+        if (list == null || list.isEmpty()) return 0;
+        int total = 0;
+        for (int i = 0; i < list.size(); i += 500) total += consumer.applyAsInt(list.subList(i, Math.min(i + 500, list.size())));
+        return total;
+    }
+}

+ 28 - 0
dtm-system/src/main/java/com/dtm/upload/service/impl/DtmSupplierServiceImpl.java

@@ -0,0 +1,28 @@
+package com.dtm.upload.service.impl;
+
+import com.dtm.upload.domain.DtmSupplier;
+import com.dtm.upload.mapper.DtmSupplierMapper;
+import com.dtm.upload.service.IDtmSupplierService;
+import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import java.util.List;
+
+@Service
+public class DtmSupplierServiceImpl implements IDtmSupplierService {
+    private final DtmSupplierMapper mapper;
+    public DtmSupplierServiceImpl(DtmSupplierMapper mapper) { this.mapper = mapper; }
+    public DtmSupplier selectDtmSupplierById(String supplierId) { return mapper.selectDtmSupplierById(supplierId); }
+    public List<DtmSupplier> selectDtmSupplierList(DtmSupplier supplier) { return mapper.selectDtmSupplierList(supplier); }
+    public int insertDtmSupplier(DtmSupplier supplier) { return mapper.insertDtmSupplier(supplier); }
+    public int updateDtmSupplier(DtmSupplier supplier) { return mapper.updateDtmSupplier(supplier); }
+    public int deleteDtmSupplierById(String supplierId) { return mapper.deleteDtmSupplierById(supplierId); }
+    public int deleteDtmSupplierByIds(String[] supplierIds) { return mapper.deleteDtmSupplierByIds(supplierIds); }
+    @Transactional
+    public int batchSaveDtmSupplier(List<DtmSupplier> list) { return batch(list, mapper::batchUpsertDtmSupplier); }
+    private <T> int batch(List<T> list, java.util.function.ToIntFunction<List<T>> consumer) {
+        if (list == null || list.isEmpty()) return 0;
+        int total = 0;
+        for (int i = 0; i < list.size(); i += 500) total += consumer.applyAsInt(list.subList(i, Math.min(i + 500, list.size())));
+        return total;
+    }
+}

+ 34 - 0
dtm-system/src/main/resources/mapper/upload/DtmAssemblyRecordMapper.xml

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.dtm.upload.mapper.DtmAssemblyRecordMapper">
+    <resultMap id="DtmAssemblyRecordResult" type="DtmAssemblyRecord">
+        <id property="id" column="id"/>
+        <result property="productCode" column="product_code"/>
+        <result property="assemblyDate" column="assembly_date"/>
+        <result property="quantity" column="quantity"/>
+    </resultMap>
+    <sql id="selectVo">select id, product_code, assembly_date, quantity from dtm_assembly_record</sql>
+    <select id="selectDtmAssemblyRecordById" parameterType="Long" resultMap="DtmAssemblyRecordResult"><include refid="selectVo"/> where id=#{id}</select>
+    <select id="selectDtmAssemblyRecordList" parameterType="DtmAssemblyRecord" resultMap="DtmAssemblyRecordResult">
+        <include refid="selectVo"/>
+        <where>
+            <if test="productCode != null and productCode != ''">and product_code = #{productCode}</if>
+            <if test="assemblyDate != null">and assembly_date = #{assemblyDate}</if>
+        </where>
+    </select>
+    <insert id="insertDtmAssemblyRecord" parameterType="DtmAssemblyRecord" useGeneratedKeys="true" keyProperty="id">
+        insert into dtm_assembly_record (product_code, assembly_date, quantity) values (#{productCode}, #{assemblyDate}, #{quantity})
+    </insert>
+    <update id="updateDtmAssemblyRecord" parameterType="DtmAssemblyRecord">
+        update dtm_assembly_record set product_code=#{productCode}, assembly_date=#{assemblyDate}, quantity=#{quantity} where id=#{id}
+    </update>
+    <delete id="deleteDtmAssemblyRecordById" parameterType="Long">delete from dtm_assembly_record where id=#{id}</delete>
+    <delete id="deleteDtmAssemblyRecordByIds" parameterType="Long">
+        delete from dtm_assembly_record where id in <foreach collection="array" item="id" open="(" separator="," close=")">#{id}</foreach>
+    </delete>
+    <delete id="deleteAllDtmAssemblyRecord">delete from dtm_assembly_record</delete>
+    <insert id="batchInsertDtmAssemblyRecord">
+        insert into dtm_assembly_record (product_code, assembly_date, quantity) values
+        <foreach collection="list" item="item" separator=",">(#{item.productCode}, #{item.assemblyDate}, #{item.quantity})</foreach>
+    </insert>
+</mapper>

+ 34 - 0
dtm-system/src/main/resources/mapper/upload/DtmBomListMapper.xml

@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.dtm.upload.mapper.DtmBomListMapper">
+    <resultMap id="DtmBomListResult" type="DtmBomList">
+        <id property="id" column="id"/>
+        <result property="finishedSku" column="finished_sku"/>
+        <result property="semiSku" column="semi_sku"/>
+        <result property="quantity" column="quantity"/>
+    </resultMap>
+    <sql id="selectVo">select id, finished_sku, semi_sku, quantity from dtm_bom_list</sql>
+    <select id="selectDtmBomListById" parameterType="Long" resultMap="DtmBomListResult"><include refid="selectVo"/> where id=#{id}</select>
+    <select id="selectDtmBomListList" parameterType="DtmBomList" resultMap="DtmBomListResult">
+        <include refid="selectVo"/>
+        <where>
+            <if test="finishedSku != null and finishedSku != ''">and finished_sku = #{finishedSku}</if>
+            <if test="semiSku != null and semiSku != ''">and semi_sku = #{semiSku}</if>
+        </where>
+    </select>
+    <insert id="insertDtmBomList" parameterType="DtmBomList" useGeneratedKeys="true" keyProperty="id">
+        insert into dtm_bom_list (finished_sku, semi_sku, quantity) values (#{finishedSku}, #{semiSku}, #{quantity})
+    </insert>
+    <update id="updateDtmBomList" parameterType="DtmBomList">
+        update dtm_bom_list set finished_sku=#{finishedSku}, semi_sku=#{semiSku}, quantity=#{quantity} where id=#{id}
+    </update>
+    <delete id="deleteDtmBomListById" parameterType="Long">delete from dtm_bom_list where id=#{id}</delete>
+    <delete id="deleteDtmBomListByIds" parameterType="Long">
+        delete from dtm_bom_list where id in <foreach collection="array" item="id" open="(" separator="," close=")">#{id}</foreach>
+    </delete>
+    <delete id="deleteAllDtmBomList">delete from dtm_bom_list</delete>
+    <insert id="batchInsertDtmBomList">
+        insert into dtm_bom_list (finished_sku, semi_sku, quantity) values
+        <foreach collection="list" item="item" separator=",">(#{item.finishedSku}, #{item.semiSku}, #{item.quantity})</foreach>
+    </insert>
+</mapper>

+ 47 - 0
dtm-system/src/main/resources/mapper/upload/DtmOrderMainMapper.xml

@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.dtm.upload.mapper.DtmOrderMainMapper">
+    <resultMap id="DtmOrderMainResult" type="DtmOrderMain">
+        <id property="orderId" column="order_id"/>
+        <result property="title" column="title"/>
+        <result property="price" column="price"/>
+        <result property="quantity" column="quantity"/>
+        <result property="sku" column="sku"/>
+        <result property="attrs" column="attrs"/>
+        <result property="orderStatus" column="order_status"/>
+        <result property="payNumber" column="pay_number"/>
+        <result property="payAmount" column="pay_amount"/>
+        <result property="paidAmount" column="paid_amount"/>
+        <result property="refundStatus" column="refund_status"/>
+        <result property="refundAmount" column="refund_amount"/>
+        <result property="createTime" column="create_time"/>
+        <result property="payTime" column="pay_time"/>
+    </resultMap>
+    <sql id="selectVo">select order_id, title, price, quantity, sku, attrs, order_status, pay_number, pay_amount, paid_amount, refund_status, refund_amount, create_time, pay_time from dtm_order_main</sql>
+    <select id="selectDtmOrderMainById" parameterType="String" resultMap="DtmOrderMainResult"><include refid="selectVo"/> where order_id=#{orderId}</select>
+    <select id="selectDtmOrderMainList" parameterType="DtmOrderMain" resultMap="DtmOrderMainResult">
+        <include refid="selectVo"/>
+        <where>
+            <if test="orderId != null and orderId != ''">and order_id = #{orderId}</if>
+            <if test="title != null and title != ''">and title like concat('%', #{title}, '%')</if>
+            <if test="sku != null and sku != ''">and sku = #{sku}</if>
+            <if test="orderStatus != null and orderStatus != ''">and order_status = #{orderStatus}</if>
+        </where>
+    </select>
+    <insert id="insertDtmOrderMain" parameterType="DtmOrderMain">
+        insert into dtm_order_main (order_id, title, price, quantity, sku, attrs, order_status, pay_number, pay_amount, paid_amount, refund_status, refund_amount, create_time, pay_time)
+        values (#{orderId}, #{title}, #{price}, #{quantity}, #{sku}, #{attrs}, #{orderStatus}, #{payNumber}, #{payAmount}, #{paidAmount}, #{refundStatus}, #{refundAmount}, #{createTime}, #{payTime})
+    </insert>
+    <update id="updateDtmOrderMain" parameterType="DtmOrderMain">
+        update dtm_order_main set title=#{title}, price=#{price}, quantity=#{quantity}, sku=#{sku}, attrs=#{attrs}, order_status=#{orderStatus}, pay_number=#{payNumber}, pay_amount=#{payAmount}, paid_amount=#{paidAmount}, refund_status=#{refundStatus}, refund_amount=#{refundAmount}, create_time=#{createTime}, pay_time=#{payTime} where order_id=#{orderId}
+    </update>
+    <delete id="deleteDtmOrderMainById" parameterType="String">delete from dtm_order_main where order_id=#{orderId}</delete>
+    <delete id="deleteDtmOrderMainByIds" parameterType="String">
+        delete from dtm_order_main where order_id in <foreach collection="array" item="orderId" open="(" separator="," close=")">#{orderId}</foreach>
+    </delete>
+    <insert id="batchUpsertDtmOrderMain">
+        insert into dtm_order_main (order_id, title, price, quantity, sku, attrs, order_status, pay_number, pay_amount, paid_amount, refund_status, refund_amount, create_time, pay_time) values
+        <foreach collection="list" item="item" separator=",">(#{item.orderId}, #{item.title}, #{item.price}, #{item.quantity}, #{item.sku}, #{item.attrs}, #{item.orderStatus}, #{item.payNumber}, #{item.payAmount}, #{item.paidAmount}, #{item.refundStatus}, #{item.refundAmount}, #{item.createTime}, #{item.payTime})</foreach>
+        on duplicate key update title=values(title), price=values(price), quantity=values(quantity), sku=values(sku), attrs=values(attrs), order_status=values(order_status), pay_number=values(pay_number), pay_amount=values(pay_amount), paid_amount=values(paid_amount), refund_status=values(refund_status), refund_amount=values(refund_amount), create_time=values(create_time), pay_time=values(pay_time)
+    </insert>
+</mapper>

+ 40 - 0
dtm-system/src/main/resources/mapper/upload/DtmProductMapper.xml

@@ -0,0 +1,40 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.dtm.upload.mapper.DtmProductMapper">
+    <resultMap id="DtmProductResult" type="DtmProduct">
+        <id property="sku" column="sku"/>
+        <result property="spu" column="spu"/>
+        <result property="productName" column="product_name"/>
+        <result property="attributes" column="attributes"/>
+        <result property="bomLevelId" column="bom_level_id"/>
+        <result property="productPrice" column="product_price"/>
+    </resultMap>
+    <sql id="selectVo">select sku, spu, product_name, attributes, bom_level_id, product_price from dtm_product</sql>
+    <select id="selectDtmProductById" parameterType="String" resultMap="DtmProductResult"><include refid="selectVo"/> where sku=#{sku}</select>
+    <select id="selectDtmProductList" parameterType="DtmProduct" resultMap="DtmProductResult">
+        <include refid="selectVo"/>
+        <where>
+            <if test="sku != null and sku != ''">and sku = #{sku}</if>
+            <if test="spu != null and spu != ''">and spu = #{spu}</if>
+            <if test="productName != null and productName != ''">and product_name like concat('%', #{productName}, '%')</if>
+            <if test="bomLevelId != null and bomLevelId != ''">and bom_level_id = #{bomLevelId}</if>
+        </where>
+    </select>
+    <insert id="insertDtmProduct" parameterType="DtmProduct">
+        insert into dtm_product (sku, spu, product_name, attributes, bom_level_id, product_price)
+        values (#{sku}, #{spu}, #{productName}, #{attributes}, #{bomLevelId}, #{productPrice})
+    </insert>
+    <update id="updateDtmProduct" parameterType="DtmProduct">
+        update dtm_product set spu=#{spu}, product_name=#{productName}, attributes=#{attributes}, bom_level_id=#{bomLevelId}, product_price=#{productPrice} where sku=#{sku}
+    </update>
+    <delete id="deleteDtmProductById" parameterType="String">delete from dtm_product where sku=#{sku}</delete>
+    <delete id="deleteDtmProductByIds" parameterType="String">
+        delete from dtm_product where sku in
+        <foreach collection="array" item="sku" open="(" separator="," close=")">#{sku}</foreach>
+    </delete>
+    <insert id="batchUpsertDtmProduct">
+        insert into dtm_product (sku, spu, product_name, attributes, bom_level_id, product_price) values
+        <foreach collection="list" item="item" separator=",">(#{item.sku}, #{item.spu}, #{item.productName}, #{item.attributes}, #{item.bomLevelId}, #{item.productPrice})</foreach>
+        on duplicate key update spu=values(spu), product_name=values(product_name), attributes=values(attributes), bom_level_id=values(bom_level_id), product_price=values(product_price)
+    </insert>
+</mapper>

+ 42 - 0
dtm-system/src/main/resources/mapper/upload/DtmPurchaseReceiptMapper.xml

@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.dtm.upload.mapper.DtmPurchaseReceiptMapper">
+    <resultMap id="DtmPurchaseReceiptResult" type="DtmPurchaseReceipt">
+        <id property="receiptId" column="receipt_id"/>
+        <result property="sku" column="sku"/>
+        <result property="supplierId" column="supplier_id"/>
+        <result property="quantity" column="quantity"/>
+        <result property="receiptDate" column="receipt_date"/>
+        <result property="actualAmount" column="actual_amount"/>
+        <result property="status" column="status"/>
+        <result property="warehouseCode" column="warehouse_code"/>
+        <result property="unitprice" column="unitprice"/>
+    </resultMap>
+    <sql id="selectVo">select receipt_id, sku, supplier_id, quantity, receipt_date, actual_amount, status, warehouse_code, unitprice from dtm_purchase_receipt</sql>
+    <select id="selectDtmPurchaseReceiptById" parameterType="String" resultMap="DtmPurchaseReceiptResult"><include refid="selectVo"/> where receipt_id=#{receiptId}</select>
+    <select id="selectDtmPurchaseReceiptList" parameterType="DtmPurchaseReceipt" resultMap="DtmPurchaseReceiptResult">
+        <include refid="selectVo"/>
+        <where>
+            <if test="receiptId != null and receiptId != ''">and receipt_id = #{receiptId}</if>
+            <if test="sku != null and sku != ''">and sku = #{sku}</if>
+            <if test="supplierId != null and supplierId != ''">and supplier_id = #{supplierId}</if>
+            <if test="warehouseCode != null and warehouseCode != ''">and warehouse_code = #{warehouseCode}</if>
+        </where>
+    </select>
+    <insert id="insertDtmPurchaseReceipt" parameterType="DtmPurchaseReceipt">
+        insert into dtm_purchase_receipt (receipt_id, sku, supplier_id, quantity, receipt_date, actual_amount, status, warehouse_code, unitprice)
+        values (#{receiptId}, #{sku}, #{supplierId}, #{quantity}, #{receiptDate}, #{actualAmount}, #{status}, #{warehouseCode}, #{unitprice})
+    </insert>
+    <update id="updateDtmPurchaseReceipt" parameterType="DtmPurchaseReceipt">
+        update dtm_purchase_receipt set sku=#{sku}, supplier_id=#{supplierId}, quantity=#{quantity}, receipt_date=#{receiptDate}, actual_amount=#{actualAmount}, status=#{status}, warehouse_code=#{warehouseCode}, unitprice=#{unitprice} where receipt_id=#{receiptId}
+    </update>
+    <delete id="deleteDtmPurchaseReceiptById" parameterType="String">delete from dtm_purchase_receipt where receipt_id=#{receiptId}</delete>
+    <delete id="deleteDtmPurchaseReceiptByIds" parameterType="String">
+        delete from dtm_purchase_receipt where receipt_id in <foreach collection="array" item="receiptId" open="(" separator="," close=")">#{receiptId}</foreach>
+    </delete>
+    <insert id="batchUpsertDtmPurchaseReceipt">
+        insert into dtm_purchase_receipt (receipt_id, sku, supplier_id, quantity, receipt_date, actual_amount, status, warehouse_code, unitprice) values
+        <foreach collection="list" item="item" separator=",">(#{item.receiptId}, #{item.sku}, #{item.supplierId}, #{item.quantity}, #{item.receiptDate}, #{item.actualAmount}, #{item.status}, #{item.warehouseCode}, #{item.unitprice})</foreach>
+        on duplicate key update sku=values(sku), supplier_id=values(supplier_id), quantity=values(quantity), receipt_date=values(receipt_date), actual_amount=values(actual_amount), status=values(status), warehouse_code=values(warehouse_code), unitprice=values(unitprice)
+    </insert>
+</mapper>

+ 39 - 0
dtm-system/src/main/resources/mapper/upload/DtmSemiFinishedProductMapper.xml

@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.dtm.upload.mapper.DtmSemiFinishedProductMapper">
+    <resultMap id="DtmSemiFinishedProductResult" type="DtmSemiFinishedProduct">
+        <id property="sku" column="sku"/>
+        <result property="semiName" column="semi_name"/>
+        <result property="price" column="price"/>
+        <result property="bomLevelId" column="bom_level_id"/>
+    </resultMap>
+    <sql id="selectVo">select sku, semi_name, price, bom_level_id from dtm_semi_finished_product</sql>
+    <select id="selectDtmSemiFinishedProductById" parameterType="String" resultMap="DtmSemiFinishedProductResult">
+        <include refid="selectVo"/> where sku = #{sku}
+    </select>
+    <select id="selectDtmSemiFinishedProductList" parameterType="DtmSemiFinishedProduct" resultMap="DtmSemiFinishedProductResult">
+        <include refid="selectVo"/>
+        <where>
+            <if test="sku != null and sku != ''">and sku = #{sku}</if>
+            <if test="semiName != null and semiName != ''">and semi_name like concat('%', #{semiName}, '%')</if>
+            <if test="bomLevelId != null and bomLevelId != ''">and bom_level_id = #{bomLevelId}</if>
+        </where>
+    </select>
+    <insert id="insertDtmSemiFinishedProduct" parameterType="DtmSemiFinishedProduct">
+        insert into dtm_semi_finished_product (sku, semi_name, price, bom_level_id)
+        values (#{sku}, #{semiName}, #{price}, #{bomLevelId})
+    </insert>
+    <update id="updateDtmSemiFinishedProduct" parameterType="DtmSemiFinishedProduct">
+        update dtm_semi_finished_product set semi_name=#{semiName}, price=#{price}, bom_level_id=#{bomLevelId} where sku=#{sku}
+    </update>
+    <delete id="deleteDtmSemiFinishedProductById" parameterType="String">delete from dtm_semi_finished_product where sku=#{sku}</delete>
+    <delete id="deleteDtmSemiFinishedProductByIds" parameterType="String">
+        delete from dtm_semi_finished_product where sku in
+        <foreach collection="array" item="sku" open="(" separator="," close=")">#{sku}</foreach>
+    </delete>
+    <insert id="batchUpsertDtmSemiFinishedProduct">
+        insert into dtm_semi_finished_product (sku, semi_name, price, bom_level_id) values
+        <foreach collection="list" item="item" separator=",">(#{item.sku}, #{item.semiName}, #{item.price}, #{item.bomLevelId})</foreach>
+        on duplicate key update semi_name=values(semi_name), price=values(price), bom_level_id=values(bom_level_id)
+    </insert>
+</mapper>

+ 43 - 0
dtm-system/src/main/resources/mapper/upload/DtmStoreMapper.xml

@@ -0,0 +1,43 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.dtm.upload.mapper.DtmStoreMapper">
+    <resultMap id="DtmStoreResult" type="DtmStore">
+        <id property="storeCode" column="store_code"/>
+        <result property="storeName" column="store_name"/>
+        <result property="deptName" column="dept_name"/>
+        <result property="channelName" column="channel_name"/>
+        <result property="recordStartDate" column="record_start_date"/>
+        <result property="recordEndDate" column="record_end_date"/>
+        <result property="salesQty" column="sales_qty"/>
+        <result property="salesAmount" column="sales_amount"/>
+    </resultMap>
+    <sql id="selectVo">select store_code, store_name, dept_name, channel_name, record_start_date, record_end_date, sales_qty, sales_amount from dtm_store</sql>
+    <select id="selectDtmStoreById" parameterType="String" resultMap="DtmStoreResult"><include refid="selectVo"/> where store_code=#{storeCode}</select>
+    <select id="selectDtmStoreList" parameterType="DtmStore" resultMap="DtmStoreResult">
+        <include refid="selectVo"/>
+        <where>
+            <if test="storeCode != null and storeCode != ''">and store_code = #{storeCode}</if>
+            <if test="storeName != null and storeName != ''">and store_name like concat('%', #{storeName}, '%')</if>
+            <if test="deptName != null and deptName != ''">and dept_name = #{deptName}</if>
+            <if test="channelName != null and channelName != ''">and channel_name = #{channelName}</if>
+        </where>
+    </select>
+    <insert id="insertDtmStore" parameterType="DtmStore">
+        insert into dtm_store (store_code, store_name, dept_name, channel_name, record_start_date, record_end_date, sales_qty, sales_amount)
+        values (#{storeCode}, #{storeName}, #{deptName}, #{channelName}, #{recordStartDate}, #{recordEndDate}, #{salesQty}, #{salesAmount})
+    </insert>
+    <update id="updateDtmStore" parameterType="DtmStore">
+        update dtm_store set store_name=#{storeName}, dept_name=#{deptName}, channel_name=#{channelName}, record_start_date=#{recordStartDate}, record_end_date=#{recordEndDate}, sales_qty=#{salesQty}, sales_amount=#{salesAmount} where store_code=#{storeCode}
+    </update>
+    <delete id="deleteDtmStoreById" parameterType="String">delete from dtm_store where store_code=#{storeCode}</delete>
+    <delete id="deleteDtmStoreByIds" parameterType="String">
+        delete from dtm_store where store_code in <foreach collection="array" item="storeCode" open="(" separator="," close=")">#{storeCode}</foreach>
+    </delete>
+    <delete id="deleteAllDtmStore">delete from dtm_store</delete>
+    <insert id="batchInsertDtmStore">
+        insert into dtm_store (store_code, store_name, dept_name, channel_name, record_start_date, record_end_date, sales_qty, sales_amount) values
+        <foreach collection="list" item="item" separator=",">(#{item.storeCode}, #{item.storeName}, #{item.deptName}, #{item.channelName}, #{item.recordStartDate}, #{item.recordEndDate}, #{item.salesQty}, #{item.salesAmount})</foreach>
+        on duplicate key update store_name=values(store_name), dept_name=values(dept_name), channel_name=values(channel_name),
+        record_start_date=values(record_start_date), record_end_date=values(record_end_date), sales_qty=values(sales_qty), sales_amount=values(sales_amount)
+    </insert>
+</mapper>

+ 35 - 0
dtm-system/src/main/resources/mapper/upload/DtmSupplierMapper.xml

@@ -0,0 +1,35 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
+<mapper namespace="com.dtm.upload.mapper.DtmSupplierMapper">
+    <resultMap id="DtmSupplierResult" type="DtmSupplier">
+        <id property="supplierId" column="supplier_id"/>
+        <result property="supplierName" column="supplier_name"/>
+    </resultMap>
+    <sql id="selectVo">select supplier_id, supplier_name from dtm_supplier</sql>
+    <select id="selectDtmSupplierById" parameterType="String" resultMap="DtmSupplierResult">
+        <include refid="selectVo"/> where supplier_id = #{supplierId}
+    </select>
+    <select id="selectDtmSupplierList" parameterType="DtmSupplier" resultMap="DtmSupplierResult">
+        <include refid="selectVo"/>
+        <where>
+            <if test="supplierId != null and supplierId != ''">and supplier_id = #{supplierId}</if>
+            <if test="supplierName != null and supplierName != ''">and supplier_name like concat('%', #{supplierName}, '%')</if>
+        </where>
+    </select>
+    <insert id="insertDtmSupplier" parameterType="DtmSupplier">
+        insert into dtm_supplier (supplier_id, supplier_name) values (#{supplierId}, #{supplierName})
+    </insert>
+    <update id="updateDtmSupplier" parameterType="DtmSupplier">
+        update dtm_supplier set supplier_name = #{supplierName} where supplier_id = #{supplierId}
+    </update>
+    <delete id="deleteDtmSupplierById" parameterType="String">delete from dtm_supplier where supplier_id = #{supplierId}</delete>
+    <delete id="deleteDtmSupplierByIds" parameterType="String">
+        delete from dtm_supplier where supplier_id in
+        <foreach collection="array" item="supplierId" open="(" separator="," close=")">#{supplierId}</foreach>
+    </delete>
+    <insert id="batchUpsertDtmSupplier">
+        insert into dtm_supplier (supplier_id, supplier_name) values
+        <foreach collection="list" item="item" separator=",">(#{item.supplierId}, #{item.supplierName})</foreach>
+        on duplicate key update supplier_name = values(supplier_name)
+    </insert>
+</mapper>