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