高德完单、取消订单接口

This commit is contained in:
dengwc 2024-04-17 14:27:15 +08:00
parent 6e2babf7de
commit 29a68432e8
9 changed files with 268 additions and 9 deletions

View File

@ -11,6 +11,7 @@ public class AmapConstant {
//订单详情地址 //订单详情地址
public static final String ORDER_DETAIL_URL = "/ws/car/open/enterprise/order/detail"; public static final String ORDER_DETAIL_URL = "/ws/car/open/enterprise/order/detail";
public static final String FINISHED_ORDER_URL = "/ws/car/open/enterprise/bill/detail/list";//企业完单数据分页查询
public static final String CANCEL_AN_ORDER_URL = "/ws/car/open/enterprise/cancelOrder";//取消订单
} }

View File

@ -0,0 +1,14 @@
package com.chint.interfaces.rest.amap.dto.settlement;
import com.chint.interfaces.rest.amap.BaseRequestParam;
import lombok.Data;
@Data
public class FinishedOrderDto extends BaseRequestParam {
private Integer pageNum;//查询页码
private Integer pageSize;//页面数据条数 默认20,最大值100
//dsStart和dsEnd时间跨度最大为1个月dsStart和dsEnd相同时查询1天的账单
private String dsStart;//开始支付时间 格式20210101
private String dsEnd;//结束支付时间 格式20210101
private Integer subEid;//关联企业id
}

View File

@ -0,0 +1,121 @@
package com.chint.interfaces.rest.amap.dto.settlement;
import com.chint.interfaces.rest.amap.BaseResponse;
import lombok.Data;
import java.util.List;
@Data
public class FinishedOrderResponse extends BaseResponse {
private Data data;
@lombok.Data
public static class Data {
private Boolean hasNextPage;//是否有下一页
private Boolean hasPreviousPage;//是否有上一页
private List<ListElement> list;
private long pages;//页数
private long total;//总数
}
@lombok.Data
public static class ListElement {
private String amapOrderId;//订单号
private String gmtCreate;//下单时间2022-09-19 08:27:39
private String confirmFeeTime;//确认收费时间2022-09-19 08:27:39
private String eName;//企业名称
private String eId;//企业id
private String cpAmapOid;//高德子订单号
private String cpOrderId;//商户订单号
private String amapRideType;//运力类型
private String cpCode;//商户id
private String cpName;//商户名称
private String userId;//高德账号
private String eUserId;//企业员工id
private String realName;//企业员工姓名
private String financeCostcenterCode;//成本中心编号
private String financeCostcenterDesc;//成本中心描述
private String dep1;//1级部门
private String dep2;//2级部门
private String dep3;//3级部门
private String dep4;//4级部门
private String dep5;//5级部门
private String dep6;//6级部门
private String dep7;//7级部门
private String dep8;//8级部门
private String dep9;//9级部门
private String dep10;//10级部门
private String dep11;//11级部门
private String dep12;//12级部门
private String dep13;//13级部门
private String dep14;//14级部门
private String dep15;//15级部门
private String cityName;//起点城市
private String startName;//起点名称
private String endCity;//终点城市
private String endName;//终点名称
private String regulationId;//用车制度ID
private String regulationName;//用车制度名称
private double orderAmount;//订单总金额
private double mileage;//订单总里程单位km
private double estimateMileage;//订单预估里程单位km
private double travelFee;// 行程费单位
private double addFee;//附加费单位
private double cancelFee;//取消费单位
private double parkingFee;//停车费用单位
private double bridgeFee;//过桥费单位
private double otherFee;//其他费用单位
private double dispatchAmount;//加价红包单位
private double infoFees;//信息费单位
private String isChangeFee;//是否改价改价未改价
private String isCancelFeeOrder;//是否为取消费订单取消费订单非取消费订单
private String remark;//用车备注
private String result;//审批结果
private String processStatus;//审批状态
private String approvalSecondType;//审批类型0-行前审批1-行后审批2-因公转企付审批3-差旅审批
private String approvalEUserId;//审批人ID
private String approvalUserName;//审批人姓名
private String estimatePrice;//预估金额单位
private String enterpriseAmount;//企业实付金额单位
private String individualAmount;//个人实付金额单位
private String highwayFee;//高速费单位
private String resultType;//审批结果类型0-人工审批1-自动审批
private String ds;//日期20220919
private String gmtCreateStartTime106;//开始计费时间2022-09-19 08:27:39
private String gmtCreateEndTime106;//结束计费时间2022-09-19 08:27:39
private String totalCouponAmount;//优惠总金额
private String departTime;//计划用车时间2022-09-19 08:27:39
private String gmtCreate103;//司机接单时间2022-09-19 08:27:39
private String gmtCreate104;//司机到达上车点时间2022-09-19 08:27:39
private String cardId;//员工cardID
private String projectCode;//外部项目code
private String departmentId;//部门编号
private String orderRelyId;//用车申请凭证ID
private String orderRely;//用车凭证car_permission申请单下单car_permission_process端内差旅审批单下单 car_meeting会议用车下单 card_voucher礼品卡下单 out_meeting外部会议用车
private String outApplyRecordId;//外部申请单单号
private String applyRecordId;//申请单ID
private String servicefee;//服务费
private String orderEnterance;//发单入口0-实时 1-预约 2-接机 3-送机 4-接站 5-送站 8-代驾 10-代叫实时 11-代叫预约 12-代叫接机 13-代叫送机 14-代叫接站 15-代叫送站
private String sceneType;//用车场景
private String actualStartName;//开始计费位置名称
private String actualEndName;//结束计费位置名称
private String autoEnterprisePay;//是否超时自动转企业支付/
private String relationEntId;//关联企业Id
private String relationEntName;//关联企业名称
private String signCompanyName;//订单签约主体
private String parentProjectCode;//上级项目ID
private String parentProjectName;//上级项目名称
private String tripFrontApplyReason;//行前审批申请原因
private String isUpgradeSuccess;//是否自费升舱
private String outMeetingId;//外部会议ID
private String outMeetingName;//外部会议名称
private Integer personalPayStatus;//转个付支付状态 0:无需支付 1: 待支付 2:支付成功 3超期未支付
private String personalPayTime;//转个付支付时间
private String entStaffExtInfo;//企业员工拓展信息
private String tokenExtInfo;//该信息为提交token时userInfo里的extInfo值需申请开通权限
private Integer carPool;//是否拼车1:拼成 0未拼成
}
}

View File

@ -0,0 +1,11 @@
package com.chint.interfaces.rest.amap.dto.takeCar;
import com.chint.interfaces.rest.amap.BaseRequestParam;
import lombok.Data;
@Data
public class CancelOrderDto extends BaseRequestParam {
private String amapOrderId;//订单号
private String reason;//取消原因
}

View File

@ -0,0 +1,9 @@
package com.chint.interfaces.rest.amap.dto.takeCar;
import com.chint.interfaces.rest.amap.BaseResponse;
import lombok.Data;
@Data
public class CancelOrderResponse extends BaseResponse {
private Boolean result;//是否取消成功
}

View File

@ -0,0 +1,44 @@
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.List;
import static com.chint.infrastructure.constant.AmapConstant.FINISHED_ORDER_URL;
@Component
public class SettleBillRequest {
@Value("${amap.baseUrl}")
private String baseUrl;
@Autowired
private AmapRequest amapRequest;
/**
* 分页查询完单数据
*
* @return
*/
public void pageFinishedOrder(String dsStart, String dsEnd) {
FinishedOrderDto finishedOrderDto = new FinishedOrderDto();
finishedOrderDto.setDsStart(dsStart);
finishedOrderDto.setDsEnd(dsEnd);
int page = 1;
boolean flag;//默认false
finishedOrderDto.setPageSize(100);
do {
finishedOrderDto.setPageNum(page);
FinishedOrderResponse finishedOrderResponse = amapRequest.post(baseUrl + FINISHED_ORDER_URL, finishedOrderDto, FinishedOrderResponse.class);
flag = finishedOrderResponse.getData().getHasNextPage();//是否有下一页
page++;
} while (flag);
}
}

View File

@ -0,0 +1,31 @@
package com.chint.interfaces.rest.amap.request;
import com.chint.interfaces.rest.amap.dto.takeCar.CancelOrderDto;
import com.chint.interfaces.rest.amap.dto.takeCar.CancelOrderResponse;
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 static com.chint.infrastructure.constant.AmapConstant.CANCEL_AN_ORDER_URL;
@Component
public class TakeCarRequest {
@Value("${amap.baseUrl}")
private String baseUrl;
@Autowired
private AmapRequest amapRequest;
/**
* 取消订单
*/
public CancelOrderResponse cancelOrder(String orderNo, String reason) {
CancelOrderDto cancelOrderDto = new CancelOrderDto();
cancelOrderDto.setAmapOrderId(orderNo);//订单号
cancelOrderDto.setReason(reason);//原因
return amapRequest.post(baseUrl + CANCEL_AN_ORDER_URL, cancelOrderDto, CancelOrderResponse.class);
}
}

View File

@ -19,13 +19,13 @@ public class TokenRequest {
private String baseUrl; private String baseUrl;
@Autowired @Autowired
private AmapRequest gaoDeRequest; private AmapRequest amapRequest;
public TokenResponse getToken(TokenDto.UserInfo userInfo) { public TokenResponse getToken(TokenDto.UserInfo userInfo) {
TokenDto tokenDto = new TokenDto(); TokenDto tokenDto = new TokenDto();
Gson gson = new Gson(); Gson gson = new Gson();
String json = gson.toJson(userInfo); String json = gson.toJson(userInfo);
tokenDto.setUserInfo(json); tokenDto.setUserInfo(json);
return gaoDeRequest.post(baseUrl + TOKEN_URL, tokenDto, TokenResponse.class); return amapRequest.post(baseUrl + TOKEN_URL, tokenDto, TokenResponse.class);
} }
} }

View File

@ -8,6 +8,8 @@ import com.chint.interfaces.rest.amap.dto.detail.OrderDetailResponse;
import com.chint.interfaces.rest.amap.dto.token.TokenDto; import com.chint.interfaces.rest.amap.dto.token.TokenDto;
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.TakeCarRequest;
import com.chint.interfaces.rest.amap.request.TokenRequest; import com.chint.interfaces.rest.amap.request.TokenRequest;
import com.google.gson.Gson; import com.google.gson.Gson;
import org.junit.jupiter.api.Test; import org.junit.jupiter.api.Test;
@ -24,19 +26,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");
@Test // @Test
public void createUser(){ public void createUser() {
BaseResponse baseResponse = amapUserRequest.createUser(user); BaseResponse baseResponse = amapUserRequest.createUser(user);
System.out.println(gson.toJson(baseResponse)); System.out.println(gson.toJson(baseResponse));
} }
@Test // @Test
public void queryUser(){ public void queryUser(){
UserQueryResponse userQueryResponse = amapUserRequest.queryUser(user); UserQueryResponse userQueryResponse = amapUserRequest.queryUser(user);
System.out.println(gson.toJson(userQueryResponse)); System.out.println(gson.toJson(userQueryResponse));
} }
@Test // @Test
public void updateUser(){ public void updateUser(){
BaseResponse baseResponse = amapUserRequest.updateUser(user); BaseResponse baseResponse = amapUserRequest.updateUser(user);
System.out.println(gson.toJson(baseResponse)); System.out.println(gson.toJson(baseResponse));
@ -48,7 +50,8 @@ public class AmapTest {
@Autowired @Autowired
private OrderDetailRequest orderDetailRequest; private OrderDetailRequest orderDetailRequest;
// @Test
// @Test
public void gaoDe() { public void gaoDe() {
TokenDto.UserInfo userInfo = new TokenDto.UserInfo(); TokenDto.UserInfo userInfo = new TokenDto.UserInfo();
userInfo.setUserId("230615020"); userInfo.setUserId("230615020");
@ -58,10 +61,35 @@ public class AmapTest {
String token = response.getData().getToken(); String token = response.getData().getToken();
System.out.println("token = " + token); System.out.println("token = " + token);
} }
// @Test
/**
* 订单查询
*/
// @Test
public void queryorderDetail() { public void queryorderDetail() {
OrderDetailResponse orderDetailResponse = orderDetailRequest.queryOrderDetail("123456"); OrderDetailResponse orderDetailResponse = orderDetailRequest.queryOrderDetail("123456");
System.out.println("orderDetailResponse = " + orderDetailResponse); System.out.println("orderDetailResponse = " + orderDetailResponse);
} }
@Autowired
private SettleBillRequest settleBillRequest;
/**
* 完单数据查询
*/
// @Test
public void pageFinishedOrder() {
settleBillRequest.pageFinishedOrder("20240301", "20240331");
}
@Autowired
private TakeCarRequest takeCarRequest;
/**
* 取消订单
*/
// @Test
public void cancelOrder() {
takeCarRequest.cancelOrder("20240301", "行程变更");
}
} }