1.无上报的判断时间,改为动态时间,按用户所设的上报间隔的2倍计算时长
2.修改历史订单包括自动订阅订单
This commit is contained in:
@@ -205,7 +205,7 @@ class MySubscriptionAdapter(
|
||||
setOnClickListener {
|
||||
qMUIPopups.dismiss()
|
||||
Intent(mContext, SubscriptionHistoryActivity::class.java).let {
|
||||
it.putExtra(ConstantString.DeviceId, item.deviceId)
|
||||
it.putExtra(ConstantString.Id, item.subscriptionId)
|
||||
mMySubscriptionActivity.startActivity(it)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1285,13 +1285,21 @@ interface INetworkService {
|
||||
@Query("userId") userId: String, @Query("deviceId") deviceId: String
|
||||
): BaseResponse<MutableList<SubscriptionsOrderBean>>
|
||||
|
||||
/**
|
||||
* 获取设备充值得的历史记录(包括自动续订)
|
||||
*/
|
||||
@GET("order$SUBSCRIPTIONS_V3/subscriptions/historyIncludRenew")
|
||||
suspend fun getHistoryIncludeRenew(
|
||||
@Query("subscriptionId") subscriptionId: String
|
||||
): BaseResponse<MutableList<SubscriptionsOrderBean>>
|
||||
|
||||
/**
|
||||
* 提交退款申请
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("order$SUBSCRIPTIONS_V3/refund/commit")
|
||||
suspend fun commitRefund(
|
||||
@Field("currency_code") currency_code: String,
|
||||
@Field("currency_code") currencyCode: String,
|
||||
@Field("orderNum") orderNum: String,
|
||||
@Field("chargeId") chargeId: String,
|
||||
@Field("amount") amount: Int,
|
||||
|
||||
@@ -1173,11 +1173,18 @@ object NetworkApi : BaseNetworkApi<INetworkService>(INetworkService.BASE_URL) {
|
||||
service.getSubscriptionsHistory(userId, deviceId)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备充值得的历史记录(包括自动续订)
|
||||
*/
|
||||
suspend fun getHistoryIncludeRenew(subscriptionId: String) = getResult {
|
||||
service.getHistoryIncludeRenew(subscriptionId)
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取设备充值得的历史记录
|
||||
*/
|
||||
suspend fun commitRefund(
|
||||
currency_code: String,
|
||||
currencyCode: String,
|
||||
orderId: String,
|
||||
chargeId: String,
|
||||
amount: Int,
|
||||
@@ -1189,7 +1196,7 @@ object NetworkApi : BaseNetworkApi<INetworkService>(INetworkService.BASE_URL) {
|
||||
payType: Int
|
||||
) = getResult {
|
||||
service.commitRefund(
|
||||
currency_code,
|
||||
currencyCode,
|
||||
orderId,
|
||||
chargeId,
|
||||
amount,
|
||||
|
||||
@@ -245,7 +245,7 @@ class LedLightActivityV0 : BaseActivity<ActivityLedLightBinding>(ActivityLedLigh
|
||||
setDisabledState(false)
|
||||
} else {
|
||||
//是否超时上报
|
||||
val isTimeoutReport = Util.isTimeoutReport(updateTime)
|
||||
val isTimeoutReport = Util.isTimeoutReport(updateTime,gnssInterval)
|
||||
if (powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2 || powerSwitch == ConstantInt.Type3 || inWifiZone == ConstantInt.Type1 || isTimeoutReport) {
|
||||
setDisabledState(true)
|
||||
} else {
|
||||
|
||||
@@ -23,7 +23,7 @@ class SubscriptionHistoryActivity :
|
||||
|
||||
private lateinit var mHistoryAdapter: SubscriptionHistoryAdapter
|
||||
private var mSubscriptionsOrderList = mutableListOf<SubscriptionsOrderBean>()
|
||||
private var mDeviceId = ""
|
||||
private var subscriptionId = ""
|
||||
private var mRefreshPackage = true
|
||||
|
||||
override fun getTopBar() = mViewBinding.ilSubscriptionHistoryTopBar.titleTopBar
|
||||
@@ -41,7 +41,7 @@ class SubscriptionHistoryActivity :
|
||||
}
|
||||
|
||||
intent?.extras?.apply {
|
||||
mDeviceId = getString(ConstantString.DeviceId, "")
|
||||
subscriptionId = getString(ConstantString.Id, "")
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ class SubscriptionHistoryActivity :
|
||||
super.onResume()
|
||||
if (mRefreshPackage) {
|
||||
mRefreshPackage = false
|
||||
mSubscriptionViewModel.getSubscriptionsHistory(mDeviceId)
|
||||
mSubscriptionViewModel.getHistoryIncludeRenew("sub_1TN3ccCUI9XSagUNmhpfpRk4")
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -537,9 +537,7 @@ class RouteV3Fragment : BaseFragment<FragmentRouteV3Binding>(FragmentRouteV3Bind
|
||||
vsbMapRouteLineV3.visibility = View.VISIBLE
|
||||
ivMapRouteLineV3LastBtn.visibility = View.VISIBLE
|
||||
ivMapRouteLineV3NextBtn.visibility = View.VISIBLE
|
||||
LogUtil.e("显示")
|
||||
} else {
|
||||
LogUtil.e("隐藏")
|
||||
vsbMapRouteLineV3.visibility = View.GONE
|
||||
ivMapRouteLineV3LastBtn.visibility = View.GONE
|
||||
ivMapRouteLineV3NextBtn.visibility = View.GONE
|
||||
|
||||
@@ -653,7 +653,7 @@ class HomeTrackFragment :
|
||||
}
|
||||
|
||||
//是否超时上报
|
||||
val isTimeoutReport = Util.isTimeoutReport(updateTime)
|
||||
val isTimeoutReport = Util.isTimeoutReport(updateTime,gnssInterval)
|
||||
mTrackStateList[0].let {
|
||||
it.menuValue =
|
||||
if (isTimeoutReport || lteSignal == ConstantInt.NoSignal || powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2) {
|
||||
@@ -773,7 +773,7 @@ class HomeTrackFragment :
|
||||
private fun setLedControlState(mapDeviceBean: MapDeviceBean) {
|
||||
mapDeviceBean.apply {
|
||||
//是否超时上报
|
||||
val isTimeoutReport = Util.isTimeoutReport(updateTime)
|
||||
// val isTimeoutReport = Util.isTimeoutReport(updateTime,gnssInterval)
|
||||
mTrackStateList[5].let {
|
||||
if (deviceType == ConstantInt.Type1) {
|
||||
it.imageId = R.drawable.icon_light_svg
|
||||
|
||||
@@ -747,8 +747,9 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
mapDeviceBean.apply {
|
||||
val share = MMKVUtil.getInt(MMKVKey.Shared)
|
||||
//分钟后无上报、没有lte信号或在wifi中隐藏直播按钮
|
||||
isCanLive =
|
||||
!(Util.isTimeoutReport(updateTime) || powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2 || powerSwitch == ConstantInt.Type3 || inWifiZone == ConstantInt.Type1)
|
||||
isCanLive = !(Util.isTimeoutReport(
|
||||
updateTime, gnssInterval
|
||||
) || powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2 || powerSwitch == ConstantInt.Type3 || inWifiZone == ConstantInt.Type1)
|
||||
mViewBinding.homeMapLiveBtn.visibility =
|
||||
if (share != ConstantInt.NoShare || deviceType == ConstantInt.Type1) {
|
||||
View.GONE
|
||||
@@ -777,7 +778,7 @@ class MapV3Fragment : BaseFragment<FragmentMapV3Binding>(FragmentMapV3Binding::i
|
||||
}
|
||||
|
||||
/**
|
||||
* 接收添加信用卡返回结果
|
||||
* 接收直播页面宠物弹窗操作
|
||||
*/
|
||||
private val mActivityResultLauncher =
|
||||
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) {
|
||||
|
||||
@@ -797,14 +797,14 @@ class Util {
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是超时上报了
|
||||
* 是否是超时上报了,按用户所设的上报间隔的2倍计算时长
|
||||
*
|
||||
* @param updateTime 10位时间戳
|
||||
*/
|
||||
fun isTimeoutReport(updateTime: Long): Boolean {
|
||||
fun isTimeoutReport(updateTime: Long, gnssInterval: Int): Boolean {
|
||||
val now = System.currentTimeMillis() / 1000
|
||||
val updateMin = (now - updateTime) / 60
|
||||
return updateMin > ConstantInt.ReportTimeOutTime
|
||||
val updateSecond = now - updateTime
|
||||
return updateSecond > gnssInterval * 2
|
||||
}
|
||||
|
||||
/***
|
||||
@@ -834,7 +834,7 @@ class Util {
|
||||
var isControl: Boolean
|
||||
mapDeviceBean.apply {
|
||||
//是否超时上报
|
||||
val isTimeoutReport = isTimeoutReport(updateTime)
|
||||
val isTimeoutReport = isTimeoutReport(updateTime, gnssInterval)
|
||||
isControl = if (powerSwitch == ConstantInt.Type3) false
|
||||
else if (SRBleUtil.instance.isMacConnect(mac)) true
|
||||
else if (powerSwitch == ConstantInt.Type0 || powerSwitch == ConstantInt.Type2 || inWifiZone == ConstantInt.Type1 || isTimeoutReport) false
|
||||
|
||||
@@ -185,7 +185,7 @@ class MapViewModel : ViewModel() {
|
||||
}
|
||||
}
|
||||
//网络无信号/ 分钟后无上报所有绿点取消显示
|
||||
else if (lteSignal <= ConstantInt.NoSignal || Util.isTimeoutReport(updateTime)) {
|
||||
else if (lteSignal <= ConstantInt.NoSignal || Util.isTimeoutReport(updateTime,gnssInterval)) {
|
||||
// setNoState(context, deviceStateList)
|
||||
|
||||
//警告状态
|
||||
@@ -307,7 +307,7 @@ class MapViewModel : ViewModel() {
|
||||
) {
|
||||
mapDeviceBean.let {
|
||||
//是否超时上报
|
||||
val isTimeoutReport = Util.isTimeoutReport(it.updateTime)
|
||||
val isTimeoutReport = Util.isTimeoutReport(it.updateTime,it.gnssInterval)
|
||||
deviceStateList[0].apply {
|
||||
menuType = ConstantInt.Open
|
||||
val lteValue =
|
||||
|
||||
@@ -61,6 +61,13 @@ class SubscriptionManageViewModel : ViewModel() {
|
||||
}
|
||||
}
|
||||
|
||||
fun getHistoryIncludeRenew(subscriptionId: String) {
|
||||
viewModelScope.launch {
|
||||
val result = NetworkApi.getHistoryIncludeRenew(subscriptionId)
|
||||
mSubscriptionsHistoryLiveData.value = result
|
||||
}
|
||||
}
|
||||
|
||||
fun commitRefund(
|
||||
orderId: String,
|
||||
chargeId: String,
|
||||
|
||||
Reference in New Issue
Block a user