[8.4.0] 司机屏无人化所有功能(除更改成D6任务相关)
This commit is contained in:
@@ -51,6 +51,7 @@ import kotlinx.android.synthetic.main.biz_login_view.biz_cl_driver_main
|
|||||||
import kotlinx.android.synthetic.main.biz_login_view.biz_login_svp
|
import kotlinx.android.synthetic.main.biz_login_view.biz_login_svp
|
||||||
import kotlinx.android.synthetic.main.biz_login_view.bv_switch_business
|
import kotlinx.android.synthetic.main.biz_login_view.bv_switch_business
|
||||||
import kotlinx.android.synthetic.main.biz_login_view.cl_login_info
|
import kotlinx.android.synthetic.main.biz_login_view.cl_login_info
|
||||||
|
import kotlinx.android.synthetic.main.biz_login_view.cl_welcome_info
|
||||||
import kotlinx.android.synthetic.main.biz_login_view.eiv_Info
|
import kotlinx.android.synthetic.main.biz_login_view.eiv_Info
|
||||||
import kotlinx.android.synthetic.main.biz_login_view.viewColdStart
|
import kotlinx.android.synthetic.main.biz_login_view.viewColdStart
|
||||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||||
@@ -67,6 +68,9 @@ class LoginFragment : MvpFragment<LoginFragment?, LoginPresenter?>(), ILoginView
|
|||||||
private var showLoginInfoAnimator1: ObjectAnimator? = null
|
private var showLoginInfoAnimator1: ObjectAnimator? = null
|
||||||
private var showLoginInfoAnimator2: ObjectAnimator? = null
|
private var showLoginInfoAnimator2: ObjectAnimator? = null
|
||||||
|
|
||||||
|
private var showLoginInfoAnimator11: ObjectAnimator? = null
|
||||||
|
private var showLoginInfoAnimator22: ObjectAnimator? = null
|
||||||
|
|
||||||
private var onlayoutListener: OnGlobalLayoutListener? = object : OnGlobalLayoutListener {
|
private var onlayoutListener: OnGlobalLayoutListener? = object : OnGlobalLayoutListener {
|
||||||
override fun onGlobalLayout() {
|
override fun onGlobalLayout() {
|
||||||
try {
|
try {
|
||||||
@@ -287,7 +291,10 @@ class LoginFragment : MvpFragment<LoginFragment?, LoginPresenter?>(), ILoginView
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (AppIdentityModeUtils.getCockpitType() == CockpitType.UNMANNED) {
|
if (AppIdentityModeUtils.getCockpitType() == CockpitType.UNMANNED) {
|
||||||
|
cl_welcome_info?.visibility = View.VISIBLE
|
||||||
|
UiThreadHandler.postDelayed({
|
||||||
mPresenter?.autoLogin()
|
mPresenter?.autoLogin()
|
||||||
|
}, 2_000, UiThreadHandler.MODE.QUEUE)
|
||||||
} else {
|
} else {
|
||||||
cl_login_info?.visibility = View.VISIBLE
|
cl_login_info?.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
@@ -314,6 +321,47 @@ class LoginFragment : MvpFragment<LoginFragment?, LoginPresenter?>(), ILoginView
|
|||||||
|
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
if (AppIdentityModeUtils.getCockpitType() == CockpitType.UNMANNED) {
|
||||||
|
if (showLoginInfoAnimator11 == null) {
|
||||||
|
showLoginInfoAnimator11 = ObjectAnimator.ofFloat(cl_welcome_info, "alpha", 0f, 1f)
|
||||||
|
showLoginInfoAnimator11?.interpolator = LinearInterpolator()
|
||||||
|
}
|
||||||
|
if (showLoginInfoAnimator22 == null) {
|
||||||
|
val dp2px = AutoSizeUtils.dp2px(AbsMogoApplication.getApp(), -50f)
|
||||||
|
showLoginInfoAnimator22 = ObjectAnimator.ofFloat(cl_welcome_info, "translationY", 0f, dp2px.toFloat())
|
||||||
|
showLoginInfoAnimator22?.interpolator = DecelerateInterpolator()
|
||||||
|
}
|
||||||
|
UiThreadHandler.postDelayed({
|
||||||
|
cl_welcome_info?.let {
|
||||||
|
val animatorSet = AnimatorSet()
|
||||||
|
animatorSet.playTogether(showLoginInfoAnimator11, showLoginInfoAnimator22)
|
||||||
|
animatorSet.duration = 500
|
||||||
|
animatorSet.addListener(object : AnimatorListener {
|
||||||
|
override fun onAnimationStart(animation: Animator) {
|
||||||
|
cl_welcome_info?.visibility = View.VISIBLE
|
||||||
|
UiThreadHandler.postDelayed({
|
||||||
|
mPresenter?.autoLogin()
|
||||||
|
}, 4_000, UiThreadHandler.MODE.QUEUE)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAnimationEnd(animation: Animator) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAnimationCancel(animation: Animator) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onAnimationRepeat(animation: Animator) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
animatorSet.start()
|
||||||
|
}
|
||||||
|
}, 1_000, UiThreadHandler.MODE.QUEUE)
|
||||||
|
} else {
|
||||||
if (showLoginInfoAnimator1 == null) {
|
if (showLoginInfoAnimator1 == null) {
|
||||||
showLoginInfoAnimator1 = ObjectAnimator.ofFloat(cl_login_info, "alpha", 0f, 1f)
|
showLoginInfoAnimator1 = ObjectAnimator.ofFloat(cl_login_info, "alpha", 0f, 1f)
|
||||||
showLoginInfoAnimator1?.interpolator = LinearInterpolator()
|
showLoginInfoAnimator1?.interpolator = LinearInterpolator()
|
||||||
@@ -330,12 +378,8 @@ class LoginFragment : MvpFragment<LoginFragment?, LoginPresenter?>(), ILoginView
|
|||||||
animatorSet.duration = 500
|
animatorSet.duration = 500
|
||||||
animatorSet.addListener(object :AnimatorListener{
|
animatorSet.addListener(object :AnimatorListener{
|
||||||
override fun onAnimationStart(animation: Animator) {
|
override fun onAnimationStart(animation: Animator) {
|
||||||
if (AppIdentityModeUtils.getCockpitType() == CockpitType.UNMANNED) {
|
|
||||||
mPresenter?.autoLogin()
|
|
||||||
} else {
|
|
||||||
cl_login_info?.visibility = View.VISIBLE
|
cl_login_info?.visibility = View.VISIBLE
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
override fun onAnimationEnd(animation: Animator) {
|
override fun onAnimationEnd(animation: Animator) {
|
||||||
|
|
||||||
@@ -353,6 +397,7 @@ class LoginFragment : MvpFragment<LoginFragment?, LoginPresenter?>(), ILoginView
|
|||||||
animatorSet.start()
|
animatorSet.start()
|
||||||
}
|
}
|
||||||
},2_000,UiThreadHandler.MODE.QUEUE)
|
},2_000,UiThreadHandler.MODE.QUEUE)
|
||||||
|
}
|
||||||
biz_login_svp?.startPlayLogic()
|
biz_login_svp?.startPlayLogic()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,31 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent" />
|
app:layout_constraintTop_toTopOf="parent" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/cl_welcome_info"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="@dimen/dp_166"
|
||||||
|
android:layout_marginTop="@dimen/dp_700"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="@dimen/dp_444"
|
||||||
|
android:layout_height="@dimen/dp_98"
|
||||||
|
android:text="@string/login_welcome_on"
|
||||||
|
android:textColor="#FF394047"
|
||||||
|
android:textSize="@dimen/sp_70" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="@dimen/dp_10"
|
||||||
|
android:src="@drawable/biz_login_robobus" />
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
<androidx.constraintlayout.widget.ConstraintLayout
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/cl_login_info"
|
android:id="@+id/cl_login_info"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
|||||||
@@ -57,6 +57,7 @@ class OchCommonConst {
|
|||||||
const val SHUTTLE_DRIVER_WEAKNET = "/shuttledriver_weaknet/shuttledriver"
|
const val SHUTTLE_DRIVER_WEAKNET = "/shuttledriver_weaknet/shuttledriver"
|
||||||
const val SHUTTLE_PASSENGER_WEAKNET = "/shuttlepassenger_weaknet/shuttlepassenger"
|
const val SHUTTLE_PASSENGER_WEAKNET = "/shuttlepassenger_weaknet/shuttlepassenger"
|
||||||
|
|
||||||
|
const val SHUTTLE_DRIVER_UNMANNED = "/shuttledriver_unmanned/shuttledriver"
|
||||||
|
|
||||||
const val SWEEPER_DRIVER = "/sweeper/sweeperdriver"
|
const val SWEEPER_DRIVER = "/sweeper/sweeperdriver"
|
||||||
|
|
||||||
|
|||||||
@@ -95,7 +95,7 @@ object AbnormalFactorsLoopManager : IMogoStatusChangedListener {
|
|||||||
|
|
||||||
if (!FunctionBuildConfig.isDemoMode && toastStr !== "") {
|
if (!FunctionBuildConfig.isDemoMode && toastStr !== "") {
|
||||||
// ToastCharterUtils.showToastLong(toastStr + "请开启相应权限或者查看网络")
|
// ToastCharterUtils.showToastLong(toastStr + "请开启相应权限或者查看网络")
|
||||||
ToastCharterUtils.showToastLong(R.string.module_och_please_open_permission, toastStr)
|
ToastCharterUtils.showToastLong(toastStr + StringUtils.getString(R.string.module_och_please_open_permission))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import android.view.View
|
|||||||
import com.mogo.eagle.core.function.api.och.IOchBizFunctionCall4Eagle
|
import com.mogo.eagle.core.function.api.och.IOchBizFunctionCall4Eagle
|
||||||
import com.mogo.eagle.core.function.call.base.CallerBase
|
import com.mogo.eagle.core.function.call.base.CallerBase
|
||||||
import com.mogo.eagle.core.function.call.och.CallerOchBizFunctionCall4EagleManager
|
import com.mogo.eagle.core.function.call.och.CallerOchBizFunctionCall4EagleManager
|
||||||
|
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||||
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||||
|
|
||||||
object OchTransform : CallerBase<OchTransformDispatch>(), IOchBizFunctionCall4Eagle {
|
object OchTransform : CallerBase<OchTransformDispatch>(), IOchBizFunctionCall4Eagle {
|
||||||
@@ -19,6 +20,10 @@ object OchTransform : CallerBase<OchTransformDispatch>(), IOchBizFunctionCall4Ea
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun isLogin(): Boolean {
|
||||||
|
return LoginStatusManager.isLogin()
|
||||||
|
}
|
||||||
|
|
||||||
override fun setVideoView(target: View?) {
|
override fun setVideoView(target: View?) {
|
||||||
OchChainLogManager.writeChainLogEye("鹰眼调用och","展示司机端视频流:${target}")
|
OchChainLogManager.writeChainLogEye("鹰眼调用och","展示司机端视频流:${target}")
|
||||||
M_LISTENERS.forEach {
|
M_LISTENERS.forEach {
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ project.dependencies {
|
|||||||
implementation project.project(':OCH:offline:driver')
|
implementation project.project(':OCH:offline:driver')
|
||||||
implementation project.project(':OCH:sweeper:driver')
|
implementation project.project(':OCH:sweeper:driver')
|
||||||
implementation project.project(':OCH:shuttle:driver_weaknet')
|
implementation project.project(':OCH:shuttle:driver_weaknet')
|
||||||
|
implementation project.project(':OCH:shuttle:driver_unmanned')
|
||||||
implementation project.project(':OCH:charter:driver')
|
implementation project.project(':OCH:charter:driver')
|
||||||
implementation project.project(':OCH:taxi:unmanned-driver')
|
implementation project.project(':OCH:taxi:unmanned-driver')
|
||||||
}else if(isPassenger()){
|
}else if(isPassenger()){
|
||||||
@@ -17,6 +18,7 @@ project.dependencies {
|
|||||||
// }else if(isBaiLing()){
|
// }else if(isBaiLing()){
|
||||||
// implementation project.project(':OCH:offline:driver')
|
// implementation project.project(':OCH:offline:driver')
|
||||||
// implementation project.project(':OCH:shuttle:driver_weaknet')
|
// implementation project.project(':OCH:shuttle:driver_weaknet')
|
||||||
|
// implementation project.project(':OCH:shuttle:driver_unmanned')
|
||||||
// implementation project.project(':OCH:shuttle:passenger_weaknet')
|
// implementation project.project(':OCH:shuttle:passenger_weaknet')
|
||||||
// implementation project.project(':OCH:charter:driver')
|
// implementation project.project(':OCH:charter:driver')
|
||||||
// implementation project.project(':OCH:charter:passenger')
|
// implementation project.project(':OCH:charter:passenger')
|
||||||
@@ -26,6 +28,7 @@ project.dependencies {
|
|||||||
}else {
|
}else {
|
||||||
implementation project.project(':OCH:offline:driver')
|
implementation project.project(':OCH:offline:driver')
|
||||||
implementation project.project(':OCH:shuttle:driver_weaknet')
|
implementation project.project(':OCH:shuttle:driver_weaknet')
|
||||||
|
implementation project.project(':OCH:shuttle:driver_unmanned')
|
||||||
implementation project.project(':OCH:shuttle:passenger_weaknet')
|
implementation project.project(':OCH:shuttle:passenger_weaknet')
|
||||||
implementation project.project(':OCH:charter:driver')
|
implementation project.project(':OCH:charter:driver')
|
||||||
implementation project.project(':OCH:charter:passenger')
|
implementation project.project(':OCH:charter:passenger')
|
||||||
|
|||||||
@@ -117,7 +117,12 @@ abstract class FacadeProvider : IMoGoFunctionProvider, ILoginCallback {
|
|||||||
||AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)
|
||AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)
|
||||||
||AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)) {
|
||AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)) {
|
||||||
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
|
||||||
return getFragmentByServeName(OchCommonConst.SHUTTLE_DRIVER_WEAKNET)
|
return getFragmentByServeName(if (AppIdentityModeUtils.getCockpitType() == CockpitType.UNMANNED) {
|
||||||
|
OchCommonConst.SHUTTLE_DRIVER_UNMANNED
|
||||||
|
} else {
|
||||||
|
OchCommonConst.SHUTTLE_DRIVER_WEAKNET
|
||||||
|
})
|
||||||
|
// return getFragmentByServeName(OchCommonConst.SHUTTLE_DRIVER_WEAKNET)
|
||||||
}else if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)){
|
}else if (AppIdentityModeUtils.isPassenger(FunctionBuildConfig.appIdentityMode)){
|
||||||
return getFragmentByServeName(OchCommonConst.SHUTTLE_PASSENGER_WEAKNET)
|
return getFragmentByServeName(OchCommonConst.SHUTTLE_PASSENGER_WEAKNET)
|
||||||
}
|
}
|
||||||
@@ -212,7 +217,11 @@ abstract class FacadeProvider : IMoGoFunctionProvider, ILoginCallback {
|
|||||||
statusBarView.tag = "status_bar"
|
statusBarView.tag = "status_bar"
|
||||||
val statusBarLP = FrameLayout.LayoutParams(
|
val statusBarLP = FrameLayout.LayoutParams(
|
||||||
ViewGroup.LayoutParams.MATCH_PARENT,
|
ViewGroup.LayoutParams.MATCH_PARENT,
|
||||||
AutoSizeUtils.dp2px(it, 67.0f),
|
if (AppIdentityModeUtils.getCockpitType() == CockpitType.UNMANNED) {
|
||||||
|
AutoSizeUtils.dp2px(it, 108.0f)
|
||||||
|
} else {
|
||||||
|
AutoSizeUtils.dp2px(it, 67.0f)
|
||||||
|
},
|
||||||
)
|
)
|
||||||
statusBarLP.topMargin = 0
|
statusBarLP.topMargin = 0
|
||||||
statusBarLP.gravity = Gravity.TOP
|
statusBarLP.gravity = Gravity.TOP
|
||||||
|
|||||||
1
OCH/shuttle/driver_unmanned/.gitignore
vendored
Normal file
1
OCH/shuttle/driver_unmanned/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
|||||||
|
/build
|
||||||
79
OCH/shuttle/driver_unmanned/build.gradle
Normal file
79
OCH/shuttle/driver_unmanned/build.gradle
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
apply plugin: 'com.android.library'
|
||||||
|
apply plugin: 'kotlin-android'
|
||||||
|
apply plugin: 'kotlin-android-extensions'
|
||||||
|
apply plugin: 'kotlin-kapt'
|
||||||
|
|
||||||
|
android {
|
||||||
|
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||||
|
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||||
|
defaultConfig {
|
||||||
|
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||||
|
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||||
|
versionCode Integer.valueOf(VERSION_CODE)
|
||||||
|
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||||
|
|
||||||
|
|
||||||
|
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||||
|
consumerProguardFiles "consumer-rules.pro"
|
||||||
|
|
||||||
|
kapt {
|
||||||
|
useBuildCache = false
|
||||||
|
arguments {
|
||||||
|
arg("AROUTER_MODULE_NAME", "shuttle_unmanned_"+project.getName())
|
||||||
|
arg("room.schemaLocation", "$projectDir/schemas".toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
compileOptions {
|
||||||
|
sourceCompatibility JavaVersion.VERSION_1_8
|
||||||
|
targetCompatibility JavaVersion.VERSION_1_8
|
||||||
|
}
|
||||||
|
|
||||||
|
lintOptions {
|
||||||
|
abortOnError false
|
||||||
|
}
|
||||||
|
|
||||||
|
buildTypes {
|
||||||
|
release {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
debug {
|
||||||
|
minifyEnabled false
|
||||||
|
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
dependencies {
|
||||||
|
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||||
|
implementation project(':OCH:common:bridge')
|
||||||
|
|
||||||
|
testImplementation 'junit:junit:4.12'
|
||||||
|
|
||||||
|
implementation rootProject.ext.dependencies.kotlinstdlib
|
||||||
|
implementation rootProject.ext.dependencies.androidxappcompat
|
||||||
|
implementation rootProject.ext.dependencies.arouter
|
||||||
|
kapt rootProject.ext.dependencies.aroutercompiler
|
||||||
|
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||||
|
implementation rootProject.ext.dependencies.amapnavi3dmap
|
||||||
|
|
||||||
|
implementation rootProject.ext.dependencies.rxjava
|
||||||
|
implementation rootProject.ext.dependencies.rxandroid
|
||||||
|
implementation rootProject.ext.dependencies.androidxrecyclerview
|
||||||
|
kapt rootProject.ext.dependencies.recyclerviewadapterhelper
|
||||||
|
|
||||||
|
implementation rootProject.ext.dependencies.roomRxjava
|
||||||
|
implementation rootProject.ext.dependencies.androidxroomruntime
|
||||||
|
kapt rootProject.ext.dependencies.androidxroomcompiler
|
||||||
|
|
||||||
|
|
||||||
|
implementation project(":OCH:common:common")
|
||||||
|
implementation project(":OCH:common:data")
|
||||||
|
compileOnly project(":libraries:mogo-map")
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||||
0
OCH/shuttle/driver_unmanned/consumer-rules.pro
Normal file
0
OCH/shuttle/driver_unmanned/consumer-rules.pro
Normal file
3
OCH/shuttle/driver_unmanned/gradle.properties
Normal file
3
OCH/shuttle/driver_unmanned/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
|||||||
|
GROUP=com.mogo.och
|
||||||
|
POM_ARTIFACT_ID=och-bus
|
||||||
|
VERSION_CODE=1
|
||||||
21
OCH/shuttle/driver_unmanned/proguard-rules.pro
vendored
Normal file
21
OCH/shuttle/driver_unmanned/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
# Add project specific ProGuard rules here.
|
||||||
|
# You can control the set of applied configuration files using the
|
||||||
|
# proguardFiles setting in build.gradle.
|
||||||
|
#
|
||||||
|
# For more details, see
|
||||||
|
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||||
|
|
||||||
|
# If your project uses WebView with JS, uncomment the following
|
||||||
|
# and specify the fully qualified class name to the JavaScript interface
|
||||||
|
# class:
|
||||||
|
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||||
|
# public *;
|
||||||
|
#}
|
||||||
|
|
||||||
|
# Uncomment this to preserve the line number information for
|
||||||
|
# debugging stack traces.
|
||||||
|
#-keepattributes SourceFile,LineNumberTable
|
||||||
|
|
||||||
|
# If you keep the line number information, uncomment this to
|
||||||
|
# hide the original source file name.
|
||||||
|
#-renamesourcefileattribute SourceFile
|
||||||
@@ -0,0 +1,589 @@
|
|||||||
|
{
|
||||||
|
"formatVersion": 1,
|
||||||
|
"database": {
|
||||||
|
"version": 2,
|
||||||
|
"identityHash": "2b20934a560960930f10ae5c581cbcec",
|
||||||
|
"entities": [
|
||||||
|
{
|
||||||
|
"tableName": "contrail_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `csv_file_url` TEXT, `csv_file_md5` TEXT, `txt_file_url` TEXT, `txt_file_md5` TEXT, `contrail_save_time` INTEGER, `md5` TEXT)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "csvFileUrl",
|
||||||
|
"columnName": "csv_file_url",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "csvFileMd5",
|
||||||
|
"columnName": "csv_file_md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "txtFileUrl",
|
||||||
|
"columnName": "txt_file_url",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "txtFileMd5",
|
||||||
|
"columnName": "txt_file_md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "contrailSaveTime",
|
||||||
|
"columnName": "contrail_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "md5",
|
||||||
|
"columnName": "md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_contrail_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_contrail_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index_contrail_data_table_md5",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"md5"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_contrail_data_table_md5` ON `${TABLE_NAME}` (`md5`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "line_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `line_name` TEXT, `end_station_name` TEXT, `line_get_time` INTEGER NOT NULL)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineName",
|
||||||
|
"columnName": "line_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "endStationName",
|
||||||
|
"columnName": "end_station_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "linegetTime",
|
||||||
|
"columnName": "line_get_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_line_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_line_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "site_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `site_id` INTEGER, `line_id` INTEGER, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `introduction` TEXT, `is_play_tts` INTEGER, `md5` TEXT, `videoList` TEXT)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "name",
|
||||||
|
"columnName": "name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "nameKr",
|
||||||
|
"columnName": "name_kr",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "seq",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLon",
|
||||||
|
"columnName": "gcj_lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLat",
|
||||||
|
"columnName": "gcj_lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lon",
|
||||||
|
"columnName": "lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lat",
|
||||||
|
"columnName": "lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "introduction",
|
||||||
|
"columnName": "introduction",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "isPlayTts",
|
||||||
|
"columnName": "is_play_tts",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "md5",
|
||||||
|
"columnName": "md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "videoListDB",
|
||||||
|
"columnName": "videoList",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_site_data_table_site_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"site_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_site_data_table_site_id` ON `${TABLE_NAME}` (`site_id`)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index_site_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_site_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "task_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `task_id` INTEGER, `line_id` INTEGER, `task_data` INTEGER, `task_start_time` INTEGER, `start_time` INTEGER, `end_time` INTEGER, `task_get_time` INTEGER NOT NULL, `status` INTEGER)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskDate",
|
||||||
|
"columnName": "task_data",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskStartTime",
|
||||||
|
"columnName": "task_start_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "startTime",
|
||||||
|
"columnName": "start_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "endtime",
|
||||||
|
"columnName": "end_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskgetTime",
|
||||||
|
"columnName": "task_get_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "status",
|
||||||
|
"columnName": "status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_task_data_table_task_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"task_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_task_data_table_task_id` ON `${TABLE_NAME}` (`task_id`)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index_task_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_task_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "used_task_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `task_id` INTEGER, `line_id` INTEGER, `site_id` INTEGER, `line_name` TEXT, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `driving_status` INTEGER, `leaving` INTEGER, `arrived_time` INTEGER, `leave_time` INTEGER, `introduction` TEXT, `is_play_tts` INTEGER, `event_save_time` INTEGER NOT NULL, `videoList` TEXT)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineName",
|
||||||
|
"columnName": "line_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "name",
|
||||||
|
"columnName": "name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "nameKr",
|
||||||
|
"columnName": "name_kr",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "seq",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLon",
|
||||||
|
"columnName": "gcj_lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLat",
|
||||||
|
"columnName": "gcj_lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lon",
|
||||||
|
"columnName": "lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lat",
|
||||||
|
"columnName": "lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "drivingStatus",
|
||||||
|
"columnName": "driving_status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "leaving",
|
||||||
|
"columnName": "leaving",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "arrivedTime",
|
||||||
|
"columnName": "arrived_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "leaveTime",
|
||||||
|
"columnName": "leave_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "introduction",
|
||||||
|
"columnName": "introduction",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "isPlayTts",
|
||||||
|
"columnName": "is_play_tts",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventSaveTime",
|
||||||
|
"columnName": "event_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "videoList",
|
||||||
|
"columnName": "videoList",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "event_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `event_type` TEXT, `lineId` INTEGER, `lineName` TEXT, `task_id` INTEGER, `task_start_time` INTEGER, `business_time` INTEGER, `write_version` INTEGER, `site_id` INTEGER, `seq` INTEGER, `driver_id` INTEGER, `event_save_time` INTEGER NOT NULL, `update_status` INTEGER NOT NULL)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventType",
|
||||||
|
"columnName": "event_type",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "lineId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineName",
|
||||||
|
"columnName": "lineName",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskStartTime",
|
||||||
|
"columnName": "task_start_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "businessTime",
|
||||||
|
"columnName": "business_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "writeVersion",
|
||||||
|
"columnName": "write_version",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "seq",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "driverId",
|
||||||
|
"columnName": "driver_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventSaveTime",
|
||||||
|
"columnName": "event_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "updateStatus",
|
||||||
|
"columnName": "update_status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_event_data_table_event_save_time",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"event_save_time"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_event_data_table_event_save_time` ON `${TABLE_NAME}` (`event_save_time`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"views": [],
|
||||||
|
"setupQueries": [
|
||||||
|
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||||
|
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '2b20934a560960930f10ae5c581cbcec')"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,589 @@
|
|||||||
|
{
|
||||||
|
"formatVersion": 1,
|
||||||
|
"database": {
|
||||||
|
"version": 3,
|
||||||
|
"identityHash": "2b20934a560960930f10ae5c581cbcec",
|
||||||
|
"entities": [
|
||||||
|
{
|
||||||
|
"tableName": "contrail_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `csv_file_url` TEXT, `csv_file_md5` TEXT, `txt_file_url` TEXT, `txt_file_md5` TEXT, `contrail_save_time` INTEGER, `md5` TEXT)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "csvFileUrl",
|
||||||
|
"columnName": "csv_file_url",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "csvFileMd5",
|
||||||
|
"columnName": "csv_file_md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "txtFileUrl",
|
||||||
|
"columnName": "txt_file_url",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "txtFileMd5",
|
||||||
|
"columnName": "txt_file_md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "contrailSaveTime",
|
||||||
|
"columnName": "contrail_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "md5",
|
||||||
|
"columnName": "md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_contrail_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_contrail_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index_contrail_data_table_md5",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"md5"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_contrail_data_table_md5` ON `${TABLE_NAME}` (`md5`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "line_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `line_name` TEXT, `end_station_name` TEXT, `line_get_time` INTEGER NOT NULL)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineName",
|
||||||
|
"columnName": "line_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "endStationName",
|
||||||
|
"columnName": "end_station_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "linegetTime",
|
||||||
|
"columnName": "line_get_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_line_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_line_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "site_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `site_id` INTEGER, `line_id` INTEGER, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `introduction` TEXT, `is_play_tts` INTEGER, `md5` TEXT, `videoList` TEXT)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "name",
|
||||||
|
"columnName": "name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "nameKr",
|
||||||
|
"columnName": "name_kr",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "seq",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLon",
|
||||||
|
"columnName": "gcj_lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLat",
|
||||||
|
"columnName": "gcj_lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lon",
|
||||||
|
"columnName": "lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lat",
|
||||||
|
"columnName": "lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "introduction",
|
||||||
|
"columnName": "introduction",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "isPlayTts",
|
||||||
|
"columnName": "is_play_tts",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "md5",
|
||||||
|
"columnName": "md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "videoListDB",
|
||||||
|
"columnName": "videoList",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_site_data_table_site_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"site_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_site_data_table_site_id` ON `${TABLE_NAME}` (`site_id`)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index_site_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_site_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "task_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `task_id` INTEGER, `line_id` INTEGER, `task_data` INTEGER, `task_start_time` INTEGER, `start_time` INTEGER, `end_time` INTEGER, `task_get_time` INTEGER NOT NULL, `status` INTEGER)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskDate",
|
||||||
|
"columnName": "task_data",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskStartTime",
|
||||||
|
"columnName": "task_start_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "startTime",
|
||||||
|
"columnName": "start_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "endtime",
|
||||||
|
"columnName": "end_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskgetTime",
|
||||||
|
"columnName": "task_get_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "status",
|
||||||
|
"columnName": "status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_task_data_table_task_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"task_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_task_data_table_task_id` ON `${TABLE_NAME}` (`task_id`)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index_task_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_task_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "used_task_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `task_id` INTEGER, `line_id` INTEGER, `site_id` INTEGER, `line_name` TEXT, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `driving_status` INTEGER, `leaving` INTEGER, `arrived_time` INTEGER, `leave_time` INTEGER, `introduction` TEXT, `is_play_tts` INTEGER, `event_save_time` INTEGER NOT NULL, `videoList` TEXT)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineName",
|
||||||
|
"columnName": "line_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "name",
|
||||||
|
"columnName": "name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "nameKr",
|
||||||
|
"columnName": "name_kr",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "seq",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLon",
|
||||||
|
"columnName": "gcj_lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLat",
|
||||||
|
"columnName": "gcj_lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lon",
|
||||||
|
"columnName": "lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lat",
|
||||||
|
"columnName": "lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "drivingStatus",
|
||||||
|
"columnName": "driving_status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "leaving",
|
||||||
|
"columnName": "leaving",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "arrivedTime",
|
||||||
|
"columnName": "arrived_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "leaveTime",
|
||||||
|
"columnName": "leave_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "introduction",
|
||||||
|
"columnName": "introduction",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "isPlayTts",
|
||||||
|
"columnName": "is_play_tts",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventSaveTime",
|
||||||
|
"columnName": "event_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "videoList",
|
||||||
|
"columnName": "videoList",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "event_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `event_type` TEXT, `lineId` INTEGER, `lineName` TEXT, `task_id` INTEGER, `task_start_time` INTEGER, `business_time` INTEGER, `write_version` INTEGER, `site_id` INTEGER, `seq` INTEGER, `driver_id` INTEGER, `event_save_time` INTEGER NOT NULL, `update_status` INTEGER NOT NULL)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventType",
|
||||||
|
"columnName": "event_type",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "lineId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineName",
|
||||||
|
"columnName": "lineName",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskStartTime",
|
||||||
|
"columnName": "task_start_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "businessTime",
|
||||||
|
"columnName": "business_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "writeVersion",
|
||||||
|
"columnName": "write_version",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "seq",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "driverId",
|
||||||
|
"columnName": "driver_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventSaveTime",
|
||||||
|
"columnName": "event_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "updateStatus",
|
||||||
|
"columnName": "update_status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_event_data_table_event_save_time",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"event_save_time"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_event_data_table_event_save_time` ON `${TABLE_NAME}` (`event_save_time`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"views": [],
|
||||||
|
"setupQueries": [
|
||||||
|
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||||
|
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '2b20934a560960930f10ae5c581cbcec')"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,601 @@
|
|||||||
|
{
|
||||||
|
"formatVersion": 1,
|
||||||
|
"database": {
|
||||||
|
"version": 4,
|
||||||
|
"identityHash": "1d1bd5c3b1770e4bc24252f26791f036",
|
||||||
|
"entities": [
|
||||||
|
{
|
||||||
|
"tableName": "contrail_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `csv_file_url` TEXT, `csv_file_md5` TEXT, `txt_file_url` TEXT, `txt_file_md5` TEXT, `contrail_save_time` INTEGER, `md5` TEXT)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "csvFileUrl",
|
||||||
|
"columnName": "csv_file_url",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "csvFileMd5",
|
||||||
|
"columnName": "csv_file_md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "txtFileUrl",
|
||||||
|
"columnName": "txt_file_url",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "txtFileMd5",
|
||||||
|
"columnName": "txt_file_md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "contrailSaveTime",
|
||||||
|
"columnName": "contrail_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "md5",
|
||||||
|
"columnName": "md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_contrail_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_contrail_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index_contrail_data_table_md5",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"md5"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_contrail_data_table_md5` ON `${TABLE_NAME}` (`md5`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "line_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `line_name` TEXT, `end_station_name` TEXT, `line_get_time` INTEGER NOT NULL)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineName",
|
||||||
|
"columnName": "line_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "endStationName",
|
||||||
|
"columnName": "end_station_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "linegetTime",
|
||||||
|
"columnName": "line_get_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_line_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_line_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "site_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `site_id` INTEGER, `line_id` INTEGER, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `introduction` TEXT, `is_play_tts` INTEGER, `md5` TEXT, `videoList` TEXT)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "name",
|
||||||
|
"columnName": "name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "nameKr",
|
||||||
|
"columnName": "name_kr",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "seq",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLon",
|
||||||
|
"columnName": "gcj_lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLat",
|
||||||
|
"columnName": "gcj_lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lon",
|
||||||
|
"columnName": "lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lat",
|
||||||
|
"columnName": "lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "introduction",
|
||||||
|
"columnName": "introduction",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "isPlayTts",
|
||||||
|
"columnName": "is_play_tts",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "md5",
|
||||||
|
"columnName": "md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "videoListDB",
|
||||||
|
"columnName": "videoList",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_site_data_table_site_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"site_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_site_data_table_site_id` ON `${TABLE_NAME}` (`site_id`)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index_site_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_site_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "task_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `task_id` INTEGER, `line_id` INTEGER, `task_data` INTEGER, `task_start_time` INTEGER, `start_time` INTEGER, `end_time` INTEGER, `task_get_time` INTEGER NOT NULL, `status` INTEGER)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskDate",
|
||||||
|
"columnName": "task_data",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskStartTime",
|
||||||
|
"columnName": "task_start_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "startTime",
|
||||||
|
"columnName": "start_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "endtime",
|
||||||
|
"columnName": "end_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskgetTime",
|
||||||
|
"columnName": "task_get_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "status",
|
||||||
|
"columnName": "status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_task_data_table_task_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"task_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_task_data_table_task_id` ON `${TABLE_NAME}` (`task_id`)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index_task_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_task_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "used_task_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `task_id` INTEGER, `line_id` INTEGER, `site_id` INTEGER, `line_name` TEXT, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `driving_status` INTEGER, `leaving` INTEGER, `arrived_time` INTEGER, `leave_time` INTEGER, `introduction` TEXT, `is_play_tts` INTEGER, `event_save_time` INTEGER NOT NULL, `videoList` TEXT)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineName",
|
||||||
|
"columnName": "line_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "name",
|
||||||
|
"columnName": "name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "nameKr",
|
||||||
|
"columnName": "name_kr",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "seq",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLon",
|
||||||
|
"columnName": "gcj_lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLat",
|
||||||
|
"columnName": "gcj_lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lon",
|
||||||
|
"columnName": "lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lat",
|
||||||
|
"columnName": "lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "drivingStatus",
|
||||||
|
"columnName": "driving_status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "leaving",
|
||||||
|
"columnName": "leaving",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "arrivedTime",
|
||||||
|
"columnName": "arrived_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "leaveTime",
|
||||||
|
"columnName": "leave_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "introduction",
|
||||||
|
"columnName": "introduction",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "isPlayTts",
|
||||||
|
"columnName": "is_play_tts",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventSaveTime",
|
||||||
|
"columnName": "event_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "videoList",
|
||||||
|
"columnName": "videoList",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "event_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `event_type` TEXT, `lineId` INTEGER, `lineName` TEXT, `task_id` INTEGER, `task_start_time` INTEGER, `business_time` INTEGER, `write_version` INTEGER, `site_id` INTEGER, `seq` INTEGER, `driver_id` INTEGER, `event_save_time` INTEGER NOT NULL, `update_status` INTEGER NOT NULL, `msg_id` TEXT, `update_time` INTEGER)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventType",
|
||||||
|
"columnName": "event_type",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "lineId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineName",
|
||||||
|
"columnName": "lineName",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskStartTime",
|
||||||
|
"columnName": "task_start_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "businessTime",
|
||||||
|
"columnName": "business_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "writeVersion",
|
||||||
|
"columnName": "write_version",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "seq",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "driverId",
|
||||||
|
"columnName": "driver_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventSaveTime",
|
||||||
|
"columnName": "event_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "updateStatus",
|
||||||
|
"columnName": "update_status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "msgId",
|
||||||
|
"columnName": "msg_id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "upDateTime",
|
||||||
|
"columnName": "update_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_event_data_table_event_save_time",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"event_save_time"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_event_data_table_event_save_time` ON `${TABLE_NAME}` (`event_save_time`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"views": [],
|
||||||
|
"setupQueries": [
|
||||||
|
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||||
|
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '1d1bd5c3b1770e4bc24252f26791f036')"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,739 @@
|
|||||||
|
{
|
||||||
|
"formatVersion": 1,
|
||||||
|
"database": {
|
||||||
|
"version": 5,
|
||||||
|
"identityHash": "018ed967c5f335de5d39581e033160ed",
|
||||||
|
"entities": [
|
||||||
|
{
|
||||||
|
"tableName": "contrail_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `csv_file_url` TEXT, `csv_file_md5` TEXT, `txt_file_url` TEXT, `txt_file_md5` TEXT, `contrail_save_time` INTEGER, `md5` TEXT)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "csvFileUrl",
|
||||||
|
"columnName": "csv_file_url",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "csvFileMd5",
|
||||||
|
"columnName": "csv_file_md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "txtFileUrl",
|
||||||
|
"columnName": "txt_file_url",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "txtFileMd5",
|
||||||
|
"columnName": "txt_file_md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "contrailSaveTime",
|
||||||
|
"columnName": "contrail_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "md5",
|
||||||
|
"columnName": "md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_contrail_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_contrail_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index_contrail_data_table_md5",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"md5"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_contrail_data_table_md5` ON `${TABLE_NAME}` (`md5`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "line_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `line_name` TEXT, `end_station_name` TEXT, `line_get_time` INTEGER NOT NULL)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineName",
|
||||||
|
"columnName": "line_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "endStationName",
|
||||||
|
"columnName": "end_station_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "linegetTime",
|
||||||
|
"columnName": "line_get_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_line_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_line_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "site_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `site_id` INTEGER, `line_id` INTEGER, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `introduction` TEXT, `is_play_tts` INTEGER, `md5` TEXT, `videoList` TEXT)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "name",
|
||||||
|
"columnName": "name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "nameKr",
|
||||||
|
"columnName": "name_kr",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "seq",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLon",
|
||||||
|
"columnName": "gcj_lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLat",
|
||||||
|
"columnName": "gcj_lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lon",
|
||||||
|
"columnName": "lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lat",
|
||||||
|
"columnName": "lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "introduction",
|
||||||
|
"columnName": "introduction",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "isPlayTts",
|
||||||
|
"columnName": "is_play_tts",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "md5",
|
||||||
|
"columnName": "md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "videoListDB",
|
||||||
|
"columnName": "videoList",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_site_data_table_site_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"site_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_site_data_table_site_id` ON `${TABLE_NAME}` (`site_id`)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index_site_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_site_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "task_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `task_id` INTEGER, `line_id` INTEGER, `task_data` INTEGER, `task_start_time` INTEGER, `start_time` INTEGER, `end_time` INTEGER, `task_get_time` INTEGER NOT NULL, `status` INTEGER)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskDate",
|
||||||
|
"columnName": "task_data",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskStartTime",
|
||||||
|
"columnName": "task_start_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "startTime",
|
||||||
|
"columnName": "start_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "endtime",
|
||||||
|
"columnName": "end_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskgetTime",
|
||||||
|
"columnName": "task_get_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "status",
|
||||||
|
"columnName": "status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_task_data_table_task_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"task_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_task_data_table_task_id` ON `${TABLE_NAME}` (`task_id`)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index_task_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_task_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "used_task_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `task_id` INTEGER, `line_id` INTEGER, `site_id` INTEGER, `line_name` TEXT, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `driving_status` INTEGER, `leaving` INTEGER, `arrived_time` INTEGER, `leave_time` INTEGER, `introduction` TEXT, `is_play_tts` INTEGER, `event_save_time` INTEGER NOT NULL, `videoList` TEXT)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineName",
|
||||||
|
"columnName": "line_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "name",
|
||||||
|
"columnName": "name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "nameKr",
|
||||||
|
"columnName": "name_kr",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "seq",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLon",
|
||||||
|
"columnName": "gcj_lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLat",
|
||||||
|
"columnName": "gcj_lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lon",
|
||||||
|
"columnName": "lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lat",
|
||||||
|
"columnName": "lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "drivingStatus",
|
||||||
|
"columnName": "driving_status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "leaving",
|
||||||
|
"columnName": "leaving",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "arrivedTime",
|
||||||
|
"columnName": "arrived_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "leaveTime",
|
||||||
|
"columnName": "leave_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "introduction",
|
||||||
|
"columnName": "introduction",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "isPlayTts",
|
||||||
|
"columnName": "is_play_tts",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventSaveTime",
|
||||||
|
"columnName": "event_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "videoList",
|
||||||
|
"columnName": "videoList",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "event_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `event_type` TEXT, `lineId` INTEGER, `lineName` TEXT, `task_id` INTEGER, `task_start_time` INTEGER, `business_time` INTEGER, `write_version` INTEGER, `site_id` INTEGER, `seq` INTEGER, `driver_id` INTEGER, `event_save_time` INTEGER NOT NULL, `update_status` INTEGER NOT NULL, `msg_id` TEXT, `update_time` INTEGER)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventType",
|
||||||
|
"columnName": "event_type",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "lineId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineName",
|
||||||
|
"columnName": "lineName",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskStartTime",
|
||||||
|
"columnName": "task_start_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "businessTime",
|
||||||
|
"columnName": "business_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "writeVersion",
|
||||||
|
"columnName": "write_version",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "seq",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "driverId",
|
||||||
|
"columnName": "driver_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventSaveTime",
|
||||||
|
"columnName": "event_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "updateStatus",
|
||||||
|
"columnName": "update_status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "msgId",
|
||||||
|
"columnName": "msg_id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "upDateTime",
|
||||||
|
"columnName": "update_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_event_data_table_event_save_time",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"event_save_time"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_event_data_table_event_save_time` ON `${TABLE_NAME}` (`event_save_time`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "writeoff_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `msg_id` TEXT, `expiry_time` INTEGER, `booking_time` INTEGER, `type` INTEGER, `task_id` INTEGER, `line_id` INTEGER, `site_id` INTEGER, `driver_id` INTEGER, `available_times` INTEGER, `order_no` TEXT, `uid` TEXT, `seq` TEXT, `business_time` INTEGER, `tick_size` INTEGER, `tick_name` TEXT, `event_save_time` INTEGER NOT NULL, `update_status` INTEGER NOT NULL, `update_time` INTEGER)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "msgId",
|
||||||
|
"columnName": "msg_id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "expiryTime",
|
||||||
|
"columnName": "expiry_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "bookingTime",
|
||||||
|
"columnName": "booking_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "type",
|
||||||
|
"columnName": "type",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "driverId",
|
||||||
|
"columnName": "driver_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "availableTimes",
|
||||||
|
"columnName": "available_times",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "orderNo",
|
||||||
|
"columnName": "order_no",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "uid",
|
||||||
|
"columnName": "uid",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "phone",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "businessTime",
|
||||||
|
"columnName": "business_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "ticketSize",
|
||||||
|
"columnName": "tick_size",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "ticketName",
|
||||||
|
"columnName": "tick_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventSaveTime",
|
||||||
|
"columnName": "event_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "updateStatus",
|
||||||
|
"columnName": "update_status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "upDateTime",
|
||||||
|
"columnName": "update_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_writeoff_data_table_event_save_time",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"event_save_time"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_writeoff_data_table_event_save_time` ON `${TABLE_NAME}` (`event_save_time`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"views": [],
|
||||||
|
"setupQueries": [
|
||||||
|
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||||
|
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '018ed967c5f335de5d39581e033160ed')"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,775 @@
|
|||||||
|
{
|
||||||
|
"formatVersion": 1,
|
||||||
|
"database": {
|
||||||
|
"version": 6,
|
||||||
|
"identityHash": "a2451ba8fe1fb6312258d93e3c2c2c8c",
|
||||||
|
"entities": [
|
||||||
|
{
|
||||||
|
"tableName": "contrail_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `csv_file_url` TEXT, `csv_file_md5` TEXT, `txt_file_url` TEXT, `txt_file_md5` TEXT, `contrail_save_time` INTEGER, `md5` TEXT)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "csvFileUrl",
|
||||||
|
"columnName": "csv_file_url",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "csvFileMd5",
|
||||||
|
"columnName": "csv_file_md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "txtFileUrl",
|
||||||
|
"columnName": "txt_file_url",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "txtFileMd5",
|
||||||
|
"columnName": "txt_file_md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "contrailSaveTime",
|
||||||
|
"columnName": "contrail_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "md5",
|
||||||
|
"columnName": "md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_contrail_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_contrail_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index_contrail_data_table_md5",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"md5"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_contrail_data_table_md5` ON `${TABLE_NAME}` (`md5`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "line_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `line_name` TEXT, `end_station_name` TEXT, `line_get_time` INTEGER NOT NULL)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineName",
|
||||||
|
"columnName": "line_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "endStationName",
|
||||||
|
"columnName": "end_station_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "linegetTime",
|
||||||
|
"columnName": "line_get_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_line_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_line_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "site_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `site_id` INTEGER, `line_id` INTEGER, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `introduction` TEXT, `is_play_tts` INTEGER, `md5` TEXT, `videoList` TEXT)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "name",
|
||||||
|
"columnName": "name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "nameKr",
|
||||||
|
"columnName": "name_kr",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "seq",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLon",
|
||||||
|
"columnName": "gcj_lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLat",
|
||||||
|
"columnName": "gcj_lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lon",
|
||||||
|
"columnName": "lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lat",
|
||||||
|
"columnName": "lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "introduction",
|
||||||
|
"columnName": "introduction",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "isPlayTts",
|
||||||
|
"columnName": "is_play_tts",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "md5",
|
||||||
|
"columnName": "md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "videoListDB",
|
||||||
|
"columnName": "videoList",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_site_data_table_site_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"site_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_site_data_table_site_id` ON `${TABLE_NAME}` (`site_id`)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index_site_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_site_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "task_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `shifts_id` INTEGER, `task_id` INTEGER, `line_id` INTEGER, `task_data` INTEGER, `task_start_time` INTEGER, `start_time` INTEGER, `end_time` INTEGER, `task_get_time` INTEGER NOT NULL, `status` INTEGER)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "shiftsId",
|
||||||
|
"columnName": "shifts_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskDate",
|
||||||
|
"columnName": "task_data",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskStartTime",
|
||||||
|
"columnName": "task_start_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "startTime",
|
||||||
|
"columnName": "start_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "endtime",
|
||||||
|
"columnName": "end_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskgetTime",
|
||||||
|
"columnName": "task_get_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "status",
|
||||||
|
"columnName": "status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_task_data_table_task_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"task_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_task_data_table_task_id` ON `${TABLE_NAME}` (`task_id`)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index_task_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_task_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "used_task_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `task_id` INTEGER, `shifts_id` INTEGER, `line_id` INTEGER, `site_id` INTEGER, `line_name` TEXT, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `driving_status` INTEGER, `leaving` INTEGER, `arrived_time` INTEGER, `leave_time` INTEGER, `introduction` TEXT, `is_play_tts` INTEGER, `event_save_time` INTEGER NOT NULL, `videoList` TEXT)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "shiftsId",
|
||||||
|
"columnName": "shifts_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineName",
|
||||||
|
"columnName": "line_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "name",
|
||||||
|
"columnName": "name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "nameKr",
|
||||||
|
"columnName": "name_kr",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "seq",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLon",
|
||||||
|
"columnName": "gcj_lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLat",
|
||||||
|
"columnName": "gcj_lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lon",
|
||||||
|
"columnName": "lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lat",
|
||||||
|
"columnName": "lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "drivingStatus",
|
||||||
|
"columnName": "driving_status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "leaving",
|
||||||
|
"columnName": "leaving",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "arrivedTime",
|
||||||
|
"columnName": "arrived_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "leaveTime",
|
||||||
|
"columnName": "leave_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "introduction",
|
||||||
|
"columnName": "introduction",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "isPlayTts",
|
||||||
|
"columnName": "is_play_tts",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventSaveTime",
|
||||||
|
"columnName": "event_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "videoList",
|
||||||
|
"columnName": "videoList",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "event_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `event_type` TEXT, `shifts_id` INTEGER, `lineId` INTEGER, `task_date` INTEGER, `lineName` TEXT, `task_id` INTEGER, `task_start_time` INTEGER, `business_time` INTEGER, `write_version` INTEGER, `site_id` INTEGER, `seq` INTEGER, `driver_id` INTEGER, `event_save_time` INTEGER NOT NULL, `update_status` INTEGER NOT NULL, `msg_id` TEXT, `update_time` INTEGER)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventType",
|
||||||
|
"columnName": "event_type",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "shiftsId",
|
||||||
|
"columnName": "shifts_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "lineId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskDate",
|
||||||
|
"columnName": "task_date",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineName",
|
||||||
|
"columnName": "lineName",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskStartTime",
|
||||||
|
"columnName": "task_start_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "businessTime",
|
||||||
|
"columnName": "business_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "writeVersion",
|
||||||
|
"columnName": "write_version",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "seq",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "driverId",
|
||||||
|
"columnName": "driver_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventSaveTime",
|
||||||
|
"columnName": "event_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "updateStatus",
|
||||||
|
"columnName": "update_status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "msgId",
|
||||||
|
"columnName": "msg_id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "upDateTime",
|
||||||
|
"columnName": "update_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_event_data_table_event_save_time",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"event_save_time"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_event_data_table_event_save_time` ON `${TABLE_NAME}` (`event_save_time`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "writeoff_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `msg_id` TEXT, `expiry_time` INTEGER, `booking_time` INTEGER, `type` INTEGER, `shifts_id` INTEGER, `task_id` INTEGER, `task_date` INTEGER, `line_id` INTEGER, `site_id` INTEGER, `driver_id` INTEGER, `available_times` INTEGER, `order_no` TEXT, `uid` TEXT, `seq` TEXT, `business_time` INTEGER, `tick_size` INTEGER, `tick_name` TEXT, `event_save_time` INTEGER NOT NULL, `update_status` INTEGER NOT NULL, `update_time` INTEGER)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "msgId",
|
||||||
|
"columnName": "msg_id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "expiryTime",
|
||||||
|
"columnName": "expiry_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "bookingTime",
|
||||||
|
"columnName": "booking_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "type",
|
||||||
|
"columnName": "type",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "shiftsId",
|
||||||
|
"columnName": "shifts_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskDate",
|
||||||
|
"columnName": "task_date",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "driverId",
|
||||||
|
"columnName": "driver_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "availableTimes",
|
||||||
|
"columnName": "available_times",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "orderNo",
|
||||||
|
"columnName": "order_no",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "uid",
|
||||||
|
"columnName": "uid",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "phone",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "businessTime",
|
||||||
|
"columnName": "business_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "ticketSize",
|
||||||
|
"columnName": "tick_size",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "ticketName",
|
||||||
|
"columnName": "tick_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventSaveTime",
|
||||||
|
"columnName": "event_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "updateStatus",
|
||||||
|
"columnName": "update_status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "upDateTime",
|
||||||
|
"columnName": "update_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
],
|
||||||
|
"autoGenerate": true
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_writeoff_data_table_event_save_time",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"event_save_time"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_writeoff_data_table_event_save_time` ON `${TABLE_NAME}` (`event_save_time`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"views": [],
|
||||||
|
"setupQueries": [
|
||||||
|
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||||
|
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, 'a2451ba8fe1fb6312258d93e3c2c2c8c')"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,861 @@
|
|||||||
|
{
|
||||||
|
"formatVersion": 1,
|
||||||
|
"database": {
|
||||||
|
"version": 7,
|
||||||
|
"identityHash": "74e6f2a37be355d3c235b4a0b837cf5d",
|
||||||
|
"entities": [
|
||||||
|
{
|
||||||
|
"tableName": "contrail_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `contrail_id` INTEGER, `csv_file_url` TEXT, `csv_file_md5` TEXT, `txt_file_url` TEXT, `txt_file_md5` TEXT, `contrail_save_time` INTEGER, `md5` TEXT, `source` INTEGER)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "contrailId",
|
||||||
|
"columnName": "contrail_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "csvFileUrl",
|
||||||
|
"columnName": "csv_file_url",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "csvFileMd5",
|
||||||
|
"columnName": "csv_file_md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "txtFileUrl",
|
||||||
|
"columnName": "txt_file_url",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "txtFileMd5",
|
||||||
|
"columnName": "txt_file_md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "contrailSaveTime",
|
||||||
|
"columnName": "contrail_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "md5",
|
||||||
|
"columnName": "md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "source",
|
||||||
|
"columnName": "source",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": true,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_contrail_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_contrail_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index_contrail_data_table_md5",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"md5"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_contrail_data_table_md5` ON `${TABLE_NAME}` (`md5`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "line_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `line_name` TEXT, `end_station_name` TEXT, `line_get_time` INTEGER NOT NULL)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineName",
|
||||||
|
"columnName": "line_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "endStationName",
|
||||||
|
"columnName": "end_station_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "linegetTime",
|
||||||
|
"columnName": "line_get_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": true,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_line_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_line_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "site_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `site_id` INTEGER, `line_id` INTEGER, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `introduction` TEXT, `is_play_tts` INTEGER, `md5` TEXT, `videoList` TEXT)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "name",
|
||||||
|
"columnName": "name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "nameKr",
|
||||||
|
"columnName": "name_kr",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "seq",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLon",
|
||||||
|
"columnName": "gcj_lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLat",
|
||||||
|
"columnName": "gcj_lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lon",
|
||||||
|
"columnName": "lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lat",
|
||||||
|
"columnName": "lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "introduction",
|
||||||
|
"columnName": "introduction",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "isPlayTts",
|
||||||
|
"columnName": "is_play_tts",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "md5",
|
||||||
|
"columnName": "md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "videoListDB",
|
||||||
|
"columnName": "videoList",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": true,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_site_data_table_site_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"site_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_site_data_table_site_id` ON `${TABLE_NAME}` (`site_id`)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index_site_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_site_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "task_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `shifts_id` INTEGER, `task_id` INTEGER, `line_id` INTEGER, `task_data` INTEGER, `task_start_time` INTEGER, `start_time` INTEGER, `end_time` INTEGER, `task_get_time` INTEGER NOT NULL, `status` INTEGER)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "shiftsId",
|
||||||
|
"columnName": "shifts_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskDate",
|
||||||
|
"columnName": "task_data",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskStartTime",
|
||||||
|
"columnName": "task_start_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "startTime",
|
||||||
|
"columnName": "start_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "endtime",
|
||||||
|
"columnName": "end_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskgetTime",
|
||||||
|
"columnName": "task_get_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "status",
|
||||||
|
"columnName": "status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": true,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_task_data_table_task_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"task_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_task_data_table_task_id` ON `${TABLE_NAME}` (`task_id`)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index_task_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_task_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "used_task_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `task_id` INTEGER, `shifts_id` INTEGER, `line_id` INTEGER, `site_id` INTEGER, `line_name` TEXT, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `driving_status` INTEGER, `leaving` INTEGER, `arrived_time` INTEGER, `leave_time` INTEGER, `introduction` TEXT, `is_play_tts` INTEGER, `event_save_time` INTEGER NOT NULL, `videoList` TEXT)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "shiftsId",
|
||||||
|
"columnName": "shifts_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineName",
|
||||||
|
"columnName": "line_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "name",
|
||||||
|
"columnName": "name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "nameKr",
|
||||||
|
"columnName": "name_kr",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "seq",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLon",
|
||||||
|
"columnName": "gcj_lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLat",
|
||||||
|
"columnName": "gcj_lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lon",
|
||||||
|
"columnName": "lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lat",
|
||||||
|
"columnName": "lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "drivingStatus",
|
||||||
|
"columnName": "driving_status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "leaving",
|
||||||
|
"columnName": "leaving",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "arrivedTime",
|
||||||
|
"columnName": "arrived_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "leaveTime",
|
||||||
|
"columnName": "leave_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "introduction",
|
||||||
|
"columnName": "introduction",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "isPlayTts",
|
||||||
|
"columnName": "is_play_tts",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventSaveTime",
|
||||||
|
"columnName": "event_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "videoList",
|
||||||
|
"columnName": "videoList",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": true,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "event_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `event_type` TEXT, `shifts_id` INTEGER, `lineId` INTEGER, `task_date` INTEGER, `lineName` TEXT, `task_id` INTEGER, `task_start_time` INTEGER, `business_time` INTEGER, `write_version` INTEGER, `site_id` INTEGER, `seq` INTEGER, `driver_id` INTEGER, `event_save_time` INTEGER NOT NULL, `update_status` INTEGER NOT NULL, `msg_id` TEXT, `update_time` INTEGER)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventType",
|
||||||
|
"columnName": "event_type",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "shiftsId",
|
||||||
|
"columnName": "shifts_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "lineId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskDate",
|
||||||
|
"columnName": "task_date",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineName",
|
||||||
|
"columnName": "lineName",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskStartTime",
|
||||||
|
"columnName": "task_start_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "businessTime",
|
||||||
|
"columnName": "business_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "writeVersion",
|
||||||
|
"columnName": "write_version",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "seq",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "driverId",
|
||||||
|
"columnName": "driver_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventSaveTime",
|
||||||
|
"columnName": "event_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "updateStatus",
|
||||||
|
"columnName": "update_status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "msgId",
|
||||||
|
"columnName": "msg_id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "upDateTime",
|
||||||
|
"columnName": "update_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": true,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_event_data_table_event_save_time",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"event_save_time"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_event_data_table_event_save_time` ON `${TABLE_NAME}` (`event_save_time`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "writeoff_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `msg_id` TEXT, `expiry_time` INTEGER, `booking_time` INTEGER, `type` INTEGER, `shifts_id` INTEGER, `task_id` INTEGER, `task_date` INTEGER, `line_id` INTEGER, `site_id` INTEGER, `driver_id` INTEGER, `available_times` INTEGER, `order_no` TEXT, `uid` TEXT, `seq` TEXT, `business_time` INTEGER, `tick_size` INTEGER, `tick_name` TEXT, `event_save_time` INTEGER NOT NULL, `update_status` INTEGER NOT NULL, `update_time` INTEGER)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "msgId",
|
||||||
|
"columnName": "msg_id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "expiryTime",
|
||||||
|
"columnName": "expiry_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "bookingTime",
|
||||||
|
"columnName": "booking_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "type",
|
||||||
|
"columnName": "type",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "shiftsId",
|
||||||
|
"columnName": "shifts_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskDate",
|
||||||
|
"columnName": "task_date",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "driverId",
|
||||||
|
"columnName": "driver_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "availableTimes",
|
||||||
|
"columnName": "available_times",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "orderNo",
|
||||||
|
"columnName": "order_no",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "uid",
|
||||||
|
"columnName": "uid",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "phone",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "businessTime",
|
||||||
|
"columnName": "business_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "ticketSize",
|
||||||
|
"columnName": "tick_size",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "ticketName",
|
||||||
|
"columnName": "tick_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventSaveTime",
|
||||||
|
"columnName": "event_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "updateStatus",
|
||||||
|
"columnName": "update_status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "upDateTime",
|
||||||
|
"columnName": "update_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": true,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_writeoff_data_table_event_save_time",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"event_save_time"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_writeoff_data_table_event_save_time` ON `${TABLE_NAME}` (`event_save_time`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "point_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `contrail_id` INTEGER, `site_id` INTEGER, `md5` TEXT, `seq` INTEGER, `point_type` INTEGER, `longitude` REAL, `latitude` REAL, `sub_seq` INTEGER)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "contrailId",
|
||||||
|
"columnName": "contrail_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "md5",
|
||||||
|
"columnName": "md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "seq",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "pointType",
|
||||||
|
"columnName": "point_type",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "longitude",
|
||||||
|
"columnName": "longitude",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "latitude",
|
||||||
|
"columnName": "latitude",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "subSeq",
|
||||||
|
"columnName": "sub_seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": true,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"views": [],
|
||||||
|
"setupQueries": [
|
||||||
|
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||||
|
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '74e6f2a37be355d3c235b4a0b837cf5d')"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,875 @@
|
|||||||
|
{
|
||||||
|
"formatVersion": 1,
|
||||||
|
"database": {
|
||||||
|
"version": 8,
|
||||||
|
"identityHash": "761be9c0c9726513939d5788d36c9c1d",
|
||||||
|
"entities": [
|
||||||
|
{
|
||||||
|
"tableName": "contrail_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `contrail_id` INTEGER, `csv_file_url` TEXT, `csv_file_md5` TEXT, `txt_file_url` TEXT, `txt_file_md5` TEXT, `contrail_save_time` INTEGER, `md5` TEXT, `source` INTEGER)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "contrailId",
|
||||||
|
"columnName": "contrail_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "csvFileUrl",
|
||||||
|
"columnName": "csv_file_url",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "csvFileMd5",
|
||||||
|
"columnName": "csv_file_md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "txtFileUrl",
|
||||||
|
"columnName": "txt_file_url",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "txtFileMd5",
|
||||||
|
"columnName": "txt_file_md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "contrailSaveTime",
|
||||||
|
"columnName": "contrail_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "md5",
|
||||||
|
"columnName": "md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "source",
|
||||||
|
"columnName": "source",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": true,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_contrail_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_contrail_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index_contrail_data_table_md5",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"md5"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_contrail_data_table_md5` ON `${TABLE_NAME}` (`md5`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "line_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `line_name` TEXT, `end_station_name` TEXT, `line_get_time` INTEGER NOT NULL)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineName",
|
||||||
|
"columnName": "line_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "endStationName",
|
||||||
|
"columnName": "end_station_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "linegetTime",
|
||||||
|
"columnName": "line_get_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": true,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_line_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_line_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "site_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `site_id` INTEGER, `line_id` INTEGER, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `introduction` TEXT, `is_play_tts` INTEGER, `md5` TEXT, `videoList` TEXT, `tag` INTEGER NOT NULL DEFAULT 0)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "name",
|
||||||
|
"columnName": "name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "nameKr",
|
||||||
|
"columnName": "name_kr",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "seq",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLon",
|
||||||
|
"columnName": "gcj_lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLat",
|
||||||
|
"columnName": "gcj_lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lon",
|
||||||
|
"columnName": "lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lat",
|
||||||
|
"columnName": "lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "introduction",
|
||||||
|
"columnName": "introduction",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "isPlayTts",
|
||||||
|
"columnName": "is_play_tts",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "md5",
|
||||||
|
"columnName": "md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "videoListDB",
|
||||||
|
"columnName": "videoList",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "tag",
|
||||||
|
"columnName": "tag",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true,
|
||||||
|
"defaultValue": "0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": true,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_site_data_table_site_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"site_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_site_data_table_site_id` ON `${TABLE_NAME}` (`site_id`)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index_site_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_site_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "task_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `shifts_id` INTEGER, `task_id` INTEGER, `line_id` INTEGER, `task_data` INTEGER, `task_start_time` INTEGER, `start_time` INTEGER, `end_time` INTEGER, `task_get_time` INTEGER NOT NULL, `status` INTEGER)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "shiftsId",
|
||||||
|
"columnName": "shifts_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskDate",
|
||||||
|
"columnName": "task_data",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskStartTime",
|
||||||
|
"columnName": "task_start_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "startTime",
|
||||||
|
"columnName": "start_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "endtime",
|
||||||
|
"columnName": "end_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskgetTime",
|
||||||
|
"columnName": "task_get_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "status",
|
||||||
|
"columnName": "status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": true,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_task_data_table_task_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"task_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_task_data_table_task_id` ON `${TABLE_NAME}` (`task_id`)"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"name": "index_task_data_table_line_id",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"line_id"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_task_data_table_line_id` ON `${TABLE_NAME}` (`line_id`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "used_task_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `task_id` INTEGER, `shifts_id` INTEGER, `line_id` INTEGER, `site_id` INTEGER, `line_name` TEXT, `name` TEXT, `name_kr` TEXT, `seq` INTEGER, `gcj_lon` REAL, `gcj_lat` REAL, `lon` REAL, `lat` REAL, `driving_status` INTEGER, `leaving` INTEGER, `arrived_time` INTEGER, `leave_time` INTEGER, `introduction` TEXT, `is_play_tts` INTEGER, `event_save_time` INTEGER NOT NULL, `videoList` TEXT, `tag` INTEGER NOT NULL DEFAULT 0)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "shiftsId",
|
||||||
|
"columnName": "shifts_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineName",
|
||||||
|
"columnName": "line_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "name",
|
||||||
|
"columnName": "name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "nameKr",
|
||||||
|
"columnName": "name_kr",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "seq",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLon",
|
||||||
|
"columnName": "gcj_lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "gcjLat",
|
||||||
|
"columnName": "gcj_lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lon",
|
||||||
|
"columnName": "lon",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lat",
|
||||||
|
"columnName": "lat",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "drivingStatus",
|
||||||
|
"columnName": "driving_status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "leaving",
|
||||||
|
"columnName": "leaving",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "arrivedTime",
|
||||||
|
"columnName": "arrived_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "leaveTime",
|
||||||
|
"columnName": "leave_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "introduction",
|
||||||
|
"columnName": "introduction",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "isPlayTts",
|
||||||
|
"columnName": "is_play_tts",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventSaveTime",
|
||||||
|
"columnName": "event_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "videoList",
|
||||||
|
"columnName": "videoList",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "tag",
|
||||||
|
"columnName": "tag",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true,
|
||||||
|
"defaultValue": "0"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": true,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "event_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `event_type` TEXT, `shifts_id` INTEGER, `lineId` INTEGER, `task_date` INTEGER, `lineName` TEXT, `task_id` INTEGER, `task_start_time` INTEGER, `business_time` INTEGER, `write_version` INTEGER, `site_id` INTEGER, `seq` INTEGER, `driver_id` INTEGER, `event_save_time` INTEGER NOT NULL, `update_status` INTEGER NOT NULL, `msg_id` TEXT, `update_time` INTEGER)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventType",
|
||||||
|
"columnName": "event_type",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "shiftsId",
|
||||||
|
"columnName": "shifts_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "lineId",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskDate",
|
||||||
|
"columnName": "task_date",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineName",
|
||||||
|
"columnName": "lineName",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskStartTime",
|
||||||
|
"columnName": "task_start_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "businessTime",
|
||||||
|
"columnName": "business_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "writeVersion",
|
||||||
|
"columnName": "write_version",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "seq",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "driverId",
|
||||||
|
"columnName": "driver_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventSaveTime",
|
||||||
|
"columnName": "event_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "updateStatus",
|
||||||
|
"columnName": "update_status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "msgId",
|
||||||
|
"columnName": "msg_id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "upDateTime",
|
||||||
|
"columnName": "update_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": true,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_event_data_table_event_save_time",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"event_save_time"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_event_data_table_event_save_time` ON `${TABLE_NAME}` (`event_save_time`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "writeoff_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `msg_id` TEXT, `expiry_time` INTEGER, `booking_time` INTEGER, `type` INTEGER, `shifts_id` INTEGER, `task_id` INTEGER, `task_date` INTEGER, `line_id` INTEGER, `site_id` INTEGER, `driver_id` INTEGER, `available_times` INTEGER, `order_no` TEXT, `uid` TEXT, `seq` TEXT, `business_time` INTEGER, `tick_size` INTEGER, `tick_name` TEXT, `event_save_time` INTEGER NOT NULL, `update_status` INTEGER NOT NULL, `update_time` INTEGER)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "msgId",
|
||||||
|
"columnName": "msg_id",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "expiryTime",
|
||||||
|
"columnName": "expiry_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "bookingTime",
|
||||||
|
"columnName": "booking_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "type",
|
||||||
|
"columnName": "type",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "shiftsId",
|
||||||
|
"columnName": "shifts_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskId",
|
||||||
|
"columnName": "task_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "taskDate",
|
||||||
|
"columnName": "task_date",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "driverId",
|
||||||
|
"columnName": "driver_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "availableTimes",
|
||||||
|
"columnName": "available_times",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "orderNo",
|
||||||
|
"columnName": "order_no",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "uid",
|
||||||
|
"columnName": "uid",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "phone",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "businessTime",
|
||||||
|
"columnName": "business_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "ticketSize",
|
||||||
|
"columnName": "tick_size",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "ticketName",
|
||||||
|
"columnName": "tick_name",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "eventSaveTime",
|
||||||
|
"columnName": "event_save_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "updateStatus",
|
||||||
|
"columnName": "update_status",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "upDateTime",
|
||||||
|
"columnName": "update_time",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": true,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [
|
||||||
|
{
|
||||||
|
"name": "index_writeoff_data_table_event_save_time",
|
||||||
|
"unique": false,
|
||||||
|
"columnNames": [
|
||||||
|
"event_save_time"
|
||||||
|
],
|
||||||
|
"orders": [],
|
||||||
|
"createSql": "CREATE INDEX IF NOT EXISTS `index_writeoff_data_table_event_save_time` ON `${TABLE_NAME}` (`event_save_time`)"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"foreignKeys": []
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"tableName": "point_data_table",
|
||||||
|
"createSql": "CREATE TABLE IF NOT EXISTS `${TABLE_NAME}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `contrail_id` INTEGER, `site_id` INTEGER, `md5` TEXT, `seq` INTEGER, `point_type` INTEGER, `longitude` REAL, `latitude` REAL, `sub_seq` INTEGER)",
|
||||||
|
"fields": [
|
||||||
|
{
|
||||||
|
"fieldPath": "id",
|
||||||
|
"columnName": "id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "lineId",
|
||||||
|
"columnName": "line_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "contrailId",
|
||||||
|
"columnName": "contrail_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "siteId",
|
||||||
|
"columnName": "site_id",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "md5",
|
||||||
|
"columnName": "md5",
|
||||||
|
"affinity": "TEXT",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "seq",
|
||||||
|
"columnName": "seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "pointType",
|
||||||
|
"columnName": "point_type",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "longitude",
|
||||||
|
"columnName": "longitude",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "latitude",
|
||||||
|
"columnName": "latitude",
|
||||||
|
"affinity": "REAL",
|
||||||
|
"notNull": false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"fieldPath": "subSeq",
|
||||||
|
"columnName": "sub_seq",
|
||||||
|
"affinity": "INTEGER",
|
||||||
|
"notNull": false
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"primaryKey": {
|
||||||
|
"autoGenerate": true,
|
||||||
|
"columnNames": [
|
||||||
|
"id"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"indices": [],
|
||||||
|
"foreignKeys": []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"views": [],
|
||||||
|
"setupQueries": [
|
||||||
|
"CREATE TABLE IF NOT EXISTS room_master_table (id INTEGER PRIMARY KEY,identity_hash TEXT)",
|
||||||
|
"INSERT OR REPLACE INTO room_master_table (id,identity_hash) VALUES(42, '761be9c0c9726513939d5788d36c9c1d')"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
7
OCH/shuttle/driver_unmanned/src/main/AndroidManifest.xml
Normal file
7
OCH/shuttle/driver_unmanned/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
<manifest package="com.mogo.och.shuttle.unmanned">
|
||||||
|
|
||||||
|
<application>
|
||||||
|
|
||||||
|
</application>
|
||||||
|
|
||||||
|
</manifest>
|
||||||
@@ -0,0 +1,90 @@
|
|||||||
|
package com.mogo.och.unmanned
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.view.View
|
||||||
|
import androidx.fragment.app.Fragment
|
||||||
|
import com.alibaba.android.arouter.facade.annotation.Route
|
||||||
|
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||||
|
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||||
|
import com.mogo.och.bridge.autopilot.autopilot.OchAutopilotAnalytics
|
||||||
|
import com.mogo.och.bridge.ui.autopilot.AutopilotState
|
||||||
|
import com.mogo.och.common.module.biz.provider.CommonServiceImpl
|
||||||
|
import com.mogo.och.common.module.constant.OchCommonConst
|
||||||
|
import com.mogo.och.unmanned.model.LineModel
|
||||||
|
import com.mogo.och.unmanned.repository.RepositoryManager
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.EventDb
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.LineDb
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.TaskDb
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.TaskSiteDb
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.WriteOffDb
|
||||||
|
import com.mogo.och.unmanned.ui.fragment.ShuttleFragment
|
||||||
|
import com.mogo.och.unmanned.ui.qr.QrOpenView
|
||||||
|
import com.mogo.och.unmanned.util.BusAnalyticsManager
|
||||||
|
import com.mogo.och.unmanned.util.BusTrajectoryManager
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 网约车小巴业务实现入口
|
||||||
|
*
|
||||||
|
* @author tongchenfei
|
||||||
|
*/
|
||||||
|
@Route(path = OchCommonConst.SHUTTLE_DRIVER_UNMANNED)
|
||||||
|
class ShuttleDriverUnmannedProvider : CommonServiceImpl() {
|
||||||
|
|
||||||
|
private val TAG = M_BUS + ShuttleDriverUnmannedProvider::class.java.simpleName
|
||||||
|
private var busFragment: ShuttleFragment? = null
|
||||||
|
|
||||||
|
override fun init(context: Context) {
|
||||||
|
d(TAG, "init")
|
||||||
|
ThreadUtils.getIoPool().submit {
|
||||||
|
LineDb.deleteObsoleteData()
|
||||||
|
TaskDb.deleteObsoleteData()
|
||||||
|
TaskSiteDb.deleteObsoleteData()
|
||||||
|
EventDb.deleteObsoleteData()
|
||||||
|
WriteOffDb.deleteObsoleteData()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun getFragment(): Fragment {
|
||||||
|
d(TAG, "getFragment")
|
||||||
|
if (busFragment == null) {
|
||||||
|
busFragment = ShuttleFragment()
|
||||||
|
}
|
||||||
|
OchAutopilotAnalytics.ochEventKey = BusAnalyticsManager
|
||||||
|
LineModel.init()
|
||||||
|
// ScannerManager.load()
|
||||||
|
BusTrajectoryManager.load()
|
||||||
|
return busFragment!!
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun resetFragment() {
|
||||||
|
d(TAG, "resetFragment")
|
||||||
|
busFragment = null
|
||||||
|
OchAutopilotAnalytics.ochEventKey = null
|
||||||
|
LineModel.release()
|
||||||
|
// ScannerManager.release()
|
||||||
|
BusTrajectoryManager.release()
|
||||||
|
RepositoryManager.release()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createOchBusinessView(context: Context?): View? {
|
||||||
|
d(TAG, "createOchBusinessView")
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createOchBindQRCodeView(context: Context?): View? {
|
||||||
|
if (FunctionBuildConfig.urlJson.bindDriverQRUrl.isNullOrEmpty()) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return context?.let {
|
||||||
|
QrOpenView(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun createStartAutopilotView(context: Context?): View? {
|
||||||
|
return context?.let {
|
||||||
|
AutopilotState(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package com.mogo.och.unmanned.action
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||||
|
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||||
|
import com.mogo.och.common.module.manager.socket.cloud.IOchOnMessageListener
|
||||||
|
import com.mogo.och.common.module.manager.socket.cloud.data.TaskUsedMsg
|
||||||
|
import com.mogo.och.unmanned.model.LineModel
|
||||||
|
import com.mogo.och.unmanned.repository.RepositoryManager
|
||||||
|
|
||||||
|
class TaskUsedAction() :
|
||||||
|
IOchOnMessageListener<TaskUsedMsg> {
|
||||||
|
|
||||||
|
private val tag = M_BUS + "OperateAction"
|
||||||
|
|
||||||
|
override fun target(): Class<TaskUsedMsg> {
|
||||||
|
|
||||||
|
return TaskUsedMsg::class.java
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onMsgReceived(obj: TaskUsedMsg?) {
|
||||||
|
i(tag, "onMsgReceived = $obj")
|
||||||
|
obj?.apply {
|
||||||
|
if (LoginStatusManager.getOchBizInfo()?.businessType == businessType
|
||||||
|
&& RepositoryManager.supportDb()) {
|
||||||
|
LineModel.endTaskByOther(taskId, plateNumber)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
package com.mogo.och.unmanned.bean
|
||||||
|
|
||||||
|
data class WaitUploadLine(var lineName: String, var lineId: Long, var task: MutableList<WaitUploadTask>) {
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (javaClass != other?.javaClass) return false
|
||||||
|
|
||||||
|
other as WaitUploadLine
|
||||||
|
|
||||||
|
if (lineId != other.lineId) return false
|
||||||
|
if (task != other.task) return false
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
var result = lineId.hashCode()
|
||||||
|
result = 31 * result + task.hashCode()
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data class WaitUploadTask(val taskStartTime: Long, val taskId: Long, val waitUploadWriteOff: Int) {
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (javaClass != other?.javaClass) return false
|
||||||
|
|
||||||
|
other as WaitUploadTask
|
||||||
|
|
||||||
|
return taskId == other.taskId
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
return taskId.hashCode()
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.mogo.och.unmanned.bean;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: wangmingjun
|
||||||
|
* @date: 2022/9/23
|
||||||
|
*/
|
||||||
|
public class WriteOffPassenger implements Serializable {
|
||||||
|
public String phone;
|
||||||
|
public String orderNo;
|
||||||
|
public String ticketName;
|
||||||
|
public int passengerSize;
|
||||||
|
public long writeOffTime;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return "WriteOffPassenger{" +
|
||||||
|
"phone='" + phone + '\'' +
|
||||||
|
", orderNo='" + orderNo + '\'' +
|
||||||
|
", ticketName='" + ticketName + '\'' +
|
||||||
|
", passengerSize=" + passengerSize +
|
||||||
|
", writeOffTime=" + writeOffTime +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
package com.mogo.och.unmanned.bean.request;
|
||||||
|
|
||||||
|
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2021/3/22
|
||||||
|
* <p>
|
||||||
|
* 根据车机行驶线路站点信息
|
||||||
|
*/
|
||||||
|
public class BusQueryLineStationsRequest {
|
||||||
|
|
||||||
|
private String sn;
|
||||||
|
|
||||||
|
public BusQueryLineStationsRequest() {
|
||||||
|
this.sn = SharedPrefsMgr.getInstance().getSn();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package com.mogo.och.unmanned.bean.request
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 通过lineid 获取轨迹id
|
||||||
|
*/
|
||||||
|
data class QueryPointRequest(val businessType: Int, val lineIds: MutableList<Long>) {
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,83 @@
|
|||||||
|
package com.mogo.och.unmanned.bean.request
|
||||||
|
|
||||||
|
import com.mogo.commons.storage.SharedPrefsMgr
|
||||||
|
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||||
|
import com.mogo.eagle.core.network.utils.digest.DigestUtils
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||||
|
import com.mogo.och.bridge.device.checkvin.CheckVinManager
|
||||||
|
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.EventDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.WriteOffDataBean
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上报事件
|
||||||
|
*/
|
||||||
|
data class ShuttleEventRequest(val requestId: String, val sn: String, val vin: String, val businessType: Int, val eventList: MutableList<Event>) {
|
||||||
|
companion object {
|
||||||
|
fun transformDb2Net(
|
||||||
|
waitUpdateEvent: List<EventDataBean>?,
|
||||||
|
waitUpdateWriteOffEvent: List<WriteOffDataBean>?
|
||||||
|
): ShuttleEventRequest {
|
||||||
|
val businessTypeShuttle = LoginStatusManager.getOchBizInfo()?.businessType ?: 11
|
||||||
|
val eventList4Request = mutableListOf<Event>()
|
||||||
|
var tempEvent: Event? = null
|
||||||
|
waitUpdateEvent?.forEach {
|
||||||
|
tempEvent = if (AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
Event(it.eventType,
|
||||||
|
EventData(0, it.taskId, it.taskDate, it.businessTime, it.writeVersion, it.siteId, it.seq, it.driverId, it.msgId)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Event(it.eventType,
|
||||||
|
EventData(it.taskId, 0, it.taskDate, it.businessTime, it.writeVersion, it.siteId, it.seq, it.driverId, it.msgId)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
eventList4Request.add(tempEvent!!)
|
||||||
|
}
|
||||||
|
|
||||||
|
waitUpdateWriteOffEvent?.forEach {
|
||||||
|
tempEvent = if (AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
Event("WriteOff",
|
||||||
|
WriteOffEventData(it.msgId, 0, it.taskId, it.taskDate, it.siteId, it.driverId, it.orderNo, it.businessTime, it.businessTime)
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
Event("WriteOff",
|
||||||
|
WriteOffEventData(it.msgId, it.taskId, 0, 0, it.siteId, it.driverId, it.orderNo, it.businessTime, it.businessTime)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
eventList4Request.add(tempEvent!!)
|
||||||
|
}
|
||||||
|
eventList4Request.sortBy { it.eventData.businessTime }
|
||||||
|
val md5Hex = DigestUtils.md5Hex(eventList4Request.toString())
|
||||||
|
return ShuttleEventRequest(md5Hex, SharedPrefsMgr.getInstance().sn, CheckVinManager.getVin(),
|
||||||
|
businessTypeShuttle, eventList4Request)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
data class Event(var eventType: String?, val eventData: EventDataBase)
|
||||||
|
|
||||||
|
open class EventDataBase(val msgtype: String, var businessTime: Long?)
|
||||||
|
|
||||||
|
data class EventData(
|
||||||
|
var taskId: Long?,
|
||||||
|
var shiftsId: Long?,
|
||||||
|
var taskDate: Long?,
|
||||||
|
var businessTimeout: Long?,
|
||||||
|
var writeVersion: Long?,
|
||||||
|
var siteId: Long?,
|
||||||
|
var seq: Int?,
|
||||||
|
var driverId: Long?,
|
||||||
|
var msgId: String?
|
||||||
|
) : EventDataBase(msgtype = "lineEvent", businessTime = businessTimeout)
|
||||||
|
|
||||||
|
data class WriteOffEventData(
|
||||||
|
var msgId: String?,
|
||||||
|
var taskId: Long?,
|
||||||
|
var shiftsId: Long?,
|
||||||
|
var taskDate: Long?,
|
||||||
|
var siteId: Long?,
|
||||||
|
var driverId: Long?,
|
||||||
|
var orderNo: String?,
|
||||||
|
var businessTimeout: Long?,
|
||||||
|
var writeVersion: Long?,
|
||||||
|
) : EventDataBase(msgtype = "writeoffEvent", businessTime = businessTimeout)
|
||||||
@@ -0,0 +1,157 @@
|
|||||||
|
package com.mogo.och.unmanned.bean.response
|
||||||
|
|
||||||
|
import com.google.gson.reflect.TypeToken
|
||||||
|
import com.mogo.eagle.core.data.BaseData
|
||||||
|
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||||
|
import com.mogo.och.bridge.autopilot.line.LineManager
|
||||||
|
import com.mogo.och.data.bean.BusRoutesResult
|
||||||
|
import com.mogo.och.data.bean.BusStationBean
|
||||||
|
import com.mogo.och.data.bean.LineInfo
|
||||||
|
import com.mogo.och.data.bean.SiteIntroduce
|
||||||
|
import com.mogo.och.unmanned.model.LineModel
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.PointDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.TaskSiteDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.PointDb
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.TaskSiteDb
|
||||||
|
import java.lang.Boolean
|
||||||
|
import kotlin.Exception
|
||||||
|
import kotlin.Int
|
||||||
|
import kotlin.Long
|
||||||
|
import kotlin.Pair
|
||||||
|
import kotlin.String
|
||||||
|
import kotlin.let
|
||||||
|
import kotlin.toString
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 网约车小巴路线接口请求响应结果
|
||||||
|
*
|
||||||
|
* @author tongchenfei
|
||||||
|
*/
|
||||||
|
class BusRoutesResponse : BaseData() {
|
||||||
|
var data: BusRoutesResult? = null
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "BusRoutesResponse{" +
|
||||||
|
"data=" + data +
|
||||||
|
'}'
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
fun db2Beans(runnintTaskAndSites: List<TaskSiteDataBean>?, lineId: Long?): Pair<MutableList<BusStationBean>, Int> {
|
||||||
|
val result = mutableListOf<BusStationBean>()
|
||||||
|
var temp: BusStationBean? = null
|
||||||
|
var currentStationIndex = -1
|
||||||
|
var lineInfo: LineInfo? = null
|
||||||
|
if (runnintTaskAndSites.isNullOrEmpty()) {
|
||||||
|
LineManager.setLineInfo(lineInfo)
|
||||||
|
return Pair(result, currentStationIndex)
|
||||||
|
}
|
||||||
|
val points = PointDb.queryPointByLineId(lineId)
|
||||||
|
runnintTaskAndSites.forEachIndexed { index, taskAndsite ->
|
||||||
|
temp = BusStationBean()
|
||||||
|
temp?.drivingStatus = (taskAndsite.drivingStatus ?: 0)
|
||||||
|
temp?.lat = (taskAndsite.lat ?: 0.0)
|
||||||
|
temp?.lon = (taskAndsite.lon ?: 0.0)
|
||||||
|
temp?.gcjLat = (taskAndsite.gcjLat ?: 0.0)
|
||||||
|
temp?.gcjLon = (taskAndsite.gcjLon ?: 0.0)
|
||||||
|
temp?.introduction = taskAndsite.introduction
|
||||||
|
temp?.isLeaving = Boolean.TRUE == taskAndsite.leaving
|
||||||
|
temp?.name = taskAndsite.name
|
||||||
|
temp?.nameKr = taskAndsite.nameKr
|
||||||
|
temp?.isPlayTts = Boolean.TRUE == taskAndsite.isPlayTts
|
||||||
|
temp?.seq = (taskAndsite.seq ?: 0)
|
||||||
|
temp?.tag = taskAndsite.tag
|
||||||
|
temp?.siteId = if (taskAndsite.siteId == null) 0 else taskAndsite.siteId!!.toInt()
|
||||||
|
points?.let { pointList ->
|
||||||
|
val sitePoint = pointList.filter {
|
||||||
|
it.siteId?.toInt() == temp?.siteId
|
||||||
|
}.sortedWith(
|
||||||
|
compareBy<PointDataBean> { it.subSeq }
|
||||||
|
// .thenBy {it.subSeq }
|
||||||
|
)
|
||||||
|
val tempPassPoints = mutableListOf<BusStationBean>()
|
||||||
|
val tempblackPoints = mutableListOf<BusStationBean>()
|
||||||
|
sitePoint.forEach { point ->
|
||||||
|
when (point.pointType) {
|
||||||
|
PointDataBean.pointTypePass -> {
|
||||||
|
tempPassPoints.add(point.toStation())
|
||||||
|
}
|
||||||
|
|
||||||
|
PointDataBean.pointTypeBlack -> {
|
||||||
|
tempblackPoints.add(point.toStation())
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
temp?.passPoints = tempPassPoints
|
||||||
|
temp?.blackPoints = tempblackPoints
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!taskAndsite.videoList.isNullOrEmpty()) {
|
||||||
|
try {
|
||||||
|
val list = GsonUtils.fromJson<List<SiteIntroduce>>(
|
||||||
|
taskAndsite.videoList,
|
||||||
|
object : TypeToken<List<SiteIntroduce?>?>() {}.type
|
||||||
|
)
|
||||||
|
temp?.videoList = list.toMutableList()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
temp?.videoList = null
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
result.add(temp!!)
|
||||||
|
// 正在进行中的任务
|
||||||
|
if (temp!!.drivingStatus == TaskSiteDataBean.drivingStatusCurrent) {
|
||||||
|
if (temp!!.tag != 2) {
|
||||||
|
currentStationIndex = index
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 线路信息
|
||||||
|
if (lineInfo == null && taskAndsite.lineId != null && taskAndsite.lineName != null) {
|
||||||
|
lineInfo = LineInfo(taskAndsite.lineId!!, taskAndsite.lineName!!, orderId = taskAndsite.taskId.toString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (currentStationIndex == -1) {
|
||||||
|
val pos = result.indexOfFirst { it.tag != 2 }
|
||||||
|
currentStationIndex = if (pos != -1) {
|
||||||
|
pos
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lineInfo?.multiMap?.put("taskInfo", LineModel.getTaskTime())
|
||||||
|
lineInfo?.siteInfos = result
|
||||||
|
LineManager.setLineInfo(lineInfo)
|
||||||
|
|
||||||
|
return Pair(result, currentStationIndex)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun bean2Db(sites: MutableList<BusStationBean>, lineId: Long, lineName: String?, taskId: Long) {
|
||||||
|
val runnintTaskAndSites = mutableListOf<TaskSiteDataBean>()
|
||||||
|
sites.forEach {
|
||||||
|
val temp = TaskSiteDataBean()
|
||||||
|
temp.taskId = taskId
|
||||||
|
temp.lineId = lineId
|
||||||
|
temp.siteId = it.siteId.toLong()
|
||||||
|
temp.lineName = lineName
|
||||||
|
temp.name = it.name
|
||||||
|
temp.nameKr = it.nameKr
|
||||||
|
temp.seq = it.seq
|
||||||
|
temp.gcjLat = it.gcjLat
|
||||||
|
temp.gcjLon = it.gcjLon
|
||||||
|
temp.lon = it.lon
|
||||||
|
temp.lat = it.lat
|
||||||
|
temp.drivingStatus = it.drivingStatus
|
||||||
|
temp.leaving = it.isLeaving
|
||||||
|
temp.introduction = it.introduction
|
||||||
|
temp.isPlayTts = it.isPlayTts
|
||||||
|
temp.videoList = GsonUtils.toJson(it.videoList)
|
||||||
|
runnintTaskAndSites.add(temp)
|
||||||
|
}
|
||||||
|
TaskSiteDb.addOrUpdate(*runnintTaskAndSites.toTypedArray())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,105 @@
|
|||||||
|
package com.mogo.och.unmanned.bean.response
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.data.BaseData
|
||||||
|
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||||
|
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||||
|
import com.mogo.och.data.bean.SiteIntroduce
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.ContrailDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.LineDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.SiteDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.TaskDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.ContraiDb
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.LineDb
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.SiteDb
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.TaskDb
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
data class CarExecutableTaskResponse(val data: List<Result>?) : BaseData() {
|
||||||
|
|
||||||
|
data class Result(
|
||||||
|
var line: LineDataBeanInsert?,
|
||||||
|
var siteList: List<SiteDataBean>?,//站点名称
|
||||||
|
val contrail: ContrailDataBean?,//站点名称
|
||||||
|
val taskList: List<TaskDataBean>?,//站点名称
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
data class LineDataBeanInsert(
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线路id
|
||||||
|
*/
|
||||||
|
var lineId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线路名称
|
||||||
|
*/
|
||||||
|
var lineName: String? = null,
|
||||||
|
/**
|
||||||
|
* 终点站点名称
|
||||||
|
*/
|
||||||
|
var endStationName: String? = null,
|
||||||
|
|
||||||
|
)
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
/**
|
||||||
|
* 保存 线路信息、自驾轨迹信息、站点信息和任务到数据库
|
||||||
|
*/
|
||||||
|
fun save2Db(data: CarExecutableTaskResponse) {
|
||||||
|
val lineList = mutableListOf<LineDataBean>()
|
||||||
|
val contrailList = mutableListOf<ContrailDataBean>()
|
||||||
|
val siteList = mutableListOf<SiteDataBean>()
|
||||||
|
|
||||||
|
data.data?.forEach { dataInfo ->
|
||||||
|
var lineId: Long? = null
|
||||||
|
dataInfo.line?.let { lineInfo ->
|
||||||
|
val tempLineInfo = LineDataBean()
|
||||||
|
lineId = lineInfo.lineId
|
||||||
|
tempLineInfo.lineId = lineInfo.lineId
|
||||||
|
tempLineInfo.lineName = lineInfo.lineName
|
||||||
|
tempLineInfo.endStationName = dataInfo.siteList?.last()?.name ?: ""
|
||||||
|
lineList.add(tempLineInfo)
|
||||||
|
}
|
||||||
|
dataInfo.contrail?.let { contrailInfo ->
|
||||||
|
contrailInfo.lineId = lineId
|
||||||
|
contrailList.add(contrailInfo)
|
||||||
|
}
|
||||||
|
dataInfo.siteList?.let { siteListInfo ->
|
||||||
|
siteListInfo.forEach {
|
||||||
|
it.lineId = lineId
|
||||||
|
val videoInfoList = mutableListOf<SiteIntroduce>()
|
||||||
|
it.videoList?.forEach { videoInfoIt ->
|
||||||
|
videoInfoList.add(videoInfoIt)
|
||||||
|
}
|
||||||
|
if (videoInfoList.isNotEmpty()) {
|
||||||
|
it.videoListDB = GsonUtils.toJson(videoInfoList)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
siteList.addAll(siteListInfo)
|
||||||
|
}
|
||||||
|
dataInfo.taskList?.let { taskInfs ->
|
||||||
|
taskInfs.forEach {
|
||||||
|
it.lineId = lineId
|
||||||
|
if (AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
// 班车需要前台生产任务Id 前台规则 任务id 等同模板id
|
||||||
|
it.taskId = it.shiftsId
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TaskDb.addOrUpdate(taskInfs, lineId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
LineDb.checkAndUpdate(lineList)
|
||||||
|
ContraiDb.addOrUpdate(contrailList)
|
||||||
|
SiteDb.addOrUpdate(siteList)
|
||||||
|
|
||||||
|
TaskDb.resetShiftsIdDetail()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,42 @@
|
|||||||
|
package com.mogo.och.unmanned.bean.response
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.data.BaseData
|
||||||
|
|
||||||
|
|
||||||
|
class PointsResponse : BaseData() {
|
||||||
|
var data: MutableList<PointResponse>? = null
|
||||||
|
}
|
||||||
|
|
||||||
|
data class Point(
|
||||||
|
val latitude: Double,
|
||||||
|
val longitude: Double,
|
||||||
|
val pointType: Int,
|
||||||
|
val segment: Int
|
||||||
|
)
|
||||||
|
|
||||||
|
data class Black(
|
||||||
|
val latitude: Double,
|
||||||
|
val longitude: Double,
|
||||||
|
val pointType: Int,
|
||||||
|
val segment: Int
|
||||||
|
)
|
||||||
|
|
||||||
|
data class PointResponse(
|
||||||
|
val businessType: Int,
|
||||||
|
val contrailId: Long,
|
||||||
|
val contrailSaveTime: Long,
|
||||||
|
val csvFileMd5: String,
|
||||||
|
val csvFileUrl: String,
|
||||||
|
val lineId: Long,
|
||||||
|
val lineName: String,
|
||||||
|
val segmentPointList: List<SegmentPoint>,
|
||||||
|
val source: Int,
|
||||||
|
val txtFileMd5: String,
|
||||||
|
val txtFileUrl: String
|
||||||
|
)
|
||||||
|
|
||||||
|
data class SegmentPoint(
|
||||||
|
val blackList: List<Black>,
|
||||||
|
val pointList: List<Point>,
|
||||||
|
val segment: Int?
|
||||||
|
)
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package com.mogo.och.unmanned.bean.response;
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.data.BaseData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: wangmingjun
|
||||||
|
* @date: 2022/2/9
|
||||||
|
*/
|
||||||
|
public class WriteOffCountResponse extends BaseData {
|
||||||
|
|
||||||
|
public Integer data;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
package com.mogo.och.unmanned.callback;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: wangmingjun
|
||||||
|
* @date: 2022/2/9
|
||||||
|
*/
|
||||||
|
public interface IBusLinesCallback {
|
||||||
|
|
||||||
|
default void onChangeLineIdSuccess() {
|
||||||
|
}
|
||||||
|
|
||||||
|
default void onRefreshSuccess(long currentTimeStamp) {
|
||||||
|
}
|
||||||
|
|
||||||
|
default void onRefreshSuccessWIthData() {
|
||||||
|
}
|
||||||
|
|
||||||
|
default void onChangeLineIdFail() {
|
||||||
|
}
|
||||||
|
|
||||||
|
default void onNoRunningTask() {
|
||||||
|
}
|
||||||
|
|
||||||
|
default void onRunningTask() {
|
||||||
|
}
|
||||||
|
|
||||||
|
default void onLeaveStaionSuccess() {
|
||||||
|
}
|
||||||
|
|
||||||
|
default void onArriveStationSuccess() {
|
||||||
|
}
|
||||||
|
|
||||||
|
default void onCompleteTask() {
|
||||||
|
}
|
||||||
|
|
||||||
|
default void onCompleteTaskFail() {
|
||||||
|
}
|
||||||
|
|
||||||
|
default void onEndTaskByOther(long taskId, String plateNumber) {
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,53 @@
|
|||||||
|
package com.mogo.och.unmanned.constant
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created on 2021/12/6
|
||||||
|
*/
|
||||||
|
class BusConst {
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
// 测试用的广播
|
||||||
|
const val BROADCAST_TEST_BUS_CONTROL_TYPE_EXTRA_KEY = "sceneType"
|
||||||
|
|
||||||
|
// 上报心跳轮询ms
|
||||||
|
const val LOOP_PERIOD_60S = 60 * 1000L
|
||||||
|
|
||||||
|
// 开始服务启动自动驾驶等待时间(埋点上传)
|
||||||
|
const val LOOP_PERIOD_15S = 15 * 1000L
|
||||||
|
const val LOOP_PERIOD_1S = 1 * 1000L
|
||||||
|
const val LOOP_DELAY = 100L
|
||||||
|
|
||||||
|
// 下发给MEC轨迹信息间隔时间 10秒
|
||||||
|
const val LOOP_PERIOD_10S = 10 * 1000L
|
||||||
|
|
||||||
|
// 尝试下发给MEC轨迹最多10次
|
||||||
|
const val LOOP_SEND_TRAJ_TIMES = 10
|
||||||
|
|
||||||
|
const val SEND_OUTVOICE_DISTANCES_TARTSTATIONE = 15
|
||||||
|
|
||||||
|
// 恢复数据时 等待同步基础数据等待2s
|
||||||
|
const val waitSysAllData = 2_000L
|
||||||
|
|
||||||
|
// 最多等待5次
|
||||||
|
const val waitCount = 5
|
||||||
|
|
||||||
|
//起点UUID
|
||||||
|
const val BUS_START_MAP_MAKER = "bus_start_map_maker";
|
||||||
|
|
||||||
|
//终点UUID
|
||||||
|
const val BUS_END_MAP_MAKER = "bus_end_map_maker";
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单起终点Marker类型
|
||||||
|
*/
|
||||||
|
const val TYPE_MARKER_BUS_ORDER = "TYPE_MARKER_BUS_ORDER"
|
||||||
|
|
||||||
|
const val TIMER_START_AUTOPILOT_INTERVAL = 20 * 1000L
|
||||||
|
|
||||||
|
//围栏到站 暂定10米
|
||||||
|
const val ARRIVE_AT_END_STATION_DISTANCE = 10
|
||||||
|
|
||||||
|
const val DELAY_10S = 10 * 1000L
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,159 @@
|
|||||||
|
package com.mogo.och.unmanned.model
|
||||||
|
|
||||||
|
import com.mogo.commons.AbsMogoApplication
|
||||||
|
import com.mogo.eagle.core.data.BaseData
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||||
|
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||||
|
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||||
|
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||||
|
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||||
|
import com.mogo.och.common.module.utils.RxUtils
|
||||||
|
import com.mogo.och.unmanned.bean.WaitUploadLine
|
||||||
|
import com.mogo.och.unmanned.bean.request.ShuttleEventRequest
|
||||||
|
import com.mogo.och.unmanned.repository.RepositoryManager
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.EventDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.EventDb
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.SiteDb
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.WriteOffDb
|
||||||
|
import io.reactivex.Observable
|
||||||
|
import io.reactivex.disposables.Disposable
|
||||||
|
import io.reactivex.subjects.BehaviorSubject
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean
|
||||||
|
|
||||||
|
object EventModel {
|
||||||
|
|
||||||
|
private val isUpdating by lazy { AtomicBoolean(false) }
|
||||||
|
|
||||||
|
private val createDefault = BehaviorSubject.createDefault(isUpdating.get())
|
||||||
|
|
||||||
|
private var eventUpdateInfo: Disposable? = null
|
||||||
|
|
||||||
|
const val TAG = "${M_BUS}EventModel"
|
||||||
|
|
||||||
|
|
||||||
|
fun load() {
|
||||||
|
if (RepositoryManager.supportDb() || RepositoryManager.supportWriteOffDb()) {
|
||||||
|
RxUtils.disposeSubscribe(eventUpdateInfo)
|
||||||
|
eventUpdateInfo = RxUtils.createSubscribe(2 * 60 * 1000) {
|
||||||
|
updateEvent()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun release() {
|
||||||
|
isUpdating.set(false)
|
||||||
|
RxUtils.disposeSubscribe(eventUpdateInfo)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun notifySyn() {
|
||||||
|
RxUtils.disposeSubscribe(eventUpdateInfo)
|
||||||
|
updateEvent()
|
||||||
|
checkDbData()
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun checkDbData() {
|
||||||
|
BizLoopManager.runInIoThread {
|
||||||
|
SiteDb.checkData()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun updateEvent() {
|
||||||
|
if (isUpdating.get()) {
|
||||||
|
d(TAG, "上报event-正在上传 等待下一次轮训 ")
|
||||||
|
OchChainLogManager.writeChainLogDb("上报event", "正在上传 等待下一次轮训")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
isUpdating.set(true)
|
||||||
|
createDefault.onNext(isUpdating.get())
|
||||||
|
ThreadUtils.getSinglePool().submit {
|
||||||
|
val waitUpdateLineEvent = EventDb.queryWaitUpdateEvent()
|
||||||
|
val waitUpdateWriteOffEvent = WriteOffDb.queryWaitUpdateEvent()
|
||||||
|
if (waitUpdateLineEvent.isNullOrEmpty() && waitUpdateWriteOffEvent.isNullOrEmpty()) {
|
||||||
|
d(TAG, "上报event-没有数据需要上报 ")
|
||||||
|
OchChainLogManager.writeChainLogDb("上报event", "没有数据需要上报")
|
||||||
|
isUpdating.set(false)
|
||||||
|
createDefault.onNext(isUpdating.get())
|
||||||
|
RxUtils.disposeSubscribe(eventUpdateInfo)
|
||||||
|
eventUpdateInfo = RxUtils.createSubscribe(2 * 60 * 1000) {
|
||||||
|
updateEvent()
|
||||||
|
}
|
||||||
|
return@submit
|
||||||
|
}
|
||||||
|
d(TAG, "上报event-开始上报 ")
|
||||||
|
OchChainLogManager.writeChainLogDb("上报event", "开始上")
|
||||||
|
val transformDb2Net = ShuttleEventRequest.transformDb2Net(waitUpdateLineEvent, waitUpdateWriteOffEvent)
|
||||||
|
RepositoryManager.reportCabinEvent(AbsMogoApplication.getApp()!!, transformDb2Net, object : OchCommonServiceCallback<BaseData?> {
|
||||||
|
override fun onSuccess(data: BaseData?) {
|
||||||
|
d(TAG, "上报event-上报event成功 $transformDb2Net ")
|
||||||
|
OchChainLogManager.writeChainLogDb("上报event成功", "$transformDb2Net")
|
||||||
|
|
||||||
|
waitUpdateLineEvent?.let { lineEvents ->
|
||||||
|
lineEvents.forEach {
|
||||||
|
it.updateStatus = EventDataBean.updated
|
||||||
|
it.upDateTime = System.currentTimeMillis()
|
||||||
|
}
|
||||||
|
EventDb.saveUpdateSuccess(lineEvents)
|
||||||
|
}
|
||||||
|
|
||||||
|
waitUpdateWriteOffEvent?.let { writeOffEvents ->
|
||||||
|
WriteOffDb.saveUpdateSuccess(writeOffEvents, EventDataBean.updated, System.currentTimeMillis())
|
||||||
|
}
|
||||||
|
|
||||||
|
isUpdating.set(false)
|
||||||
|
createDefault.onNext(isUpdating.get())
|
||||||
|
val queryWaitUpdateEventCount = EventDb.queryWaitUpdateEventCount()
|
||||||
|
if (queryWaitUpdateEventCount != null && queryWaitUpdateEventCount > 0) {
|
||||||
|
updateEvent()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val queryWaitUpdateWriteOffCount = WriteOffDb.queryWaitUpdateWriteOffCount()
|
||||||
|
if (queryWaitUpdateWriteOffCount != null && queryWaitUpdateWriteOffCount > 0) {
|
||||||
|
updateEvent()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
RxUtils.disposeSubscribe(eventUpdateInfo)
|
||||||
|
eventUpdateInfo = RxUtils.createSubscribe(2 * 60 * 1000) {
|
||||||
|
updateEvent()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFail(code: Int, msg: String?) {
|
||||||
|
isUpdating.set(false)
|
||||||
|
createDefault.onNext(isUpdating.get())
|
||||||
|
d(TAG, "上报event-上报event失败 $transformDb2Net code:$code msg:$msg ")
|
||||||
|
OchChainLogManager.writeChainLogDb("上报event失败", "$transformDb2Net ")
|
||||||
|
RxUtils.disposeSubscribe(eventUpdateInfo)
|
||||||
|
eventUpdateInfo = RxUtils.createSubscribe(10 * 1000) {
|
||||||
|
updateEvent()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError() {
|
||||||
|
isUpdating.set(false)
|
||||||
|
createDefault.onNext(isUpdating.get())
|
||||||
|
d(TAG, "上报event-上报event失败 $transformDb2Net ")
|
||||||
|
OchChainLogManager.writeChainLogDb("上报event失败", "$transformDb2Net")
|
||||||
|
RxUtils.disposeSubscribe(eventUpdateInfo)
|
||||||
|
eventUpdateInfo = RxUtils.createSubscribe(10 * 1000) {
|
||||||
|
updateEvent()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryWaitUploadInfo(): Observable<MutableList<WaitUploadLine>>? {
|
||||||
|
return RepositoryManager.queryWaitUploadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getUploadTaskObservable(): BehaviorSubject<Boolean> {
|
||||||
|
return createDefault
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,407 @@
|
|||||||
|
package com.mogo.och.unmanned.model
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.Context
|
||||||
|
import com.mogo.commons.AbsMogoApplication
|
||||||
|
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||||
|
import com.mogo.eagle.core.data.map.SiteMarkerBean
|
||||||
|
import com.mogo.eagle.core.data.och.OchInfo
|
||||||
|
import com.mogo.eagle.core.data.v2x.Point
|
||||||
|
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||||
|
import com.mogo.eagle.core.function.call.datacenter.CallerDataCenterBizListener
|
||||||
|
import com.mogo.eagle.core.function.call.och.CallerEagleBaseFunctionCall4OchManager
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||||
|
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||||
|
import com.mogo.och.bridge.autopilot.line.LineManager
|
||||||
|
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||||
|
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||||
|
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||||
|
import com.mogo.och.common.module.manager.socket.lan.LanSocketManager
|
||||||
|
import com.mogo.och.common.module.manager.socket.lan.bean.WriteOffResultMsg
|
||||||
|
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||||
|
import com.mogo.och.common.module.utils.RxUtils
|
||||||
|
import com.mogo.och.data.bean.BusStationBean
|
||||||
|
import com.mogo.och.shuttle.unmanned.R
|
||||||
|
import com.mogo.och.unmanned.callback.IBusLinesCallback
|
||||||
|
import com.mogo.och.unmanned.model.OrderModel.isGoingToNextStation
|
||||||
|
import com.mogo.och.unmanned.repository.RepositoryManager
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.LineDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.TaskDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.TaskSiteDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.EventDb
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.SiteDb
|
||||||
|
import com.mogo.och.unmanned.repository.exception.DataException
|
||||||
|
import com.mogo.och.unmanned.util.ShuttleVoiceManager
|
||||||
|
import io.reactivex.Observer
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
|
import io.reactivex.disposables.Disposable
|
||||||
|
import io.reactivex.schedulers.Schedulers
|
||||||
|
import java.util.concurrent.ConcurrentHashMap
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: wangmingjun
|
||||||
|
* @date: 2022/2/9
|
||||||
|
*/
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
|
object LineModel {
|
||||||
|
private var mContext: Context? = null
|
||||||
|
|
||||||
|
private val mBusLinesCallbackMap: MutableMap<String, IBusLinesCallback> = ConcurrentHashMap()
|
||||||
|
|
||||||
|
const val TAG = "${M_BUS}BusLineModel"
|
||||||
|
|
||||||
|
var currentTask: TaskDataBean? = null
|
||||||
|
|
||||||
|
// 当前任务的站点列表
|
||||||
|
var stationList: MutableList<BusStationBean>? = mutableListOf()
|
||||||
|
|
||||||
|
private var startTaskDisposable: Disposable? = null
|
||||||
|
|
||||||
|
|
||||||
|
// 当前站点
|
||||||
|
@JvmStatic
|
||||||
|
var startStationIndex: Int = 0 //A->B 此处值是A站点索引
|
||||||
|
|
||||||
|
//下一站点
|
||||||
|
@JvmStatic
|
||||||
|
var nextStationIndex: Int = 0
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun init() {
|
||||||
|
d(TAG, "init")
|
||||||
|
mContext = AbsMogoApplication.getApp()
|
||||||
|
EventModel.load()
|
||||||
|
SynchDataModel.queryCarExecutableTaskList(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
@Synchronized
|
||||||
|
fun release() {
|
||||||
|
d(TAG, "release")
|
||||||
|
mContext = null
|
||||||
|
|
||||||
|
SynchDataModel.release()
|
||||||
|
EventModel.release()
|
||||||
|
mBusLinesCallbackMap.clear()
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun setBusLinesCallback(tag: String?, callback: IBusLinesCallback?) {
|
||||||
|
if (tag == null || "" == tag) return
|
||||||
|
if (callback == null) {
|
||||||
|
mBusLinesCallbackMap.remove(tag)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
mBusLinesCallbackMap[tag] = callback
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getBusLinesCallbackMap(): MutableMap<String, IBusLinesCallback> {
|
||||||
|
return mBusLinesCallbackMap
|
||||||
|
}
|
||||||
|
|
||||||
|
fun refreshTask() {
|
||||||
|
SynchDataModel.queryCarExecutableTaskList(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始任务
|
||||||
|
*/
|
||||||
|
@JvmStatic
|
||||||
|
fun commitSwitchLineId(task: TaskDataBean, line: LineDataBean) {
|
||||||
|
RxUtils.disposeSubscribe(startTaskDisposable)
|
||||||
|
line.getLineIdAndName { lineId, lineName ->
|
||||||
|
task.getLineIdAndName { shiftsId, taskId, taskTime, taskDate ->
|
||||||
|
RepositoryManager.startTask(shiftsId, taskId, lineId, taskTime, lineName)
|
||||||
|
?.subscribeOn(Schedulers.io())
|
||||||
|
?.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
?.subscribe(object : Observer<Boolean> {
|
||||||
|
override fun onSubscribe(d: Disposable) {
|
||||||
|
startTaskDisposable = d
|
||||||
|
d(TAG, "commitSwitchLineId onSubscribe")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(e: Throwable) {
|
||||||
|
d(TAG, "commitSwitchLineId onError${e.printStackTrace()}")
|
||||||
|
if (RepositoryManager.supportDb()) {
|
||||||
|
if (e is DataException) {
|
||||||
|
OchChainLogManager.writeChainLog("开始任务", "${e.message}")
|
||||||
|
// ToastUtils.showShort("选择任务失败:${e.message}")
|
||||||
|
ToastUtils.showShort(R.string.module_och_choose_task_fail, e.message)
|
||||||
|
mBusLinesCallbackMap.forEach {
|
||||||
|
it.value.onChangeLineIdFail()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
OchChainLogManager.writeChainLog("开始任务", "${e.message}")
|
||||||
|
// ToastUtils.showShort("选择任务失败:${e.message}")
|
||||||
|
ToastUtils.showShort(R.string.module_och_choose_task_fail, e.message)
|
||||||
|
mBusLinesCallbackMap.forEach {
|
||||||
|
it.value.onChangeLineIdFail()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onComplete() {
|
||||||
|
d(TAG, "commitSwitchLineId onComplete")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNext(data: Boolean) {
|
||||||
|
d(TAG, "commitSwitchLineId onNext ${data}")
|
||||||
|
if (data) {
|
||||||
|
EventDb.saveEventTaskStart(shiftsId, taskId, lineId, taskTime, lineName, taskDate)
|
||||||
|
OrderModel.queryBusRoutes()
|
||||||
|
BizLoopManager.runInIoThread {
|
||||||
|
val querySiteByLineId = SiteDb.querySiteByLineId(lineId)
|
||||||
|
querySiteByLineId?.forEach {
|
||||||
|
if (it.seq == 1) {
|
||||||
|
LanSocketManager.sendMsgToClient(WriteOffResultMsg(-99, "", "", System.currentTimeMillis(), LineManager.lineInfos?.lineId
|
||||||
|
?: 0, it.siteId ?: 0L))
|
||||||
|
}
|
||||||
|
return@forEach
|
||||||
|
}
|
||||||
|
}
|
||||||
|
mBusLinesCallbackMap.forEach {
|
||||||
|
it.value.onChangeLineIdSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
RxUtils.disposeSubscribe(startTaskDisposable)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun haveRunningTask() {
|
||||||
|
mBusLinesCallbackMap.forEach { callback ->
|
||||||
|
callback.value.onRunningTask()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun haveNoRunningTask() {
|
||||||
|
mBusLinesCallbackMap.forEach { callback ->
|
||||||
|
callback.value.onNoRunningTask()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun leaveStationSuccess() {
|
||||||
|
mBusLinesCallbackMap.forEach { map ->
|
||||||
|
map.value.onLeaveStaionSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun arrivedStationSuccess() {
|
||||||
|
LanSocketManager.sendMsgToClient(WriteOffResultMsg(-99, "", "", System.currentTimeMillis(), LineManager.lineInfos?.lineId
|
||||||
|
?: 0, LineManager.getStations()?.first?.siteId?.toLong() ?: 0L))
|
||||||
|
mBusLinesCallbackMap.forEach { callback ->
|
||||||
|
callback.value.onArriveStationSuccess()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun isLastStation(): Boolean? {
|
||||||
|
return if (stationList.isNullOrEmpty()) {
|
||||||
|
null
|
||||||
|
} else {
|
||||||
|
// startStationIndex == stationList!!.size - 1
|
||||||
|
startStationIndex == getLastStationPos(stationList!!)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun getLastStationPos(stationList: MutableList<BusStationBean>): Int {
|
||||||
|
for (index in stationList.indices.reversed()) {
|
||||||
|
val item = stationList[index]
|
||||||
|
if (item.tag != 2) {
|
||||||
|
return index
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return stationList.lastIndex
|
||||||
|
}
|
||||||
|
|
||||||
|
fun isLastStation(end: BusStationBean): Boolean {
|
||||||
|
return if (stationList.isNullOrEmpty()) {
|
||||||
|
false
|
||||||
|
} else {
|
||||||
|
// val last = stationList?.last()
|
||||||
|
val last = stationList!!.reversed().firstOrNull { it.tag != 2 } ?: stationList!!.last()
|
||||||
|
return last == end
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getTaskTime(): String {
|
||||||
|
return DateTimeUtil.formatLongToString(
|
||||||
|
currentTask?.taskStartTime ?: System.currentTimeMillis(),
|
||||||
|
DateTimeUtil.HH_mm
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun endTask(isSlideStop: Boolean) {
|
||||||
|
currentTask?.getLineIdAndName { shiftsId, taskId, taskTime, taskDate ->
|
||||||
|
LineManager.triggerCompleteTask(isSlideStop)
|
||||||
|
RepositoryManager.endTask(shiftsId, taskId)
|
||||||
|
?.subscribeOn(Schedulers.io())
|
||||||
|
?.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
?.subscribe(object : Observer<Boolean> {
|
||||||
|
override fun onSubscribe(d: Disposable) {
|
||||||
|
startTaskDisposable
|
||||||
|
d(TAG, "endTask onSubscribe")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(e: Throwable) {
|
||||||
|
d(TAG, "endTask onError${e.printStackTrace()}")
|
||||||
|
if (e is DataException) {
|
||||||
|
|
||||||
|
}
|
||||||
|
if (RepositoryManager.supportDb()) {
|
||||||
|
isGoingToNextStation = false
|
||||||
|
|
||||||
|
ThirdDeviceData.endTask()
|
||||||
|
ThirdDeviceData.sendTaskDetailsToClients()
|
||||||
|
ShuttleVoiceManager.endOrderBus()
|
||||||
|
// 取消自驾
|
||||||
|
CallerAutoPilotControlManager.cancelAutoPilot()
|
||||||
|
currentTask = null
|
||||||
|
LineManager.setLineInfo(null)
|
||||||
|
LineManager.setStartAndEndStation(null, null)
|
||||||
|
LanSocketManager.sendMsgToClient(WriteOffResultMsg(-99, "", "", System.currentTimeMillis(), LineManager.lineInfos?.lineId
|
||||||
|
?: 0, LineManager.getStations()?.first?.siteId?.toLong()
|
||||||
|
?: 0L))
|
||||||
|
LineModel.callEyeMap(1)
|
||||||
|
stationList = mutableListOf()
|
||||||
|
startStationIndex = 0
|
||||||
|
mBusLinesCallbackMap.forEach {
|
||||||
|
it.value.onCompleteTask()
|
||||||
|
}
|
||||||
|
val changeInfo =
|
||||||
|
"taskId:${currentTask?.taskId}--lineInfo:${LineManager.lineInfos}"
|
||||||
|
OchChainLogManager.writeChainLog("结束任务", changeInfo)
|
||||||
|
} else {
|
||||||
|
// ToastUtils.showShort("结束任务失败请稍后再试")
|
||||||
|
ToastUtils.showShort(R.string.module_och_task_finish_fail)
|
||||||
|
mBusLinesCallbackMap.forEach {
|
||||||
|
it.value.onCompleteTaskFail()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LineManager.lastArrivedSiteId = -1
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onComplete() {
|
||||||
|
d(TAG, "endTask onComplete")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNext(data: Boolean) {
|
||||||
|
d(TAG, "endTask onNext ${data}")
|
||||||
|
if (data) {
|
||||||
|
isGoingToNextStation = false
|
||||||
|
|
||||||
|
ThirdDeviceData.endTask()
|
||||||
|
ThirdDeviceData.sendTaskDetailsToClients()
|
||||||
|
ShuttleVoiceManager.endOrderBus()
|
||||||
|
// 取消自驾
|
||||||
|
CallerAutoPilotControlManager.cancelAutoPilot()
|
||||||
|
currentTask = null
|
||||||
|
LineManager.setLineInfo(null)
|
||||||
|
LineManager.setStartAndEndStation(null, null)
|
||||||
|
LanSocketManager.sendMsgToClient(WriteOffResultMsg(-99, "", "", System.currentTimeMillis(), LineManager.lineInfos?.lineId
|
||||||
|
?: 0, LineManager.getStations()?.first?.siteId?.toLong()
|
||||||
|
?: 0L))
|
||||||
|
stationList = mutableListOf()
|
||||||
|
startStationIndex = 0
|
||||||
|
LineModel.callEyeMap(2)
|
||||||
|
mBusLinesCallbackMap.forEach {
|
||||||
|
it.value.onCompleteTask()
|
||||||
|
}
|
||||||
|
val changeInfo =
|
||||||
|
"taskId:${currentTask?.taskId}--lineInfo:${LineManager.lineInfos}"
|
||||||
|
OchChainLogManager.writeChainLog("结束任务", changeInfo)
|
||||||
|
}
|
||||||
|
LineManager.lastArrivedSiteId = -1
|
||||||
|
onComplete()
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun startTaskMessage(): Boolean {
|
||||||
|
if (!stationList.isNullOrEmpty()) {
|
||||||
|
return startStationIndex == 0 && stationList!!.first().drivingStatus == TaskSiteDataBean.drivingStatusCurrent && !stationList!!.first().isLeaving
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
fun setDemoMode() {
|
||||||
|
// 美化是否开始
|
||||||
|
if (FunctionBuildConfig.isDemoMode) { //行驶过程中设置美化
|
||||||
|
val (startStation, _) = LineManager.getStations()
|
||||||
|
if (startStation != null && startStation.isLeaving) {
|
||||||
|
OrderModel.startBeautificationMode()
|
||||||
|
d(TAG, "美化模式-ignore:置为true(每次滑动出发)")
|
||||||
|
} else if (startStationIndex > 0 && startStationIndex < stationList!!.size - 1) {
|
||||||
|
//美化模式下 中间站点到站 引导线要一直绘制,所以此处不出强制绘制不传false
|
||||||
|
CallerAutoPilotControlManager.setIPCDemoMode(false)
|
||||||
|
d(TAG, "美化模式-ignore:false(到达中间站)")
|
||||||
|
} else {
|
||||||
|
OrderModel.closeBeautificationMode()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun callEyeMap(index: Int) {
|
||||||
|
d(TAG, "执行${index} callEyeMap${stationList?.size}")
|
||||||
|
if (stationList.isNullOrEmpty()) {
|
||||||
|
val ochInfo = OchInfo(1, mutableListOf())
|
||||||
|
ochInfo.siteMarkerList = mutableListOf()
|
||||||
|
CallerDataCenterBizListener.invokeOchInfo(ochInfo)
|
||||||
|
OchChainLogManager.writeChainLogMap("地图", "站点信息:${ochInfo}")
|
||||||
|
CallerEagleBaseFunctionCall4OchManager.updateOrderStatus(false)
|
||||||
|
} else {
|
||||||
|
CallerEagleBaseFunctionCall4OchManager.updateOrderStatus(true)
|
||||||
|
val siteList = mutableListOf<SiteMarkerBean>()
|
||||||
|
var temp: SiteMarkerBean? = null
|
||||||
|
stationList?.let {
|
||||||
|
it.forEachIndexed { index, busStationBean ->
|
||||||
|
if (index == 0) {
|
||||||
|
temp = SiteMarkerBean(Point(busStationBean.gcjLon, busStationBean.gcjLat), R.drawable.unmanned_bus_station_start, 0.5f, 0.87f)
|
||||||
|
} else if (index == it.size - 1) {
|
||||||
|
temp = SiteMarkerBean(Point(busStationBean.gcjLon, busStationBean.gcjLat), R.drawable.unmanned_bus_station_end, 0.5f, 0.87f)
|
||||||
|
} else {
|
||||||
|
if (busStationBean.drivingStatus == 1) {
|
||||||
|
temp = SiteMarkerBean(Point(busStationBean.gcjLon, busStationBean.gcjLat), R.drawable.unmanned_bus_station_pass, 0.5f, 0.478f)
|
||||||
|
} else if (busStationBean.drivingStatus == 3) {
|
||||||
|
temp = SiteMarkerBean(Point(busStationBean.gcjLon, busStationBean.gcjLat), R.drawable.unmanned_bus_station_notarrive, 0.5f, 0.478f)
|
||||||
|
} else if (busStationBean.drivingStatus == 2) {
|
||||||
|
if (busStationBean.isLeaving) {
|
||||||
|
temp = SiteMarkerBean(Point(busStationBean.gcjLon, busStationBean.gcjLat), R.drawable.unmanned_bus_station_pass, 0.5f, 0.478f)
|
||||||
|
} else {
|
||||||
|
temp = SiteMarkerBean(Point(busStationBean.gcjLon, busStationBean.gcjLat), R.drawable.unmanned_bus_station_notarrive, 0.5f, 0.478f)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
temp?.let { temp ->
|
||||||
|
siteList.add(temp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val (start, end) = LineManager.getStations()
|
||||||
|
if (start != null && end != null) {
|
||||||
|
val ochInfo = OchInfo(1, mutableListOf(start.toMogoLocation(), end.toMogoLocation()))
|
||||||
|
ochInfo.siteMarkerList = siteList
|
||||||
|
CallerDataCenterBizListener.invokeOchInfo(ochInfo)
|
||||||
|
OchChainLogManager.writeChainLogMap("地图", "站点信息:${ochInfo}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun endTaskByOther(taskId: Long, plateNumber: String) {
|
||||||
|
if (LoginStatusManager.getOchCarInfo()?.plateNumber == plateNumber) {
|
||||||
|
d(TAG, "当前车辆消耗任务")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
RepositoryManager.endTaskByOther(taskId)
|
||||||
|
mBusLinesCallbackMap.forEach { callback ->
|
||||||
|
callback.value.onEndTaskByOther(taskId, plateNumber)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,570 @@
|
|||||||
|
package com.mogo.och.unmanned.model
|
||||||
|
|
||||||
|
import android.annotation.SuppressLint
|
||||||
|
import android.content.Context
|
||||||
|
import android.text.TextUtils
|
||||||
|
import com.mogo.commons.AbsMogoApplication
|
||||||
|
import com.mogo.commons.module.status.MogoStatusManager
|
||||||
|
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||||
|
import com.mogo.eagle.core.function.api.autopilot.IMoGoAutopilotStatusListener
|
||||||
|
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotControlManager
|
||||||
|
import com.mogo.eagle.core.function.call.autopilot.CallerAutoPilotStatusListenerManager
|
||||||
|
import com.mogo.eagle.core.function.call.setting.CallerSopSettingManager
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.e
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||||
|
import com.mogo.eagle.core.utilcode.util.CoordinateUtils
|
||||||
|
import com.mogo.eagle.core.utilcode.util.StringUtils
|
||||||
|
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||||
|
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||||
|
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||||
|
import com.mogo.och.bridge.autopilot.autopilot.IOchAutopilotStatusListener
|
||||||
|
import com.mogo.och.bridge.autopilot.autopilot.OchAutoPilotStatusListenerManager
|
||||||
|
import com.mogo.och.bridge.autopilot.autopilot.bean.ArrivedStation
|
||||||
|
import com.mogo.och.bridge.autopilot.line.ILineCallback
|
||||||
|
import com.mogo.och.bridge.autopilot.line.LineManager
|
||||||
|
import com.mogo.och.bridge.autopilot.location.OchLocationManager
|
||||||
|
import com.mogo.och.common.module.biz.birdge.BridgeListener
|
||||||
|
import com.mogo.och.common.module.biz.birdge.BridgeManager
|
||||||
|
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||||
|
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||||
|
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||||
|
import com.mogo.och.common.module.manager.loop.LoopInfo
|
||||||
|
import com.mogo.och.common.module.manager.socket.cloud.OCHSocketMessageManager
|
||||||
|
import com.mogo.och.common.module.manager.socket.lan.LedScreenManager
|
||||||
|
import com.mogo.och.common.module.manager.transform.OchTransform
|
||||||
|
import com.mogo.och.common.module.manager.transform.OchTransformDispatch
|
||||||
|
import com.mogo.och.common.module.map.MapMakerManager
|
||||||
|
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||||
|
import com.mogo.och.common.module.utils.OCHThreadPoolManager
|
||||||
|
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||||
|
import com.mogo.och.common.module.utils.RxUtils
|
||||||
|
import com.mogo.och.shuttle.unmanned.R
|
||||||
|
import com.mogo.och.unmanned.constant.BusConst
|
||||||
|
import com.mogo.och.unmanned.repository.RepositoryManager
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.TaskSiteDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.exception.DataException
|
||||||
|
import com.mogo.och.unmanned.util.BusTrajectoryManager
|
||||||
|
import com.mogo.och.unmanned.util.ShuttleVoiceManager
|
||||||
|
import io.reactivex.Observer
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
|
import io.reactivex.disposables.Disposable
|
||||||
|
import io.reactivex.schedulers.Schedulers
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2021/3/23
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* 小巴订单管理
|
||||||
|
*/
|
||||||
|
@SuppressLint("StaticFieldLeak")
|
||||||
|
object OrderModel {
|
||||||
|
private val TAG: String = M_BUS + OrderModel::class.java.simpleName
|
||||||
|
|
||||||
|
private var mContext: Context? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用来表示是否正在开往下一站
|
||||||
|
*/
|
||||||
|
@JvmStatic
|
||||||
|
var isGoingToNextStation: Boolean = false
|
||||||
|
|
||||||
|
@Volatile
|
||||||
|
private var isArrivedStation = false
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun init() {
|
||||||
|
mContext = AbsMogoApplication.getApp()
|
||||||
|
|
||||||
|
ThirdDeviceData.init()
|
||||||
|
|
||||||
|
// 加载核销模块
|
||||||
|
TicketModel.load()
|
||||||
|
|
||||||
|
OchAutoPilotStatusListenerManager.addListener(TAG, ochAutopilotStatusListener)
|
||||||
|
|
||||||
|
BridgeManager.addBridgeListener(TAG, bridgeListener)
|
||||||
|
|
||||||
|
LineManager.addListener(TAG, arriveStationBySearch)
|
||||||
|
|
||||||
|
OchTransform.addListener(TAG, ochTransform)
|
||||||
|
|
||||||
|
RxUtils.errCatch()
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun release() {
|
||||||
|
// 注销定位监听
|
||||||
|
|
||||||
|
mContext = null
|
||||||
|
|
||||||
|
ThirdDeviceData.release()
|
||||||
|
|
||||||
|
TicketModel.release()
|
||||||
|
|
||||||
|
OchAutoPilotStatusListenerManager.removeListener(TAG)
|
||||||
|
BridgeManager.removeBridgeListener(LineModel.TAG)
|
||||||
|
|
||||||
|
LineManager.removeListener(TAG)
|
||||||
|
OchTransform.removeListener(TAG)
|
||||||
|
}
|
||||||
|
|
||||||
|
private val bridgeListener = object : BridgeListener {
|
||||||
|
override fun onPncInfoListener(pncAction: String) {
|
||||||
|
if (TextUtils.equals(pncAction, StringUtils.getString(R.string.module_core_entering_the_station))) {
|
||||||
|
ShuttleVoiceManager.arrivedStationOut(ResourcesUtils.getString(R.string.unmanned_bus_voice_out_arriving_station))
|
||||||
|
}
|
||||||
|
// when (pncAction) {
|
||||||
|
// OchCommonConst.PNC_ACTION_ENTERSTATION -> {
|
||||||
|
// ShuttleVoiceManager.arrivedStationOut(ResourcesUtils.getString(R.string.m2_voice_out_arriving_station))
|
||||||
|
// }
|
||||||
|
// else -> {}
|
||||||
|
// }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val ochAutopilotStatusListener = object : IOchAutopilotStatusListener {
|
||||||
|
override fun onAutopilotArriveAtStation(arrivedStation: ArrivedStation?) {
|
||||||
|
e(TAG, "行程日志-onAutopilotArriveAtStation arrive")
|
||||||
|
onArriveAt(arrivedStation, "底盘触发进站")
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private val ochTransform = object : OchTransformDispatch {
|
||||||
|
override fun logout() {
|
||||||
|
logoutInner()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 自车定位
|
||||||
|
private val arriveStationBySearch = object : ILineCallback {
|
||||||
|
override fun arrivedStationSuccessBySearch() {
|
||||||
|
//是否到站的围栏判断 离站状态并且自动驾驶还未触发到站
|
||||||
|
if (isGoingToNextStation && !isArrivedStation) {
|
||||||
|
OCHThreadPoolManager.getsInstance().locationExecute {
|
||||||
|
onArriveAt(null, "兜底:距离站点15m内 每秒钟向底盘查询是否到站 底盘返回")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun sendStartAutopilotSuccessAck() {
|
||||||
|
//底盘收到启动自驾的回执
|
||||||
|
BizLoopManager.setLoopFunction(TAG, LoopInfo(2, ::calculateDistanceAndAutoStatus, scheduler = Schedulers.io()))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 在站点15m内且启动自动驾驶成功后播报,每次启动仅播报1次
|
||||||
|
private fun calculateDistanceAndAutoStatus() {
|
||||||
|
val (start, _) = LineManager.getStations()
|
||||||
|
if (start == null) {
|
||||||
|
BizLoopManager.removeLoopFunction(TAG)
|
||||||
|
} else {
|
||||||
|
val startLon = start.gcjLon
|
||||||
|
val startLat = start.gcjLat
|
||||||
|
val mogoLocation = OchLocationManager.getGCJ02Location()
|
||||||
|
val distance = CoordinateUtils.calculateLineDistance(
|
||||||
|
startLon, startLat,
|
||||||
|
mogoLocation.longitude, mogoLocation.latitude
|
||||||
|
)
|
||||||
|
if (distance < BusConst.SEND_OUTVOICE_DISTANCES_TARTSTATIONE) {
|
||||||
|
if (OchAutoPilotStatusListenerManager.autopilotState == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING) {
|
||||||
|
ShuttleVoiceManager.arrivedStationOut(ResourcesUtils.getString(R.string.unmanned_bus_voice_out_autopilot_start_in15m))
|
||||||
|
BizLoopManager.removeLoopFunction(TAG)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
BizLoopManager.removeLoopFunction(TAG)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询小巴路线
|
||||||
|
*/
|
||||||
|
@JvmStatic
|
||||||
|
fun queryBusRoutes() {
|
||||||
|
d(TAG, "查询小巴路线")
|
||||||
|
RepositoryManager.loadCurrentTaskInfo()
|
||||||
|
?.subscribeOn(Schedulers.io())
|
||||||
|
?.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
?.subscribe(object : Observer<Boolean> {
|
||||||
|
override fun onSubscribe(d: Disposable) {
|
||||||
|
d(TAG, "queryBusRoutes onSubscribe")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(e: Throwable) {
|
||||||
|
e.printStackTrace()
|
||||||
|
d(TAG, "queryBusRoutes onError${e.printStackTrace()}")
|
||||||
|
e.printStackTrace()
|
||||||
|
LineModel.haveNoRunningTask()
|
||||||
|
d(TAG, "queryBusRoutes 获取到小巴路线数据:空 ")
|
||||||
|
LineManager.setLineInfo(null)
|
||||||
|
updateBusStatus()
|
||||||
|
closeBeautificationMode()
|
||||||
|
removeTipRunnables()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onComplete() {
|
||||||
|
d(TAG, "queryBusRoutes onComplete")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNext(data: Boolean) {
|
||||||
|
if (data) {
|
||||||
|
MogoStatusManager.getInstance().setShuttleDriverPerformTask(TAG, true)
|
||||||
|
LineModel.haveRunningTask()
|
||||||
|
updateBusStatus()
|
||||||
|
} else {
|
||||||
|
MogoStatusManager.getInstance().setShuttleDriverPerformTask(TAG, false)
|
||||||
|
LineModel.haveNoRunningTask()
|
||||||
|
d(TAG, "queryBusRoutes 获取到小巴路线数据:空 ")
|
||||||
|
LineManager.setLineInfo(null)
|
||||||
|
updateBusStatus()
|
||||||
|
closeBeautificationMode()
|
||||||
|
removeTipRunnables()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置路线站点状态--结束路线,当前路线恢复到始发站
|
||||||
|
* @param isSlideStop true:单程结束(订单完成正常滑动结束) false:订单未完成结束(点击结束按钮结束)
|
||||||
|
*/
|
||||||
|
@JvmStatic
|
||||||
|
fun completeTask(isSlideStop: Boolean) {
|
||||||
|
OCHThreadPoolManager.getsInstance().execute {
|
||||||
|
d(TAG, "结束当前路线abortTask")
|
||||||
|
removeTipRunnables()
|
||||||
|
LineModel.endTask(isSlideStop)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun onStartAutopilot() {
|
||||||
|
//开启自动驾驶 2.10.0: 如果自动驾驶状态下开启, 非自动驾驶状态下不开启,需手动点击自动驾驶按钮开启
|
||||||
|
isGoingToNextStation = true
|
||||||
|
if (CallerAutoPilotStatusListenerManager.getState() == IMoGoAutopilotStatusListener.STATUS_AUTOPILOT_RUNNING
|
||||||
|
) {
|
||||||
|
LineManager.startAutopilot(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
fun startBeautificationMode() {
|
||||||
|
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = true
|
||||||
|
CallerAutoPilotControlManager.setIgnoreConditionDraw(true)
|
||||||
|
CallerAutoPilotControlManager.setIPCDemoMode(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 关闭美化模式
|
||||||
|
*/
|
||||||
|
@JvmStatic
|
||||||
|
fun closeBeautificationMode() {
|
||||||
|
if (FunctionBuildConfig.isDemoMode) { //收车结束美化
|
||||||
|
FunctionBuildConfig.isIgnoreConditionsDrawAutopilotTrajectoryData = false //是否强制绘制引导线
|
||||||
|
CallerAutoPilotControlManager.setIgnoreConditionDraw(false) // 同步给乘客屏
|
||||||
|
CallerAutoPilotControlManager.setIPCDemoMode(false) //是否自动启动自驾
|
||||||
|
d(TAG, "美化模式-ignore:置为false")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 滑动出发
|
||||||
|
*/
|
||||||
|
@JvmStatic
|
||||||
|
fun driveToNextStation() {
|
||||||
|
if (LineModel.isLastStation() == true) {
|
||||||
|
// 当前站是最后一站,结束当前行程
|
||||||
|
completeTask(true)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
LineManager.getStations().first?.let { startStation ->
|
||||||
|
startStation.drivingStatus = TaskSiteDataBean.drivingStatusCurrent
|
||||||
|
startStation.isLeaving = true
|
||||||
|
LineModel.currentTask?.let { task ->
|
||||||
|
RepositoryManager.leaveStation(
|
||||||
|
startStation.seq,
|
||||||
|
startStation.siteId.toLong(),
|
||||||
|
task.shiftsId ?: 0L,
|
||||||
|
task.taskId ?: 0L,
|
||||||
|
task.lineId ?: 0L,
|
||||||
|
task.taskStartTime ?: System.currentTimeMillis(),
|
||||||
|
task.taskDate ?: 0L
|
||||||
|
)
|
||||||
|
?.subscribeOn(Schedulers.io())
|
||||||
|
?.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
?.subscribe(object : Observer<Boolean> {
|
||||||
|
override fun onSubscribe(d: Disposable) {
|
||||||
|
d(TAG, "driveToNextStation onSubscribe")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(e: Throwable) {
|
||||||
|
d(TAG, "driveToNextStation onError${e.printStackTrace()}")
|
||||||
|
if (e is DataException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
LineModel.leaveStationSuccess()
|
||||||
|
isArrivedStation = false
|
||||||
|
onStartAutopilot()
|
||||||
|
|
||||||
|
ThirdDeviceData.leaveStation()
|
||||||
|
|
||||||
|
updateBusStatus()
|
||||||
|
|
||||||
|
LineModel.callEyeMap(3)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onComplete() {
|
||||||
|
d(TAG, "onComplete")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNext(data: Boolean) {
|
||||||
|
d(TAG, "driveToNextStation onComplete")
|
||||||
|
if (data) {
|
||||||
|
LineModel.leaveStationSuccess()
|
||||||
|
isArrivedStation = false
|
||||||
|
onStartAutopilot()
|
||||||
|
|
||||||
|
ThirdDeviceData.leaveStation()
|
||||||
|
|
||||||
|
updateBusStatus()
|
||||||
|
LineModel.callEyeMap(4)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 渲染站点信息
|
||||||
|
* 服务端返回的OchBusRoutesResult逻辑, 离开站为当前站, 到达下一站后才会将下一站置为当前站,
|
||||||
|
* 车机端展示 三站: 中间为即将到到达或者刚到达的站
|
||||||
|
* queryBusRoutes
|
||||||
|
* queryBusRoutes
|
||||||
|
* queryBusRoutes
|
||||||
|
* driveToNextStation
|
||||||
|
* onArriveAt
|
||||||
|
*/
|
||||||
|
private fun updateBusStatus() {
|
||||||
|
val (startStation, endStation) = LineManager.getStations()
|
||||||
|
if (startStation != null && endStation != null) {
|
||||||
|
if (startStation.isLeaving) {// 出发需要移除
|
||||||
|
MapMakerManager.removeMapMaker(BusConst.BUS_START_MAP_MAKER, startStation.lat, startStation.lon)
|
||||||
|
} else {// 为出发展示
|
||||||
|
MapMakerManager.addMapMaker(TAG, BusConst.BUS_START_MAP_MAKER, startStation.lat, startStation.lon, R.raw.star_marker)
|
||||||
|
}
|
||||||
|
MapMakerManager.addMapMaker(TAG, BusConst.BUS_END_MAP_MAKER, endStation.lat, endStation.lon, R.raw.end_marker)
|
||||||
|
} else {
|
||||||
|
MapMakerManager.removeAllMapMarkerByOwner(TAG)
|
||||||
|
}
|
||||||
|
|
||||||
|
LineModel.stationList?.let {
|
||||||
|
if (LineModel.startTaskMessage()) { //默认是第一站到站查询
|
||||||
|
LineManager.lineInfos?.lineName?.let { lineName ->
|
||||||
|
LedScreenManager.sendTripInfo2Led(
|
||||||
|
LedScreenManager.START_TRIP,
|
||||||
|
lineName, "", "", false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
//任务选择后首发前给司机提示任务
|
||||||
|
beforeTaskTips()
|
||||||
|
} else {
|
||||||
|
removeTipRunnables()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
LineModel.setDemoMode()
|
||||||
|
|
||||||
|
LineManager.getStartStation {
|
||||||
|
isGoingToNextStation = it.isLeaving
|
||||||
|
}
|
||||||
|
|
||||||
|
ThirdDeviceData.sendTaskDetailsToClients()
|
||||||
|
|
||||||
|
//需放在currentStationIndex赋值之后
|
||||||
|
BusTrajectoryManager.syncTrajectoryInfo()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun beforeTaskTips() {
|
||||||
|
if (LineModel.currentTask == null) return
|
||||||
|
|
||||||
|
removeTipRunnables()
|
||||||
|
|
||||||
|
val taskTime = LineModel.currentTask!!.taskStartTime ?: return
|
||||||
|
val tip3Time = taskTime - 3 * 60 * 1000 - DateTimeUtil.getCurrentTimeStamp() // 首站离开前3分钟提示
|
||||||
|
val tip1Time = taskTime - 60 * 1000 - DateTimeUtil.getCurrentTimeStamp() // 首站离开前1分钟提示
|
||||||
|
|
||||||
|
if (tip3Time > 0) {
|
||||||
|
UiThreadHandler.postDelayed(tip3Runnable, tip3Time)
|
||||||
|
}
|
||||||
|
|
||||||
|
if (tip1Time > 0) {
|
||||||
|
UiThreadHandler.postDelayed(tip1Runnable, tip1Time)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var tip3Runnable = Runnable {
|
||||||
|
|
||||||
|
if (LineModel.startTaskMessage()) {
|
||||||
|
tipStartTask("3")
|
||||||
|
} else {
|
||||||
|
removeTipRunnables()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private var tip1Runnable = Runnable {
|
||||||
|
if (LineModel.startTaskMessage()) {
|
||||||
|
tipStartTask("1")
|
||||||
|
} else {
|
||||||
|
removeTipRunnables()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun tipStartTask(s: String) {
|
||||||
|
val tips = ResourcesUtils.getString(R.string.unmanned_bus_before_tips_s, s)
|
||||||
|
//展示在运营消息
|
||||||
|
OCHSocketMessageManager.pushAppOperationalMsgBox(
|
||||||
|
DateTimeUtil.getCurrentTimeStamp(),
|
||||||
|
tips, OCHSocketMessageManager.OPERATION_SYSTEM
|
||||||
|
)
|
||||||
|
ShuttleVoiceManager.showLeafTime(tips)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun removeTipRunnables() {
|
||||||
|
UiThreadHandler.removeCallbacks(tip3Runnable)
|
||||||
|
UiThreadHandler.removeCallbacks(tip1Runnable)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 到站
|
||||||
|
*
|
||||||
|
* @param data
|
||||||
|
*/
|
||||||
|
@JvmStatic
|
||||||
|
fun onArriveAt(data: ArrivedStation?, type: String) {
|
||||||
|
if (LineManager.getStations().second == null) {
|
||||||
|
e(TAG, "行程日志-到站异常,取消后续操作结束")
|
||||||
|
OchChainLogManager.writeChainLog("shuttle弱网", "$type 行程日志-到站异常,取消后续操作结束")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
if (data != null) {
|
||||||
|
d(TAG, "地盘到站${data}")
|
||||||
|
}
|
||||||
|
|
||||||
|
//MAP 280 每隔100ms左右返回一次到站, 导致在到达中间站后再次滑动出发后会有时间差,收到一次到站,出现问题
|
||||||
|
//此处比对 自驾告诉的到站站点坐标和本地应到站站点坐标, 一致时才能到站
|
||||||
|
LineManager.getStations { start, end ->
|
||||||
|
|
||||||
|
if (isArrivedStation || end.siteId == LineManager.lastArrivedSiteId) return@getStations
|
||||||
|
|
||||||
|
OchChainLogManager.writeChainLog("触发进站", type)
|
||||||
|
LineManager.lastArrivedSiteId = end.siteId
|
||||||
|
isArrivedStation = true
|
||||||
|
isGoingToNextStation = false
|
||||||
|
start.drivingStatus = TaskSiteDataBean.drivingStatusPassed
|
||||||
|
start.isLeaving = false
|
||||||
|
end.drivingStatus = TaskSiteDataBean.drivingStatusCurrent
|
||||||
|
RepositoryManager.arriveStation(end.seq, end.siteId.toLong(), LineModel.currentTask?.taskId
|
||||||
|
?: 0L)
|
||||||
|
?.subscribeOn(Schedulers.io())
|
||||||
|
?.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
?.subscribe(object : Observer<Boolean> {
|
||||||
|
override fun onSubscribe(d: Disposable) {
|
||||||
|
d(TAG, "onSubscribe")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(e: Throwable) {
|
||||||
|
d(TAG, "onError${e.printStackTrace()}")
|
||||||
|
if (e is DataException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
ThirdDeviceData.arriveStation()
|
||||||
|
d(TAG, "arrivedStation onComplete")
|
||||||
|
LineModel.stationList?.let {
|
||||||
|
//此处始发站应为上段路程的终点站
|
||||||
|
LineModel.startStationIndex = LineModel.nextStationIndex
|
||||||
|
val startStation = LineManager.getStations().second
|
||||||
|
if (LineModel.startStationIndex + 1 < it.size) {
|
||||||
|
//遍历当前路段起始点之后的数组,第一个正常停靠点即为该段终点
|
||||||
|
val subStationList = it.subList(LineModel.startStationIndex + 1, it.size)
|
||||||
|
val endStation = subStationList.firstOrNull { bean ->
|
||||||
|
bean.tag != 2
|
||||||
|
}
|
||||||
|
LineModel.nextStationIndex = it.indexOf(endStation)
|
||||||
|
// val endStation = stationlist[LineModel.startStationIndex + 1]
|
||||||
|
LineManager.setStartAndEndStation(startStation, endStation)
|
||||||
|
LineModel.callEyeMap(5)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LineModel.arrivedStationSuccess()
|
||||||
|
updateBusStatus()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onComplete() {
|
||||||
|
ThirdDeviceData.arriveStation()
|
||||||
|
d(TAG, "arrivedStation onComplete")
|
||||||
|
LineModel.stationList?.let {
|
||||||
|
//此处始发站应为上段路程的终点站
|
||||||
|
LineModel.startStationIndex = LineModel.nextStationIndex
|
||||||
|
val startStation = LineManager.getStations().second
|
||||||
|
if (LineModel.startStationIndex + 1 < it.size) {
|
||||||
|
//遍历当前路段起始点之后的数组,第一个正常停靠点即为该段终点
|
||||||
|
val subStationList = it.subList(LineModel.startStationIndex + 1, it.size)
|
||||||
|
val endStation = subStationList.firstOrNull { bean ->
|
||||||
|
bean.tag != 2
|
||||||
|
}
|
||||||
|
LineModel.nextStationIndex = it.indexOf(endStation)
|
||||||
|
// val endStation = stationlist[LineModel.startStationIndex + 1]
|
||||||
|
LineManager.setStartAndEndStation(startStation, endStation)
|
||||||
|
LineModel.callEyeMap(6)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
LineModel.arrivedStationSuccess()
|
||||||
|
updateBusStatus()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNext(data: Boolean) {
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 登出
|
||||||
|
@JvmStatic
|
||||||
|
fun logoutInner() {
|
||||||
|
ThreadUtils.getIoPool().execute {
|
||||||
|
try {
|
||||||
|
if (RepositoryManager.haveDataWaitSyn()) {
|
||||||
|
ToastUtils.showShort(ResourcesUtils.getString(R.string.unmanned_shuttle_logout_error))
|
||||||
|
return@execute
|
||||||
|
}
|
||||||
|
if (RepositoryManager.haveRunningTask()) {
|
||||||
|
ToastUtils.showShort(ResourcesUtils.getString(R.string.unmanned_shuttle_logout_error_running))
|
||||||
|
return@execute
|
||||||
|
}
|
||||||
|
} catch (e: Exception) {
|
||||||
|
OchChainLogManager.writeChainLog("错误", "${e.message}")
|
||||||
|
}
|
||||||
|
MogoStatusManager.getInstance().setShuttleDriverPerformTask(TAG, false)
|
||||||
|
MogoStatusManager.getInstance().setTaxiUnmanedDriverLineRoutingVerifyMode(TAG, false)
|
||||||
|
CallerSopSettingManager.invokeRoutingListener(false)
|
||||||
|
MapMakerManager.removeAllMapMarkerByOwner(TAG)
|
||||||
|
LineManager.lastArrivedSiteId = -1
|
||||||
|
BusTrajectoryManager.stopTrajReqLoop()
|
||||||
|
LoginStatusManager.loginOut()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,197 @@
|
|||||||
|
package com.mogo.och.unmanned.model
|
||||||
|
|
||||||
|
import com.mogo.commons.AbsMogoApplication
|
||||||
|
import com.mogo.commons.storage.SharedPrefsMgr
|
||||||
|
import com.mogo.eagle.core.network.utils.digest.DigestUtils
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
|
||||||
|
import com.mogo.eagle.core.utilcode.util.NetworkUtils
|
||||||
|
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||||
|
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||||
|
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||||
|
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||||
|
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||||
|
import com.mogo.och.common.module.utils.RxUtils
|
||||||
|
import com.mogo.och.shuttle.unmanned.R
|
||||||
|
import com.mogo.och.unmanned.bean.response.CarExecutableTaskResponse
|
||||||
|
import com.mogo.och.unmanned.bean.response.PointResponse
|
||||||
|
import com.mogo.och.unmanned.repository.RepositoryManager
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.PointDb
|
||||||
|
import io.reactivex.Observer
|
||||||
|
import io.reactivex.disposables.Disposable
|
||||||
|
import io.reactivex.schedulers.Schedulers
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean
|
||||||
|
|
||||||
|
object SynchDataModel {
|
||||||
|
|
||||||
|
private const val TAG = "SynchDataModel"
|
||||||
|
|
||||||
|
private val isRequesting = AtomicBoolean(false)
|
||||||
|
|
||||||
|
// 展示上一次刷新时间
|
||||||
|
const val EXECUTABLECHANGETIME = "executablechangetime"
|
||||||
|
|
||||||
|
private var queryCarInfo: Disposable? = null
|
||||||
|
|
||||||
|
// 判断接口是否变化
|
||||||
|
private const val EXECUTABLECHANGEMD5 = "EXECUTABLECHANGEMD5"
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步基础信息
|
||||||
|
*/
|
||||||
|
fun queryCarExecutableTaskList(isBackground: Boolean) {
|
||||||
|
RxUtils.disposeSubscribe(queryCarInfo)
|
||||||
|
if (isRequesting.get()) {
|
||||||
|
d(TAG, "正在同步请稍等")
|
||||||
|
val lastUpdateTime = SharedPrefsMgr.getInstance().getLong(EXECUTABLECHANGETIME, 0)
|
||||||
|
LineModel.getBusLinesCallbackMap().forEach { callback ->
|
||||||
|
callback.value.onRefreshSuccess(lastUpdateTime)
|
||||||
|
}
|
||||||
|
return
|
||||||
|
}
|
||||||
|
isRequesting.set(true)
|
||||||
|
d(TAG, "开始同步数据")
|
||||||
|
RepositoryManager.queryCarExecutableTaskList(
|
||||||
|
object : OchCommonServiceCallback<CarExecutableTaskResponse> {
|
||||||
|
override fun onSuccess(data: CarExecutableTaskResponse) {
|
||||||
|
isRequesting.set(false)
|
||||||
|
i(TAG, "查询路线和站点的数据为:${data.data}")
|
||||||
|
RxUtils.disposeSubscribe(queryCarInfo)
|
||||||
|
queryCarInfo = RxUtils.createSubscribe(60_000) {
|
||||||
|
queryCarExecutableTaskList(true)
|
||||||
|
}
|
||||||
|
// 第一次过滤 请求返回值的md5
|
||||||
|
val currentRequest = DigestUtils.md5Hex(data.data.toString())
|
||||||
|
val lastChangeMd5 = SharedPrefsMgr.getInstance().getString(EXECUTABLECHANGEMD5)
|
||||||
|
val lastUpdateTime = SharedPrefsMgr.getInstance().getLong(EXECUTABLECHANGETIME, 0)
|
||||||
|
val currentTimeStamp = DateTimeUtil.getCurrentTimeStamp()
|
||||||
|
|
||||||
|
SharedPrefsMgr.getInstance().putLong(EXECUTABLECHANGETIME, currentTimeStamp)
|
||||||
|
val sameDay = DateTimeUtil.isSameDay(currentTimeStamp, lastUpdateTime)
|
||||||
|
LineModel.getBusLinesCallbackMap().forEach { callback ->
|
||||||
|
callback.value.onRefreshSuccess(currentTimeStamp)
|
||||||
|
}
|
||||||
|
if (isBackground) {
|
||||||
|
if (currentRequest == lastChangeMd5 && sameDay) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
SharedPrefsMgr.getInstance().putString(EXECUTABLECHANGEMD5, currentRequest)
|
||||||
|
OchChainLogManager.writeChainLog(
|
||||||
|
"数据发生变化",
|
||||||
|
"接口信息发生变化 $lastChangeMd5 new md5${currentRequest}"
|
||||||
|
)
|
||||||
|
val startTime = System.currentTimeMillis()
|
||||||
|
CarExecutableTaskResponse.save2Db(data)
|
||||||
|
d(TAG, "更新数据耗时${System.currentTimeMillis() - startTime}")
|
||||||
|
RxUtils.createSubscribe(800) {
|
||||||
|
// 等待写入数据库
|
||||||
|
LineModel.getBusLinesCallbackMap().forEach { callback ->
|
||||||
|
callback.value.onRefreshSuccessWIthData()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError() {
|
||||||
|
isRequesting.set(false)
|
||||||
|
d(TAG, "同步数据失败 onError")
|
||||||
|
RxUtils.disposeSubscribe(queryCarInfo)
|
||||||
|
queryCarInfo = RxUtils.createSubscribe(60_000) {
|
||||||
|
queryCarExecutableTaskList(true)
|
||||||
|
}
|
||||||
|
if (!isBackground) {
|
||||||
|
if (!NetworkUtils.isConnected(AbsMogoApplication.getApp())) {
|
||||||
|
ToastUtils.showShort(ResourcesUtils.getString(R.string.network_error_tip))
|
||||||
|
} else {
|
||||||
|
ToastUtils.showShort(ResourcesUtils.getString(R.string.request_error_tip))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onFail(code: Int, failMsg: String) {
|
||||||
|
isRequesting.set(false)
|
||||||
|
d(TAG, "同步数据失败 onFail")
|
||||||
|
RxUtils.disposeSubscribe(queryCarInfo)
|
||||||
|
queryCarInfo = RxUtils.createSubscribe(60_000) {
|
||||||
|
queryCarExecutableTaskList(true)
|
||||||
|
}
|
||||||
|
if (!isBackground) {
|
||||||
|
if (!NetworkUtils.isConnected(AbsMogoApplication.getApp())) {
|
||||||
|
// ToastUtils.showShort("网络异常,请稍后重试")
|
||||||
|
ToastUtils.showShort(R.string.module_och_network_error)
|
||||||
|
} else {
|
||||||
|
ToastUtils.showShort(failMsg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
private val waitSysData = mutableSetOf<Long>()
|
||||||
|
private val isRequestingContrainInfo = AtomicBoolean(false)
|
||||||
|
|
||||||
|
|
||||||
|
fun synContraiInfo(needUpdatePoint: MutableList<Long>) {
|
||||||
|
waitSysData.addAll(needUpdatePoint)
|
||||||
|
if (isRequestingContrainInfo.get()) {
|
||||||
|
// 正在请求
|
||||||
|
OchChainLogManager.writeChainLogNet(false, "同步轨迹", "正在同步轨迹请稍等 ")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
isRequestingContrainInfo.set(true)
|
||||||
|
|
||||||
|
val lines = mutableListOf<Long>()
|
||||||
|
waitSysData.forEach {
|
||||||
|
lines.add(it)
|
||||||
|
}
|
||||||
|
OchChainLogManager.writeChainLogNet(false, "同步轨迹", "轨迹变更需同步禁行点和途径点 线路:${lines}")
|
||||||
|
RepositoryManager.queryPointFromNet(lines)
|
||||||
|
?.subscribeOn(Schedulers.io())
|
||||||
|
?.observeOn(Schedulers.io())
|
||||||
|
?.subscribe(object : Observer<List<PointResponse>> {
|
||||||
|
override fun onSubscribe(d: Disposable) {
|
||||||
|
d(TAG, "queryPointsByLinesId onSubscribe")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(e: Throwable) {
|
||||||
|
d(TAG, "同步轨迹 onError${e.printStackTrace()} 同步轨迹失败 5s种后重试 线路:${lines}")
|
||||||
|
OchChainLogManager.writeChainLogNet(false, "同步轨迹", "同步轨迹失败 5s种后重试 线路:${lines}")
|
||||||
|
RxUtils.createSubscribe(5_000) {
|
||||||
|
synContraiInfo(needUpdatePoint)
|
||||||
|
}
|
||||||
|
isRequestingContrainInfo.set(false)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onComplete() {
|
||||||
|
d(TAG, "endTask onComplete")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNext(data: List<PointResponse>) {
|
||||||
|
try {
|
||||||
|
i(TAG, "途经点和轨迹信息为:${data}")
|
||||||
|
PointDb.addOrUpdate(data)
|
||||||
|
for (datum in data) {
|
||||||
|
waitSysData.remove(datum.lineId)
|
||||||
|
}
|
||||||
|
isRequestingContrainInfo.set(false)
|
||||||
|
if (waitSysData.isNotEmpty()) {
|
||||||
|
synContraiInfo(needUpdatePoint)
|
||||||
|
}
|
||||||
|
OchChainLogManager.writeChainLogNet(false, "同步轨迹", "网络请求重构 轨迹信息${data}")
|
||||||
|
d(TAG, "同步轨迹网络成功")
|
||||||
|
} catch (e: Exception) {
|
||||||
|
isRequestingContrainInfo.set(false)
|
||||||
|
OchChainLogManager.writeChainLogDb("同步轨迹", "同步轨迹时报错 轨迹信息${data} 错误信息${e.message}")
|
||||||
|
synContraiInfo(needUpdatePoint)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
fun release() {
|
||||||
|
isRequesting.set(false)
|
||||||
|
RxUtils.disposeSubscribe(queryCarInfo)
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,198 @@
|
|||||||
|
package com.mogo.och.unmanned.model
|
||||||
|
|
||||||
|
import com.mogo.commons.AbsMogoApplication
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||||
|
import com.mogo.eagle.core.utilcode.util.GsonUtils
|
||||||
|
import com.mogo.eagle.core.utilcode.util.StringUtils
|
||||||
|
import com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||||
|
import com.mogo.och.bridge.autopilot.line.LineManager
|
||||||
|
import com.mogo.och.bridge.distance.IDistanceListener
|
||||||
|
import com.mogo.och.bridge.distance.TrajectoryAndDistanceManager
|
||||||
|
import com.mogo.och.common.module.biz.birdge.BridgeListener
|
||||||
|
import com.mogo.och.common.module.biz.birdge.BridgeManager
|
||||||
|
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||||
|
import com.mogo.och.common.module.manager.socket.cloud.AbnormalFactorsLoopManager
|
||||||
|
import com.mogo.och.common.module.manager.socket.cloud.OCHSocketMessageManager
|
||||||
|
import com.mogo.och.common.module.manager.socket.cloud.action.OperateAction
|
||||||
|
import com.mogo.och.common.module.manager.socket.lan.ILanMessageListener
|
||||||
|
import com.mogo.och.common.module.manager.socket.lan.LanSocketManager
|
||||||
|
import com.mogo.och.common.module.manager.socket.lan.LedScreenManager
|
||||||
|
import com.mogo.och.common.module.manager.socket.lan.bean.BusinessType
|
||||||
|
import com.mogo.och.common.module.manager.socket.lan.bean.DPMsgType
|
||||||
|
import com.mogo.och.common.module.manager.socket.lan.bean.TaskDetailsMsg
|
||||||
|
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||||
|
import com.mogo.och.data.bean.BusRoutesResult
|
||||||
|
import com.mogo.och.data.bean.BusTransferData
|
||||||
|
import com.mogo.och.shuttle.unmanned.R
|
||||||
|
import com.mogo.och.unmanned.action.TaskUsedAction
|
||||||
|
import com.mogo.och.unmanned.constant.BusConst
|
||||||
|
import com.mogo.och.unmanned.util.ShuttleVoiceManager
|
||||||
|
|
||||||
|
object ThirdDeviceData {
|
||||||
|
|
||||||
|
const val TAG = M_BUS + "ThirdDeviceData"
|
||||||
|
|
||||||
|
@JvmStatic
|
||||||
|
val busRoutesResult: BusRoutesResult = BusRoutesResult()
|
||||||
|
|
||||||
|
private val bridgeListener: BridgeListener = object : BridgeListener {
|
||||||
|
override fun onCollisionRisk() {
|
||||||
|
ShuttleVoiceManager.collisionRisk()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private val trajectoryListener: IDistanceListener = object : IDistanceListener {
|
||||||
|
override fun distanceCallback(distance: Float) {
|
||||||
|
// 小于200m 播报站点介绍
|
||||||
|
if (distance < 200) {
|
||||||
|
LineManager.getStations { start, end ->
|
||||||
|
if (!end.isPlayTts) {
|
||||||
|
end.isPlayTts = true
|
||||||
|
if (StringUtils.isEmpty(end.introduction)) {
|
||||||
|
if (!StringUtils.isEmpty(end.name)) {
|
||||||
|
// val message = "前方到站:${end.name},请下车的乘客做好准备"
|
||||||
|
val message = StringUtils.getString(R.string.module_och_next_station, end.name)
|
||||||
|
ShuttleVoiceManager.leave200Distance(message)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
end.introduction?.let {
|
||||||
|
ShuttleVoiceManager.leave200Distance(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun init() {
|
||||||
|
//监听运营消息
|
||||||
|
OCHSocketMessageManager.registerSocketMessageListener(
|
||||||
|
OCHSocketMessageManager.msgMonitorType,
|
||||||
|
OperateAction(true)
|
||||||
|
)
|
||||||
|
|
||||||
|
OCHSocketMessageManager.registerSocketMessageListener(
|
||||||
|
OCHSocketMessageManager.msgTaskUsedType,
|
||||||
|
TaskUsedAction()
|
||||||
|
)
|
||||||
|
|
||||||
|
// 长链接监听
|
||||||
|
AbnormalFactorsLoopManager.startLoopAbnormalFactors(AbsMogoApplication.getApp())
|
||||||
|
|
||||||
|
//监听乘客屏发来的消息
|
||||||
|
LanSocketManager.registerSocketMessageListener(
|
||||||
|
DPMsgType.TYPE_TASK_DETAILS.type,
|
||||||
|
taskDetailsMsgListener
|
||||||
|
)
|
||||||
|
TrajectoryAndDistanceManager.addDistanceListener(TAG, trajectoryListener)
|
||||||
|
BridgeManager.addBridgeListener(TAG, bridgeListener)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun release() {
|
||||||
|
|
||||||
|
OCHSocketMessageManager.releaseSocketMessageListener(OCHSocketMessageManager.msgMonitorType)
|
||||||
|
|
||||||
|
OCHSocketMessageManager.releaseSocketMessageListener(OCHSocketMessageManager.msgTaskUsedType)
|
||||||
|
|
||||||
|
AbnormalFactorsLoopManager.stopLoopAbnormalFactors()
|
||||||
|
|
||||||
|
TrajectoryAndDistanceManager.removeListener(TAG)
|
||||||
|
|
||||||
|
BridgeManager.removeBridgeListener(TAG)
|
||||||
|
|
||||||
|
//监听乘客屏发来的消息
|
||||||
|
LanSocketManager.unRegisterSocketMessageListener(
|
||||||
|
DPMsgType.TYPE_TASK_DETAILS.type,
|
||||||
|
taskDetailsMsgListener
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 乘客屏请求线路信息
|
||||||
|
private val taskDetailsMsgListener = object : ILanMessageListener<TaskDetailsMsg> {
|
||||||
|
override fun targetLan(): Class<TaskDetailsMsg> = TaskDetailsMsg::class.java
|
||||||
|
override fun onLanMsgReceived(taskDetailsMsg: TaskDetailsMsg?) = sendTaskDetailsToClients()
|
||||||
|
}
|
||||||
|
|
||||||
|
private var delayedTts: Runnable? = null
|
||||||
|
|
||||||
|
// 离站
|
||||||
|
fun leaveStation() {
|
||||||
|
LineManager.getStationsWithLine { start, end, lineInfo ->
|
||||||
|
delayedTts = object : Runnable {
|
||||||
|
override fun run() {
|
||||||
|
ShuttleVoiceManager.leaveStationBus(end.name, end.nameKr)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
UiThreadHandler.postDelayed(delayedTts, BusConst.DELAY_10S)
|
||||||
|
//给bus外屏发送
|
||||||
|
LedScreenManager.sendTripInfo2Led(
|
||||||
|
LedScreenManager.LEAVE_STATION,
|
||||||
|
lineInfo.lineName,
|
||||||
|
start.name ?: "",
|
||||||
|
end.name ?: "",
|
||||||
|
LineModel.isLastStation() == true
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//到站
|
||||||
|
fun arriveStation() {
|
||||||
|
delayedTts?.let {
|
||||||
|
UiThreadHandler.removeCallbacks(delayedTts)
|
||||||
|
}
|
||||||
|
LineManager.getStationsWithLine { start, end, lineInfo ->
|
||||||
|
ShuttleVoiceManager.arrivedStationBus(end.name, end.nameKr)
|
||||||
|
// 收到正在进站的决策信息时播报,每个站点仅播报1次
|
||||||
|
ShuttleVoiceManager.arrivedStationOut(ResourcesUtils.getString(R.string.unmanned_bus_voice_out_arrive_station))
|
||||||
|
//给bus外屏发送
|
||||||
|
LedScreenManager.sendTripInfo2Led(
|
||||||
|
LedScreenManager.ARRIVE_STATION,
|
||||||
|
lineInfo.lineName,
|
||||||
|
start.name ?: "",
|
||||||
|
end.name ?: "",
|
||||||
|
LineModel.isLastStation(end)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//结束任务
|
||||||
|
fun endTask() {
|
||||||
|
delayedTts?.let {
|
||||||
|
UiThreadHandler.removeCallbacks(delayedTts)
|
||||||
|
}
|
||||||
|
LineManager.getLineInfo { lineInfo ->
|
||||||
|
LedScreenManager.sendTripInfo2Led(
|
||||||
|
LedScreenManager.END_TRIP,
|
||||||
|
lineInfo.lineName,
|
||||||
|
"",
|
||||||
|
"",
|
||||||
|
false
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun sendTaskDetailsToClients() {
|
||||||
|
if (LineManager.lineInfos == null || LineModel.currentTask == null || LineModel.stationList.isNullOrEmpty()) {
|
||||||
|
val data = BusTransferData(if (LoginStatusManager.isLogin()) 1 else 0, null)
|
||||||
|
val msg = TaskDetailsMsg(GsonUtils.toJson(data), BusinessType.shuttle)
|
||||||
|
d(TAG, "sendTaskDetailsToClients = " + GsonUtils.toJson(msg))
|
||||||
|
LanSocketManager.sendMsgToClient(msg)
|
||||||
|
} else {
|
||||||
|
LineManager.getLineInfo { lineInfo ->
|
||||||
|
busRoutesResult.setSite(LineModel.stationList)
|
||||||
|
busRoutesResult.lineId = lineInfo.lineId.toInt()
|
||||||
|
busRoutesResult.name = lineInfo.lineName
|
||||||
|
busRoutesResult.taskId = LineModel.currentTask!!.taskId!!.toInt()
|
||||||
|
busRoutesResult.taskTime = LineModel.currentTask!!.taskStartTime!!
|
||||||
|
busRoutesResult.writeVersion = System.currentTimeMillis()
|
||||||
|
val data = BusTransferData(if (LoginStatusManager.isLogin()) 1 else 0, busRoutesResult)
|
||||||
|
val msg = TaskDetailsMsg(GsonUtils.toJson(data), BusinessType.shuttle)
|
||||||
|
d(TAG, "sendTaskDetailsToClients = " + GsonUtils.toJson(msg))
|
||||||
|
LanSocketManager.sendMsgToClient(msg)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,325 @@
|
|||||||
|
package com.mogo.och.unmanned.model
|
||||||
|
|
||||||
|
import com.elegant.network.utils.GsonUtil
|
||||||
|
import com.mogo.commons.AbsMogoApplication
|
||||||
|
import com.mogo.eagle.core.data.enums.EventTypeEnumNew
|
||||||
|
import com.mogo.eagle.core.data.msgbox.MsgBoxBean
|
||||||
|
import com.mogo.eagle.core.data.msgbox.MsgBoxType
|
||||||
|
import com.mogo.eagle.core.data.msgbox.V2XMsg
|
||||||
|
import com.mogo.eagle.core.function.call.msgbox.CallerMsgBoxManager.saveMsgBox
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.d
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger.i
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||||
|
import com.mogo.eagle.core.utilcode.util.StringUtils
|
||||||
|
import com.mogo.och.bridge.autopilot.line.LineManager
|
||||||
|
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||||
|
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||||
|
import com.mogo.och.common.module.manager.loop.LoopInfo
|
||||||
|
import com.mogo.och.common.module.manager.socket.cloud.IOchOnMessageListener
|
||||||
|
import com.mogo.och.common.module.manager.socket.cloud.OCHSocketMessageManager
|
||||||
|
import com.mogo.och.common.module.manager.socket.lan.ILanMessageListener
|
||||||
|
import com.mogo.och.common.module.manager.socket.lan.LanSocketManager
|
||||||
|
import com.mogo.och.common.module.manager.socket.lan.bean.DPMsgType
|
||||||
|
import com.mogo.och.common.module.manager.socket.lan.bean.WriteOffDetialMsg
|
||||||
|
import com.mogo.och.common.module.manager.socket.lan.bean.WriteOffResultMsg
|
||||||
|
import com.mogo.och.common.module.utils.OchPhoneUtil
|
||||||
|
import com.mogo.och.shuttle.unmanned.R
|
||||||
|
import com.mogo.och.unmanned.bean.WriteOffPassenger
|
||||||
|
import com.mogo.och.unmanned.repository.RepositoryManager
|
||||||
|
import com.mogo.och.unmanned.repository.exception.DataException
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.response.PassengerWriteOffResponse
|
||||||
|
import com.mogo.och.unmanned.util.ShuttleVoiceManager
|
||||||
|
import io.reactivex.Observable
|
||||||
|
import io.reactivex.ObservableEmitter
|
||||||
|
import io.reactivex.ObservableOnSubscribe
|
||||||
|
import io.reactivex.Observer
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
|
import io.reactivex.disposables.Disposable
|
||||||
|
import io.reactivex.schedulers.Schedulers
|
||||||
|
|
||||||
|
object TicketModel {
|
||||||
|
|
||||||
|
private const val TAG = M_BUS + "TicketModel"
|
||||||
|
|
||||||
|
private const val SELECTWRITEOFFCOUNT = "SELECTWRITEOFFCOUNT"
|
||||||
|
|
||||||
|
private var emitterMain: ObservableEmitter<Pair<Int, Int>>? = null
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接受乘客端扫码数据进行云端和本地核销
|
||||||
|
*/
|
||||||
|
private val writeOffDetialMsg = object : ILanMessageListener<WriteOffDetialMsg> {
|
||||||
|
override fun targetLan(): Class<WriteOffDetialMsg> = WriteOffDetialMsg::class.java
|
||||||
|
override fun onLanMsgReceived(obj: WriteOffDetialMsg?) = receiveWrteOffDefailtInfo(obj)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 接受乘客端扫码数据进行云端和本地核销
|
||||||
|
*/
|
||||||
|
private val writeOffOnlineMsg = object : IOchOnMessageListener<WriteOffPassenger> {
|
||||||
|
override fun target(): Class<WriteOffPassenger> {
|
||||||
|
return WriteOffPassenger::class.java
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onMsgReceived(passenger: WriteOffPassenger?) {
|
||||||
|
//进行播报
|
||||||
|
i(TAG, "后台socket 核验:passenger = " + GsonUtil.jsonFromObject(passenger))
|
||||||
|
if (passenger == null || passenger.passengerSize == 0) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
RepositoryManager.saveWriteOff4Socket(passenger)
|
||||||
|
writeOffSuccess(
|
||||||
|
passenger.passengerSize,
|
||||||
|
passenger.phone ?: "",
|
||||||
|
"",
|
||||||
|
passenger.ticketName ?: "",
|
||||||
|
0
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val observable = Observable.create(ObservableOnSubscribe<Pair<Int, Int>> { emitter -> emitterMain = emitter })
|
||||||
|
|
||||||
|
fun getWriteOffCountObservable(): Observable<Pair<Int, Int>> {
|
||||||
|
return observable
|
||||||
|
}
|
||||||
|
|
||||||
|
fun load() {
|
||||||
|
// 3s轮训站点核销人数 人数本地核销 直接计算就好
|
||||||
|
if (RepositoryManager.supportWriteOff() && RepositoryManager.supportWriteOffDb()) {
|
||||||
|
BizLoopManager.setLoopFunction(
|
||||||
|
SELECTWRITEOFFCOUNT,
|
||||||
|
LoopInfo(3, TicketModel::selectWriteOffCount, scheduler = Schedulers.io())
|
||||||
|
)
|
||||||
|
}
|
||||||
|
// 核销信息
|
||||||
|
LanSocketManager.registerSocketMessageListener(DPMsgType.TYPE_WRITEOFF_INFO_DETAIL.type, writeOffDetialMsg)
|
||||||
|
|
||||||
|
//监听核销乘客
|
||||||
|
OCHSocketMessageManager.registerSocketMessageListener(OCHSocketMessageManager.msgWriteOffPassengerType, writeOffOnlineMsg)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun release() {
|
||||||
|
if (RepositoryManager.supportWriteOff()) {
|
||||||
|
BizLoopManager.removeLoopFunction(SELECTWRITEOFFCOUNT)
|
||||||
|
}
|
||||||
|
LanSocketManager.unRegisterSocketMessageListener(DPMsgType.TYPE_WRITEOFF_INFO_DETAIL.type, writeOffDetialMsg)
|
||||||
|
OCHSocketMessageManager.releaseSocketMessageListener(OCHSocketMessageManager.msgWriteOffPassengerType)
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun selectWriteOffCount() {
|
||||||
|
LineManager.getStations().first?.let { firstStation ->
|
||||||
|
LineModel.currentTask?.let { currentTask ->
|
||||||
|
val queryWriteoffCount = RepositoryManager.queryWriteoffCount(
|
||||||
|
AbsMogoApplication.getApp(),
|
||||||
|
currentTask.taskId ?: 0L,
|
||||||
|
firstStation.siteId.toLong()
|
||||||
|
)
|
||||||
|
if (queryWriteoffCount != null) {
|
||||||
|
queryWriteoffCount.subscribe(
|
||||||
|
object : Observer<Int> {
|
||||||
|
override fun onSubscribe(d: Disposable) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(e: Throwable) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onComplete() {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNext(count: Int) {
|
||||||
|
emitterMain?.onNext(Pair<Int, Int>(firstStation.siteId, count))
|
||||||
|
d(TAG, "${firstStation.name}核销人数:${count}")
|
||||||
|
OchChainLogManager.writeChainLog(
|
||||||
|
"核销人数",
|
||||||
|
"任务:${currentTask.taskId} 站点:${firstStation.siteId}_${firstStation.name}"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
emitterMain?.onNext(Pair(0, 0))
|
||||||
|
d(TAG, "线路或者站点为空")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private fun receiveWrteOffDefailtInfo(writeOffDetialMsg: WriteOffDetialMsg?) {
|
||||||
|
writeOffDetialMsg?.let {
|
||||||
|
if (writeOffDetialMsg.code != 0) {
|
||||||
|
sendMessage2Driver(
|
||||||
|
writeOffDetialMsg.msg ?: "",
|
||||||
|
writeOffDetialMsg.phone ?: "",
|
||||||
|
writeOffDetialMsg.code,
|
||||||
|
writeOffDetialMsg.orderNo ?: "",
|
||||||
|
)
|
||||||
|
} else {
|
||||||
|
RepositoryManager.writeOff(writeOffDetialMsg)
|
||||||
|
?.subscribeOn(Schedulers.io())
|
||||||
|
?.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
?.subscribe(object : Observer<PassengerWriteOffResponse.Result?> {
|
||||||
|
override fun onSubscribe(d: Disposable) {
|
||||||
|
d(TAG, "receiveWrteOffDefailtInfo onSubscribe")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onError(e: Throwable) {
|
||||||
|
d(TAG, "receiveWrteOffDefailtInfo onError${e.printStackTrace()}")
|
||||||
|
if (e is DataException) {
|
||||||
|
d(TAG, "核销失败 ${e.code}-----${e.msg}")
|
||||||
|
parseData(e.code, e.msg ?: "", writeOffDetialMsg.phone
|
||||||
|
?: "", writeOffDetialMsg.orderNo ?: "")
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
OchChainLogManager.writeChainLogWriteOff("核销失败", "原因${e.message}")
|
||||||
|
} catch (e: Exception) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onComplete() {
|
||||||
|
d(TAG, "receiveWrteOffDefailtInfo onComplete")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun onNext(data: PassengerWriteOffResponse.Result) {
|
||||||
|
d(TAG, "queryBusLines onNext ${data}")
|
||||||
|
writeOffSuccess(
|
||||||
|
data.ticketSize ?: 0,
|
||||||
|
data.phone ?: "",
|
||||||
|
writeOffDetialMsg.orderNo ?: "",
|
||||||
|
data.ticketName ?: "",
|
||||||
|
data.businessTime ?: System.currentTimeMillis(),
|
||||||
|
)
|
||||||
|
try {
|
||||||
|
OchChainLogManager.writeChainLogWriteOff("核销成功", "原因$data")
|
||||||
|
} catch (e: Exception) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 解析错误原因
|
||||||
|
*/
|
||||||
|
private fun parseData(code: Int, msg: String, phone: String, orderNo: String) {
|
||||||
|
when (code) {
|
||||||
|
// 1009 -> sendMessage2Driver("乘车日期非今日", phone,1009,orderNo)
|
||||||
|
1009 -> sendMessage2Driver(StringUtils.getString(R.string.module_och_travel_date_not_today), phone, 1009, orderNo)
|
||||||
|
// 1005 -> sendMessage2Driver("当前无路线任务", phone,1005,orderNo)
|
||||||
|
1005 -> sendMessage2Driver(StringUtils.getString(R.string.module_och_there_are_no_route_tasks), phone, 1005, orderNo)
|
||||||
|
// 1006 -> sendMessage2Driver("车票非当前路线", phone,1006,orderNo)
|
||||||
|
1006 -> sendMessage2Driver(StringUtils.getString(R.string.module_och_ticket_not_current_route), phone, 1006, orderNo)
|
||||||
|
// 1008 -> sendMessage2Driver("车票无剩余可用次数", phone,99,orderNo)
|
||||||
|
1008 -> sendMessage2Driver(StringUtils.getString(R.string.module_och_ticket_has_no_remaining_valid_rides_available), phone, 99, orderNo)
|
||||||
|
// 6001 -> sendMessage2Driver("二维码已过期", phone,6001,orderNo)
|
||||||
|
6001 -> sendMessage2Driver(StringUtils.getString(R.string.module_och_qr_code_expired), phone, 6001, orderNo)
|
||||||
|
// 6002 -> sendMessage2Driver("同一订单核销间隔时间需大于2分钟", phone,6002,orderNo)
|
||||||
|
6002 -> sendMessage2Driver(StringUtils.getString(R.string.module_och_interval_canceling_same_order_too_short), phone, 6002, orderNo)
|
||||||
|
// 6003 -> sendMessage2Driver("车票非当前站点", phone,6003,orderNo)
|
||||||
|
6003 -> sendMessage2Driver(StringUtils.getString(R.string.module_och_ticket_not_valid_for_current_station), phone, 6003, orderNo)
|
||||||
|
// 6004 -> sendMessage2Driver("车辆未执行任务", phone,6004,orderNo)
|
||||||
|
6004 -> sendMessage2Driver(StringUtils.getString(R.string.module_och_vehicle_not_duty), phone, 6004, orderNo)
|
||||||
|
// 6005 -> sendMessage2Driver("车票非当前班次", phone,6005,orderNo)
|
||||||
|
6005 -> sendMessage2Driver(StringUtils.getString(R.string.module_och_ticket_not_for_current_train), phone, 6005, orderNo)
|
||||||
|
// 1012 -> sendMessage2Driver("车票与车辆所属租户不一致", phone,1012,orderNo)
|
||||||
|
1012 -> sendMessage2Driver(StringUtils.getString(R.string.module_och_ticket_does_not_match_tenant_who_owns_vehicle), phone, 1012, orderNo)
|
||||||
|
else -> {
|
||||||
|
try {
|
||||||
|
val tempcode = msg.toInt()
|
||||||
|
parseData(tempcode, msg, phone, orderNo)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
sendMessage2Driver(msg, phone, 3002, orderNo)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验票失败
|
||||||
|
* code 3001 乘客屏参数校验失败
|
||||||
|
* code 3002 司机屏校验失败原因未知
|
||||||
|
* code 99 小程序缓存丢失Android 缓存存在
|
||||||
|
*/
|
||||||
|
private fun sendMessage2Driver(message: String, phone: String, code: Int, orderNo: String) {
|
||||||
|
// 发送乘客屏 通过蓝牙告知小程序
|
||||||
|
LanSocketManager.sendMsgToClient(WriteOffResultMsg(code, phone, orderNo, System.currentTimeMillis(), LineManager.lineInfos?.lineId
|
||||||
|
?: 0, LineManager.getStations()?.first?.siteId?.toLong() ?: 0L))
|
||||||
|
// val failedReason = "核销失败,${message}"
|
||||||
|
val failedReason = StringUtils.getString(R.string.module_och_recognition_failed, message)
|
||||||
|
// tts
|
||||||
|
ShuttleVoiceManager.writeOffFaile(failedReason)
|
||||||
|
val tempPhone = OchPhoneUtil.getPhoneWithoutMiddle(phone)
|
||||||
|
val reaseonAndPhone = if (tempPhone.isEmpty()) {
|
||||||
|
failedReason
|
||||||
|
} else {
|
||||||
|
// "${failedReason};乘客:${tempPhone}"
|
||||||
|
"${failedReason}${StringUtils.getString(R.string.module_och_passenger)}${tempPhone}"
|
||||||
|
}
|
||||||
|
saveMsgBox(
|
||||||
|
MsgBoxBean(
|
||||||
|
MsgBoxType.V2X, V2XMsg(
|
||||||
|
EventTypeEnumNew.TYPE_ABNORMAL_VERIFICATION.poiType,
|
||||||
|
reaseonAndPhone,
|
||||||
|
EventTypeEnumNew.TYPE_ABNORMAL_VERIFICATION.tts,
|
||||||
|
""
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 验票成功
|
||||||
|
* 1、本地核销
|
||||||
|
* 2、云端核销
|
||||||
|
*/
|
||||||
|
private fun writeOffSuccess(ticketSize: Int, phone: String, orderNo: String, ticketName: String, businessTime: Long) {
|
||||||
|
|
||||||
|
// 发送乘客屏 通过蓝牙告知小程序 为0时是 安全员小程序核销的
|
||||||
|
if (businessTime > 0) {
|
||||||
|
LanSocketManager.sendMsgToClient(
|
||||||
|
WriteOffResultMsg(
|
||||||
|
code = 0,// 00成功
|
||||||
|
phone = phone,
|
||||||
|
orderNo = orderNo,
|
||||||
|
businessTime = businessTime,
|
||||||
|
LineManager.lineInfos?.lineId ?: 0L,
|
||||||
|
LineManager.getStations()?.first?.siteId?.toLong() ?: 0L
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
BizLoopManager.runInIoThread { selectWriteOffCount() }
|
||||||
|
|
||||||
|
ShuttleVoiceManager.writeOffCount(ticketSize)
|
||||||
|
|
||||||
|
var tempPhone = phone
|
||||||
|
if (tempPhone.length > 8) {
|
||||||
|
//截取电话号码前三位
|
||||||
|
val phoneNumPre = tempPhone.substring(0, 3)
|
||||||
|
//截取电话号码后四位
|
||||||
|
val phoneNumFix = tempPhone.substring(7)
|
||||||
|
tempPhone = "$phoneNumPre****$phoneNumFix"
|
||||||
|
}
|
||||||
|
// val content = "${ticketSize}张 $ticketName $tempPhone"
|
||||||
|
val content = "${ticketSize}${StringUtils.getString(R.string.module_och_piece)} $ticketName $tempPhone"
|
||||||
|
saveMsgBox(MsgBoxBean(
|
||||||
|
MsgBoxType.V2X,
|
||||||
|
V2XMsg(
|
||||||
|
EventTypeEnumNew.TYPE_VERIFICATION_SUCCESSFUL.poiType,
|
||||||
|
content,
|
||||||
|
EventTypeEnumNew.TYPE_VERIFICATION_SUCCESSFUL.tts,
|
||||||
|
""
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,250 @@
|
|||||||
|
package com.mogo.och.unmanned.repository
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import com.mogo.commons.env.Project
|
||||||
|
import com.mogo.commons.env.ProjectUtils
|
||||||
|
import com.mogo.eagle.core.data.BaseData
|
||||||
|
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||||
|
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||||
|
import com.mogo.och.common.module.manager.socket.lan.bean.WriteOffDetialMsg
|
||||||
|
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||||
|
import com.mogo.och.unmanned.bean.WaitUploadLine
|
||||||
|
import com.mogo.och.unmanned.bean.WriteOffPassenger
|
||||||
|
import com.mogo.och.unmanned.bean.request.ShuttleEventRequest
|
||||||
|
import com.mogo.och.unmanned.bean.response.CarExecutableTaskResponse
|
||||||
|
import com.mogo.och.unmanned.bean.response.PointResponse
|
||||||
|
import com.mogo.och.unmanned.repository.db.MyDataBase
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.LineDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.TaskDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.EventDb
|
||||||
|
import com.mogo.och.unmanned.repository.line.ILineRepository
|
||||||
|
import com.mogo.och.unmanned.repository.line.impl.NormalRepository
|
||||||
|
import com.mogo.och.unmanned.repository.line.impl.WeaknetRepository
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.response.PassengerWriteOffResponse
|
||||||
|
import com.mogo.och.unmanned.repository.writeoff.IWriteOffRepository
|
||||||
|
import com.mogo.och.unmanned.repository.writeoff.impl.WriteOffCacheRepository
|
||||||
|
import com.mogo.och.unmanned.repository.writeoff.impl.WriteOffNormallRepository
|
||||||
|
import io.reactivex.Observable
|
||||||
|
|
||||||
|
object RepositoryManager {
|
||||||
|
|
||||||
|
private val TAG = "${M_BUS}RepositoryManager"
|
||||||
|
private var lineRepository: ILineRepository? = null
|
||||||
|
get() {
|
||||||
|
if (field == null) {
|
||||||
|
when (ProjectUtils.getProjectType()) {
|
||||||
|
Project.SAAS -> {
|
||||||
|
if (AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
field = WeaknetRepository()
|
||||||
|
CallerLogger.d(TAG, "saas shuttle 支持db")
|
||||||
|
} else if (AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
field = WeaknetRepository()
|
||||||
|
CallerLogger.d(TAG, "saas scheduled 支持db")
|
||||||
|
} else if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
field = WeaknetRepository()
|
||||||
|
CallerLogger.d(TAG, "saas bus 支持db")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Project.DALI -> {
|
||||||
|
if (AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
field = WeaknetRepository()
|
||||||
|
CallerLogger.d(TAG, "dali shuttle 支持db")
|
||||||
|
} else if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
field = NormalRepository()
|
||||||
|
CallerLogger.d(TAG, "dali bus 不支持db")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Project.MOGO -> {
|
||||||
|
if (AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
field = NormalRepository()
|
||||||
|
CallerLogger.d(TAG, "mogo shuttle 不支持db")
|
||||||
|
} else if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
field = NormalRepository()
|
||||||
|
CallerLogger.d(TAG, "mogo bus 不支持db")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
|
||||||
|
private var writeOffRepository: IWriteOffRepository? = null
|
||||||
|
get() {
|
||||||
|
if (field == null) {
|
||||||
|
when (ProjectUtils.getProjectType()) {
|
||||||
|
Project.SAAS -> {
|
||||||
|
if (AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
field = WriteOffCacheRepository()
|
||||||
|
CallerLogger.d(TAG, "saas shuttle 核销缓存")
|
||||||
|
} else if (AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
field = WriteOffCacheRepository()
|
||||||
|
CallerLogger.d(TAG, "saas sceduletd 核销缓存")
|
||||||
|
} else if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
field = WriteOffCacheRepository()
|
||||||
|
CallerLogger.d(TAG, "saas bus 核销缓存")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Project.DALI -> {
|
||||||
|
if (AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
field = WriteOffNormallRepository()
|
||||||
|
CallerLogger.d(TAG, "dali shuttle 不支持核销缓存")
|
||||||
|
} else if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
field = WriteOffNormallRepository()
|
||||||
|
CallerLogger.d(TAG, "dali bus 不支持核销缓存")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
|
||||||
|
fun release() {
|
||||||
|
closeDb()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun loadCurrentTaskInfo(): Observable<Boolean>? {
|
||||||
|
return lineRepository?.loadCurrentTaskInfo()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryCanUseLine(): Observable<List<LineDataBean>?>? {
|
||||||
|
return lineRepository?.queryCanUseLine()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryCanUserTask(lineId: Long): Observable<List<TaskDataBean>?>? {
|
||||||
|
return lineRepository?.queryCanUserTask(lineId)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun startTask(shiftsId: Long, taskId: Long, lineId: Long, taskTime: Long, lineName: String): Observable<Boolean>? {
|
||||||
|
return lineRepository?.startTask(shiftsId, taskId, lineId, taskTime, lineName)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun leaveStation(
|
||||||
|
seq: Int, siteId: Long, shiftsId: Long, taskId: Long, lineId: Long, taskStartTime: Long, taskDate: Long
|
||||||
|
): Observable<Boolean>? {
|
||||||
|
return lineRepository?.leaveStation(seq, siteId, shiftsId, taskId, lineId, taskStartTime, taskDate)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun arriveStation(seq: Int, siteId: Long, taskId: Long): Observable<Boolean>? {
|
||||||
|
return lineRepository?.arriveStation(seq, siteId, taskId)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun endTask(shiftsId: Long, taskId: Long): Observable<Boolean>? {
|
||||||
|
return lineRepository?.endTask(shiftsId, taskId)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun endTaskByOther(taskId: Long) {
|
||||||
|
lineRepository?.endTaskByOther(taskId)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun haveRunningTask(): Boolean {
|
||||||
|
return lineRepository?.haveRunningTask() ?: false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun haveDataWaitSyn(): Boolean {
|
||||||
|
if (ProjectUtils.isSaas() && AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
EventDb.queryWaitUpdateEvent()?.let {
|
||||||
|
return it.isNotEmpty()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
fun supportDb(): Boolean {
|
||||||
|
if (ProjectUtils.isSaas() || (ProjectUtils.isDali() && AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode))) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
fun supportWriteOff(): Boolean {
|
||||||
|
if (ProjectUtils.isSaas() || (ProjectUtils.isDali())) {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
fun supportWriteOffDb(): Boolean {
|
||||||
|
if (supportWriteOff()) {
|
||||||
|
return ProjectUtils.isSaas()
|
||||||
|
}
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryCarExecutableTaskList(
|
||||||
|
ochCommonServiceCallback: OchCommonServiceCallback<CarExecutableTaskResponse>
|
||||||
|
) {
|
||||||
|
if (lineRepository is WeaknetRepository) {
|
||||||
|
lineRepository?.queryCarExecutableTaskList(ochCommonServiceCallback)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryPointFromNet(lines: MutableList<Long>): Observable<MutableList<PointResponse>>? {
|
||||||
|
if (lineRepository is WeaknetRepository) {
|
||||||
|
return lineRepository?.queryPointsByLineIds(lines)
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
fun reportCabinEvent(
|
||||||
|
context: Context?,
|
||||||
|
data: ShuttleEventRequest?,
|
||||||
|
callback: OchCommonServiceCallback<BaseData?>?
|
||||||
|
) {
|
||||||
|
if (lineRepository is WeaknetRepository) {
|
||||||
|
lineRepository?.reportCabinEvent(context, data, callback)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryWriteoffCount(context: Context, taskId: Long, siteId: Long): Observable<Int>? {
|
||||||
|
return writeOffRepository?.queryWriteoffCount(context, taskId, siteId)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun writeOff(writeOffDetialMsg: WriteOffDetialMsg): Observable<PassengerWriteOffResponse.Result>? {
|
||||||
|
return writeOffRepository?.writeOffEvent(writeOffDetialMsg)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryWaitUploadData(): Observable<MutableList<WaitUploadLine>>? {
|
||||||
|
return writeOffRepository?.queryWaitUploadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun canCanEndTask(taskId: Long): Boolean {
|
||||||
|
return writeOffRepository?.canCanEndTask(taskId) ?: true
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 安全员小程序核销成功的用户计数用
|
||||||
|
*/
|
||||||
|
fun saveWriteOff4Socket(passenger: WriteOffPassenger) {
|
||||||
|
BizLoopManager.runInIoThread {
|
||||||
|
writeOffRepository?.writeOffEvent4Socket(passenger)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun closeDb() {
|
||||||
|
if (supportDb()) {
|
||||||
|
MyDataBase.instance?.close()
|
||||||
|
CallerLogger.d(TAG, "关闭数据库")
|
||||||
|
MyDataBase.instance = null
|
||||||
|
CallerLogger.d(TAG, "重置数据库")
|
||||||
|
lineRepository?.release()
|
||||||
|
lineRepository = null
|
||||||
|
writeOffRepository?.release()
|
||||||
|
writeOffRepository = null
|
||||||
|
CallerLogger.d(TAG, "重置 repository")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db
|
||||||
|
|
||||||
|
interface IDbRepository {
|
||||||
|
fun register() {
|
||||||
|
MyDataBase.instance?.register(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun release()
|
||||||
|
}
|
||||||
@@ -0,0 +1,201 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db
|
||||||
|
|
||||||
|
import android.os.Environment
|
||||||
|
import androidx.room.Database
|
||||||
|
import androidx.room.Room
|
||||||
|
import androidx.room.RoomDatabase
|
||||||
|
import androidx.room.migration.Migration
|
||||||
|
import androidx.sqlite.db.SupportSQLiteDatabase
|
||||||
|
import com.mogo.commons.AbsMogoApplication
|
||||||
|
import com.mogo.commons.env.Project
|
||||||
|
import com.mogo.commons.env.ProjectUtils
|
||||||
|
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||||
|
import com.mogo.eagle.core.utilcode.util.FileUtils
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.ContrailDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.EventDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.LineDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.PointDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.SiteDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.TaskDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.TaskSiteDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.WriteOffDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.dao.ContrailDataDao
|
||||||
|
import com.mogo.och.unmanned.repository.db.dao.EventDataDao
|
||||||
|
import com.mogo.och.unmanned.repository.db.dao.LineDataDao
|
||||||
|
import com.mogo.och.unmanned.repository.db.dao.PointDataDao
|
||||||
|
import com.mogo.och.unmanned.repository.db.dao.SiteDataDao
|
||||||
|
import com.mogo.och.unmanned.repository.db.dao.TaskDataDao
|
||||||
|
import com.mogo.och.unmanned.repository.db.dao.TaskSiteDataDao
|
||||||
|
import com.mogo.och.unmanned.repository.db.dao.WriteOffDataDao
|
||||||
|
import java.io.File
|
||||||
|
import java.util.concurrent.Executors
|
||||||
|
|
||||||
|
//注解Database告诉系统这是Room数据库对象
|
||||||
|
//entities指定该数据库有哪些表,多张表就逗号分隔
|
||||||
|
//version指定数据库版本号,升级时需要用到
|
||||||
|
//数据库继承自RoomDatabase
|
||||||
|
@Database(entities = [ContrailDataBean::class, LineDataBean::class,
|
||||||
|
SiteDataBean::class, TaskDataBean::class, TaskSiteDataBean::class,
|
||||||
|
EventDataBean::class, WriteOffDataBean::class, PointDataBean::class
|
||||||
|
], version = 8)
|
||||||
|
abstract class MyDataBase : RoomDatabase() {
|
||||||
|
|
||||||
|
private val dbRepositorys = mutableListOf<IDbRepository>()
|
||||||
|
|
||||||
|
override fun close() {
|
||||||
|
super.close()
|
||||||
|
dbRepositorys.forEach {
|
||||||
|
it.release()
|
||||||
|
}
|
||||||
|
dbRepositorys.clear()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun register(iDbRepository: IDbRepository) {
|
||||||
|
dbRepositorys.add(iDbRepository)
|
||||||
|
}
|
||||||
|
|
||||||
|
abstract val contrailDataDao: ContrailDataDao?
|
||||||
|
abstract val eventDataDao: EventDataDao?
|
||||||
|
abstract val lineDataDao: LineDataDao?
|
||||||
|
abstract val pointDataDao: PointDataDao?
|
||||||
|
abstract val siteDataDao: SiteDataDao?
|
||||||
|
abstract val taskDataDao: TaskDataDao?
|
||||||
|
abstract val taskSiteDataDao: TaskSiteDataDao?
|
||||||
|
abstract val writeOffDataDao: WriteOffDataDao?
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
|
||||||
|
|
||||||
|
private val TAG = "MyDataBase"
|
||||||
|
|
||||||
|
|
||||||
|
private val MIGRATION_1_2 = object : Migration(1, 2) {
|
||||||
|
override fun migrate(database: SupportSQLiteDatabase) {
|
||||||
|
database.execSQL("ALTER TABLE ${EventDataBean.tableName} ADD COLUMN driver_id INTEGER");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private val MIGRATION_2_3 = object : Migration(2, 3) {
|
||||||
|
override fun migrate(database: SupportSQLiteDatabase) {
|
||||||
|
database.execSQL("ALTER TABLE ${SiteDataBean.tableName} ADD COLUMN videoList TEXT");
|
||||||
|
database.execSQL("ALTER TABLE ${TaskSiteDataBean.tableName} ADD COLUMN videoList TEXT");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private val MIGRATION_3_4 = object : Migration(3, 4) {
|
||||||
|
override fun migrate(database: SupportSQLiteDatabase) {
|
||||||
|
database.execSQL("ALTER TABLE ${EventDataBean.tableName} ADD COLUMN msg_id TEXT")
|
||||||
|
database.execSQL("ALTER TABLE ${EventDataBean.tableName} ADD COLUMN update_time INTEGER")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val MIGRATION_4_5 = object : Migration(4, 5) {
|
||||||
|
override fun migrate(database: SupportSQLiteDatabase) {
|
||||||
|
database.execSQL("CREATE TABLE IF NOT EXISTS `${WriteOffDataBean.tableName}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `msg_id` TEXT, `expiry_time` INTEGER, `booking_time` INTEGER, `type` INTEGER, `task_id` INTEGER, `line_id` INTEGER, `site_id` INTEGER, `driver_id` INTEGER, `available_times` INTEGER, `order_no` TEXT, `uid` TEXT, `seq` TEXT, `business_time` INTEGER, `tick_size` INTEGER, `tick_name` TEXT, `event_save_time` INTEGER NOT NULL, `update_status` INTEGER NOT NULL, `update_time` INTEGER)")
|
||||||
|
database.execSQL("CREATE INDEX `index_writeoff_data_table_event_save_time` ON `writeoff_data_table` (`event_save_time`)")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val MIGRATION_5_6 = object : Migration(5, 6) {
|
||||||
|
override fun migrate(database: SupportSQLiteDatabase) {
|
||||||
|
database.execSQL("ALTER TABLE ${EventDataBean.tableName} ADD COLUMN task_date INTEGER")
|
||||||
|
database.execSQL("ALTER TABLE ${EventDataBean.tableName} ADD COLUMN shifts_id INTEGER")
|
||||||
|
database.execSQL("ALTER TABLE ${WriteOffDataBean.tableName} ADD COLUMN task_date INTEGER")
|
||||||
|
database.execSQL("ALTER TABLE ${WriteOffDataBean.tableName} ADD COLUMN shifts_id INTEGER")
|
||||||
|
database.execSQL("ALTER TABLE ${TaskDataBean.tableName} ADD COLUMN shifts_id INTEGER")
|
||||||
|
database.execSQL("ALTER TABLE ${TaskSiteDataBean.tableName} ADD COLUMN shifts_id INTEGER")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private val MIGRATION_6_7 = object : Migration(6, 7) {
|
||||||
|
override fun migrate(database: SupportSQLiteDatabase) {
|
||||||
|
database.execSQL("CREATE TABLE IF NOT EXISTS `${PointDataBean.tableName}` (`id` INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, `line_id` INTEGER, `contrail_id` INTEGER, `site_id` INTEGER, `md5` TEXT, `seq` INTEGER, `point_type` INTEGER, `longitude` REAL, `latitude` REAL, `sub_seq` INTEGER)")
|
||||||
|
database.execSQL("ALTER TABLE ${ContrailDataBean.tableName} ADD COLUMN contrail_id INTEGER")
|
||||||
|
database.execSQL("ALTER TABLE ${ContrailDataBean.tableName} ADD COLUMN source INTEGER")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
private val MIGRATION_7_8 = object : Migration(7, 8) {
|
||||||
|
override fun migrate(db: SupportSQLiteDatabase) {
|
||||||
|
// 获取当前数据库文件名(通过database路径解析)
|
||||||
|
CallerLogger.d(TAG, "数据库路径:${db.path ?: "错误"}")
|
||||||
|
val dbPath = db.path ?: return
|
||||||
|
val dbFileName = dbPath.substringAfterLast(File.separator)
|
||||||
|
// 仅当数据库是shuttle_db时,执行新增tag字段操作
|
||||||
|
if (dbFileName == "shuttle_db") {
|
||||||
|
// 新增tag字段:int类型,非空,默认值0
|
||||||
|
db.execSQL("ALTER TABLE ${SiteDataBean.tableName} ADD COLUMN tag INTEGER NOT NULL DEFAULT 0")
|
||||||
|
db.execSQL("ALTER TABLE ${TaskSiteDataBean.tableName} ADD COLUMN tag INTEGER NOT NULL DEFAULT 0")
|
||||||
|
CallerLogger.d(TAG, "shuttle_db:给${SiteDataBean.tableName}、${TaskSiteDataBean.tableName}新增tag字段成功")
|
||||||
|
} else {
|
||||||
|
CallerLogger.d(TAG, "非shuttle_db,跳过tag字段新增")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun getDBName(): MyDataBase {
|
||||||
|
val roomName = when (ProjectUtils.getProjectType()) {
|
||||||
|
Project.SAAS -> {
|
||||||
|
if (AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
"shuttle_db"
|
||||||
|
} else if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
"saas_bus_db"
|
||||||
|
} else if (AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
"saas_scheduled_db"
|
||||||
|
} else {
|
||||||
|
FunctionBuildConfig.appIdentityMode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Project.DALI -> {
|
||||||
|
if (AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
"dali_shuttle_db"
|
||||||
|
} else {
|
||||||
|
FunctionBuildConfig.appIdentityMode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
FunctionBuildConfig.appIdentityMode
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
FileUtils.createOrExistsDir(ROOT_PATH)
|
||||||
|
|
||||||
|
val dbFile = AbsMogoApplication.getApp().getDatabasePath(roomName)
|
||||||
|
|
||||||
|
val oldDbFile = File(ROOT_PATH)
|
||||||
|
oldDbFile.listFiles()?.forEach {
|
||||||
|
FileUtils.moveFile(it, File(dbFile.parent + File.separator + it.name), null)
|
||||||
|
}
|
||||||
|
|
||||||
|
FileUtils.deleteFilesInDir(ROOT_PATH)
|
||||||
|
|
||||||
|
return Room.databaseBuilder(
|
||||||
|
AbsMogoApplication.getApp()!!.applicationContext,
|
||||||
|
MyDataBase::class.java,
|
||||||
|
dbFile.path
|
||||||
|
)
|
||||||
|
.addMigrations(MIGRATION_1_2)
|
||||||
|
.addMigrations(MIGRATION_2_3)
|
||||||
|
.addMigrations(MIGRATION_3_4)
|
||||||
|
.addMigrations(MIGRATION_4_5)
|
||||||
|
.addMigrations(MIGRATION_5_6)
|
||||||
|
.addMigrations(MIGRATION_6_7)
|
||||||
|
.addMigrations(MIGRATION_7_8)
|
||||||
|
.fallbackToDestructiveMigration()
|
||||||
|
.setQueryCallback({ sqlQuery, bindArgs -> CallerLogger.d(TAG, "sql:$sqlQuery--->参数:$bindArgs") }, Executors.newSingleThreadExecutor())
|
||||||
|
.build()
|
||||||
|
}
|
||||||
|
|
||||||
|
val ROOT_PATH = Environment.getExternalStorageDirectory().absolutePath + File.separator + "Mogo" + File.separator + "APP_cache" + File.separator //程序外部存储跟目录
|
||||||
|
|
||||||
|
var instance: MyDataBase? = getDBName()
|
||||||
|
get() {
|
||||||
|
if (field == null) {
|
||||||
|
field = getDBName()
|
||||||
|
}
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.bean
|
||||||
|
|
||||||
|
import androidx.room.ColumnInfo
|
||||||
|
import androidx.room.Entity
|
||||||
|
import androidx.room.PrimaryKey
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 启动自驾使用的轨迹信息
|
||||||
|
*/
|
||||||
|
@Entity(tableName = ContrailDataBean.tableName)
|
||||||
|
data class ContrailDataBean(
|
||||||
|
|
||||||
|
@PrimaryKey(autoGenerate = true) var id: Int = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线路id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "line_id", typeAffinity = ColumnInfo.INTEGER, index = true)
|
||||||
|
var lineId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轨迹id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "contrail_id", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var contrailId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* csv格式的轨迹文件
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "csv_file_url", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
var csvFileUrl: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* csv_file_url 文件的md5值
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "csv_file_md5", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
var csvFileMd5: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* txt格式的轨迹文件
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "txt_file_url", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
var txtFileUrl: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* txt文件的md5
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "txt_file_md5", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
var txtFileMd5: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 文件的保存时间
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "contrail_save_time", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var contrailSaveTime: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 前几个字符拼接后做md5的值
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "md5", typeAffinity = ColumnInfo.TEXT, index = true)
|
||||||
|
var md5: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轨迹id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "source", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var source: Int? = null,
|
||||||
|
|
||||||
|
|
||||||
|
) {
|
||||||
|
companion object {
|
||||||
|
const val tableName: String = "contrail_data_table"
|
||||||
|
const val SOURCETYPEROUTING = 2
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "ContrailDataBean(lineId=$lineId, csvFileUrl=$csvFileUrl, csvFileMd5=$csvFileMd5, txtFileUrl=$txtFileUrl, txtFileMd5=$txtFileMd5, contrailSaveTime=$contrailSaveTime)"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,119 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.bean
|
||||||
|
|
||||||
|
import androidx.room.ColumnInfo
|
||||||
|
import androidx.room.Entity
|
||||||
|
import androidx.room.PrimaryKey
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上报给服务器端的 选择线路、滑动出发、进站 完成线路的对象
|
||||||
|
*/
|
||||||
|
@Entity(tableName = EventDataBean.tableName)
|
||||||
|
data class EventDataBean(
|
||||||
|
|
||||||
|
@PrimaryKey(autoGenerate = true) var id: Int = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 事件类型
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "event_type", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
var eventType: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成任务的模板id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "shifts_id", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var shiftsId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务id、模板id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "lineId", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var lineId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板发生日期
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "task_date", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var taskDate: Long? = null,
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "lineName", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
var lineName: String? = null,
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "task_id", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var taskId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "task_start_time", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var taskStartTime: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务发生的时间
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "business_time", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var businessTime: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据版本
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "write_version", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var writeVersion: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "site_id", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var siteId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点排序
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "seq", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var seq: Int? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点排序
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "driver_id", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var driverId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 存储此条数据时时间戳
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "event_save_time", typeAffinity = ColumnInfo.INTEGER, index = true)
|
||||||
|
val eventSaveTime: Long = System.currentTimeMillis(),
|
||||||
|
|
||||||
|
@ColumnInfo(name = "update_status", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var updateStatus: Int = 0,
|
||||||
|
|
||||||
|
@ColumnInfo(name = "msg_id", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
var msgId: String? = "",
|
||||||
|
|
||||||
|
@ColumnInfo(name = "update_time", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var upDateTime: Long? = 0L,
|
||||||
|
|
||||||
|
) {
|
||||||
|
companion object {
|
||||||
|
const val tableName: String = "event_data_table"
|
||||||
|
|
||||||
|
const val TaskStart = "TaskStart"
|
||||||
|
const val TaskArriveSite = "TaskArriveSite"
|
||||||
|
const val TaskLeaveSite = "TaskLeaveSite"
|
||||||
|
const val TaskEnd = "TaskEnd"
|
||||||
|
|
||||||
|
|
||||||
|
const val notUpdate = 0
|
||||||
|
const val updating = 1
|
||||||
|
const val updated = 2
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.bean
|
||||||
|
|
||||||
|
import androidx.room.ColumnInfo
|
||||||
|
import androidx.room.Entity
|
||||||
|
import androidx.room.PrimaryKey
|
||||||
|
import com.google.gson.annotations.SerializedName
|
||||||
|
|
||||||
|
@Entity(tableName = LineDataBean.tableName)
|
||||||
|
data class LineDataBean(
|
||||||
|
|
||||||
|
@PrimaryKey(autoGenerate = true)
|
||||||
|
var id: Long = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线路id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "line_id", typeAffinity = ColumnInfo.INTEGER, index = true)
|
||||||
|
var lineId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线路名称
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "line_name", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
@SerializedName("name", alternate = ["lineName"])
|
||||||
|
var lineName: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 终点站名称
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "end_station_name", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
@SerializedName("endSiteName")
|
||||||
|
var endStationName: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 存储此条数据时时间戳
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "line_get_time", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
val linegetTime: Long = System.currentTimeMillis(),
|
||||||
|
) {
|
||||||
|
companion object {
|
||||||
|
const val tableName: String = "line_data_table"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun getLineIdAndName(function: (lineId: Long, lineName: String) -> Unit) {
|
||||||
|
lineId?.let { id ->
|
||||||
|
lineName?.let { name ->
|
||||||
|
function(id, name)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (javaClass != other?.javaClass) return false
|
||||||
|
|
||||||
|
other as LineDataBean
|
||||||
|
|
||||||
|
if (lineId != other.lineId) return false
|
||||||
|
if (lineName != other.lineName) return false
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
var result = lineId?.hashCode() ?: 0
|
||||||
|
result = 31 * result + (lineName?.hashCode() ?: 0)
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,86 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.bean
|
||||||
|
|
||||||
|
import androidx.room.ColumnInfo
|
||||||
|
import androidx.room.Entity
|
||||||
|
import androidx.room.PrimaryKey
|
||||||
|
import com.mogo.och.data.bean.BusStationBean
|
||||||
|
|
||||||
|
@Entity(tableName = PointDataBean.tableName)
|
||||||
|
data class PointDataBean(
|
||||||
|
|
||||||
|
@PrimaryKey(autoGenerate = true) var id: Int = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点所属线路Id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "line_id", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var lineId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 轨迹id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "contrail_id", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var contrailId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A--B--C--D
|
||||||
|
* A--B 的途径点 siteId = B.id
|
||||||
|
* B--C 的途径点 siteId = C.id
|
||||||
|
* C--D 的途径点 siteId = D.id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "site_id", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var siteId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* ContrailDataBean 表格中的md5值
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "md5", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
var md5: String? = null,
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 排队组
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "seq", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var seq: Int? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 点的类型
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "point_type", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var pointType: Int? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 高精坐标
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "longitude", typeAffinity = ColumnInfo.REAL)
|
||||||
|
var longitude: Double? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 高精坐标
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "latitude", typeAffinity = ColumnInfo.REAL)
|
||||||
|
var latitude: Double? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 组内排序
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "sub_seq", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var subSeq: Int? = null,
|
||||||
|
|
||||||
|
) {
|
||||||
|
fun toStation(): BusStationBean {
|
||||||
|
val temp = BusStationBean()
|
||||||
|
temp.lat = latitude ?: 0.0
|
||||||
|
temp.lon = longitude ?: 0.0
|
||||||
|
temp.pointType = pointType ?: pointTypePass
|
||||||
|
temp.isLeaving = true
|
||||||
|
return temp
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
const val tableName = "point_data_table"
|
||||||
|
const val pointTypePass = 1
|
||||||
|
const val pointTypeBlack = 2
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,127 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.bean
|
||||||
|
|
||||||
|
import androidx.room.ColumnInfo
|
||||||
|
import androidx.room.Entity
|
||||||
|
import androidx.room.Ignore
|
||||||
|
import androidx.room.PrimaryKey
|
||||||
|
import com.mogo.och.data.bean.SiteIntroduce
|
||||||
|
|
||||||
|
@Entity(tableName = SiteDataBean.tableName)
|
||||||
|
data class SiteDataBean(
|
||||||
|
|
||||||
|
@PrimaryKey(autoGenerate = true) var id: Int = 0,
|
||||||
|
/**
|
||||||
|
* 站点id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "site_id", typeAffinity = ColumnInfo.INTEGER, index = true)
|
||||||
|
var siteId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点所属线路Id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "line_id", typeAffinity = ColumnInfo.INTEGER, index = true)
|
||||||
|
var lineId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点名称
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "name", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
var name: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点韩文名称
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "name_kr", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
var nameKr: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点排序
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "seq", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var seq: Int? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 高德坐标
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "gcj_lon", typeAffinity = ColumnInfo.REAL)
|
||||||
|
var gcjLon: Double? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 高德坐标
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "gcj_lat", typeAffinity = ColumnInfo.REAL)
|
||||||
|
var gcjLat: Double? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 高精坐标
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "lon", typeAffinity = ColumnInfo.REAL)
|
||||||
|
var lon: Double? = null,
|
||||||
|
/**
|
||||||
|
* 高精坐标
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "lat", typeAffinity = ColumnInfo.REAL)
|
||||||
|
var lat: Double? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点介绍
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "introduction", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
var introduction: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否播放站点介绍
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "is_play_tts", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var isPlayTts: Boolean? = false,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 除id 外其他值做的md5
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "md5", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
var md5: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点视频
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "videoList", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
var videoListDB: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点标志 0:未赋值/默认值,与1结果一致 1:正常停靠 2:临时不停靠
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "tag", typeAffinity = ColumnInfo.INTEGER, defaultValue = "0")
|
||||||
|
var tag: Int = 0,
|
||||||
|
|
||||||
|
@Ignore
|
||||||
|
var videoList: MutableList<SiteIntroduce>? = null
|
||||||
|
) {
|
||||||
|
companion object {
|
||||||
|
const val tableName = "site_data_table"
|
||||||
|
const val mediaTypeVideo = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun toString(): String {
|
||||||
|
return "SiteDataBean(siteId=$siteId, lineId=$lineId, name=$name, nameKr=$nameKr, seq=$seq, gcjLon=$gcjLon, gcjLat=$gcjLat, lon=$lon, lat=$lat, introduction=$introduction, isPlayTts=$isPlayTts, videoList=$videoListDB, tag=$tag)"
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (javaClass != other?.javaClass) return false
|
||||||
|
|
||||||
|
other as SiteDataBean
|
||||||
|
|
||||||
|
if (siteId != other.siteId) return false
|
||||||
|
if (lineId != other.lineId) return false
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
var result = siteId?.hashCode() ?: 0
|
||||||
|
result = 31 * result + (lineId?.hashCode() ?: 0)
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,120 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.bean
|
||||||
|
|
||||||
|
import androidx.room.ColumnInfo
|
||||||
|
import androidx.room.Entity
|
||||||
|
import androidx.room.PrimaryKey
|
||||||
|
import com.google.gson.annotations.SerializedName
|
||||||
|
import com.mogo.och.unmanned.repository.RepositoryManager
|
||||||
|
|
||||||
|
@Entity(tableName = TaskDataBean.tableName)
|
||||||
|
data class TaskDataBean(
|
||||||
|
|
||||||
|
@PrimaryKey(autoGenerate = true)
|
||||||
|
@SerializedName("idtemp")
|
||||||
|
var id: Int = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成任务的模板id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "shifts_id", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var shiftsId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "task_id", typeAffinity = ColumnInfo.INTEGER, index = true)
|
||||||
|
@SerializedName("id")
|
||||||
|
var taskId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务所属线路
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "line_id", typeAffinity = ColumnInfo.INTEGER, index = true)
|
||||||
|
var lineId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务安排的日期
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "task_data", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var taskDate: Long? = null,
|
||||||
|
/**
|
||||||
|
* 任务安排的时间
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "task_start_time", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var taskStartTime: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务开始时间
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "start_time", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var startTime: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务结束时间
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "end_time", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var endtime: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务保存到数据库的时间 用来第二天删除前几天的任务
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "task_get_time", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var taskgetTime: Long = System.currentTimeMillis(),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务状态 (0 未使用) (1 运行中) (2 已使用)
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "status", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var status: Long? = 0,
|
||||||
|
) {
|
||||||
|
companion object {
|
||||||
|
const val tableName: String = "task_data_table"
|
||||||
|
|
||||||
|
const val unUse = 0L
|
||||||
|
const val useing = 1L
|
||||||
|
const val used = 2L
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun equals(other: Any?): Boolean {
|
||||||
|
if (this === other) return true
|
||||||
|
if (javaClass != other?.javaClass) return false
|
||||||
|
|
||||||
|
other as TaskDataBean
|
||||||
|
|
||||||
|
if (taskId != other.taskId) return false
|
||||||
|
if (lineId != other.lineId) return false
|
||||||
|
if (shiftsId != other.shiftsId) return false
|
||||||
|
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun hashCode(): Int {
|
||||||
|
var result = taskId?.hashCode() ?: 0
|
||||||
|
result = 31 * result + (lineId?.hashCode() ?: 0)
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getLineIdAndName(function: (shiftsId: Long, taskId: Long, taskTime: Long, taskDate: Long) -> Unit) {
|
||||||
|
if (RepositoryManager.supportDb()) {
|
||||||
|
taskId?.let { id ->
|
||||||
|
taskStartTime?.let { time ->
|
||||||
|
taskDate?.let { date ->
|
||||||
|
shiftsId?.let { shiftsId ->
|
||||||
|
function(shiftsId, id, time, date)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
taskId?.let { id ->
|
||||||
|
taskStartTime?.let { time ->
|
||||||
|
function(shiftsId ?: 0, id, time, taskDate ?: System.currentTimeMillis())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,182 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.bean
|
||||||
|
|
||||||
|
import androidx.room.ColumnInfo
|
||||||
|
import androidx.room.Entity
|
||||||
|
import androidx.room.PrimaryKey
|
||||||
|
|
||||||
|
@Entity(tableName = TaskSiteDataBean.tableName)
|
||||||
|
data class TaskSiteDataBean(
|
||||||
|
|
||||||
|
@PrimaryKey(autoGenerate = true) var id: Int = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "task_id", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var taskId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成任务的模板id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "shifts_id", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var shiftsId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线路id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "line_id", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var lineId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "site_id", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var siteId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 线路名称 删除线路 特殊情况下要展示线路的冗余
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "line_name", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
var lineName: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点名称
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "name", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
var name: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点韩文
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "name_kr", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
var nameKr: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点排序
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "seq", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var seq: Int? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 高德坐标
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "gcj_lon", typeAffinity = ColumnInfo.REAL)
|
||||||
|
var gcjLon: Double? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 高德坐标
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "gcj_lat", typeAffinity = ColumnInfo.REAL)
|
||||||
|
var gcjLat: Double? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 高精坐标
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "lon", typeAffinity = ColumnInfo.REAL)
|
||||||
|
var lon: Double? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 高精坐标
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "lat", typeAffinity = ColumnInfo.REAL)
|
||||||
|
var lat: Double? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前站点状态 行驶信息,0初始值;1已经过;2当前站;3未到站
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "driving_status", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var drivingStatus: Int? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否离站
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "leaving", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var leaving: Boolean? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 到站时间
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "arrived_time", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var arrivedTime: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 离站时间
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "leave_time", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var leaveTime: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点介绍
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "introduction", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
var introduction: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否播放站点介绍
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "is_play_tts", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var isPlayTts: Boolean? = null,
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务保存到数据库的时间 用来第二天删除前几天的任务
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "event_save_time", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var eventSaveTime: Long = System.currentTimeMillis(),
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点视频
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "videoList", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
var videoList: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 站点标志 0:未赋值/默认值,与1结果一致 1:正常停靠 2:临时不停靠
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "tag", typeAffinity = ColumnInfo.INTEGER, defaultValue = "0")
|
||||||
|
var tag: Int = 0,
|
||||||
|
) {
|
||||||
|
companion object {
|
||||||
|
/**
|
||||||
|
* 开始任务 并把第一站置为 2 当前站
|
||||||
|
*/
|
||||||
|
fun toTaskSiteDatas(querySites: List<SiteDataBean>, shiftsId: Long, taskId: Long, lineName: String): MutableList<TaskSiteDataBean> {
|
||||||
|
val result = mutableListOf<TaskSiteDataBean>()
|
||||||
|
var temp: TaskSiteDataBean? = null
|
||||||
|
querySites.forEach {
|
||||||
|
temp = TaskSiteDataBean()
|
||||||
|
temp?.taskId = taskId
|
||||||
|
temp?.shiftsId = shiftsId
|
||||||
|
temp?.lineId = it.lineId
|
||||||
|
temp?.lineName = lineName
|
||||||
|
temp?.siteId = it.siteId
|
||||||
|
temp?.name = it.name
|
||||||
|
temp?.nameKr = it.nameKr
|
||||||
|
temp?.seq = it.seq
|
||||||
|
temp?.gcjLon = it.gcjLon
|
||||||
|
temp?.gcjLat = it.gcjLat
|
||||||
|
temp?.lon = it.lon
|
||||||
|
temp?.lat = it.lat
|
||||||
|
if (it.seq == 1) {
|
||||||
|
temp?.drivingStatus = drivingStatusCurrent
|
||||||
|
} else {
|
||||||
|
temp?.drivingStatus = drivingStatusNotArrived
|
||||||
|
}
|
||||||
|
temp?.leaving = false
|
||||||
|
temp?.introduction = it.introduction
|
||||||
|
temp?.isPlayTts = it.isPlayTts
|
||||||
|
temp?.videoList = it.videoListDB
|
||||||
|
temp?.tag = it.tag
|
||||||
|
result.add(temp!!)
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
const val tableName: String = "used_task_data_table"
|
||||||
|
|
||||||
|
const val drivingStatusInit = 0//0初始值
|
||||||
|
const val drivingStatusPassed = 1//1已经过
|
||||||
|
const val drivingStatusCurrent = 2//2当前站
|
||||||
|
const val drivingStatusNotArrived = 3//3未到站
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.bean
|
||||||
|
|
||||||
|
import androidx.room.ColumnInfo
|
||||||
|
import androidx.room.Entity
|
||||||
|
import androidx.room.PrimaryKey
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上报给服务器端的 选择线路、滑动出发、进站 完成线路的对象
|
||||||
|
*/
|
||||||
|
@Entity(tableName = WriteOffDataBean.tableName)
|
||||||
|
data class WriteOffDataBean(
|
||||||
|
|
||||||
|
@PrimaryKey(autoGenerate = true) var id: Int = 0,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二维码有效时间 时间戳 有效时间1分钟
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "msg_id", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
var msgId: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 二维码有效时间 时间戳 有效时间1分钟
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "expiry_time", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var expiryTime: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 乘车日期
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "booking_time", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var bookingTime: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验接驳还是公交 shuttle bus
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "type", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var type: Int? = null,
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 生成任务的模板id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "shifts_id", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var shiftsId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 当前的任务id、模板id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "task_id", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var taskId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 模板发生日期
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "task_date", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var taskDate: Long? = null,
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验线路Id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "line_id", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var lineId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 校验站点Id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "site_id", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var siteId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 司机id
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "driver_id", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var driverId: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 剩余核销次数>0
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "available_times", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var availableTimes: Int? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 订单号
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "order_no", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
var orderNo: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* uid
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "uid", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
var uid: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户手机号
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "seq", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
var phone: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 业务发生的时间
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "business_time", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var businessTime: Long? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 票里人数
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "tick_size", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var ticketSize: Int? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 票的类型
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "tick_name", typeAffinity = ColumnInfo.TEXT)
|
||||||
|
var ticketName: String? = null,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 存储此条数据时时间戳
|
||||||
|
*/
|
||||||
|
@ColumnInfo(name = "event_save_time", typeAffinity = ColumnInfo.INTEGER, index = true)
|
||||||
|
val eventSaveTime: Long = System.currentTimeMillis(),
|
||||||
|
|
||||||
|
@ColumnInfo(name = "update_status", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var updateStatus: Int = notUpdate,
|
||||||
|
|
||||||
|
@ColumnInfo(name = "update_time", typeAffinity = ColumnInfo.INTEGER)
|
||||||
|
var upDateTime: Long? = 0L,
|
||||||
|
|
||||||
|
|
||||||
|
) {
|
||||||
|
companion object {
|
||||||
|
const val tableName: String = "writeoff_data_table"
|
||||||
|
|
||||||
|
// 没有上传
|
||||||
|
const val notUpdate = 0
|
||||||
|
|
||||||
|
// 上传中
|
||||||
|
const val updating = 1
|
||||||
|
|
||||||
|
// 已上传
|
||||||
|
const val updated = 2
|
||||||
|
|
||||||
|
const val daliXiaoChengXu = "ehsafety"
|
||||||
|
const val saasXiaoChengXu = "mogogosafety"
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.dao
|
||||||
|
|
||||||
|
import androidx.room.Dao
|
||||||
|
import androidx.room.Insert
|
||||||
|
import androidx.room.OnConflictStrategy
|
||||||
|
import androidx.room.Query
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.ContrailDataBean
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
interface ContrailDataDao {
|
||||||
|
|
||||||
|
//插入轨迹信息
|
||||||
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
|
fun insert(vararg contrailDataBean: ContrailDataBean)
|
||||||
|
|
||||||
|
@Query("UPDATE ${ContrailDataBean.tableName} SET csv_file_url = :csv_file_url ,csv_file_md5 = :csv_file_md5 ,txt_file_url = :txt_file_url " +
|
||||||
|
",txt_file_md5 = :txt_file_md5 ,contrail_save_time = :contrail_save_time,md5 = :md5 WHERE id = :id")
|
||||||
|
fun update(csv_file_url: String,csv_file_md5: String,txt_file_url: String,txt_file_md5: String,contrail_save_time: Long,md5: String,id:Int)
|
||||||
|
|
||||||
|
// 线路删除时同步删除所属轨迹信息
|
||||||
|
@Query("DELETE FROM ${ContrailDataBean.tableName} WHERE line_id = :lineId")
|
||||||
|
fun deleteByLineId(lineId: Long)
|
||||||
|
|
||||||
|
//查询线路对应的轨迹信息
|
||||||
|
@Query("SELECT * FROM ${ContrailDataBean.tableName} WHERE line_id = :lineId")
|
||||||
|
fun queryContrailByLineId(lineId:Long): List<ContrailDataBean>?
|
||||||
|
|
||||||
|
//查询线路对应的轨迹信息
|
||||||
|
@Query("SELECT * FROM ${ContrailDataBean.tableName} WHERE md5 = :md5")
|
||||||
|
fun queryContrailByMd5(md5:String): List<ContrailDataBean>?
|
||||||
|
|
||||||
|
//查询线路对应的轨迹信息 只要一个结果
|
||||||
|
fun queryContrailByLineIdOne(lineId: Long): ContrailDataBean?{
|
||||||
|
val queryContrailByLineId = queryContrailByLineId(lineId)
|
||||||
|
return if(queryContrailByLineId.isNullOrEmpty()){
|
||||||
|
null
|
||||||
|
}else{
|
||||||
|
queryContrailByLineId.first()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@Query("UPDATE ${ContrailDataBean.tableName} SET contrail_id = :contrailId ,source = :source WHERE line_id = :lineId")
|
||||||
|
fun updateIdAndSource(contrailId: Long, source: Int, lineId: Long)
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,43 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.dao
|
||||||
|
|
||||||
|
import androidx.room.Dao
|
||||||
|
import androidx.room.Delete
|
||||||
|
import androidx.room.Insert
|
||||||
|
import androidx.room.OnConflictStrategy
|
||||||
|
import androidx.room.Query
|
||||||
|
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.EventDataBean
|
||||||
|
import io.reactivex.Observable
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
interface EventDataDao {
|
||||||
|
|
||||||
|
//插入数据
|
||||||
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
|
fun insert(vararg eventDataBean: EventDataBean)
|
||||||
|
|
||||||
|
//删除数据
|
||||||
|
@Delete
|
||||||
|
fun delete(vararg eventDataBean: EventDataBean)
|
||||||
|
|
||||||
|
@Query("UPDATE ${EventDataBean.tableName} SET update_status = :status,update_time = :currentTimeMillis WHERE id = :id")
|
||||||
|
fun updateUpdateSatus(id: Int, status: Int, currentTimeMillis: Long): Int
|
||||||
|
|
||||||
|
|
||||||
|
// 删除过时数据
|
||||||
|
@Query("DELETE FROM ${EventDataBean.tableName} WHERE event_save_time < :zeroTime")
|
||||||
|
fun deleteObsoleteData(zeroTime: Long = DateTimeUtil.getCurrentDateZero()): Int
|
||||||
|
|
||||||
|
@Query("SELECT * FROM ${EventDataBean.tableName} WHERE update_status = ${EventDataBean.notUpdate}")
|
||||||
|
fun queryEventByStatusWithPage(): List<EventDataBean>?
|
||||||
|
|
||||||
|
@Query("SELECT count(1) FROM ${EventDataBean.tableName} WHERE update_status = ${EventDataBean.notUpdate}")
|
||||||
|
fun queryEventByStatusWithPageCount(): Int
|
||||||
|
|
||||||
|
@Query("SELECT * FROM ${EventDataBean.tableName} WHERE update_status = ${EventDataBean.notUpdate} and event_save_time > :zeroTime GROUP by task_start_time")
|
||||||
|
fun queryWaitUploadInfo(zeroTime: Long = DateTimeUtil.getCurrentDateZero()): Observable<List<EventDataBean>?>
|
||||||
|
|
||||||
|
@Query("SELECT * FROM ${EventDataBean.tableName} order by event_save_time LIMIT 5 OFFSET 0")
|
||||||
|
fun queryLastDataByWaritData(): List<EventDataBean>?
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,45 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.dao
|
||||||
|
|
||||||
|
import androidx.room.Dao
|
||||||
|
import androidx.room.Delete
|
||||||
|
import androidx.room.Insert
|
||||||
|
import androidx.room.OnConflictStrategy
|
||||||
|
import androidx.room.Query
|
||||||
|
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.LineDataBean
|
||||||
|
import io.reactivex.Observable
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
interface LineDataDao {
|
||||||
|
//插入数据
|
||||||
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
|
fun insert(vararg lineDataBean: LineDataBean)
|
||||||
|
|
||||||
|
//删除数据
|
||||||
|
@Delete
|
||||||
|
fun delete(vararg lineDataBean: LineDataBean)
|
||||||
|
|
||||||
|
@Query("UPDATE ${LineDataBean.tableName} SET line_name = :lineName ,end_station_name = :endStationName WHERE id = :id")
|
||||||
|
fun updateInfo(lineName: String?, endStationName: String?, id: Long)
|
||||||
|
|
||||||
|
// 删除过时数据
|
||||||
|
@Query("DELETE FROM ${LineDataBean.tableName} WHERE line_get_time < :zeroTime")
|
||||||
|
fun deleteObsoleteData(zeroTime: Long = DateTimeUtil.getCurrentDateZero()): Int
|
||||||
|
|
||||||
|
|
||||||
|
//删除非昨天添加的数据
|
||||||
|
@Query("DELETE FROM ${LineDataBean.tableName} WHERE line_get_time < :zeroTime")
|
||||||
|
fun deleteWeltData(zeroTime: Long = DateTimeUtil.getCurrentDateZero()): Int
|
||||||
|
|
||||||
|
//查询当天插入的所有数据
|
||||||
|
@Query("SELECT * FROM ${LineDataBean.tableName} WHERE line_get_time > :zeroTime")
|
||||||
|
fun loadDataRx(zeroTime: Long = DateTimeUtil.getCurrentDateZero()): Observable<List<LineDataBean>?>
|
||||||
|
|
||||||
|
//查询当天插入的所有数据
|
||||||
|
@Query("SELECT * FROM ${LineDataBean.tableName} WHERE line_get_time > :zeroTime")
|
||||||
|
fun loadData(zeroTime: Long = DateTimeUtil.getCurrentDateZero()): List<LineDataBean>?
|
||||||
|
|
||||||
|
@Query("SELECT * FROM ${LineDataBean.tableName} WHERE line_id = :lineId")
|
||||||
|
fun queryByLineId(lineId: Int): List<LineDataBean>?
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,39 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.dao
|
||||||
|
|
||||||
|
import androidx.room.Dao
|
||||||
|
import androidx.room.Delete
|
||||||
|
import androidx.room.Insert
|
||||||
|
import androidx.room.OnConflictStrategy
|
||||||
|
import androidx.room.Query
|
||||||
|
import androidx.room.Transaction
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.PointDataBean
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
interface PointDataDao {
|
||||||
|
//插入数据
|
||||||
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
|
fun insert(vararg lineDataBean: PointDataBean)
|
||||||
|
|
||||||
|
//插入数据
|
||||||
|
@Transaction
|
||||||
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
|
fun insertTra(vararg lineDataBean: PointDataBean)
|
||||||
|
|
||||||
|
|
||||||
|
//删除数据
|
||||||
|
@Delete
|
||||||
|
fun delete(vararg lineDataBean: PointDataBean)
|
||||||
|
|
||||||
|
|
||||||
|
// 线路删除时同步删除所属轨迹信息
|
||||||
|
@Transaction
|
||||||
|
@Query("DELETE FROM ${PointDataBean.tableName} WHERE line_id in (:lineId)")
|
||||||
|
fun deleteByLineIdTra(lineId: List<Long>)
|
||||||
|
|
||||||
|
@Transaction
|
||||||
|
@Query("DELETE FROM ${PointDataBean.tableName} WHERE line_id in (:lineId)")
|
||||||
|
fun deleteByLineId(lineId: List<Long>)
|
||||||
|
|
||||||
|
@Query("SELECT * FROM ${PointDataBean.tableName} WHERE line_id = :lineId")
|
||||||
|
fun queryPointByLineId(lineId: Long): List<PointDataBean>?
|
||||||
|
}
|
||||||
@@ -0,0 +1,59 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.dao
|
||||||
|
|
||||||
|
import androidx.room.Dao
|
||||||
|
import androidx.room.Delete
|
||||||
|
import androidx.room.Insert
|
||||||
|
import androidx.room.OnConflictStrategy
|
||||||
|
import androidx.room.Query
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.SiteDataBean
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
interface SiteDataDao {
|
||||||
|
//插入数据
|
||||||
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
|
fun insert(vararg lineDataBean: SiteDataBean)
|
||||||
|
|
||||||
|
@Delete
|
||||||
|
fun deleteById(vararg siteDataBean: SiteDataBean)
|
||||||
|
|
||||||
|
@Query("UPDATE ${SiteDataBean.tableName} SET site_id = :site_id ,line_id = :lineId,name = :name,name_kr = :nameKr,seq = :seq," +
|
||||||
|
"gcj_lon = :gcjLon,gcj_lat = :gcjLat,lon = :lon,lat = :lat,introduction = :introduction," +
|
||||||
|
"is_play_tts = :isPlayTts,md5 = :md5,videoList = :videoListDB,tag = :tag WHERE id = :id")
|
||||||
|
fun updateInfo(site_id: Long?, lineId: Long?, name: String?, nameKr: String?, seq: Int?,
|
||||||
|
gcjLon: Double?, gcjLat: Double?, lon: Double?, lat: Double?, introduction: String?,
|
||||||
|
isPlayTts: Boolean?, md5: String?, videoListDB: String?, tag: Int, id: Int
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
// 线路删除时同步删除所属站点
|
||||||
|
@Query("DELETE FROM ${SiteDataBean.tableName} WHERE line_id = :lineId")
|
||||||
|
fun deleteByLineId(lineId: Long)
|
||||||
|
|
||||||
|
//查询线路对应的轨迹信息
|
||||||
|
@Query("SELECT * FROM ${SiteDataBean.tableName} WHERE md5 = :md5")
|
||||||
|
fun querySitesByMd5(md5: String): List<SiteDataBean>?
|
||||||
|
|
||||||
|
//查询线路对应的轨迹信息
|
||||||
|
@Query("SELECT * FROM ${SiteDataBean.tableName}")
|
||||||
|
fun queryAllSites(): List<SiteDataBean>?
|
||||||
|
|
||||||
|
|
||||||
|
@Query("SELECT * FROM ${SiteDataBean.tableName} WHERE line_id = :lineId and site_id = :siteId")
|
||||||
|
fun querySitesByLineIdAndSiteId(lineId: Long, siteId: Long): List<SiteDataBean>?
|
||||||
|
|
||||||
|
@Query("SELECT * FROM ${SiteDataBean.tableName} WHERE line_id = :lineId order by seq")
|
||||||
|
fun querySitesByLineId(lineId: Long): List<SiteDataBean>?
|
||||||
|
|
||||||
|
@Query("SELECT * FROM ${SiteDataBean.tableName} GROUP by md5 HAVING count(1) > 1")
|
||||||
|
fun checkData(): List<SiteDataBean>?
|
||||||
|
|
||||||
|
fun querySiteByLineIdAndSiteId(lineId: Long, siteId: Long): SiteDataBean? {
|
||||||
|
val queryContrailByLineId = querySitesByLineIdAndSiteId(lineId, siteId)
|
||||||
|
return if (queryContrailByLineId.isNullOrEmpty()) {
|
||||||
|
null
|
||||||
|
} else {
|
||||||
|
queryContrailByLineId.first()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,89 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.dao
|
||||||
|
|
||||||
|
import androidx.room.Dao
|
||||||
|
import androidx.room.Delete
|
||||||
|
import androidx.room.Insert
|
||||||
|
import androidx.room.OnConflictStrategy
|
||||||
|
import androidx.room.Query
|
||||||
|
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.TaskDataBean
|
||||||
|
import io.reactivex.Observable
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
interface TaskDataDao {
|
||||||
|
//插入数据
|
||||||
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
|
fun insert(vararg lineDataBean: TaskDataBean)
|
||||||
|
|
||||||
|
//删除数据
|
||||||
|
@Delete
|
||||||
|
fun delete(vararg lineDataBean: TaskDataBean)
|
||||||
|
|
||||||
|
@Query("UPDATE ${TaskDataBean.tableName} SET start_time = :currentTimeMillis ,status = :useing WHERE id = :id")
|
||||||
|
fun updateStatus(currentTimeMillis: Long, useing: Long, id: Int)
|
||||||
|
|
||||||
|
//删除非昨天添加的数据
|
||||||
|
@Query("DELETE FROM ${TaskDataBean.tableName} WHERE task_get_time < :zeroTime")
|
||||||
|
fun deleteDataByZero(zeroTime: Long): Int
|
||||||
|
|
||||||
|
@Query("UPDATE ${TaskDataBean.tableName} SET end_time = :endTime,status = ${TaskDataBean.used} WHERE task_id = :taskId")
|
||||||
|
fun endTask(taskId: Long, endTime: Long = DateTimeUtil.getCurrentTimeStamp())
|
||||||
|
|
||||||
|
//查询当天插入的所有数据
|
||||||
|
@Query("SELECT * FROM ${TaskDataBean.tableName} WHERE task_get_time > :zeroTime")
|
||||||
|
fun loadAllData(zeroTime: Long): List<TaskDataBean>?
|
||||||
|
|
||||||
|
// 查询当天特定线路正在执行的任务
|
||||||
|
@Query("SELECT * FROM ${TaskDataBean.tableName} WHERE task_get_time > :zeroTime and status = ${TaskDataBean.useing} and line_id = :lineId")
|
||||||
|
fun queryRunningTaskByLineId(
|
||||||
|
lineId: Long,
|
||||||
|
zeroTime: Long = DateTimeUtil.getCurrentDateZero()
|
||||||
|
): List<TaskDataBean>?
|
||||||
|
|
||||||
|
// 查询当天特定线路正在执行的任务
|
||||||
|
@Query("SELECT * FROM ${TaskDataBean.tableName} WHERE task_get_time > :zeroTime and status = ${TaskDataBean.useing}")
|
||||||
|
fun queryRunningTaskByStatus(zeroTime: Long = DateTimeUtil.getCurrentDateZero()): List<TaskDataBean>?
|
||||||
|
|
||||||
|
@Query("SELECT * FROM ${TaskDataBean.tableName} WHERE task_get_time > :zeroTime and status = ${TaskDataBean.unUse} and line_id = :lineId order by task_start_time")
|
||||||
|
fun queryUnuseTask(
|
||||||
|
lineId: Long,
|
||||||
|
zeroTime: Long = DateTimeUtil.getCurrentDateZero()
|
||||||
|
): Observable<List<TaskDataBean>?>
|
||||||
|
|
||||||
|
@Query("DELETE FROM ${TaskDataBean.tableName} WHERE task_get_time > :zeroTime and line_id = :lineId")
|
||||||
|
fun deleteByLineId(lineId: Long, zeroTime: Long = DateTimeUtil.getCurrentDateZero())
|
||||||
|
|
||||||
|
@Query("SELECT * FROM ${TaskDataBean.tableName} WHERE line_id = :lineId and task_get_time > :zeroTime")
|
||||||
|
fun querySitesByLineId(
|
||||||
|
lineId: Long?,
|
||||||
|
zeroTime: Long = DateTimeUtil.getCurrentDateZero()
|
||||||
|
): List<TaskDataBean>?
|
||||||
|
|
||||||
|
//查询线路对应的轨迹信息
|
||||||
|
@Query("SELECT * FROM ${TaskDataBean.tableName} WHERE task_id = :taskId")
|
||||||
|
fun queryContrailByLineId(taskId: Long): List<TaskDataBean>?
|
||||||
|
|
||||||
|
//查询线路对应的轨迹信息
|
||||||
|
@Query("SELECT * FROM ${TaskDataBean.tableName}")
|
||||||
|
fun queryAllTask(): List<TaskDataBean>?
|
||||||
|
|
||||||
|
|
||||||
|
// 删除过时数据
|
||||||
|
@Query("DELETE FROM ${TaskDataBean.tableName} WHERE task_get_time < :zeroTime")
|
||||||
|
fun deleteObsoleteData(zeroTime: Long = DateTimeUtil.getCurrentDateZero()): Int
|
||||||
|
|
||||||
|
@Query("UPDATE ${TaskDataBean.tableName} SET shifts_id = 0 WHERE shifts_id is null")
|
||||||
|
fun setShiftsIdDetail()
|
||||||
|
|
||||||
|
|
||||||
|
//查询线路对应的轨迹信息 只要一个结果
|
||||||
|
fun queryTaskByTaskIdOne(taskId: Long): TaskDataBean? {
|
||||||
|
val queryContrailByLineId = queryContrailByLineId(taskId)
|
||||||
|
return if (queryContrailByLineId.isNullOrEmpty()) {
|
||||||
|
null
|
||||||
|
} else {
|
||||||
|
queryContrailByLineId.first()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,37 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.dao
|
||||||
|
|
||||||
|
import androidx.room.Dao
|
||||||
|
import androidx.room.Insert
|
||||||
|
import androidx.room.OnConflictStrategy
|
||||||
|
import androidx.room.Query
|
||||||
|
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.TaskSiteDataBean
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
interface TaskSiteDataDao {
|
||||||
|
//插入数据
|
||||||
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
|
fun insert(vararg lineDataBean: TaskSiteDataBean): List<Long>
|
||||||
|
|
||||||
|
//查询当天插入的所有数据
|
||||||
|
@Query("SELECT * FROM ${TaskSiteDataBean.tableName} WHERE task_id = :taskId order by seq")
|
||||||
|
fun queryRunningTask(taskId: Long): List<TaskSiteDataBean>?
|
||||||
|
|
||||||
|
@Query("UPDATE ${TaskSiteDataBean.tableName} SET leaving = :leave WHERE task_id = :taskId and site_id = :siteId")
|
||||||
|
fun updateLeave(taskId: Long, siteId: Long, leave: Int)
|
||||||
|
|
||||||
|
@Query("UPDATE ${TaskSiteDataBean.tableName} SET leaving = :leave , driving_status = :drivingStatusCurrent WHERE task_id = :taskId and site_id = :siteId")
|
||||||
|
fun updateDrivingStatusANdLeave(taskId: Long, siteId: Long, drivingStatusCurrent: Int, leave: Int)
|
||||||
|
|
||||||
|
@Query("UPDATE ${TaskSiteDataBean.tableName} SET driving_status = :drivingStatusCurrent WHERE task_id = :taskId and site_id = :siteId")
|
||||||
|
fun updateDrivingStatus(taskId: Long, siteId: Long, drivingStatusCurrent: Int)
|
||||||
|
|
||||||
|
// 删除过时数据
|
||||||
|
@Query("DELETE FROM ${TaskSiteDataBean.tableName} WHERE event_save_time < :zeroTime")
|
||||||
|
fun deleteObsoleteData(zeroTime: Long = DateTimeUtil.getCurrentDateZero()): Int
|
||||||
|
|
||||||
|
// 根据taskId删除所属站点信息
|
||||||
|
@Query("DELETE FROM ${TaskSiteDataBean.tableName} WHERE task_id = :taskId")
|
||||||
|
fun deleteErrorDataByTaskId(taskId: Long)
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,46 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.dao
|
||||||
|
|
||||||
|
import androidx.room.Dao
|
||||||
|
import androidx.room.Delete
|
||||||
|
import androidx.room.Insert
|
||||||
|
import androidx.room.OnConflictStrategy
|
||||||
|
import androidx.room.Query
|
||||||
|
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.WriteOffDataBean
|
||||||
|
|
||||||
|
@Dao
|
||||||
|
interface WriteOffDataDao {
|
||||||
|
|
||||||
|
//插入数据
|
||||||
|
@Insert(onConflict = OnConflictStrategy.REPLACE)
|
||||||
|
fun insert(vararg eventDataBean: WriteOffDataBean)
|
||||||
|
|
||||||
|
//删除数据
|
||||||
|
@Delete
|
||||||
|
fun delete(vararg eventDataBean: WriteOffDataBean)
|
||||||
|
|
||||||
|
// 删除过时数据
|
||||||
|
@Query("DELETE FROM ${WriteOffDataBean.tableName} WHERE event_save_time < :zeroTime")
|
||||||
|
fun deleteObsoleteData(zeroTime: Long = DateTimeUtil.getCurrentDateZero()): Int
|
||||||
|
|
||||||
|
|
||||||
|
@Query("SELECT * FROM ${WriteOffDataBean.tableName} WHERE event_save_time > :zeroTime and order_no = :orderNo order by event_save_time")
|
||||||
|
fun queryWriteOffByOrderNo(zeroTime: Long = DateTimeUtil.getCurrentDateZero(), orderNo: String): List<WriteOffDataBean>?
|
||||||
|
|
||||||
|
@Query("SELECT * FROM ${WriteOffDataBean.tableName} WHERE event_save_time > :zeroTime and task_id = :taskId and update_status = ${WriteOffDataBean.notUpdate}")
|
||||||
|
fun queryWaitWriteOffByTaskId(taskId: Long, zeroTime: Long = DateTimeUtil.getCurrentDateZero()): List<WriteOffDataBean>?
|
||||||
|
|
||||||
|
@Query("SELECT * FROM ${WriteOffDataBean.tableName} WHERE update_status = ${WriteOffDataBean.notUpdate}")
|
||||||
|
fun queryWriteOffEventByStatusWithPage(): List<WriteOffDataBean>?
|
||||||
|
|
||||||
|
@Query("SELECT * FROM ${WriteOffDataBean.tableName} WHERE event_save_time > :zeroTime and task_id = :taskId and site_id = :siteId")
|
||||||
|
fun queryWriteOffByTaskAndSiteId(taskId: Long, siteId: Long, zeroTime: Long = DateTimeUtil.getCurrentDateZero()): List<WriteOffDataBean>?
|
||||||
|
|
||||||
|
@Query("SELECT count(1) FROM ${WriteOffDataBean.tableName} WHERE update_status = ${WriteOffDataBean.notUpdate}")
|
||||||
|
fun queryWriteOffByStatusWithPageCount(): Int
|
||||||
|
|
||||||
|
@Query("UPDATE ${WriteOffDataBean.tableName} SET update_status = :updated ,update_time = :currentTimeMillis WHERE id = :id")
|
||||||
|
fun updateStatusAndTime(updated: Int, currentTimeMillis: Long, id: Int)
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,91 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.repository
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.network.utils.digest.DigestUtils
|
||||||
|
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||||
|
import com.mogo.och.unmanned.model.SynchDataModel
|
||||||
|
import com.mogo.och.unmanned.repository.db.IDbRepository
|
||||||
|
import com.mogo.och.unmanned.repository.db.MyDataBase
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.ContrailDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.dao.ContrailDataDao
|
||||||
|
|
||||||
|
object ContraiDb : IDbRepository {
|
||||||
|
|
||||||
|
private var contrailDao: ContrailDataDao? = null
|
||||||
|
get() {
|
||||||
|
if (field == null) {
|
||||||
|
field = MyDataBase.instance?.contrailDataDao
|
||||||
|
register()
|
||||||
|
}
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun release() {
|
||||||
|
contrailDao = null
|
||||||
|
}
|
||||||
|
|
||||||
|
fun addOrUpdate(contrailDatalist: List<ContrailDataBean>) {
|
||||||
|
val runnable = Runnable {
|
||||||
|
// 校验数据个数
|
||||||
|
contrailDao?.let { contrailDao ->
|
||||||
|
val needUpdatePoint = mutableListOf<Long>()
|
||||||
|
contrailDatalist.forEach {
|
||||||
|
val md5Source = it.toString()
|
||||||
|
val md5Hex = DigestUtils.md5Hex(md5Source)
|
||||||
|
val queryContrailByMd5 = contrailDao.queryContrailByMd5(md5Hex)
|
||||||
|
if (queryContrailByMd5.isNullOrEmpty()) {// 没有值或者值有变化
|
||||||
|
val needUpdate = contrailDao.queryContrailByLineIdOne(it.lineId!!)
|
||||||
|
it.md5 = md5Hex
|
||||||
|
needUpdatePoint.add(it.lineId!!)
|
||||||
|
if (needUpdate != null) {// 更新
|
||||||
|
it.id = needUpdate.id
|
||||||
|
contrailDao.update(it.csvFileUrl ?: "", it.csvFileMd5
|
||||||
|
?: "", it.txtFileUrl ?: "", it.txtFileMd5
|
||||||
|
?: "", System.currentTimeMillis(), md5Hex, needUpdate.id)
|
||||||
|
} else {// 插入新的
|
||||||
|
contrailDao.insert(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (needUpdatePoint.isNotEmpty()) {
|
||||||
|
SynchDataModel.synContraiInfo(needUpdatePoint)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BizLoopManager.runInIoThread(runnable)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun deleteByLineId(lineId: Long) {
|
||||||
|
contrailDao?.deleteByLineId(lineId)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryAutopilotInfoByLineid(lineId: Long): ContrailDataBean? {
|
||||||
|
return contrailDao?.queryContrailByLineIdOne(lineId)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun saveRunningInfo(
|
||||||
|
lineId: Int,
|
||||||
|
csvFileMd5: String?,
|
||||||
|
csvFileUrl: String?,
|
||||||
|
txtFileUrl: String?,
|
||||||
|
txtFileMd5: String?,
|
||||||
|
contrailSaveTime: Long
|
||||||
|
) {
|
||||||
|
val runningLine = ContrailDataBean(
|
||||||
|
lineId = lineId.toLong(),
|
||||||
|
csvFileUrl = csvFileUrl,
|
||||||
|
csvFileMd5 = csvFileMd5,
|
||||||
|
txtFileUrl = txtFileUrl,
|
||||||
|
txtFileMd5 = txtFileMd5,
|
||||||
|
contrailSaveTime = contrailSaveTime
|
||||||
|
)
|
||||||
|
addOrUpdate(mutableListOf(runningLine))
|
||||||
|
}
|
||||||
|
|
||||||
|
fun upDateIdAndsource(contrailId: Long?, source: Int?, lineId: Long?) {
|
||||||
|
if (contrailId != null && source != null && lineId != null) {
|
||||||
|
contrailDao?.updateIdAndSource(contrailId, source, lineId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,175 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.repository
|
||||||
|
|
||||||
|
import androidx.room.Transaction
|
||||||
|
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||||
|
import com.mogo.och.common.module.manager.cache.OchSPManager
|
||||||
|
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||||
|
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||||
|
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||||
|
import com.mogo.och.unmanned.model.EventModel
|
||||||
|
import com.mogo.och.unmanned.repository.db.IDbRepository
|
||||||
|
import com.mogo.och.unmanned.repository.db.MyDataBase
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.EventDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.dao.EventDataDao
|
||||||
|
import io.reactivex.Observable
|
||||||
|
|
||||||
|
|
||||||
|
object EventDb : IDbRepository {
|
||||||
|
|
||||||
|
private var eventDataDao: EventDataDao? = null
|
||||||
|
get() {
|
||||||
|
if (field == null) {
|
||||||
|
field = MyDataBase.instance?.eventDataDao
|
||||||
|
register()
|
||||||
|
}
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun release() {
|
||||||
|
eventDataDao = null
|
||||||
|
}
|
||||||
|
|
||||||
|
fun saveEventTaskStart(shiftsId: Long, taskId: Long, lineId: Long, taskStartTime: Long, name: String, taskDate: Long) {
|
||||||
|
val event = EventDataBean()
|
||||||
|
event.eventType = EventDataBean.TaskStart
|
||||||
|
event.lineId = lineId
|
||||||
|
event.taskId = taskId
|
||||||
|
event.shiftsId = shiftsId
|
||||||
|
event.taskDate = taskDate
|
||||||
|
event.lineName = name
|
||||||
|
event.taskStartTime = taskStartTime
|
||||||
|
event.businessTime = DateTimeUtil.getCurrentTimeStamp()
|
||||||
|
event.writeVersion = DateTimeUtil.getCurrentTimeStamp()
|
||||||
|
event.driverId = LoginStatusManager.getOchLoginInfo()?.driverId ?: -1
|
||||||
|
event.siteId = 0L
|
||||||
|
event.seq = 0
|
||||||
|
event.msgId = "${OchSPManager.getSn()}_${DateTimeUtil.getCurrentTimeStamp()}"
|
||||||
|
BizLoopManager.runInIoThread {
|
||||||
|
eventDataDao?.insert(event)
|
||||||
|
EventModel.notifySyn()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun saveEventTaskArriveSite(
|
||||||
|
shiftsId: Long,
|
||||||
|
taskId: Long,
|
||||||
|
lineId: Long,
|
||||||
|
siteId: Long,
|
||||||
|
seq: Int,
|
||||||
|
taskStartTime: Long?,
|
||||||
|
lineName: String,
|
||||||
|
taskDate: Long?
|
||||||
|
) {
|
||||||
|
val event = EventDataBean()
|
||||||
|
event.eventType = EventDataBean.TaskArriveSite
|
||||||
|
event.lineId = lineId
|
||||||
|
event.shiftsId = shiftsId
|
||||||
|
event.taskStartTime = taskStartTime
|
||||||
|
event.lineName = lineName
|
||||||
|
event.taskId = taskId
|
||||||
|
event.taskDate = taskDate
|
||||||
|
event.businessTime = DateTimeUtil.getCurrentTimeStamp()
|
||||||
|
event.writeVersion = DateTimeUtil.getCurrentTimeStamp()
|
||||||
|
event.siteId = siteId
|
||||||
|
event.driverId = LoginStatusManager.getOchLoginInfo()?.driverId ?: -1
|
||||||
|
event.seq = seq
|
||||||
|
event.msgId = "${OchSPManager.getSn()}_${DateTimeUtil.getCurrentTimeStamp()}"
|
||||||
|
BizLoopManager.runInIoThread {
|
||||||
|
eventDataDao?.insert(event)
|
||||||
|
EventModel.notifySyn()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun saveEventTaskLeaveSite(
|
||||||
|
shiftsId: Long,
|
||||||
|
taskId: Long,
|
||||||
|
lineId: Long,
|
||||||
|
siteId: Long,
|
||||||
|
seq: Int,
|
||||||
|
taskStartTime: Long?,
|
||||||
|
lineName: String,
|
||||||
|
taskDate: Long
|
||||||
|
) {
|
||||||
|
val event = EventDataBean()
|
||||||
|
event.eventType = EventDataBean.TaskLeaveSite
|
||||||
|
event.lineId = lineId
|
||||||
|
event.shiftsId = shiftsId
|
||||||
|
event.taskId = taskId
|
||||||
|
event.taskDate = taskDate
|
||||||
|
event.taskStartTime = taskStartTime
|
||||||
|
event.lineName = lineName
|
||||||
|
event.businessTime = DateTimeUtil.getCurrentTimeStamp()
|
||||||
|
event.writeVersion = DateTimeUtil.getCurrentTimeStamp()
|
||||||
|
event.driverId = LoginStatusManager.getOchLoginInfo()?.driverId ?: -1L
|
||||||
|
event.siteId = siteId
|
||||||
|
event.seq = seq
|
||||||
|
event.msgId = "${OchSPManager.getSn()}_${DateTimeUtil.getCurrentTimeStamp()}"
|
||||||
|
BizLoopManager.runInIoThread {
|
||||||
|
eventDataDao?.insert(event)
|
||||||
|
EventModel.notifySyn()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun saveEventTaskEnd(
|
||||||
|
shiftsId: Long,
|
||||||
|
taskId: Long,
|
||||||
|
lineId: Long,
|
||||||
|
taskStartTime: Long?,
|
||||||
|
lineName: String,
|
||||||
|
taskDate: Long
|
||||||
|
) {
|
||||||
|
val event = EventDataBean()
|
||||||
|
event.eventType = EventDataBean.TaskEnd
|
||||||
|
event.lineId = lineId
|
||||||
|
event.shiftsId = shiftsId
|
||||||
|
event.taskId = taskId
|
||||||
|
event.taskDate = taskDate
|
||||||
|
event.lineName = lineName
|
||||||
|
event.taskStartTime = taskStartTime
|
||||||
|
event.businessTime = DateTimeUtil.getCurrentTimeStamp()
|
||||||
|
event.writeVersion = DateTimeUtil.getCurrentTimeStamp()
|
||||||
|
event.driverId = LoginStatusManager.getOchLoginInfo()?.driverId ?: -1L
|
||||||
|
event.siteId = 0L
|
||||||
|
event.seq = 0
|
||||||
|
event.msgId = "${OchSPManager.getSn()}_${DateTimeUtil.getCurrentTimeStamp()}"
|
||||||
|
BizLoopManager.runInIoThread {
|
||||||
|
eventDataDao?.insert(event)
|
||||||
|
EventModel.notifySyn()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryWaitUpdateEvent(): List<EventDataBean>? {
|
||||||
|
return eventDataDao?.queryEventByStatusWithPage()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryWaitUpdateEventCount(): Int? {
|
||||||
|
return eventDataDao?.queryEventByStatusWithPageCount()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryLastData(): EventDataBean? {
|
||||||
|
val queryLastDataByWaritData = eventDataDao?.queryLastDataByWaritData()
|
||||||
|
if (queryLastDataByWaritData.isNullOrEmpty()) {
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
return queryLastDataByWaritData.first()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transaction
|
||||||
|
fun saveUpdateSuccess(waitUpdateEvent: List<EventDataBean>) {
|
||||||
|
waitUpdateEvent.forEach {
|
||||||
|
eventDataDao?.updateUpdateSatus(it.id, it.updateStatus, System.currentTimeMillis())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun deleteObsoleteData() {
|
||||||
|
eventDataDao?.deleteObsoleteData()?.let {
|
||||||
|
OchChainLogManager.writeChainLogDb("删除临时数据", "Event删除数量:${it}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryWaitUploadData(): Observable<List<EventDataBean>?>? {
|
||||||
|
return eventDataDao?.queryWaitUploadInfo()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,141 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.repository
|
||||||
|
|
||||||
|
import androidx.room.Transaction
|
||||||
|
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||||
|
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||||
|
import com.mogo.och.unmanned.repository.db.IDbRepository
|
||||||
|
import com.mogo.och.unmanned.repository.db.MyDataBase
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.LineDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.dao.LineDataDao
|
||||||
|
import io.reactivex.Observable
|
||||||
|
|
||||||
|
object LineDb : IDbRepository {
|
||||||
|
|
||||||
|
private var lineDao: LineDataDao? = null
|
||||||
|
get() {
|
||||||
|
if (field == null) {
|
||||||
|
field = MyDataBase.instance?.lineDataDao
|
||||||
|
register()
|
||||||
|
}
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun release() {
|
||||||
|
lineDao = null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun cleanWeltData() {
|
||||||
|
lineDao?.deleteWeltData()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryCanUserLine(): List<LineDataBean>? {
|
||||||
|
return lineDao?.loadData()
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 读取可用线路
|
||||||
|
*/
|
||||||
|
fun queryCanUseLineRx(): Observable<List<LineDataBean>?>? {
|
||||||
|
return lineDao?.loadDataRx()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun checkAndUpdate(serverDatalist: List<LineDataBean>) {
|
||||||
|
val runable = object : Runnable {
|
||||||
|
@Transaction
|
||||||
|
override fun run() {
|
||||||
|
// 校验数据个数
|
||||||
|
lineDao?.let { lineDao ->
|
||||||
|
val loadData = lineDao.loadData()
|
||||||
|
if (loadData.isNullOrEmpty()) {
|
||||||
|
// 插入新的值
|
||||||
|
lineDao.insert(*serverDatalist.toTypedArray())
|
||||||
|
// TODO: Ui展示需要动态刷新UI去
|
||||||
|
return
|
||||||
|
}
|
||||||
|
// 后台新增数据
|
||||||
|
val needAddDatas = serverDatalist - loadData
|
||||||
|
// 后台没有本地数据库有的未分配线路
|
||||||
|
val needMinusDatas = loadData - serverDatalist
|
||||||
|
|
||||||
|
// TODO: Ui展示需要动态刷新UI去
|
||||||
|
|
||||||
|
if (needAddDatas.isNotEmpty()) {
|
||||||
|
// 新增线路
|
||||||
|
lineDao.insert(*needAddDatas.toTypedArray())
|
||||||
|
}
|
||||||
|
if (needMinusDatas.isNotEmpty()) {
|
||||||
|
// 删除线路
|
||||||
|
lineDao.delete(*needMinusDatas.toTypedArray())
|
||||||
|
needMinusDatas.forEach { minusLine ->
|
||||||
|
minusLine.lineId?.let { lineId ->
|
||||||
|
// 删除线路对应的站点
|
||||||
|
SiteDb.deleteByLineId(lineId)
|
||||||
|
val runingTask = TaskDb.queryRunningTaskByLineId(lineId)
|
||||||
|
if (runingTask.isNullOrEmpty()) {
|
||||||
|
// 删除线路对应的自驾信息
|
||||||
|
ContraiDb.deleteByLineId(lineId)
|
||||||
|
TaskDb.deleteByLineId(lineId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 交集 服务器端
|
||||||
|
val needUpdateByMd5 = serverDatalist - needAddDatas
|
||||||
|
// 交集 本地数据库
|
||||||
|
val oldDataList = loadData - needMinusDatas
|
||||||
|
|
||||||
|
val needDelete = mutableListOf<LineDataBean>()
|
||||||
|
val needUpDate = mutableListOf<LineDataBean>()
|
||||||
|
|
||||||
|
needUpdateByMd5.forEach {
|
||||||
|
val oldList = oldDataList.filter { local -> local.lineId == it.lineId }
|
||||||
|
if (oldList.isNotEmpty()) {
|
||||||
|
oldList.forEachIndexed { index, lineBean ->
|
||||||
|
if (index == 0) {
|
||||||
|
if (lineBean.lineName == it.lineName && lineBean.endStationName == it.endStationName) {
|
||||||
|
// 数据没有变化
|
||||||
|
} else {
|
||||||
|
it.id = lineBean.id
|
||||||
|
needUpDate.add(it)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 站点多了 需要删除
|
||||||
|
needDelete.add(lineBean)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lineDao.delete(*needDelete.toTypedArray())
|
||||||
|
|
||||||
|
needUpDate.forEach { updateItem ->
|
||||||
|
// 跟新数据
|
||||||
|
lineDao.updateInfo(updateItem.lineName, updateItem.endStationName, updateItem.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
BizLoopManager.runInIoThread(runable)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun deleteObsoleteData() {
|
||||||
|
lineDao?.deleteObsoleteData()?.let {
|
||||||
|
OchChainLogManager.writeChainLogDb("删除临时数据", "Line删除数量:${it}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 没有线路就插入线路
|
||||||
|
*/
|
||||||
|
fun saveRunningInfo(lineId: Int, lineName: String?, endStationName: String?) {
|
||||||
|
val queryByLineId = lineDao?.queryByLineId(lineId)
|
||||||
|
if (queryByLineId.isNullOrEmpty()) {
|
||||||
|
lineDao?.insert(LineDataBean(lineId = lineId.toLong(), lineName = lineName, endStationName = endStationName))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,118 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.repository
|
||||||
|
|
||||||
|
import com.mogo.och.unmanned.bean.response.PointResponse
|
||||||
|
import com.mogo.och.unmanned.repository.db.IDbRepository
|
||||||
|
import com.mogo.och.unmanned.repository.db.MyDataBase
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.ContrailDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.PointDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.dao.PointDataDao
|
||||||
|
|
||||||
|
object PointDb : IDbRepository {
|
||||||
|
|
||||||
|
private var pointDao: PointDataDao? = null
|
||||||
|
get() {
|
||||||
|
if (field == null) {
|
||||||
|
field = MyDataBase.instance?.pointDataDao
|
||||||
|
register()
|
||||||
|
}
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun release() {
|
||||||
|
pointDao = null
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryPointByLineId(lineId: Long?): List<PointDataBean>? {
|
||||||
|
lineId?.let {
|
||||||
|
return pointDao?.queryPointByLineId(lineId)
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
fun deletePointByLineIds(lineIds: List<Long>) {
|
||||||
|
pointDao?.deleteByLineId(lineIds)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun addOrUpdate(serverDataList: List<PointResponse>) {
|
||||||
|
val contaiBeans = mutableListOf<PointDataBean>()
|
||||||
|
val needDelete = mutableListOf<Long>()
|
||||||
|
val needUpdateLineInfos = mutableListOf<ContrailDataBean>()
|
||||||
|
|
||||||
|
serverDataList.forEach { contrailInfo ->
|
||||||
|
val lineId = contrailInfo.lineId
|
||||||
|
// 当前线路已排序的所有站点
|
||||||
|
val siteList = SiteDb.querySiteByLineId(lineId)
|
||||||
|
val contraiBean = ContraiDb.queryAutopilotInfoByLineid(lineId)
|
||||||
|
|
||||||
|
contraiBean?.let {
|
||||||
|
contraiBean.source = contrailInfo.source
|
||||||
|
contraiBean.contrailId = contrailInfo.contrailId
|
||||||
|
needUpdateLineInfos.add(contraiBean)
|
||||||
|
}
|
||||||
|
|
||||||
|
val segmentPointList = contrailInfo.segmentPointList
|
||||||
|
needDelete.add(lineId)
|
||||||
|
segmentPointList.forEachIndexed { index, segmentPoint ->
|
||||||
|
val siteIndex = segmentPoint.segment
|
||||||
|
siteList?.let { siteListTemp ->
|
||||||
|
siteIndex?.let { siteIndexTemp ->
|
||||||
|
// 途径点和禁行点所有站点
|
||||||
|
// TODO:("站点接口和轨迹接口绑定有问题的情况未来要处理")
|
||||||
|
if (siteIndexTemp < 0 || siteIndexTemp >= siteListTemp.size) return@forEachIndexed
|
||||||
|
val siteDataBean = siteListTemp[siteIndexTemp]
|
||||||
|
segmentPoint.pointList?.forEachIndexed { index, point ->
|
||||||
|
val pointTemp = PointDataBean()
|
||||||
|
pointTemp.lineId = lineId
|
||||||
|
pointTemp.contrailId = contrailInfo.contrailId
|
||||||
|
pointTemp.siteId = siteDataBean.siteId
|
||||||
|
pointTemp.md5 = contraiBean?.md5 ?: ""
|
||||||
|
pointTemp.seq = siteIndex
|
||||||
|
pointTemp.pointType = PointDataBean.pointTypePass
|
||||||
|
pointTemp.longitude = point.longitude
|
||||||
|
pointTemp.latitude = point.latitude
|
||||||
|
pointTemp.subSeq = index
|
||||||
|
contaiBeans.add(pointTemp)
|
||||||
|
}
|
||||||
|
segmentPoint.blackList?.forEachIndexed { index, black ->
|
||||||
|
val pointTemp = PointDataBean()
|
||||||
|
pointTemp.lineId = lineId
|
||||||
|
pointTemp.contrailId = contrailInfo.contrailId
|
||||||
|
pointTemp.siteId = siteDataBean.siteId
|
||||||
|
pointTemp.md5 = contraiBean?.md5 ?: ""
|
||||||
|
pointTemp.seq = siteIndex
|
||||||
|
pointTemp.pointType = PointDataBean.pointTypeBlack
|
||||||
|
pointTemp.longitude = black.longitude
|
||||||
|
pointTemp.latitude = black.latitude
|
||||||
|
pointTemp.subSeq = index
|
||||||
|
contaiBeans.add(pointTemp)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (needUpdateLineInfos.size < 100) {
|
||||||
|
needUpdateLineInfos.forEach {
|
||||||
|
ContraiDb.upDateIdAndsource(it.contrailId, it.source, it.lineId)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
MyDataBase.instance?.runInTransaction {
|
||||||
|
needUpdateLineInfos.forEach {
|
||||||
|
ContraiDb.upDateIdAndsource(it.contrailId, it.source, it.lineId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (needDelete.size < 100) {
|
||||||
|
pointDao?.deleteByLineId(needDelete)
|
||||||
|
} else {
|
||||||
|
pointDao?.deleteByLineIdTra(needDelete)
|
||||||
|
}
|
||||||
|
if (contaiBeans.size < 100) {
|
||||||
|
pointDao?.insert(*contaiBeans.toTypedArray())
|
||||||
|
} else {
|
||||||
|
pointDao?.insertTra(*contaiBeans.toTypedArray())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,146 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.repository
|
||||||
|
|
||||||
|
import androidx.room.Transaction
|
||||||
|
import com.mogo.eagle.core.network.utils.digest.DigestUtils
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||||
|
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||||
|
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||||
|
import com.mogo.och.unmanned.model.SynchDataModel
|
||||||
|
import com.mogo.och.unmanned.repository.db.IDbRepository
|
||||||
|
import com.mogo.och.unmanned.repository.db.MyDataBase
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.SiteDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.dao.SiteDataDao
|
||||||
|
|
||||||
|
object SiteDb : IDbRepository {
|
||||||
|
|
||||||
|
private const val TAG = "SiteDb"
|
||||||
|
|
||||||
|
private var siteDataDao: SiteDataDao? = null
|
||||||
|
get() {
|
||||||
|
if (field == null) {
|
||||||
|
field = MyDataBase.instance?.siteDataDao
|
||||||
|
register()
|
||||||
|
}
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun release() {
|
||||||
|
siteDataDao = null
|
||||||
|
}
|
||||||
|
|
||||||
|
fun addOrUpdate(serverDataList: List<SiteDataBean>) {
|
||||||
|
val runnable = object : Runnable {
|
||||||
|
@Transaction
|
||||||
|
override fun run() {
|
||||||
|
siteDataDao?.let { siteDataDao ->
|
||||||
|
val localAllSites = siteDataDao.queryAllSites()
|
||||||
|
if (localAllSites.isNullOrEmpty()) {
|
||||||
|
// 插入新数据
|
||||||
|
siteDataDao.insert(*serverDataList.toTypedArray())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
val delPointByLineIds = mutableSetOf<Long>()
|
||||||
|
// 后台新增数据
|
||||||
|
val needAddDatas = serverDataList - localAllSites
|
||||||
|
// 后台没有本地数据库有的未分配线路
|
||||||
|
val needMinusDatas = localAllSites - serverDataList
|
||||||
|
|
||||||
|
if (needAddDatas.isNotEmpty()) {
|
||||||
|
// 新增线路
|
||||||
|
needAddDatas.forEach {
|
||||||
|
val md5Source = it.toString()
|
||||||
|
val md5Hex = DigestUtils.md5Hex(md5Source)
|
||||||
|
it.md5 = md5Hex
|
||||||
|
it.lineId?.let { lineId -> delPointByLineIds.add(lineId) }
|
||||||
|
}
|
||||||
|
// 新增插入新数据
|
||||||
|
siteDataDao.insert(*needAddDatas.toTypedArray())
|
||||||
|
}
|
||||||
|
|
||||||
|
if (needMinusDatas.isNotEmpty()) {
|
||||||
|
// 删除线路
|
||||||
|
siteDataDao.deleteById(*needMinusDatas.toTypedArray())
|
||||||
|
needMinusDatas.forEach {
|
||||||
|
it.lineId?.let { it1 -> delPointByLineIds.add(it1) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 交集 服务器端
|
||||||
|
val needUpdateByMd5 = serverDataList - needAddDatas
|
||||||
|
// 交集 本地数据库
|
||||||
|
val oldDataList = localAllSites - needMinusDatas
|
||||||
|
|
||||||
|
val needDelete = mutableListOf<SiteDataBean>()
|
||||||
|
val needUpDate = mutableListOf<SiteDataBean>()
|
||||||
|
|
||||||
|
|
||||||
|
needUpdateByMd5.forEach {
|
||||||
|
val md5Source = it.toString()
|
||||||
|
val md5Hex = DigestUtils.md5Hex(md5Source)
|
||||||
|
val oldList =
|
||||||
|
oldDataList.filter { local -> local.siteId == it.siteId && local.lineId == it.lineId }
|
||||||
|
if (oldList.isNotEmpty()) {
|
||||||
|
oldList.forEachIndexed { index, siteDataBean ->
|
||||||
|
if (index == 0) {
|
||||||
|
if (siteDataBean.md5 == md5Hex) {
|
||||||
|
// 数据没有变化
|
||||||
|
} else {
|
||||||
|
it.id = siteDataBean.id
|
||||||
|
it.md5 = md5Hex
|
||||||
|
needUpDate.add(it)
|
||||||
|
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
needDelete.add(siteDataBean)
|
||||||
|
siteDataBean.lineId?.let { it1 -> delPointByLineIds.add(it1) }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
needUpDate.forEach { updateDateItem ->
|
||||||
|
siteDataDao.updateInfo(updateDateItem.siteId, updateDateItem.lineId, updateDateItem.name, updateDateItem.nameKr,
|
||||||
|
updateDateItem.seq, updateDateItem.gcjLon, updateDateItem.gcjLat, updateDateItem.lon, updateDateItem.lat,
|
||||||
|
updateDateItem.introduction, updateDateItem.isPlayTts, updateDateItem.md5, updateDateItem.videoListDB, updateDateItem.tag, updateDateItem.id)
|
||||||
|
updateDateItem.lineId?.let { delPointByLineIds.add(it) }
|
||||||
|
}
|
||||||
|
siteDataDao.deleteById(*needDelete.toTypedArray())
|
||||||
|
// 清除所有变更的站点
|
||||||
|
if (delPointByLineIds.isNotEmpty()) {
|
||||||
|
val delPointList = delPointByLineIds.toMutableList()
|
||||||
|
PointDb.deletePointByLineIds(delPointList)
|
||||||
|
SynchDataModel.synContraiInfo(delPointList)
|
||||||
|
}
|
||||||
|
checkData()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
BizLoopManager.runInIoThread(runnable)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun checkData() {
|
||||||
|
CallerLogger.d(TAG, "检测站点数据")
|
||||||
|
siteDataDao?.checkData()?.let { list ->
|
||||||
|
list.forEach {
|
||||||
|
siteDataDao?.deleteById(it)
|
||||||
|
}
|
||||||
|
if (list.isNotEmpty()) {
|
||||||
|
OchChainLogManager.writeChainLogDb("数据检测", "有重复数据${list}")
|
||||||
|
checkData()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun deleteByLineId(lineId: Long) {
|
||||||
|
siteDataDao?.deleteByLineId(lineId)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun querySiteByLineId(lineId: Long): List<SiteDataBean>? {
|
||||||
|
siteDataDao?.let { siteDataDao ->
|
||||||
|
return siteDataDao.querySitesByLineId(lineId)
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,228 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.repository
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||||
|
import com.mogo.eagle.core.utilcode.util.StringUtils
|
||||||
|
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||||
|
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||||
|
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||||
|
import com.mogo.och.data.db.exception.DbException
|
||||||
|
import com.mogo.och.shuttle.unmanned.R
|
||||||
|
import com.mogo.och.unmanned.model.LineModel
|
||||||
|
import com.mogo.och.unmanned.repository.db.IDbRepository
|
||||||
|
import com.mogo.och.unmanned.repository.db.MyDataBase
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.TaskDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.dao.TaskDataDao
|
||||||
|
import com.mogo.och.unmanned.repository.exception.DataException
|
||||||
|
import io.reactivex.Observable
|
||||||
|
|
||||||
|
object TaskDb : IDbRepository {
|
||||||
|
|
||||||
|
private const val TAG = "${M_BUS}TaskDb"
|
||||||
|
|
||||||
|
private var taskDataDao: TaskDataDao? = null
|
||||||
|
get() {
|
||||||
|
if (field == null) {
|
||||||
|
field = MyDataBase.instance?.taskDataDao
|
||||||
|
register()
|
||||||
|
}
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun release() {
|
||||||
|
taskDataDao = null
|
||||||
|
}
|
||||||
|
|
||||||
|
fun addOrUpdate(vararg lineDataBean: TaskDataBean) {
|
||||||
|
// 从接口恢复数据
|
||||||
|
taskDataDao?.insert(*lineDataBean)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun addOrUpdate(serverDateList: List<TaskDataBean>, lineId: Long?) {
|
||||||
|
val runable = object : Runnable {
|
||||||
|
override fun run() {
|
||||||
|
taskDataDao?.let { taskDataDao ->
|
||||||
|
val localTasks = taskDataDao.querySitesByLineId(lineId)
|
||||||
|
if (localTasks == null) {
|
||||||
|
taskDataDao.insert(*serverDateList.toTypedArray())
|
||||||
|
// TODO: Ui展示需要动态刷新UI去
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
// 后台新增数据
|
||||||
|
val needAddDatas = serverDateList - localTasks
|
||||||
|
// 后台没有本地数据库有的未分配线路
|
||||||
|
val needMinusDatas = localTasks - serverDateList
|
||||||
|
|
||||||
|
// TODO: Ui展示需要动态刷新UI去
|
||||||
|
|
||||||
|
if (needAddDatas.isNotEmpty()) {
|
||||||
|
// 新增任务
|
||||||
|
taskDataDao.insert(*needAddDatas.toTypedArray())
|
||||||
|
}
|
||||||
|
if (needMinusDatas.isNotEmpty()) {
|
||||||
|
val needSaveTask = mutableListOf<TaskDataBean>()
|
||||||
|
// 删除任务
|
||||||
|
needMinusDatas.forEach {
|
||||||
|
if (it.status == TaskDataBean.useing || it.status == TaskDataBean.used) {
|
||||||
|
needSaveTask.add(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val failneedMinusDatas = needMinusDatas - needSaveTask
|
||||||
|
taskDataDao.delete(*failneedMinusDatas.toTypedArray())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
BizLoopManager.runInIoThread(runable)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取线路可用的任务
|
||||||
|
*/
|
||||||
|
fun queryCanUserTask(lineId: Long): Observable<List<TaskDataBean>?>? {
|
||||||
|
taskDataDao?.let { taskDataDao ->
|
||||||
|
// 查询当天未使用的任务
|
||||||
|
return taskDataDao.queryUnuseTask(lineId).map {
|
||||||
|
it.filter { (System.currentTimeMillis() - it.taskStartTime!!) < 10 * 60 * 1000 }
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null
|
||||||
|
}
|
||||||
|
|
||||||
|
fun startTask(shiftsId: Long, taskId: Long, lineId: Long, lineName: String): Observable<Boolean>? {
|
||||||
|
return Observable.just(taskId)
|
||||||
|
.flatMap {
|
||||||
|
var updateCount: Int? = 0
|
||||||
|
var startTime = System.currentTimeMillis()
|
||||||
|
try {
|
||||||
|
// 更新task状态
|
||||||
|
taskDataDao?.queryTaskByTaskIdOne(taskId)?.let {
|
||||||
|
it.startTime = System.currentTimeMillis()
|
||||||
|
it.status = TaskDataBean.useing
|
||||||
|
// 更新任务状态
|
||||||
|
taskDataDao?.updateStatus(System.currentTimeMillis(), TaskDataBean.useing, it.id)
|
||||||
|
OchChainLogManager.writeChainLogDb("开始任务", "变更线路:${lineId}_${lineName}_task:${taskId} 为正在使用的状态")
|
||||||
|
}
|
||||||
|
CallerLogger.d(TAG, "更新任务状态用时:${System.currentTimeMillis() - startTime}")
|
||||||
|
startTime = System.currentTimeMillis()
|
||||||
|
updateCount = TaskSiteDb.startTask(shiftsId, taskId, lineId, lineName)
|
||||||
|
OchChainLogManager.writeChainLogDb("开始任务", "把正在使用的数据更新到RunningTask表格一共${updateCount}行数据")
|
||||||
|
CallerLogger.d(TAG, "插入正在运行的线路用时:${System.currentTimeMillis() - startTime}")
|
||||||
|
} catch (e: Exception) {
|
||||||
|
if (e is DbException) {
|
||||||
|
if (e.code == DbException.NEEDSYNDATA) {
|
||||||
|
// 重新同步 信息
|
||||||
|
LineModel.refreshTask()
|
||||||
|
println("数据不全")
|
||||||
|
// 恢复数据
|
||||||
|
taskDataDao?.queryTaskByTaskIdOne(taskId)?.let {
|
||||||
|
it.startTime = null
|
||||||
|
it.status = TaskDataBean.unUse
|
||||||
|
// 更新任务状态
|
||||||
|
taskDataDao?.updateStatus(
|
||||||
|
System.currentTimeMillis(),
|
||||||
|
TaskDataBean.unUse,
|
||||||
|
it.id
|
||||||
|
)
|
||||||
|
OchChainLogManager.writeChainLogDb(
|
||||||
|
"开始任务",
|
||||||
|
"异常情况${lineId}_${lineName}_task:${taskId} 为未使用的状态 原因:${e.message}"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return@flatMap Observable.error(DataException(DataException.startTaskErrorCode, e.message
|
||||||
|
?: ""))
|
||||||
|
}
|
||||||
|
updateCount?.let {
|
||||||
|
if (it <= 0) {
|
||||||
|
// 插入失败
|
||||||
|
return@flatMap Observable.error(DataException(DataException.startTaskErrorCode, StringUtils.getString(R.string.module_och_no_data_inserted)))
|
||||||
|
} else {
|
||||||
|
// 开始任务成功
|
||||||
|
return@flatMap Observable.just(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryRunningTaskByLineId(lineId: Long): List<TaskDataBean>? {
|
||||||
|
return taskDataDao?.queryRunningTaskByLineId(lineId)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun deleteByLineId(lineId: Long) {
|
||||||
|
taskDataDao?.deleteByLineId(lineId)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryRunningTask(): List<TaskDataBean>? {
|
||||||
|
return taskDataDao?.queryRunningTaskByStatus()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryTaskById(taskId: Long): TaskDataBean? {
|
||||||
|
return taskDataDao?.queryTaskByTaskIdOne(taskId)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryAllTask(): List<TaskDataBean>? {
|
||||||
|
return taskDataDao?.queryAllTask()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun endTask(taskId: Long) {
|
||||||
|
BizLoopManager.runInIoThread {
|
||||||
|
taskDataDao?.endTask(taskId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun deleteObsoleteData() {
|
||||||
|
taskDataDao?.deleteObsoleteData()?.let {
|
||||||
|
OchChainLogManager.writeChainLogDb("删除临时数据", "Task删除数量:${it}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun saveRunningInfo(lineId: Int, taskId: Int, taskTime: Long) {
|
||||||
|
val runningTask = taskDataDao?.queryTaskByTaskIdOne(taskId.toLong())
|
||||||
|
if (runningTask == null) {
|
||||||
|
val taskDataBean = TaskDataBean()
|
||||||
|
taskDataBean.taskId = taskId.toLong()
|
||||||
|
taskDataBean.lineId = lineId.toLong()
|
||||||
|
taskDataBean.taskStartTime = taskTime
|
||||||
|
taskDataBean.taskDate = DateTimeUtil.getCurrentDateZero()
|
||||||
|
taskDataBean.status = TaskDataBean.useing
|
||||||
|
taskDataDao?.insert(taskDataBean)
|
||||||
|
} else {
|
||||||
|
runningTask.status = TaskDataBean.useing
|
||||||
|
taskDataDao?.insert(runningTask)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun endTaskByOther(taskId: Long) {
|
||||||
|
BizLoopManager.runInIoThread {
|
||||||
|
val taskInfo = taskDataDao?.queryTaskByTaskIdOne(taskId)
|
||||||
|
if (taskInfo != null) {
|
||||||
|
if (taskInfo.status == TaskDataBean.unUse) {
|
||||||
|
taskDataDao?.endTask(taskId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun restoreTask(taskId: Long) {
|
||||||
|
// 更新task状态
|
||||||
|
taskDataDao?.queryTaskByTaskIdOne(taskId)?.let {
|
||||||
|
it.startTime = System.currentTimeMillis()
|
||||||
|
it.status = TaskDataBean.useing
|
||||||
|
// 更新任务状态
|
||||||
|
taskDataDao?.updateStatus(System.currentTimeMillis(), TaskDataBean.useing, it.id)
|
||||||
|
OchChainLogManager.writeChainLogDb("恢复任务", "线路任务改为正在执行的状态")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun resetShiftsIdDetail() {
|
||||||
|
taskDataDao?.setShiftsIdDetail()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,173 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.repository
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||||
|
import com.mogo.eagle.core.utilcode.util.StringUtils
|
||||||
|
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||||
|
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||||
|
import com.mogo.och.data.db.exception.DbException
|
||||||
|
import com.mogo.och.shuttle.unmanned.R
|
||||||
|
import com.mogo.och.unmanned.repository.db.IDbRepository
|
||||||
|
import com.mogo.och.unmanned.repository.db.MyDataBase
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.LineDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.TaskSiteDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.dao.TaskSiteDataDao
|
||||||
|
|
||||||
|
object TaskSiteDb : IDbRepository {
|
||||||
|
|
||||||
|
private const val TAG = "${M_BUS}TaskSiteDb"
|
||||||
|
|
||||||
|
private var taskSiteDataDao: TaskSiteDataDao? = null
|
||||||
|
get() {
|
||||||
|
if (field == null) {
|
||||||
|
field = MyDataBase.instance?.taskSiteDataDao
|
||||||
|
register()
|
||||||
|
}
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun release() {
|
||||||
|
taskSiteDataDao = null
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun addOrUpdate(vararg lineDataBean: TaskSiteDataBean) {
|
||||||
|
taskSiteDataDao?.insert(*lineDataBean)
|
||||||
|
}
|
||||||
|
|
||||||
|
// 开始线路
|
||||||
|
fun startTask(shiftsId: Long, taskId: Long, linId: Long, lineName: String): Int? {
|
||||||
|
// 获取线路的站点
|
||||||
|
val querySites = SiteDb.querySiteByLineId(linId)?.distinctBy { it.siteId }?.sortedBy { it.seq }
|
||||||
|
if (querySites.isNullOrEmpty()) {
|
||||||
|
// throw DbException(DbException.NEEDSYNDATA,"没有站点数据")
|
||||||
|
throw DbException(DbException.NEEDSYNDATA, StringUtils.getString(R.string.module_och_no_station_data))
|
||||||
|
}
|
||||||
|
querySites.forEachIndexed { index, siteDataBean ->
|
||||||
|
if (index + 1 != siteDataBean.seq) {
|
||||||
|
// throw DbException(DbException.NEEDSYNDATA,"站点数据排序不对")
|
||||||
|
throw DbException(DbException.NEEDSYNDATA, StringUtils.getString(R.string.module_och_station_data_order_incorrect))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val toTaskSiteDatas = TaskSiteDataBean.toTaskSiteDatas(
|
||||||
|
querySites,
|
||||||
|
shiftsId,
|
||||||
|
taskId,
|
||||||
|
lineName
|
||||||
|
)
|
||||||
|
if (toTaskSiteDatas.size < 2) {
|
||||||
|
// throw DbException(DbException.NEEDSYNDATA,"站点数据不全请稍后再试")
|
||||||
|
throw DbException(DbException.NEEDSYNDATA, StringUtils.getString(R.string.module_och_station_data_incomplete))
|
||||||
|
}
|
||||||
|
// 把线路所有的站点搬迁到运行中表格中
|
||||||
|
val result = taskSiteDataDao?.insert(*toTaskSiteDatas.toTypedArray())
|
||||||
|
return if (result.isNullOrEmpty()) {
|
||||||
|
null
|
||||||
|
} else {
|
||||||
|
result.size
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 滑动出发
|
||||||
|
fun updateLeave(taskId: Long, siteId: Long, leave: Boolean) {
|
||||||
|
BizLoopManager.runInIoThread {
|
||||||
|
taskSiteDataDao?.updateLeave(taskId, siteId, if (leave) 1 else 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun updateDrivingStatus(taskId: Long, siteId: Long, drivingStatus: Int) {
|
||||||
|
BizLoopManager.runInIoThread {
|
||||||
|
taskSiteDataDao?.updateDrivingStatus(taskId, siteId, drivingStatus)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun updateDrivingStatusAndLeave(
|
||||||
|
taskId: Long,
|
||||||
|
siteId: Long,
|
||||||
|
drivingStatus: Int,
|
||||||
|
leave: Boolean
|
||||||
|
) {
|
||||||
|
BizLoopManager.runInIoThread {
|
||||||
|
taskSiteDataDao?.updateDrivingStatusANdLeave(
|
||||||
|
taskId,
|
||||||
|
siteId,
|
||||||
|
drivingStatus,
|
||||||
|
if (leave) 1 else 0
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryRunningTask(taskId: Long): List<TaskSiteDataBean>? {
|
||||||
|
return taskSiteDataDao?.queryRunningTask(taskId)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun deleteErrorData(taskId: Long) {
|
||||||
|
taskSiteDataDao?.deleteErrorDataByTaskId(taskId)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun deleteObsoleteData() {
|
||||||
|
taskSiteDataDao?.deleteObsoleteData()?.let {
|
||||||
|
OchChainLogManager.writeChainLogDb("删除临时数据", "rurnning Task删除数量:${it}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 从后台恢复正在执行的任务
|
||||||
|
*/
|
||||||
|
fun restoreRunningTask(
|
||||||
|
shiftsId: Long,
|
||||||
|
taskId: Long,
|
||||||
|
currentSiteId: Long,
|
||||||
|
leaving: Boolean,
|
||||||
|
lineInfo: LineDataBean
|
||||||
|
) {
|
||||||
|
val taskHistory = queryRunningTask(taskId)
|
||||||
|
if (!taskHistory.isNullOrEmpty()) {
|
||||||
|
//有错误数据
|
||||||
|
deleteErrorData(taskId)
|
||||||
|
}
|
||||||
|
// 获取线路的站点
|
||||||
|
val querySites = SiteDb.querySiteByLineId(lineInfo.lineId!!)?.distinctBy { it.siteId }
|
||||||
|
if (querySites.isNullOrEmpty()) {
|
||||||
|
// throw DbException(DbException.NEEDSYNDATA,"没有站点数据")
|
||||||
|
throw DbException(DbException.NEEDSYNDATA, StringUtils.getString(R.string.module_och_no_station_data))
|
||||||
|
}
|
||||||
|
val toTaskSiteDatas = TaskSiteDataBean.toTaskSiteDatas(
|
||||||
|
querySites,
|
||||||
|
shiftsId,
|
||||||
|
taskId,
|
||||||
|
lineInfo.lineName!!
|
||||||
|
)
|
||||||
|
val resetData = resetInfo(currentSiteId, leaving, toTaskSiteDatas)
|
||||||
|
// 把线路所有的站点搬迁到运行中表格中
|
||||||
|
taskSiteDataDao?.insert(*resetData.toTypedArray())
|
||||||
|
}
|
||||||
|
|
||||||
|
fun resetInfo(
|
||||||
|
currentSiteId: Long,
|
||||||
|
leaving: Boolean,
|
||||||
|
runningSite: MutableList<TaskSiteDataBean>
|
||||||
|
): MutableList<TaskSiteDataBean> {
|
||||||
|
var currentSeq = 0
|
||||||
|
runningSite.forEach {
|
||||||
|
if (it.siteId == currentSiteId) {
|
||||||
|
currentSeq = it.seq ?: 0
|
||||||
|
it.drivingStatus = TaskSiteDataBean.drivingStatusCurrent
|
||||||
|
it.leaving = leaving
|
||||||
|
return@forEach
|
||||||
|
}
|
||||||
|
}
|
||||||
|
runningSite.forEach {
|
||||||
|
val seq = it.seq ?: 0
|
||||||
|
if (seq < currentSeq) {
|
||||||
|
it.drivingStatus = TaskSiteDataBean.drivingStatusPassed
|
||||||
|
it.leaving = true
|
||||||
|
} else if (seq > currentSeq) {
|
||||||
|
it.drivingStatus = TaskSiteDataBean.drivingStatusNotArrived
|
||||||
|
it.leaving = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return runningSite
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,84 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.repository
|
||||||
|
|
||||||
|
import androidx.room.Transaction
|
||||||
|
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||||
|
import com.mogo.och.unmanned.model.EventModel
|
||||||
|
import com.mogo.och.unmanned.repository.db.IDbRepository
|
||||||
|
import com.mogo.och.unmanned.repository.db.MyDataBase
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.WriteOffDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.dao.WriteOffDataDao
|
||||||
|
|
||||||
|
object WriteOffDb : IDbRepository {
|
||||||
|
|
||||||
|
private var writeOffDataDao: WriteOffDataDao? = null
|
||||||
|
get() {
|
||||||
|
if (field == null) {
|
||||||
|
field = MyDataBase.instance?.writeOffDataDao
|
||||||
|
register()
|
||||||
|
}
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun release() {
|
||||||
|
writeOffDataDao = null
|
||||||
|
}
|
||||||
|
|
||||||
|
fun addOrUpdate(vararg lineDataBean: WriteOffDataBean) {
|
||||||
|
writeOffDataDao?.insert(*lineDataBean)
|
||||||
|
EventModel.notifySyn()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
fun queryWaitUpdateEventCount(orderNo: String): List<WriteOffDataBean>? {
|
||||||
|
val queryWriteOffByOrderNo = writeOffDataDao?.queryWriteOffByOrderNo(orderNo = orderNo)
|
||||||
|
return queryWriteOffByOrderNo
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryWaitUpdateEvent(): List<WriteOffDataBean>? {
|
||||||
|
return writeOffDataDao?.queryWriteOffEventByStatusWithPage()
|
||||||
|
}
|
||||||
|
|
||||||
|
@Transaction
|
||||||
|
fun saveUpdateSuccess(
|
||||||
|
writeOffEvents: List<WriteOffDataBean>,
|
||||||
|
updated: Int,
|
||||||
|
currentTimeMillis: Long
|
||||||
|
) {
|
||||||
|
writeOffEvents.forEach {
|
||||||
|
writeOffDataDao?.updateStatusAndTime(updated, currentTimeMillis, it.id)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryWaitUpdateEventByTaskId(taskId: Long): List<WriteOffDataBean>? {
|
||||||
|
return writeOffDataDao?.queryWaitWriteOffByTaskId(taskId)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryWaitUpdateEventCountByTaskId(taskId: Long): Int {
|
||||||
|
val queryWriteOffByOrderNo = writeOffDataDao?.queryWaitWriteOffByTaskId(taskId)
|
||||||
|
var count4Persion = 0
|
||||||
|
queryWriteOffByOrderNo?.forEach { wirteoffItem ->
|
||||||
|
if (wirteoffItem.ticketSize == null || wirteoffItem.ticketSize!! < 1) {
|
||||||
|
wirteoffItem.ticketSize = 1
|
||||||
|
}
|
||||||
|
count4Persion += (wirteoffItem.ticketSize ?: 1)
|
||||||
|
}
|
||||||
|
|
||||||
|
return count4Persion
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryWriteOffByTaskAndSiteId(taskId: Long, siteId: Long): List<WriteOffDataBean>? {
|
||||||
|
return writeOffDataDao?.queryWriteOffByTaskAndSiteId(taskId, siteId)
|
||||||
|
}
|
||||||
|
|
||||||
|
fun deleteObsoleteData() {
|
||||||
|
writeOffDataDao?.deleteObsoleteData()?.let {
|
||||||
|
OchChainLogManager.writeChainLogDb("删除临时数据", "WriteOff删除数量:${it}")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryWaitUpdateWriteOffCount(): Int? {
|
||||||
|
return writeOffDataDao?.queryWriteOffByStatusWithPageCount()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.db.transform
|
||||||
|
|
||||||
|
import io.reactivex.Observable
|
||||||
|
import io.reactivex.ObservableSource
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
|
import io.reactivex.functions.Function
|
||||||
|
import io.reactivex.schedulers.Schedulers
|
||||||
|
|
||||||
|
fun <T, V> Observable<T>.transform4DataBase(transfor: Function<T, ObservableSource<V>>): Observable<V> {
|
||||||
|
return flatMap(transfor)
|
||||||
|
.subscribeOn(Schedulers.io())
|
||||||
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.exception
|
||||||
|
|
||||||
|
class DataException : RuntimeException {
|
||||||
|
var code: Int = 0
|
||||||
|
var msg: String = ""
|
||||||
|
|
||||||
|
constructor() : super()
|
||||||
|
constructor(code: Int, message: String) : super("${code}_${message}") {
|
||||||
|
this.code = code
|
||||||
|
this.msg = message
|
||||||
|
}
|
||||||
|
|
||||||
|
companion object {
|
||||||
|
val startTaskErrorCode = 10010
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.line
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import com.mogo.eagle.core.data.BaseData
|
||||||
|
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||||
|
import com.mogo.och.unmanned.bean.request.ShuttleEventRequest
|
||||||
|
import com.mogo.och.unmanned.bean.response.CarExecutableTaskResponse
|
||||||
|
import com.mogo.och.unmanned.bean.response.PointResponse
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.LineDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.TaskDataBean
|
||||||
|
import io.reactivex.Observable
|
||||||
|
|
||||||
|
interface ILineRepository {
|
||||||
|
|
||||||
|
fun loadCurrentTaskInfo(): Observable<Boolean>?
|
||||||
|
|
||||||
|
fun queryCanUseLine(): Observable<List<LineDataBean>?>?
|
||||||
|
|
||||||
|
fun queryCanUserTask(lineId: Long): Observable<List<TaskDataBean>?>?
|
||||||
|
|
||||||
|
fun startTask(shiftsId: Long, taskId: Long, lineId: Long, taskTime: Long, lineName: String): Observable<Boolean>?
|
||||||
|
|
||||||
|
fun leaveStation(
|
||||||
|
seq: Int,
|
||||||
|
siteId: Long,
|
||||||
|
shiftsId: Long,
|
||||||
|
taskId: Long,
|
||||||
|
lineId: Long,
|
||||||
|
taskStartTime: Long,
|
||||||
|
taskDate: Long
|
||||||
|
): Observable<Boolean>?
|
||||||
|
|
||||||
|
fun arriveStation(seq: Int, siteId: Long, taskId: Long): Observable<Boolean>?
|
||||||
|
|
||||||
|
fun endTask(shiftsId: Long, taskId: Long): Observable<Boolean>?
|
||||||
|
|
||||||
|
fun queryCarExecutableTaskList(ochCommonServiceCallback: OchCommonServiceCallback<CarExecutableTaskResponse>)
|
||||||
|
|
||||||
|
fun reportCabinEvent(context: Context?, data: ShuttleEventRequest?, callback: OchCommonServiceCallback<BaseData?>?)
|
||||||
|
|
||||||
|
fun haveRunningTask(): Boolean {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
fun release()
|
||||||
|
fun endTaskByOther(taskId: Long) {}
|
||||||
|
|
||||||
|
fun queryPointsByLineIds(lines: MutableList<Long>): Observable<MutableList<PointResponse>>?
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,229 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.line.impl
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import com.mogo.commons.env.Project
|
||||||
|
import com.mogo.commons.env.ProjectUtils
|
||||||
|
import com.mogo.eagle.core.data.BaseData
|
||||||
|
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||||
|
import com.mogo.eagle.core.utilcode.util.StringUtils
|
||||||
|
import com.mogo.och.bridge.autopilot.line.LineManager
|
||||||
|
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||||
|
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||||
|
import com.mogo.och.data.bean.BusStationBean
|
||||||
|
import com.mogo.och.data.bean.ContraiInfo
|
||||||
|
import com.mogo.och.data.bean.LineInfo
|
||||||
|
import com.mogo.och.shuttle.unmanned.R
|
||||||
|
import com.mogo.och.unmanned.bean.request.ShuttleEventRequest
|
||||||
|
import com.mogo.och.unmanned.bean.response.CarExecutableTaskResponse
|
||||||
|
import com.mogo.och.unmanned.bean.response.PointResponse
|
||||||
|
import com.mogo.och.unmanned.model.LineModel
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.LineDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.TaskDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.TaskSiteDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.line.ILineRepository
|
||||||
|
import com.mogo.och.unmanned.repository.net.NetInterface
|
||||||
|
import com.mogo.och.unmanned.repository.net.exception.NetException
|
||||||
|
import com.mogo.och.unmanned.repository.net.project.dali.bus.DaliBusServiceManager
|
||||||
|
import com.mogo.och.unmanned.repository.net.project.mogo.bus.MogoBusServiceManager
|
||||||
|
import com.mogo.och.unmanned.repository.net.project.mogo.shuttle.MogoShuttleServiceManager
|
||||||
|
import io.reactivex.Observable
|
||||||
|
|
||||||
|
class NormalRepository : ILineRepository {
|
||||||
|
|
||||||
|
private val tag = "${M_BUS}NormalRepository"
|
||||||
|
|
||||||
|
private var normalLineInterface: NetInterface? = null
|
||||||
|
get() {
|
||||||
|
if (field == null) {
|
||||||
|
when (ProjectUtils.getProjectType()) {
|
||||||
|
Project.SAAS -> {
|
||||||
|
if (AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
// throw NetException("非缓存weakNetInterface 初始化环境错误 isBus")
|
||||||
|
throw NetException(StringUtils.getString(R.string.module_och_init_env_error_bus))
|
||||||
|
} else if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
// throw NetException("非缓存weakNetInterface 初始化环境错误 isBus")
|
||||||
|
throw NetException(StringUtils.getString(R.string.module_och_init_env_error_bus))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Project.DALI -> {
|
||||||
|
if (AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
// throw NetException("非缓存weakNetInterface 初始化环境错误 isBus")
|
||||||
|
throw NetException(StringUtils.getString(R.string.module_och_init_env_error_bus))
|
||||||
|
} else if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
field = DaliBusServiceManager
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Project.MOGO -> {
|
||||||
|
field = MogoBusServiceManager()
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
field = MogoShuttleServiceManager()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
|
||||||
|
init {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun loadCurrentTaskInfo(): Observable<Boolean>? {
|
||||||
|
return normalLineInterface?.queryBusRoutes()
|
||||||
|
?.flatMap { busRoutesResult ->
|
||||||
|
if (!busRoutesResult.sites.isNullOrEmpty() && busRoutesResult.sites.size > 1) {
|
||||||
|
OchChainLogManager.writeChainLogDb(
|
||||||
|
"业务数据",
|
||||||
|
"本地没有正在运行的数据,服务器端有${busRoutesResult}"
|
||||||
|
)
|
||||||
|
CallerLogger.d(tag, "本地没有正在运行的数据,服务器端有${busRoutesResult}")
|
||||||
|
val result = mutableListOf<BusStationBean>()
|
||||||
|
var temp: BusStationBean?
|
||||||
|
var currentStationIndex = -1
|
||||||
|
var lineInfo: LineInfo? = null
|
||||||
|
busRoutesResult.sites.forEachIndexed { index, taskAndsite ->
|
||||||
|
temp = BusStationBean()
|
||||||
|
temp?.drivingStatus = taskAndsite.drivingStatus
|
||||||
|
temp?.lat = taskAndsite.lat
|
||||||
|
temp?.lon = taskAndsite.lon
|
||||||
|
temp?.gcjLat = taskAndsite.gcjLat
|
||||||
|
temp?.gcjLon = taskAndsite.gcjLon
|
||||||
|
temp?.introduction = taskAndsite.introduction
|
||||||
|
temp?.isLeaving = taskAndsite.isLeaving
|
||||||
|
temp?.name = taskAndsite.name
|
||||||
|
temp?.nameKr = taskAndsite.nameKr
|
||||||
|
temp?.isPlayTts = java.lang.Boolean.TRUE == taskAndsite.isPlayTts
|
||||||
|
temp?.seq = taskAndsite.seq
|
||||||
|
temp?.siteId = taskAndsite.siteId
|
||||||
|
result.add(temp!!)
|
||||||
|
// 正在进行中的任务
|
||||||
|
if (temp!!.drivingStatus == TaskSiteDataBean.drivingStatusCurrent) {
|
||||||
|
if (temp!!.tag != 2) {
|
||||||
|
currentStationIndex = index
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 线路信息
|
||||||
|
if (lineInfo == null && busRoutesResult.name != null) {
|
||||||
|
lineInfo = LineInfo(busRoutesResult.lineId.toLong(), busRoutesResult.name, orderId = busRoutesResult.taskId.toString())
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
if (currentStationIndex == -1) {
|
||||||
|
val pos = result.indexOfFirst { it.tag != 2 }
|
||||||
|
currentStationIndex = if (pos != -1) {
|
||||||
|
pos
|
||||||
|
} else {
|
||||||
|
0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
lineInfo?.multiMap?.put("taskInfo", LineModel.getTaskTime())
|
||||||
|
lineInfo?.siteInfos = result
|
||||||
|
LineManager.setLineInfo(lineInfo)
|
||||||
|
|
||||||
|
LineManager.setContraiInfo(
|
||||||
|
ContraiInfo(busRoutesResult.lineId.toLong(), busRoutesResult.csvFileUrl, busRoutesResult.csvFileMd5,
|
||||||
|
busRoutesResult.txtFileUrl, busRoutesResult.txtFileMd5,
|
||||||
|
busRoutesResult.contrailSaveTime)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
val tempTask = TaskDataBean()
|
||||||
|
tempTask.taskId = busRoutesResult.taskId.toLong()
|
||||||
|
tempTask.taskStartTime = busRoutesResult.taskTime
|
||||||
|
tempTask.lineId = busRoutesResult.lineId.toLong()
|
||||||
|
LineModel.currentTask = tempTask
|
||||||
|
|
||||||
|
LineModel.stationList = result
|
||||||
|
LineModel.startStationIndex = currentStationIndex
|
||||||
|
LineModel.stationList?.let { stationlist ->
|
||||||
|
val startStation = stationlist[LineModel.startStationIndex]
|
||||||
|
if (LineModel.startStationIndex < stationlist.size - 1) {
|
||||||
|
//遍历当前路段起始点之后的数组,第一个正常停靠点即为该段终点
|
||||||
|
val subStationList = stationlist.subList(LineModel.startStationIndex + 1, stationlist.size)
|
||||||
|
val endStation = subStationList.firstOrNull { bean ->
|
||||||
|
bean.tag != 2
|
||||||
|
}
|
||||||
|
// val endStation = stationlist[LineModel.startStationIndex + 1]
|
||||||
|
LineModel.nextStationIndex = stationlist.indexOf(endStation)
|
||||||
|
LineManager.setStartAndEndStation(startStation, endStation)
|
||||||
|
LineModel.callEyeMap(7)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return@flatMap Observable.just(true)
|
||||||
|
}
|
||||||
|
return@flatMap Observable.just(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun queryCanUseLine(): Observable<List<LineDataBean>?>? {
|
||||||
|
return normalLineInterface?.queryBusLines()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun queryCanUserTask(lineId: Long): Observable<List<TaskDataBean>?>? {
|
||||||
|
return normalLineInterface?.queryBusTaskByLineId(lineId)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun startTask(
|
||||||
|
shiftsId: Long,
|
||||||
|
taskId: Long,
|
||||||
|
lineId: Long,
|
||||||
|
taskTime: Long,
|
||||||
|
lineName: String
|
||||||
|
): Observable<Boolean>? {
|
||||||
|
return normalLineInterface?.switchLine(taskId)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun leaveStation(
|
||||||
|
seq: Int,
|
||||||
|
siteId: Long,
|
||||||
|
shiftsId: Long,
|
||||||
|
taskId: Long,
|
||||||
|
lineId: Long,
|
||||||
|
taskStartTime: Long,
|
||||||
|
taskDate: Long
|
||||||
|
): Observable<Boolean>? {
|
||||||
|
return normalLineInterface?.leaveStation(seq, siteId, taskId, System.currentTimeMillis())
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun arriveStation(seq: Int, siteId: Long, taskId: Long): Observable<Boolean>? {
|
||||||
|
return normalLineInterface?.arriveSiteStation(
|
||||||
|
seq,
|
||||||
|
siteId,
|
||||||
|
taskId,
|
||||||
|
System.currentTimeMillis()
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun endTask(shiftsId: Long, taskId: Long): Observable<Boolean>? {
|
||||||
|
return normalLineInterface?.endTask(taskId)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun queryCarExecutableTaskList(ochCommonServiceCallback: OchCommonServiceCallback<CarExecutableTaskResponse>) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun queryPointsByLineIds(lines: MutableList<Long>): Observable<MutableList<PointResponse>>? {
|
||||||
|
return Observable.just(ArrayList<PointResponse>())
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun reportCabinEvent(
|
||||||
|
context: Context?,
|
||||||
|
data: ShuttleEventRequest?,
|
||||||
|
callback: OchCommonServiceCallback<BaseData?>?
|
||||||
|
) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun release() {
|
||||||
|
normalLineInterface = null
|
||||||
|
CallerLogger.d(tag, "重置 normalNetInterface")
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,530 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.line.impl
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import com.mogo.commons.AbsMogoApplication
|
||||||
|
import com.mogo.commons.env.Project
|
||||||
|
import com.mogo.commons.env.ProjectUtils
|
||||||
|
import com.mogo.eagle.core.data.BaseData
|
||||||
|
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||||
|
import com.mogo.eagle.core.utilcode.util.StringUtils
|
||||||
|
import com.mogo.eagle.core.utilcode.util.ToastUtils
|
||||||
|
import com.mogo.och.bridge.autopilot.line.LineManager
|
||||||
|
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||||
|
import com.mogo.och.common.module.manager.logchainanalytic.OchChainLogManager
|
||||||
|
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||||
|
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||||
|
import com.mogo.och.data.bean.ContraiInfo
|
||||||
|
import com.mogo.och.shuttle.unmanned.R
|
||||||
|
import com.mogo.och.unmanned.bean.request.QueryPointRequest
|
||||||
|
import com.mogo.och.unmanned.bean.request.ShuttleEventRequest
|
||||||
|
import com.mogo.och.unmanned.bean.response.BusRoutesResponse
|
||||||
|
import com.mogo.och.unmanned.bean.response.CarExecutableTaskResponse
|
||||||
|
import com.mogo.och.unmanned.bean.response.PointResponse
|
||||||
|
import com.mogo.och.unmanned.constant.BusConst
|
||||||
|
import com.mogo.och.unmanned.model.LineModel
|
||||||
|
import com.mogo.och.unmanned.model.LineModel.currentTask
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.ContrailDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.LineDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.TaskDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.TaskSiteDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.ContraiDb
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.EventDb
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.LineDb
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.SiteDb
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.TaskDb
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.TaskSiteDb
|
||||||
|
import com.mogo.och.unmanned.repository.line.ILineRepository
|
||||||
|
import com.mogo.och.unmanned.repository.net.NetInterface
|
||||||
|
import com.mogo.och.unmanned.repository.net.exception.NetException
|
||||||
|
import com.mogo.och.unmanned.repository.net.project.dali.shuttle.DaliShuttleServiceManager
|
||||||
|
import com.mogo.och.unmanned.repository.net.project.saas.bus.SaasBusServiceManager
|
||||||
|
import com.mogo.och.unmanned.repository.net.project.saas.scheduled.SaasScheduledServiceManager
|
||||||
|
import com.mogo.och.unmanned.repository.net.project.saas.shuttle.SaasShuttleServiceManager
|
||||||
|
import io.reactivex.Observable
|
||||||
|
|
||||||
|
class WeaknetRepository : ILineRepository {
|
||||||
|
private val TAG = "${M_BUS}ShuttleSaasRepository"
|
||||||
|
private val context = AbsMogoApplication.getApp()
|
||||||
|
|
||||||
|
private var weakNetInterface: NetInterface? = null
|
||||||
|
get() {
|
||||||
|
if (field == null) {
|
||||||
|
when (ProjectUtils.getProjectType()) {
|
||||||
|
Project.SAAS -> {
|
||||||
|
if (AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
field = SaasShuttleServiceManager
|
||||||
|
} else if (AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
field = SaasScheduledServiceManager
|
||||||
|
} else if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
field = SaasBusServiceManager
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Project.DALI -> {
|
||||||
|
if (AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
field = DaliShuttleServiceManager
|
||||||
|
} else if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
// throw NetException("缓存weakNetInterface 初始化环境错误 isBus")
|
||||||
|
throw NetException(StringUtils.getString(R.string.module_och_cache_init_env_error_bus))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Project.MOGO -> {
|
||||||
|
// throw NetException("缓存weakNetInterface 初始化环境错误 MOGO")
|
||||||
|
throw NetException(StringUtils.getString(R.string.module_och_cache_init_env_error_mogo))
|
||||||
|
}
|
||||||
|
|
||||||
|
else -> {
|
||||||
|
// throw NetException("缓存weakNetInterface 初始化环境错误 未知")
|
||||||
|
throw NetException(StringUtils.getString(R.string.module_och_cache_init_env_error_unknown))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun loadCurrentTaskInfo(): Observable<Boolean>? {
|
||||||
|
return Observable.just(123)
|
||||||
|
.flatMap {
|
||||||
|
// 获取正在运行的任务
|
||||||
|
val runningTaskInfo = TaskDb.queryRunningTask()
|
||||||
|
if (runningTaskInfo.isNullOrEmpty()) {
|
||||||
|
// 本地没有进行中的任务
|
||||||
|
CallerLogger.d(TAG, "loadCurrentTaskInfo 没有查询到正在运行的任务")
|
||||||
|
return@flatMap loadServerRuningTask(1)
|
||||||
|
} else if (runningTaskInfo.size > 1) {
|
||||||
|
// 本地有多条正在进行的任务 需要check event
|
||||||
|
// 1 比对event表 1 清理错误数据 2 加载后台数据
|
||||||
|
CallerLogger.d(TAG, "loadCurrentTaskInfo 查询到多个正在执行的任务")
|
||||||
|
return@flatMap selectRightData(runningTaskInfo)
|
||||||
|
} else {
|
||||||
|
// 只有一条进行中的任务
|
||||||
|
currentTask = runningTaskInfo.first()
|
||||||
|
// 恢复站点信息
|
||||||
|
currentTask?.taskId?.let {
|
||||||
|
// 获取正在进行中的具体信息
|
||||||
|
val runnintTaskAndSites = TaskSiteDb.queryRunningTask(it)?.distinctBy { it.siteId }
|
||||||
|
if (runnintTaskAndSites.isNullOrEmpty() || runnintTaskAndSites.size < 2) {
|
||||||
|
CallerLogger.d(TAG, "异常情况:有任务:${runningTaskInfo} runningTask 表格没有对应的数据:${runnintTaskAndSites}")
|
||||||
|
OchChainLogManager.writeChainLogDb("加载任务", "异常情况:有任务:${runningTaskInfo} runningTask 表格没有对应的数据:${runnintTaskAndSites}")
|
||||||
|
TaskSiteDb.deleteErrorData(it)
|
||||||
|
return@flatMap loadServerRuningTask(1)
|
||||||
|
}
|
||||||
|
val db2Beans = BusRoutesResponse.db2Beans(runnintTaskAndSites, currentTask!!.lineId)
|
||||||
|
LineModel.stationList = db2Beans.first
|
||||||
|
LineModel.startStationIndex = db2Beans.second
|
||||||
|
LineModel.stationList?.let { stationlist ->
|
||||||
|
val startStation = stationlist[LineModel.startStationIndex]
|
||||||
|
if (LineModel.startStationIndex < stationlist.size - 1) {
|
||||||
|
//遍历当前路段起始点之后的数组,第一个正常停靠点即为该段终点
|
||||||
|
val subStationList = stationlist.subList(LineModel.startStationIndex + 1, stationlist.size)
|
||||||
|
val endStation = subStationList.firstOrNull { bean ->
|
||||||
|
bean.tag != 2
|
||||||
|
}
|
||||||
|
LineModel.nextStationIndex = stationlist.indexOf(endStation)
|
||||||
|
// val endStation = stationlist[LineModel.startStationIndex + 1]
|
||||||
|
LineManager.setStartAndEndStation(startStation, endStation)
|
||||||
|
LineModel.callEyeMap(8)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
// 设置自动驾驶信息
|
||||||
|
currentTask?.lineId?.let {
|
||||||
|
ContraiDb.queryAutopilotInfoByLineid(it)?.apply {
|
||||||
|
if (lineId == null || lineId!! < 0L || csvFileUrl.isNullOrEmpty() || csvFileMd5.isNullOrEmpty() || txtFileUrl.isNullOrEmpty() || txtFileMd5.isNullOrEmpty()) {
|
||||||
|
// ToastUtils.showLong("请设置轨迹信息")
|
||||||
|
ToastUtils.showLong(R.string.module_och_set_line_info)
|
||||||
|
OchChainLogManager.writeChainLogAutopilot("轨迹错误", this.toString())
|
||||||
|
CallerLogger.d(TAG, "轨迹错误,$this")
|
||||||
|
}
|
||||||
|
LineManager.setContraiInfo(ContraiInfo(lineId!!, csvFileUrl!!, csvFileMd5!!, txtFileUrl!!, txtFileMd5!!, contrailSaveTime!!, source = source
|
||||||
|
?: ContrailDataBean.SOURCETYPEROUTING))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return@flatMap Observable.just(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun selectRightData(runningTaskInfo: List<TaskDataBean>): Observable<Boolean>? {
|
||||||
|
return Observable.just(123)
|
||||||
|
.flatMap {
|
||||||
|
// 查找最新已经上报的任务
|
||||||
|
val sorted = runningTaskInfo.sortedBy {
|
||||||
|
it.startTime
|
||||||
|
}
|
||||||
|
val tempList = sorted.toMutableList()
|
||||||
|
val possible = tempList.removeFirst()
|
||||||
|
val queryLastData = EventDb.queryLastData()
|
||||||
|
if (queryLastData != null) {
|
||||||
|
if (possible.taskId == queryLastData.taskId) {
|
||||||
|
// 最后一个事件和最新的task一直 恢复数据
|
||||||
|
tempList.forEach {
|
||||||
|
it.status = TaskDataBean.used
|
||||||
|
}
|
||||||
|
TaskDb.addOrUpdate(*tempList.toTypedArray())
|
||||||
|
CallerLogger.d(TAG, "异常情况:多个正在进行的任务 task:${runningTaskInfo} event:${queryLastData.taskId}有一个和event表对应使用相同的一个 另一个置为已使用")
|
||||||
|
OchChainLogManager.writeChainLogDb("加载任务", "异常情况:多个正在进行的任务 task:${runningTaskInfo} event:${queryLastData.taskId}有一个和event表对应使用相同的一个 另一个置为已使用")
|
||||||
|
return@flatMap loadServerRuningTask(1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 全部置为已使用 通过接口恢复数据
|
||||||
|
runningTaskInfo.forEach {
|
||||||
|
it.status = TaskDataBean.used
|
||||||
|
}
|
||||||
|
CallerLogger.d(TAG, "异常情况:多个正在进行的任务 task:${runningTaskInfo} 全部置为已使用 从后台加载正在使用的任务")
|
||||||
|
OchChainLogManager.writeChainLogDb("加载任务", "异常情况:多个正在进行的任务 task:${runningTaskInfo} 全部置为已使用 从后台加载正在使用的任务")
|
||||||
|
TaskDb.addOrUpdate(*runningTaskInfo.toTypedArray())
|
||||||
|
return@flatMap loadCurrentTaskInfo()
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private fun loadServerRuningTask(loadCount: Int): Observable<Boolean>? {
|
||||||
|
if (ProjectUtils.isSaas()) {
|
||||||
|
// 从登录接口获取数据
|
||||||
|
// 1、从登录接口获取业务数据
|
||||||
|
// 2、check 数据库数据
|
||||||
|
// 3、数据库没有数据 做延迟等待同步接口同步基础数据 ?? 等待基础数据同步完在进行
|
||||||
|
// 4、恢复本地正在运行的数据
|
||||||
|
val loginInfo = LoginStatusManager.getOchBizInfo()
|
||||||
|
return Observable.just(loginInfo).flatMap {
|
||||||
|
// check数据 是否正在之心
|
||||||
|
val taskId = if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode) ||
|
||||||
|
AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
it.taskId
|
||||||
|
} else {
|
||||||
|
it.shiftsId
|
||||||
|
}
|
||||||
|
val taskDate = it.taskDate
|
||||||
|
val currentSiteId = it.currentSite
|
||||||
|
val leaving = it.leaving
|
||||||
|
val lineId = it.lineId ?: 0L
|
||||||
|
|
||||||
|
if (lineId <= 0) {
|
||||||
|
return@flatMap Observable.just(false)
|
||||||
|
}
|
||||||
|
if (taskId <= 0 || currentSiteId <= 0) {
|
||||||
|
return@flatMap Observable.just(false)
|
||||||
|
}
|
||||||
|
// 日期是否正确
|
||||||
|
if (AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
if (!DateTimeUtil.isSameDay(System.currentTimeMillis(), taskDate)) {
|
||||||
|
return@flatMap Observable.just(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// region 任务本地是否存在
|
||||||
|
val allTask = TaskDb.queryAllTask()
|
||||||
|
if (allTask.isNullOrEmpty()) {
|
||||||
|
if (loadCount == BusConst.waitCount)
|
||||||
|
return@flatMap Observable.just(false)
|
||||||
|
CallerLogger.d(TAG, "本地没有任务等待2s后 重新查询")
|
||||||
|
Thread.sleep(BusConst.waitSysAllData)
|
||||||
|
return@flatMap loadServerRuningTask(loadCount + 1)
|
||||||
|
}
|
||||||
|
// 服务端任务已被删除
|
||||||
|
val queryTaskById = TaskDb.queryTaskById(taskId)
|
||||||
|
if (queryTaskById == null) {
|
||||||
|
CallerLogger.d(TAG, "服务端正在执行${taskId},本地没有此任务")
|
||||||
|
OchChainLogManager.writeChainLogDb("错误信息", "服务端正在执行${taskId},本地没有此任务")
|
||||||
|
return@flatMap Observable.just(false)
|
||||||
|
} else {
|
||||||
|
// 本地任务已经被执行
|
||||||
|
if (queryTaskById.status == TaskDataBean.used) {
|
||||||
|
return@flatMap Observable.just(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// region 检查线路
|
||||||
|
val allLineData = LineDb.queryCanUserLine()
|
||||||
|
if (allLineData.isNullOrEmpty()) {
|
||||||
|
if (loadCount == BusConst.waitCount)
|
||||||
|
return@flatMap Observable.just(false)
|
||||||
|
CallerLogger.d(TAG, "本地没有线路等待2s后 重新查询")
|
||||||
|
Thread.sleep(BusConst.waitSysAllData)
|
||||||
|
if (loadCount > 1) {
|
||||||
|
return@flatMap loadServerRuningTask(1)
|
||||||
|
} else {
|
||||||
|
return@flatMap loadServerRuningTask(loadCount + 1)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 正在执行的站点是否在此线路中
|
||||||
|
var containLine = false
|
||||||
|
var lineInfo: LineDataBean? = null
|
||||||
|
allLineData.forEach { lineItem ->
|
||||||
|
if (lineItem.lineId == lineId) {
|
||||||
|
containLine = true
|
||||||
|
lineInfo = lineItem
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!containLine) {
|
||||||
|
CallerLogger.d(TAG, "服务端正在执行${lineId},线路已被删除")
|
||||||
|
OchChainLogManager.writeChainLogDb("错误信息", "服务端正在执行${lineId},线路已被删除")
|
||||||
|
return@flatMap Observable.just(false)
|
||||||
|
}
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// region 检查站点 包括个数和是否包含 currentSite
|
||||||
|
val siteWithLine = SiteDb.querySiteByLineId(lineId)
|
||||||
|
if (siteWithLine.isNullOrEmpty() || siteWithLine.size < 2) {
|
||||||
|
CallerLogger.d(TAG, "服务端正在执行${taskId},线路站点错误${siteWithLine}")
|
||||||
|
OchChainLogManager.writeChainLogDb("错误信息", "服务端正在执行${taskId},线路站点错误${siteWithLine}")
|
||||||
|
return@flatMap Observable.just(false)
|
||||||
|
}
|
||||||
|
// 正在执行的站点是否在此线路中
|
||||||
|
var containSite = false
|
||||||
|
siteWithLine.forEach {
|
||||||
|
if (it.siteId == currentSiteId) {
|
||||||
|
containSite = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!containSite) {
|
||||||
|
CallerLogger.d(TAG, "服务端正在执行${taskId},线路站点错误${siteWithLine}")
|
||||||
|
OchChainLogManager.writeChainLogDb("错误信息", "服务端正在执行${taskId},${siteWithLine}站点不包含正在执行的站点:${currentSiteId}")
|
||||||
|
return@flatMap Observable.just(false)
|
||||||
|
}
|
||||||
|
// endregion
|
||||||
|
|
||||||
|
// 恢复任务
|
||||||
|
TaskDb.restoreTask(taskId)
|
||||||
|
|
||||||
|
// 恢复正在执行任务表
|
||||||
|
TaskSiteDb.restoreRunningTask(it.shiftsId, taskId, currentSiteId, leaving, lineInfo!!)
|
||||||
|
|
||||||
|
return@flatMap loadCurrentTaskInfo()
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 从特定接口回复数据
|
||||||
|
return weakNetInterface?.queryBusRoutes()?.flatMap { busRoutesResult ->
|
||||||
|
if (!busRoutesResult.sites.isNullOrEmpty() && busRoutesResult.sites.size > 1) {
|
||||||
|
val queryTaskById = TaskDb.queryTaskById(busRoutesResult.taskId.toLong())
|
||||||
|
if (queryTaskById == null || queryTaskById.status != TaskDataBean.used) {
|
||||||
|
OchChainLogManager.writeChainLogDb(
|
||||||
|
"业务数据",
|
||||||
|
"本地没有正在运行的数据,服务器端有${busRoutesResult}"
|
||||||
|
)
|
||||||
|
CallerLogger.d(TAG, "本地没有正在运行的数据,服务器端有${busRoutesResult}")
|
||||||
|
LineDb.saveRunningInfo(
|
||||||
|
busRoutesResult.lineId,
|
||||||
|
busRoutesResult.name,
|
||||||
|
busRoutesResult.sites.last().name
|
||||||
|
)
|
||||||
|
TaskDb.saveRunningInfo(
|
||||||
|
busRoutesResult.lineId,
|
||||||
|
busRoutesResult.taskId,
|
||||||
|
busRoutesResult.taskTime
|
||||||
|
)
|
||||||
|
ContraiDb.saveRunningInfo(
|
||||||
|
busRoutesResult.lineId,
|
||||||
|
busRoutesResult.csvFileMd5,
|
||||||
|
busRoutesResult.csvFileUrl,
|
||||||
|
busRoutesResult.txtFileUrl,
|
||||||
|
busRoutesResult.txtFileMd5,
|
||||||
|
busRoutesResult.contrailSaveTime
|
||||||
|
)
|
||||||
|
BusRoutesResponse.bean2Db(
|
||||||
|
busRoutesResult.sites,
|
||||||
|
busRoutesResult.lineId.toLong(),
|
||||||
|
busRoutesResult.name,
|
||||||
|
busRoutesResult.taskId.toLong()
|
||||||
|
)
|
||||||
|
return@flatMap loadCurrentTaskInfo()
|
||||||
|
} else {
|
||||||
|
return@flatMap Observable.just(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return@flatMap Observable.just(false)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun queryCanUseLine(): Observable<List<LineDataBean>?>? {
|
||||||
|
return LineDb.queryCanUseLineRx()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun queryCanUserTask(lineId: Long): Observable<List<TaskDataBean>?>? {
|
||||||
|
return TaskDb.queryCanUserTask(lineId)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun startTask(
|
||||||
|
shiftsId: Long,
|
||||||
|
taskId: Long,
|
||||||
|
lineId: Long,
|
||||||
|
taskTime: Long,
|
||||||
|
lineName: String
|
||||||
|
): Observable<Boolean>? {
|
||||||
|
return TaskDb.startTask(shiftsId, taskId, lineId, lineName)
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 滑动出发
|
||||||
|
*/
|
||||||
|
override fun leaveStation(
|
||||||
|
seq: Int,
|
||||||
|
siteId: Long,
|
||||||
|
shiftsId: Long,
|
||||||
|
taskId: Long,
|
||||||
|
lineId: Long,
|
||||||
|
taskStartTime: Long,
|
||||||
|
taskDate: Long
|
||||||
|
): Observable<Boolean>? {
|
||||||
|
return Observable.just(taskId)
|
||||||
|
.flatMap {
|
||||||
|
//开始站点: leaving false->true
|
||||||
|
LineManager.getStartStation {
|
||||||
|
TaskSiteDb.updateLeave(taskId, it.siteId.toLong(), true)
|
||||||
|
OchChainLogManager.writeChainLogDb(
|
||||||
|
"滑动出发",
|
||||||
|
"task:${currentTask}__taskId:${currentTask?.taskId}"
|
||||||
|
)
|
||||||
|
CallerLogger.d(TAG, "滑动出发:task:${currentTask}__taskId:${currentTask?.taskId}")
|
||||||
|
// 设置滑动出发任务
|
||||||
|
LineManager.getLineInfo { lineInfo ->
|
||||||
|
EventDb.saveEventTaskLeaveSite(
|
||||||
|
shiftsId,
|
||||||
|
taskId,
|
||||||
|
lineId,
|
||||||
|
it.siteId.toLong(),
|
||||||
|
it.seq,
|
||||||
|
taskStartTime,
|
||||||
|
lineInfo.lineName,
|
||||||
|
taskDate
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
val (startStation, endStation) = LineManager.getStations()
|
||||||
|
val changeInfo =
|
||||||
|
"taskId:${currentTask?.taskId}--lineId:${currentTask?.lineId}--currentStationName:${startStation?.name}--finalNextStationName:${endStation?.name}"
|
||||||
|
OchChainLogManager.writeChainLog("滑动出发", changeInfo)
|
||||||
|
CallerLogger.d(TAG, "滑动出发:$changeInfo")
|
||||||
|
// 开始任务成功
|
||||||
|
return@flatMap Observable.just(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun arriveStation(seq: Int, siteId: Long, taskId: Long): Observable<Boolean>? {
|
||||||
|
// 开始站点:leaving true->false drivingStatus 2->1
|
||||||
|
return Observable.just(taskId)
|
||||||
|
.flatMap {
|
||||||
|
LineManager.getStations { start, end ->
|
||||||
|
if (currentTask != null && currentTask!!.taskId != null) {
|
||||||
|
currentTask?.let { task ->
|
||||||
|
if (task.taskId != null && task.lineId != null) {
|
||||||
|
TaskSiteDb.updateDrivingStatusAndLeave(
|
||||||
|
task.taskId!!,
|
||||||
|
start.siteId.toLong(),
|
||||||
|
TaskSiteDataBean.drivingStatusPassed,
|
||||||
|
false
|
||||||
|
)
|
||||||
|
// 设置到站任务
|
||||||
|
LineManager.getLineInfo { lineInfo ->
|
||||||
|
EventDb.saveEventTaskArriveSite(
|
||||||
|
task.shiftsId ?: 0L,
|
||||||
|
task.taskId!!,
|
||||||
|
task.lineId!!,
|
||||||
|
end.siteId.toLong(),
|
||||||
|
end.seq,
|
||||||
|
task.taskStartTime,
|
||||||
|
lineInfo.lineName,
|
||||||
|
task.taskDate
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
OchChainLogManager.writeChainLog(
|
||||||
|
"到站_数据更新_error",
|
||||||
|
"task:${currentTask}__taskId:${currentTask?.taskId}"
|
||||||
|
)
|
||||||
|
CallerLogger.d(TAG, "到站_数据更新_error:task:${currentTask}__taskId:${currentTask?.taskId}")
|
||||||
|
}
|
||||||
|
// 结束站点: drivingStatus 3-2
|
||||||
|
if (currentTask != null && currentTask!!.taskId != null) {
|
||||||
|
currentTask?.taskId?.let { taskId ->
|
||||||
|
TaskSiteDb.updateDrivingStatus(
|
||||||
|
taskId,
|
||||||
|
end.siteId.toLong(),
|
||||||
|
TaskSiteDataBean.drivingStatusCurrent
|
||||||
|
)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
OchChainLogManager.writeChainLog(
|
||||||
|
"到站_数据更新_error",
|
||||||
|
"task:${currentTask}__taskId:${currentTask?.taskId}"
|
||||||
|
)
|
||||||
|
CallerLogger.d(TAG, "到站_数据更新_error:task:${currentTask}__taskId:${currentTask?.taskId}")
|
||||||
|
}
|
||||||
|
val changeInfo =
|
||||||
|
"taskId:${currentTask?.taskId}--lineId:${currentTask?.lineId}--currentStationName:${start.name}--finalNextStationName:${end.name}"
|
||||||
|
OchChainLogManager.writeChainLog("到站", changeInfo)
|
||||||
|
CallerLogger.d(TAG, "到站:$changeInfo")
|
||||||
|
}
|
||||||
|
return@flatMap Observable.just(true)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun endTask(shiftsId: Long, taskId: Long): Observable<Boolean>? {
|
||||||
|
return Observable.just(taskId).flatMap {
|
||||||
|
currentTask?.let { task ->
|
||||||
|
if (task.taskId != null && task.lineId != null) {
|
||||||
|
TaskDb.endTask(task.taskId!!)
|
||||||
|
LineManager.getLineInfo { lineInfo ->
|
||||||
|
EventDb.saveEventTaskEnd(shiftsId, task.taskId!!, task.lineId!!, task.taskStartTime, lineInfo.lineName, task.taskDate
|
||||||
|
?: 0L)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return@flatMap Observable.just(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun endTaskByOther(taskId: Long) {
|
||||||
|
TaskDb.endTaskByOther(taskId)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun queryCarExecutableTaskList(
|
||||||
|
ochCommonServiceCallback: OchCommonServiceCallback<CarExecutableTaskResponse>
|
||||||
|
) {
|
||||||
|
weakNetInterface?.queryCarExecutableTaskList(context, ochCommonServiceCallback)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun queryPointsByLineIds(lines: MutableList<Long>): Observable<MutableList<PointResponse>>? {
|
||||||
|
val request = QueryPointRequest(LoginStatusManager.getOchBizInfo()?.businessType
|
||||||
|
?: 0, lines)
|
||||||
|
return weakNetInterface?.queryPointsByLinesId(context, request)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun reportCabinEvent(
|
||||||
|
context: Context?,
|
||||||
|
data: ShuttleEventRequest?,
|
||||||
|
callback: OchCommonServiceCallback<BaseData?>?
|
||||||
|
) {
|
||||||
|
weakNetInterface?.reportCabinEvent(context, data, callback)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun haveRunningTask(): Boolean {
|
||||||
|
if (LineModel.currentTask == null) {
|
||||||
|
return false
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun release() {
|
||||||
|
weakNetInterface = null
|
||||||
|
CallerLogger.d(TAG, "重置 weakNetInterface")
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,71 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net;
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.data.BaseData;
|
||||||
|
import com.mogo.och.common.module.network.OchCommonServiceCallback;
|
||||||
|
import com.mogo.och.data.bean.BusRoutesResult;
|
||||||
|
import com.mogo.och.unmanned.bean.request.QueryPointRequest;
|
||||||
|
import com.mogo.och.unmanned.bean.request.ShuttleEventRequest;
|
||||||
|
import com.mogo.och.unmanned.bean.response.CarExecutableTaskResponse;
|
||||||
|
import com.mogo.och.unmanned.bean.response.PointResponse;
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.LineDataBean;
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.TaskDataBean;
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.PassengerWriteOffRequest;
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.response.PassengerWriteOffResponse;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import io.reactivex.Observable;
|
||||||
|
|
||||||
|
public interface NetInterface {
|
||||||
|
|
||||||
|
default Observable<Boolean> switchLine(long taskId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
default Observable<Boolean> endTask(long taskId) {
|
||||||
|
return Observable.just(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
default Observable<Boolean> leaveStation(int seq, long siteId, long taskId, long writeVersion) {
|
||||||
|
return Observable.just(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
default Observable<Boolean> arriveSiteStation(int seq, long siteId, long taskId, long writeVersion) {
|
||||||
|
return Observable.just(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
default Observable<List<LineDataBean>> queryBusLines() {
|
||||||
|
return Observable.just(new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
default Observable<List<TaskDataBean>> queryBusTaskByLineId(long lineId) {
|
||||||
|
return Observable.just(new ArrayList<>());
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
default Observable<BusRoutesResult> queryBusRoutes() {
|
||||||
|
return Observable.just(new BusRoutesResult());
|
||||||
|
}
|
||||||
|
|
||||||
|
default Observable<Integer> writeOffCount(Context context, Long taskId, Long siteId) {
|
||||||
|
return Observable.just(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
default Observable<PassengerWriteOffResponse.Result> writeOffTicket(Context context,
|
||||||
|
PassengerWriteOffRequest ticketInfo) {
|
||||||
|
return Observable.just(new PassengerWriteOffResponse.Result("", 0, "", 0L, 0L));
|
||||||
|
}
|
||||||
|
|
||||||
|
default void queryCarExecutableTaskList(Context context, OchCommonServiceCallback<CarExecutableTaskResponse> callback) {
|
||||||
|
}
|
||||||
|
|
||||||
|
default void reportCabinEvent(Context context, ShuttleEventRequest data, OchCommonServiceCallback<BaseData> callback) {
|
||||||
|
}
|
||||||
|
|
||||||
|
default Observable<List<PointResponse>> queryPointsByLinesId(Context context, QueryPointRequest data) {
|
||||||
|
return Observable.just(new ArrayList<>());
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.bean.request;
|
||||||
|
|
||||||
|
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||||
|
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 中止/结束任务请求
|
||||||
|
*/
|
||||||
|
public class BusCloseTaskRequest {
|
||||||
|
|
||||||
|
private String sn;
|
||||||
|
private long taskId;
|
||||||
|
private long writeVersion;
|
||||||
|
|
||||||
|
public BusCloseTaskRequest(long taskId) {
|
||||||
|
this.sn = SharedPrefsMgr.getInstance().getSn();
|
||||||
|
this.taskId = taskId;
|
||||||
|
this.writeVersion = DateTimeUtil.getCurrentTimeStamp();
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSn() {
|
||||||
|
return sn;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.bean.request;
|
||||||
|
|
||||||
|
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||||
|
import com.mogo.och.common.module.utils.DateTimeUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: wangmingjun
|
||||||
|
* @date: 2021/10/18
|
||||||
|
*/
|
||||||
|
public class BusResetDrivingLineRequest {
|
||||||
|
public String sn;
|
||||||
|
public Long taskId; //切换到的线路id
|
||||||
|
public long writeVersion; //更新时间戳
|
||||||
|
|
||||||
|
public BusResetDrivingLineRequest(Long taskId) {
|
||||||
|
this.sn = SharedPrefsMgr.getInstance().getSn();
|
||||||
|
this.taskId = taskId;
|
||||||
|
this.writeVersion = DateTimeUtil.getCurrentTimeStamp();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.bean.request
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by pangfan on 2021/8/19
|
||||||
|
*
|
||||||
|
* 订单状态更新请求数据结构
|
||||||
|
*/
|
||||||
|
class BusRoutePlanningUpdateReqBean(
|
||||||
|
var sn: String, var lineId: Int, var startSiteId: Int,
|
||||||
|
var endSiteId: Int, var points: List<Result>
|
||||||
|
) {
|
||||||
|
data class Result(
|
||||||
|
var latitude: Double? = null,
|
||||||
|
var longitude: Double? = null
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.bean.request;
|
||||||
|
|
||||||
|
import com.mogo.commons.storage.SharedPrefsMgr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2021/3/22
|
||||||
|
* <p>
|
||||||
|
* 小巴车运营状态请求参数
|
||||||
|
*/
|
||||||
|
public class BusUpdateSiteStatusRequest {
|
||||||
|
|
||||||
|
public String sn;
|
||||||
|
public long taskId;
|
||||||
|
public int seq;//站点序号
|
||||||
|
public long siteId;//站点id
|
||||||
|
public long writeVersion; //更新时间戳
|
||||||
|
|
||||||
|
public BusUpdateSiteStatusRequest(long taskId, long siteId, int seq, long writeVersion) {
|
||||||
|
this.sn = SharedPrefsMgr.getInstance().getSn();
|
||||||
|
this.seq = seq;
|
||||||
|
this.siteId = siteId;
|
||||||
|
this.taskId = taskId;
|
||||||
|
this.writeVersion = writeVersion;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,17 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.bean.request
|
||||||
|
|
||||||
|
import com.mogo.och.unmanned.constant.BusConst
|
||||||
|
import java.util.UUID
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created on 2021/9/16
|
||||||
|
*
|
||||||
|
* 上传车机心跳信息请求数据
|
||||||
|
*/
|
||||||
|
class CarHeartbeatReqBean(
|
||||||
|
var sn: String, //经度
|
||||||
|
var lon: Double, //纬度
|
||||||
|
var lat: Double,
|
||||||
|
var msgId: String = UUID.randomUUID().toString(), //心跳信息唯一标识
|
||||||
|
var interval: Int = (BusConst.LOOP_PERIOD_60S / 1000).toInt() //上报间隔,单位秒,非必传,默认60秒
|
||||||
|
)
|
||||||
@@ -0,0 +1,50 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.bean.request;
|
||||||
|
|
||||||
|
public
|
||||||
|
/**
|
||||||
|
* @author congtaowang
|
||||||
|
* @since 2021/3/22
|
||||||
|
*
|
||||||
|
* 根据车机行驶线路站点信息
|
||||||
|
*/
|
||||||
|
class PassengerWriteOffRequest {
|
||||||
|
|
||||||
|
private String sn;
|
||||||
|
private String orderNo;
|
||||||
|
private String uid;
|
||||||
|
|
||||||
|
public PassengerWriteOffRequest(String orderNo, String uid) {
|
||||||
|
this.orderNo = orderNo;
|
||||||
|
this.uid = uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public PassengerWriteOffRequest(String sn, String orderNo, String uid) {
|
||||||
|
this.sn = sn;
|
||||||
|
this.orderNo = orderNo;
|
||||||
|
this.uid = uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getSn() {
|
||||||
|
return sn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSn(String sn) {
|
||||||
|
this.sn = sn;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getOrderNo() {
|
||||||
|
return orderNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setOrderNo(String orderNo) {
|
||||||
|
this.orderNo = orderNo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUid() {
|
||||||
|
return uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUid(String uid) {
|
||||||
|
this.uid = uid;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.bean.request
|
||||||
|
|
||||||
|
data class WriteOffCountReqBean(val sn: String, val taskId: Long, val siteId: Long)
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.bean.response;
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.data.BaseData;
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.TaskDataBean;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: wangmingjun
|
||||||
|
* @date: 2022/2/9
|
||||||
|
*/
|
||||||
|
public class BusQueryLineTaskResponse extends BaseData {
|
||||||
|
public List<TaskDataBean> data;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.bean.response;
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.data.BaseData;
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.LineDataBean;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: wangmingjun
|
||||||
|
* @date: 2022/2/9
|
||||||
|
*/
|
||||||
|
public class BusQueryLinesResponse extends BaseData {
|
||||||
|
public List<LineDataBean> data;
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.bean.response
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.data.BaseData
|
||||||
|
|
||||||
|
|
||||||
|
data class PassengerWriteOffResponse(val data: Result?) : BaseData() {
|
||||||
|
data class Result(
|
||||||
|
val phone: String?,
|
||||||
|
val ticketSize: Int?,
|
||||||
|
val ticketName: String?,
|
||||||
|
val remainingTimes: Long?,//剩余次数,
|
||||||
|
val businessTime: Long?,//业务时间
|
||||||
|
)
|
||||||
|
}
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.exception
|
||||||
|
|
||||||
|
class NetException : RuntimeException {
|
||||||
|
constructor() : super()
|
||||||
|
constructor(message: String?) : super(message)
|
||||||
|
}
|
||||||
@@ -0,0 +1,142 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.project.dali.bus
|
||||||
|
|
||||||
|
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||||
|
import com.mogo.commons.storage.SharedPrefsMgr
|
||||||
|
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||||
|
import com.mogo.och.common.module.constant.OchCommonConst
|
||||||
|
import com.mogo.och.common.module.network.OchCommonNet
|
||||||
|
import com.mogo.och.common.module.network.interceptor.transformTry
|
||||||
|
import com.mogo.och.data.bean.BusRoutesResult
|
||||||
|
import com.mogo.och.unmanned.bean.request.BusQueryLineStationsRequest
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.LineDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.TaskDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.net.NetInterface
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.BusCloseTaskRequest
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.BusResetDrivingLineRequest
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.BusUpdateSiteStatusRequest
|
||||||
|
import io.reactivex.Observable
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: wangmingjun
|
||||||
|
* @date: 2021/10/20
|
||||||
|
*/
|
||||||
|
object DaliBusServiceManager : NetInterface {
|
||||||
|
|
||||||
|
private val mService: IDaliBusApiService =
|
||||||
|
MoGoRetrofitFactory.getInstance(OchCommonConst.getBaseUrl()).create(
|
||||||
|
IDaliBusApiService::class.java
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询小巴车当前任务
|
||||||
|
*/
|
||||||
|
override fun queryBusRoutes(): Observable<BusRoutesResult>? {
|
||||||
|
return mService.queryBusRoutes(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
BusQueryLineStationsRequest()
|
||||||
|
).transformTry()
|
||||||
|
.flatMap(OchCommonNet("saas bus queryBusRoutes", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(it.data ?: BusRoutesResult())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置线路站点
|
||||||
|
* @param taskId
|
||||||
|
*/
|
||||||
|
override fun switchLine(
|
||||||
|
taskId: Long,
|
||||||
|
): Observable<Boolean>? {
|
||||||
|
return mService.switchLine(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
BusResetDrivingLineRequest(taskId)
|
||||||
|
).transformTry()
|
||||||
|
.flatMap(OchCommonNet("switchLine", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 正常结束任务
|
||||||
|
* @param taskId
|
||||||
|
*/
|
||||||
|
override fun endTask(taskId: Long): Observable<Boolean>? {
|
||||||
|
return mService.endTask(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
BusCloseTaskRequest(taskId)
|
||||||
|
).transformTry()
|
||||||
|
.flatMap(OchCommonNet("endTask", true))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 离站上报
|
||||||
|
* @param seq
|
||||||
|
* @param siteId
|
||||||
|
*/
|
||||||
|
override fun leaveStation(seq: Int, siteId: Long, taskId: Long, writeVersion: Long): Observable<Boolean>? {
|
||||||
|
return mService.leaveStation(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
BusUpdateSiteStatusRequest(taskId, siteId, seq, writeVersion)
|
||||||
|
).transformTry()
|
||||||
|
.flatMap(OchCommonNet("leaveStation", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 到站更新站点状态
|
||||||
|
* @param seq
|
||||||
|
* @param siteId
|
||||||
|
*/
|
||||||
|
override fun arriveSiteStation(
|
||||||
|
seq: Int, siteId: Long, taskId: Long, writeVersion: Long,
|
||||||
|
): Observable<Boolean>? {
|
||||||
|
return mService.arriveSiteStation(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
BusUpdateSiteStatusRequest(taskId, siteId, seq, writeVersion)
|
||||||
|
)
|
||||||
|
.transformTry()
|
||||||
|
.flatMap(OchCommonNet("arriveSiteStation", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun queryBusLines(): Observable<List<LineDataBean>?> {
|
||||||
|
return mService.queryBusLines(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
SharedPrefsMgr.getInstance().sn
|
||||||
|
).transformTry()
|
||||||
|
.flatMap(OchCommonNet("queryBusLines", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(it.data)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun queryBusTaskByLineId(lineId: Long): Observable<List<TaskDataBean>?> {
|
||||||
|
return mService.queryBusTaskByLineId(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
lineId
|
||||||
|
).transformTry()
|
||||||
|
.flatMap(OchCommonNet("queryBusLines", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(it.data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,151 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.project.dali.bus
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.data.BaseData
|
||||||
|
import com.mogo.och.unmanned.bean.request.BusQueryLineStationsRequest
|
||||||
|
import com.mogo.och.unmanned.bean.response.BusRoutesResponse
|
||||||
|
import com.mogo.och.unmanned.bean.response.WriteOffCountResponse
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.BusCloseTaskRequest
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.BusResetDrivingLineRequest
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.BusRoutePlanningUpdateReqBean
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.BusUpdateSiteStatusRequest
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.PassengerWriteOffRequest
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.response.BusQueryLineTaskResponse
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.response.BusQueryLinesResponse
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.response.PassengerWriteOffResponse
|
||||||
|
import io.reactivex.Observable
|
||||||
|
import retrofit2.http.Body
|
||||||
|
import retrofit2.http.GET
|
||||||
|
import retrofit2.http.Header
|
||||||
|
import retrofit2.http.Headers
|
||||||
|
import retrofit2.http.POST
|
||||||
|
import retrofit2.http.Query
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小巴车相关接口
|
||||||
|
*
|
||||||
|
* @author tongchenfei
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* wiki: http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48970072
|
||||||
|
*/
|
||||||
|
interface IDaliBusApiService {
|
||||||
|
/**
|
||||||
|
* 根据车机坐标获取所在区域全部站点信息
|
||||||
|
*
|
||||||
|
* @param request 请求参数
|
||||||
|
* @return 接口返回数据
|
||||||
|
*/
|
||||||
|
@Headers("Content-Type:application/json;charset=UTF-8")
|
||||||
|
@POST("/autopilot-car-hailing/line/v2/driver/bus/lineDataWithDriver/query")
|
||||||
|
fun queryBusRoutes(@Header("appId") appId: String?, @Header("ticket") ticket: String?, @Body request: BusQueryLineStationsRequest?): Observable<BusRoutesResponse>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param request 请求参数{"destLine":1,"sn":"F803EB2046PZD00229"} 这个接口是重置bus线路的, 不是重置线路中站点的
|
||||||
|
* @return 返回值是重置后的车站列表
|
||||||
|
* 开始路线
|
||||||
|
*/
|
||||||
|
@Headers("Content-Type:application/json;charset=UTF-8")
|
||||||
|
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/startTask")
|
||||||
|
fun switchLine(@Header("appId") appId: String?, @Header("ticket") ticket: String?, @Body request: BusResetDrivingLineRequest?): Observable<BaseData>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 离站,通知服务器
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Headers("Content-Type:application/json;charset=UTF-8")
|
||||||
|
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/leave")
|
||||||
|
fun leaveStation(@Header("appId") appId: String?, @Header("ticket") ticket: String?, @Body request: BusUpdateSiteStatusRequest?): Observable<BaseData>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 到站 更新到站信息
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Headers("Content-type:application/json;charset=UTF-8")
|
||||||
|
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/arrive")
|
||||||
|
fun arriveSiteStation(@Header("appId") appId: String?, @Header("ticket") ticket: String?, @Body request: BusUpdateSiteStatusRequest?): Observable<BaseData>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆配置的所有路线
|
||||||
|
* @param appId
|
||||||
|
* @param ticket
|
||||||
|
* @param sn
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GET("/autopilot-car-hailing/line/v2/driver/bus/bindLine/query")
|
||||||
|
fun queryBusLines(@Header("appId") appId: String?, @Header("ticket") ticket: String?, @Query("sn") sn: String?): Observable<BusQueryLinesResponse>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询路线当天的任务
|
||||||
|
* @param appId
|
||||||
|
* @param ticket
|
||||||
|
* @param lineId 线路id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GET("/autopilot-car-hailing/line/v2/driver/bus/task/query")
|
||||||
|
fun queryBusTaskByLineId(@Header("appId") appId: String?, @Header("ticket") ticket: String?, @Query("lineId") lineId: Long?): Observable<BusQueryLineTaskResponse>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传轨迹信息
|
||||||
|
* @param appId
|
||||||
|
* @param ticket
|
||||||
|
* @param data
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Headers("Content-type:application/json;charset=UTF-8")
|
||||||
|
@POST("/autopilot-car-hailing/location/v2/driver/bus/saveLineCoordinate")
|
||||||
|
fun updateOrderRoute(
|
||||||
|
@Header("appId") appId: String?,
|
||||||
|
@Header("ticket") ticket: String?,
|
||||||
|
@Body data: BusRoutePlanningUpdateReqBean?
|
||||||
|
): Observable<BaseData>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 中止任务
|
||||||
|
* @param appId
|
||||||
|
* @param ticket
|
||||||
|
* @param data
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/abortTask")
|
||||||
|
fun abortTask(
|
||||||
|
@Header("appId") appId: String?,
|
||||||
|
@Header("ticket") ticket: String?,
|
||||||
|
@Body data: BusCloseTaskRequest?
|
||||||
|
): Observable<BaseData>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务正常跑完结束
|
||||||
|
* @param appId
|
||||||
|
* @param ticket
|
||||||
|
* @param data
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Headers("Content-type:application/json;charset=UTF-8")
|
||||||
|
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/endTask")
|
||||||
|
fun endTask(@Header("appId") appId: String?, @Header("ticket") ticket: String?, @Body data: BusCloseTaskRequest?): Observable<BaseData>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务正常跑完结束
|
||||||
|
* @param appId
|
||||||
|
* @param ticket
|
||||||
|
* @param data
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Headers("Content-type:application/json;charset=UTF-8")
|
||||||
|
@POST("/och-bus-cabin/cab/flow/v1/bus/driver/endTask")
|
||||||
|
fun writeOffCount(@Header("appId") appId: String?, @Header("ticket") ticket: String?, @Query("taskId") taskId: Long, @Query("siteId") siteId: Long): Observable<WriteOffCountResponse>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 核销接口
|
||||||
|
*/
|
||||||
|
@Headers("Content-type:application/json;charset=UTF-8")
|
||||||
|
@POST("/och-vehicle/api/scanner/device/writeOff")
|
||||||
|
fun daliwriteOffTicket(@Header("appId") appId: String, @Header("ticket") ticket: String, @Body request: PassengerWriteOffRequest): Observable<PassengerWriteOffResponse>
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,117 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.project.dali.shuttle
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||||
|
import com.mogo.commons.storage.SharedPrefsMgr
|
||||||
|
import com.mogo.eagle.core.data.BaseData
|
||||||
|
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||||
|
import com.mogo.och.common.module.constant.OchCommonConst
|
||||||
|
import com.mogo.och.common.module.manager.cache.OchSPManager
|
||||||
|
import com.mogo.och.common.module.network.OchCommonNet
|
||||||
|
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||||
|
import com.mogo.och.common.module.network.OchCommonSubscribeImpl
|
||||||
|
import com.mogo.och.common.module.network.interceptor.transformIoTry
|
||||||
|
import com.mogo.och.data.bean.BusRoutesResult
|
||||||
|
import com.mogo.och.unmanned.bean.request.BusQueryLineStationsRequest
|
||||||
|
import com.mogo.och.unmanned.bean.request.ShuttleEventRequest
|
||||||
|
import com.mogo.och.unmanned.bean.response.CarExecutableTaskResponse
|
||||||
|
import com.mogo.och.unmanned.repository.net.NetInterface
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.PassengerWriteOffRequest
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.response.PassengerWriteOffResponse
|
||||||
|
import io.reactivex.Observable
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: wangmingjun
|
||||||
|
* @date: 2021/10/20
|
||||||
|
*/
|
||||||
|
object DaliShuttleServiceManager : NetInterface {
|
||||||
|
|
||||||
|
private val mService: IDaliShuttleApiService =
|
||||||
|
MoGoRetrofitFactory.getInstance(OchCommonConst.getShuttleUrl()).create(
|
||||||
|
IDaliShuttleApiService::class.java
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询小巴车当前任务
|
||||||
|
*/
|
||||||
|
override fun queryBusRoutes(): Observable<BusRoutesResult?>? {
|
||||||
|
//获取当前高德坐标
|
||||||
|
return mService.queryBusRoutes(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
BusQueryLineStationsRequest()
|
||||||
|
).transformIoTry()
|
||||||
|
.flatMap(OchCommonNet("saas shuttle queryBusRoutes", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(it.data ?: BusRoutesResult())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 只发生在大理和saas环境 查询当前站点核销的人数
|
||||||
|
*/
|
||||||
|
override fun writeOffCount(context: Context?, taskId: Long?, siteId: Long?): Observable<Int> {
|
||||||
|
return mService.writeOffCount(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
taskId?.toString(),
|
||||||
|
siteId?.toString()
|
||||||
|
)
|
||||||
|
.flatMap(OchCommonNet("saas shuttle writeOffCount", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(it.data ?: 0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步 线路、站点、任务、自驾轨迹信息
|
||||||
|
*/
|
||||||
|
override fun queryCarExecutableTaskList(
|
||||||
|
context: Context,
|
||||||
|
callback: OchCommonServiceCallback<CarExecutableTaskResponse>?
|
||||||
|
) {
|
||||||
|
mService.queryCarExecutableTaskList(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
SharedPrefsMgr.getInstance().sn,
|
||||||
|
)
|
||||||
|
.transformIoTry()
|
||||||
|
.subscribe(OchCommonSubscribeImpl(context, callback, "queryCarExecutableTaskList"))
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传 开始线路 滑动出发 到站 完成线路 各个任务到服务器端
|
||||||
|
*/
|
||||||
|
override fun reportCabinEvent(
|
||||||
|
context: Context,
|
||||||
|
data: ShuttleEventRequest,
|
||||||
|
callback: OchCommonServiceCallback<BaseData>?,
|
||||||
|
) {
|
||||||
|
mService.reportCabinEvent(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
data,
|
||||||
|
)
|
||||||
|
.subscribe(OchCommonSubscribeImpl(context, callback, "reportCabinEvent"))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun writeOffTicket(
|
||||||
|
context: Context,
|
||||||
|
ticketInfo: PassengerWriteOffRequest,
|
||||||
|
): Observable<PassengerWriteOffResponse.Result?>? {
|
||||||
|
ticketInfo.sn = OchSPManager.getSn()
|
||||||
|
return mService.daliwriteOffTicket(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
ticketInfo
|
||||||
|
)
|
||||||
|
.transformIoTry()
|
||||||
|
.flatMap(OchCommonNet("dali shuttle writeOffCount", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(it.data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,68 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.project.dali.shuttle;
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.data.BaseData;
|
||||||
|
import com.mogo.och.unmanned.bean.request.BusQueryLineStationsRequest;
|
||||||
|
import com.mogo.och.unmanned.bean.request.ShuttleEventRequest;
|
||||||
|
import com.mogo.och.unmanned.bean.response.BusRoutesResponse;
|
||||||
|
import com.mogo.och.unmanned.bean.response.CarExecutableTaskResponse;
|
||||||
|
import com.mogo.och.unmanned.bean.response.WriteOffCountResponse;
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.PassengerWriteOffRequest;
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.response.PassengerWriteOffResponse;
|
||||||
|
|
||||||
|
import io.reactivex.Observable;
|
||||||
|
import retrofit2.http.Body;
|
||||||
|
import retrofit2.http.GET;
|
||||||
|
import retrofit2.http.Header;
|
||||||
|
import retrofit2.http.Headers;
|
||||||
|
import retrofit2.http.POST;
|
||||||
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小巴车相关接口
|
||||||
|
*
|
||||||
|
* @author tongchenfei
|
||||||
|
* <p>
|
||||||
|
* wiki: http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48970072
|
||||||
|
*/
|
||||||
|
public interface IDaliShuttleApiService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询当前运行任务
|
||||||
|
*
|
||||||
|
* @param request 请求参数
|
||||||
|
* @return 接口返回数据
|
||||||
|
*/
|
||||||
|
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||||
|
@POST("/och-shuttle-cabin/api/business/v1/driver/lineDataWithDriver/query")
|
||||||
|
Observable<BusRoutesResponse> queryBusRoutes(@Header("appId") String appId, @Header("ticket") String ticket, @Body BusQueryLineStationsRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询当前站点核销的人数
|
||||||
|
*/
|
||||||
|
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||||
|
@GET("och-shuttle-cabin/api/business/v1/task/writeOffCount")
|
||||||
|
Observable<WriteOffCountResponse> writeOffCount(@Header("appId") String appId, @Header("ticket") String ticket, @Query("taskId") String taskId, @Query("siteId") String siteId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 实时核销 核销接口
|
||||||
|
*/
|
||||||
|
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||||
|
@POST("/och-vehicle/api/scanner/device/writeOff")
|
||||||
|
Observable<PassengerWriteOffResponse> daliwriteOffTicket(@Header("appId") String appId, @Header("ticket") String ticket, @Body PassengerWriteOffRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步 线路、站点、任务、自驾轨迹信息
|
||||||
|
*/
|
||||||
|
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||||
|
@GET("/och-shuttle-cabin/api/flow/v1/queryCarExecutableTaskList")
|
||||||
|
Observable<CarExecutableTaskResponse> queryCarExecutableTaskList(@Header("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传 开始线路 滑动出发 到站 完成线路 各个任务到服务器端
|
||||||
|
*/
|
||||||
|
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||||
|
@POST("/och-shuttle-cabin/api/flow/v1/reportCabinEvent")
|
||||||
|
Observable<BaseData> reportCabinEvent(@Header("appId") String appId, @Header("ticket") String ticket, @Body ShuttleEventRequest request);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,129 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.project.mogo.bus
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.data.BaseData
|
||||||
|
import com.mogo.och.unmanned.bean.request.BusQueryLineStationsRequest
|
||||||
|
import com.mogo.och.unmanned.bean.response.BusRoutesResponse
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.BusCloseTaskRequest
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.BusResetDrivingLineRequest
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.BusRoutePlanningUpdateReqBean
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.BusUpdateSiteStatusRequest
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.CarHeartbeatReqBean
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.response.BusQueryLineTaskResponse
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.response.BusQueryLinesResponse
|
||||||
|
import io.reactivex.Observable
|
||||||
|
import retrofit2.http.Body
|
||||||
|
import retrofit2.http.GET
|
||||||
|
import retrofit2.http.Header
|
||||||
|
import retrofit2.http.Headers
|
||||||
|
import retrofit2.http.POST
|
||||||
|
import retrofit2.http.Query
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小巴车相关接口
|
||||||
|
*
|
||||||
|
* @author tongchenfei
|
||||||
|
*
|
||||||
|
*
|
||||||
|
* wiki: http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48970072
|
||||||
|
*/
|
||||||
|
interface IMogoBusApiService {
|
||||||
|
/**
|
||||||
|
* 根据车机坐标获取所在区域全部站点信息
|
||||||
|
*
|
||||||
|
* @param request 请求参数
|
||||||
|
* @return 接口返回数据
|
||||||
|
*/
|
||||||
|
@Headers("Content-Type:application/json;charset=UTF-8")
|
||||||
|
@POST("/autopilot-car-hailing/line/v2/driver/bus/lineDataWithDriver/query")
|
||||||
|
fun queryBusRoutes(@Header("appId") appId: String?, @Header("ticket") ticket: String?, @Body request: BusQueryLineStationsRequest?): Observable<BusRoutesResponse>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param request 请求参数{"destLine":1,"sn":"F803EB2046PZD00229"} 这个接口是重置bus线路的, 不是重置线路中站点的
|
||||||
|
* @return 返回值是重置后的车站列表
|
||||||
|
* 开始路线
|
||||||
|
*/
|
||||||
|
@Headers("Content-Type:application/json;charset=UTF-8")
|
||||||
|
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/startTask")
|
||||||
|
fun switchLine(@Header("appId") appId: String?, @Header("ticket") ticket: String?, @Body request: BusResetDrivingLineRequest?): Observable<BaseData>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 离站,通知服务器
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Headers("Content-Type:application/json;charset=UTF-8")
|
||||||
|
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/leave")
|
||||||
|
fun leaveStation(@Header("appId") appId: String?, @Header("ticket") ticket: String?, @Body request: BusUpdateSiteStatusRequest?): Observable<BaseData>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 到站 更新到站信息
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Headers("Content-type:application/json;charset=UTF-8")
|
||||||
|
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/arrive")
|
||||||
|
fun arriveSiteStation(@Header("appId") appId: String?, @Header("ticket") ticket: String?, @Body request: BusUpdateSiteStatusRequest?): Observable<BaseData>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车机端上传心跳数据(只在出车状态时上传):包含高德坐标系经纬度
|
||||||
|
* @param data
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Headers("Content-type:application/json;charset=UTF-8")
|
||||||
|
@POST("/autopilot-car-hailing/location/v2/driver/bus/heartbeat")
|
||||||
|
fun runCarHeartbeat(
|
||||||
|
@Header("appId") appId: String?,
|
||||||
|
@Header("ticket") ticket: String?,
|
||||||
|
@Body data: CarHeartbeatReqBean?
|
||||||
|
): Observable<BaseData>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆配置的所有路线
|
||||||
|
* @param appId
|
||||||
|
* @param ticket
|
||||||
|
* @param sn
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GET("/autopilot-car-hailing/line/v2/driver/bus/bindLine/query")
|
||||||
|
fun queryBusLines(@Header("appId") appId: String?, @Header("ticket") ticket: String?, @Query("sn") sn: String?): Observable<BusQueryLinesResponse>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询路线当天的任务
|
||||||
|
* @param appId
|
||||||
|
* @param ticket
|
||||||
|
* @param lineId 线路id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GET("/autopilot-car-hailing/line/v2/driver/bus/task/query")
|
||||||
|
fun queryBusTaskByLineId(@Header("appId") appId: String?, @Header("ticket") ticket: String?, @Query("lineId") lineId: Long?): Observable<BusQueryLineTaskResponse>
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传轨迹信息
|
||||||
|
* @param appId
|
||||||
|
* @param ticket
|
||||||
|
* @param data
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Headers("Content-type:application/json;charset=UTF-8")
|
||||||
|
@POST("/autopilot-car-hailing/location/v2/driver/bus/saveLineCoordinate")
|
||||||
|
fun updateOrderRoute(
|
||||||
|
@Header("appId") appId: String?,
|
||||||
|
@Header("ticket") ticket: String?,
|
||||||
|
@Body data: BusRoutePlanningUpdateReqBean?
|
||||||
|
): Observable<BaseData>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务正常跑完结束
|
||||||
|
* @param appId
|
||||||
|
* @param ticket
|
||||||
|
* @param data
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Headers("Content-type:application/json;charset=UTF-8")
|
||||||
|
@POST("/autopilot-car-hailing/cab/flow/v1/bus/driver/bus/endTask")
|
||||||
|
fun endTask(@Header("appId") appId: String?, @Header("ticket") ticket: String?, @Body data: BusCloseTaskRequest?): Observable<BaseData>
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,148 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.project.mogo.bus
|
||||||
|
|
||||||
|
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||||
|
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||||
|
import com.mogo.commons.storage.SharedPrefsMgr
|
||||||
|
import com.mogo.och.common.module.constant.OchCommonConst
|
||||||
|
import com.mogo.och.common.module.network.OchCommonNet
|
||||||
|
import com.mogo.och.common.module.network.interceptor.transformTry
|
||||||
|
import com.mogo.och.data.bean.BusRoutesResult
|
||||||
|
import com.mogo.och.unmanned.bean.request.BusQueryLineStationsRequest
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.LineDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.TaskDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.net.NetInterface
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.BusCloseTaskRequest
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.BusResetDrivingLineRequest
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.BusUpdateSiteStatusRequest
|
||||||
|
import io.reactivex.Observable
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: wangmingjun
|
||||||
|
* @date: 2021/10/20
|
||||||
|
*/
|
||||||
|
class MogoBusServiceManager : NetInterface {
|
||||||
|
|
||||||
|
private val mService: IMogoBusApiService =
|
||||||
|
MoGoRetrofitFactory.getInstance(OchCommonConst.getBaseUrl()).create(
|
||||||
|
IMogoBusApiService::class.java
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询小巴车当前任务
|
||||||
|
*/
|
||||||
|
override fun queryBusRoutes(): Observable<BusRoutesResult>? {
|
||||||
|
return mService.queryBusRoutes(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
BusQueryLineStationsRequest()
|
||||||
|
).transformTry()
|
||||||
|
.flatMap(OchCommonNet("mogo/dali bus queryBusRoutes", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(it.data ?: BusRoutesResult())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置线路站点
|
||||||
|
* @param taskId
|
||||||
|
*/
|
||||||
|
override fun switchLine(
|
||||||
|
taskId: Long,
|
||||||
|
): Observable<Boolean>? {
|
||||||
|
return mService.switchLine(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
BusResetDrivingLineRequest(taskId)
|
||||||
|
).transformTry()
|
||||||
|
.flatMap(OchCommonNet("switchLine", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 正常结束任务
|
||||||
|
* @param taskId
|
||||||
|
*/
|
||||||
|
override fun endTask(taskId: Long): Observable<Boolean>? {
|
||||||
|
return mService.endTask(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
BusCloseTaskRequest(taskId)
|
||||||
|
).transformTry()
|
||||||
|
.flatMap(OchCommonNet("endTask", true))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 离站上报
|
||||||
|
* @param seq
|
||||||
|
* @param siteId
|
||||||
|
*/
|
||||||
|
override fun leaveStation(
|
||||||
|
seq: Int,
|
||||||
|
siteId: Long,
|
||||||
|
taskId: Long,
|
||||||
|
writeVersion: Long,
|
||||||
|
): Observable<Boolean>? {
|
||||||
|
return mService.leaveStation(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
BusUpdateSiteStatusRequest(taskId, siteId, seq, writeVersion)
|
||||||
|
).transformTry()
|
||||||
|
.flatMap(OchCommonNet("leaveStation", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 到站更新站点状态
|
||||||
|
* @param seq
|
||||||
|
* @param siteId
|
||||||
|
*/
|
||||||
|
override fun arriveSiteStation(
|
||||||
|
seq: Int, siteId: Long, taskId: Long, writeVersion: Long,
|
||||||
|
): Observable<Boolean>? {
|
||||||
|
return mService.arriveSiteStation(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
BusUpdateSiteStatusRequest(taskId, siteId, seq, writeVersion)
|
||||||
|
)
|
||||||
|
.transformTry()
|
||||||
|
.flatMap(OchCommonNet("arriveSiteStation", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun queryBusLines(): Observable<List<LineDataBean>?> {
|
||||||
|
return mService.queryBusLines(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
SharedPrefsMgr.getInstance().sn
|
||||||
|
).transformTry()
|
||||||
|
.flatMap(OchCommonNet("queryBusLines", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(it.data)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun queryBusTaskByLineId(lineId: Long): Observable<List<TaskDataBean>?> {
|
||||||
|
return mService.queryBusTaskByLineId(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
lineId
|
||||||
|
).transformTry()
|
||||||
|
.flatMap(OchCommonNet("queryBusLines", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(it.data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,101 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.project.mogo.shuttle;
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.data.BaseData;
|
||||||
|
import com.mogo.och.unmanned.bean.request.BusQueryLineStationsRequest;
|
||||||
|
import com.mogo.och.unmanned.bean.response.BusRoutesResponse;
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.BusCloseTaskRequest;
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.BusResetDrivingLineRequest;
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.BusUpdateSiteStatusRequest;
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.response.BusQueryLineTaskResponse;
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.response.BusQueryLinesResponse;
|
||||||
|
|
||||||
|
import io.reactivex.Observable;
|
||||||
|
import retrofit2.http.Body;
|
||||||
|
import retrofit2.http.GET;
|
||||||
|
import retrofit2.http.Header;
|
||||||
|
import retrofit2.http.Headers;
|
||||||
|
import retrofit2.http.POST;
|
||||||
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小巴车相关接口
|
||||||
|
*
|
||||||
|
* @author tongchenfei
|
||||||
|
* <p>
|
||||||
|
*/
|
||||||
|
public interface IMogoShuttleApiService {
|
||||||
|
/**
|
||||||
|
* 查询当前运行任务
|
||||||
|
*
|
||||||
|
* @param request 请求参数
|
||||||
|
* @return 接口返回数据
|
||||||
|
*/
|
||||||
|
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||||
|
@POST("/och-shuttle-cabin/api/business/v1/driver/lineDataWithDriver/query")
|
||||||
|
Observable<BusRoutesResponse> queryBusRoutes(@Header("appId") String appId, @Header("ticket") String ticket, @Body BusQueryLineStationsRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param request 请求参数{"destLine":1,"sn":"F803EB2046PZD00229"} 这个接口是重置bus线路的, 不是重置线路中站点的
|
||||||
|
* @return 返回值是重置后的车站列表
|
||||||
|
* 开始路线
|
||||||
|
*/
|
||||||
|
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||||
|
@POST("/och-shuttle-cabin/api/flow/v1/driver/startTask")
|
||||||
|
Observable<BaseData> switchLine(@Header("appId") String appId, @Header("ticket") String ticket, @Body BusResetDrivingLineRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 离站,通知服务器
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||||
|
@POST("/och-shuttle-cabin/api/flow/v1/driver/leave")
|
||||||
|
Observable<BaseData> leaveStation(@Header("appId") String appId, @Header("ticket") String ticket, @Body BusUpdateSiteStatusRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 到站 更新到站信息
|
||||||
|
*
|
||||||
|
* @param request
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||||
|
@POST("/och-shuttle-cabin/api/flow/v1/driver/arrive")
|
||||||
|
Observable<BaseData> arriveSiteStation(@Header("appId") String appId, @Header("ticket") String ticket, @Body BusUpdateSiteStatusRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆配置的所有路线
|
||||||
|
*
|
||||||
|
* @param appId
|
||||||
|
* @param ticket
|
||||||
|
* @param sn
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GET("/och-shuttle-cabin/api/business/v1/driver/bindLine/query")
|
||||||
|
Observable<BusQueryLinesResponse> queryBusLines(@Header("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询线路的任务
|
||||||
|
*
|
||||||
|
* @param appId
|
||||||
|
* @param ticket
|
||||||
|
* @param lineId 线路id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GET("/och-shuttle-cabin/api/business/v1/driver/task/query")
|
||||||
|
Observable<BusQueryLineTaskResponse> queryBusTaskByLineId(@Header("appId") String appId, @Header("ticket") String ticket, @Query("lineId") Long lineId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 任务正常跑完结束
|
||||||
|
*
|
||||||
|
* @param appId
|
||||||
|
* @param ticket
|
||||||
|
* @param data
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||||
|
@POST("/och-shuttle-cabin/api/flow/v1/driver/endTask")
|
||||||
|
Observable<BaseData> endTask(@Header("appId") String appId, @Header("ticket") String ticket, @Body BusCloseTaskRequest data);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,158 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.project.mogo.shuttle
|
||||||
|
|
||||||
|
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||||
|
import com.mogo.commons.storage.SharedPrefsMgr
|
||||||
|
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||||
|
import com.mogo.och.common.module.constant.OchCommonConst
|
||||||
|
import com.mogo.och.common.module.network.OchCommonNet
|
||||||
|
import com.mogo.och.common.module.network.interceptor.transformTry
|
||||||
|
import com.mogo.och.data.bean.BusRoutesResult
|
||||||
|
import com.mogo.och.unmanned.bean.request.BusQueryLineStationsRequest
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.LineDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.TaskDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.net.NetInterface
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.BusCloseTaskRequest
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.BusResetDrivingLineRequest
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.BusUpdateSiteStatusRequest
|
||||||
|
import io.reactivex.Observable
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: wangmingjun
|
||||||
|
* @date: 2021/10/20
|
||||||
|
*/
|
||||||
|
class MogoShuttleServiceManager : NetInterface {
|
||||||
|
|
||||||
|
private val mService: IMogoShuttleApiService = MoGoRetrofitFactory.getInstance(OchCommonConst.getShuttleUrl()).create(
|
||||||
|
IMogoShuttleApiService::class.java
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询小巴车当前任务
|
||||||
|
* @param context
|
||||||
|
* @param callback
|
||||||
|
*/
|
||||||
|
override fun queryBusRoutes(): Observable<BusRoutesResult>? {
|
||||||
|
return mService.queryBusRoutes(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
BusQueryLineStationsRequest()
|
||||||
|
).transformTry()
|
||||||
|
.flatMap(OchCommonNet("mogo/dali shuttle queryBusRoutes", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(it.data ?: BusRoutesResult())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 重置线路站点
|
||||||
|
* @param context
|
||||||
|
* @param taskId
|
||||||
|
* @param callback
|
||||||
|
*/
|
||||||
|
override fun switchLine(
|
||||||
|
taskId: Long,
|
||||||
|
): Observable<Boolean>? {
|
||||||
|
return mService.switchLine(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
BusResetDrivingLineRequest(taskId)
|
||||||
|
).transformTry()
|
||||||
|
.flatMap(OchCommonNet("switchLine", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 正常结束任务
|
||||||
|
* @param context
|
||||||
|
* @param taskId
|
||||||
|
* @param callback
|
||||||
|
*/
|
||||||
|
override fun endTask(taskId: Long): Observable<Boolean>? {
|
||||||
|
return mService.endTask(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
BusCloseTaskRequest(taskId)
|
||||||
|
).transformTry()
|
||||||
|
.flatMap(OchCommonNet("endTask", true))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 离站上报
|
||||||
|
* @param context
|
||||||
|
* @param seq
|
||||||
|
* @param siteId
|
||||||
|
* @param callback
|
||||||
|
*/
|
||||||
|
override fun leaveStation(
|
||||||
|
seq: Int,
|
||||||
|
siteId: Long,
|
||||||
|
taskId: Long,
|
||||||
|
writeVersion: Long,
|
||||||
|
): Observable<Boolean>? {
|
||||||
|
return mService.leaveStation(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
BusUpdateSiteStatusRequest(taskId, siteId, seq, writeVersion)
|
||||||
|
).transformTry()
|
||||||
|
.flatMap(OchCommonNet("leaveStation", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 到站更新站点状态
|
||||||
|
* @param context
|
||||||
|
* @param seq
|
||||||
|
* @param siteId
|
||||||
|
* @param callback
|
||||||
|
*/
|
||||||
|
override fun arriveSiteStation(
|
||||||
|
seq: Int, siteId: Long, taskId: Long, writeVersion: Long,
|
||||||
|
): Observable<Boolean>? {
|
||||||
|
return mService.arriveSiteStation(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
BusUpdateSiteStatusRequest(taskId, siteId, seq, writeVersion)
|
||||||
|
)
|
||||||
|
.transformTry()
|
||||||
|
.flatMap(OchCommonNet("arriveSiteStation", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(true)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun queryBusLines(): Observable<List<LineDataBean>?> {
|
||||||
|
return mService.queryBusLines(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
SharedPrefsMgr.getInstance().sn
|
||||||
|
).transformTry()
|
||||||
|
.flatMap(OchCommonNet("queryBusLines", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(it.data)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun queryBusTaskByLineId(
|
||||||
|
lineId: Long): Observable<List<TaskDataBean>?> {
|
||||||
|
return mService.queryBusTaskByLineId(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
lineId
|
||||||
|
).transformTry()
|
||||||
|
.flatMap(OchCommonNet("queryBusLines", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(it.data)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,74 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.project.saas.bus;
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.data.BaseData;
|
||||||
|
import com.mogo.och.unmanned.bean.request.QueryPointRequest;
|
||||||
|
import com.mogo.och.unmanned.bean.request.ShuttleEventRequest;
|
||||||
|
import com.mogo.och.unmanned.bean.response.BusRoutesResponse;
|
||||||
|
import com.mogo.och.unmanned.bean.response.CarExecutableTaskResponse;
|
||||||
|
import com.mogo.och.unmanned.bean.response.PointsResponse;
|
||||||
|
import com.mogo.och.unmanned.bean.response.WriteOffCountResponse;
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.PassengerWriteOffRequest;
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.WriteOffCountReqBean;
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.response.PassengerWriteOffResponse;
|
||||||
|
|
||||||
|
import io.reactivex.Observable;
|
||||||
|
import retrofit2.http.Body;
|
||||||
|
import retrofit2.http.GET;
|
||||||
|
import retrofit2.http.Header;
|
||||||
|
import retrofit2.http.Headers;
|
||||||
|
import retrofit2.http.POST;
|
||||||
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小巴车相关接口
|
||||||
|
*
|
||||||
|
* @author tongchenfei
|
||||||
|
* <p>
|
||||||
|
* wiki: http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48970072
|
||||||
|
*/
|
||||||
|
public interface ISaasBusApiService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询当前运行任务
|
||||||
|
*
|
||||||
|
* @param request 请求参数
|
||||||
|
* @return 接口返回数据
|
||||||
|
*/
|
||||||
|
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||||
|
@GET("/och-bus-cabin/api/business/v1/driver/bus/lineDataWithDriver/query")
|
||||||
|
Observable<BusRoutesResponse> queryBusRoutes(@Header("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询当前站点核销的人数
|
||||||
|
*/
|
||||||
|
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||||
|
@POST("/och-vehicle/api/car/v2/task/site/writeOffCount")
|
||||||
|
Observable<WriteOffCountResponse> writeOffCount(@Header("appId") String appId, @Header("ticket") String ticket, @Body WriteOffCountReqBean writeOffCountReqBean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步核销接口
|
||||||
|
*/
|
||||||
|
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||||
|
@POST("/och-vehicle/api/car/v2/device/writeOff")
|
||||||
|
Observable<PassengerWriteOffResponse> saaswriteOffTicket(@Header("appId") String appId, @Header("ticket") String ticket, @Body PassengerWriteOffRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步 线路、站点、任务、自驾轨迹信息
|
||||||
|
*/
|
||||||
|
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||||
|
@GET("/och-vehicle/cabin/queryCarExecutableTaskList")
|
||||||
|
Observable<CarExecutableTaskResponse> queryCarExecutableTaskList(@Header("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传 开始线路 滑动出发 到站 完成线路 各个任务到服务器端
|
||||||
|
*/
|
||||||
|
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||||
|
@POST("/och-vehicle/cabin/reportCabinEvent")
|
||||||
|
Observable<BaseData> reportCabinEvent(@Header("appId") String appId, @Header("ticket") String ticket, @Body ShuttleEventRequest request);
|
||||||
|
|
||||||
|
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||||
|
@POST("/och-contrail/contrail/queryCabinContrailByLines")
|
||||||
|
Observable<PointsResponse> queryCabinContrailByLines(@Header("appId") String appId, @Header("ticket") String ticket, @Body QueryPointRequest request);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,100 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.project.saas.bus
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||||
|
import com.mogo.commons.storage.SharedPrefsMgr
|
||||||
|
import com.mogo.eagle.core.data.BaseData
|
||||||
|
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||||
|
import com.mogo.och.common.module.constant.OchCommonConst
|
||||||
|
import com.mogo.och.common.module.network.OchCommonNet
|
||||||
|
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||||
|
import com.mogo.och.common.module.network.OchCommonSubscribeImpl
|
||||||
|
import com.mogo.och.common.module.network.interceptor.transformIoTry
|
||||||
|
import com.mogo.och.data.bean.BusRoutesResult
|
||||||
|
import com.mogo.och.unmanned.bean.request.QueryPointRequest
|
||||||
|
import com.mogo.och.unmanned.bean.request.ShuttleEventRequest
|
||||||
|
import com.mogo.och.unmanned.bean.response.CarExecutableTaskResponse
|
||||||
|
import com.mogo.och.unmanned.bean.response.PointResponse
|
||||||
|
import com.mogo.och.unmanned.repository.net.NetInterface
|
||||||
|
import io.reactivex.Observable
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: wangmingjun
|
||||||
|
* @date: 2021/10/20
|
||||||
|
*/
|
||||||
|
object SaasBusServiceManager : NetInterface {
|
||||||
|
|
||||||
|
private val mService: ISaasBusApiService =
|
||||||
|
MoGoRetrofitFactory.getInstance(OchCommonConst.getBaseUrl()).create(
|
||||||
|
ISaasBusApiService::class.java
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询小巴车当前任务
|
||||||
|
* @param context
|
||||||
|
* @param callback
|
||||||
|
*/
|
||||||
|
override fun queryBusRoutes(): Observable<BusRoutesResult?>? {
|
||||||
|
//获取当前高德坐标
|
||||||
|
return mService.queryBusRoutes(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
SharedPrefsMgr.getInstance().getSn()
|
||||||
|
).transformIoTry()
|
||||||
|
.flatMap(OchCommonNet("queryBusRoutes", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(it.data ?: BusRoutesResult())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步 线路、站点、任务、自驾轨迹信息
|
||||||
|
*/
|
||||||
|
override fun queryCarExecutableTaskList(
|
||||||
|
context: Context,
|
||||||
|
callback: OchCommonServiceCallback<CarExecutableTaskResponse>?
|
||||||
|
) {
|
||||||
|
mService.queryCarExecutableTaskList(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
SharedPrefsMgr.getInstance().sn,
|
||||||
|
)
|
||||||
|
.transformIoTry()
|
||||||
|
.subscribe(OchCommonSubscribeImpl(context, callback, "queryCarExecutableTaskList"))
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传 开始线路 滑动出发 到站 完成线路 各个任务到服务器端
|
||||||
|
*/
|
||||||
|
override fun reportCabinEvent(
|
||||||
|
context: Context,
|
||||||
|
data: ShuttleEventRequest,
|
||||||
|
callback: OchCommonServiceCallback<BaseData>?,
|
||||||
|
) {
|
||||||
|
mService.reportCabinEvent(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
data,
|
||||||
|
)
|
||||||
|
.subscribe(OchCommonSubscribeImpl(context, callback, "reportCabinEvent"))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun queryPointsByLinesId(
|
||||||
|
context: Context?,
|
||||||
|
data: QueryPointRequest?
|
||||||
|
): Observable<MutableList<PointResponse>>? {
|
||||||
|
return mService.queryCabinContrailByLines(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
data,
|
||||||
|
)
|
||||||
|
.transformIoTry()
|
||||||
|
.flatMap(OchCommonNet("queryPointsByLinesId", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(it.data ?: mutableListOf())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.project.saas.scheduled;
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.data.BaseData;
|
||||||
|
import com.mogo.och.unmanned.bean.request.BusQueryLineStationsRequest;
|
||||||
|
import com.mogo.och.unmanned.bean.request.QueryPointRequest;
|
||||||
|
import com.mogo.och.unmanned.bean.request.ShuttleEventRequest;
|
||||||
|
import com.mogo.och.unmanned.bean.response.BusRoutesResponse;
|
||||||
|
import com.mogo.och.unmanned.bean.response.CarExecutableTaskResponse;
|
||||||
|
import com.mogo.och.unmanned.bean.response.PointsResponse;
|
||||||
|
import com.mogo.och.unmanned.bean.response.WriteOffCountResponse;
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.PassengerWriteOffRequest;
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.WriteOffCountReqBean;
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.response.PassengerWriteOffResponse;
|
||||||
|
|
||||||
|
import io.reactivex.Observable;
|
||||||
|
import retrofit2.http.Body;
|
||||||
|
import retrofit2.http.GET;
|
||||||
|
import retrofit2.http.Header;
|
||||||
|
import retrofit2.http.Headers;
|
||||||
|
import retrofit2.http.POST;
|
||||||
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小巴车相关接口
|
||||||
|
*
|
||||||
|
* @author tongchenfei
|
||||||
|
* <p>
|
||||||
|
* wiki: http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48970072
|
||||||
|
*/
|
||||||
|
public interface ISaasScheduledApiService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询当前运行任务
|
||||||
|
*
|
||||||
|
* @param request 请求参数
|
||||||
|
* @return 接口返回数据
|
||||||
|
*/
|
||||||
|
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||||
|
@POST("/och-shuttle-cabin/api/business/v1/driver/lineDataWithDriver/query")
|
||||||
|
Observable<BusRoutesResponse> queryBusRoutes(@Header("appId") String appId, @Header("ticket") String ticket, @Body BusQueryLineStationsRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询当前站点核销的人数
|
||||||
|
*/
|
||||||
|
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||||
|
@POST("/och-vehicle/api/car/v2/task/site/writeOffCount")
|
||||||
|
Observable<WriteOffCountResponse> writeOffCount(@Header("appId") String appId, @Header("ticket") String ticket, @Body WriteOffCountReqBean writeOffCountReqBean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步核销接口
|
||||||
|
*/
|
||||||
|
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||||
|
@POST("/och-vehicle/api/car/v2/device/writeOff")
|
||||||
|
Observable<PassengerWriteOffResponse> saaswriteOffTicket(@Header("appId") String appId, @Header("ticket") String ticket, @Body PassengerWriteOffRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步 线路、站点、任务、自驾轨迹信息
|
||||||
|
*/
|
||||||
|
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||||
|
@GET("/och-vehicle/cabin/queryCarExecutableTaskList")
|
||||||
|
Observable<CarExecutableTaskResponse> queryCarExecutableTaskList(@Header("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传 开始线路 滑动出发 到站 完成线路 各个任务到服务器端
|
||||||
|
*/
|
||||||
|
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||||
|
@POST("/och-vehicle/cabin/reportCabinEvent")
|
||||||
|
Observable<BaseData> reportCabinEvent(@Header("appId") String appId, @Header("ticket") String ticket, @Body ShuttleEventRequest request);
|
||||||
|
|
||||||
|
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||||
|
@POST("/och-contrail/contrail/queryCabinContrailByLines")
|
||||||
|
Observable<PointsResponse> queryCabinContrailByLines(@Header("appId") String appId, @Header("ticket") String ticket, @Body QueryPointRequest request);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.project.saas.scheduled
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||||
|
import com.mogo.commons.storage.SharedPrefsMgr
|
||||||
|
import com.mogo.eagle.core.data.BaseData
|
||||||
|
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||||
|
import com.mogo.och.common.module.constant.OchCommonConst
|
||||||
|
import com.mogo.och.common.module.manager.cache.OchSPManager
|
||||||
|
import com.mogo.och.common.module.network.OchCommonNet
|
||||||
|
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||||
|
import com.mogo.och.common.module.network.OchCommonSubscribeImpl
|
||||||
|
import com.mogo.och.common.module.network.interceptor.transformIoTry
|
||||||
|
import com.mogo.och.data.bean.BusRoutesResult
|
||||||
|
import com.mogo.och.unmanned.bean.request.BusQueryLineStationsRequest
|
||||||
|
import com.mogo.och.unmanned.bean.request.QueryPointRequest
|
||||||
|
import com.mogo.och.unmanned.bean.request.ShuttleEventRequest
|
||||||
|
import com.mogo.och.unmanned.bean.response.CarExecutableTaskResponse
|
||||||
|
import com.mogo.och.unmanned.bean.response.PointResponse
|
||||||
|
import com.mogo.och.unmanned.repository.net.NetInterface
|
||||||
|
import io.reactivex.Observable
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: wangmingjun
|
||||||
|
* @date: 2021/10/20
|
||||||
|
*/
|
||||||
|
object SaasScheduledServiceManager : NetInterface {
|
||||||
|
|
||||||
|
private val mService: ISaasScheduledApiService = MoGoRetrofitFactory.getInstance(OchCommonConst.getShuttleUrl()).create(
|
||||||
|
ISaasScheduledApiService::class.java
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询小巴车当前任务
|
||||||
|
*/
|
||||||
|
override fun queryBusRoutes(): Observable<BusRoutesResult?>? {
|
||||||
|
//获取当前高德坐标
|
||||||
|
return mService.queryBusRoutes(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
BusQueryLineStationsRequest()
|
||||||
|
).transformIoTry()
|
||||||
|
.flatMap(OchCommonNet("queryBusRoutes", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(it.data ?: BusRoutesResult())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步 线路、站点、任务、自驾轨迹信息
|
||||||
|
*/
|
||||||
|
override fun queryCarExecutableTaskList(
|
||||||
|
context: Context,
|
||||||
|
callback: OchCommonServiceCallback<CarExecutableTaskResponse>?
|
||||||
|
) {
|
||||||
|
mService.queryCarExecutableTaskList(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
OchSPManager.getSn()
|
||||||
|
)
|
||||||
|
.transformIoTry()
|
||||||
|
.subscribe(OchCommonSubscribeImpl(context, callback, "queryCarExecutableTaskList"))
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传 开始线路 滑动出发 到站 完成线路 各个任务到服务器端
|
||||||
|
*/
|
||||||
|
override fun reportCabinEvent(
|
||||||
|
context: Context,
|
||||||
|
data: ShuttleEventRequest,
|
||||||
|
callback: OchCommonServiceCallback<BaseData>?,
|
||||||
|
) {
|
||||||
|
mService.reportCabinEvent(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
data,
|
||||||
|
)
|
||||||
|
.subscribe(OchCommonSubscribeImpl(context, callback, "reportCabinEvent"))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun queryPointsByLinesId(
|
||||||
|
context: Context?,
|
||||||
|
data: QueryPointRequest?
|
||||||
|
): Observable<MutableList<PointResponse>>? {
|
||||||
|
return mService.queryCabinContrailByLines(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
data,
|
||||||
|
)
|
||||||
|
.transformIoTry()
|
||||||
|
.flatMap(OchCommonNet("queryPointsByLinesId", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(it.data ?: mutableListOf())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,75 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.project.saas.shuttle;
|
||||||
|
|
||||||
|
import com.mogo.eagle.core.data.BaseData;
|
||||||
|
import com.mogo.och.unmanned.bean.request.BusQueryLineStationsRequest;
|
||||||
|
import com.mogo.och.unmanned.bean.request.QueryPointRequest;
|
||||||
|
import com.mogo.och.unmanned.bean.request.ShuttleEventRequest;
|
||||||
|
import com.mogo.och.unmanned.bean.response.BusRoutesResponse;
|
||||||
|
import com.mogo.och.unmanned.bean.response.CarExecutableTaskResponse;
|
||||||
|
import com.mogo.och.unmanned.bean.response.PointsResponse;
|
||||||
|
import com.mogo.och.unmanned.bean.response.WriteOffCountResponse;
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.PassengerWriteOffRequest;
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.WriteOffCountReqBean;
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.response.PassengerWriteOffResponse;
|
||||||
|
|
||||||
|
import io.reactivex.Observable;
|
||||||
|
import retrofit2.http.Body;
|
||||||
|
import retrofit2.http.GET;
|
||||||
|
import retrofit2.http.Header;
|
||||||
|
import retrofit2.http.Headers;
|
||||||
|
import retrofit2.http.POST;
|
||||||
|
import retrofit2.http.Query;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小巴车相关接口
|
||||||
|
*
|
||||||
|
* @author tongchenfei
|
||||||
|
* <p>
|
||||||
|
* wiki: http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=48970072
|
||||||
|
*/
|
||||||
|
public interface ISaasShuttleApiService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询当前运行任务
|
||||||
|
*
|
||||||
|
* @param request 请求参数
|
||||||
|
* @return 接口返回数据
|
||||||
|
*/
|
||||||
|
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||||
|
@POST("/och-shuttle-cabin/api/business/v1/driver/lineDataWithDriver/query")
|
||||||
|
Observable<BusRoutesResponse> queryBusRoutes(@Header("appId") String appId, @Header("ticket") String ticket, @Body BusQueryLineStationsRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询当前站点核销的人数
|
||||||
|
*/
|
||||||
|
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||||
|
@POST("/och-vehicle/api/car/v2/task/site/writeOffCount")
|
||||||
|
Observable<WriteOffCountResponse> writeOffCount(@Header("appId") String appId, @Header("ticket") String ticket, @Body WriteOffCountReqBean writeOffCountReqBean);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步核销接口
|
||||||
|
*/
|
||||||
|
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||||
|
@POST("/och-vehicle/api/car/v2/device/writeOff")
|
||||||
|
Observable<PassengerWriteOffResponse> saaswriteOffTicket(@Header("appId") String appId, @Header("ticket") String ticket, @Body PassengerWriteOffRequest request);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步 线路、站点、任务、自驾轨迹信息
|
||||||
|
*/
|
||||||
|
@Headers({"Content-type:application/json;charset=UTF-8"})
|
||||||
|
@GET("/och-vehicle/cabin/queryCarExecutableTaskList")
|
||||||
|
Observable<CarExecutableTaskResponse> queryCarExecutableTaskList(@Header("appId") String appId, @Header("ticket") String ticket, @Query("sn") String sn);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传 开始线路 滑动出发 到站 完成线路 各个任务到服务器端
|
||||||
|
*/
|
||||||
|
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||||
|
@POST("/och-vehicle/cabin/reportCabinEvent")
|
||||||
|
Observable<BaseData> reportCabinEvent(@Header("appId") String appId, @Header("ticket") String ticket, @Body ShuttleEventRequest request);
|
||||||
|
|
||||||
|
@Headers({"Content-Type:application/json;charset=UTF-8"})
|
||||||
|
@POST("/och-contrail/contrail/queryCabinContrailByLines")
|
||||||
|
Observable<PointsResponse> queryCabinContrailByLines(@Header("appId") String appId, @Header("ticket") String ticket, @Body QueryPointRequest request);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.net.project.saas.shuttle
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import com.mogo.cloud.passport.MoGoAiCloudClientConfig
|
||||||
|
import com.mogo.commons.storage.SharedPrefsMgr
|
||||||
|
import com.mogo.eagle.core.data.BaseData
|
||||||
|
import com.mogo.eagle.core.network.MoGoRetrofitFactory
|
||||||
|
import com.mogo.och.common.module.constant.OchCommonConst
|
||||||
|
import com.mogo.och.common.module.manager.cache.OchSPManager
|
||||||
|
import com.mogo.och.common.module.network.OchCommonNet
|
||||||
|
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||||
|
import com.mogo.och.common.module.network.OchCommonSubscribeImpl
|
||||||
|
import com.mogo.och.common.module.network.interceptor.transformIoTry
|
||||||
|
import com.mogo.och.data.bean.BusRoutesResult
|
||||||
|
import com.mogo.och.unmanned.bean.request.BusQueryLineStationsRequest
|
||||||
|
import com.mogo.och.unmanned.bean.request.QueryPointRequest
|
||||||
|
import com.mogo.och.unmanned.bean.request.ShuttleEventRequest
|
||||||
|
import com.mogo.och.unmanned.bean.response.CarExecutableTaskResponse
|
||||||
|
import com.mogo.och.unmanned.bean.response.PointResponse
|
||||||
|
import com.mogo.och.unmanned.repository.net.NetInterface
|
||||||
|
import io.reactivex.Observable
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author: wangmingjun
|
||||||
|
* @date: 2021/10/20
|
||||||
|
*/
|
||||||
|
object SaasShuttleServiceManager : NetInterface {
|
||||||
|
|
||||||
|
private val mService: ISaasShuttleApiService = MoGoRetrofitFactory.getInstance(OchCommonConst.getShuttleUrl()).create(
|
||||||
|
ISaasShuttleApiService::class.java
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询小巴车当前任务
|
||||||
|
*/
|
||||||
|
override fun queryBusRoutes(): Observable<BusRoutesResult?>? {
|
||||||
|
//获取当前高德坐标
|
||||||
|
return mService.queryBusRoutes(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
BusQueryLineStationsRequest()
|
||||||
|
).transformIoTry()
|
||||||
|
.flatMap(OchCommonNet("queryBusRoutes", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(it.data ?: BusRoutesResult())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 同步 线路、站点、任务、自驾轨迹信息
|
||||||
|
*/
|
||||||
|
override fun queryCarExecutableTaskList(
|
||||||
|
context: Context,
|
||||||
|
callback: OchCommonServiceCallback<CarExecutableTaskResponse>?
|
||||||
|
) {
|
||||||
|
mService.queryCarExecutableTaskList(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
OchSPManager.getSn()
|
||||||
|
)
|
||||||
|
.transformIoTry()
|
||||||
|
.subscribe(OchCommonSubscribeImpl(context, callback, "queryCarExecutableTaskList"))
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 上传 开始线路 滑动出发 到站 完成线路 各个任务到服务器端
|
||||||
|
*/
|
||||||
|
override fun reportCabinEvent(
|
||||||
|
context: Context,
|
||||||
|
data: ShuttleEventRequest,
|
||||||
|
callback: OchCommonServiceCallback<BaseData>?,
|
||||||
|
) {
|
||||||
|
mService.reportCabinEvent(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
data,
|
||||||
|
)
|
||||||
|
.subscribe(OchCommonSubscribeImpl(context, callback, "reportCabinEvent"))
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun queryPointsByLinesId(
|
||||||
|
context: Context?,
|
||||||
|
data: QueryPointRequest?
|
||||||
|
): Observable<MutableList<PointResponse>>? {
|
||||||
|
return mService.queryCabinContrailByLines(
|
||||||
|
MoGoAiCloudClientConfig.getInstance().serviceAppId,
|
||||||
|
SharedPrefsMgr.getInstance().token,
|
||||||
|
data,
|
||||||
|
)
|
||||||
|
.transformIoTry()
|
||||||
|
.flatMap(OchCommonNet("queryPointsByLinesId", false))
|
||||||
|
.flatMap {
|
||||||
|
Observable.just(it.data ?: mutableListOf())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.writeoff
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import com.mogo.och.common.module.manager.socket.lan.bean.WriteOffDetialMsg
|
||||||
|
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||||
|
import com.mogo.och.unmanned.bean.WaitUploadLine
|
||||||
|
import com.mogo.och.unmanned.bean.WriteOffPassenger
|
||||||
|
import com.mogo.och.unmanned.bean.response.WriteOffCountResponse
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.response.PassengerWriteOffResponse
|
||||||
|
import io.reactivex.Observable
|
||||||
|
|
||||||
|
interface IWriteOffRepository {
|
||||||
|
|
||||||
|
fun queryWriteoffCount(context: Context, taskId: Long, siteId: Long): Observable<Int>?
|
||||||
|
|
||||||
|
fun writeOffEvent(writeOffDetialMsg: WriteOffDetialMsg): Observable<PassengerWriteOffResponse.Result>?
|
||||||
|
|
||||||
|
fun release()
|
||||||
|
|
||||||
|
fun canCanEndTask(taskId: Long): Boolean {
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
fun queryWaitUploadData(): Observable<MutableList<WaitUploadLine>>?
|
||||||
|
fun writeOffEvent4Socket(passenger: WriteOffPassenger) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,291 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.writeoff.impl
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import com.mogo.commons.env.Project
|
||||||
|
import com.mogo.commons.env.ProjectUtils
|
||||||
|
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.Product
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||||
|
import com.mogo.eagle.core.utilcode.util.StringUtils
|
||||||
|
import com.mogo.och.common.module.biz.login.LoginStatusManager
|
||||||
|
import com.mogo.och.bridge.autopilot.line.LineManager
|
||||||
|
import com.mogo.och.common.module.manager.cache.OchSPManager
|
||||||
|
import com.mogo.och.common.module.manager.socket.lan.bean.WriteOffDetialMsg
|
||||||
|
import com.mogo.och.common.module.utils.DateTimeUtil
|
||||||
|
import com.mogo.och.shuttle.unmanned.R
|
||||||
|
import com.mogo.och.unmanned.bean.WaitUploadLine
|
||||||
|
import com.mogo.och.unmanned.bean.WaitUploadTask
|
||||||
|
import com.mogo.och.unmanned.bean.WriteOffPassenger
|
||||||
|
import com.mogo.och.unmanned.model.LineModel
|
||||||
|
import com.mogo.och.unmanned.repository.db.bean.WriteOffDataBean
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.EventDb
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.WriteOffDb
|
||||||
|
import com.mogo.och.unmanned.repository.exception.DataException
|
||||||
|
import com.mogo.och.unmanned.repository.net.exception.NetException
|
||||||
|
import com.mogo.och.unmanned.repository.net.NetInterface
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.response.PassengerWriteOffResponse
|
||||||
|
import com.mogo.och.unmanned.repository.net.project.saas.bus.SaasBusServiceManager
|
||||||
|
import com.mogo.och.unmanned.repository.net.project.saas.scheduled.SaasScheduledServiceManager
|
||||||
|
import com.mogo.och.unmanned.repository.writeoff.IWriteOffRepository
|
||||||
|
import io.reactivex.Observable
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
|
import io.reactivex.schedulers.Schedulers
|
||||||
|
|
||||||
|
class WriteOffCacheRepository : IWriteOffRepository {
|
||||||
|
private val TAG = "${M_BUS}ShuttleSaasRepository"
|
||||||
|
|
||||||
|
private var weakNetInterface: NetInterface?=null
|
||||||
|
get() {
|
||||||
|
if(field==null){
|
||||||
|
when (ProjectUtils.getProjectType()) {
|
||||||
|
Project.SAAS -> {
|
||||||
|
if(AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
field = SaasScheduledServiceManager
|
||||||
|
}else if(AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
field = SaasBusServiceManager
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Project.DALI -> {
|
||||||
|
// throw NetException("缓存weakNetInterface 初始化环境错误 Dali")
|
||||||
|
throw NetException(StringUtils.getString(R.string.module_och_cache_init_env_error_dali))
|
||||||
|
}
|
||||||
|
Project.MOGO -> {
|
||||||
|
// throw NetException("缓存weakNetInterface 初始化环境错误 MOGO")
|
||||||
|
throw NetException(StringUtils.getString(R.string.module_och_cache_init_env_error_mogo))
|
||||||
|
}
|
||||||
|
else->{
|
||||||
|
// throw NetException("缓存weakNetInterface 初始化环境错误 未知")
|
||||||
|
throw NetException(StringUtils.getString(R.string.module_och_cache_init_env_error_unknown))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun queryWriteoffCount(
|
||||||
|
context: Context,
|
||||||
|
taskId: Long,
|
||||||
|
siteId: Long
|
||||||
|
): Observable<Int>? {
|
||||||
|
val queryWriteOffByTaskAndSiteId = WriteOffDb.queryWriteOffByTaskAndSiteId(taskId, siteId)
|
||||||
|
queryWriteOffByTaskAndSiteId?.let {
|
||||||
|
var count4Persion = 0
|
||||||
|
it.forEach { wirteoffItem->
|
||||||
|
if (wirteoffItem.ticketSize == null || wirteoffItem.ticketSize!! < 1) {
|
||||||
|
wirteoffItem.ticketSize=1
|
||||||
|
}
|
||||||
|
count4Persion+=(wirteoffItem.ticketSize?:1)
|
||||||
|
}
|
||||||
|
return Observable.just(count4Persion)
|
||||||
|
.flatMap {
|
||||||
|
return@flatMap Observable.just(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return Observable.just(0)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun writeOffEvent(writeOffDetialMsg: WriteOffDetialMsg): Observable<PassengerWriteOffResponse.Result>? {
|
||||||
|
|
||||||
|
return Observable.just(writeOffDetialMsg)
|
||||||
|
.flatMap {
|
||||||
|
// 1、校验数据
|
||||||
|
/**
|
||||||
|
* 0、校验 tenantId
|
||||||
|
* 1、校验pipe 校验project
|
||||||
|
* 2、校验业务模式 bus和接驳
|
||||||
|
* 3、校验二维码有效性(向后1分钟有效)
|
||||||
|
* 4、校验乘车日期
|
||||||
|
* 5、校验线路
|
||||||
|
*
|
||||||
|
* 接驳
|
||||||
|
* 6、校验次数
|
||||||
|
* 7、同一个订单2分钟内只能执行一次
|
||||||
|
* 小巴
|
||||||
|
* 6、校验站点
|
||||||
|
*/
|
||||||
|
var lineId:Long?=null
|
||||||
|
var siteId:Long?=null
|
||||||
|
|
||||||
|
|
||||||
|
// 1、校验租户id
|
||||||
|
it.tenantId?.let { tenantId->
|
||||||
|
if(LoginStatusManager.getOchCarInfo()?.tenantId==tenantId){
|
||||||
|
|
||||||
|
}else{
|
||||||
|
// throw DataException(1012,"当前用户下单路线非当前的车辆所属公司")
|
||||||
|
throw DataException(1012, StringUtils.getString(R.string.module_och_current_user_order_not_current_company))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 2、校验project
|
||||||
|
if(ProjectUtils.isSaas()){
|
||||||
|
if(it.pipe != WriteOffDataBean.saasXiaoChengXu){
|
||||||
|
// throw DataException(1012,"当前用户下单路线非当前的车辆所属公司")
|
||||||
|
throw DataException(1012, StringUtils.getString(R.string.module_och_current_user_order_not_current_company))
|
||||||
|
}
|
||||||
|
}else if(ProjectUtils.isDali()){
|
||||||
|
if(it.pipe != WriteOffDataBean.daliXiaoChengXu){
|
||||||
|
// throw DataException(1012,"当前用户下单路线非当前的车辆所属公司")
|
||||||
|
throw DataException(1012, StringUtils.getString(R.string.module_och_current_user_order_not_current_company))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 3、校验 bus和shuttle
|
||||||
|
if (LoginStatusManager.getProductType()!=Product.valueOf(it.typeBiz)) {
|
||||||
|
// throw DataException(1005,"车辆未登录、或没有任务")
|
||||||
|
throw DataException(1005, StringUtils.getString(R.string.module_och_not_login_car))
|
||||||
|
}
|
||||||
|
// 4 二维码1分钟失效
|
||||||
|
if(System.currentTimeMillis()-(it.expiryTime?:0L)>60_000){
|
||||||
|
// throw DataException(6001,"二维码已过期")
|
||||||
|
throw DataException(6001, StringUtils.getString(R.string.module_och_qr_code_expires))
|
||||||
|
}
|
||||||
|
// 5 校验乘车日期
|
||||||
|
if(!DateTimeUtil.isSameDay(System.currentTimeMillis(),it.bookingTime?:0)){
|
||||||
|
// throw DataException(1009,"车票所选乘车日期非今日")
|
||||||
|
throw DataException(1009, StringUtils.getString(R.string.module_och_ticket_not_today))
|
||||||
|
}
|
||||||
|
// 6、校验线路
|
||||||
|
if(LineManager.lineInfos==null||LineManager.lineInfos?.lineId==null){
|
||||||
|
// throw DataException(1005,"车辆未登录、或没有任务")
|
||||||
|
throw DataException(1005, StringUtils.getString(R.string.module_och_not_login_car))
|
||||||
|
}
|
||||||
|
if(it.lineId==LineManager.lineInfos?.lineId){
|
||||||
|
lineId = it.lineId
|
||||||
|
}else{
|
||||||
|
// throw DataException(1006,"车票路线信息与当前车辆执行任务的路线信息不符合")
|
||||||
|
throw DataException(1006, StringUtils.getString(R.string.module_och_ticket_line_current_car_line_inconformity))
|
||||||
|
}
|
||||||
|
if (!it.orderNo.isNullOrEmpty()) {
|
||||||
|
val lastWriteOff = WriteOffDb.queryWaitUpdateEventCount(it.orderNo!!)
|
||||||
|
// 7、校验次数
|
||||||
|
if ((it.availableTimes ?: 0) <= (lastWriteOff?.size ?: 0)) {
|
||||||
|
// throw DataException(1008, "车票剩余可用次数为0")
|
||||||
|
throw DataException(1008, StringUtils.getString(R.string.module_och_ticket_not_used))
|
||||||
|
}
|
||||||
|
if (AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
// 8、同一个订单2分钟内只能核销一次
|
||||||
|
if (lastWriteOff != null && lastWriteOff.size > 0) {
|
||||||
|
if (System.currentTimeMillis() - lastWriteOff.last().eventSaveTime <= 120_000) {
|
||||||
|
// throw DataException(6002, "同一订单核销间隔时间需大于2分钟")
|
||||||
|
throw DataException(6002, StringUtils.getString(R.string.module_och_interval_canceling_same_order_too_short))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
val (start, _) = LineManager.getStations()
|
||||||
|
siteId = start?.siteId?.toLong() ?: 0
|
||||||
|
} else if (AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
// 8、校验起始站点
|
||||||
|
val (start, _) = LineManager.getStations()
|
||||||
|
if (start?.siteId?.toLong() == it.startStationId) {
|
||||||
|
siteId = it.startStationId
|
||||||
|
} else {
|
||||||
|
// throw DataException(6003, "车票站点信息与当前车辆执行任务的站点信息不符合")
|
||||||
|
throw DataException(6003, StringUtils.getString(R.string.module_och_ticket_station_current_car_station_inconformity))
|
||||||
|
}
|
||||||
|
} else if(AppIdentityModeUtils.isScheduled(FunctionBuildConfig.appIdentityMode)){
|
||||||
|
val (start, _) = LineManager.getStations()
|
||||||
|
siteId = start?.siteId?.toLong() ?: 0
|
||||||
|
// 8、校验起始站点
|
||||||
|
val task = LineModel.currentTask
|
||||||
|
if(task==null){
|
||||||
|
// throw DataException(6004, "车辆未执行任务")
|
||||||
|
throw DataException(6004, StringUtils.getString(R.string.module_och_vehicle_not_duty))
|
||||||
|
}else{
|
||||||
|
if (task.taskId!=it.shiftsId) {
|
||||||
|
// throw DataException(6005, "车票站点信息与当前车辆执行任务信息不符合")
|
||||||
|
throw DataException(6005, StringUtils.getString(R.string.module_och_ticket_station_current_car_task_inconformity))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// throw DataException(11000, "缺少orderNo")
|
||||||
|
throw DataException(11000, StringUtils.getString(R.string.module_och_not_order_no))
|
||||||
|
}
|
||||||
|
|
||||||
|
val addWrite = WriteOffDataBean()
|
||||||
|
addWrite.expiryTime = it.expiryTime
|
||||||
|
addWrite.bookingTime = it.bookingTime
|
||||||
|
addWrite.type = it.type
|
||||||
|
addWrite.shiftsId = it.shiftsId
|
||||||
|
addWrite.taskId = LineModel.currentTask?.taskId
|
||||||
|
addWrite.taskDate = LineModel.currentTask?.taskDate
|
||||||
|
addWrite.lineId = lineId
|
||||||
|
addWrite.siteId = siteId
|
||||||
|
addWrite.availableTimes = it.availableTimes
|
||||||
|
addWrite.orderNo = it.orderNo
|
||||||
|
addWrite.uid = it.uid
|
||||||
|
addWrite.phone = it.phone
|
||||||
|
addWrite.ticketSize = it.ticketSize
|
||||||
|
addWrite.ticketName = it.ticketName
|
||||||
|
addWrite.msgId = OchSPManager.getSn()+System.currentTimeMillis()
|
||||||
|
addWrite.driverId = LoginStatusManager.getOchLoginInfo()?.driverId?:0
|
||||||
|
addWrite.businessTime = System.currentTimeMillis()
|
||||||
|
WriteOffDb.addOrUpdate(addWrite)
|
||||||
|
val reslut = PassengerWriteOffResponse.Result(it.phone,it.ticketSize,it.ticketName,it.availableTimes?.toLong(),addWrite.businessTime)
|
||||||
|
return@flatMap Observable.just(reslut)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun canCanEndTask(taskId: Long): Boolean {
|
||||||
|
val queryWaitUpdateEventByTaskId = WriteOffDb.queryWaitUpdateEventByTaskId(taskId)
|
||||||
|
return queryWaitUpdateEventByTaskId.isNullOrEmpty()
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun queryWaitUploadData(): Observable<MutableList<WaitUploadLine>>? {
|
||||||
|
return EventDb.queryWaitUploadData()
|
||||||
|
?.flatMap { waitUploadList->
|
||||||
|
val result = mutableListOf<WaitUploadLine>()
|
||||||
|
waitUploadList.forEach { wait->
|
||||||
|
if(wait.lineId!=null&&wait.lineName!=null&&wait.taskId!=null&&wait.taskStartTime!=null) {
|
||||||
|
val waitUpdateEventCount = WriteOffDb.queryWaitUpdateEventCountByTaskId(wait.taskId!!)
|
||||||
|
val tempTask = WaitUploadTask(wait.taskStartTime!!,wait.taskId!!,waitUpdateEventCount)
|
||||||
|
val tempLine = WaitUploadLine(wait.lineName!!, wait.lineId!!, mutableListOf(tempTask))
|
||||||
|
val haveSave = result.filter {
|
||||||
|
it.lineId==tempLine.lineId
|
||||||
|
}
|
||||||
|
if(haveSave.isEmpty()){
|
||||||
|
result.add(tempLine)
|
||||||
|
}else{
|
||||||
|
haveSave.first().task.add(tempTask)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Observable.just(result) }
|
||||||
|
?.subscribeOn(Schedulers.io())
|
||||||
|
?.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 小程序核销的乘客插入到计算核销人数的包中
|
||||||
|
*/
|
||||||
|
override fun writeOffEvent4Socket(passenger: WriteOffPassenger) {
|
||||||
|
val addWrite = WriteOffDataBean()
|
||||||
|
//addWrite.expiryTime = it.expiryTime
|
||||||
|
//addWrite.bookingTime = it.bookingTime
|
||||||
|
//addWrite.type = it.type
|
||||||
|
addWrite.taskId = LineModel.currentTask?.taskId
|
||||||
|
addWrite.shiftsId = LineModel.currentTask?.shiftsId
|
||||||
|
LineManager.getStationsWithLine { start, end, lineInfo ->
|
||||||
|
addWrite.siteId = start.siteId.toLong()
|
||||||
|
addWrite.lineId = lineInfo.lineId
|
||||||
|
}
|
||||||
|
//addWrite.availableTimes = it.availableTimes
|
||||||
|
addWrite.orderNo = passenger.orderNo
|
||||||
|
//addWrite.uid = it.uid
|
||||||
|
addWrite.phone = passenger.phone
|
||||||
|
addWrite.ticketSize = passenger.passengerSize
|
||||||
|
addWrite.ticketName = passenger.ticketName
|
||||||
|
//addWrite.msgId = OchSPManager.getSn()+System.currentTimeMillis()
|
||||||
|
addWrite.driverId = LoginStatusManager.getOchLoginInfo()?.driverId?:0
|
||||||
|
//addWrite.businessTime = System.currentTimeMillis()
|
||||||
|
addWrite.updateStatus = WriteOffDataBean.updated
|
||||||
|
WriteOffDb.addOrUpdate(addWrite)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun release() {
|
||||||
|
weakNetInterface = null
|
||||||
|
CallerLogger.d(TAG,"重置 weakNetInterface")
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,113 @@
|
|||||||
|
package com.mogo.och.unmanned.repository.writeoff.impl
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import com.mogo.commons.AbsMogoApplication
|
||||||
|
import com.mogo.commons.env.Project
|
||||||
|
import com.mogo.commons.env.ProjectUtils
|
||||||
|
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||||
|
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_BUS
|
||||||
|
import com.mogo.eagle.core.utilcode.util.StringUtils
|
||||||
|
import com.mogo.och.common.module.manager.socket.lan.bean.WriteOffDetialMsg
|
||||||
|
import com.mogo.och.common.module.network.OchCommonServiceCallback
|
||||||
|
import com.mogo.och.shuttle.unmanned.R
|
||||||
|
import com.mogo.och.unmanned.bean.WaitUploadLine
|
||||||
|
import com.mogo.och.unmanned.bean.WaitUploadTask
|
||||||
|
import com.mogo.och.unmanned.bean.response.WriteOffCountResponse
|
||||||
|
import com.mogo.och.unmanned.repository.db.repository.EventDb
|
||||||
|
import com.mogo.och.unmanned.repository.net.NetInterface
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.request.PassengerWriteOffRequest
|
||||||
|
import com.mogo.och.unmanned.repository.net.bean.response.PassengerWriteOffResponse
|
||||||
|
import com.mogo.och.unmanned.repository.net.exception.NetException
|
||||||
|
import com.mogo.och.unmanned.repository.net.project.dali.bus.DaliBusServiceManager
|
||||||
|
import com.mogo.och.unmanned.repository.net.project.dali.shuttle.DaliShuttleServiceManager
|
||||||
|
import com.mogo.och.unmanned.repository.writeoff.IWriteOffRepository
|
||||||
|
import io.reactivex.Observable
|
||||||
|
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||||
|
import io.reactivex.schedulers.Schedulers
|
||||||
|
|
||||||
|
class WriteOffNormallRepository: IWriteOffRepository {
|
||||||
|
|
||||||
|
private val TAG = "${M_BUS}WriteOffNormallRepository"
|
||||||
|
|
||||||
|
private var normalNetInterface: NetInterface?=null
|
||||||
|
get() {
|
||||||
|
if(field==null){
|
||||||
|
when (ProjectUtils.getProjectType()) {
|
||||||
|
Project.SAAS -> {
|
||||||
|
// throw NetException("writeoff 核销 初始化环境错误 SAAS")
|
||||||
|
throw NetException(StringUtils.getString(R.string.module_och_verification_init_env_error_saas))
|
||||||
|
}
|
||||||
|
Project.DALI -> {
|
||||||
|
if(AppIdentityModeUtils.isShuttle(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
field = DaliShuttleServiceManager
|
||||||
|
}else if(AppIdentityModeUtils.isBus(FunctionBuildConfig.appIdentityMode)) {
|
||||||
|
field = DaliBusServiceManager
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Project.MOGO -> {
|
||||||
|
// throw NetException("writeoff 核销 初始化环境错误 MOGO")
|
||||||
|
throw NetException(StringUtils.getString(R.string.module_och_verification_init_env_error_mogo))
|
||||||
|
}
|
||||||
|
else->{
|
||||||
|
// throw NetException("writeoff 核销 初始化环境错误 未知")
|
||||||
|
throw NetException(StringUtils.getString(R.string.module_och_verification_init_env_error_unknown))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return field
|
||||||
|
}
|
||||||
|
|
||||||
|
init {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun queryWriteoffCount(
|
||||||
|
context: Context,
|
||||||
|
taskId: Long,
|
||||||
|
siteId: Long,
|
||||||
|
): Observable<Int>? {
|
||||||
|
return normalNetInterface?.writeOffCount(context,taskId,siteId)
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
override fun writeOffEvent(writeOffDetialMsg: WriteOffDetialMsg): Observable<PassengerWriteOffResponse.Result>? {
|
||||||
|
val passengerWriteOffRequest = PassengerWriteOffRequest(writeOffDetialMsg.orderNo, writeOffDetialMsg.uid)
|
||||||
|
return normalNetInterface?.writeOffTicket(
|
||||||
|
AbsMogoApplication.getApp(),
|
||||||
|
passengerWriteOffRequest,
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun release() {
|
||||||
|
normalNetInterface=null
|
||||||
|
CallerLogger.d(TAG,"重置 normalNetInterface")
|
||||||
|
}
|
||||||
|
|
||||||
|
override fun queryWaitUploadData(): Observable<MutableList<WaitUploadLine>>? {
|
||||||
|
return EventDb.queryWaitUploadData()
|
||||||
|
?.flatMap { waitUploadList->
|
||||||
|
val result = mutableListOf<WaitUploadLine>()
|
||||||
|
waitUploadList.forEach { wait->
|
||||||
|
if(wait.lineId!=null&&wait.lineName!=null&&wait.taskId!=null&&wait.taskStartTime!=null) {
|
||||||
|
val tempTask = WaitUploadTask(wait.taskStartTime!!,wait.taskId!!,0)
|
||||||
|
val tempLine = WaitUploadLine(wait.lineName!!, wait.lineId!!, mutableListOf(tempTask))
|
||||||
|
val haveSave = result.filter {
|
||||||
|
it.lineId==tempLine.lineId
|
||||||
|
}
|
||||||
|
if(haveSave.isEmpty()){
|
||||||
|
result.add(tempLine)
|
||||||
|
}else{
|
||||||
|
haveSave.first().task.add(tempTask)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Observable.just(result) }
|
||||||
|
?.subscribeOn(Schedulers.io())
|
||||||
|
?.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user