init
This commit is contained in:
parent
ed236df1d6
commit
ef2b4e363d
@ -31,7 +31,7 @@ import zlib from '@ohos.zlib';
|
||||
import FileModel from '../../pages/judgeSDK/utils/file-model';
|
||||
// @ts-nocheck
|
||||
//读表
|
||||
|
||||
//参数平台
|
||||
export async function getDataBaseTable(params) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const map = {
|
||||
@ -108,14 +108,6 @@ export async function getDataBaseTable(params) {
|
||||
accountTable.sqlOperate(INSERT_SQL,params.tableName,()=>{
|
||||
resolve(true)
|
||||
})
|
||||
// res.body[params.tableName].map((data, i) => {
|
||||
// accountTable.insertData(data, (id) => {
|
||||
// if (i == res.body[params.tableName].length - 1) {
|
||||
// resolve();
|
||||
// }
|
||||
// });
|
||||
// })
|
||||
|
||||
}
|
||||
}, true);
|
||||
});
|
||||
@ -172,7 +164,6 @@ export async function upDateTable(params) {
|
||||
}
|
||||
const accountTable = new AccountTable(() => {
|
||||
}, map[params.tableName]);
|
||||
console.log('param,tablename',params.tableName)
|
||||
accountTable.getRdbStore(() => {
|
||||
accountTable.query(0,async (result) => {
|
||||
console.log('param,tablenametttt',res.body[params.tableName])
|
||||
@ -181,7 +172,6 @@ export async function upDateTable(params) {
|
||||
let INSERT_SQL = "INSERT INTO "+params.tableName
|
||||
+ " ("+ map[params.tableName].ACCOUNT_TABLE.columns.toString()+") VALUES "
|
||||
|
||||
console.log('param,tablename11111')
|
||||
res.body[params.tableName].map((data,i) => {
|
||||
data.id=`${i}`
|
||||
let str='('
|
||||
@ -205,25 +195,31 @@ export async function upDateTable(params) {
|
||||
})
|
||||
|
||||
} else {
|
||||
let str=''
|
||||
res.body[params.tableName].map((data,i)=>{
|
||||
let num=0
|
||||
str+=`UPDATE ${params.tableName} SET `
|
||||
for(let key in data){
|
||||
num++
|
||||
if(num==map[params.tableName].ACCOUNT_TABLE.columns.length-1){
|
||||
str+=`${key} = "${data[key]}"`
|
||||
await delSyncTable(params.tableName)
|
||||
let INSERT_SQL = "INSERT INTO "+params.tableName
|
||||
+ " ("+ map[params.tableName].ACCOUNT_TABLE.columns.toString()+") VALUES "
|
||||
|
||||
res.body[params.tableName].map((data,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]||'1'}"`
|
||||
}else{
|
||||
str+=`${key} = "${data[key]}",`
|
||||
str+=`"${data[res]||'1'}"`+','
|
||||
}
|
||||
})
|
||||
if(i==res.body[params.tableName].length-1){
|
||||
str+=')'
|
||||
}else{
|
||||
str+='),'
|
||||
}
|
||||
str+=` WHERE id = "${i}";`
|
||||
INSERT_SQL+=str
|
||||
})
|
||||
accountTable.sqlOperate(str,params.tableName,()=>{
|
||||
|
||||
accountTable.sqlOperate(INSERT_SQL,params.tableName,()=>{
|
||||
resolve(true)
|
||||
})
|
||||
return
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -269,26 +265,11 @@ export async function upDateTableConfig(tableName,arr) {
|
||||
const accountTable = new AccountTable(() => {
|
||||
}, map[tableName]);
|
||||
accountTable.getRdbStore(() => {
|
||||
accountTable.query(0, (result) => {
|
||||
accountTable.query(0,async (result) => {
|
||||
if(arr.length){
|
||||
if(result.length){
|
||||
let str=''
|
||||
arr.map((data,i)=>{
|
||||
let num=0
|
||||
str+=`UPDATE ${tableName} SET `
|
||||
for(let key in data){
|
||||
num++
|
||||
if(num==map[tableName].ACCOUNT_TABLE.columns.length-1){
|
||||
str+=`${key} = "${data[key]}"`
|
||||
}else{
|
||||
str+=`${key} = "${data[key]}",`
|
||||
}
|
||||
}
|
||||
str+=` WHERE id = "${i}";`
|
||||
})
|
||||
accountTable.sqlOperate(str,tableName,()=>{
|
||||
resolve(true)
|
||||
})
|
||||
await delSyncTable(tableName)
|
||||
upDateTableConfig(tableName,arr)
|
||||
}else{
|
||||
let INSERT_SQL = "INSERT INTO "+tableName
|
||||
+ " ("+ map[tableName].ACCOUNT_TABLE.columns.toString()+") VALUES "
|
||||
@ -314,17 +295,6 @@ export async function upDateTableConfig(tableName,arr) {
|
||||
accountTable.sqlOperate(INSERT_SQL,tableName,()=>{
|
||||
resolve();
|
||||
})
|
||||
// arr.map((data,i) => {
|
||||
// if (result.length == 0) {
|
||||
// accountTable.insertData(data, (id) => {
|
||||
// if (i == result.length - 1) {
|
||||
//
|
||||
// }
|
||||
// });
|
||||
// } else {
|
||||
//
|
||||
// }
|
||||
// })
|
||||
}
|
||||
|
||||
}else{
|
||||
@ -336,6 +306,7 @@ export async function upDateTableConfig(tableName,arr) {
|
||||
});
|
||||
});
|
||||
}
|
||||
//考试平台
|
||||
export async function getMySystemSetTable(params) {
|
||||
return new Promise((resolve, reject) => {
|
||||
const map = {
|
||||
@ -385,8 +356,6 @@ export async function getMySystemSetTable(params) {
|
||||
}
|
||||
let INSERT_SQL = "INSERT INTO "+params.tableName
|
||||
+ " ("+ map[params.tableName].ACCOUNT_TABLE.columns.toString()+") VALUES "
|
||||
|
||||
console.log('param,tablename11111')
|
||||
res.body[params.tableName].map((data,i) => {
|
||||
data.id=`${i+result.length}`
|
||||
let str='('
|
||||
@ -547,10 +516,7 @@ export async function getEsCarModel(context){
|
||||
export async function upDataZhongxinginitialization(){
|
||||
return new Promise(async (resolve, reject) => {
|
||||
if(!globalThis.carInfo?.carId){
|
||||
// prompt.showToast({
|
||||
// message: '联网更新失败,请检查网络后重新更新',
|
||||
// duration: 1000
|
||||
// });
|
||||
|
||||
resolve(false)
|
||||
return
|
||||
}
|
||||
@ -558,8 +524,8 @@ export async function upDataZhongxinginitialization(){
|
||||
"carId": globalThis.carInfo?.carId, // 表名
|
||||
"examinationRoomId": globalThis.carInfo?.examinationRoomId, //考试平台kdid
|
||||
videoVersion:'1.0',
|
||||
judgeVersion:'2024.11.22.14',
|
||||
shellVersion:'2024.11.22.14'
|
||||
judgeVersion:'2022.03.17.1',
|
||||
shellVersion: globalThis.version
|
||||
}
|
||||
let res: any = await initialization(str)
|
||||
if(!res){
|
||||
@ -709,29 +675,8 @@ function setSyncCenterSqlData(key,res){
|
||||
})
|
||||
}
|
||||
else{
|
||||
let str=''
|
||||
str+=`UPDATE ${mapName[key]} SET `
|
||||
arrList.map((data,i)=>{
|
||||
let num=0
|
||||
for(let keyWord in map[key].ACCOUNT_TABLE.columns){
|
||||
num++
|
||||
if(map[key].ACCOUNT_TABLE.columns[keyWord]=='id'){
|
||||
continue
|
||||
}
|
||||
if(num== map[key].ACCOUNT_TABLE.columns.length){
|
||||
str+=`${map[key].ACCOUNT_TABLE.columns[keyWord]} = "${data[map[key].ACCOUNT_TABLE.columns[keyWord]]}"`
|
||||
}else{
|
||||
str+=`${map[key].ACCOUNT_TABLE.columns[keyWord]} = "${data[map[key].ACCOUNT_TABLE.columns[keyWord]
|
||||
]}",`
|
||||
}
|
||||
}
|
||||
str+=` WHERE id = "${i}";`
|
||||
})
|
||||
console.log('updataTableSQl',str)
|
||||
accountTable.sqlOperate(str,mapName[key],(val)=>{
|
||||
console.log('valval',val)
|
||||
resolve(val)
|
||||
})
|
||||
await delSyncTable(mapName[key])
|
||||
setSyncCenterSqlData(key,res)
|
||||
}
|
||||
}, true);
|
||||
});
|
||||
|
||||
@ -44,7 +44,6 @@ struct Index {
|
||||
@State angle: number = 0
|
||||
@State ratio: number = 850 / 960
|
||||
@State loading: boolean = true
|
||||
@State devPath: string = "/dev/ttyS0"
|
||||
@State fd: number = -1;
|
||||
private context = getContext(this) as common.UIAbilityContext;
|
||||
|
||||
@ -465,21 +464,15 @@ struct Index {
|
||||
db.getRdbStore(() => {
|
||||
db.query('0', async (array) => {
|
||||
if (array.length) {
|
||||
delSyncTable('MA_SYSSET').then(() => {
|
||||
delSyncTable('MA_SYSSET').then(async () => {
|
||||
// getSyncData('MA_SYSSET')
|
||||
getDataBaseTable({ tableName: 'MA_SYSSET' })
|
||||
await getDataBaseTable({ tableName: 'MA_SYSSET' })
|
||||
await getMySystemSetTable({ tableName: 'MA_SYSSET' })
|
||||
})
|
||||
// array.map((res, i) => {
|
||||
// db.deleteData(res, async () => {
|
||||
// if (i == array.length - 1) {
|
||||
// await getDataBaseTable({ tableName: 'MA_SYSSET' })
|
||||
// // await getMySystemSetTable({ tableName: 'MA_SYSSET' })
|
||||
// }
|
||||
// });
|
||||
// })
|
||||
|
||||
} else {
|
||||
await getDataBaseTable({ tableName: 'MA_SYSSET' })
|
||||
// await getMySystemSetTable({ tableName: 'MA_SYSSET' })
|
||||
await getMySystemSetTable({ tableName: 'MA_SYSSET' })
|
||||
}
|
||||
// console.log(markRuleParams)
|
||||
})
|
||||
|
||||
@ -239,6 +239,7 @@ struct FaceCompare {
|
||||
|
||||
globalThis.udpClient2.sendMsg(param, this.context)
|
||||
}
|
||||
|
||||
async faceComparFn() {
|
||||
var loginInfo1 = {
|
||||
host: `http://${this.param.ip}:80`, user: "administrator", pass: this.param.pwd }
|
||||
|
||||
@ -12,17 +12,10 @@ import FaceCompare from './compontents/faceCompareByhaikang'
|
||||
import ethernet from '@ohos.net.ethernet';
|
||||
import prompt from '@ohos.prompt'
|
||||
import {initJudgeUdp} from '../common/utils/UdpJudge'
|
||||
// import testNapi from "@ohos.idcard";
|
||||
import CommonEvent from '@ohos.commonEventManager';
|
||||
// @ts-ignore
|
||||
|
||||
import {writeObjectOut} from '../api/judge'
|
||||
import testNapi from "@ohos.idcard";
|
||||
import mediaLibrary from '@ohos.multimedia.mediaLibrary'
|
||||
import fs from '@ohos.file.fs'
|
||||
import FileUtil from '../common/utils/File'
|
||||
import common from '@ohos.app.ability.common';
|
||||
import onvifclient from '@ohos.onvifclient';
|
||||
import util from '@ohos.util';
|
||||
import { VideoConfig } from './interfaces'
|
||||
import WebRTCVoice from './webRTC/'
|
||||
@Entry
|
||||
@ -112,12 +105,11 @@ struct Index {
|
||||
@State isCanClick: boolean = true;
|
||||
subscriber;
|
||||
@State faceCatchImg:string=''
|
||||
private fileUtil: FileUtil
|
||||
// private fileUtil: FileUtil
|
||||
// that.sfzmhm = 'surenjun';
|
||||
|
||||
onPageShow() {
|
||||
//语音功能
|
||||
console.log('kkkkkk')
|
||||
this.stepFlag=false
|
||||
new WebRTCVoice(this.context);
|
||||
this.faceCompareSucess=0
|
||||
@ -150,18 +142,14 @@ struct Index {
|
||||
}
|
||||
globalThis.statue=2
|
||||
this.numCount=0
|
||||
const fileUtil = new FileUtil(this.context)
|
||||
this.fileUtil = fileUtil
|
||||
|
||||
|
||||
|
||||
globalThis.udpClient2&&globalThis.udpClient2.onMessage((val)=>{
|
||||
console.log('valvaltotol2',val.id,val.body,val.length)
|
||||
|
||||
if(val.id=='32'){
|
||||
|
||||
globalThis.signNum=val.body[1]
|
||||
console.log('qkqkqkqval.body1',val.id,val.body,val.length)
|
||||
|
||||
if(val.body[0]=='7'){
|
||||
this.getqkFn()
|
||||
this.signNum=val.body[1]
|
||||
@ -190,7 +178,6 @@ struct Index {
|
||||
})
|
||||
// 应用启动时打开读卡设备
|
||||
let ret = testNapi.OpenDevice();
|
||||
console.log("zzctest Open Device ret = " + ret);
|
||||
if (ret == 0) {
|
||||
testNapi.StartReadCard(this.onReadCard);
|
||||
} else {
|
||||
@ -430,13 +417,12 @@ struct Index {
|
||||
globalThis.lsh=this.lsh
|
||||
return
|
||||
}else{
|
||||
this.getExaminationStudentInfoFn()
|
||||
// this.getExaminationStudentInfoFn()
|
||||
}
|
||||
this.initSysset()
|
||||
initJudgeUdp()
|
||||
}
|
||||
changeQkfn(){
|
||||
console.log('userqk')
|
||||
this.qkFn()
|
||||
}
|
||||
getqkFn(){
|
||||
@ -558,20 +544,18 @@ struct Index {
|
||||
const db = new AccountTable(()=>{},MA_SYSSET);
|
||||
db.getRdbStore(()=>{
|
||||
db.query('0', (syssetParams) => {
|
||||
//TODO 监管接口序列号 目前环境没有
|
||||
const serialNumberArr = syssetParams.filter(sys => sys.v_no === '901')
|
||||
that.jkxlh = serialNumberArr?.[0]?.v_value || '1234567'
|
||||
const ksxtbhArr = syssetParams.filter(sys => sys.v_no === '902')
|
||||
that.ksxtbh = ksxtbhArr?.[0]?.v_value || '222'
|
||||
const studentRefreshParam=syssetParams.filter(sys => sys.v_no === '452')
|
||||
that.studentRefreshStatue=studentRefreshParam?.[0]?.v_value || '0'
|
||||
console.log('studentRefreshStatue',studentRefreshParam)
|
||||
//0不自动更新 1自动更新(不限次数) 2没有考生更新2次
|
||||
if(that.studentRefreshStatue=='2'){
|
||||
clearInterval(that.interval2)
|
||||
that.interval2=setInterval(()=>{
|
||||
if(that.dataList.length==0&&that.numCount<3){
|
||||
that.numCount++
|
||||
console.log('2222211111')
|
||||
that.getExaminationStudentInfoFn()
|
||||
}
|
||||
},5000)
|
||||
@ -883,15 +867,6 @@ struct Index {
|
||||
})
|
||||
|
||||
}
|
||||
Array2Byte(array) {
|
||||
var buf = new ArrayBuffer(array.length);
|
||||
var view = new Uint8Array(buf);
|
||||
for (var i = 0; i != array.length; ++i)
|
||||
{
|
||||
view[i] = array[i] & 0xFF;
|
||||
}
|
||||
return view;
|
||||
}
|
||||
outClick(){
|
||||
testNapi.StopReadCard();
|
||||
// console.log("zzctest Close Device ret = " + testNapi.CloseDevice());
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user