|
|
@@ -3,8 +3,8 @@ package com.grkj.iscs_mars.websocket
|
|
|
import com.google.gson.Gson
|
|
|
import com.google.gson.reflect.TypeToken
|
|
|
import com.grkj.iscs_mars.R
|
|
|
-import com.grkj.iscs_mars.util.AppUtils
|
|
|
import com.grkj.iscs_mars.util.CommonUtils
|
|
|
+import com.grkj.iscs_mars.util.FileUtil
|
|
|
import com.grkj.iscs_mars.util.LzTekUtils
|
|
|
import com.grkj.iscs_mars.util.SPUtils
|
|
|
import com.grkj.iscs_mars.util.log.LogUtil
|
|
|
@@ -16,12 +16,14 @@ import com.sik.sikcore.shell.ShellUtils
|
|
|
import com.sik.sikcore.thread.ThreadUtils
|
|
|
import com.sik.siknet.http.httpDownloadFile
|
|
|
import com.sik.siknet.http.interceptor.ProgressListener
|
|
|
-import kotlinx.coroutines.delay
|
|
|
+import java.io.File
|
|
|
|
|
|
/**
|
|
|
* 消息业务处理
|
|
|
*/
|
|
|
object MessageBusinessManager {
|
|
|
+ private const val OFFLINE_ACTIVE_FILENAME = "OfflineActive.dat"
|
|
|
+
|
|
|
/**
|
|
|
* 消息类型,执行命令,输出结果到日志
|
|
|
*/
|
|
|
@@ -42,6 +44,11 @@ object MessageBusinessManager {
|
|
|
*/
|
|
|
const val MESSAGE_TYPE_UPDATE_APP = "updateApp"
|
|
|
|
|
|
+ /**
|
|
|
+ * 更新证书
|
|
|
+ */
|
|
|
+ const val MESSAGE_TYPE_UPDATE_LICENSE = "updateLicense"
|
|
|
+
|
|
|
/**
|
|
|
* 基座配置
|
|
|
*/
|
|
|
@@ -136,6 +143,29 @@ object MessageBusinessManager {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ MESSAGE_TYPE_UPDATE_LICENSE -> {
|
|
|
+ val licenseDownloadPath = messageEntity.content ?: return
|
|
|
+ ThreadUtils.runOnIO {
|
|
|
+ val downloadLicense = licenseDownloadPath.httpDownloadFile()
|
|
|
+ downloadLicense?.let {
|
|
|
+ LogUtil.i("下载证书完成,进行转移")
|
|
|
+ val arcSoftActiveOfflineFile =
|
|
|
+ File(
|
|
|
+ "${
|
|
|
+ FileUtil.getRootFolder(
|
|
|
+ SIKCore.getApplication(),
|
|
|
+ 5
|
|
|
+ )?.absolutePath
|
|
|
+ }${FileUtil.CONFIG_DIR}${File.separator}${OFFLINE_ACTIVE_FILENAME}"
|
|
|
+ )
|
|
|
+ if (arcSoftActiveOfflineFile.parentFile?.exists() == false) {
|
|
|
+ arcSoftActiveOfflineFile.parentFile?.mkdirs()
|
|
|
+ }
|
|
|
+ it.copyTo(arcSoftActiveOfflineFile, true)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
MESSAGE_TYPE_DOCK_CONFIG -> {
|
|
|
val dockConfig = messageEntity.content ?: return
|
|
|
try {
|