From 0c6fefa68fc562dddc7e7feaf75ca5ed716308e3 Mon Sep 17 00:00:00 2001 From: nixj Date: Tue, 30 Apr 2024 13:35:06 +0800 Subject: [PATCH] =?UTF-8?q?=E3=80=90update=E3=80=91=E9=AB=98=E5=BE=B7?= =?UTF-8?q?=E4=BC=81=E4=B8=9A=E5=AE=8C=E5=8D=95=E6=95=B0=E6=8D=AE=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E6=9F=A5=E8=AF=A2=E6=96=B9=E6=B3=95=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../rest/amap/request/SettleBillRequest.java | 10 +++---- src/test/java/com/chint/AmapTest.java | 28 +++++++++++-------- 2 files changed, 21 insertions(+), 17 deletions(-) diff --git a/src/main/java/com/chint/interfaces/rest/amap/request/SettleBillRequest.java b/src/main/java/com/chint/interfaces/rest/amap/request/SettleBillRequest.java index f2cd1531..85479f71 100644 --- a/src/main/java/com/chint/interfaces/rest/amap/request/SettleBillRequest.java +++ b/src/main/java/com/chint/interfaces/rest/amap/request/SettleBillRequest.java @@ -2,13 +2,11 @@ package com.chint.interfaces.rest.amap.request; import com.chint.interfaces.rest.amap.dto.settlement.FinishedOrderDto; import com.chint.interfaces.rest.amap.dto.settlement.FinishedOrderResponse; -import com.chint.interfaces.rest.amap.dto.token.TokenDto; -import com.chint.interfaces.rest.amap.dto.token.TokenResponse; -import com.google.gson.Gson; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; +import java.util.ArrayList; import java.util.List; import static com.chint.infrastructure.constant.AmapConstant.FINISHED_ORDER_URL; @@ -26,7 +24,8 @@ public class SettleBillRequest { * * @return */ - public void pageFinishedOrder(String dsStart, String dsEnd) { + public List pageFinishedOrder(String dsStart, String dsEnd) { + List result=new ArrayList<>(); FinishedOrderDto finishedOrderDto = new FinishedOrderDto(); finishedOrderDto.setDsStart(dsStart); finishedOrderDto.setDsEnd(dsEnd); @@ -36,9 +35,10 @@ public class SettleBillRequest { do { finishedOrderDto.setPageNum(page); FinishedOrderResponse finishedOrderResponse = amapRequest.post(baseUrl + FINISHED_ORDER_URL, finishedOrderDto, FinishedOrderResponse.class); + result.add(finishedOrderResponse); flag = finishedOrderResponse.getData().getHasNextPage();//是否有下一页 page++; } while (flag); - + return result; } } diff --git a/src/test/java/com/chint/AmapTest.java b/src/test/java/com/chint/AmapTest.java index 2ecf79be..dc412579 100644 --- a/src/test/java/com/chint/AmapTest.java +++ b/src/test/java/com/chint/AmapTest.java @@ -8,7 +8,7 @@ import com.chint.interfaces.rest.amap.BaseResponse; import com.chint.interfaces.rest.amap.dto.UserQueryResponse; import com.chint.interfaces.rest.amap.dto.detail.OrderDetailResponse; import com.chint.interfaces.rest.amap.dto.location.LocationResponse; -import com.chint.interfaces.rest.amap.dto.token.TokenDto; +import com.chint.interfaces.rest.amap.dto.settlement.FinishedOrderResponse; import com.chint.interfaces.rest.amap.dto.token.TokenResponse; import com.chint.interfaces.rest.amap.request.OrderDetailRequest; import com.chint.interfaces.rest.amap.request.SettleBillRequest; @@ -20,6 +20,8 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; +import java.util.List; + @SpringBootTest public class AmapTest { @@ -37,6 +39,19 @@ public class AmapTest { private User user = new User(1L, "230615020", 1, "卢麟哲", "lulz1@chint.com", "15857193365", "A30000001"); private User user2 = new User(null, "240102021", 1, "袁文领", "yuanwl@chint.com", "13849105130 ", "A30000001"); + + @Autowired + private SettleBillRequest settleBillRequest; + + /** + * 完单数据查询 + */ + @Test + public void pageFinishedOrder() { + List responses= settleBillRequest.pageFinishedOrder("20240401", "20240431"); + System.out.println(responses); + } + @Test public void createUser() { BaseResponse baseResponse = amapUserRequest.createUser(user2); @@ -93,17 +108,6 @@ public class AmapTest { System.out.println("orderDetailResponse = " + orderDetailResponse); } - @Autowired - private SettleBillRequest settleBillRequest; - - /** - * 完单数据查询 - */ - // @Test - public void pageFinishedOrder() { - settleBillRequest.pageFinishedOrder("20240301", "20240331"); - } - @Autowired private TakeCarRequest takeCarRequest;