双中心修改
This commit is contained in:
parent
abb3e1bb47
commit
33a719a462
@ -81,21 +81,11 @@ export async function setliushuiNum(context) {
|
|||||||
export async function getDoubleCeneterTable(param) {
|
export async function getDoubleCeneterTable(param) {
|
||||||
return new Promise(async (reslove, reject) => {
|
return new Promise(async (reslove, reject) => {
|
||||||
// MA_SYSSET双中心下做合并表格操作
|
// MA_SYSSET双中心下做合并表格操作
|
||||||
const db = new AccountTable(() => {
|
delSyncTable('MA_SYSSET', param.context).then(async () => {
|
||||||
}, MA_SYSSET, param.context);
|
await getDataBaseTable({ tableName: 'MA_SYSSET' }, param)
|
||||||
db.getRdbStore(() => {
|
await getMySystemSetTable({ tableName: 'MA_SYSSET' }, param)
|
||||||
db.query('0', async (array) => {
|
})
|
||||||
if (array.length) {
|
|
||||||
delSyncTable('MA_SYSSET').then(async () => {
|
|
||||||
await getDataBaseTable({ tableName: 'MA_SYSSET' }, param)
|
|
||||||
await getMySystemSetTable({ tableName: 'MA_SYSSET' }, param)
|
|
||||||
})
|
|
||||||
} else {
|
|
||||||
await getDataBaseTable({ tableName: 'MA_SYSSET' }, param)
|
|
||||||
await getMySystemSetTable({ tableName: 'MA_SYSSET' }, param)
|
|
||||||
}
|
|
||||||
})
|
|
||||||
}, param.context)
|
|
||||||
const typeObj = {
|
const typeObj = {
|
||||||
'MA_MARKRULE': false,
|
'MA_MARKRULE': false,
|
||||||
'MA_SYSTEMPARM': false,
|
'MA_SYSTEMPARM': false,
|
||||||
|
|||||||
@ -1,7 +1,5 @@
|
|||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
import data_rdb from '@ohos.data.rdb';
|
import { initCenterCache, initCenterCacheByKSPT, initEsModel, initialization } from '../../api/index';
|
||||||
import UIAbility from '@ohos.app.ability.UIAbility';
|
|
||||||
import { initCenterCache,initCenterCacheByKSPT,initEsModel,initialization } from '../../api/index'
|
|
||||||
import { dateFormat } from '../utils/tools';
|
import { dateFormat } from '../utils/tools';
|
||||||
import AccountTable from '../database/tables/AccountTable';
|
import AccountTable from '../database/tables/AccountTable';
|
||||||
import MA_MARKRULE from '../constants/MA_MARKRULE';
|
import MA_MARKRULE from '../constants/MA_MARKRULE';
|
||||||
@ -23,12 +21,12 @@ import MA_ITEMINFO from '../constants/MA_ITEMINFO';
|
|||||||
import MA_T_CARPARMSET from '../constants/MA_T_CARPARMSET';
|
import MA_T_CARPARMSET from '../constants/MA_T_CARPARMSET';
|
||||||
import ES_CAR_VIDEO_PARAMETER from '../constants/ES_CAR_VIDEO_PARAMETER';
|
import ES_CAR_VIDEO_PARAMETER from '../constants/ES_CAR_VIDEO_PARAMETER';
|
||||||
import IpConfigTable from '../constants/IpConfigTable';
|
import IpConfigTable from '../constants/IpConfigTable';
|
||||||
import CommonConstants from '../constants/CommonConstants'
|
import CommonConstants from '../constants/CommonConstants';
|
||||||
import DeviceInfoTable from '../constants/DeviceInfoTable'
|
import DeviceInfoTable from '../constants/DeviceInfoTable';
|
||||||
import USER from '../constants/USER'
|
import USER from '../constants/USER';
|
||||||
import util from '@ohos.util';
|
import util from '@ohos.util';
|
||||||
import zlib from '@ohos.zlib';
|
|
||||||
import FileModel from '../../pages/judgeSDK/utils/fileModel';
|
import FileModel from '../../pages/judgeSDK/utils/fileModel';
|
||||||
|
|
||||||
// @ts-nocheck
|
// @ts-nocheck
|
||||||
//读表
|
//读表
|
||||||
//参数平台
|
//参数平台
|
||||||
@ -51,155 +49,126 @@ const map = {
|
|||||||
'MA_ITEMINFO': MA_ITEMINFO,
|
'MA_ITEMINFO': MA_ITEMINFO,
|
||||||
'MA_T_CARPARMSET': MA_T_CARPARMSET,
|
'MA_T_CARPARMSET': MA_T_CARPARMSET,
|
||||||
'ES_CAR_VIDEO_PARAMETER': ES_CAR_VIDEO_PARAMETER,
|
'ES_CAR_VIDEO_PARAMETER': ES_CAR_VIDEO_PARAMETER,
|
||||||
'USER':USER,
|
'USER': USER,
|
||||||
'IpConfigTable':IpConfigTable,
|
'IpConfigTable': IpConfigTable,
|
||||||
'DeviceInfoTable':DeviceInfoTable,
|
'DeviceInfoTable': DeviceInfoTable,
|
||||||
'CommonConstants':CommonConstants
|
'CommonConstants': CommonConstants
|
||||||
}
|
}
|
||||||
const centerToMap={
|
const centerToMap = {
|
||||||
'ItemInfo':MA_ITEMINFO,
|
'ItemInfo': MA_ITEMINFO,
|
||||||
'MarkRule':MA_MARKRULE,
|
'MarkRule': MA_MARKRULE,
|
||||||
'SystemParm':MA_SYSTEMPARM,
|
'SystemParm': MA_SYSTEMPARM,
|
||||||
'mapCollectList':MA_MAP_COLLECT,
|
'mapCollectList': MA_MAP_COLLECT,
|
||||||
'mapCollectshapeList':MA_MAP_COLLECT_SHAPE,
|
'mapCollectshapeList': MA_MAP_COLLECT_SHAPE,
|
||||||
'Map_Collect': MA_MAP_COLLECT,
|
'Map_Collect': MA_MAP_COLLECT,
|
||||||
'Map_Collect_Shape': MA_MAP_COLLECT_SHAPE,
|
'Map_Collect_Shape': MA_MAP_COLLECT_SHAPE,
|
||||||
'Map_ItemClass':MA_MAP_ITEMCLASS,
|
'Map_ItemClass': MA_MAP_ITEMCLASS,
|
||||||
'Map_Point':MA_MAP_POINT,
|
'Map_Point': MA_MAP_POINT,
|
||||||
'Map_Point_Item':MA_MAP_POINT_ITEM,
|
'Map_Point_Item': MA_MAP_POINT_ITEM,
|
||||||
'Map_Road':MA_MAP_ROAD,
|
'Map_Road': MA_MAP_ROAD,
|
||||||
'Map_Road_Lane':MA_MAP_ROAD_LANE,
|
'Map_Road_Lane': MA_MAP_ROAD_LANE,
|
||||||
'Map_SubItem':MA_MAP_SUBITEM,
|
'Map_SubItem': MA_MAP_SUBITEM,
|
||||||
'Sysset':MA_SYSSET,
|
'Sysset': MA_SYSSET,
|
||||||
'CarInfo':ES_CARINFO,
|
'CarInfo': ES_CARINFO,
|
||||||
// 'ES_EXAMPOINTDETAIL':ES_EXAMPOINTDETAIL,
|
// 'ES_EXAMPOINTDETAIL':ES_EXAMPOINTDETAIL,
|
||||||
'MarkRuleSet':MA_MARKRULE,
|
'MarkRuleSet': MA_MARKRULE,
|
||||||
'Cdsbinfo':MA_CDSBINFO,
|
'Cdsbinfo': MA_CDSBINFO,
|
||||||
'T_CarParmSet':MA_T_CARPARMSET,
|
'T_CarParmSet': MA_T_CARPARMSET,
|
||||||
// 'ES_CAR_VIDEO_PARAMETER':ES_CAR_VIDE0pO_PARAMETER
|
// 'ES_CAR_VIDEO_PARAMETER':ES_CAR_VIDE0pO_PARAMETER
|
||||||
}
|
}
|
||||||
|
|
||||||
function sqlInsertCommonFn(tableName,resultArr,context?){
|
function sqlInsertCommonFn(tableName, resultArr, context?, delFlag = true) {
|
||||||
return new Promise((resolve,reject)=>{
|
return new Promise((resolve, reject) => {
|
||||||
const accountTable = new AccountTable(() => {
|
const accountTable = new AccountTable(() => {
|
||||||
}, map[tableName],context);
|
}, map[tableName], context);
|
||||||
accountTable.getRdbStore(() => {
|
accountTable.getRdbStore(() => {
|
||||||
accountTable.query('0', async (result) => {
|
accountTable.query('0', async (result) => {
|
||||||
// console.log('表长度',result.length,tableName)
|
// console.log('表长度',result.length,tableName)
|
||||||
if (result.length == 0) {
|
if (result.length == 0) {
|
||||||
let INSERT_SQL = "INSERT INTO "+tableName
|
let INSERT_SQL = "INSERT INTO " + tableName
|
||||||
+ " ("+ map[tableName].ACCOUNT_TABLE.columns.toString()+") VALUES "
|
+ " (" + map[tableName].ACCOUNT_TABLE.columns.toString() + ") VALUES "
|
||||||
|
|
||||||
resultArr.map((data,i) => {
|
resultArr.map((data, i) => {
|
||||||
data.id=`${i}`
|
data.id = `${i}`
|
||||||
let str='('
|
let str = '('
|
||||||
map[tableName].ACCOUNT_TABLE.columns.map((res,index)=>{
|
map[tableName].ACCOUNT_TABLE.columns.map((res, index) => {
|
||||||
if(map[tableName].ACCOUNT_TABLE.columns.length-1==index){
|
if (map[tableName].ACCOUNT_TABLE.columns.length - 1 == index) {
|
||||||
str+=data[res]?`"${data[res]}"`:'NULL'
|
str += data[res] ? `"${data[res]}"` : 'NULL'
|
||||||
}else{
|
} else {
|
||||||
str+=(data[res]?`"${data[res]}"`:'NULL')+','
|
str += (data[res] ? `"${data[res]}"` : 'NULL') + ','
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
if(i==resultArr.length-1){
|
if (i == resultArr.length - 1) {
|
||||||
str+=')'
|
str += ')'
|
||||||
}else{
|
} else {
|
||||||
str+='),'
|
str += '),'
|
||||||
}
|
}
|
||||||
INSERT_SQL+=str
|
INSERT_SQL += str
|
||||||
})
|
})
|
||||||
accountTable.sqlOperate(INSERT_SQL,tableName,(val)=>{
|
accountTable.sqlOperate(INSERT_SQL, tableName, (val) => {
|
||||||
console.log('sqlsqlinsert,',val,'tableName',tableName)
|
console.log('sqlsqlinsert,', val, 'tableName', tableName)
|
||||||
resolve(val)
|
resolve(val)
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
await delSyncTable(tableName,context)
|
if (delFlag) {
|
||||||
const result= await sqlInsertCommonFn(tableName,resultArr,context)
|
await delSyncTable(tableName, context)
|
||||||
|
}
|
||||||
|
const result = await sqlInsertCommonFn(tableName, resultArr, context)
|
||||||
resolve(result)
|
resolve(result)
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
},context);
|
}, context);
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//参数平台
|
//参数平台
|
||||||
export async function getDataBaseTable(params,reqParam) {
|
export async function getDataBaseTable(params, reqParam) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
const accountTable = new AccountTable(() => {
|
const date = new Date()
|
||||||
}, map[params.tableName],context);
|
if (!reqParam?.paraKdid) {
|
||||||
accountTable.getRdbStore(() => {
|
prompt.showToast({
|
||||||
accountTable.query('0', async (result) => {
|
message: 'paraKdid获取失败',
|
||||||
if (result.length != 0) {
|
duration: 3000
|
||||||
resolve();
|
});
|
||||||
return
|
return
|
||||||
} else {
|
}
|
||||||
const date = new Date()
|
const str = { "head": { "time": dateFormat(date) },
|
||||||
if(!reqParam?.paraKdid){
|
"body":
|
||||||
prompt.showToast({
|
{ "tableName": params.tableName, // 表名
|
||||||
message: 'paraKdid获取失败',
|
"paraKdid": reqParam.paraKdid, //参数平台kdid
|
||||||
duration: 3000
|
"examinationRoomId": reqParam.examinationRoomId, //考试平台kdid
|
||||||
});
|
"typeRsp": "0" // 赋默认值0,无需改变
|
||||||
return
|
}
|
||||||
}
|
}
|
||||||
const str = { "head": { "time": dateFormat(date) },
|
let res: any = await initCenterCache(str, reqParam.centerHost)
|
||||||
"body":
|
if (res.body[params.tableName].length == 0) {
|
||||||
{ "tableName": params.tableName, // 表名
|
resolve();
|
||||||
"paraKdid": reqParam.paraKdid, //参数平台kdid
|
return
|
||||||
"examinationRoomId": reqParam.examinationRoomId, //考试平台kdid
|
}
|
||||||
"typeRsp": "0" // 赋默认值0,无需改变
|
if (params.tableName == 'MA_SYSSET') {
|
||||||
}
|
res.body[params.tableName] = res.body[params.tableName].filter(res => {
|
||||||
}
|
return res['v_no'] >= 300 && res['v_no'] <= 700
|
||||||
let res: any = await initCenterCache(str,reqParam.centerHost)
|
})
|
||||||
if( res.body[params.tableName].length==0){
|
}
|
||||||
resolve();
|
sqlInsertCommonFn(param.tableName, res.body[params.tableName]).then((val) => {
|
||||||
return
|
reslove(val)
|
||||||
}
|
})
|
||||||
|
|
||||||
let INSERT_SQL = "INSERT INTO "+params.tableName
|
|
||||||
+ " ("+ map[params.tableName].ACCOUNT_TABLE.columns.toString()+") VALUES "
|
|
||||||
if(params.tableName=='MA_SYSSET'){
|
|
||||||
res.body[params.tableName]= res.body[params.tableName].filter(res=>{
|
|
||||||
return res['v_no']>=300&&res['v_no']<=700
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
res.body[params.tableName].map((data,i) => {
|
|
||||||
// data.id=`${i}`
|
|
||||||
data.id=i
|
|
||||||
let str='('
|
|
||||||
map[params.tableName].ACCOUNT_TABLE.columns.map((res,index)=>{
|
|
||||||
if(map[params.tableName].ACCOUNT_TABLE.columns.length-1==index){
|
|
||||||
str+=data[res]?`"${data[res]}"`:'NULL'
|
|
||||||
}else{
|
|
||||||
str+=(data[res]?`"${data[res]}"`:'NULL')+','
|
|
||||||
}
|
|
||||||
})
|
|
||||||
if(i==res.body[params.tableName].length-1){
|
|
||||||
str+=')'
|
|
||||||
}else{
|
|
||||||
str+='),'
|
|
||||||
}
|
|
||||||
INSERT_SQL+=str
|
|
||||||
})
|
|
||||||
|
|
||||||
accountTable.sqlOperate(INSERT_SQL,params.tableName,()=>{
|
|
||||||
resolve(true)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}, true);
|
|
||||||
},reqParam.context);
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//依据数组和表名更新sql表
|
//依据数组和表名更新sql表
|
||||||
export async function upDateTableByArray(tableName,arr) {
|
export async function upDateTableByArray(tableName, arr) {
|
||||||
sqlInsertCommonFn(tableName,arr)
|
sqlInsertCommonFn(tableName, arr)
|
||||||
}
|
}
|
||||||
|
|
||||||
//更新双中心表
|
//更新双中心表
|
||||||
export async function upDateTable(params,reqParam) {
|
export async function upDateTable(params, reqParam) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const date = new Date()
|
const date = new Date()
|
||||||
let paraKdid=reqParam?.paraKdid||''
|
let paraKdid = reqParam?.paraKdid || ''
|
||||||
let examinationRoomId=reqParam?.examinationRoomId||''
|
let examinationRoomId = reqParam?.examinationRoomId || ''
|
||||||
if(!paraKdid|| !examinationRoomId){
|
if (!paraKdid || !examinationRoomId) {
|
||||||
resolve(false)
|
resolve(false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -212,17 +181,17 @@ export async function upDateTable(params,reqParam) {
|
|||||||
"typeRsp": "0" // 赋默认值0,无需改变
|
"typeRsp": "0" // 赋默认值0,无需改变
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const url=globalThis.timeInfo.url
|
const url = globalThis.timeInfo.url
|
||||||
|
|
||||||
initCenterCache(str,url).then(async (res)=>{
|
initCenterCache(str, url).then(async (res) => {
|
||||||
if(!res||res==undefined||res==''){
|
if (!res || res == undefined || res == '') {
|
||||||
resolve(false)
|
resolve(false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
const result=await sqlInsertCommonFn(params.tableName,res.body[params.tableName],reqParam.context)
|
const result = await sqlInsertCommonFn(params.tableName, res.body[params.tableName], reqParam.context)
|
||||||
resolve(result)
|
resolve(result)
|
||||||
}catch (error){
|
} catch (error) {
|
||||||
console.log(error)
|
console.log(error)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
@ -230,10 +199,10 @@ export async function upDateTable(params,reqParam) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//考试平台
|
//考试平台
|
||||||
export async function getMySystemSetTable(params,reqParam) {
|
export async function getMySystemSetTable(params, reqParam) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const date = new Date()
|
const date = new Date()
|
||||||
if(!reqParam.paraKdid){
|
if (!reqParam.paraKdid) {
|
||||||
prompt.showToast({
|
prompt.showToast({
|
||||||
message: 'paraKdid获取失败',
|
message: 'paraKdid获取失败',
|
||||||
duration: 3000
|
duration: 3000
|
||||||
@ -248,17 +217,17 @@ export async function getMySystemSetTable(params,reqParam) {
|
|||||||
"typeRsp": "0" // 赋默认值0,无需改变
|
"typeRsp": "0" // 赋默认值0,无需改变
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
initCenterCacheByKSPT(str,reqParam.url).then((res)=>{
|
initCenterCacheByKSPT(str, reqParam.url).then((res) => {
|
||||||
if( res.body[params.tableName].length==0){
|
if (res.body[params.tableName].length == 0) {
|
||||||
resolve();
|
resolve();
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if(params.tableName=='MA_SYSSET'){
|
if (params.tableName == 'MA_SYSSET') {
|
||||||
res.body[params.tableName]= res.body[params.tableName].filter(res=>{
|
res.body[params.tableName] = res.body[params.tableName].filter(res => {
|
||||||
return res['v_no']<300 || res['v_no']>700
|
return res['v_no'] < 300 || res['v_no'] > 700
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
sqlInsertCommonFn(params.tableName,res.body[params.tableName],reqParam.context).then((result)=>{
|
sqlInsertCommonFn(params.tableName, res.body[params.tableName], reqParam.context, false).then((result) => {
|
||||||
resolve(result)
|
resolve(result)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -269,10 +238,10 @@ export async function getMySystemSetTable(params,reqParam) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//依据表名同步获取数据
|
//依据表名同步获取数据
|
||||||
export async function getSyncData(tableName,context?) {
|
export async function getSyncData(tableName, context?) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const accountTable = new AccountTable(() => {
|
const accountTable = new AccountTable(() => {
|
||||||
}, map[tableName],context);
|
}, map[tableName], context);
|
||||||
accountTable.getRdbStore(() => {
|
accountTable.getRdbStore(() => {
|
||||||
accountTable.query('0', async (result) => {
|
accountTable.query('0', async (result) => {
|
||||||
resolve(result)
|
resolve(result)
|
||||||
@ -282,22 +251,22 @@ export async function getSyncData(tableName,context?) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function delSyncTable(tableName,context?){
|
export async function delSyncTable(tableName, context?) {
|
||||||
return new Promise((resolve,reject)=>{
|
return new Promise((resolve, reject) => {
|
||||||
const accountTable = new AccountTable(() => {
|
const accountTable = new AccountTable(() => {
|
||||||
}, map[tableName],context);
|
}, map[tableName], context);
|
||||||
accountTable.deleteTableData((ret)=>{
|
accountTable.deleteTableData((ret) => {
|
||||||
console.log('删除成功')
|
console.log('删除成功')
|
||||||
resolve(true)
|
resolve(true)
|
||||||
},tableName,context)
|
}, tableName, context)
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取车模、场地模型
|
//获取车模、场地模型
|
||||||
export async function getEsCarModel(context){
|
export async function getEsCarModel(context) {
|
||||||
const date = new Date()
|
const date = new Date()
|
||||||
if(!globalThis.timeInfo?.paraKdid){
|
if (!globalThis.timeInfo?.paraKdid) {
|
||||||
prompt.showToast({
|
prompt.showToast({
|
||||||
message: 'paraKdid获取失败',
|
message: 'paraKdid获取失败',
|
||||||
duration: 3000
|
duration: 3000
|
||||||
@ -307,23 +276,23 @@ export async function getEsCarModel(context){
|
|||||||
const carStr = { "head": { "time": dateFormat(date) },
|
const carStr = { "head": { "time": dateFormat(date) },
|
||||||
"body":
|
"body":
|
||||||
{
|
{
|
||||||
"rtkType":"1",//1:车模 2:场地模型
|
"rtkType": "1", //1:车模 2:场地模型
|
||||||
"rspType":"0", //返回类型
|
"rspType": "0", //返回类型
|
||||||
"paraKdid": globalThis.timeInfo.paraKdid, //参数平台kdid
|
"paraKdid": globalThis.timeInfo.paraKdid, //参数平台kdid
|
||||||
"examinationRoomId": globalThis.timeInfo.kdid, //考试平台kdid
|
"examinationRoomId": globalThis.timeInfo.kdid, //考试平台kdid
|
||||||
// "carMac":"MAC-HCPAD-210",
|
// "carMac":"MAC-HCPAD-210",
|
||||||
"carMac":globalThis.deviceNo
|
"carMac": globalThis.deviceNo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const venueStr = { "head": { "time": dateFormat(date) },
|
const venueStr = { "head": { "time": dateFormat(date) },
|
||||||
"body":
|
"body":
|
||||||
{
|
{
|
||||||
"rtkType":"2",//1:车模 2:场地模型
|
"rtkType": "2", //1:车模 2:场地模型
|
||||||
"rspType":"0", //返回类型
|
"rspType": "0", //返回类型
|
||||||
"paraKdid": globalThis.timeInfo.paraKdid, //参数平台kdid
|
"paraKdid": globalThis.timeInfo.paraKdid, //参数平台kdid
|
||||||
"examinationRoomId": globalThis.timeInfo.kdid, //考试平台kdid
|
"examinationRoomId": globalThis.timeInfo.kdid, //考试平台kdid
|
||||||
// "carMac":"MAC-HCPAD-210",
|
// "carMac":"MAC-HCPAD-210",
|
||||||
"carMac":globalThis.deviceNo
|
"carMac": globalThis.deviceNo
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -335,48 +304,48 @@ export async function getEsCarModel(context){
|
|||||||
const venueModel = venueRes.body.ES_MODEL[0][2];
|
const venueModel = venueRes.body.ES_MODEL[0][2];
|
||||||
|
|
||||||
let tmpBase64Array = carModel.split("\r\n")
|
let tmpBase64Array = carModel.split("\r\n")
|
||||||
let newBase64Str:string = '';
|
let newBase64Str: string = '';
|
||||||
for (let i = 0; i < tmpBase64Array.length; ++i) {
|
for (let i = 0; i < tmpBase64Array.length; ++i) {
|
||||||
newBase64Str += tmpBase64Array[i];
|
newBase64Str += tmpBase64Array[i];
|
||||||
}
|
}
|
||||||
const base64 = new util.Base64();
|
const base64 = new util.Base64();
|
||||||
let result = base64.decodeSync(newBase64Str);
|
let result = base64.decodeSync(newBase64Str);
|
||||||
const fileModel= new FileModel(context);
|
const fileModel = new FileModel(context);
|
||||||
await fileModel.initFolder()
|
await fileModel.initFolder()
|
||||||
await fileModel.storingFiles(result.buffer)
|
await fileModel.storingFiles(result.buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function upDataZhongxinginitialization(param){
|
export async function upDataZhongxinginitialization(param) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
if(!param.carId){
|
if (!param.carId) {
|
||||||
resolve(false)
|
resolve(false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
const str = {
|
const str = {
|
||||||
"carId": param.carId, // 表名
|
"carId": param.carId, // 表名
|
||||||
"examinationRoomId": param.examinationRoomId, //考试平台kdid
|
"examinationRoomId": param.examinationRoomId, //考试平台kdid
|
||||||
videoVersion:'1.0',
|
videoVersion: '1.0',
|
||||||
judgeVersion:param.judgeVersion,
|
judgeVersion: param.judgeVersion,
|
||||||
shellVersion: param.shellVersion,
|
shellVersion: param.shellVersion,
|
||||||
host:param.host
|
host: param.host
|
||||||
}
|
}
|
||||||
console.log('daihai2',JSON.stringify(str))
|
console.log('daihai2', JSON.stringify(str))
|
||||||
|
|
||||||
initialization(str).then(async (res)=>{
|
initialization(str).then(async (res) => {
|
||||||
console.log('daihai3',JSON.stringify(res))
|
console.log('daihai3', JSON.stringify(res))
|
||||||
if(!res){
|
if (!res) {
|
||||||
resolve(false)
|
resolve(false)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
let flag
|
let flag
|
||||||
console.log('resposestart')
|
console.log('resposestart')
|
||||||
|
|
||||||
for(let key in res.initializationRsp.body){
|
for (let key in res.initializationRsp.body) {
|
||||||
if(!centerToMap[key]){
|
if (!centerToMap[key]) {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
const data= await setSyncCenterSqlData(key,res,param)
|
const data = await setSyncCenterSqlData(key, res, param)
|
||||||
if(!data){
|
if (!data) {
|
||||||
resolve(false)
|
resolve(false)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -385,52 +354,53 @@ export async function upDataZhongxinginitialization(param){
|
|||||||
|
|
||||||
console.log('resposestart')
|
console.log('resposestart')
|
||||||
|
|
||||||
}).catch((Error)=>{
|
}).catch((Error) => {
|
||||||
resolve(false)
|
resolve(false)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
function setSyncCenterSqlData(key,res,param){
|
|
||||||
return new Promise((resolve,reject)=>{
|
function setSyncCenterSqlData(key, res, param) {
|
||||||
const mapName={
|
return new Promise((resolve, reject) => {
|
||||||
'ItemInfo':'MA_ITEMINFO',
|
const mapName = {
|
||||||
'MarkRule':'MA_MARKRULE',
|
'ItemInfo': 'MA_ITEMINFO',
|
||||||
'SystemParm':'MA_SYSTEMPARM',
|
'MarkRule': 'MA_MARKRULE',
|
||||||
|
'SystemParm': 'MA_SYSTEMPARM',
|
||||||
'Map_Collect': 'MA_MAP_COLLECT',
|
'Map_Collect': 'MA_MAP_COLLECT',
|
||||||
'Map_Collect_Shape': 'MA_MAP_COLLECT_SHAPE',
|
'Map_Collect_Shape': 'MA_MAP_COLLECT_SHAPE',
|
||||||
'Map_ItemClass':'MA_MAP_ITEMCLASS',
|
'Map_ItemClass': 'MA_MAP_ITEMCLASS',
|
||||||
'Map_Point':'MA_MAP_POINT',
|
'Map_Point': 'MA_MAP_POINT',
|
||||||
'Map_Point_Item':'MA_MAP_POINT_ITEM',
|
'Map_Point_Item': 'MA_MAP_POINT_ITEM',
|
||||||
'Map_Road':'MA_MAP_ROAD',
|
'Map_Road': 'MA_MAP_ROAD',
|
||||||
'Map_Road_Lane':'MA_MAP_ROAD_LANE',
|
'Map_Road_Lane': 'MA_MAP_ROAD_LANE',
|
||||||
'Map_SubItem':'MAP_SUBITEM',
|
'Map_SubItem': 'MAP_SUBITEM',
|
||||||
'Sysset':'MA_SYSSET',
|
'Sysset': 'MA_SYSSET',
|
||||||
'CarInfo':'ES_CARINFO',
|
'CarInfo': 'ES_CARINFO',
|
||||||
// 'ES_EXAMPOINTDETAIL':ES_EXAMPOINTDETAIL,
|
// 'ES_EXAMPOINTDETAIL':ES_EXAMPOINTDETAIL,
|
||||||
'MarkRuleSet':'MA_MARKRULESET',
|
'MarkRuleSet': 'MA_MARKRULESET',
|
||||||
'Cdsbinfo':'MA_CDSBINFO',
|
'Cdsbinfo': 'MA_CDSBINFO',
|
||||||
'T_CarParmSet':'MA_T_CARPARMSET',
|
'T_CarParmSet': 'MA_T_CARPARMSET',
|
||||||
// 'ES_CAR_VIDEO_PARAMETER':ES_CAR_VIDE0pO_PARAMETER
|
// 'ES_CAR_VIDEO_PARAMETER':ES_CAR_VIDE0pO_PARAMETER
|
||||||
}
|
}
|
||||||
// const accountTable = new AccountTable(() => {
|
// const accountTable = new AccountTable(() => {
|
||||||
// }, centerToMap[key],param.context);
|
// }, centerToMap[key],param.context);
|
||||||
let arrList
|
let arrList
|
||||||
if(res.initializationRsp.body[key].record instanceof Array){
|
if (res.initializationRsp.body[key].record instanceof Array) {
|
||||||
arrList =res.initializationRsp.body[key].record
|
arrList = res.initializationRsp.body[key].record
|
||||||
}else{
|
} else {
|
||||||
arrList=[res.initializationRsp.body[key].record]
|
arrList = [res.initializationRsp.body[key].record]
|
||||||
}
|
}
|
||||||
console.log('mapName[key]',mapName[key],key)
|
console.log('mapName[key]', mapName[key], key)
|
||||||
sqlInsertCommonFn(mapName[key],arrList,param.context).then((result)=>{
|
sqlInsertCommonFn(mapName[key], arrList, param.context).then((result) => {
|
||||||
console.log(key,'表建立成功')
|
console.log(key, '表建立成功')
|
||||||
if(result){
|
if (result) {
|
||||||
resolve(true)
|
resolve(true)
|
||||||
}else{
|
} else {
|
||||||
resolve(false)
|
resolve(false)
|
||||||
}
|
}
|
||||||
}).catch((msg)=>{
|
}).catch((msg) => {
|
||||||
reject(false)
|
reject(false)
|
||||||
console.log(key,'表建立失败')
|
console.log(key, '表建立失败')
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user