From 34017a09d1e8f21caac9932151294a1f38d1f364 Mon Sep 17 00:00:00 2001 From: lvyuankang <1344032923@qq.com> Date: Thu, 8 Aug 2024 18:09:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=97=A5=E5=BF=97&&=E5=95=8F=E9=A1=8C=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/ets/common/service/indexService.ts | 19 +++++++---- .../ets/common/service/terminalService.ts | 4 +-- .../main/ets/common/service/videoService.ts | 7 ++-- entry/src/main/ets/common/utils/GlobalUdp.ts | 2 ++ .../ets/common/utils/UdpClientByCenter.ts | 34 +++++++++---------- .../src/main/ets/entryability/EntryAbility.ts | 4 +-- entry/src/main/ets/pages/CarCheck.ets | 11 ++++++ entry/src/main/ets/pages/Index.ets | 4 +-- entry/src/main/ets/pages/Judge.ets | 15 +++++++- entry/src/main/ets/pages/TerminalInfos.ets | 2 +- entry/src/main/ets/pages/UserInfo.ets | 2 +- .../ets/pages/compontents/SignDisplayCom.ets | 4 ++- .../src/main/ets/pages/judgeSDK/api/index.ts | 3 ++ .../ets/pages/judgeSDK/utils/judgeConfig.ts | 2 +- 14 files changed, 75 insertions(+), 38 deletions(-) diff --git a/entry/src/main/ets/common/service/indexService.ts b/entry/src/main/ets/common/service/indexService.ts index dbb41914..b827041c 100644 --- a/entry/src/main/ets/common/service/indexService.ts +++ b/entry/src/main/ets/common/service/indexService.ts @@ -225,25 +225,30 @@ export async function takePhotoFn(context) { // param[key] = false } for (let i = 0; i <= arr.length - 1; i++) { - let key = arr[i] - if (param[key]) { + let key1 = arr[i] + if (param[key1]) { param.pztd = param[`td${Number(i) + 1}`] - takePhoto(param, context, 'jt/', 0, (data) => { + takePhoto(param, context, 'jt/', 0, (data) => { + consoele.log('getPhtogetPhto',data) if (Number(data.fileSize) <= (Number(param.zdyz) * 1000)) { - map[key] = true + console.log('getPhtot0000') + + map[key1] = true promptAction.showToast({ message: `视频遮挡`, duration: 3000 }); - globalThis.spzd[key] = true + globalThis.spzd[key1] = true } else { - map[key] = false - globalThis.spzd[key] = false + map[key1] = false + globalThis.spzd[key1] = false } + console.log('getPhtot0000') setTimeout(() => { takePhotoFn() }, 3000) }) + } } globalThis.takePhotoNum++ diff --git a/entry/src/main/ets/common/service/terminalService.ts b/entry/src/main/ets/common/service/terminalService.ts index e05ddfe3..c9826ca9 100644 --- a/entry/src/main/ets/common/service/terminalService.ts +++ b/entry/src/main/ets/common/service/terminalService.ts @@ -9,11 +9,11 @@ import FileUtil from '../../common/utils/File' //获取设备信息 export async function getDeviceInfo(context) { // globalThis.deviceNo = '153216400880'; //科目三设备 - globalThis.deviceNo = '150667400235'; //科目三设备 + // globalThis.deviceNo = '150667400235'; //科目三设备 + // globalThis.deviceNo = '1649018001275'; //洛阳科目三设备 // globalThis.deviceNo = 'MAC-36E6575F'; //杭州科目二设备 489 // globalThis.deviceNo = 'MAC-C57C8966'; //杭州科目二设备 - return return new Promise(async (resolve, reject) => { const fileUtil = new FileUtil(context) const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/deviceNo.txt'); diff --git a/entry/src/main/ets/common/service/videoService.ts b/entry/src/main/ets/common/service/videoService.ts index 8f4b7b7f..caa3e4ca 100644 --- a/entry/src/main/ets/common/service/videoService.ts +++ b/entry/src/main/ets/common/service/videoService.ts @@ -80,6 +80,7 @@ interface takePhotoParam { name?:string, base64?:string, fileSize?:number, + errorCode?:number } /** * @@ -106,15 +107,15 @@ export async function takePhoto(param, context,dir,flag=1,callback?) { if(flag==0){ rtsp_server.detectVideoSnapshotSize(video_uri,fileName,(err,snapResult)=>{ console.log("baohaowen_detectLoop round end size1:"+snapResult.fileSize); - callback({fileSize:snapResult.fileSize }) + callback({fileSize:snapResult.fileSize,errorCode:snapResult.errorCode }) }); } else{ return new Promise((resolve,reject)=>{ rtsp_server.getVideoSnapshot(context, video_uri, fileName,dir,true,(err,snapResult)=>{ - console.log('getPhtot') - resolve({base64: snapResult.dataString,name:snapResult.fileName,fileSize:snapResult.fileSize }) + console.log('getPhtot',JSON.stringify(snapResult)) + resolve({base64: snapResult.dataString,name:snapResult.fileName,fileSize:snapResult.fileSize,errorCode:snapResult.errorCode }) }); }) console.log('getmyLog02') diff --git a/entry/src/main/ets/common/utils/GlobalUdp.ts b/entry/src/main/ets/common/utils/GlobalUdp.ts index c2456651..0370a16a 100644 --- a/entry/src/main/ets/common/utils/GlobalUdp.ts +++ b/entry/src/main/ets/common/utils/GlobalUdp.ts @@ -43,6 +43,7 @@ export async function getUDP(errorFlag?) { globalThis.udpClient = udpClient globalThis.udpClient.onMessage_1(()=>{ + console.log('getUDPonMessage_1msgmsgByGloalUdp') }) globalThis.udpClient.onError_Callback(()=>{ @@ -171,6 +172,7 @@ export async function setJudgeUdp() { await udpClientbyCenter.bindUdp() await udpClientbyCenter.onMessage_1((val) => { console.log('valval', val) + }) // globalThis.judgeUdpClient = udpClientbyCenter; return { diff --git a/entry/src/main/ets/common/utils/UdpClientByCenter.ts b/entry/src/main/ets/common/utils/UdpClientByCenter.ts index a65fd832..cb4667b3 100644 --- a/entry/src/main/ets/common/utils/UdpClientByCenter.ts +++ b/entry/src/main/ets/common/utils/UdpClientByCenter.ts @@ -73,11 +73,11 @@ export default class UdpClientByCenter { promise.then(() => { // globalThis.closeHeartSocket=false this.isWorking = true - console.log(`${TAG} udp bind success`); + console.log(`${TAG} getUDPudp rebind success`); }).catch(err => { //globalThis.closeHeartSocket=true this.isWorking = false - console.log(`${TAG} udp bind failed:${JSON.stringify(err)}`); + console.log(`${TAG} getUDPudp rebind failed:${JSON.stringify(err)}`); }); } @@ -87,10 +87,10 @@ export default class UdpClientByCenter { }); promise.then(() => { this.isWorking = true - console.log(`${TAG} udp bind success`); + console.log(`${TAG} getUDPudp bind success`); }).catch(err => { this.isWorking = false - console.log(`${TAG} udp bind failed:${JSON.stringify(err)}`); + console.log(`${TAG} getUDPudp bind failed:${JSON.stringify(err)}`); }); } @@ -147,9 +147,9 @@ export default class UdpClientByCenter { } sendHeadMsg(msgData) { - console.log('sendHeadMsg enter') + console.log('getUDPsendHeadMsg enter') this.sendMsg(msgData, null) - console.log('sendHeadMsg exit') + console.log('getUDPsendHeadMsg exit') } sendMsg(msg, sendCallback?) { @@ -172,12 +172,12 @@ export default class UdpClientByCenter { if (sendCallback) { sendCallback() } - console.log(`${TAG}udpCLient udp send success:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`); + console.log(`${TAG}getUDPudpCLient udp send success:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`); }).catch(err => { - console.log(`${TAG}udpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`); + console.log(`${TAG}getUDPudpCLient udp send fail:oppositeIp${this.oppositeIp},oppositeIpPort:${this.oppositeIpPort},localIp:${this.localIp},localIpPort,${this.localIpPort}`); }); } - console.log('getState success:' + JSON.stringify(data)); + console.log('getUDPgetState success:' + JSON.stringify(data)); }) } @@ -194,7 +194,7 @@ export default class UdpClientByCenter { onError_Callback(callback?) { this.udp.on('error', async err => { this.isWorking = false; - console.log('UdpClientByCenter onError err:' + JSON.stringify(err)); + console.log('getUDPUdpClientByCenter onError err:' + JSON.stringify(err)); callback && callback() }); } @@ -202,7 +202,7 @@ export default class UdpClientByCenter { onError_resend(callback?) { this.udp.on('error', async err => { this.isWorking = false; - console.log(TAG, 'udpError', JSON.stringify(err)) + console.log(TAG, 'getUDPudpError', JSON.stringify(err)) await this.bindUdp() await this.sendMsg('111', null) await this.onMessage_1(callback) @@ -243,16 +243,16 @@ export default class UdpClientByCenter { } closeUdp(callback?) { - console.log('UdpClientByCenter enter closeUdp ip:' + this.localIp + ' port:' + this.localIpPort); + console.log('getUDPUdpClientByCenter enter closeUdp ip:' + this.localIp + ' port:' + this.localIpPort); this.udp.close(err => { if (err) { - console.log('UdpClientByCenter closeUdp failed ip:' + this.localIp + ' port:' + this.localIpPort + ' err:' + JSON.stringify(err)); + console.log('getUDPUdpClientByCenter closeUdp failed ip:' + this.localIp + ' port:' + this.localIpPort + ' err:' + JSON.stringify(err)); } else { this.isWorking = false if (callback != null) { callback() } - console.log('UdpClientByCenter closeUdp succeed ip:' + this.localIp + ' port:' + this.localIpPort); + console.log('getUDPUdpClientByCenter closeUdp succeed ip:' + this.localIp + ' port:' + this.localIpPort); } }) } @@ -264,9 +264,9 @@ export default class UdpClientByCenter { } closeMessage_1(){ - console.info('surenjun', '关闭udp message监听事件') + console.info('surenjun', 'getUDP关闭udp message监听事件') this.udp.off('message',this.message_1Fn); - console.info('surenjun', '关闭udp message监听事件 成功') + console.info('surenjun', 'getUDP关闭udp message监听事件 成功') } message_1Fn = (value)=>{ @@ -291,7 +291,7 @@ export default class UdpClientByCenter { } console.log(`${TAG} udp222 on message array buffer:${str}`); - strachArr[28] = globalThis.chuankoMsg || '0' + strachArr[28] = globalThis.chuankoMsg || strachArr[28] // this.stashFn(str) const newArr = JSON.parse(JSON.stringify(strachArr)) // this.stashFn=()=>{} diff --git a/entry/src/main/ets/entryability/EntryAbility.ts b/entry/src/main/ets/entryability/EntryAbility.ts index a85e910d..983a375a 100644 --- a/entry/src/main/ets/entryability/EntryAbility.ts +++ b/entry/src/main/ets/entryability/EntryAbility.ts @@ -28,8 +28,8 @@ export default class EntryAbility extends UIAbility { globalThis.examinerInfo = {} globalThis.deviceNo = ''; globalThis.hasAuth = false - globalThis.version = '2024.11.22.14' - globalThis.judgeVersion = '2024.11.22.14' + globalThis.version = '2022.08.13.01' + globalThis.judgeVersion = '2022.12.05.1' globalThis.videoVersion= '1.0' // globalThis.version = '2023.12.13.01' // globalThis.judgeVersion = '2023.09.30.1' diff --git a/entry/src/main/ets/pages/CarCheck.ets b/entry/src/main/ets/pages/CarCheck.ets index 71be5f8e..33a2a7e0 100644 --- a/entry/src/main/ets/pages/CarCheck.ets +++ b/entry/src/main/ets/pages/CarCheck.ets @@ -103,6 +103,9 @@ export default struct Index { router.pushUrl({ url: 'pages/SignDisplay', }, router.RouterMode.Single); + this.stachValue = JSON.parse(JSON.stringify(StackValueData)) + this.warnFlag = JSON.parse(JSON.stringify(WarnFlagData)) + this.passArray = JSON.parse(JSON.stringify(PassData)) // clearInterval(this.interval) } @@ -157,6 +160,9 @@ export default struct Index { this.warnFlag = WarnFlagData this.passArray = PassData this.checkListCopy = JSON.parse(JSON.stringify(this.checkList)) + this.stachValue = JSON.parse(JSON.stringify(StackValueData)) + this.warnFlag = JSON.parse(JSON.stringify(WarnFlagData)) + this.passArray = JSON.parse(JSON.stringify(PassData)) this.index = this.checkListCopy[0].key this.vocObj.playAudio({ type: 1, @@ -167,6 +173,8 @@ export default struct Index { getPLCInfo() { const that = this globalThis.udpClient.onMessage_1 && globalThis.udpClient.onMessage_1((msg) => { + console.log('getUDPonMessage_1byCarCheck2') + if (!this.breakFlag) { return } @@ -309,6 +317,9 @@ export default struct Index { outClick() { this.vocObj && this.vocObj.releasePlayer() this.breakFlag = false + this.stachValue = JSON.parse(JSON.stringify(StackValueData)) + this.warnFlag = JSON.parse(JSON.stringify(WarnFlagData)) + this.passArray = JSON.parse(JSON.stringify(PassData)) // clearInterval(this.interval) } diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index 3f759d11..571792a7 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -11,7 +11,7 @@ import FileUtil from '../common/utils/File'; import { getUDP, getUDP2 } from '../common/utils/GlobalUdp'; import { initJudgeUdp } from '../common/utils/UdpJudge'; import { getTCP } from '../common/utils/GlobalTcp'; -import { getliushuiNum, setliushuiNum } from '../common/service/indexService'; +import { getliushuiNum, setliushuiNum,takePhotoFn } from '../common/service/indexService'; import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl'; import worker, { MessageEvents } from '@ohos.worker'; import promptAction from '@ohos.promptAction' @@ -285,7 +285,6 @@ struct Index { this.heartMsg() } }, 1000) - // takePhotoFn(this.context) // getTCP() @@ -337,6 +336,7 @@ struct Index { async initParams() { this.loading = false + takePhotoFn(this.context) this.deviceId=await getDeviceInfo(this.context) || '' await getCarInfo() await setCurrentTime(); diff --git a/entry/src/main/ets/pages/Judge.ets b/entry/src/main/ets/pages/Judge.ets index 6d56ea34..8c01d416 100644 --- a/entry/src/main/ets/pages/Judge.ets +++ b/entry/src/main/ets/pages/Judge.ets @@ -49,15 +49,22 @@ struct Index { this.time = await getCurrentTime(); this.examTime += 1; }, 1000); + console.log('SURENJUN_JUDGE',10) //初始化数据库表 await this.initDb() //断点续考 + console.log('SURENJUN_JUDGE',11) + await this.goDdxkItems() //初始化评判 + console.log('SURENJUN_JUDGE',6) + const judge = await this.initJudge(); + console.log('SURENJUN_JUDGE',7) + this.judge = judge } @@ -69,7 +76,6 @@ struct Index { const {isTrajectoryOpen,trajectoryPath} = judgeConfig await this.initStudent(); await this.initCar(); - //是否开启轨迹回放模式 if (isTrajectoryOpen) { this.initTrajectoryParam(trajectoryPath) @@ -79,12 +85,16 @@ struct Index { await this.initSysset(); this.singlePlay = globalThis.singlePlay } + await this.initCDSBInfo() // 科目三新增读取表数据 if (examSubject == 3) { + await this.initMapPoint() + await this.initMapPointItem() + //定时上传考试里程 // let mileageTimer = setInterval(()=>{ // this.uploadMileage() @@ -331,7 +341,10 @@ struct Index { // 评判相关初始化 async initJudge() { + console.log('SURENJUN_JUDGE',0) + const judge = new Judge(this); + console.log('SURENJUN_JUDGE',30) await judge.onJudgeFn(async (judgeData) => { const {xmmcStr,carztStr,kfArr} = judgeData; this.xmmcStr = xmmcStr; diff --git a/entry/src/main/ets/pages/TerminalInfos.ets b/entry/src/main/ets/pages/TerminalInfos.ets index 88738196..dcf04b53 100644 --- a/entry/src/main/ets/pages/TerminalInfos.ets +++ b/entry/src/main/ets/pages/TerminalInfos.ets @@ -19,7 +19,7 @@ struct Index { // @State inputTextList2: string[] = ['192.168.7.124','20022'] // @State inputTextList1: string[] = ['172.37.55.191','18782','192.168.7.1','8082','255.255.255.0','192.168.7.170','114.114.114.114','192.168.7.124','20022','172.37.55.59','20122'] - @State inputTextList1: string[] = ['172.37.55.191','18782','172.37.55.191','8082','255.255.255.0','192.168.7.1','114.114.114.114','192.168.7.124','20022','192.168.7.170','20122'] + @State inputTextList1: string[] = ['192.168.1.144','18782','192.168.1.144','8082','255.255.255.0','192.168.7.1','114.114.114.114','192.168.7.124','20022','192.168.7.170','20122'] // @State inputTextList2: string[] = [] // 112.80.35.83 11052 // @State inputTextList1: string[] = ['192.168.36.2','8084','192.168.36.200','20122','255.255.255.0','192.168.36.1','','','114.114.114.114','192.168.36.139','8000'] diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index 574ba0b2..bd3c646e 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -311,7 +311,7 @@ struct UserInfo { that.ksxtbh = ksxtbhArr?.[0]?.v_value || '222' const studentRefreshParam = syssetParams.filter(sys => sys.v_no === '452') that.studentRefreshStatue = studentRefreshParam?.[0]?.v_value || '0' - const faceParam = syssetParams.filter(sys => sys.v_no === '2313') + const faceParam = syssetParams.filter(sys => sys.v_no === '2413') that.FaceOpenStatue = faceParam?.[0]?.v_value == '3' ? '1' : '0' that.FaceOpenStatue = '0' console.log('that.FaceOpenStatue', that.FaceOpenStatue) diff --git a/entry/src/main/ets/pages/compontents/SignDisplayCom.ets b/entry/src/main/ets/pages/compontents/SignDisplayCom.ets index b1a3ea80..71a8d6fe 100644 --- a/entry/src/main/ets/pages/compontents/SignDisplayCom.ets +++ b/entry/src/main/ets/pages/compontents/SignDisplayCom.ets @@ -329,7 +329,7 @@ export default struct SignDisplayCom { if (showBack) { this.ratio = 1.4 globalThis.udpClient.onMessage_1((msg) => { - console.log('msgmsg', msg) + console.log('getUDPonMessage_1bysignDisplay0', msg) if (msg) { getSignal(msg) } @@ -354,6 +354,8 @@ export default struct SignDisplayCom { const showBack = this.showBack; if (showBack) { globalThis.udpClient.onMessage_1((msg) => { + console.log('getUDPonMessage_1bysignDisplay2', msg) + getSignal(msg) }) } else { diff --git a/entry/src/main/ets/pages/judgeSDK/api/index.ts b/entry/src/main/ets/pages/judgeSDK/api/index.ts index 1130ab6d..bcaf889b 100644 --- a/entry/src/main/ets/pages/judgeSDK/api/index.ts +++ b/entry/src/main/ets/pages/judgeSDK/api/index.ts @@ -25,7 +25,10 @@ export async function examJudgeVersion(){ * @desc 设置评判日志级别和日志回调函数 */ export async function examJudgeSetLogCallback(level:number,handleLog:Function):Promise{ + console.log('SURENJUN_JUDGESDK',0) const temp = libJudgeSdk.examJudgeSetLogCallback(level,handleLog); + console.log('SURENJUN_JUDGESDK',1) + return await handle(temp,'examJudgeSetLogCallback') } diff --git a/entry/src/main/ets/pages/judgeSDK/utils/judgeConfig.ts b/entry/src/main/ets/pages/judgeSDK/utils/judgeConfig.ts index 8928e239..a25399cf 100644 --- a/entry/src/main/ets/pages/judgeSDK/utils/judgeConfig.ts +++ b/entry/src/main/ets/pages/judgeSDK/utils/judgeConfig.ts @@ -2,7 +2,7 @@ //考试回放开关 export const judgeConfig = { //本地目录开关 - isTrajectoryOpen: true, + isTrajectoryOpen: false, //是否开启拍照 isPhotoOpen: false, //扣分语音是否强制开启 -- 2.43.0.windows.1