双中心修改
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);
|
|
||||||
db.getRdbStore(() => {
|
|
||||||
db.query('0', async (array) => {
|
|
||||||
if (array.length) {
|
|
||||||
delSyncTable('MA_SYSSET').then(async () => {
|
|
||||||
await getDataBaseTable({ tableName: 'MA_SYSSET' }, param)
|
await getDataBaseTable({ tableName: 'MA_SYSSET' }, param)
|
||||||
await getMySystemSetTable({ 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
|
||||||
//读表
|
//读表
|
||||||
//参数平台
|
//参数平台
|
||||||
@ -79,7 +77,7 @@ const centerToMap={
|
|||||||
// '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);
|
||||||
@ -113,7 +111,9 @@ function sqlInsertCommonFn(tableName,resultArr,context?){
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
if (delFlag) {
|
||||||
await delSyncTable(tableName, context)
|
await delSyncTable(tableName, context)
|
||||||
|
}
|
||||||
const result = await sqlInsertCommonFn(tableName, resultArr, context)
|
const result = await sqlInsertCommonFn(tableName, resultArr, context)
|
||||||
resolve(result)
|
resolve(result)
|
||||||
}
|
}
|
||||||
@ -121,17 +121,10 @@ function sqlInsertCommonFn(tableName,resultArr,context?){
|
|||||||
}, 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(() => {
|
|
||||||
}, map[params.tableName],context);
|
|
||||||
accountTable.getRdbStore(() => {
|
|
||||||
accountTable.query('0', async (result) => {
|
|
||||||
if (result.length != 0) {
|
|
||||||
resolve();
|
|
||||||
return
|
|
||||||
} else {
|
|
||||||
const date = new Date()
|
const date = new Date()
|
||||||
if (!reqParam?.paraKdid) {
|
if (!reqParam?.paraKdid) {
|
||||||
prompt.showToast({
|
prompt.showToast({
|
||||||
@ -153,46 +146,22 @@ export async function getDataBaseTable(params,reqParam) {
|
|||||||
resolve();
|
resolve();
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
let INSERT_SQL = "INSERT INTO "+params.tableName
|
|
||||||
+ " ("+ map[params.tableName].ACCOUNT_TABLE.columns.toString()+") VALUES "
|
|
||||||
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(param.tableName, res.body[params.tableName]).then((val) => {
|
||||||
|
reslove(val)
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
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) => {
|
||||||
@ -258,7 +227,7 @@ export async function getMySystemSetTable(params,reqParam) {
|
|||||||
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)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
@ -390,6 +359,7 @@ export async function upDataZhongxinginitialization(param){
|
|||||||
})
|
})
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
function setSyncCenterSqlData(key, res, param) {
|
function setSyncCenterSqlData(key, res, param) {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const mapName = {
|
const mapName = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user