【update】高德企业完单数据分页查询方法修改

This commit is contained in:
nixj 2024-04-30 13:35:06 +08:00
parent cbcbda9153
commit 0c6fefa68f
2 changed files with 21 additions and 17 deletions

View File

@ -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.FinishedOrderDto;
import com.chint.interfaces.rest.amap.dto.settlement.FinishedOrderResponse; 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.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import static com.chint.infrastructure.constant.AmapConstant.FINISHED_ORDER_URL; import static com.chint.infrastructure.constant.AmapConstant.FINISHED_ORDER_URL;
@ -26,7 +24,8 @@ public class SettleBillRequest {
* *
* @return * @return
*/ */
public void pageFinishedOrder(String dsStart, String dsEnd) { public List<FinishedOrderResponse> pageFinishedOrder(String dsStart, String dsEnd) {
List<FinishedOrderResponse> result=new ArrayList<>();
FinishedOrderDto finishedOrderDto = new FinishedOrderDto(); FinishedOrderDto finishedOrderDto = new FinishedOrderDto();
finishedOrderDto.setDsStart(dsStart); finishedOrderDto.setDsStart(dsStart);
finishedOrderDto.setDsEnd(dsEnd); finishedOrderDto.setDsEnd(dsEnd);
@ -36,9 +35,10 @@ public class SettleBillRequest {
do { do {
finishedOrderDto.setPageNum(page); finishedOrderDto.setPageNum(page);
FinishedOrderResponse finishedOrderResponse = amapRequest.post(baseUrl + FINISHED_ORDER_URL, finishedOrderDto, FinishedOrderResponse.class); FinishedOrderResponse finishedOrderResponse = amapRequest.post(baseUrl + FINISHED_ORDER_URL, finishedOrderDto, FinishedOrderResponse.class);
result.add(finishedOrderResponse);
flag = finishedOrderResponse.getData().getHasNextPage();//是否有下一页 flag = finishedOrderResponse.getData().getHasNextPage();//是否有下一页
page++; page++;
} while (flag); } while (flag);
return result;
} }
} }

View File

@ -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.UserQueryResponse;
import com.chint.interfaces.rest.amap.dto.detail.OrderDetailResponse; 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.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.dto.token.TokenResponse;
import com.chint.interfaces.rest.amap.request.OrderDetailRequest; import com.chint.interfaces.rest.amap.request.OrderDetailRequest;
import com.chint.interfaces.rest.amap.request.SettleBillRequest; 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.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest; import org.springframework.boot.test.context.SpringBootTest;
import java.util.List;
@SpringBootTest @SpringBootTest
public class AmapTest { 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 user = new User(1L, "230615020", 1, "卢麟哲", "lulz1@chint.com", "15857193365", "A30000001");
private User user2 = new User(null, "240102021", 1, "袁文领", "yuanwl@chint.com", "13849105130 ", "A30000001"); private User user2 = new User(null, "240102021", 1, "袁文领", "yuanwl@chint.com", "13849105130 ", "A30000001");
@Autowired
private SettleBillRequest settleBillRequest;
/**
* 完单数据查询
*/
@Test
public void pageFinishedOrder() {
List<FinishedOrderResponse> responses= settleBillRequest.pageFinishedOrder("20240401", "20240431");
System.out.println(responses);
}
@Test @Test
public void createUser() { public void createUser() {
BaseResponse baseResponse = amapUserRequest.createUser(user2); BaseResponse baseResponse = amapUserRequest.createUser(user2);
@ -93,17 +108,6 @@ public class AmapTest {
System.out.println("orderDetailResponse = " + orderDetailResponse); System.out.println("orderDetailResponse = " + orderDetailResponse);
} }
@Autowired
private SettleBillRequest settleBillRequest;
/**
* 完单数据查询
*/
// @Test
public void pageFinishedOrder() {
settleBillRequest.pageFinishedOrder("20240301", "20240331");
}
@Autowired @Autowired
private TakeCarRequest takeCarRequest; private TakeCarRequest takeCarRequest;