111
Administrator
2025-11-14 e2ba28674fb5a6ab0fe85e2d0f09cd94fa496dff
src/test/java/com/gs/xky/XkyApplicationTests.java
@@ -1,23 +1,52 @@
package com.gs.xky;
import com.gs.xky.service.XkyService;
import com.alibaba.fastjson.JSON;
import com.gs.xky.config.*;
import com.gs.xky.dto.BarcodeDeliveryNo;
import com.gs.xky.dto.EmployeeInfo;
import com.gs.xky.dto.XkyDetail;
import com.gs.xky.dto.XkyEntity;
import com.gs.xky.entity.MesInvItemArn;
import com.gs.xky.service.*;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.io.IOException;
import java.util.List;
import java.util.stream.Collectors;
@SpringBootTest
class XkyApplicationTests {
    @Autowired
    private XkyService xkyService;
    private VwCjScSjTsBbService vwCjScSjTsBbService;
    /**
     * 测试导出生产数据并发送钉钉消息
     * 功能:查询VW_CJ_SC_SJ_TS_BB表数据 -> 导出Excel -> 发送钉钉文件消息
     */
    @Test
    void contextLoads() throws IOException {
    void testExportAndSendProductionData() throws Exception {
        System.out.println("=== 开始测试导出生产数据并发送钉钉 ===");
        xkyService.GetSaveDetail();
        try {
            boolean result = vwCjScSjTsBbService.exportAndSendToDingtalk();
            if (result) {
                System.out.println("✓ 生产数据导出并发送成功");
                System.out.println("  - 数据已从 VW_CJ_SC_SJ_TS_BB 表查询");
                System.out.println("  - Excel 文件已生成并保存到 D:\\BIFile\\");
                System.out.println("  - 钉钉文件消息已发送");
            } else {
                System.out.println("✗ 生产数据导出或发送失败");
            }
        } catch (Exception e) {
            System.out.println("✗ 导出并发送时发生异常: " + e.getMessage());
            e.printStackTrace();
        }
        System.out.println("=== 测试结束 ===");
    }
}