学员开始考试防抖修改

This commit is contained in:
lv 2025-04-22 15:33:05 +08:00
commit c328cdd5f7
10 changed files with 120 additions and 74 deletions

View File

@ -33,6 +33,12 @@ export default class ServiceExtImpl extends IdlServiceExtStub {
console.log("lixiao error", JSON.stringify(err)) console.log("lixiao error", JSON.stringify(err))
}) })
}).catch(err => { }).catch(err => {
callback(0, JSON.stringify({
code: 1,
data: {
code: 2300007
}
}));
console.log("lixiao paste error", JSON.stringify(err)) console.log("lixiao paste error", JSON.stringify(err))
}) })
} }

View File

@ -0,0 +1,22 @@
import fs from '@ohos.file.fs';
export function delLog(offset: number) {
try {
const path = "/mnt/hmdfs/100/account/device_view/local/files/duolun/logs"
const list = fs.listFileSync(path)
const now = new Date().getTime()
list.forEach(filename => {
const year = Number(filename.split("_")[0])
const month = Number(filename.split("_")[1]) - 1
const date = Number(filename.split("_")[2])
const fileDate = new Date(year, month, date).getTime()
if (now - fileDate >= offset * 24 * 60 * 60 * 1000) {
fs.rmdirSync(path + "/" + filename)
console.log("lixiao delete log success path: ", path + "/" + filename)
}
})
} catch (e) {
console.log("lixiao delete log error", JSON.stringify(e))
}
}

View File

@ -192,7 +192,8 @@ export async function getUDP2(context,errorFlag?) {
console.info('surenjun', 'GlobalUdp收到endExam事件') console.info('surenjun', 'GlobalUdp收到endExam事件')
globalThis.udpEvent.sendEndExam(val.body[1]) globalThis.udpEvent.sendEndExam(val.body[1])
} }
}if (val.id == '36'){ }
if (val.id == '36') {
//获取远程扣分内容 //获取远程扣分内容
console.info('surenjun', '考车收到远程扣分项目内容,扣分代码:' + val.body[0]) console.info('surenjun', '考车收到远程扣分项目内容,扣分代码:' + val.body[0])
globalThis.udpEvent.sendKfContent(val.body[0]) globalThis.udpEvent.sendKfContent(val.body[0])
@ -322,9 +323,11 @@ export async function setJudgeUdp() {
) )
console.info('surenjun hintPort=> ', globalThis.carInfo?.hintPort) console.info('surenjun hintPort=> ', globalThis.carInfo?.hintPort)
await udpClientbyCenter.onError_Callback(()=>{}) await udpClientbyCenter.onError_Callback(() => {
})
await udpClientbyCenter.bindUdp() await udpClientbyCenter.bindUdp()
await udpClientbyCenter.onMessage_2((val) => {}) await udpClientbyCenter.onMessage_2((val) => {
})
//远程监听开始考试、结束考试、扣分指令 //远程监听开始考试、结束考试、扣分指令
@ -363,8 +366,18 @@ export async function setJudgeUdp() {
}) })
console.info('surenjun', `考车发送确定扣分指令,指令为:${directives}`) console.info('surenjun', `考车发送确定扣分指令,指令为:${directives}`)
}, },
//申请语音对讲
askVoice() {
globalThis.udpClient2.sendMsgExt({
id: 49,
list: [],
carNo: globalThis.carInfo.carNo,
placeId: globalThis.carInfo.examinationRoomId,
})
}
} }
} }
} }
// globalThis.udpClient.bindUdp() // globalThis.udpClient.bindUdp()

View File

@ -60,8 +60,8 @@ export const getMessageHeartbeat = async (msg) => {
const {fourInOneScreen:{gpsDigit}} = judgeConfig const {fourInOneScreen:{gpsDigit}} = judgeConfig
const asclshArr = stringToASC(fillZero( const asclshArr = stringToASC(fillZero(
globalThis.singlePlay globalThis.singlePlay
? '1111111111111' ? (examSubject == 2 ? '0000000000000' : '0000000000000')
: globalThis.lsh, : (globalThis.lsh || '0000000000000'),
13)); 13));
const ascksyhArr = stringToASC(fillZero(examSubject == 2 ? '0000000000000':'1111111111111', 13)) const ascksyhArr = stringToASC(fillZero(examSubject == 2 ? '0000000000000':'1111111111111', 13))
const ascsbxhArr = stringToASC('00000000') const ascsbxhArr = stringToASC('00000000')

View File

@ -8,7 +8,7 @@ import { TempLogger } from '../common/utils/TempLogger';
import DB from '../common/database/DbSql'; import DB from '../common/database/DbSql';
import { initTable } from '../common/service/initable'; import { initTable } from '../common/service/initable';
import Want from '@ohos.app.ability.Want'; import Want from '@ohos.app.ability.Want';
import { examPeerOccupy } from '../pages/judgeSDK/api'; import { examJudgeVersion, examPeerOccupy } from '../pages/judgeSDK/api';
export default class EntryAbility extends UIAbility { export default class EntryAbility extends UIAbility {
async onCreate(want, launchParam) { async onCreate(want, launchParam) {
@ -52,8 +52,6 @@ export default class EntryAbility extends UIAbility {
globalThis.deviceNo = ''; globalThis.deviceNo = '';
globalThis.hasAuth = false globalThis.hasAuth = false
// globalThis.judgeVersion ='2024.08.24.1'
// globalThis.version ='2023.12.13.01';
globalThis.version = GlobalConfig.version.jn.km3[0]; globalThis.version = GlobalConfig.version.jn.km3[0];
globalThis.judgeVersion = GlobalConfig.version.jn.km3[1]; globalThis.judgeVersion = GlobalConfig.version.jn.km3[1];
globalThis.tcpSendNum = 0 globalThis.tcpSendNum = 0
@ -76,9 +74,6 @@ export default class EntryAbility extends UIAbility {
console.info('jiangsong globalThis.pathDir = ' + globalThis.pathDir); console.info('jiangsong globalThis.pathDir = ' + globalThis.pathDir);
// this.requestPermission(this.context) // this.requestPermission(this.context)
// this.featureAbilityAuth() // this.featureAbilityAuth()
TempLogger.init()
// tcp创建连接
// await tcpUtil.init()
const windowClass = await windowStage.getMainWindow(); const windowClass = await windowStage.getMainWindow();
globalThis.windowClass = windowClass globalThis.windowClass = windowClass

View File

@ -22,12 +22,13 @@ import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
import IdlServiceExtProxy from '../IdlServiceExt/idl_service_ext_proxy'; import IdlServiceExtProxy from '../IdlServiceExt/idl_service_ext_proxy';
import Want from '@ohos.app.ability.Want'; import Want from '@ohos.app.ability.Want';
import emitter from '@ohos.events.emitter'; import emitter from '@ohos.events.emitter';
import { examJudgeVersion } from './judgeSDK/api';
import { delLog } from '../common/service/logService';
@Entry @Entry
@Component @Component
struct Index { struct Index {
@State carNum: string = '' @State carNum: string = ''
@State version: string = ''
@State url: string = '' @State url: string = ''
@State hasAuth: boolean = false; @State hasAuth: boolean = false;
@State dialogVisiable: boolean = false; @State dialogVisiable: boolean = false;
@ -58,6 +59,8 @@ struct Index {
private avPlayer private avPlayer
private context = getContext(this) as common.UIAbilityContext; private context = getContext(this) as common.UIAbilityContext;
private serviceExtProxy: IdlServiceExtProxy private serviceExtProxy: IdlServiceExtProxy
@State judgeVersion: string = ""
private version: string = "2025.04.21.01"
@Styles @Styles
commStyle(){ commStyle(){
@ -194,12 +197,12 @@ struct Index {
Column() { Column() {
Row() { Row() {
Column() { Column() {
Text('V外壳' + globalThis.version) Text('V外壳' + this.version)
.fontColor('#CCAE7A') .fontColor('#CCAE7A')
.fontSize(18 * globalThis.ratio) .fontSize(18 * globalThis.ratio)
.width('30%') .width('30%')
.margin({ bottom: 10 }) .margin({ bottom: 10 })
Text('V评判' + globalThis.judgeVersion) Text('V评判' + this.judgeVersion)
.fontColor('#CCAE7A') .fontColor('#CCAE7A')
.fontSize(18 * globalThis.ratio) .fontSize(18 * globalThis.ratio)
.width('30%') .width('30%')
@ -443,6 +446,7 @@ struct Index {
// globalThis.param854Str=sys.v_value // globalThis.param854Str=sys.v_value
delPic(Number(sys.v_value), 1) delPic(Number(sys.v_value), 1)
delPic(Number(sys.v_value), 2) delPic(Number(sys.v_value), 2)
delLog(Number(sys.v_value))
// this.delLoading=false // this.delLoading=false
} }
@ -611,6 +615,7 @@ struct Index {
} }
async initParams() { async initParams() {
this.judgeVersion = await examJudgeVersion()
await getUDP(this.context, false) await getUDP(this.context, false)
this.loading = false this.loading = false
await getDeviceInfo(this.context) await getDeviceInfo(this.context)
@ -626,7 +631,6 @@ struct Index {
console.info('surenjun', 'distanceClass=>初始化完成') console.info('surenjun', 'distanceClass=>初始化完成')
} }
this.carNum = globalThis.carInfo.plateNo; this.carNum = globalThis.carInfo.plateNo;
this.version = globalThis.version;
this.hasAuth = globalThis.hasAuth; this.hasAuth = globalThis.hasAuth;
setTimeout(() => { setTimeout(() => {
this.initParamFlag = true this.initParamFlag = true

View File

@ -111,6 +111,7 @@ struct Index {
FLAG: carInfo.flag, FLAG: carInfo.flag,
BK1: carInfo.bk1, BK1: carInfo.bk1,
BK2: carInfo.bk2, BK2: carInfo.bk2,
X_MCH: carInfo.x_mch,
}) })
console.info('surenjun =>carinfoArrr',JSON.stringify( this.carinfoArr)) console.info('surenjun =>carinfoArrr',JSON.stringify( this.carinfoArr))
} }

View File

@ -140,7 +140,9 @@ struct UserInfo {
// 同一学员连续第二次考试时不再验证身份 // 同一学员连续第二次考试时不再验证身份
if (this.currentUser.kssycs == '1' && this.systemParam.Param830Str == '1') { if (this.currentUser.kssycs == '1' && this.systemParam.Param830Str == '1') {
this.sfbdinterfaceFn() this.sfbdinterfaceFn()
} else { } else {
this.ksksLimit = false
this.showFaceCompare = true this.showFaceCompare = true
} }
} else { } else {
@ -148,6 +150,7 @@ struct UserInfo {
} }
} catch (e) { } catch (e) {
console.info('Throw Error', JSON.stringify(e)) console.info('Throw Error', JSON.stringify(e))
this.ksksLimit = false
} }
} }
@ -881,6 +884,7 @@ struct UserInfo {
//身份比对 //身份比对
async sfbdinterfaceFn() { async sfbdinterfaceFn() {
this.ksksLimit = false
globalThis.statue = 4 globalThis.statue = 4
this.stepFlag = true this.stepFlag = true
const carInfo = globalThis.carInfo; const carInfo = globalThis.carInfo;
@ -894,7 +898,7 @@ struct UserInfo {
carId, carId,
lsh: this.currentUser.lsh || '', lsh: this.currentUser.lsh || '',
examinationRoomId examinationRoomId
}); })
} }
this.currentUser.id = '1' this.currentUser.id = '1'
const avPlayer = this.avPlayer; const avPlayer = this.avPlayer;

View File

@ -73,6 +73,7 @@ export interface CARINFO {
FLAG: string, FLAG: string,
BK1: string, BK1: string,
BK2: string BK2: string
X_MCH: string
} }
export interface MAPPOINT { export interface MAPPOINT {

View File

@ -696,13 +696,13 @@ export default class Judge {
if (this.disConnectNum < 5 && this.disConnectNum > 0) { if (this.disConnectNum < 5 && this.disConnectNum > 0) {
console.log("wzj", "第" + this.disConnectNum + "次重新发送", JSON.stringify(data)) console.log("wzj", "第" + this.disConnectNum + "次重新发送", JSON.stringify(data))
} }
if (
//后台连接中心异常
temp.code == -1 || temp.code == 0 ||
//断网&网络超时次数计算 //断网&网络超时次数计算
if (temp.code == 2300007 || temp.code == 2300028) { temp.code == 2300007 || temp.code == 2300028) {
this.disConnectNum += 1; this.disConnectNum += 1;
if (this.disConnectNum < 5) { if (this.disConnectNum < 5) {
if (temp.code == 2300028) {
await new Promise(resolve => setTimeout(resolve, 1000)); // 延迟1秒
}
return await this.sendWriteObjectOut(data, filePath) return await this.sendWriteObjectOut(data, filePath)
} }
} }