From 3205daf0a55c8bf042bbe0d94cbab28aac547ea0 Mon Sep 17 00:00:00 2001 From: wangzhongjie Date: Tue, 11 Feb 2025 09:18:16 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E4=BC=98=E5=8C=96=E7=9A=84=E7=89=88?= =?UTF-8?q?=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/build-profile.json5 | 3 - .../main/ets/common/service/indexService.ts | 3 +- entry/src/main/ets/pages/CarCheck.ets | 2 +- entry/src/main/ets/pages/Index.ets | 2 +- entry/src/main/ets/pages/VideoConfig.ets | 2 +- .../ets/pages/compontents/FaceCompare.ets | 4 +- .../compontents/faceCompareByhaikang.ets | 4 +- entry/src/main/ets/pages/judgeSDK/judge.ts | 253 ++++++++++-------- .../ets/pages/judgeSDK/utils/filePhoto.ts | 73 ++--- .../ets/{common => }/service/usbService.ts | 0 .../ets/{common => }/service/videoService.ts | 8 +- .../ets/{common => }/service/voiceService.ts | 0 ohos/README.md | 1 + ohos/dts/README.md | 1 + ohos/so/README.md | 1 + 15 files changed, 192 insertions(+), 165 deletions(-) rename entry/src/main/ets/{common => }/service/usbService.ts (100%) rename entry/src/main/ets/{common => }/service/videoService.ts (97%) rename entry/src/main/ets/{common => }/service/voiceService.ts (100%) create mode 100644 ohos/README.md create mode 100644 ohos/dts/README.md create mode 100644 ohos/so/README.md diff --git a/entry/build-profile.json5 b/entry/build-profile.json5 index 36a2dbf9..f272df29 100644 --- a/entry/build-profile.json5 +++ b/entry/build-profile.json5 @@ -7,9 +7,6 @@ "cppFlags": "", }, "sourceOption": { - "workers": [ - './src/main/ets/workers/worker.ts' - ] } }, "targets": [ diff --git a/entry/src/main/ets/common/service/indexService.ts b/entry/src/main/ets/common/service/indexService.ts index 00b0c3eb..1b73f2f2 100644 --- a/entry/src/main/ets/common/service/indexService.ts +++ b/entry/src/main/ets/common/service/indexService.ts @@ -3,9 +3,8 @@ import promptAction from '@ohos.promptAction' import router from '@ohos.router' import { dateFormat } from '../utils/tools' import FileUtil from '../../common/utils/File' -import { takePhoto, deleteAllFileByPiC } from '../../common/service/videoService' +import { deleteAllFileByPiC, takePhoto } from '../../service/videoService' // import { VideoConfigData } from '../../mock'; - import { delSyncTable, getDataBaseTable, diff --git a/entry/src/main/ets/pages/CarCheck.ets b/entry/src/main/ets/pages/CarCheck.ets index 1cb687e2..9a5c79fa 100644 --- a/entry/src/main/ets/pages/CarCheck.ets +++ b/entry/src/main/ets/pages/CarCheck.ets @@ -1,4 +1,4 @@ -import { voiceService } from '../common/service/voiceService'; +import { voiceService } from '../service/voiceService'; import router from '@ohos.router'; import { carConfigurationInfo, uploadExamCarCheckResult } from '../api/checkCar'; import TopLogo from './compontents/TopLogo'; diff --git a/entry/src/main/ets/pages/Index.ets b/entry/src/main/ets/pages/Index.ets index d27adbea..5940eec9 100644 --- a/entry/src/main/ets/pages/Index.ets +++ b/entry/src/main/ets/pages/Index.ets @@ -15,7 +15,7 @@ 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 { delPic } from '../service/videoService'; import imageBtn from './compontents/imageBtn'; import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; diff --git a/entry/src/main/ets/pages/VideoConfig.ets b/entry/src/main/ets/pages/VideoConfig.ets index af9fb62a..a4fe9a2a 100644 --- a/entry/src/main/ets/pages/VideoConfig.ets +++ b/entry/src/main/ets/pages/VideoConfig.ets @@ -2,7 +2,7 @@ import TopLogo from './compontents/topLogo'; import FileUtil from '../common/utils/File'; import common from '@ohos.app.ability.common'; import promptAction from '@ohos.promptAction'; -import { endRecordVideo, startRecordVideo, takePhoto } from '../common/service/videoService'; +import { endRecordVideo, startRecordVideo, takePhoto } from '../service/videoService'; import { GlobalConfig } from '../config/index'; import { VideoConfigData } from '../mock'; import { VideoConfig } from '../model'; diff --git a/entry/src/main/ets/pages/compontents/FaceCompare.ets b/entry/src/main/ets/pages/compontents/FaceCompare.ets index 0bc74f79..8e514def 100644 --- a/entry/src/main/ets/pages/compontents/FaceCompare.ets +++ b/entry/src/main/ets/pages/compontents/FaceCompare.ets @@ -1,10 +1,10 @@ -import { voiceService } from '../../common/service/voiceService'; +import { voiceService } from '../../service/voiceService'; import { faceCompare } from '../../api/userInfo'; import FileUtil from '../../common/utils/File'; import common from '@ohos.app.ability.common'; import { string2Bytes } from '../../common/utils/tools'; -import { takePhoto } from '../../common/service/videoService'; +import { takePhoto } from '../../service/videoService'; import { GlobalConfig } from '../../config/index'; import { VideoConfigData } from '../../mock'; import { VideoConfig } from '../../model'; diff --git a/entry/src/main/ets/pages/compontents/faceCompareByhaikang.ets b/entry/src/main/ets/pages/compontents/faceCompareByhaikang.ets index c23ef1e3..7b83a4b6 100644 --- a/entry/src/main/ets/pages/compontents/faceCompareByhaikang.ets +++ b/entry/src/main/ets/pages/compontents/faceCompareByhaikang.ets @@ -1,10 +1,10 @@ -import { voiceService } from '../../common/service/voiceService'; +import { voiceService } from '../../service/voiceService'; import { faceCompare } from '../../api/userInfo'; import FileUtil from '../../common/utils/File'; import common from '@ohos.app.ability.common'; import { string2Bytes } from '../../common/utils/tools'; -import { takePhoto } from '../../common/service/videoService'; +import { takePhoto } from '../../service/videoService'; import { GlobalConfig } from '../../config/index'; import { VideoConfig } from '../../model'; diff --git a/entry/src/main/ets/pages/judgeSDK/judge.ts b/entry/src/main/ets/pages/judgeSDK/judge.ts index 2291d3bf..50f82053 100644 --- a/entry/src/main/ets/pages/judgeSDK/judge.ts +++ b/entry/src/main/ets/pages/judgeSDK/judge.ts @@ -12,9 +12,9 @@ import FileLog from './utils/fileLog'; import JudgeTask from './utils/judgeTask'; import { judgeConfig } from './utils/judgeConfig'; import { uploadExamProgressData, writeObjectOut } from '../../api/judge'; -import UsbService from '../../common/service/usbService'; +import UsbService from '../../service/usbService'; import { KF, LANE } from '../judgeSDK/api/judgeSDK.d'; -import { endRecordVideo, saveStartRecordVideo } from '../../common/service/videoService'; +import { endRecordVideo, saveStartRecordVideo } from '../../service/videoService'; import { Array2Byte, convertGpsCoord2, @@ -65,7 +65,7 @@ export default class Judge { if (singlePlay) { return '' } else { - const {filePhoto} = this; + const { filePhoto } = this; const photoBase64 = await filePhoto.getPhoto(); console.info(judgeTag, '拍照完成') return photoBase64 @@ -73,7 +73,7 @@ export default class Judge { } //人工操作项目 public setJudgeItem = async (itemno, type: 1 | 2) => { - const {fileLog} = this; + const { fileLog } = this; await examJudgeArtificialItem(itemno * 1, type); await fileLog.setExamJudgeData({ method: 'examJudgeArtificialItem', @@ -84,7 +84,7 @@ export default class Judge { } //人工扣分 public setJudgeMark = async (itemno, serial, type = 1) => { - const {fileLog} = this + const { fileLog } = this await examJudgeArtificialMark(itemno * 1, serial, type); console.info(judgeTag, `进入人工扣分-${itemno}-${serial}`) await fileLog.setExamJudgeData({ @@ -98,7 +98,7 @@ export default class Judge { } // 断网数据补传 uploadDisConnectData = async () => { - const {isJudgeDisConnect,fileLog,fileUtil} = this; + const { isJudgeDisConnect, fileLog, fileUtil } = this; if (!isJudgeDisConnect) { return } @@ -112,10 +112,10 @@ export default class Judge { } //上传无锡所过程数据 uploadProgressData = async () => { - const {judgeUI,fileUtil,fileLog} = this; - const {idCard,startFullTime} = judgeUI + const { judgeUI, fileUtil, fileLog } = this; + const { idCard, startFullTime } = judgeUI const carInfo = globalThis.carInfo; - const {carId,examinationRoomId} = carInfo + const { carId, examinationRoomId } = carInfo const folderPath = fileLog.folderPath const base64 = new util.Base64(); const time = await getCurrentTime(); @@ -151,8 +151,8 @@ export default class Judge { } //获取科目三的评判初始化配置 getKm3JudgeInitConfig = async () => { - const {judgeUI,getModelData} = this; - const {mapPointArr,mapPointItemArr} = judgeUI; + const { judgeUI, getModelData } = this; + const { mapPointArr, mapPointItemArr } = judgeUI; return { map_point: mapPointArr, map_point_item: mapPointItemArr, @@ -164,10 +164,12 @@ export default class Judge { } // 处理特殊参数配置 handleSEP = async (code: number) => { - const {judgeUI:{ - judgeConfigObj - },avPlayer} = this; - const {examSubject} = globalThis.carInfo; + const { + judgeUI:{ + judgeConfigObj + }, avPlayer + } = this; + const { examSubject } = globalThis.carInfo; switch (code) { //结束考试方式 @@ -186,9 +188,9 @@ export default class Judge { if (xmdm == 20) { return true } - const {judgeTask,beginProject,pointsDedute,uploadProgressPhoto,endProject,checkExamIsEnd,totalScore} = this; - const {projectsObj,passingScore:passingGrade} = this.judgeUI - const {isUpload} = projectsObj[xmdm]; + const { judgeTask, beginProject, pointsDedute, uploadProgressPhoto, endProject, checkExamIsEnd, totalScore } = this; + const { projectsObj, passingScore:passingGrade } = this.judgeUI + const { isUpload } = projectsObj[xmdm]; //如果项目没有开始 console.info('surenjun isUpload=>', isUpload) if (!isUpload) { @@ -233,7 +235,7 @@ export default class Judge { // 处理udp plc信号 handleUdp = async (msg) => { console.info('plc信号', msg) - const {fileLog,getPlcData,usbService,isUdpEnd,isExamEnd,judgeUI} = this + const { fileLog, getPlcData, usbService, isUdpEnd, isExamEnd, judgeUI } = this const stachArr = msg.split(',') if (stachArr[0] != '#DN_GD' || isUdpEnd) { return @@ -305,10 +307,10 @@ export default class Judge { private tempData: any //实时计算gps经纬度距离 handDistance = async () => { - const {jd,wd,hxj,dwzt,jdzt} = this.tempData.gps; + const { jd, wd, hxj, dwzt, jdzt } = this.tempData.gps; const tJD = convertGpsCoord2(jd) const tWD = convertGpsCoord2(wd) - const {prevJd,prevWd} = this + const { prevJd, prevWd } = this if (prevJd && dwzt == 4 && jdzt == 3) { const distance = await examCalcGpsDistance({ jd1: prevJd, @@ -329,8 +331,9 @@ export default class Judge { // 校验考试是否结束 checkExamIsEnd = async (isManual?: boolean) => { - const {judgeUI,avPlayer,isExamEnd,isEndTip,ksjs} = this; - const {isAllProjectsEnd,examSubject,singlePlay,totalScore,judgeConfigObj,passingScore,examMileage,jl} = judgeUI; + const { judgeUI, avPlayer, isExamEnd, isEndTip, ksjs } = this; + const { isAllProjectsEnd, examSubject, singlePlay, totalScore, judgeConfigObj, passingScore, examMileage, jl } = + judgeUI; if (isExamEnd) { return @@ -353,7 +356,8 @@ export default class Judge { if (isAllProjectsEnd && jl >= examMileage) { //成绩合格 if (totalScore >= passingGrade && !isEndTip) { - if (examSubject == 3 && (param342 == 0 || param342 == 2) && (param302 != 6 || param302 != 7 || param302 != 8)) { + if (examSubject == 3 && (param342 == 0 || param342 == 2) && + (param302 != 6 || param302 != 7 || param302 != 8)) { if (param512[7] != 0) { clearTimeout(this.deductedPopShowTimer) avPlayer.playAudio(['voice/综合评判.mp3']) @@ -410,7 +414,8 @@ export default class Judge { return } - if (examSubject == 3 && (param342 == 0 || param342 == 2) && (param302 != 6 || param302 != 7 || param302 != 8)) { + if (examSubject == 3 && (param342 == 0 || param342 == 2) && + (param302 != 6 || param302 != 7 || param302 != 8)) { if (param512[7] != 0) { clearTimeout(this.deductedPopShowTimer) this.judgeUI.isDeductedPopShow = false @@ -459,7 +464,7 @@ export default class Judge { private plcData: any // 获取plc数据 getPlcData = async (plc: string) => { - const {fileLog,mndgStr,rmndg} = this; + const { fileLog, mndgStr, rmndg } = this; await fileLog.setPlcProgressData(plc) //plc字符串转化成评判初始化数据 const tempData = await plcStrToJson(plc); @@ -481,7 +486,7 @@ export default class Judge { } // 处理轨迹plc信号 handleTrajectoryUdp = async (strArr) => { - const {fileLog,setJudgeItem,setJudgeMark,endExam} = this; + const { fileLog, setJudgeItem, setJudgeMark, endExam } = this; let num = 2; const judgeTimer = setInterval(async () => { const msgStr = strArr[num]; @@ -526,15 +531,17 @@ export default class Judge { // 项目开始接口同步 beginProject = async (ksxm) => { const carInfo = globalThis.carInfo; - const { examSubject,plateNo } = carInfo; - const {judgeUI,fileLog,getSbbm,xmxh,filePath} = this; - const {lsh,idCard,serialNumber,projectsObj,ksdd,kslx,xldm} = judgeUI + const { examSubject, plateNo } = carInfo; + const { judgeUI, fileLog, getSbbm, xmxh, filePath } = this; + const { lsh, idCard, serialNumber, projectsObj, ksdd, kslx, xldm } = judgeUI const time = await getCurrentTime(); const project = projectsObj[ksxm] const sbxh = getSbbm(ksxm, xmxh) const data = { //系统类别 接口序列号 接口标识 - xtlb: '17', jkxlh: serialNumber, jkid: '17C52', + xtlb: '17', + jkxlh: serialNumber, + jkid: '17C52', drvexam: { // 考试科目 身份证号码 lsh, @@ -550,7 +557,7 @@ export default class Judge { kssj: time } } - const {code} = await this.sendWriteObjectOut(data, filePath) + const { code } = await this.sendWriteObjectOut(data, filePath) console.info(judgeTag, '项目开始 end') if (code === 2300007) { this.isJudgeDisConnect = true; @@ -561,15 +568,17 @@ export default class Judge { endProject = async (ksxm) => { const carInfo = globalThis.carInfo; const deviceNo = globalThis.deviceNo; - const { examSubject,plateNo,carNo } = carInfo; - const {judgeUI,fileLog,getSbxh,xmxh,getSbbm,filePath} = this; - const {lsh,idCard,serialNumber,projectsObj,cdsbInfoObj,ksdd,kslx,xldm,} = judgeUI + const { examSubject, plateNo, carNo } = carInfo; + const { judgeUI, fileLog, getSbxh, xmxh, getSbbm, filePath } = this; + const { lsh, idCard, serialNumber, projectsObj, cdsbInfoObj, ksdd, kslx, xldm, } = judgeUI const time = await getCurrentTime(); const project = projectsObj[ksxm] const sbxh = examSubject == 3 ? undefined : getSbbm(ksxm, xmxh) const data = { - xtlb: '17', jkxlh: serialNumber, jkid: '17C55', + xtlb: '17', + jkxlh: serialNumber, + jkid: '17C55', drvexam: { lsh, kskm: examSubject, @@ -585,7 +594,7 @@ export default class Judge { jssj: time } } - const {code} = await this.sendWriteObjectOut(data, filePath) + const { code } = await this.sendWriteObjectOut(data, filePath) if (code === 2300007) { this.isJudgeDisConnect = true; } @@ -622,16 +631,18 @@ export default class Judge { // 考试过程照片 uploadProgressPhoto = async (ksxm) => { const time = await getCurrentTime(); - const {judgeUI,plcData,getPhoto,fileLog,filePath} = this; + const { judgeUI, plcData, getPhoto, fileLog, filePath } = this; const photoBase64 = await getPhoto(); const carInfo = globalThis.carInfo; - const { examSubject,plateNo,carNo } = carInfo; - const {lsh,idCard,serialNumber,projectsObj,ksdd,judgeConfigObj} = judgeUI; - const {sensor,gps} = plcData + const { examSubject, plateNo, carNo } = carInfo; + const { lsh, idCard, serialNumber, projectsObj, ksdd, judgeConfigObj } = judgeUI; + const { sensor, gps } = plcData const project = projectsObj[ksxm] const data = { - xtlb: '17', jkxlh: serialNumber, jkid: '17C54', + xtlb: '17', + jkxlh: serialNumber, + jkid: '17C54', drvexam: { lsh, kskm: examSubject, @@ -645,7 +656,7 @@ export default class Judge { ksdd: encodeURI(ksdd) } }; - const {code} = await this.sendWriteObjectOut(data, filePath); + const { code } = await this.sendWriteObjectOut(data, filePath); if (code === 2300007) { this.isJudgeDisConnect = true } @@ -672,13 +683,13 @@ export default class Judge { this.carztStr = ''; this.testKmItems = {}; // 考试回放配置 - const {isTrajectoryOpen,modelPath,trajectoryPath} = judgeConfig + const { isTrajectoryOpen, modelPath, trajectoryPath } = judgeConfig this.isTrajectoryOpen = isTrajectoryOpen; this.modelPath = modelPath; this.trajectoryPath = trajectoryPath; this.isExam = !this.judgeUI.singlePlay; - const {projectsCenterObj,examSubject} = judgeUI; + const { projectsCenterObj, examSubject } = judgeUI; (examSubject == 2 ? testKm2Items : testKm3Items).forEach(item => { const projectCenterObj = projectsCenterObj[item.code] @@ -702,18 +713,18 @@ export default class Judge { // 获取评判初始化数据 getJudgeInitData = async () => { - const {getModelData,getKm3JudgeInitConfig} = this + const { getModelData, getKm3JudgeInitConfig } = this const carInfo = globalThis.carInfo; - const { examSubject,plateNo,carId } = carInfo; + const { examSubject, plateNo, carId } = carInfo; const judgeUI = this.judgeUI - const {projectsObj,itemInfoObj,markRuleListObj,carType,carName,systemparmArr,carinfoArr} = judgeUI + const { projectsObj, itemInfoObj, markRuleListObj, carType, carName, systemparmArr, carinfoArr } = judgeUI const examType = examSubject == 2 ? 'km2' : 'km3' let allitems = []; if (examSubject == 2) { allitems = Reflect.ownKeys(itemInfoObj).map(cdsbKey => { const cdsb = itemInfoObj[cdsbKey]; - const {xmdm,xmxh,modelKey} = cdsb + const { xmdm, xmxh, modelKey } = cdsb return { xmdm, xmxh, model: getModelData(`${examType}/${modelKey}.txt`) } @@ -755,12 +766,13 @@ export default class Judge { // 获取开始考试数据 getJudgeBeginData = async () => { - const {code,name:examinerName} = globalThis.examinerInfo; + const { code, name:examinerName } = globalThis.examinerInfo; let currentParams: any = router.getParams(); - const {sczb,kfdm} = currentParams; - const {isExam} = this; + const { sczb, kfdm } = currentParams; + const { isExam } = this; const judgeUI = this.judgeUI - const {projects,carType,kssycs,isDdxk,ddxkTime,projectsCenterObj,ddxkKsxmArr,ddxkKfArr,passingScore} = judgeUI; + const { projects, carType, kssycs, isDdxk, ddxkTime, projectsCenterObj, ddxkKsxmArr, ddxkKfArr, passingScore } = + judgeUI; const beginInfo = { kgid: '012', kgxm: decodeURI(examinerName || ''), @@ -815,14 +827,14 @@ export default class Judge { //处理评判过程回调 handleRealExam = async (strData, callBack) => { let examData: EXAMDATA = JSON.parse(strData); - const {getDqxmStr,getKfStr,goJudgeVoice,setMndg,avPlayer,fileLog,judgeUI} = this; - const {carzt,xmks,kf,event,xmjs,xmqx,ksjs,sound,mndg,lane,precast,nongps} = examData + const { getDqxmStr, getKfStr, goJudgeVoice, setMndg, avPlayer, fileLog, judgeUI } = this; + const { carzt, xmks, kf, event, xmjs, xmqx, ksjs, sound, mndg, lane, precast, nongps } = examData const param512 = (judgeUI.judgeConfigObj['512'] || '').split(','); //获取项目结束、项目开始代码 const xmdm = event == 2 ? xmjs.xmdm : xmks.xmdm const xmxh = event == 2 ? xmjs.xmxh : xmks.xmxh; const isManualProjectIn = this.artSubject3ProjectsCodesArr.includes(xmdm); - const {examSubject,projects,judgeConfigObj} = this.judgeUI; + const { examSubject, projects, judgeConfigObj } = this.judgeUI; const param611 = judgeConfigObj['611'] || ''; switch (event) { //项目开始 @@ -872,7 +884,7 @@ export default class Judge { //扣分 case 3: const thisKf = getKfStr(`${kf.xmdm}_${kf.kfdm}`) - //扣分信息 + //扣分信息 this.kfArr.push({ //扣分项目名称 xmmcStr: getDqxmStr(kf.xmdm), @@ -911,7 +923,7 @@ export default class Judge { //项目取消 case 6: { console.info(judgeTag, '项目取消'); - const {examSubject} = this.judgeUI + const { examSubject } = this.judgeUI const xmdm = xmqx.xmdm; const xmmcCode = judgeUI.projectsObj[xmdm].projectCodeCenter; const voiceCode = getKmProjectCancelVoice(examSubject, xmmcCode); @@ -941,7 +953,7 @@ export default class Judge { case 10: { const param611 = judgeConfigObj['611'] || ''; const [f, s] = param611.split('/') - const {xmdm,xmxh} = precast; + const { xmdm, xmxh } = precast; const xmmcCode = judgeUI.projectsObj[xmdm].projectCodeCenter; const xmmcSingleCode = judgeUI.projectsObj[xmdm].projectCode; // if(examSubject == 2 && ((xmdm == 0 && f == 1) || (xmdm == 1 && s == 1) || xmdm == 3)){ @@ -960,7 +972,7 @@ export default class Judge { //差分事件 case 11: { - const {type} = nongps + const { type } = nongps this.checkDwzt(type) } default: @@ -968,7 +980,7 @@ export default class Judge { } - const {xmmcStr,carztStr,kfArr} = this; + const { xmmcStr, carztStr, kfArr } = this; await callBack({ //项目名称 考车状态 扣分arr @@ -1001,7 +1013,7 @@ export default class Judge { closeAllFiles } = this; - const {projectsObj,judgeConfigObj,examSubject,examMileage,jl,isAllProjectsEnd} = judgeUI; + const { projectsObj, judgeConfigObj, examSubject, examMileage, jl, isAllProjectsEnd } = judgeUI; const kfLen = kf.length; //不报语音的项目列表 const ignoreVoiceCodeArr = (judgeConfigObj['312'] || '').split(',') @@ -1014,20 +1026,20 @@ export default class Judge { const code = projectsObj[xmdm].projectCodeCenter; const isEnd = projectsObj[xmdm].isEnd; const kmCode = getKmProjectVoice(code, 1, judgeConfigObj, lane, xmxh) - // if (!ignoreVoiceCodeArr.includes(code)) { - // if(examSubject == 2 && ((xmdm == 0 && f == 2) || (xmdm == 1 && s == 2) || xmdm == 3)){ - // //倒出入库、桩考\进项目语音控制 - // }else{ - // kmCode && avPlayer.playAudio([`voice/${kmCode}.mp3`],true) - // } - // } + // if (!ignoreVoiceCodeArr.includes(code)) { + // if(examSubject == 2 && ((xmdm == 0 && f == 2) || (xmdm == 1 && s == 2) || xmdm == 3)){ + // //倒出入库、桩考\进项目语音控制 + // }else{ + // kmCode && avPlayer.playAudio([`voice/${kmCode}.mp3`],true) + // } + // } setTimeout(() => { if (param512[7] != 0) { clearTimeout(this.deductedPopShowTimer) this.judgeUI.isDeductedPopShow = true } }, 200) - //项目已考不上传监管信息 + //项目已考不上传监管信息 if (!isEnd) { judgeTask.addTask(async () => { console.info(judgeTag, `项目开始-${xmdm}-${projectsObj[xmdm].name}`) @@ -1080,9 +1092,10 @@ export default class Judge { // 扣分 case 3: console.info('surenjun', '扣分开始') - //扣分时实时播报语音(0-否+1-是) + //扣分时实时播报语音(0-否+1-是) const currentKf = kf[kfLen -1]; - if (judgeConfig.kfVoiceOpen || (examSubject == 2 && judgeConfigObj['618'] == '1') || (examSubject == 3 && judgeConfigObj['418'] == '1')) { + if (judgeConfig.kfVoiceOpen || (examSubject == 2 && judgeConfigObj['618'] == '1') || + (examSubject == 3 && judgeConfigObj['418'] == '1')) { avPlayer.playAudio([`voice/${currentKf.markcatalog}.mp3`, `voice/mark_${Math.abs(currentKf.score)}.mp3`]) } const isStart = await checkProjectIsStart(currentKf.xmdm, 2, currentKf); @@ -1103,7 +1116,7 @@ export default class Judge { // 考试结束 case 5: console.info(judgeTag, '考试结束') - //关闭录像 + //关闭录像 if (!globalThis.singlePlay) { await endRecordVideo(this.videoData) } @@ -1133,9 +1146,9 @@ export default class Judge { pointsDedute = async (ksxm, kf) => { const carInfo = globalThis.carInfo; const deviceNo = globalThis.deviceNo; - const { examSubject,plateNo,carNo } = carInfo; - const {judgeUI,getProjectInfo,fileLog,xmmcSingleCode,xmmcEndCode,filePath} = this; - const {lsh,idCard,serialNumber,ksdd,projectsObj} = judgeUI + const { examSubject, plateNo, carNo } = carInfo; + const { judgeUI, getProjectInfo, fileLog, xmmcSingleCode, xmmcEndCode, filePath } = this; + const { lsh, idCard, serialNumber, ksdd, projectsObj } = judgeUI const time = await getCurrentTime(); const project = getProjectInfo(ksxm); //科目三夜间行驶.模拟灯光、上车准备出现通用评判,ksxm为当前进行的项目 @@ -1151,7 +1164,9 @@ export default class Judge { }) const data = { - xtlb: '17', jkxlh: serialNumber, jkid: '17C53', + xtlb: '17', + jkxlh: serialNumber, + jkid: '17C53', drvexam: { lsh, kskm: examSubject, @@ -1172,7 +1187,7 @@ export default class Judge { } console.info(judgeTag + 'ksxm=>', data.drvexam.ksxm) - const {code} = await this.sendWriteObjectOut(data, filePath); + const { code } = await this.sendWriteObjectOut(data, filePath); if (code == 2300007) { this.isJudgeDisConnect = true } @@ -1182,8 +1197,8 @@ export default class Judge { // 评判语音提示 goJudgeVoice = async (sound: SOUND) => { - const {avPlayer,fileLog} = this; - const {xmdm,code,type} = sound; + const { avPlayer, fileLog } = this; + const { xmdm, code, type } = sound; console.info('surenjun code=>', JSON.stringify(code)) //判断是不是模拟灯光语音 if (type == 1) { @@ -1208,9 +1223,9 @@ export default class Judge { this.judgeUI.loadingPopupVisible = true; this.judgeUI.endPopupVisible = false; this.judgeUI.isDeductedPopShow = false; - const {qjjl,dcjl} = ksjs - const {judgeUI,endExam,handleSEP,kfArr,avPlayer,judgeTask,isManual,closeAllFiles} = this; - const {judgeConfigObj,examSubject,isAllProjectsEnd,totalScore,passingScore} = judgeUI; + const { qjjl, dcjl } = ksjs + const { judgeUI, endExam, handleSEP, kfArr, avPlayer, judgeTask, isManual, closeAllFiles } = this; + const { judgeConfigObj, examSubject, isAllProjectsEnd, totalScore, passingScore } = judgeUI; //计算考试分数 // this.judgeUI.totalScore = isAllProjectsEnd ? totalScore : 0; const singlePlay = globalThis.singlePlay @@ -1218,7 +1233,8 @@ export default class Judge { // globalThis.windowClass.setWindowSystemBarEnable(['navigation']) //自动退出待验证并且不合格 - if (!isManual && examSubject == 3 && (param302 == 1 || (singlePlay && param302 == 2)) && totalScore < passingScore) { + if (!isManual && examSubject == 3 && (param302 == 1 || (singlePlay && param302 == 2)) && + totalScore < passingScore) { avPlayer.playAudio([`voice/考试结束.mp3`]) } //联网模式下手动结束的直接退出 @@ -1264,7 +1280,7 @@ export default class Judge { public endExam = async (isManual?: Boolean) => { const carInfo = globalThis.carInfo; const singlePlay = globalThis.singlePlay - const { examSubject ,plateNo} = carInfo; + const { examSubject, plateNo } = carInfo; const { judgeUI, ksjs, @@ -1277,14 +1293,16 @@ export default class Judge { filePath, closeAllFiles } = this; - const {lsh,idCard,serialNumber,kssycs,totalScore,judgeConfigObj,isAllProjectsEnd,passingScore} = judgeUI + const { lsh, idCard, serialNumber, kssycs, totalScore, judgeConfigObj, isAllProjectsEnd, passingScore } = judgeUI //TODO 断网考试结束补传 // await uploadDisConnectData(); const time = await getCurrentTime(); const photoBase64 = await getPhoto(); - const {d1,d2,d3,d4,d5} = ksjs + const { d1, d2, d3, d4, d5 } = ksjs const data = { - xtlb: '17', jkxlh: serialNumber, jkid: '17C56', + xtlb: '17', + jkxlh: serialNumber, + jkid: '17C56', drvexam: { lsh, kchp: encodeURI(plateNo), @@ -1302,7 +1320,7 @@ export default class Judge { let backTimeOut = setTimeout(() => { router.back() }, 90 * 1000) - const {code,keystr,message} = await this.sendWriteObjectOut(data, filePath); + const { code, keystr, message } = await this.sendWriteObjectOut(data, filePath); promptWxCode('17C56', code) if (code != 1) { @@ -1324,7 +1342,8 @@ export default class Judge { let voiceURL = '' if (examSubject == 2) { if (isAllProjectsEnd) { - voiceURL = (totalScore < passingScore ? `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` : 'voice/qualified.mp3') + voiceURL = + (totalScore < passingScore ? `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` : 'voice/qualified.mp3') } else { voiceURL = `voice/unqualified_${kssycs == 1 ? 'one' : 'two'}.wav` currentKssycs = kssycs == 1 ? 0 : 1 @@ -1450,7 +1469,7 @@ export default class Judge { // 消息心跳发送 getMessageHeartbeat = async (isEnd?: Boolean) => { const carInfo = globalThis.carInfo; - const { examSubject,plateNo,ksyh } = carInfo; + const { examSubject, plateNo, ksyh } = carInfo; const { judgeUI, isExam, @@ -1467,17 +1486,19 @@ export default class Judge { fileLog, } = this; const singlePlay = globalThis.singlePlay - const {lsh,startHourTime,totalScore,examTime,judgeConfigObj} = judgeUI; - const {fourInOneScreen:{ - gpsDigit - }} = judgeConfig + const { lsh, startHourTime, totalScore, examTime, judgeConfigObj } = judgeUI; + const { + fourInOneScreen:{ + gpsDigit + } + } = judgeConfig const examType = examSubject == 2 ? 2 : 3 - const {sensor,gps} = tempData; + const { sensor, gps } = tempData; if (tempData.sensor === undefined) { return } - const {zfxd,yfxd,shtd,ygd,jgd,skd,dh1,dh2,lhq,jsc,ssc,fsc,lb,mkg,aqd,ygq,cs,fdjzs,dw} = sensor - const {jd,wd, hxj, fyj, hbg,sd} = gps; + const { zfxd, yfxd, shtd, ygd, jgd, skd, dh1, dh2, lhq, jsc, ssc, fsc, lb, mkg, aqd, ygq, cs, fdjzs, dw } = sensor + const { jd, wd, hxj, fyj, hbg, sd } = gps; //过滤错误数据 if (jd == 0) { @@ -1485,7 +1506,7 @@ export default class Judge { } const translateProject = getTranslateProject(); const sbxh = getSbxh(xmdm, xmxh) - const {carzt,dcjl,qjjl,dxjl,bxjl} = performInfo || {}; + const { carzt, dcjl, qjjl, dxjl, bxjl } = performInfo || {}; const asclshArr = stringToASC( fillZero((singlePlay ? (examSubject == 2 ? '0000000000000' : '1111111111111') : lsh) || 0, 13) ); @@ -1493,7 +1514,8 @@ export default class Judge { const ascksyhArr = stringToASC(fillZero(ksyh || 0, 13)) const ascsbxhArr = stringToASC(sbxh) const translateSignals = getTranslateSignals( - [zfxd, yfxd, shtd, ygd, jgd, skd, dh1, dh2, lhq, jsc, ssc, fsc, lb, mkg, aqd].concat(getDwStatusType(dw)).concat(getCarStatusType(carzt)).concat([ygq, sensor.wd, 0]) + [zfxd, yfxd, shtd, ygd, jgd, skd, dh1, dh2, lhq, jsc, ssc, fsc, lb, mkg, aqd].concat(getDwStatusType(dw)) + .concat(getCarStatusType(carzt)).concat([ygq, sensor.wd, 0]) ) //@ts-ignore const translateJd = convertGpsCoord2(wd).toFixed(gpsDigit) * Math.pow(10, gpsDigit); @@ -1521,7 +1543,8 @@ export default class Judge { translateSignals, //速度 发动机转速 GPS纬度 GPS经度 主天线位置 //@ts-ignore - string2Bytes(tempSd * 100, 2 * 8), string2Bytes(fdjzs / 100, 8), string2Bytes(translateJd, 4 * 8), string2Bytes(translateWd, 4 * 8), string2Bytes(1, 8), + string2Bytes(tempSd * 100, 2 * 8), string2Bytes(fdjzs / 100, 8), string2Bytes(translateJd, 4 * 8), + string2Bytes(translateWd, 4 * 8), string2Bytes(1, 8), //GPS东向距离 string2Bytes(dxjl < 0 ? (dxjl + 4294967296) : dxjl, 4 * 8), //GPS北向距离 @@ -1568,8 +1591,8 @@ export default class Judge { //获取场地序号 getSbxh = (ksxm, xmxh) => { - const {judgeUI} = this; - const {cdsbInfoObj,projectsObj} = judgeUI; + const { judgeUI } = this; + const { cdsbInfoObj, projectsObj } = judgeUI; const project = projectsObj[ksxm] if (project == 3) { return '0000000000' @@ -1585,8 +1608,8 @@ export default class Judge { } getSbbm = (ksxm, xmxh) => { - const {judgeUI} = this; - const {cdsbInfoObj,projectsObj,examSubject} = judgeUI; + const { judgeUI } = this; + const { cdsbInfoObj, projectsObj, examSubject } = judgeUI; const project = projectsObj[ksxm] //科目三不需要 if (examSubject == 3) { @@ -1603,7 +1626,7 @@ export default class Judge { // 中心所有项目转换 getTranslateProject = () => { - const {examSubject} = this.judgeUI; + const { examSubject } = this.judgeUI; const tempItems = (examSubject == 2 ? testKm2Items : testKm3Items).map(item => { const current = this.testKmItems[item.code]; return { @@ -1649,14 +1672,14 @@ export default class Judge { // 统计必考项目、所有项目、已考数量 setCountItems = async () => { const carInfo = globalThis.carInfo; - const { examSubject} = carInfo; - const {projectsObj} = this.judgeUI; + const { examSubject } = carInfo; + const { projectsObj } = this.judgeUI; //必考项目数量 必考项目已考数量 let projectNum = 0, endProjectsNum = 0; // 所有考试项目数量 项目已考项目数量 let allProjectNum = 0, allEndProjectsNum = 0; Reflect.ownKeys(projectsObj).forEach(projectKey => { - const {type,isRequired} = projectsObj[projectKey]; + const { type, isRequired } = projectsObj[projectKey]; allProjectNum += 1; if (type == 3 || type == 4) { allEndProjectsNum += 1; @@ -1680,7 +1703,7 @@ export default class Judge { // 检测差分状态 checkDwzt = async (type) => { - const {avPlayer} = this; + const { avPlayer } = this; const judgeConfig = this.judgeUI.judgeConfig; switch (type) { case 0: @@ -1706,7 +1729,7 @@ export default class Judge { case 4: this.judgeUI.isDwztRight = false; - //差分异常上报 + //差分异常上报 break; } } @@ -1719,8 +1742,8 @@ export default class Judge { //开始评判 private async judging(callBack: Function) { - const {judgeUI} = this; - const { name, lsh, idCard,kssycs,manualMarkRules} = judgeUI; + const { judgeUI } = this; + const { name, lsh, idCard, kssycs, manualMarkRules } = judgeUI; const fileLog = new FileLog(judgeUI.context); const filePath = await fileLog.initFileLogo({ name, lsh, idCard @@ -1799,7 +1822,7 @@ export default class Judge { this.videoData = await saveStartRecordVideo(`${name}_${kssycs}`) } - const {examSubject,projectsObj} = this.judgeUI + const { examSubject, projectsObj } = this.judgeUI // if(examSubject == 3){ // //不做模拟灯光,需要做上车准备 =>(请上车准备) // if(projectsObj[41]?.type == 3 && projectsObj[1]?.type != 3){ @@ -1839,7 +1862,7 @@ export default class Judge { //监听远程扣分 globalThis.udpEvent.onKfExam(async (content) => { console.info('评判收到远程扣分项目内容' + JSON.stringify(content)) - const { kfxh , directives } = content.data; + const { kfxh, directives } = content.data; console.info(judgeTag, '评判收到远程扣分项目内容,扣分序号:' + `kfxh=>${kfxh}; directives=>${directives}`) //根据扣分序号找扣分代码 const currentKf = manualMarkRules.filter(mark => mark.kfxh == kfxh)[0]; diff --git a/entry/src/main/ets/pages/judgeSDK/utils/filePhoto.ts b/entry/src/main/ets/pages/judgeSDK/utils/filePhoto.ts index 25563c36..938a48af 100644 --- a/entry/src/main/ets/pages/judgeSDK/utils/filePhoto.ts +++ b/entry/src/main/ets/pages/judgeSDK/utils/filePhoto.ts @@ -1,46 +1,30 @@ import FileUtil from '../../../common/utils/File' -import { takePhoto } from '../../../common/service/videoService'; +import { takePhoto } from '../../../service/videoService'; import promptAction from '@ohos.promptAction'; -import {judgeConfig} from './judgeConfig' +import { judgeConfig } from './judgeConfig' -interface Params{ - userName:string - pwd:string - ip:string - port:string - rlls:string - pztd:string +interface Params { + userName: string + pwd: string + ip: string + port: string + rlls: string + pztd: string } -export default class FilePhoto{ - - private params:Params - private context:any - private fileUtil:FileUtil +export default class FilePhoto { public mediaTest - - constructor(context) { - (async ()=>{ - //TODO 309参数 获取拍照摄像头拍照通道 - const fileUtil = new FileUtil(context) - const strConfig = await fileUtil.readFile('/mnt/hmdfs/100/account/device_view/local/files/duolun/config/config3.txt'); - const config = JSON.parse(strConfig) - const {userName,ip,pwd,port,rlls,pztd} = config - this.params = {userName,pwd,ip,port,rlls,pztd} - this.context = context - this.fileUtil = fileUtil - })() - } - + private params: Params + private context: any public getPhoto = async () => { - const {params} = this; - if(!judgeConfig.isPhotoOpen){ + const { params } = this; + if (!judgeConfig.isPhotoOpen) { return '' - }else{ + } else { try { - console.info('surenjun','拍照开始') - const res = await takePhoto(params, this.context, 'pz/',2); - console.info('surenjun','拍照结束' + JSON.stringify(res)) + console.info('surenjun', '拍照开始') + const res = await takePhoto(params, this.context, 'pz/', 2); + console.info('surenjun', '拍照结束' + JSON.stringify(res)) return res.base64 } catch (e) { console.error('surenjun =>拍照异常' + JSON.stringify(e)) @@ -52,5 +36,26 @@ export default class FilePhoto{ } } } + private fileUtil: FileUtil + constructor(context) { + (async () => { + //TODO 309参数 获取拍照摄像头拍照通道 + const fileUtil = new FileUtil(context) + const strConfig = + await fileUtil.readFile('/mnt/hmdfs/100/account/device_view/local/files/duolun/config/config3.txt'); + const config = JSON.parse(strConfig) + const { userName, ip, pwd, port, rlls, pztd } = config + this.params = { + userName, + pwd, + ip, + port, + rlls, + pztd + } + this.context = context + this.fileUtil = fileUtil + })() + } } \ No newline at end of file diff --git a/entry/src/main/ets/common/service/usbService.ts b/entry/src/main/ets/service/usbService.ts similarity index 100% rename from entry/src/main/ets/common/service/usbService.ts rename to entry/src/main/ets/service/usbService.ts diff --git a/entry/src/main/ets/common/service/videoService.ts b/entry/src/main/ets/service/videoService.ts similarity index 97% rename from entry/src/main/ets/common/service/videoService.ts rename to entry/src/main/ets/service/videoService.ts index b8ba82f5..ea5d5f09 100644 --- a/entry/src/main/ets/common/service/videoService.ts +++ b/entry/src/main/ets/service/videoService.ts @@ -1,11 +1,11 @@ import photoAccessHelper from '@ohos.file.photoAccessHelper'; import dataSharePredicates from '@ohos.data.dataSharePredicates'; -import { dateFormat, getCurrentTime, isSevenDaysAgo } from '../utils/tools'; +import { dateFormat, getCurrentTime, isSevenDaysAgo } from '../common/utils/tools'; // import rtsp_server from '@ohos.rtsprecord'; import record from '@ohos.rtsprecord'; -import { FileHelper } from './FileHelper'; -import FileUtil from '../utils/File'; -import { GlobalConfig } from '../../config'; +import { FileHelper } from '../common/service/FileHelper'; +import FileUtil from '../common/utils/File'; +import { GlobalConfig } from '../config'; import promptAction from '@ohos.promptAction'; const rtsp_server = record.createServer(); diff --git a/entry/src/main/ets/common/service/voiceService.ts b/entry/src/main/ets/service/voiceService.ts similarity index 100% rename from entry/src/main/ets/common/service/voiceService.ts rename to entry/src/main/ets/service/voiceService.ts diff --git a/ohos/README.md b/ohos/README.md new file mode 100644 index 00000000..29c4f109 --- /dev/null +++ b/ohos/README.md @@ -0,0 +1 @@ +存储本项目需要的声明文件以及os文件 \ No newline at end of file diff --git a/ohos/dts/README.md b/ohos/dts/README.md new file mode 100644 index 00000000..ad1ba3c0 --- /dev/null +++ b/ohos/dts/README.md @@ -0,0 +1 @@ +存储本项目需要的声明文件 \ No newline at end of file diff --git a/ohos/so/README.md b/ohos/so/README.md new file mode 100644 index 00000000..51d8559f --- /dev/null +++ b/ohos/so/README.md @@ -0,0 +1 @@ +存储本项目需要的os文件 \ No newline at end of file