fix: 更新 DbSql、FileUtils、Roads、UserInfo 和 FaceCompare 组件中的代码逻辑和类型声明,提升代码一致性

This commit is contained in:
wangzhongjie 2025-04-09 09:18:09 +08:00
parent ef2e07d1ac
commit 05cd7eff24
6 changed files with 1506 additions and 1505 deletions

File diff suppressed because it is too large Load Diff

View File

@ -1,7 +1,7 @@
import TopLogo from './compontents/TopLogo';
import { getSyncData } from '../common/service/initable';
import router from '@ohos.router';
import { MASYSTEMPARMType, RouteParamsType } from '../model';
import { GetSyncData } from '../utils/table/Operation';
const cBg = $rawfile('judge/km3/road/luxian_pre.png');
const lBg = $rawfile('judge/km3/road/luxian_nor.png');
@ -17,7 +17,7 @@ struct Index {
async aboutToAppear() {
//读取systemparam表的no1等于4的
const systemParms: Array<MASYSTEMPARMType> = await getSyncData('MA_SYSTEMPARM') as MASYSTEMPARMType[];
const systemParms: Array<MASYSTEMPARMType> = await GetSyncData('MA_SYSTEMPARM') as MASYSTEMPARMType[];
systemParms.forEach((systemParm: MASYSTEMPARMType) => {
//TODO 字段名称待修改
// const { no1, no2, no3, txt1, txt2 } = systemParm;

View File

@ -8,7 +8,7 @@ import IDCardSDK from '@ohos.idcard';
import common from '@ohos.app.ability.common';
import promptAction from '@ohos.promptAction';
import FilePhoto from './judgeSDK/utils/filePhoto';
// import { sqlInsertCommonFn, upDateTableByArray } from '../common/service/initable';
import { CandidateData, EmptyCandidateObject } from '../mock/CandidateData';
import BoardPrePareSetPopup from './compontents/judge/BoardPrePareSetPopup';
import LoadingPopup from './compontents/judge/LoadingPopup';
@ -208,20 +208,6 @@ struct UserInfo {
{ label: '考试员名', key: 'ksy2' },
]
private onCenterMsg = (val: centerCallBackMsgType) => {
if (val.id == 32) {
AppStorage.setOrCreate('signNum', val.body[1])
if (val.body[0] == 7) {
//缺考处理
this.getqkFn()
this.signNum = val.body[1]
}
} else if (val.id == 42) {
//收到中心缺考确认消息
this.qkFn()
}
}
aboutToAppear() {
this.avPlayer = new VoiceAnnounce();
}
@ -1340,6 +1326,20 @@ struct UserInfo {
.backgroundImage($r('app.media.bg'))
.backgroundImageSize({ width: '100%', height: '100%' })
}
private onCenterMsg = (val: centerCallBackMsgType) => {
if (val.id == 32) {
AppStorage.setOrCreate('signNum', val.body[1])
if (val.body[0] == 7) {
//缺考处理
this.getqkFn()
this.signNum = val.body[1]
}
} else if (val.id == 42) {
//收到中心缺考确认消息
this.qkFn()
}
}
}
// 头像组件

View File

@ -1,15 +1,15 @@
import { voiceService } from '../../service/voiceService';
import { faceCompare } from '../../api/userInfo';
import common from '@ohos.app.ability.common';
import { takePhoto } from '../../service/videoService';
import { GlobalConfig } from '../../config/index';
import { VideoConfigData } from '../../mock';
import { CarInfoType, UDPParamType, VideoConfig } from '../../model';
import { NumberToByteArray } from '../../utils/Common';
import FileUtils from '../../utils/FileUtils';
import { CenterUDPClientInstance } from '../../utils/business/CenterUdpBusiness';
import { takePhoto } from '../../utils/Video';
import { voiceService } from '../../utils/Voice';
interface ParamType {
id?: number;
@ -257,25 +257,25 @@ export default struct FaceCompare {
CenterUDPClientInstance.sendData(param2)
}
}, 1000)
CenterUDPClientInstance.getData((val)=>{
if (AppStorage.get('statue') != 3) {
return
}
if (val.id == 48) {
if (val.body[13] == 1) {
this.showFaceCompareFlag = !this.showFaceCompareFlag
this.showFaceCompare = !this.showFaceCompare
this.vocObj && this.vocObj.releasePlayer()
this.faceCompareSucess = 1
clearInterval(this.interval)
} else if (val.body[13] == 1 && this.callBackFlag) {
AppStorage.setOrCreate('statue', 2)
this.vocObj && this.vocObj.playAudio({
type: 1,
name: 'face_chekc_fail.wav'
})
}
CenterUDPClientInstance.onMsg((val) => {
if (AppStorage.get('statue') != 3) {
return
}
if (val.id == 48) {
if (val.body[13] == 1) {
this.showFaceCompareFlag = !this.showFaceCompareFlag
this.showFaceCompare = !this.showFaceCompare
this.vocObj && this.vocObj.releasePlayer()
this.faceCompareSucess = 1
clearInterval(this.interval)
} else if (val.body[13] == 1 && this.callBackFlag) {
AppStorage.setOrCreate('statue', 2)
this.vocObj && this.vocObj.playAudio({
type: 1,
name: 'face_chekc_fail.wav'
})
}
}
})
}

View File

@ -134,7 +134,7 @@ class DbUtils {
this.rdbStore.querySql(sql, []).then((res: relationalStore.ResultSet) => {
console.log(DbTag, "sql query", JSON.stringify(res))
if (res.rowCount <= 0) {
resolve(null)
resolve(0 as T)
} else {
res.goToNextRow()
resolve(res.getLong(0) as T)

View File

@ -7,7 +7,7 @@ import { BusinessError } from '@ohos.base'
export default class FileUtils {
public destFile: string
public destFile?: string
public filePathFdObj: Record<string, fs.File> = {}
private context: common.UIAbilityContext
private absolutePath = '/mnt/hmdfs/100/account/device_view/local/files/duolun'
@ -59,6 +59,7 @@ export default class FileUtils {
return file.fd
} catch (e) {
this.handleError('editFile文件失败', e, filePath)
return undefined
}
}