Commit 0e9b1e55 authored by yinjiacheng's avatar yinjiacheng

add 订单组件获取自提点列表接口封装

parent a0296739
package com.yidian.shenghuoquan.border.dto
import com.google.gson.annotations.SerializedName
/**
* author: yinjiacheng
* date: 2021/8/24 18:31
* description: 自提点列表数据结构
*/
data class PickupPointListDto(
@SerializedName("list")
val list: List<PickupPoint>,
@SerializedName("total") // 总数
val total: Int,
@SerializedName("total_page") // 总页数
val totalPage: Int
)
data class PickupPoint(
@SerializedName("address") // 详细地址
val address: String,
@SerializedName("area") // 区
val area: String,
@SerializedName("city") // 市
val city: String,
@SerializedName("contact_name") // 联系人
val contactName: String,
@SerializedName("create_time")
val createTime: String,
@SerializedName("distance") // 距离 单位:km(如果入参没有传longitude或latitude则没有此字段)
val distance: Double,
@SerializedName("is_delete")
val isDelete: Int,
@SerializedName("latitude") // 纬度
val latitude: String,
@SerializedName("life_account_id") // 生活号id
val lifeAccountId: String,
@SerializedName("location")
val location: String,
@SerializedName("longitude") // 经度
val longitude: String,
@SerializedName("phone") // 联系电话
val phone: String,
@SerializedName("province") // 省
val province: String,
@SerializedName("take_place_id") // 自提点id
val takePlaceId: Int,
@SerializedName("take_place_name") // 自提点名称
val takePlaceName: String,
@SerializedName("update_time")
val updateTime: String
)
......@@ -2,9 +2,7 @@ package com.yidian.shenghuoquan.border.http
import com.yidian.bcommon.http.HttpResult
import io.reactivex.rxjava3.core.Observable
import retrofit2.http.Headers
import retrofit2.http.POST
import retrofit2.http.QueryMap
import retrofit2.http.*
/**
* author: yinjiacheng
......@@ -19,6 +17,7 @@ interface OrderApiService {
const val orderConfirm = "/order/order/order_confirm_page"
const val createOrder = "/order/order/create"
const val orderPay = "/pay/order/pay"
const val getPickupPointList = "/marketing/wxapp/get_bind_take_place_list"
}
/**
......@@ -28,7 +27,7 @@ interface OrderApiService {
@Headers("Content-Type: application/json")
fun getOrderDetail(
@QueryMap commonParams: Map<String, String>,
@QueryMap requestParams: Map<String, String?>
@Body requestParams: Map<String, String?>
): Observable<HttpResult<Any?>>
/**
......@@ -38,7 +37,7 @@ interface OrderApiService {
@Headers("Content-Type: application/json")
fun applyRefund(
@QueryMap commonParams: Map<String, String>,
@QueryMap requestParams: Map<String, String?>
@Body requestParams: Map<String, String?>
): Observable<HttpResult<Any?>>
/**
......@@ -71,4 +70,13 @@ interface OrderApiService {
@QueryMap requestParams: Map<String, String?>
): Observable<HttpResult<Any?>>
/**
* 获取活动设置的自提点列表
*/
@GET(getPickupPointList)
fun getPickupPointList(
@QueryMap commonParams: Map<String, String>,
@QueryMap requestParams: Map<String, String?>
): Observable<HttpResult<Any?>>
}
......@@ -5,12 +5,10 @@ import com.yidian.bcommon.http.HttpResult
import com.yidian.bcommon.http.HttpResultSubscriber
import com.yidian.bcommon.http.TransformUtil
import com.yidian.http.ServiceFactory
import com.yidian.shenghuoquan.border.dto.CreateOrderResDto
import com.yidian.shenghuoquan.border.dto.OrderConfirmResDto
import com.yidian.shenghuoquan.border.dto.OrderDetailDto
import com.yidian.shenghuoquan.border.dto.OrderPayResDto
import com.yidian.shenghuoquan.border.dto.*
import com.yidian.shenghuoquan.border.http.callback.IApplyRefundCallback
import com.yidian.shenghuoquan.border.http.callback.IGetOrderDetailCallback
import com.yidian.shenghuoquan.border.http.callback.IGetPickupPointListCallback
/**
* author: yinjiacheng
......@@ -123,4 +121,25 @@ object OrderRemoteDataSource {
}
})
}
/**
* 获取活动设置的自提点列表
*/
fun getPickupPointList(callback: IGetPickupPointListCallback, requestParams: HashMap<String, String?>) {
val timeStamp = System.currentTimeMillis()
val publicParamsMap = HttpParamsUtils.getPublicParamsMap(timeStamp)
val privateParamsMap = HttpParamsUtils.getPrivateParamsMap(requestParams, timeStamp)
ServiceFactory.getInstance().createService(OrderApiService::class.java)
.getPickupPointList(publicParamsMap, privateParamsMap)
.compose(TransformUtil.defaultSchedulers())
.subscribe(object : HttpResultSubscriber<PickupPointListDto>() {
override fun onSuccess(result: HttpResult<PickupPointListDto>?) {
callback.getPickupPointListSuccess(result?.result)
}
override fun onFailure(result: HttpResult<PickupPointListDto>?) {
callback.getPickupPointListFailure(result?.reason)
}
})
}
}
package com.yidian.shenghuoquan.border.http.callback
import com.yidian.shenghuoquan.border.dto.PickupPointListDto
/**
* author: yinjiacheng
* date: 2021/8/24 19:01
* description: API /marketing/wxapp/get_bind_take_place_list
*/
interface IGetPickupPointListCallback {
fun getPickupPointListSuccess(result: PickupPointListDto?)
fun getPickupPointListFailure(message: String?)
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment