| | |
| | | |
| | | import cn.hutool.crypto.digest.DigestUtil; |
| | | import com.gs.xiaomi.dto.BCS101Request; |
| | | import com.gs.xiaomi.dto.NumbericalDto; |
| | | import com.gs.xiaomi.service.BCS101ApiService; |
| | | import com.gs.xiaomi.service.XM104Service; |
| | | import com.gs.xiaomi.service.Xm104Service; |
| | | import org.junit.jupiter.api.Test; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.boot.test.context.SpringBootTest; |
| | |
| | | class XiaomiApplicationTests { |
| | | |
| | | @Autowired |
| | | private XM104Service xm104Service; |
| | | private Xm104Service xm104Service; |
| | | |
| | | @Autowired |
| | | private BCS101ApiService bcs101ApiService; |
| | |
| | | @Test |
| | | void contextLoads() throws Exception { |
| | | xm104Service.getDb(); |
| | | } |
| | | |
| | | //manualSynchronization |
| | | @Test |
| | | void contextLoads1() throws Exception { |
| | | NumbericalDto barcode = new NumbericalDto(); |
| | | barcode.setAsn("9316702418"); |
| | | xm104Service.manualSynchronization(barcode); |
| | | } |
| | | |
| | | @Test |
| | |
| | | void testBCS101ApiService() throws Exception { |
| | | // 创建测试请求参数 |
| | | BCS101Request request = new BCS101Request(); |
| | | request.setSupplierId("100071"); |
| | | request.setDocNo("9311991542"); |
| | | request.setSupplierId("177301"); |
| | | request.setDocNo("9316716044"); |
| | | request.setDocType("ASNGR"); |
| | | request.setPageNo(1); |
| | | request.setPageSize(1000); |
| | | |
| | | System.out.println("=== 测试BCS101 API服务(Basic Auth版本) ==="); |
| | | try { |
| | | // 调用标准BCS101 API服务(只使用Basic Auth) |
| | | String response = bcs101ApiService.getBCS101Data(request); |
| | | System.out.println("BCS101 API Response: " + response); |
| | | } catch (Exception e) { |
| | | System.out.println("BCS101 API调用异常: " + e.getMessage()); |
| | | e.printStackTrace(); |
| | | } |
| | | String bcs101Data = bcs101ApiService.getBCS101Data(request); |
| | | System.out.println(bcs101Data); |
| | | |
| | | System.out.println("\n=== 测试BCS101 API服务(带X5协议版本) ==="); |
| | | try { |
| | | // 调用带X5协议的BCS101 API服务 |
| | | String responseWithX5 = bcs101ApiService.getBCS101DataWithX5(request, true); |
| | | System.out.println("BCS101 API Response (X5): " + responseWithX5); |
| | | } catch (Exception e) { |
| | | System.out.println("BCS101 API X5调用异常: " + e.getMessage()); |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | } |