bengbengbalabalabeng commented on issue #663:
URL: https://github.com/apache/fesod/issues/663#issuecomment-3462031396

   ## 环境
   
   - Docker [CentOS 7]
   - amazon-corretto-17
   - fastexcel 1.3.0
   - Maven 3.9.6
   
   ## 测试结果
   
   正常,未复现普通用户执行错误问题。`multi-sheet-pojo-write-test.xlsx` 与以下结果一致。(是不是我这边遗漏了什么?)
   
   <img width="321" height="267" alt="Image" 
src="https://github.com/user-attachments/assets/31b3956f-4d93-44b2-9a6e-d6c2c8a0b661";
 />
   
   
   ## 代码
   
   Main
   ```java
   public class App {
       public static void main(String[] args) {
           System.out.println("Hello World!");
   
           writeWithPOJO();
   
           writeWithNoPOJO();
   
           System.out.println("Done...");
       }
   
       static void writeWithPOJO() {
           String path = "/app/output/multi-sheet-pojo-write-test.xlsx";
   
           try (ExcelWriter excelWriter = 
FastExcel.write(path).excelType(ExcelTypeEnum.XLSX).build()) {
               for (int i = 0; i < 3; i++) {
                   WriteSheet writeSheet = FastExcel.writerSheet(i, 
"TableName_" + (i + 1))
                           .head(ExcelData.class)
                           .build();
   
                   excelWriter.write(pojoData(), writeSheet);
               }
           }
       }
   
       public static List<ExcelData> pojoData() {
           return IntStream.range(1, 11)
                   .mapToObj(no -> new ExcelData(no, 
UUID.randomUUID().toString()))
                   .toList();
       }
   
       @NoArgsConstructor
       @AllArgsConstructor
       @EqualsAndHashCode(callSuper = false)
       @Data
       public static class ExcelData implements Serializable {
           @ExcelProperty("序号")
           private Integer no;
   
           @ExcelProperty("代码")
           private String code;
       }
   
       static void writeWithNoPOJO() {
           String path = "/app/output/multi-sheet-list-write-test.xlsx";
   
           List<List<String>> head = new ArrayList<>();
           head.add(List.of("序号"));
           head.add(List.of("代码"));
   
   
           try (ExcelWriter excelWriter = 
FastExcel.write(path).excelType(ExcelTypeEnum.XLSX).build()) {
               for (int i = 0; i < 3; i++) {
                   WriteSheet writeSheet = FastExcel.writerSheet(i, 
"TableName_" + (i + 1))
                           .head(head)
                           .build();
   
                   excelWriter.write(mapData(), writeSheet);
               }
           }
       }
   
       public static List<List<Object>> mapData() {
           return IntStream.range(1, 11)
                   .<List<Object>>mapToObj(no -> List.of(no, 
UUID.randomUUID().toString()))
                   .toList();
       }
   }
   ```
   
   Dockerfile (By AI)
   
   ```Dockerfile
   FROM centos:7
   
   COPY amazon-corretto-17.0.17.10.1-linux-aarch64 
/usr/lib/jvm/amazon-corretto-17
   
   ENV JAVA_HOME=/usr/lib/jvm/amazon-corretto-17
   ENV PATH="$JAVA_HOME/bin:${PATH}"
   
   WORKDIR /app
   
   COPY target/fesod-docker-test-1.0-SNAPSHOT-jar-with-dependencies.jar app.jar
   
   # 创建非 root 用户(用于复现权限问题)
   RUN useradd -m testuser
   USER testuser
   
   CMD ["java", "-jar", "app.jar"]
   ```
   
   docker-compose.yaml (By AI)
   
   ```yaml
   version: "3.8"
   
   services:
     fastexcel:
       build: .
       container_name: fesod-docker-test
       volumes:
         - {local-volume}:/app/output/
       working_dir: /app
   ```
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to