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;