2024-02-22 10:40:35 +08:00
|
|
|
// @ts-nocheck
|
|
|
|
|
import promptAction from '@ohos.promptAction'
|
|
|
|
|
import router from '@ohos.router'
|
|
|
|
|
import { dateFormat} from '../utils/tools'
|
|
|
|
|
import FileUtil from '../../common/utils/File'
|
|
|
|
|
import AccountTable from '../../common/database/tables/AccountTable';
|
|
|
|
|
import MA_SYSSET from '../../common/constants/MA_SYSSET';
|
2024-03-12 15:32:48 +08:00
|
|
|
import {deleteAllFile} from './videoService'
|
2024-02-22 10:40:35 +08:00
|
|
|
import {
|
|
|
|
|
getDataBaseTable,
|
|
|
|
|
upDateTable,
|
|
|
|
|
getMySystemSetTable,
|
|
|
|
|
delSyncTable,
|
|
|
|
|
upDataZhongxinginitialization
|
|
|
|
|
} from '../../common/service/initable'
|
|
|
|
|
import configAddress from '../../common/utils/FileConfig'
|
|
|
|
|
//配置流水号
|
|
|
|
|
export async function setliushuiNum(context){
|
|
|
|
|
const fileUtil = new FileUtil(context)
|
|
|
|
|
let res = fs.accessSync(configAddress.comoonfileWriteAddress+'/config/liushui.txt');
|
|
|
|
|
const fileData = await fileUtil.readFile(configAddress.comoonfileWriteAddress+'/config/liushui.txt');
|
|
|
|
|
if(res&&JSON.stringify(fileData).indexOf('u0000')<0) {
|
|
|
|
|
const date = new Date()
|
|
|
|
|
const time1 = JSON.parse(fileData).date.split(' ')[0]
|
|
|
|
|
const time2 = dateFormat(date).split(' ')[0]
|
|
|
|
|
if (time1 == time2) {
|
|
|
|
|
const date = new Date()
|
|
|
|
|
const param = {
|
|
|
|
|
date: dateFormat(date),
|
|
|
|
|
value: Number(JSON.parse(fileData).value) + 1
|
|
|
|
|
}
|
|
|
|
|
const folderPath = await fileUtil.initFolder(`/config`);
|
|
|
|
|
fileUtil.addFile(`${folderPath}/liushui.txt`, JSON.stringify(param))
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
const date = new Date()
|
|
|
|
|
const param = {
|
|
|
|
|
date: dateFormat(date),
|
|
|
|
|
value: 0
|
|
|
|
|
}
|
2024-03-12 15:32:48 +08:00
|
|
|
// deleteAllFile('jt/',context)
|
2024-02-22 10:40:35 +08:00
|
|
|
const folderPath = await fileUtil.initFolder(`/config`);
|
|
|
|
|
fileUtil.addFile(`${folderPath}/liushui.txt`, JSON.stringify(param))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//双中心表
|
|
|
|
|
export async function getDoubleCeneterTable() {
|
|
|
|
|
return new Promise(async (reslove,reject)=>{
|
|
|
|
|
// MA_SYSSET双中心下做合并表格操作
|
|
|
|
|
const db = new AccountTable(() => {
|
|
|
|
|
}, MA_SYSSET);
|
|
|
|
|
db.getRdbStore(() => {
|
|
|
|
|
db.query('0', async (array) => {
|
|
|
|
|
if (array.length) {
|
|
|
|
|
delSyncTable('MA_SYSSET').then(async () => {
|
|
|
|
|
await getDataBaseTable({ tableName: 'MA_SYSSET' })
|
|
|
|
|
await getMySystemSetTable({ tableName: 'MA_SYSSET' })
|
|
|
|
|
})
|
|
|
|
|
} else {
|
|
|
|
|
await getDataBaseTable({ tableName: 'MA_SYSSET' })
|
|
|
|
|
await getMySystemSetTable({ tableName: 'MA_SYSSET' })
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
})
|
|
|
|
|
const typeObj = {
|
|
|
|
|
'MA_MARKRULE': false,
|
|
|
|
|
'MA_SYSTEMPARM': false,
|
|
|
|
|
'MA_MAP_COLLECT': false,
|
|
|
|
|
'MA_MAP_COLLECT_SHAPE': false,
|
|
|
|
|
'MA_MAP_ITEMCLASS': false,
|
|
|
|
|
'MA_MAP_POINT': false,
|
|
|
|
|
'MA_MAP_POINT_ITEM': false,
|
|
|
|
|
'MA_MAP_ROAD': false,
|
|
|
|
|
'MA_MAP_ROAD_LANE': false,
|
|
|
|
|
'MA_MAP_SUBITEM': false,
|
|
|
|
|
'ES_CARINFO': false,
|
|
|
|
|
'ES_EXAMPOINTDETAIL': false,
|
|
|
|
|
'MA_MARKRULESET': false,
|
|
|
|
|
'ES_CAR_VIDEO_PARAMETER': false,
|
|
|
|
|
'MA_CDSBINFO': false,
|
|
|
|
|
'MA_ITEMINFO': false,
|
|
|
|
|
'MA_T_CARPARMSET': false
|
|
|
|
|
}
|
|
|
|
|
for(let key in typeObj){
|
|
|
|
|
typeObj[key] = await upDateTable({ tableName: key })
|
|
|
|
|
if (!typeObj[key]) {
|
|
|
|
|
promptAction.showToast({
|
|
|
|
|
message: `未能查询到${key}表数据, 请先检查网络是否连接正常`,
|
|
|
|
|
duration: 3000
|
|
|
|
|
});
|
|
|
|
|
reslove(false)
|
|
|
|
|
return
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
reslove(true)
|
|
|
|
|
router.pushUrl({
|
|
|
|
|
url: 'pages/ExaminerLogin',
|
|
|
|
|
}, router.RouterMode.Single);
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
//单中心存表
|
|
|
|
|
export async function getSingleCenterTable() {
|
|
|
|
|
return new Promise((reslove,reject)=>{
|
2024-02-26 15:01:27 +08:00
|
|
|
upDataZhongxinginitialization().then((result)=>{
|
|
|
|
|
if(result){
|
2024-02-22 10:40:35 +08:00
|
|
|
router.pushUrl({
|
|
|
|
|
url: 'pages/ExaminerLogin',
|
|
|
|
|
}, router.RouterMode.Single)
|
|
|
|
|
reslove(true)
|
|
|
|
|
}else{
|
|
|
|
|
promptAction.showToast({
|
2024-02-26 15:01:27 +08:00
|
|
|
message: `联网更新失败,请检查网络后重新更新`,
|
|
|
|
|
duration: 500
|
2024-02-22 10:40:35 +08:00
|
|
|
});
|
|
|
|
|
reslove(false)
|
|
|
|
|
}
|
|
|
|
|
}).catch((error)=>{
|
|
|
|
|
console.log(error)
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
|
2024-03-12 15:32:48 +08:00
|
|
|
}
|