Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
p x
SuZhouAvp
Commits
0a5baef9
Commit
0a5baef9
authored
Aug 18, 2025
by
p x
Browse files
登录
parent
09291f32
Changes
59
Hide whitespace changes
Inline
Side-by-side
app/build.gradle.kts
View file @
0a5baef9
...
...
@@ -39,6 +39,7 @@ android {
}
buildFeatures
{
dataBinding
=
true
viewBinding
=
true
}
lint
{
abortOnError
=
false
...
...
@@ -54,10 +55,15 @@ dependencies {
implementation
(
libs
.
material
)
implementation
(
libs
.
androidx
.
activity
)
implementation
(
libs
.
androidx
.
constraintlayout
)
implementation
(
libs
.
androidx
.
navigation
.
fragment
.
ktx
)
implementation
(
libs
.
androidx
.
navigation
.
ui
.
ktx
)
testImplementation
(
libs
.
junit
)
androidTestImplementation
(
libs
.
androidx
.
junit
)
androidTestImplementation
(
libs
.
androidx
.
espresso
.
core
)
//sm4 加密
implementation
(
"org.bouncycastle:bcprov-jdk15on:1.70"
)
implementation
(
"com.google.protobuf:protobuf-java:4.31.1"
)
// implementation("com.google.protobuf:protobuf-javalite:4.31.1")
// implementation("com.google.protobuf:protoc:3.0.0")
...
...
app/proguard-rules.pro
View file @
0a5baef9
...
...
@@ -18,4 +18,7 @@
#
If
you
keep
the
line
number
information
,
uncomment
this
to
#
hide
the
original
source
file
name
.
#-
renamesourcefileattribute
SourceFile
\ No newline at end of file
#-
renamesourcefileattribute
SourceFile
-
keep
class
org
.
bouncycastle
.
**
{
*
;
}
-
dontwarn
org
.
bouncycastle
.
**
app/src/androidTest/java/com/sd/cavphmi/ExampleInstrumentedTest.kt
View file @
0a5baef9
...
...
@@ -2,6 +2,7 @@ package com.sd.cavphmi
import
androidx.test.platform.app.InstrumentationRegistry
import
androidx.test.ext.junit.runners.AndroidJUnit4
import
com.sd.cavphmi.utils.SM4CryptoHelper
import
org.junit.Test
import
org.junit.runner.RunWith
...
...
@@ -21,4 +22,12 @@ class ExampleInstrumentedTest {
val
appContext
=
InstrumentationRegistry
.
getInstrumentation
().
targetContext
assertEquals
(
"com.sd.cavphmi"
,
appContext
.
packageName
)
}
@Test
fun
loginCpy
(){
var
pwd
=
"vUO2dStZDhbd*88FfT84"
var
key
=
"Cusc@itmp-sm4key"
.
toByteArray
()
var
pp
=
SM4CryptoHelper
.
encryptECB
(
key
,
pwd
.
toByteArray
())
println
(
"------------------pp = ${pp}"
)
}
}
\ No newline at end of file
app/src/main/AndroidManifest.xml
View file @
0a5baef9
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
>
<!-- 打开关闭sdcard的权限 -->
<uses-permission
android:name=
"android.permission.MOUNT_UNMOUNT_FILESYSTEMS"
tools:ignore=
"ProtectedPermissions"
/>
<uses-permission
android:name=
"android.permission.INTERACT_ACROSS_USERS_FULL"
tools:ignore=
"ProtectedPermissions"
/>
<!-- 允许程序打开网络套接字 -->
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<!-- 允许程序访问网络状态 -->
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<!-- 允许用户改变WiFi连接状态 -->
<uses-permission
android:name=
"android.permission.CHANGE_WIFI_STATE"
/>
<!-- 程序访问粗略位置 -->
<uses-permission
android:name=
"android.permission.ACCESS_COARSE_LOCATION"
/>
<!-- 允许用户访问精确位置 -->
<uses-permission
android:name=
"android.permission.ACCESS_FINE_LOCATION"
/>
<!-- Android Q 允许后台运行定位 -->
<uses-permission
android:name=
"android.permission.ACCESS_BACKGROUND_LOCATION"
/>
<!-- 允许程序读取手机状态 -->
<uses-permission
android:name=
"android.permission.READ_PHONE_STATE"
/>
<!-- 打电话的权限 -->
<!-- <uses-permission android:name="android.permission.CALL_PHONE" />-->
tools:ignore=
"ProtectedPermissions"
/>
<!-- 允许程序打开网络套接字 -->
<uses-permission
android:name=
"android.permission.INTERNET"
/>
<!-- 允许程序访问网络状态 -->
<uses-permission
android:name=
"android.permission.ACCESS_NETWORK_STATE"
/>
<!-- 允许用户改变WiFi连接状态 -->
<uses-permission
android:name=
"android.permission.CHANGE_WIFI_STATE"
/>
<!-- 程序访问粗略位置 -->
<uses-permission
android:name=
"android.permission.ACCESS_COARSE_LOCATION"
/>
<!-- 允许用户访问精确位置 -->
<uses-permission
android:name=
"android.permission.ACCESS_FINE_LOCATION"
/>
<!-- Android Q 允许后台运行定位 -->
<uses-permission
android:name=
"android.permission.ACCESS_BACKGROUND_LOCATION"
/>
<!-- 允许程序读取手机状态 -->
<uses-permission
android:name=
"android.permission.READ_PHONE_STATE"
/>
<!-- 打电话的权限 -->
<!-- <uses-permission android:name="android.permission.CALL_PHONE" /> -->
<!-- 从SDCard读出数据权限 -->
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<!-- 允许程序写入外部存储设备 -->
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<!-- 允许程序读取所有者数据 -->
<uses-permission
android:name=
"android.permission.READ_OWNER_DATA"
/>
<!-- 访问WiFi状态,需要WiFi信息用于网络定位 -->
<uses-permission
android:name=
"android.permission.ACCESS_WIFI_STATE"
/>
<!-- 访问网络的变化, 需要某些信息用于网络定位 -->
<uses-permission
android:name=
"android.permission.CHANGE_NETWORK_STATE"
/>
<!-- 8.0 安装未知程序权限 -->
<uses-permission
android:name=
"android.permission.READ_EXTERNAL_STORAGE"
/>
<!-- 允许程序写入外部存储设备 -->
<uses-permission
android:name=
"android.permission.WRITE_EXTERNAL_STORAGE"
/>
<!-- 允许程序读取所有者数据 -->
<uses-permission
android:name=
"android.permission.READ_OWNER_DATA"
/>
<!-- 访问WiFi状态,需要WiFi信息用于网络定位 -->
<uses-permission
android:name=
"android.permission.ACCESS_WIFI_STATE"
/>
<!-- 访问网络的变化, 需要某些信息用于网络定位 -->
<uses-permission
android:name=
"android.permission.CHANGE_NETWORK_STATE"
/>
<!-- 8.0 安装未知程序权限 -->
<uses-permission
android:name=
"android.permission.REQUEST_INSTALL_PACKAGES"
/>
<application
...
...
@@ -46,7 +31,6 @@
android:fullBackupContent=
"@xml/backup_rules"
android:icon=
"@mipmap/ic_launcher"
android:label=
"@string/app_name"
android:roundIcon=
"@mipmap/ic_launcher_round"
android:supportsRtl=
"true"
android:theme=
"@style/Theme.SuZhouAvp"
tools:targetApi=
"31"
>
...
...
@@ -57,28 +41,40 @@
<meta-data
android:name=
"com.minedata.minenavi.apikey"
android:value=
"57ac7a0d56494912a0c28e651fa4a40a"
/>
<!-- android:screenOrientation="userLandscape"-->
android:value=
"57ac7a0d56494912a0c28e651fa4a40a"
/>
<!-- android:screenOrientation="userLandscape" -->
<activity
android:name=
".ui.
Boot
Activity"
android:name=
".ui.
Login
Activity"
android:exported=
"true"
android:screenOrientation=
"landscape"
android:theme=
"@style/SplashTheme"
>
android:theme=
"@style/Theme.SuZhouAvp"
android:screenOrientation=
"landscape"
>
<intent-filter>
<action
android:name=
"android.intent.action.MAIN"
/>
<category
android:name=
"android.intent.category.LAUNCHER"
/>
</intent-filter>
</activity>
<activity
android:name=
".ui.MainActivity"
android:exported=
"true"
android:launchMode=
"singleTask"
android:screenOrientation=
"landscape"
>
android:screenOrientation=
"landscape"
/
>
</activity>
<!-- <activity-->
<!-- android:name=".ui.BootActivity"-->
<!-- android:exported="true"-->
<!-- android:screenOrientation="landscape"-->
<!-- android:theme="@style/SplashTheme">-->
<!-- <intent-filter>-->
<!-- <action android:name="android.intent.action.MAIN" />-->
<!-- <category android:name="android.intent.category.LAUNCHER" />-->
<!-- </intent-filter>-->
<!-- </activity>-->
</application>
...
...
app/src/main/assets/777=88
0 → 100644
View file @
0a5baef9
/*** 感知延时**/
fun subPreDelay(): LiveData<PreDelay> {
try {
if (preDelayWSClient == null) {
preDelayWSClient = PreDelayWSClient(URI(MyContants.WS_PRE_DELAY))
preDelayWSClient?.connect()
preDelayWSClient?.onDataCb = object : PreDelayWSClient.OnDataCb {
override fun onMsg(str: String) {
viewModelScope.launch {
FileIoUtils.writeToFile(str, "pre_delay.txt")
var bean = gson.fromJson(str, PreDelay::class.java)
preDelay.postValue(bean)
}
}
}
}
} catch (e: Exception) {
e.printStackTrace()
}
return preDelay
}
\ No newline at end of file
app/src/main/java/com/sd/cavphmi/bean/AllLinePlaningBean.kt
deleted
100644 → 0
View file @
09291f32
package
com.sd.cavphmi.bean
/**全局路径发生切换***/
data class
AllLinePlaningBean
(
val
objectData
:
List
<
LinePlaning
>,
val
wsTime
:
Long
)
data class
LinePlaning
(
var
line
:
List
<
List
<
Double
>>)
\ No newline at end of file
app/src/main/java/com/sd/cavphmi/bean/CarVehicle.kt
View file @
0a5baef9
package
com.sd.cavphmi.bean
/***网联车辆位姿
*{"version":"2.0.0","data_id":"default","data_type":"OBU","data_list":[{"vid":"2
45","vmodel":"01010108001","vtype":"Ambulance","coord_type":"Geo","coord":"116.5013455,39.8110367","direction":330.2354,"speed":0.0,"timestamp":1754464768658,"vinfo":{"door":1,"light":1,"wiper":0}},{"vid":"261","vmodel":"01010102001","vtype":"双层客车1","coord_type":"Geo","coord":"117.345278,39.0059533","direction":346.8844,"speed":47.0,"timestamp":1754464768625,"vinfo":{"door":0,"light":0,"wiper":1,"poleId":"1200003938"}},{"vid":"263","vmodel":"01010400006","vtype":"中型客车","coord_type":"Geo","coord":"117.3505606,39.0030274","direction":356.9585,"speed":58.0,"timestamp":1754464768626,"vinfo":{"door":0,"light":0,"wiper":1}},{"vid":"265","vmodel":"01010400001","vtype":"清扫","coord_type":"Geo","coord":"117.346545,39.001303","direction":0.27499999999997726,"speed":0.0,"timestamp":1754464768627,"vinfo":{"door":0,"light":0,"wiper":1,"poleId":"1200001928"}},{"vid":"267","vmodel":"01010400003","vtype":"售卖","coord_type":"Geo","coord":"117.3463217,38.9951148","direction":94.40610000000004,"speed":0.0,"timestamp":1754464768628,"vinfo":{"door":0,"light":36864,"wiper":1,"poleId":"1200003838"}},{"vid":"269","vmodel":"01010400004","vtype":"出租","coord_type":"Geo","coord":"117.3465439,38.9954946","direction":274.5396,"speed":53.0,"timestamp":1754464768627,"vinfo":{"door":0,"light":0,"wiper":1,"poleId":"1200003838"}},{"vid":"335","vmodel":"01010108001","vtype":"Ambulance","coord_type":"Geo","coord":"116.5014316,39.8110748","direction":330.2354,"speed":0.0,"timestamp":1754464768655,"vinfo":{"door":1,"light":1,"wiper":0}},{"vid":"363","vmodel":"01010108001","vtype":"Ambulance","coord_type":"Geo","coord":"116.5030884,39.8089693","direction":238.19000000000005,"speed":0.0,"timestamp":1754464768657,"vinfo":{"door":1,"light":1,"wiper":0}},{"vid":"355","vmodel":"01010108001","vtype":"Ambulance","coord_type":"Geo","coord":"116.5024007,39.8101233","direction":329.1582,"speed":0.0,"timestamp":1754464768656,"vinfo":{"door":1,"light":1,"wiper":0}},{"vid":"271","vmodel":"01010400008","vtype":"巡逻车","coord_type":"Geo","coord":"117.3471332,39.0015908","direction":271.231,"speed":60.0,"timestamp":1754464768627,"vinfo":{"door":0,"light":0,"wiper":1,"poleId":"1200001928"}},{"vid":"369","vmodel":"01010108001","vtype":"Ambulance","coord_type":"Geo","coord":"116.5012194,39.8088289","direction":256.06500000000005,"speed":0.0,"timestamp":1754464768656,"vinfo":{"door":1,"light":1,"wiper":0}},{"vid":"367","vmodel":"01010108001","vtype":"Ambulance","coord_type":"Geo","coord":"116.5027912,39.8087311","direction":58.24649999999997,"speed":0.0,"timestamp":1754464768657,"vinfo":{"door":1,"light":1,"wiper":0}},{"vid":"359","vmodel":"01010108001","vtype":"Ambulance","coord_type":"Geo","coord":"116.5012066,39.8088949","direction":263.1252999999999,"speed":0.0,"timestamp":1754464768658,"vinfo":{"door":1,"light":1,"wiper":0
}}]}
*{"version":"2.0.0","data_id":"default","data_type":"OBU","data_list":[{"vid":"2
61","vmodel":"01010102001","vtype":"双层客车1","coord_type":"Geo","coord":"117.3499501,39.0072603","direction":333.573,"speed":1.0,"timestamp":1755156180282,"vinfo":{"door":0,"light":0,"wiper":1}},{"vid":"263","vmodel":"01010400006","vtype":"中型客车","coord_type":"Geo","coord":"117.3487397,39.0030869","direction":3.008699999999976,"speed":58.0,"timestamp":1755156180283,"vinfo":{"door":0,"light":0,"wiper":1}},{"vid":"265","vmodel":"01010400001","vtype":"清扫","coord_type":"Geo","coord":"117.3443229,39.0011612","direction":349.3043,"speed":54.0,"timestamp":1755156180283,"vinfo":{"door":0,"light":0,"wiper":1}},{"vid":"267","vmodel":"01010400003","vtype":"售卖","coord_type":"Geo","coord":"117.3463546,38.9986415","direction":348.0532,"speed":4.0,"timestamp":1755156180284,"vinfo":{"door":0,"light":36864,"wiper":1,"poleId":"1200003843"}},{"vid":"269","vmodel":"01010400004","vtype":"出租","coord_type":"Geo","coord":"117.3472319,38.994756","direction":190.48939999999993,"speed":41.0,"timestamp":1755156180283,"vinfo":{"door":0,"light":0,"wiper":1,"poleId":"1200003838"}},{"vid":"271","vmodel":"01010400008","vtype":"巡逻车","coord_type":"Geo","coord":"117.3470161,39.0023286","direction":87.26830000000001,"speed":60.0,"timestamp":1755156180284,"vinfo":{"door":0,"light":0,"wiper":1
}}]}
* **/
data class
CarVehicle
(
val
data_id
:
String
,
...
...
@@ -12,8 +12,8 @@ data class CarVehicle(
data class
VData
(
val
coord
:
String
,
val
coord_type
:
String
,
//"117.345278,39.0059533",
val
direction
:
Double
,
//
航向角
val
speed
:
Double
,
val
direction
:
Double
,
//
交通实体朝向:可选字段, 单位为角度,正东方向为0,顺时针方向为正(0~360),无该字段时会自动计算
val
speed
:
Double
,
//单位:km/h,
val
timestamp
:
Long
,
val
vid
:
String
,
val
vinfo
:
Vinfo
,
...
...
@@ -23,7 +23,7 @@ data class VData(
data class
Vinfo
(
val
door
:
Int
,
val
light
:
Int
,
val
light
:
Int
,
//灯光状态
val
poleId
:
String
,
val
wiper
:
Int
)
\ No newline at end of file
app/src/main/java/com/sd/cavphmi/bean/LoginSuccBean.kt
0 → 100644
View file @
0a5baef9
package
com.sd.cavphmi.bean
/***登录成功返回
* {"id":"1945784080018624513","username":"曲华晔","userAccount":"18********66","userProperty":null,"tenantId":"1416942676699533314","createTime":"2025-07-17 17:54:10","longitude":116.50195100000000000,"latitude":39.80889700000000000,"tenantName":"北京亦庄示范场","tenantCode":"PM270","tenantType":"other","isSystemAdmin":0,"hdMap":1,"expiry":0,"startTime":"2025-07-17 00:00:00","endTime":"2025-10-31 00:00:00","token":"3W6UeYoWsr3Hged3iJDqw5RQrLyTDwDkkX481PIiuYGwPCamTVdGHhmAxaCgHtns4IaNTEynJ8JfY46bvkzoqqDA9YcGUmkMZ31sV7QAVrk91yOPTv9mCvPLUgOeBgRl","ipAddress":"10.42.4.0","loginModel":"itdts-portal-v5"}
* **/
data class
LoginSuccBean
(
val
createTime
:
String
,
val
endTime
:
String
,
val
expiry
:
Int
,
val
hdMap
:
Int
,
val
id
:
String
,
val
ipAddress
:
String
,
val
isSystemAdmin
:
Int
,
val
latitude
:
Double
,
val
loginModel
:
String
,
val
longitude
:
Double
,
val
startTime
:
String
,
val
tenantCode
:
String
,
val
tenantId
:
String
,
val
tenantName
:
String
,
val
tenantType
:
String
,
val
token
:
String
,
val
userAccount
:
String
,
val
userProperty
:
Any
,
val
username
:
String
)
\ No newline at end of file
app/src/main/java/com/sd/cavphmi/bean/OrderBean.kt
deleted
100644 → 0
View file @
09291f32
package
com.sd.cavphmi.bean
/**{"id":"1935144643924385794","reserveOrderId":null,"orderNo":"20250618091651107821","vehicleId":"1700381241280815105","plateNo":"吉AC242","parkingLotId":"1589482925440901121","parkingLotName":"长春一汽园区内停车场","parkingLotSpaceId":null,"parkingLotSpaceCode":null,"userId":"1856265200534417410","userName":null,"appointmentEnterTime":null,"cancelBy":null,"cancelReason":null,"cancelTime":null,"avpStatus":6,"enterTime":"2025-06-18 09:16:51","outTime":null,"duration":5341,"durationString":"1小时29分钟","payTime":null,"payType":null,"orderStatus":20,"actualCost":12.0,"ifAppointEnd":0,"vehicleType":1,"payState":0,"parkImg":"","entranceId":"1589482929723285510","entranceLng":125.14179663,"entranceLat":43.83972200,"vehicleLng":125.14245358326262,"vehicleLat":43.838947467820994,"parkingPointId":null,"callPointId":null,"heading":149.77603}**/
data class
OrderBean
(
val
actualCost
:
Float
,
val
appointmentEnterTime
:
String
,
val
avpStatus
:
Int
,
val
callPointId
:
String
,
val
cancelBy
:
Any
,
val
cancelReason
:
Any
,
val
cancelTime
:
Any
,
val
duration
:
Int
,
val
durationString
:
String
,
val
enterTime
:
String
,
val
entranceId
:
String
,
val
entranceLat
:
Double
,
val
entranceLng
:
Double
,
val
heading
:
Double
,
val
id
:
String
,
val
ifAppointEnd
:
Int
,
val
orderNo
:
String
,
val
orderStatus
:
Int
,
val
outTime
:
Any
,
val
parkImg
:
String
,
val
parkingLotId
:
String
,
val
parkingLotName
:
String
,
val
parkingLotSpaceCode
:
String
,
val
parkingLotSpaceId
:
String
,
val
parkingPointId
:
String
,
val
payState
:
Int
,
val
payTime
:
Any
,
val
payType
:
Any
,
val
plateNo
:
String
,
val
reserveOrderId
:
String
,
val
userId
:
String
,
val
userName
:
Any
,
val
vehicleId
:
String
,
val
vehicleLat
:
Double
,
val
vehicleLng
:
Double
,
val
vehicleType
:
Int
)
\ No newline at end of file
app/src/main/java/com/sd/cavphmi/bean/ParkBean.kt
deleted
100644 → 0
View file @
09291f32
package
com.sd.cavphmi.bean
/***定车位变更
* {"centrePoint":"125.14337396,43.83873198","extendPoint":"125.14333880,43.83866747","callOrBackPoint":"125.1424934543.83896992","parkingSpace":"1D-001"}
* */
data class
ParkBean
(
val
callOrBackPoint
:
String
,
val
centrePoint
:
String
,
val
extendPoint
:
String
,
val
parkingSpace
:
String
)
\ No newline at end of file
app/src/main/java/com/sd/cavphmi/bean/PartLineBean.kt
deleted
100644 → 0
View file @
09291f32
package
com.sd.cavphmi.bean
/**局部路径***/
data class
PartLineBean
(
val
objectData
:
List
<
PartLine
>)
data class
PartLine
(
var
type
:
Int
,
var
pointStr
:
String
,
val
globalPath
:
List
<
List
<
Double
>>,
)
\ No newline at end of file
app/src/main/java/com/sd/cavphmi/bean/PerTarget.kt
View file @
0a5baef9
...
...
@@ -20,5 +20,5 @@ data class PData(
val
vid
:
String
,
val
vinfo
:
Any
,
val
vmodel
:
String
,
val
vtype
:
String
val
vtype
:
String
//pedestrian = 行人
)
\ No newline at end of file
app/src/main/java/com/sd/cavphmi/bean/RsiEventBean.kt
deleted
100644 → 0
View file @
09291f32
package
com.sd.cavphmi.bean
/***rsi事件**/
class
RsiEventBean
{
}
\ No newline at end of file
app/src/main/java/com/sd/cavphmi/bean/VehDetailBean.kt
0 → 100644
View file @
0a5baef9
package
com.sd.cavphmi.bean
/**车辆详情**/
data class
VehDetailBean
(
val
code
:
Int
,
val
msg
:
String
,
val
result
:
Result
,
val
success
:
Boolean
)
data class
Result
(
val
offlineCount
:
Int
,
val
onlineCount
:
Int
,
val
vehicleInfos
:
List
<
VehicleInfo
>
)
data class
VehicleInfo
(
val
online
:
Boolean
,
val
plateNumber
:
String
,
val
vehicleCode
:
String
,
val
vehicleId
:
Long
,
val
vehicleImgUrl
:
Any
,
val
vehicleOwnerName
:
Any
,
val
vehicleOwnerPhone
:
Any
,
val
vehicleVideoUrl
:
Any
)
\ No newline at end of file
app/src/main/java/com/sd/cavphmi/moudule/NetworkModule.kt
View file @
0a5baef9
...
...
@@ -63,8 +63,6 @@ object NetworkModule {
}
//------------------API 方法---------------
@Singleton
@Provides
fun
provideClientRetrofitService
(
@NormalInterceptorOkHttpClient
okHttpClient
:
OkHttpClient
):
ClientRetrofitMethod
{
...
...
@@ -72,7 +70,6 @@ object NetworkModule {
}
fun
getSSlSocketFactory
():
SslData
{
val
trustManagerFactory
:
TrustManagerFactory
=
TrustManagerFactory
.
getInstance
(
TrustManagerFactory
.
getDefaultAlgorithm
()
...
...
app/src/main/java/com/sd/cavphmi/net/HeadParamsInterceptor.kt
View file @
0a5baef9
package
com.sd.cavphmi.net
import
com.sd.cavphmi.utils.MyContants
import
okhttp3.Interceptor
import
okhttp3.Response
import
javax.inject.Inject
...
...
@@ -16,7 +17,10 @@ class HeadParamsInterceptor @Inject constructor() : Interceptor {
var
original
=
chain
.
request
()
// var path = original.url.encodedPath.substringAfterLast("/")
var
request
=
original
.
newBuilder
()
request
.
header
(
"Tenant-Id"
,
"1484465260508323841"
)
if
(
MyContants
.
HTTP_TOKEN
.
isNotEmpty
())
{
request
.
header
(
"token"
,
MyContants
.
HTTP_TOKEN
)
request
.
header
(
"Authorization"
,
MyContants
.
HTTP_TOKEN
)
}
return
chain
.
proceed
(
request
.
build
())
}
...
...
app/src/main/java/com/sd/cavphmi/net/OnDataBackService.kt
deleted
100644 → 0
View file @
09291f32
package
com.sd.cavphmi.net
abstract
class
OnDataBackService
<
T
>:
OnDataCallback
<
T
>
{
override
fun
onSubscribe
()
{
}
override
fun
onComplete
()
{
}
}
\ No newline at end of file
app/src/main/java/com/sd/cavphmi/net/OnDataCallback.kt
deleted
100644 → 0
View file @
09291f32
package
com.sd.cavphmi.net
interface
OnDataCallback
<
T
>
{
fun
onSubscribe
()
fun
onSuccess
(
t
:
T
)
fun
onFailed
(
error
:
String
)
fun
onComplete
()
fun
loginTimeout
()
}
\ No newline at end of file
app/src/main/java/com/sd/cavphmi/net/httpmothod/ClientRetrofitMethod.kt
View file @
0a5baef9
package
com.sd.cavphmi.net.httpmothod
import
com.sd.cavphmi.bean.LoginSuccBean
import
com.sd.cavphmi.bean.ParkLinePlan
import
com.sd.cavphmi.bean.OrderBean
import
com.sd.cavphmi.bean.SpaceNoBean
import
com.sd.cavphmi.bean.VehDetailBean
import
com.sd.cavphmi.net.MyBaseResource
import
okhttp3.RequestBody
import
retrofit2.http.Body
...
...
@@ -11,28 +12,35 @@ import retrofit2.http.POST
interface
ClientRetrofitMethod
{
/**
* 获取配置文件
*/
// @Headers("Cache-Control:public,max-age=3600")
// @GET("http://59.175.163.12/serv-addr/server.json")
// fun getConfigurations(): Observable<List<ConfigurationBean>>
//
/***查询车位信息***/
@POST
(
"hkapi/pms/v1/parkingSpace/spaceNo"
)
suspend
fun
getSpaceData
(
@Body
body
:
RequestBody
):
MyBaseResource
<
SpaceNoBean
>
/***车辆详情***/
// @POST("api/perm/admin/auth/passLogin")
// @POST("api/perm/admin/auth/passLogin")
@POST
(
"api/opr/login"
)
suspend
fun
login
(
@Body
body
:
RequestBody
):
LoginSuccBean
/***车辆详情***/
// @POST("v1/avp/overview/getVehicleInfo")
@POST
(
"api/avpweb/v1/avp/overview/getVehicleInfo"
)
suspend
fun
getVehDetail
(
@Body
body
:
RequestBody
):
VehDetailBean
// /***车辆详情***/
// @POST("/v1/avp/overview/listAvpStatus")
// suspend fun getVehDetail(@Body body: RequestBody): VehDetailBean
/***获取订单信息**/
@POST
(
"avp/avpMonitor/getOrderParkingInfoForPlate"
)
suspend
fun
getOrderData
(
@Body
body
:
RequestBody
):
OrderBean
/***获取网络质量**/
@POST
(
"avp/siteLine/getNetworkQuality"
)
suspend
fun
getTimeOut
():
Any
/***获取路径规划**/
@POST
(
"avp/linePlaning/get"
)
suspend
fun
getLinePlaning
(
@Body
body
:
RequestBody
):
ParkLinePlan
//
@POST("avp/avpMonitor/getOrderParkingInfoForPlate")
//
suspend fun getOrderData(@Body body: RequestBody): OrderBean
//
//
/***获取网络质量**/
//
@POST("avp/siteLine/getNetworkQuality")
//
suspend fun getTimeOut(): Any
//
//
/***获取路径规划**/
//
@POST("avp/linePlaning/get")
//
suspend fun getLinePlaning(@Body body: RequestBody): ParkLinePlan
/**
...
...
app/src/main/java/com/sd/cavphmi/repositorys/AvpDataRepo.kt
0 → 100644
View file @
0a5baef9
package
com.sd.cavphmi.repositorys
import
com.sd.cavphmi.bean.VehDetailBean
import
com.sd.cavphmi.net.MyResult
import
com.sd.cavphmi.net.RequestBodyUtil
import
com.sd.cavphmi.net.httpmothod.ClientRetrofitMethod
import
com.sd.cavphmi.utils.MyContants
import
retrofit2.HttpException
import
javax.inject.Inject
/***AVP 接口**/
class
AvpDataRepo
@Inject
constructor
(
private
var
clientRetrofitMethod
:
ClientRetrofitMethod
)
{
/***获取车辆详情
* @param id 车辆id
* **/
suspend
fun
getVehDetail
(
id
:
String
=
"1"
):
MyResult
<
VehDetailBean
>
{
if
(
id
.
isNullOrEmpty
())
{
return
MyResult
.
Error
(
MyContants
.
HTTP_ERROR
,
"error"
)
}
// if (!orderCalled.getAndSet(true)) {
var
map
=
mapOf
(
"id"
to
id
)
var
body
=
RequestBodyUtil
.
toRequestBody
(
map
)
try
{
var
bean
=
clientRetrofitMethod
.
getVehDetail
(
body
)
return
MyResult
.
Success
(
bean
)
}
catch
(
e
:
HttpException
)
{
// println("e.message = ${e.message}")
return
MyResult
.
Error
(
e
.
code
(),
e
.
message
()
?:
"error"
)
}
catch
(
e
:
Exception
)
{
return
MyResult
.
Error
(
MyContants
.
HTTP_ERROR
,
e
.
message
?:
"error"
)
}
// } else {
// return MyResult.Error(MyContants.ALREADT_ONCE, "")
// }
}
suspend
fun
login
(
user
:
String
,
pwd
:
String
,
verifyCode
:
Int
):
MyResult
<
String
>
{
// if (id.isNullOrEmpty()) {
// return MyResult.Error(MyContants.HTTP_ERROR, "error")
// }
var
map
=
mapOf
(
"userAccount"
to
user
,
"password"
to
pwd
,
"verificationCode"
to
verifyCode
)
var
body
=
RequestBodyUtil
.
toRequestBody
(
map
)
try
{
var
bean
=
clientRetrofitMethod
.
login
(
body
)
return
MyResult
.
Success
(
bean
.
token
)
}
catch
(
e
:
HttpException
)
{
// println("e.message = ${e.message}")
return
MyResult
.
Error
(
e
.
code
(),
e
.
message
()
?:
"error"
)
}
catch
(
e
:
Exception
)
{
return
MyResult
.
Error
(
MyContants
.
HTTP_ERROR
,
e
.
message
?:
"error"
)
}
}
}
\ No newline at end of file
Prev
1
2
3
Next
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment