| | |
| | | private PurchaseService service; |
| | | @Autowired |
| | | private DingtalkInfoService dingtalkInfoService; |
| | | @Autowired |
| | | private VwCjScSjTsBbService vwCjScSjTsBbService; |
| | | |
| | | @Test |
| | | void contextLoads() throws IOException { |
| | |
| | | System.out.println("=== 开始测试发送文件消息 ==="); |
| | | |
| | | // 指定要发送的文件路径(请修改为实际存在的文件路径) |
| | | String filePath = "D:\\test\\report.xlsx"; // 示例:Excel报表文件 |
| | | String filePath = "D:\\BIFile\\12412321.pdf"; // 示例:Excel报表文件 |
| | | // String filePath = "D:\\test\\document.pdf"; // 示例:PDF文档 |
| | | // String filePath = "D:\\test\\data.docx"; // 示例:Word文档 |
| | | |
| | |
| | | |
| | | System.out.println("=== 测试结束 ==="); |
| | | } |
| | | |
| | | /** |
| | | * 测试导出生产数据并发送钉钉消息 |
| | | * 功能:查询VW_CJ_SC_SJ_TS_BB表数据 -> 导出Excel -> 发送钉钉文件消息 |
| | | */ |
| | | @Test |
| | | void testExportAndSendProductionData() throws Exception { |
| | | System.out.println("=== 开始测试导出生产数据并发送钉钉 ==="); |
| | | |
| | | 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("=== 测试结束 ==="); |
| | | } |
| | | } |