huliguo
2025-06-26 5a7486e9893a706ed464e3197c9711286b077896
ruoyi-service/ruoyi-order/src/main/java/com/ruoyi/order/service/impl/ChargeOrderServiceImpl.java
@@ -30,6 +30,7 @@
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.multipart.MultipartFile;
import javax.annotation.Resource;
import java.io.IOException;
@@ -37,6 +38,8 @@
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
import java.time.LocalDateTime;
import java.time.LocalTime;
@@ -65,17 +68,22 @@
    @Override
    public void importExpress(String url) {
    public void importExpress(MultipartFile file) {
 /*       System.out.println("导入订单url:"+url);
        URL url1 = null;
        try {
            url1 = new URL(url);
            String encodedUrl = new URI(url).toASCIIString();
            url1 = new URL(encodedUrl);
        } catch (MalformedURLException e) {
            throw new RuntimeException(e);
        }
        } catch (URISyntaxException e) {
            throw new RuntimeException(e);
        }*/
        List<String> orderNumberList=new ArrayList<>();
        try (InputStream fileInputStream = url1.openStream()) {
            Workbook workbook = new XSSFWorkbook(fileInputStream);
        try (InputStream inputStream = file.getInputStream();
             Workbook workbook = new XSSFWorkbook(inputStream)) {
//            Workbook workbook = new XSSFWorkbook(fileInputStream);
            Sheet sheet = workbook.getSheetAt(0); // 获取第一个Sheet
            int lastRowNum = sheet.getLastRowNum();
            for (int i = 1; i <= lastRowNum; i++) {//第二行开始