| | |
| | | package com.gs.xky; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.gs.xky.config.ApiResponse; |
| | | import com.gs.xky.config.BodyParam; |
| | | import com.gs.xky.config.DataAcquisitionConfiguration; |
| | | import com.gs.xky.config.XkyCommonParam; |
| | | 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 java.io.IOException; |
| | | import java.util.List; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @SpringBootTest |
| | | class XkyApplicationTests { |
| | |
| | | private MesInvItemArnService invItemArnService; |
| | | @Autowired |
| | | private PurchaseService service; |
| | | @Autowired |
| | | private DingtalkInfoService dingtalkInfoService; |
| | | |
| | | @Test |
| | | void contextLoads() throws IOException { |
| | |
| | | @Test |
| | | void cs() throws IOException { |
| | | |
| | | String str = "22250529195E;22250529EQHY;22250529HCM9;222505304W8Q;222505305XRK;22250530F6UC;22250530JQ31;22250531UF8T;222506013N09;222506015051;2225060152A2;2225060152EN;222506015AM7;222506015U07;2225060162K4;222506016C4C;222506017GEM;222506017YTU;222506019RWD;22250601A216;22250601C4C3;22250601GTT8;22250601GUGU;22250601H6Y7;22250601JN9X;22250601JVW5;22250601L6R5;22250601NANG;22250601NHK4;22250601NYAL;22250601Q669;22250601RGJX;22250601VCE2;22250601W6C6;22250601WFK1;22250601WH28;22250601XE2T;22250602M0MU;"; |
| | | String str = "22250702H88F;"; |
| | | |
| | | |
| | | String[] split = str.split(";"); |
| | |
| | | } |
| | | |
| | | @Test |
| | | void cs3() throws IOException { |
| | | void cs3() throws Exception { |
| | | DingTalkParam dingTalkParam = new DingTalkParam(1); |
| | | DingTalkResponse<EmployeeInfo> employeeInfoDingTalkResponse = |
| | | apiService.sendListRequest(dingTalkParam, EmployeeInfo.class, |
| | | "http://192.168.1.64/eHR/eHRExternalService/Service.ashx"); |
| | | |
| | | // service.syncPurchaseOrderDetails(); |
| | | List<EmployeeInfo> collect = employeeInfoDingTalkResponse.getData().stream() |
| | | .filter(s -> "造梦者(浙江)科技有限公司".equals(s.getCUnitName())) |
| | | .collect(Collectors.toList()); |
| | | |
| | | } |
| | | |
| | | /** |
| | | * 测试发送ActionCard消息(在外部浏览器中打开链接) |
| | | * 适用场景:BI报表、外部系统链接等需要在外部浏览器打开的场景 |
| | | */ |
| | | @Test |
| | | void testSendActionCardMessage() throws Exception { |
| | | System.out.println("=== 开始测试发送ActionCard消息 ==="); |
| | | |
| | | boolean result = dingtalkInfoService.sendActionCardMessage(); |
| | | |
| | | if (result) { |
| | | System.out.println("✓ ActionCard消息发送成功"); |
| | | } else { |
| | | System.out.println("✗ ActionCard消息发送失败"); |
| | | } |
| | | |
| | | System.out.println("=== 测试结束 ==="); |
| | | } |
| | | |
| | | /** |
| | | * 测试发送文件消息 |
| | | * 适用场景:发送Excel报表、PDF文档、Word文档等各类文件 |
| | | */ |
| | | @Test |
| | | void testSendFileMessage() throws Exception { |
| | | System.out.println("=== 开始测试发送文件消息 ==="); |
| | | |
| | | // 指定要发送的文件路径(请修改为实际存在的文件路径) |
| | | String filePath = "D:\\BIFile\\12412321.pdf"; // 示例:Excel报表文件 |
| | | // String filePath = "D:\\test\\document.pdf"; // 示例:PDF文档 |
| | | // String filePath = "D:\\test\\data.docx"; // 示例:Word文档 |
| | | |
| | | try { |
| | | boolean result = dingtalkInfoService.sendFileMessage(filePath); |
| | | |
| | | if (result) { |
| | | System.out.println("✓ 文件消息发送成功"); |
| | | } else { |
| | | System.out.println("✗ 文件消息发送失败"); |
| | | } |
| | | } catch (Exception e) { |
| | | System.out.println("✗ 发送文件时发生异常: " + e.getMessage()); |
| | | e.printStackTrace(); |
| | | } |
| | | |
| | | System.out.println("=== 测试结束 ==="); |
| | | } |
| | | } |