package com.oneclouds.cargo.request; import android.content.Context; import android.os.Handler; import com.google.gson.Gson; import com.oneclouds.cargo.constant.SPConstant; import com.oneclouds.cargo.request.manager.UrlManager; import com.oneclouds.cargo.util.MapUtil; import com.oneclouds.cargo.util.SPUtil; import com.oneclouds.cargo.util.http.OkDate; import com.oneclouds.cargo.util.http.OkHttpUtil; import com.oneclouds.cargo.util.http.RequestTest; import java.util.ArrayList; import java.util.HashMap; import java.util.Map; import okhttp3.Request; /** * @author hlh * @version 1.0.0 * @date 2021/9/7 11:38 * @description:运单请求 */ public class WaybillRequest { private Context con; private Handler hd; private String token; public WaybillRequest(Context con, Handler hd) { this.con = con; this.hd = hd; } private Gson gson=new Gson(); public String getToken(Context con) { return SPUtil.getSP(con, SPConstant.DATA,SPConstant.DATA_TOKEN); } //投诉信息保存 public static final String WAYBILL_COMPLAINT_V3="/app/shipper/waybill/complaintV3"; //确认装货 public static final String WAYBILL_CONFIRM_LOADING="/app/shipper/waybill/confirmLoading"; //确认卸货 public static final String WAYBILL_CONFIRM_UNLOAD="/app/shipper/waybill/confirmUnload"; //评价信息保存 public static final String WAYBILL_EVALUATION_V3="/app/shipper/waybill/evaluationV3"; //运单详情 public static final String WAYBILL_GET_EXECUTE_WATBILL="/app/shipper/waybill/getExecuteWaybill"; //获取双轨迹 public static final String WAYBILL_GET_LOC="/app/shipper/waybill/getLoc"; //货源详情 public static final String WAYBILL_GET_ORDER_DETAIL="waybill_getOrderDetail"; //获取评价信息 public static final String WAYBILL_LIST_APPAISES="waybill_listAppraises"; //获取投诉信息 public static final String WAYBILL_LIST_COMPLAINT="waybill_listComplaint"; //货源列表 public static final String WAYBILL_LIST_V2="waybill_listV2"; //运单列表数量 public static final String WAYBILL_LIST_NUM="waybill_listnum"; //运单列表 public void orderList(int page,int limit,int orderStatus){ Map map=new HashMap<>(); map.put("page",page); map.put("limit",limit); if(orderStatus!=0){ map.put("orderStatus",orderStatus); } Request re = OkHttpUtil.posts(new OkDate(UrlManager.getWaybillListV2(), "post", MapUtil.mapJson(map)),getToken(con),con); RequestTest.test(1,WAYBILL_LIST_V2,re,con,hd); } //运单详情 public void orderDetail(int waybillId){ Map map=new HashMap<>(); map.put("waybillId",waybillId); Request re = OkHttpUtil.posts(new OkDate(UrlManager.getWaybillGetExecuteWatbill(), "post", MapUtil.mapJson(map)),getToken(con),con); RequestTest.test(1,WAYBILL_GET_EXECUTE_WATBILL,re,con,hd); } //货源详情 public void orderDetailAll(int id){ Map map=new HashMap<>(); map.put("id",id); Request re = OkHttpUtil.posts(new OkDate(UrlManager.getWaybillGetOrderDetail(), "post", MapUtil.mapJson(map)),getToken(con),con); RequestTest.test(1,WAYBILL_GET_ORDER_DETAIL,re,con,hd); } //获取评价信息 public void orderEvaluate(int waybillId){ Map map=new HashMap<>(); map.put("waybillId",waybillId); Request re = OkHttpUtil.posts(new OkDate(UrlManager.getWaybillListAppaises(), "post", MapUtil.mapJson(map)),getToken(con),con); RequestTest.test(1,WAYBILL_LIST_APPAISES,re,con,hd); } //保存评价信息 public void evaluate(int waybillId,String content,int attitudeScore){ Map map=new HashMap<>(); map.put("attitudeScore",attitudeScore); map.put("content",content); map.put("fileIds",new ArrayList<>()); map.put("waybillId",waybillId); Request re = OkHttpUtil.posts(new OkDate(UrlManager.getWaybillEvaluationV3(), "post", MapUtil.mapJson(map)),getToken(con),con); RequestTest.test(1,WAYBILL_EVALUATION_V3,re,con,hd); } //获取投诉信息 public void orderComplaint(int waybillId){ Map map=new HashMap<>(); map.put("waybillId",waybillId); Request re = OkHttpUtil.posts(new OkDate(UrlManager.getWaybillListComplaint(), "post", MapUtil.mapJson(map)),getToken(con),con); RequestTest.test(1,WAYBILL_LIST_COMPLAINT,re,con,hd); } //保存投诉信息Complaint public void complaint(int waybillId,String content){ Map map=new HashMap<>(); map.put("content",content); map.put("fileIds",new ArrayList<>()); map.put("waybillId",waybillId); Request re = OkHttpUtil.posts(new OkDate(UrlManager.getWaybillComplaintV3(), "post", MapUtil.mapJson(map)),getToken(con),con); RequestTest.test(1,WAYBILL_COMPLAINT_V3,re,con,hd); } }