fix: 优化的版本

This commit is contained in:
wangzhongjie 2025-02-11 09:18:16 +08:00
parent c5b74ac135
commit 3205daf0a5
15 changed files with 192 additions and 165 deletions

View File

@ -7,9 +7,6 @@
"cppFlags": "",
},
"sourceOption": {
"workers": [
'./src/main/ets/workers/worker.ts'
]
}
},
"targets": [

View File

@ -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,

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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';

View File

@ -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,
@ -164,9 +164,11 @@ export default class Judge {
}
// 处理特殊参数配置
handleSEP = async (code: number) => {
const {judgeUI:{
const {
judgeUI:{
judgeConfigObj
},avPlayer} = this;
}, avPlayer
} = this;
const { examSubject } = globalThis.carInfo;
switch (code) {
@ -330,7 +332,8 @@ 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 { 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
@ -534,7 +539,9 @@ export default class Judge {
const sbxh = getSbbm(ksxm, xmxh)
const data = {
//系统类别 接口序列号 接口标识
xtlb: '17', jkxlh: serialNumber, jkid: '17C52',
xtlb: '17',
jkxlh: serialNumber,
jkid: '17C52',
drvexam: {
// 考试科目 身份证号码
lsh,
@ -569,7 +576,9 @@ export default class Judge {
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,
@ -631,7 +640,9 @@ export default class Judge {
const project = projectsObj[ksxm]
const data = {
xtlb: '17', jkxlh: serialNumber, jkid: '17C54',
xtlb: '17',
jkxlh: serialNumber,
jkid: '17C54',
drvexam: {
lsh,
kskm: examSubject,
@ -760,7 +771,8 @@ export default class Judge {
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 || ''),
@ -1082,7 +1094,8 @@ export default class Judge {
console.info('surenjun', '扣分开始')
//扣分时实时播报语音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);
@ -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,
@ -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`])
}
//联网模式下手动结束的直接退出
@ -1284,7 +1300,9 @@ export default class Judge {
const photoBase64 = await getPhoto();
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),
@ -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
@ -1468,9 +1487,11 @@ export default class Judge {
} = this;
const singlePlay = globalThis.singlePlay
const { lsh, startHourTime, totalScore, examTime, judgeConfigObj } = judgeUI;
const {fourInOneScreen:{
const {
fourInOneScreen:{
gpsDigit
}} = judgeConfig
}
} = judgeConfig
const examType = examSubject == 2 ? 2 : 3
const { sensor, gps } = tempData;
if (tempData.sensor === undefined) {
@ -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北向距离

View File

@ -1,5 +1,5 @@
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'
@ -13,25 +13,9 @@ interface Params{
}
export default class FilePhoto {
public mediaTest
private params: Params
private context: any
private fileUtil:FileUtil
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
})()
}
public getPhoto = async () => {
const { params } = this;
if (!judgeConfig.isPhotoOpen) {
@ -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
})()
}
}

View File

@ -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();

1
ohos/README.md Normal file
View File

@ -0,0 +1 @@
存储本项目需要的声明文件以及os文件

1
ohos/dts/README.md Normal file
View File

@ -0,0 +1 @@
存储本项目需要的声明文件

1
ohos/so/README.md Normal file
View File

@ -0,0 +1 @@
存储本项目需要的os文件