From 415f8c7fcbfb43b564946e56e7c775d06ef2e8b3 Mon Sep 17 00:00:00 2001 From: wangzhongjie Date: Mon, 22 Sep 2025 13:07:32 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E6=8F=90=E4=BA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/api/judge.ts | 11 +-- .../main/ets/common/service/indexService.ts | 6 +- entry/src/main/ets/common/service/initable.ts | 5 +- .../main/ets/common/service/videoService.ts | 57 +++++++++++++-- entry/src/main/ets/common/utils/aioTool.ts | 1 + .../src/main/ets/common/utils/tempRequest.ts | 8 +-- entry/src/main/ets/pages/CarCheck.ets | 1 + entry/src/main/ets/pages/Index.ets | 21 +++--- entry/src/main/ets/pages/Judge.ets | 23 ++++-- entry/src/main/ets/pages/UserInfo.ets | 49 +++++++++++-- .../ets/pages/compontents/FaceCompare.ets | 4 +- .../ets/pages/compontents/SignDisplayCom.ets | 12 ++-- entry/src/main/ets/pages/judgeSDK/judge.ts | 70 ++++++++++++------- .../ets/pages/judgeSDK/utils/fileModel.ts | 2 +- 14 files changed, 191 insertions(+), 79 deletions(-) diff --git a/entry/src/main/ets/api/judge.ts b/entry/src/main/ets/api/judge.ts index 41b655ba..22f74789 100644 --- a/entry/src/main/ets/api/judge.ts +++ b/entry/src/main/ets/api/judge.ts @@ -30,13 +30,13 @@ export async function writeObjectOut(params, filePath?: string): Promise { if (singlePlay) { return { code: 1 } } - console.log('testsqlTag0') + console.log('daihaimm testsqlTag0') //获取监管接口地址路径 if (!globalThis.JGPATH) { - console.log('testsqlTag1') + console.log('daihaimm testsqlTag1') const syssetParams = await getSyncData('MA_SYSSET') || []; - console.log('testsqlTag2') + console.log('daihaimm testsqlTag2') //@ts-ignore syssetParams.forEach(sys => { @@ -50,10 +50,11 @@ export async function writeObjectOut(params, filePath?: string): Promise { }) } const {xtlb,jkxlh,jkid,drvexam} = params; - console.log('testsqlTag3') + console.log('daihaimm testsqlTag3') //新监管调用 if (globalThis.isJGNew) { + console.log('daihaimm testsqlTag4') return await writeObjectOutNew(params, filePath) } @@ -64,7 +65,7 @@ export async function writeObjectOut(params, filePath?: string): Promise { .map((key: string) => ( `<${key}>${drvexam[key]}`)); - console.log('surenjun filePath=>', filePath); + console.log('daihaimm surenjun filePath=>', filePath); if (filePath) { const fileUtil = new FileUtil(globalThis.context); await fileUtil.initFolder(filePath); diff --git a/entry/src/main/ets/common/service/indexService.ts b/entry/src/main/ets/common/service/indexService.ts index 63ef3b11..0272a4c4 100644 --- a/entry/src/main/ets/common/service/indexService.ts +++ b/entry/src/main/ets/common/service/indexService.ts @@ -295,9 +295,7 @@ async function openChuankouFn() { let ret = await testNapi.SerialSet(fd, 115200, 0, 8, 1, 0) console.log('daihairet', ret) } - let readSerials = true - async function getChuankouFnMsg() { if (!readSerials) { return @@ -315,7 +313,7 @@ async function getChuankouFnMsg() { readSerials = true console.log('daihai', revTestInfo?.recevedBuf?.toString()) const message = revTestInfo?.recevedBuf?.toString() - console.log("chuankou xinxi", message) + console.log("chuankou xinxi",message) if (message == '') { return } @@ -327,7 +325,7 @@ async function getChuankouFnMsg() { return } console.log("chuankou xinxi 档位", msg[9]) - if (msg[9] == 0 || msg[9] == 1 || msg[9] == 2 || msg[9] == 3 || msg[9] == 4 || msg[9] == 5) { + if(msg[9]==0||msg[9]==1||msg[9]==2||msg[9]==3||msg[9]==4||msg[9]==5){ console.log("chuankou xinxi 111 message", message) globalThis.chuankoMsg = msg[9] console.log("chuankou xinxi 111 档位", msg[9]) diff --git a/entry/src/main/ets/common/service/initable.ts b/entry/src/main/ets/common/service/initable.ts index def04b15..c2697691 100644 --- a/entry/src/main/ets/common/service/initable.ts +++ b/entry/src/main/ets/common/service/initable.ts @@ -97,7 +97,8 @@ export function sqlInsertCommonFn(tableName, resultArr, delFlag = true) { return new Promise((resolve, reject) => { DB.clearTable(tableName).then((res) => { if(!resultArr?.length){ - return + console.log('daihaimm sqlInsertCommonFn []') + resolve(true) } let INSERT_SQL = "INSERT INTO " + tableName + " (" + map[tableName].ACCOUNT_TABLE.columns.toString() + ") VALUES " @@ -191,6 +192,7 @@ export async function getDataBaseTable(params, reqParam) { message: 'paraKdid获取失败', duration: 3000 }); + reject() return } const str = { "head": { "time": dateFormat(date) }, @@ -270,6 +272,7 @@ export async function getMySystemSetTable(params, reqParam) { message: 'paraKdid获取失败', duration: 3000 }); + reject() return } const str = { "head": { "time": dateFormat(date) }, diff --git a/entry/src/main/ets/common/service/videoService.ts b/entry/src/main/ets/common/service/videoService.ts index a813956b..44ce9ca1 100644 --- a/entry/src/main/ets/common/service/videoService.ts +++ b/entry/src/main/ets/common/service/videoService.ts @@ -1,4 +1,5 @@ import mediaLibrary from '@ohos.multimedia.mediaLibrary' +// @ts-ignore import onvifclient from '@ohos.onvifclient'; import fs from '@ohos.file.fs' @@ -6,6 +7,7 @@ import fs from '@ohos.file.fs' import photoAccessHelper from '@ohos.file.photoAccessHelper' import dataSharePredicates from '@ohos.data.dataSharePredicates' import { dateFormat, getCurrentTime } from '../utils/tools' +// @ts-ignore import record from '@ohos.rtsprecord'; // import record from '@ohos.rtsprecord'; import { FileHelper } from './FileHelper'; @@ -33,6 +35,44 @@ const FILE_ASSET_FETCH_COLUMNS = [photoAccessHelper.PhotoKeys.URI, // const rtsp_server = record.createServer(); +export async function delPic(day,type) { + let phAccessHelper = photoAccessHelper.getPhotoAccessHelper(globalThis.context); + console.info('albumGetAssetsDemoCallback'); + let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates(); + let albumFetchOptions: photoAccessHelper.FetchOptions = { + fetchColumns: [], + predicates: predicates + }; + let fetchOption: photoAccessHelper.FetchOptions = { + fetchColumns: [], + predicates: predicates + }; + let albumList: photoAccessHelper.FetchResult = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC, albumFetchOptions); + let albums = await albumList.getAllObjects(); + for(let i=0;i<=albums.length;i++){ + let albumName=albums[i].albumName + // isSevenDaysAgo(albumName, day) + console.log('albumNamealbumName',albumName) + if (isSevenDaysAgo(albumName, day)&&albumName!='jt'&&albumName!='pz') { + deleteAllFileByPiC(albumName, type) + + } + } +} + +export function isSevenDaysAgo(date,days=2) { + const today = new Date(); // 当前日期 + const target = new Date(date); // 需要判断的日期 + console.info("listFile succeed1",JSON.stringify(target)); + + const diff = today.getTime() - target.getTime(); // 计算两个日期之间的毫秒数差异 + const diffDays = diff / (1000 * 60 * 60 * 24); // 将毫秒转换为天数 + console.info("listFile succeed2",JSON.stringify(diffDays)); + // 如果差异天数正好是2,则原日期是当前日期的前2天 + console.log('diffDays',diffDays,days) + return diffDays >= (Number(days) ); +} + export async function saveStartRecordVideo(path) { return new Promise(async (reslove, reject) => { const fileUtil = new FileUtil(globalThis.context) @@ -169,21 +209,28 @@ export async function takePhoto(param, context, dir, flag = 1, callback?) { // }); } else { return new Promise((resolve, reject) => { + console.log('daihaimmm getVideoSnapshot start: ') + // @ts-ignore rtsp_server.getVideoSnapshot(context, video_uri, fileName, dir, true, (err, snapResult) => { - console.log('getPhtot') - resolve({ base64: snapResult.dataString, name: snapResult.fileName, fileSize: snapResult.fileSize }) + if (err) { + console.log('daihaimmm getVideoSnapshot err: ' + JSON.stringify(err)) + reject(err) + } else { + console.log('daihaimmm getPhtot') + resolve({ base64: snapResult.dataString, name: snapResult.fileName, fileSize: snapResult.fileSize }) + } }); }) console.log('getmyLog02') } - console.log('getmyLog03') + console.log('daihaimmm getmyLog03') } -export async function deleteAllFileByPiC(dirName) { +export async function deleteAllFileByPiC(dirName, type=1) { // const fileHelper = new FileHelper(); - fileHelper.deleteFileOfAlbum(dirName, 1); + fileHelper.deleteFileOfAlbum(dirName, type); } export async function deleteAllVideos(context, type: photoAccessHelper.AlbumType, subType: photoAccessHelper.AlbumSubtype): Promise { diff --git a/entry/src/main/ets/common/utils/aioTool.ts b/entry/src/main/ets/common/utils/aioTool.ts index 0f777c10..3d4cb411 100644 --- a/entry/src/main/ets/common/utils/aioTool.ts +++ b/entry/src/main/ets/common/utils/aioTool.ts @@ -1,3 +1,4 @@ +// @ts-ignore import HiSerialSDK from '@ohos.hiserialsdk'; // 打开串口工具 diff --git a/entry/src/main/ets/common/utils/tempRequest.ts b/entry/src/main/ets/common/utils/tempRequest.ts index 3b474a01..aca01882 100644 --- a/entry/src/main/ets/common/utils/tempRequest.ts +++ b/entry/src/main/ets/common/utils/tempRequest.ts @@ -122,9 +122,7 @@ export default async function tempRequest(req: any): Promise { reject({ code: e.code }) - } finally { - httpRequest.destroy(); - console.log('httpRequest destroy finally') + } }) @@ -164,12 +162,12 @@ async function xmlToJson(result, url) { if (result.length > 10000) { setTimeout(() => { let res = deeml(xmlArr); - console.log("xmlToJson end", JSON.stringify(res)); + console.log("xmlToJson end",JSON.stringify(res) ); resolve(res) }, 10000) } else { let res = deeml(xmlArr); - console.log("xmlToJson end", JSON.stringify(res)); + console.log("xmlToJson end",JSON.stringify(res) ); resolve(res) } diff --git a/entry/src/main/ets/pages/CarCheck.ets b/entry/src/main/ets/pages/CarCheck.ets index b6bca6c5..40703f67 100644 --- a/entry/src/main/ets/pages/CarCheck.ets +++ b/entry/src/main/ets/pages/CarCheck.ets @@ -2,6 +2,7 @@ import { voiceService } from '../common/service/voiceService'; import router from '@ohos.router'; import { carConfigurationInfo, uploadExamCarCheckResult } from '../api/checkCar'; import TopLogo from './compontents/TopLogo'; +// @ts-ignore import testNapi from '@ohos.hiserialsdk'; import { dateFormat } from '../common/utils/tools'; import { DwMapData, PassData, RealNumData, StackValueData, WarnFlagData, WarnFlagTipData } from '../mock'; diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index fd869614..09ef993e 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -16,9 +16,10 @@ import promptAction from '@ohos.promptAction'; import errorMsgDialog from './compontents/errorMsgDialog'; import GetDistance from '../common/utils/GetDistance'; import UdpEvent from '../common/utils/UdpEvent'; +import { delPic } from '../common/service/videoService'; import imageBtn from './compontents/imageBtn'; import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; -// import {updateModelAndCar} from '../common/autoUpdate/index' +import {updateModelAndCar} from '../common/autoUpdate/index' // import {uploadLogFile} from '../common/service/indexService' import { getModalValueCdAndCar } from '../api'; @@ -44,7 +45,7 @@ struct Index { @State fd: number = -1; @State num: number = 0; //模型是否下载 - @State isModelInit: boolean = true; + @State isModelInit: boolean = false; fileHelper = null; errorDialog: CustomDialogController = new CustomDialogController({ builder: errorMsgDialog({ @@ -341,7 +342,7 @@ struct Index { .width(80 * globalThis.ratio) .height(80 * globalThis.ratio) .position({ x: 288 * globalThis.ratio, y: 89 * globalThis.ratio }) - Text(this.loadingText || '获取考车信息,请稍候……') + Text(this.loadingText ||'获取考车信息,请稍候……') .fontSize(24 * globalThis.ratio) .margin({ top: 20 * globalThis.ratio }) .fontWeight(400) @@ -399,6 +400,8 @@ struct Index { console.log('syssyssyssys') // this.delLoading=true // globalThis.param854Str=sys.v_value + delPic(Number(sys.v_value), 1) + delPic(Number(sys.v_value), 2) // this.delLoading=false } @@ -435,9 +438,9 @@ struct Index { this.loading = true console.log("sql 1111") - getSingleCenterTable(param).then(async (ret: any) => { + getSingleCenterTable(param).then(async (ret:any) => { - if (!this.isModelInit) { + if(!this.isModelInit){ this.loading = true this.loadingText = '正在下载考车模型,请稍候……' // await updateModelAndCar(false) @@ -446,7 +449,7 @@ struct Index { this.isModelInit = true } - if (typeof ret == 'object' && ret.resultCode == '3') { + if(typeof ret == 'object' && ret.resultCode == '3'){ this.loadingText = '正在下载考车最新版本,请稍候……' this.loading = true // await updateModelAndCar(true) @@ -466,7 +469,7 @@ struct Index { if (globalThis.singlePlay) { router.pushUrl({ url: 'pages/userInfo' - }, router.RouterMode.Single) + },router.RouterMode.Single) return } if (globalThis.singlePlay) { @@ -641,14 +644,12 @@ struct Index { // deleteAllFIleLog(GlobalConfig.comoonfileWriteAddress + '/PLC/') //设置plc udp 同步requesthost await getUDP(this.context, false) - getTCP() - this.loading = false await getDeviceInfo(this.context) await getCarInfo() await getUDP2(this.context, false) - console.log('socket1111') + getTCP() this.deviceId = globalThis.carInfo.carNo await setCurrentTime(); if (!globalThis.distanceClass) { diff --git a/entry/src/main/ets/pages/Judge.ets b/entry/src/main/ets/pages/Judge.ets index f1b1bd53..3276b06a 100644 --- a/entry/src/main/ets/pages/Judge.ets +++ b/entry/src/main/ets/pages/Judge.ets @@ -38,13 +38,21 @@ import { getChuankouFn } from '../common/service/indexService'; @Entry @Component struct Index { + timerchuankou: number = undefined + timer: number = undefined + mileageTimer: number = undefined; + async aboutToDisappear() { + console.log('daihaimm1111 Judge aboutToDisappear') clearInterval(this.mileageTimer) + clearInterval(this.timer) + clearInterval(this.timerchuankou) + this.judge = null } async aboutToAppear() { getChuankouFn() - setInterval(() => { + this.timerchuankou = setInterval(() => { console.log("chuankou 定时器2") getChuankouFn() }, 1000) @@ -57,7 +65,7 @@ struct Index { this.startExamTime = time - setInterval(async () => { + this.timer = setInterval(async () => { this.time = await getCurrentTime(); this.examTime += 1; }, 1000); @@ -144,6 +152,11 @@ struct Index { const markRuleParams = markRules || (await getSyncData('MA_MARKRULE') as MarkRule[]) markRuleParams.forEach(mark => { + console.log("markrile item mark.onlyoneid: ", mark.onlyoneid); + console.log("markrile item mark.nocancelid: ", mark.nocancelid); + + console.log("markrile item mark.onlyoneid Number: ", Number(mark.onlyoneid)); + console.log("markrile item mark.nocancelid Number: ", Number(mark.nocancelid)); const tempObj = { itemno: mark.itemno * 1, markcatalog: mark.markcatalog, @@ -151,8 +164,8 @@ struct Index { markreal: mark.markreal * 1, markserial: mark.markserial, kfxh: mark.kfxh, - OnlyOneKind: mark.onlyoneid * 1, - NoCancelId: mark.nocancelid * 1, + OnlyOneKind: !isNaN(Number(mark.onlyoneid)) ? Number(mark.onlyoneid) : 0, + NoCancelId: !isNaN(Number(mark.nocancelid)) ? Number(mark.nocancelid) : 0, GPS_SID: mark.gps_sid == 0 ? false : true } @@ -1384,7 +1397,6 @@ struct Index { @State markRuleListObj: MarkRule = {} @State cdsbInfoObj: CDSBInfo = {} @State itemInfoObj: CDSBInfo = {} - @State timer: number = 0 @State judgeConfig: { [k: string]: string }[] = [] @State judgeConfigObj: { [k: string]: any } = defaultJudgeConfigObj //流水号 @@ -1446,7 +1458,6 @@ struct Index { @State dw: string = '' //速度 @State sd: string = '' - @State mileageTimer: number = 0; @State passingScore: number = 80 @State dwztErrorVisible: boolean = false; @State popTimer: number = 0; diff --git a/entry/src/main/ets/pages/UserInfo.ets b/entry/src/main/ets/pages/UserInfo.ets index 4c96617a..f7840db6 100644 --- a/entry/src/main/ets/pages/UserInfo.ets +++ b/entry/src/main/ets/pages/UserInfo.ets @@ -8,6 +8,7 @@ import { dateFormat, getCurrentHourTime, getCurrentTime, string2Bytes } from '.. import FaceCompare from './compontents/FaceCompare'; // import { initJudgeUdp } from '../common/utils/UdpJudge' import { writeObjectOut } from '../api/judge'; +// @ts-ignore import testNapi from '@ohos.idcard'; import common from '@ohos.app.ability.common'; import { User } from './interfaces'; @@ -192,6 +193,7 @@ struct UserInfo { } async onPageShow() { + console.log('daihai userinfo onPageShow') this.isExamStart = false this.startExam = false this.updateTimeLimit = false @@ -205,7 +207,7 @@ struct UserInfo { //身份证读卡器初始化 // this.openDeviceByIDCard() const routerParam = router.getParams() || { type: 0 }; - console.log('routerParam', JSON.stringify(routerParam)) + console.log('daihaim routerParam', JSON.stringify(routerParam)) initJudgeUdp() if (!globalThis.singlePlay) { // @ts-ignore @@ -215,8 +217,8 @@ struct UserInfo { this.list = await getSyncData('USERLIST') // @ts-ignore const data = await getSyncData('USER') - console.log('surenjun useruser=>,', JSON.stringify(this.list)) - console.log('surenjun useruser1=>,', JSON.stringify(data)) + console.log('daihaim surenjun this.list=>,', JSON.stringify(this.list)) + console.log('daihaim surenjun useruser1=>,', JSON.stringify(data)) const user = data[0] if(!Number(user.kssycs)){ @@ -224,22 +226,35 @@ struct UserInfo { return res.sfzmhm != user.sfzmhm }) } + console.log('daihaim 111,') + this.pageIndex = 0 this.dataList = this.list.slice(this.pageIndex * 4, this.pageIndex * 4 + 4) + console.log('daihaim 222 this.dataList length,' + this.dataList.length) + + if (this.dataList.length) { + console.log('daihaim 222 this.dataList,' +JSON.stringify(this.dataList)) + setTimeout(() => { this.currentUser = this.dataList[0] this.currentUser.ksy2 = globalThis.kgxm globalThis.lsh = this.currentUser.lsh }, 200) } else { + console.log('daihaim 7777,') + this.currentUser = EmptyCandidateObject globalThis.lsh = '1111111111111' + } this.list.forEach((res, index) => { res.id = index.toString() }) + console.log('daihaim 8888,' + JSON.stringify(this.list)) + await upDateTableByArray('USERLIST', this.list || []) + console.log('daihaim 999,') // if(this.) // if (user && Number(user.kssycs)) { @@ -274,9 +289,12 @@ struct UserInfo { // globalThis.lsh = '1111111111111' // } // } + this.getExaminationStudentInfoFn() } else { + console.log('daihaim surenjun routerParam.type 11111') await this.getExaminationStudentInfoFn() + } } @@ -504,6 +522,9 @@ struct UserInfo { 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') //判断自动更新 + console.log('daihaimmm syssetParams syssetParams::' + JSON.stringify(syssetParams)) + console.log('daihaimmm syssetParams studentRefreshParam::' + JSON.stringify(studentRefreshParam)) + that.studentRefreshStatue = studentRefreshParam?.[0]?.v_value || '0' const openCheckFlagParam = syssetParams.filter(sys => sys.v_no == '17') //0 const openCheckFlag = openCheckFlagParam?.[0]?.v_value == '1' ? '1' : '0' @@ -518,6 +539,7 @@ struct UserInfo { that.openDeviceByIDCard() } } + console.log('daihaimmm syssetParams len::' + syssetParams.length) // let a = await this.fileUtil.initFolder("/config/temptable") // this.fileUtil.addFile("temp.log", JSON.stringify(syssetParams)) syssetParams.forEach(sys => { @@ -592,11 +614,13 @@ struct UserInfo { }) // faceParam?.[0]?.v_value || + console.log('daihaimmmm 11111 that.studentRefreshStatue:' +that.studentRefreshStatue) //0不自动更新 1自动更新(不限次数) 2没有考生更新2次 if (that.studentRefreshStatue == '2') { if (that.list.length == 0) { + console.log('daihaimmmm 11111') clearInterval(that.interval) that.interval = setInterval(() => { if (that.numCount < 3) { @@ -611,6 +635,8 @@ struct UserInfo { } } else if (that.studentRefreshStatue == '1') { if (that.list.length == 0) { + console.log('daihaimmmm 22222') + clearInterval(that.interval) that.interval = setInterval(() => { if (that.list.length == 0) { @@ -909,9 +935,9 @@ struct UserInfo { this.isLoadingPopupVisible = true avPlayer.playAudio([`voice/监管通信中.mp3`], false, async () => { - console.info('surenjun', '播放结束开始考试接口调用') + console.info('daihaimm surenjun', '播放结束开始考试接口调用') const {code,keystr,message} = await this.beginExam() || {}; - console.info('surenjun', '开始考试接口调用结束') + console.info('daihaimm surenjun', '开始考试接口调用结束', code,keystr,message) // console.info('surenjun',code +'') //@ts-ignore TODO code转换 @@ -926,7 +952,14 @@ struct UserInfo { return } this.currentUser.id = '0' - await upDateTableByArray('USER', [this.currentUser]) + console.log('daiihaimm upDateTableByArray start this.currentUser: ' + JSON.stringify(this.currentUser)) + if (this.currentUser.sfzmhm) { + await upDateTableByArray('USER', [this.currentUser]) + } else { + console.error('daiihaimm 当前考生为空') + } + console.log('daiihaimm upDateTableByArray end') + this.stepFlag = false this.isLoadingPopupVisible = false router.pushUrl({ @@ -1093,8 +1126,10 @@ struct UserInfo { //接口标识 jkid: '17C51', } - console.info('surenjunjianguan', JSON.stringify(param)) + console.info('daihaimm surenjunjianguan', JSON.stringify(param)) const temp = await writeObjectOut(param); + console.info('daihaimm surenjunjianguan end', JSON.stringify(temp)) + globalThis.lsh = this.currentUser.lsh globalThis.ksyh = this.currentUser.ksy1sfzmhm return temp diff --git a/entry/src/main/ets/pages/compontents/FaceCompare.ets b/entry/src/main/ets/pages/compontents/FaceCompare.ets index 74835c59..99635c39 100644 --- a/entry/src/main/ets/pages/compontents/FaceCompare.ets +++ b/entry/src/main/ets/pages/compontents/FaceCompare.ets @@ -187,8 +187,8 @@ export default struct FaceCompare { this.base64 = this.imageBase64 + data.base64 faceCompare({ sfzh: this.sfzh, - secondImage: this.firstImage.substr(22), - firstImage: data.base64, + secondImage: data.base64, + firstImage: '', type: 2, verifyType: 1 }) diff --git a/entry/src/main/ets/pages/compontents/SignDisplayCom.ets b/entry/src/main/ets/pages/compontents/SignDisplayCom.ets index cb246ac2..724b0f0e 100644 --- a/entry/src/main/ets/pages/compontents/SignDisplayCom.ets +++ b/entry/src/main/ets/pages/compontents/SignDisplayCom.ets @@ -25,11 +25,10 @@ export default struct SignDisplayCom { @State interval: number = 0 @State @Watch('outClick') outFlag: boolean = false; @State url: string = '' - private timer = null private udpClient: UdpClient = null private FileLog: FileLog private vocObj = null; - + timer: number = undefined constructor() { super() } @@ -325,13 +324,14 @@ export default struct SignDisplayCom { aboutToDisappear() { // clearInterval(this.interval) + // clearInterval(this.timer) } async aboutToAppear() { - setInterval(() => { - console.log("chuankou 定时器2") - getChuankouFn() - }, 1000) + // this.timer = setInterval(() => { + // console.log("chuankou 定时器2") + // getChuankouFn() + // }, 1000) // const fileUtil = new FileUtil(globalThis.context) // const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt') // this.udplocalIp=JSON.parse(data)?.udplocalIp||'192.168.7.170' diff --git a/entry/src/main/ets/pages/judgeSDK/judge.ts b/entry/src/main/ets/pages/judgeSDK/judge.ts index 336feee0..1e9df87a 100644 --- a/entry/src/main/ets/pages/judgeSDK/judge.ts +++ b/entry/src/main/ets/pages/judgeSDK/judge.ts @@ -56,7 +56,9 @@ import { } from './api/index'; import { getSyncData, upDateTableByArray } from '../../common/service/initable'; import { GlobalConfig } from '../../config'; + const judgeTag = 'SURENJUN_JUDGE' +const endExamTag = "endExam" function ifNeedRetry(code: number | string): boolean { let arr = ["B210010", "B210023", "B210024", "B210031", "B210033", "B210034", "B210041"] @@ -65,6 +67,7 @@ function ifNeedRetry(code: number | string): boolean { } return false } + export default class Judge { // 过程照片拍照 getPhoto = async (empty?: boolean) => { @@ -320,13 +323,13 @@ export default class Judge { const tWD = convertGpsCoord2(wd) const {prevJd,prevWd} = this if (prevJd && dwzt == 4 && jdzt == 3 && !globalThis.singlePlay) { - // const distance = await examCalcGpsDistance({ - // jd1: prevJd, - // wd1: prevWd, - // jd2: tJD, - // wd2: tWD, - // h: hxj || 1, - // }) + const distance = await examCalcGpsDistance({ + jd1: prevJd, + wd1: prevWd, + jd2: tJD, + wd2: tWD, + h: hxj || 1, + }) //@ts-ignore // globalThis.distanceClass?.setTimeData(((distance / 100).toFixed(2)) * 1) } @@ -390,10 +393,10 @@ export default class Judge { //成绩不合格 if (totalScore < passingGrade) { //科目三不合格报靠边停车 - if (examSubject == 3 ) { - if( param302 == 1){ + if (examSubject == 3) { + if (param302 == 1) { avPlayer.playAudio([`voice/考试结束.mp3`]); - }else if(param302 == 0){ + } else if (param302 == 0) { return } } @@ -469,7 +472,7 @@ export default class Judge { private testKmItems: any private plcData: any //特殊扣分标记 - private specialkf:string = '' + private specialkf: string = '' // 获取plc数据 getPlcData = async (plc: string) => { const {fileLog,mndgStr,rmndg} = this; @@ -540,7 +543,7 @@ export default class Judge { // 调代理接口是否断网了 private isJudgeDisConnect: boolean; // 项目开始接口同步 - beginProject = async (ksxm,xmxh?:string) => { + beginProject = async (ksxm, xmxh?: string) => { const carInfo = globalThis.carInfo; const { examSubject,plateNo } = carInfo; const {judgeUI,fileLog,getSbbm,filePath} = this; @@ -574,7 +577,7 @@ export default class Judge { promptWxCode('17C52', code) } // 项目结束接口同步 - endProject = async (ksxm,xmxh?:string) => { + endProject = async (ksxm, xmxh?: string) => { const carInfo = globalThis.carInfo; const deviceNo = globalThis.deviceNo; const { examSubject,plateNo,carNo } = carInfo; @@ -604,7 +607,7 @@ export default class Judge { const {code} = await this.sendWriteObjectOut(data, filePath) //科三 & 432=3 - if(examSubject == 3 && this.judgeUI.judgeConfigObj['432'] == 2){ + if (examSubject == 3 && this.judgeUI.judgeConfigObj['432'] == 2) { this.judgeUI.uploadMileage() } @@ -750,12 +753,12 @@ export default class Judge { allitems = Reflect.ownKeys(itemInfoObj).map(cdsbKey => { const cdsb = itemInfoObj[cdsbKey]; const {xmdm,xmxh,modelKey} = cdsb - const modelVal= getModelData(`${modelKey}.txt`) - if(modelVal){ + const modelVal = getModelData(`${modelKey}.txt`) + if (modelVal) { return { xmdm, xmxh, model: modelVal } - }else{ + } else { return undefined } }).filter(item => item !== undefined) @@ -849,7 +852,7 @@ export default class Judge { mfxx: false, mfxxn: false, //科目三特殊扣分项 - specialkf:judgeUI.specialkf, + specialkf: judgeUI.specialkf, } console.info(judgeTag, '5.获取开始考试数据完成') return beginInfo @@ -1074,7 +1077,7 @@ export default class Judge { if (!isEnd) { judgeTask.addTask(async () => { console.info(judgeTag, `项目开始-${xmdm}-${projectsObj[xmdm].name}`) - await beginProject(xmdm,xmxh) + await beginProject(xmdm, xmxh) }, { isDelay: true }) @@ -1103,7 +1106,7 @@ export default class Judge { if (!projectIsEnd) { judgeTask.addTask(async () => { console.info(judgeTag, `项目结束-${xmdm}-${projectsObj[xmdm].name}`) - await endProject(xmdm,xmxh) + await endProject(xmdm, xmxh) this.xmmcSingleCode = 0; this.xmmcEndCode = undefined; }, { @@ -1151,7 +1154,7 @@ export default class Judge { await endRecordVideo(this.videoData) } judgeTask.addTask(async () => { - console.info(judgeTag, '考试结束 start') + console.info(judgeTag, handEndExam, '考试结束 start') globalThis.isJudge = false; await handEndExam(ksjs) }) @@ -1242,11 +1245,11 @@ export default class Judge { }) } else { //收到综合评判语音时,显示综合评判弹窗 - if(code[0] == 'zhpp'){ + if (code[0] == 'zhpp') { const param512 = (this.judgeUI.judgeConfigObj['512'] || '').split(','); this.judgeUI.isDeductedPopShow = false clearTimeout(this.deductedPopShowTimer) - if(param512[7] != 0){ + if (param512[7] != 0) { this.judgeUI.isDeductedPopShow = true this.judgeUI.defaultTabIndex = 1 } @@ -1258,6 +1261,7 @@ export default class Judge { // 处理考试结束 public handEndExam = async (ksjs: KSJS) => { + console.log(endExamTag, "handEndExam") this.judgeUI.loadingPopupVisible = true; this.judgeUI.endPopupVisible = false; this.judgeUI.isDeductedPopShow = false; @@ -1286,14 +1290,19 @@ export default class Judge { } avPlayer.playAudio(['voice/exam_waiting.mp3'], globalThis.singlePlay, async () => { + console.log(endExamTag, "播放 exam_waiting") try { if (!singlePlay) { + console.log(endExamTag, "获取中心心跳1") const bytes = await this.getMessageHeartbeat(true); + console.log(endExamTag, "获取中心心跳2") globalThis.judgeUdp.send(bytes) + console.log(endExamTag, "获取中心心跳3") } } catch (e) { - console.info(judgeTag, JSON.stringify(e)) + console.info(judgeTag,endExamTag,"心跳错误", JSON.stringify(e)) } + console.log(endExamTag,"开始调取结束考试") await endExam() }); @@ -1302,6 +1311,7 @@ export default class Judge { // 考试结束 public endExam = async (isManual?: Boolean) => { + console.log(endExamTag,"endExam start") const carInfo = globalThis.carInfo; const singlePlay = globalThis.singlePlay const { examSubject ,plateNo} = carInfo; @@ -1321,7 +1331,9 @@ export default class Judge { //TODO 断网考试结束补传 // await uploadDisConnectData(); const time = await getCurrentTime(); + console.log(endExamTag,"获取图片1") const photoBase64 = await getPhoto(); + console.log(endExamTag,"获取图片2") const {d1,d2,d3,d4,d5} = ksjs const data = { xtlb: '17', jkxlh: serialNumber, jkid: '17C56', @@ -1339,12 +1351,16 @@ export default class Judge { dwlc: [d1, d2, d3, d4, d5].map((d, index) => `${index + 1},${Math.floor(d / 100)}`).join(';'), } } + let backTimeOut = setTimeout(() => { router.back() }, 90 * 1000) + console.log(endExamTag,"上传结束考试1",JSON.stringify(data)) const {code,keystr,message} = await this.sendWriteObjectOut(data, filePath); + console.log(endExamTag,"上传结束考试2",code,keystr,message) + console.log(endExamTag,"上传监管code1") promptWxCode('17C56', code) - + console.log(endExamTag,"上传监管code2") if (code != 1) { avPlayer.playAudio(['voice/监管失败.mp3']) this.judgeUI.errorMsg = decodeURIComponent(message) @@ -1838,7 +1854,7 @@ export default class Judge { //TODO 待优化 跨组件传值不生效 globalThis.laneData = performInfo.lane; //特殊扣分标记上传中心 - if(performInfo.specialkf !== this.specialkf){ + if (performInfo.specialkf !== this.specialkf) { this.judgeUI.uploadMileage(performInfo.specialkf) this.specialkf = performInfo.specialkf } @@ -1920,7 +1936,7 @@ export default class Judge { globalThis.udpEvent.onStopExam(async () => { const config392 = (this.judgeUI.judgeConfigObj['392'] || '20,81').split(','); console.info(judgeTag, '开始远程终止考试扣分') - this.setJudgeMark(config392[0]*1, config392[1], 2); + this.setJudgeMark(config392[0] * 1, config392[1], 2); }) this.checkExamIsEnd(); diff --git a/entry/src/main/ets/pages/judgeSDK/utils/fileModel.ts b/entry/src/main/ets/pages/judgeSDK/utils/fileModel.ts index c9131252..4e1f7efc 100644 --- a/entry/src/main/ets/pages/judgeSDK/utils/fileModel.ts +++ b/entry/src/main/ets/pages/judgeSDK/utils/fileModel.ts @@ -20,7 +20,7 @@ export default class FileModel{ // 设置文件夹 public initFolder = async () => { const {fileUtil} = this - await fileUtil.initFolder(`/models/model_enc`); + await fileUtil.initFolder(`/models`); const folderPath = await fileUtil.initFolder(`/models`); this.folderPath = folderPath; }