Merge remote-tracking branch 'origin/api10' into api10

This commit is contained in:
lixiao 2025-04-09 14:37:11 +08:00
commit aa878365fe
10 changed files with 225 additions and 236 deletions

View File

@ -1,11 +1,17 @@
import { getSyncData } from '../common/service/initable';
import request from '../utils/Request'; import request from '../utils/Request';
import http from '@ohos.net.http'; import http from '@ohos.net.http';
import common from '@ohos.app.ability.common'; import common from '@ohos.app.ability.common';
import { DrvexamType, GetJudgeParamsType } from '../model'; import {
CarInfoType,
DrvexamType,
GetJudgeParamsType,
MASYSSETTableType,
RegulatoryInterfaceParams,
WuxiExamType
} from '../model';
import FileUtils from '../utils/FileUtils'; import FileUtils from '../utils/FileUtils';
import { GetSyncData } from '../utils/table/Operation';
//监管接口序列号映射 //监管接口序列号映射
const gjxlhObj: Record<string, string> = { const gjxlhObj: Record<string, string> = {
@ -22,34 +28,35 @@ interface WR {
code: number code: number
} }
export default async function writeObjectOutNew(data, filePath: string): Promise<WR> { export default async function writeObjectOutNew(data: RegulatoryInterfaceParams, filePath: string): Promise<WR> {
const context: common.UIAbilityContext = AppStorage.get('context') const context: common.UIAbilityContext = AppStorage.get('context')
const fileUtil = new FileUtils(context); const fileUtil = new FileUtils(context);
// const { jkid, drvexam } = data;
const basic = await getBasicConfig(data.jkid); const basic = await getBasicConfig(data.jkid);
const params = await getParams(data.jkid, data.drvexam); const params = await getParams(data.jkid, data.drvexam);
// const { wglb, jkxlh, glbm, jgbh, sjbs } = basic;
if (filePath) { if (filePath) {
await fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`, JSON.stringify({ let examData: WuxiExamType = {
wglb: basic.wglb, wglb: basic.wglb,
jkxlh: basic.jkxlh, jkxlh: basic.jkxlh || "",
glbm: basic.glbm, glbm: basic.glbm,
jgbh: basic.jgbh, jgbh: basic.jgbh,
sjbs: basic.sjbs, sjbs: basic.sjbs,
data: params.data, data: params.data,
file: { file: {
...params.file, param: [] sjbs: params.file.sjbs,
}, // params: []
})); }
}
await fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`, JSON.stringify(examData));
} }
// let connectTimeout = sjbs === '02-21-000014' ?60000:1 // let connectTimeout = sjbs === '02-21-000014' ?60000:1
console.info('surenjun', '调用新监管') console.info('surenjun', '调用新监管')
let temp: WR let temp: WR
try { try {
const JGHOST: string = AppStorage.get<string>('JGHOST')
temp = await request<WR>({ temp = await request<WR>({
host: globalThis.JGHOST as string, host: JGHOST,
method: http.RequestMethod.POST, method: http.RequestMethod.POST,
//是否是新中心 //是否是新中心
isNewCenter: true, isNewCenter: true,
@ -86,7 +93,8 @@ export default async function writeObjectOutNew(data, filePath: string): Promise
} }
export async function getParams(jkid: string, drvexam: DrvexamType): Promise<GetJudgeParamsType> { export async function getParams(jkid: string, drvexam: DrvexamType): Promise<GetJudgeParamsType> {
const examSubject: number = globalThis.carInfo.examSubject; const carInfo: CarInfoType = AppStorage.get<CarInfoType>('carInfo')!
const examSubject: string = carInfo.examSubject;
switch (jkid) { switch (jkid) {
//开始考试 //开始考试
case '17C51': case '17C51':
@ -97,7 +105,7 @@ export async function getParams(jkid: string, drvexam: DrvexamType): Promise<Get
sfzmhm: drvexam.sfzmhm, sfzmhm: drvexam.sfzmhm,
kchp: decodeURI(drvexam.kchp), kchp: decodeURI(drvexam.kchp),
kskm: examSubject.toString(), kskm: examSubject.toString(),
ksxl: examSubject == 3 ? drvexam.ksxl : undefined, ksxl: examSubject == "3" ? drvexam.ksxl : undefined,
kssj: drvexam.kssj kssj: drvexam.kssj
} }
}, },
@ -120,10 +128,10 @@ export async function getParams(jkid: string, drvexam: DrvexamType): Promise<Get
param: { param: {
sfzmhm: drvexam.sfzmhm, sfzmhm: drvexam.sfzmhm,
kskm: drvexam.kskm, kskm: drvexam.kskm,
ksxl: examSubject == 3 ? drvexam.ksxl : undefined, ksxl: examSubject == "3" ? drvexam.ksxl : undefined,
kchp: decodeURI(drvexam.kchp), kchp: decodeURI(drvexam.kchp),
//TODO 待验证 科目三无 //TODO 待验证 科目三无
sbbh: examSubject == 3 ? undefined : drvexam.sbxh, sbbh: examSubject == "3" ? undefined : drvexam.sbxh,
kssj: drvexam.kssj, kssj: drvexam.kssj,
ksxm: drvexam.ksxm, ksxm: drvexam.ksxm,
} }
@ -139,7 +147,7 @@ export async function getParams(jkid: string, drvexam: DrvexamType): Promise<Get
data: { data: {
sjbs: gjxlhObj[jkid], sjbs: gjxlhObj[jkid],
param: { param: {
kffs: drvexam.kffs, kffs: drvexam.kffs.toString(),
kfsj: drvexam.kfsj, kfsj: drvexam.kfsj,
kfxm: drvexam.kfxm, kfxm: drvexam.kfxm,
kfxmmx: drvexam.kfxmmx, kfxmmx: drvexam.kfxmmx,
@ -180,7 +188,7 @@ export async function getParams(jkid: string, drvexam: DrvexamType): Promise<Get
jssj: drvexam.jssj, jssj: drvexam.jssj,
kskm: examSubject.toString(), kskm: examSubject.toString(),
ksxl: drvexam.ksxl, ksxl: drvexam.ksxl,
sbbh: examSubject == 3 ? undefined : drvexam.sbxh, sbbh: examSubject == "3" ? undefined : drvexam.sbxh,
ksxm: drvexam.ksxm, ksxm: drvexam.ksxm,
sfzmhm: drvexam.sfzmhm sfzmhm: drvexam.sfzmhm
}, },
@ -212,17 +220,18 @@ export async function getParams(jkid: string, drvexam: DrvexamType): Promise<Get
} }
//获取基础信息 //获取基础信息
async function getBasicConfig(jkid) { async function getBasicConfig(jkid: string): Promise<WuxiExamType> {
const examSubject = globalThis.carInfo.examSubject; const carInfo: CarInfoType = AppStorage.get<CarInfoType>('carInfo')!
const syssetParam = await getSyncData('MA_SYSSET'); const examSubject: string = carInfo.examSubject;
let syssetObj = {}; const syssetParam: MASYSSETTableType[] = await GetSyncData<MASYSSETTableType>('MA_SYSSET');
let syssetObj: Record<string, string> = {};
syssetParam.forEach(sys => { syssetParam.forEach(sys => {
syssetObj[sys.v_no] = decodeURIComponent(sys.v_value) syssetObj[sys.v_no] = decodeURIComponent(sys.v_value)
}); });
return { let obj: WuxiExamType = {
//外挂类别 //外挂类别
wglb: examSubject == 2 ? "700203" : "700204", wglb: examSubject == "2" ? "700203" : "700204",
//监管接口序列号 // //监管接口序列号
jkxlh: syssetObj['901'], jkxlh: syssetObj['901'],
//管理部门 //管理部门
glbm: syssetObj['903'], glbm: syssetObj['903'],
@ -231,4 +240,5 @@ async function getBasicConfig(jkid) {
//接口id //接口id
sjbs: gjxlhObj[jkid], sjbs: gjxlhObj[jkid],
} }
return obj
} }

View File

@ -805,3 +805,16 @@ export interface WR {
} }
// 无锡所数据
export interface WuxiExamType {
wglb: string
jkxlh: string,
glbm: string,
jgbh: string,
sjbs: string,
data?: JudgeData,
file?: JudgeFile
}

View File

@ -51,6 +51,7 @@ export interface TimeSynchronizationRspBody {
paraKdid?: string paraKdid?: string
kdid?: string kdid?: string
} }
export interface examinerLoginRsp { export interface examinerLoginRsp {
bz1?: string; bz1?: string;
fieldid?: string fieldid?: string

View File

@ -130,7 +130,11 @@ struct Index {
}, router.RouterMode.Single); }, router.RouterMode.Single);
console.log('res11', JSON.stringify(res)) console.log('res11', JSON.stringify(res))
const examinerLoginInfo: ExaminerLoginInfo = res.examinerLoginRsp.body const examinerLoginInfo: ExaminerLoginInfo | undefined = res.examinerLoginRsp?.body;
if (!examinerLoginInfo) {
console.error('examinerLoginRsp.body is undefined');
return;
}
examinerLoginInfo.username = this.inputTextArr[0] examinerLoginInfo.username = this.inputTextArr[0]
AppStorage.setOrCreate<ExaminerLoginInfo>('examinerInfo', examinerLoginInfo) AppStorage.setOrCreate<ExaminerLoginInfo>('examinerInfo', examinerLoginInfo)
}).catch((err: BusinessError) => { }).catch((err: BusinessError) => {

View File

@ -60,7 +60,7 @@ struct Index {
private fileHelper!: FileHelper private fileHelper!: FileHelper
private interval = -1; private interval = -1;
private avPlayer!: VoiceAnnounce private avPlayer!: VoiceAnnounce
private timeInfo: TimeSynchronizationRspBody private timeInfo!: TimeSynchronizationRspBody
private context = getContext(this) as common.UIAbilityContext; private context = getContext(this) as common.UIAbilityContext;
async aboutToAppear() { async aboutToAppear() {

View File

@ -1,12 +1,12 @@
import TopLogo from './compontents/TopLogo' import TopLogo from './compontents/TopLogo'
import { registrationDeviceNo } from '../api/checkCar' import { registrationDeviceNo } from '../api/checkCar'
import deviceManager from '@ohos.distributedHardware.deviceManager' import deviceManager from '@ohos.distributedHardware.deviceManager'
import promptAction from '@ohos.promptAction'
import common from '@ohos.app.ability.common' import common from '@ohos.app.ability.common'
import { ApiResponseType, DeviceParamType } from '../model' import { ApiResponseType, DeviceParamType } from '../model'
import dayTs from '../utils/Date' import dayTs from '../utils/Date'
import FileUtils from '../utils/FileUtils' import FileUtils from '../utils/FileUtils'
import Prompt from '@system.prompt'
@Entry @Entry
@Component @Component
@ -128,8 +128,9 @@ struct Index {
AppStorage.setOrCreate('deviceNo', this.ip) AppStorage.setOrCreate('deviceNo', this.ip)
// upDateTableByArray('DeviceInfoTable', [{ deviceId: this.ip }]) // upDateTableByArray('DeviceInfoTable', [{ deviceId: this.ip }])
registrationDeviceNo(param).then((res: ApiResponseType) => { registrationDeviceNo(param).then((res: ApiResponseType) => {
if (res.registrationDeviceNoRsp.head.resultCode == '0') { if (res.registrationDeviceNoRsp && res.registrationDeviceNoRsp.head &&
promptAction.showToast({ res.registrationDeviceNoRsp.head.resultCode == '0') {
Prompt.showToast({
message: decodeURIComponent(res.registrationDeviceNoRsp.head.resultMessage), message: decodeURIComponent(res.registrationDeviceNoRsp.head.resultMessage),
duration: 3000 duration: 3000
}); });

View File

@ -187,18 +187,18 @@ struct UserInfo {
alignment: DialogAlignment.Center, alignment: DialogAlignment.Center,
}, },
) )
private filePhoto: FilePhoto private filePhoto!: FilePhoto
// 过程照片拍照 // 过程照片拍照
getPhoto = async () => { getPhoto = async () => {
//单机模式返回空照片 //单机模式返回空照片
if (this.singlePlay) { if (this.singlePlay) {
return '' return ''
} else { } else {
const photoBase64: string = await this.filePhoto.getPhoto(); const photoBase64: string = (await this.filePhoto.getPhoto()) || "";
return photoBase64 return photoBase64
} }
} }
private avPlayer: VoiceAnnounce private avPlayer!: VoiceAnnounce
private context = getContext(this) as common.UIAbilityContext; private context = getContext(this) as common.UIAbilityContext;
private labelBlocks: LabelBlockType[] = [ private labelBlocks: LabelBlockType[] = [
{ label: '考生姓名', key: 'xm' }, { label: '考生姓名', key: 'xm' },
@ -220,9 +220,9 @@ struct UserInfo {
this.ksksLimit = false this.ksksLimit = false
this.currentUser = EmptyCandidateObject this.currentUser = EmptyCandidateObject
this.filePhoto = new FilePhoto(this.context); this.filePhoto = new FilePhoto(this.context);
this.singlePlay = AppStorage.get<boolean>('singlePlay') this.singlePlay = AppStorage.get<boolean>('singlePlay') || false
this.examinerLoginInfo = AppStorage.get<ExaminerLoginInfo>('examinerInfo') this.examinerLoginInfo = AppStorage.get<ExaminerLoginInfo>('examinerInfo')!
this.carInfo = AppStorage.get<CarInfoType>('carInfo') this.carInfo = AppStorage.get<CarInfoType>('carInfo')!
//语音功能on //语音功能on
// new WebRTCVoice(this.context); // new WebRTCVoice(this.context);
//初始化数据 //初始化数据
@ -264,7 +264,7 @@ struct UserInfo {
if (this.dataList.length) { if (this.dataList.length) {
setTimeout(() => { setTimeout(() => {
this.currentUser = this.dataList[0] this.currentUser = this.dataList[0]
this.currentUser.ksy2 = this.examinerLoginInfo.kgxm this.currentUser.ksy2 = this.examinerLoginInfo.kgxm || ""
AppStorage.setOrCreate('lsh', this.currentUser.lsh) AppStorage.setOrCreate('lsh', this.currentUser.lsh)
}, 200) }, 200)
} else { } else {
@ -341,7 +341,7 @@ struct UserInfo {
this.currentUser = EmptyCandidateObject this.currentUser = EmptyCandidateObject
setTimeout(() => { setTimeout(() => {
this.currentUser = res this.currentUser = res
this.currentUser.ksy2 = this.examinerLoginInfo.kgxm this.currentUser.ksy2 = this.examinerLoginInfo.kgxm || ""
}, 200) }, 200)
this.examinerLoginInfo.ksyh = res.ksy1sfzmhm this.examinerLoginInfo.ksyh = res.ksy1sfzmhm
@ -371,7 +371,7 @@ struct UserInfo {
await SqlInsertTable('USER', []) await SqlInsertTable('USER', [])
setTimeout(() => { setTimeout(() => {
this.currentUser = this.list[0] this.currentUser = this.list[0]
this.currentUser.ksy2 = this.examinerLoginInfo.kgxm this.currentUser.ksy2 = this.examinerLoginInfo.kgxm || ""
AppStorage.setOrCreate('lsh', this.currentUser.lsh) AppStorage.setOrCreate('lsh', this.currentUser.lsh)
}, 200) }, 200)
@ -384,7 +384,7 @@ struct UserInfo {
onReadCard(ret: IDCardSDK.IDCardInfo) { onReadCard(ret: IDCardSDK.IDCardInfo) {
console.info(`zzctest xx Read Card ret =${ret.status}`) console.info(`zzctest xx Read Card ret =${ret.status}`)
let thisVar: IdCard = AppStorage.get('indexComponent'); let thisVar: IdCard = AppStorage.get('indexComponent')!;
if (ret.status == 0) { // status = 1 为读到身份证信息; status = 1 为身份证离开读卡器 if (ret.status == 0) { // status = 1 为读到身份证信息; status = 1 为身份证离开读卡器
// 收到身份证离开读卡器的事件通知,根据实际业务需要决定是否需要清空之前已读取的身份证信息。 // 收到身份证离开读卡器的事件通知,根据实际业务需要决定是否需要清空之前已读取的身份证信息。
@ -517,28 +517,28 @@ struct UserInfo {
// this.fileUtil.addFile("temp.log", JSON.stringify(syssetParams)) // this.fileUtil.addFile("temp.log", JSON.stringify(syssetParams))
syssetParams.forEach(sys => { syssetParams.forEach(sys => {
//364 绕车一周评判时机(1-开始考试后判 2-开始考试前判) //364 绕车一周评判时机(1-开始考试后判 2-开始考试前判)
if (sys.v_no === '364' && decodeURIComponent(sys.v_value) == '2') { if (sys.v_no === '364' && decodeURIComponent(sys.v_value || "") == '2') {
this.systemParam.Param364 = sys.v_value this.systemParam.Param364 = sys.v_value || ""
that.isBoardPrePareSetPopupOpen = true; that.isBoardPrePareSetPopupOpen = true;
that.isFirstBoardPrePareSetPopupBtnShow = false that.isFirstBoardPrePareSetPopupBtnShow = false
} }
//398参数为1 第二场考试上车准备不考 //398参数为1 第二场考试上车准备不考
if (sys.v_no === '398' && decodeURIComponent(sys.v_value) == '1') { if (sys.v_no === '398' && decodeURIComponent(sys.v_value || "") == '1') {
that.systemParam.Param398 = decodeURIComponent(sys.v_value) that.systemParam.Param398 = decodeURIComponent(sys.v_value || "")
that.isSecondBoardPrePareSetPopupOpen = true; that.isSecondBoardPrePareSetPopupOpen = true;
} }
// 车上没有缺考功能 // 车上没有缺考功能
if (sys.v_no === '770') { if (sys.v_no === '770') {
that.systemParam.Param770Str = sys.v_value; that.systemParam.Param770Str = sys.v_value || "";
} }
// 开始考试前必须解开安全带或关车门 // 开始考试前必须解开安全带或关车门
if (sys.v_no === '803') { if (sys.v_no === '803') {
that.systemParam.Param803Str = sys.v_value + ''; that.systemParam.Param803Str = sys.v_value + '';
} }
//判断是否考生是否按顺序考试 //判断是否考生是否按顺序考试
if (sys.v_no === '341' && decodeURIComponent(sys.v_value) == '1') { if (sys.v_no === '341' && decodeURIComponent(sys.v_value || "") == '1') {
that.systemParam.Param341 = true that.systemParam.Param341 = true
} else { } else {
//todo //todo
@ -546,15 +546,15 @@ struct UserInfo {
} }
//开始考试触发方式 //开始考试触发方式
if (sys.v_no === '612') { if (sys.v_no === '612') {
that.systemParam.Param612Str = decodeURIComponent(sys.v_value) that.systemParam.Param612Str = decodeURIComponent(sys.v_value || "")
} }
//车上考试过一次就不能缺考 //车上考试过一次就不能缺考
if (sys.v_no === '352') { if (sys.v_no === '352') {
that.systemParam.Param352Str = decodeURIComponent(sys.v_value) that.systemParam.Param352Str = decodeURIComponent(sys.v_value || "")
} }
//828考生待考界面安全员显示考试员 //828考生待考界面安全员显示考试员
if (sys.v_no === '828') { if (sys.v_no === '828') {
that.systemParam.Param828Str = decodeURIComponent(sys.v_value) that.systemParam.Param828Str = decodeURIComponent(sys.v_value || "")
if (that.systemParam.Param828Str == '1') { if (that.systemParam.Param828Str == '1') {
that.labelBlocks[5].label = '安全员名' that.labelBlocks[5].label = '安全员名'
} else { } else {
@ -565,7 +565,7 @@ struct UserInfo {
} }
//视频保存天数 //视频保存天数
if (sys.v_no === '305') { if (sys.v_no === '305') {
that.systemParam.Param305Str = decodeURIComponent(sys.v_value) that.systemParam.Param305Str = decodeURIComponent(sys.v_value || "")
if (!Number(this.systemParam.Param305Str)) { if (!Number(this.systemParam.Param305Str)) {
that.systemParam.Param305Str = '2' that.systemParam.Param305Str = '2'
} }
@ -654,9 +654,9 @@ struct UserInfo {
this.type = '2' this.type = '2'
this.errorDialog.open() this.errorDialog.open()
this.updateTimeLimit = true this.updateTimeLimit = true
let md5Message: string = CryptoJS.MD5(this.carInfo.carId + let md5Message: string = CryptoJS.MD5(this.carInfo.carId! +
this.carInfo.examinationRoomId + this.carInfo.examinationRoomId! +
this.examinerLoginInfo.username).toString(); this.examinerLoginInfo.username!).toString();
const param = const param =
`<getExaminationStudentInfoReq><head><checkCode>${md5Message}</checkCode></head><body><carId>${this.carInfo.carId}</carId><examinationRoomId>${this.carInfo.examinationRoomId}</examinationRoomId><examinerName>${this.examinerLoginInfo.username}</examinerName><sfzmhm></sfzmhm></body></getExaminationStudentInfoReq>` `<getExaminationStudentInfoReq><head><checkCode>${md5Message}</checkCode></head><body><carId>${this.carInfo.carId}</carId><examinationRoomId>${this.carInfo.examinationRoomId}</examinationRoomId><examinerName>${this.examinerLoginInfo.username}</examinerName><sfzmhm></sfzmhm></body></getExaminationStudentInfoReq>`
try { try {
@ -712,10 +712,10 @@ struct UserInfo {
}); });
if (this.systemParam.Param828Str == '1' || this.systemParam.Param828Str == '2') { if (this.systemParam.Param828Str == '1' || this.systemParam.Param828Str == '2') {
// listData.ksy2=listData.ksy1; // listData.ksy2=listData.ksy1;
listData.ksy2 = this.examinerLoginInfo.kgxm listData.ksy2 = this.examinerLoginInfo.kgxm || ""
} else { } else {
// listData.ksy2=listData.ksy2; // listData.ksy2=listData.ksy2;
listData.ksy2 = this.examinerLoginInfo.kgxm listData.ksy2 = this.examinerLoginInfo.kgxm || ""
} }
listData.kszp = this.photo + listData.kszp listData.kszp = this.photo + listData.kszp
listData.ksmjzp = this.photo + listData.ksmjzp listData.ksmjzp = this.photo + listData.ksmjzp
@ -737,7 +737,7 @@ struct UserInfo {
if (this.dataList.length) { if (this.dataList.length) {
setTimeout(() => { setTimeout(() => {
this.currentUser = user.length ? user[0] : this.dataList[0] this.currentUser = user.length ? user[0] : this.dataList[0]
this.currentUser.ksy2 = this.examinerLoginInfo.kgxm this.currentUser.ksy2 = this.examinerLoginInfo.kgxm || ""
AppStorage.setOrCreate('lsh', this.currentUser.lsh) AppStorage.setOrCreate('lsh', this.currentUser.lsh)
this.examinerLoginInfo.ksyh = this.currentUser.ksy1sfzmhm this.examinerLoginInfo.ksyh = this.currentUser.ksy1sfzmhm
AppStorage.setOrCreate('examinerInfo', this.examinerLoginInfo) AppStorage.setOrCreate('examinerInfo', this.examinerLoginInfo)
@ -787,10 +787,10 @@ struct UserInfo {
} }
console.log('JsonJson', JSON.stringify(this.currentUser)) console.log('JsonJson', JSON.stringify(this.currentUser))
const param: ExaminationStuAbsentParams = { const param: ExaminationStuAbsentParams = {
carId: this.carInfo.carId, carId: this.carInfo.carId || "",
sfzmhm: this.currentUser.sfzmhm, sfzmhm: this.currentUser.sfzmhm,
examinationRoomId: this.carInfo.examinationRoomId, examinationRoomId: this.carInfo.examinationRoomId || "",
username: this.examinerLoginInfo.username, username: this.examinerLoginInfo.username || "",
lsh: this.lsh lsh: this.lsh
} }
console.log('carNo1111', param) console.log('carNo1111', param)
@ -804,8 +804,8 @@ struct UserInfo {
const param: UDPParamType = { const param: UDPParamType = {
id: 43, id: 43,
list: tmpList, list: tmpList,
carNo: this.carInfo.carNo, carNo: this.carInfo.carNo || "",
placeId: this.carInfo.examinationRoomId placeId: this.carInfo.examinationRoomId || ""
} }
CenterUDPClientInstance.sendData(param) CenterUDPClientInstance.sendData(param)
// globalThis.udpClient2.sendMsgExt(param, this.context) // globalThis.udpClient2.sendMsgExt(param, this.context)

View File

@ -190,7 +190,7 @@ export default struct FaceCompare {
console.log('mmmmm0', 2) console.log('mmmmm0', 2)
this.param.pztd = this.param.rlls this.param.pztd = this.param.rlls
const data = await takePhoto(this.param, this.context, 'jt/', 1,) const data = await takePhoto(this.param, this.context, 'jt/', 1,)
this.base64 = this.imageBase64 + data.base64 this.base64 = this.imageBase64 + (data.base64 || "")
console.log('mmmmt', this.base64) console.log('mmmmt', this.base64)
faceCompare({ faceCompare({
sfzh: this.sfzh, sfzh: this.sfzh,
@ -238,8 +238,8 @@ export default struct FaceCompare {
const param: UDPParamType = { const param: UDPParamType = {
id: 46, id: 46,
list: tmpList, list: tmpList,
carNo: this.carInfo.carNo, carNo: this.carInfo.carNo || "",
placeId: this.carInfo.examinationRoomId, placeId: this.carInfo.examinationRoomId || "",
sendCallback: () => { sendCallback: () => {
this.callBackFlag = true this.callBackFlag = true
} }
@ -253,8 +253,8 @@ export default struct FaceCompare {
const param2: UDPParamType = { const param2: UDPParamType = {
id: 47, id: 47,
list: tmpList, list: tmpList,
carNo: this.carInfo.carNo, carNo: this.carInfo.carNo || "",
placeId: this.carInfo.examinationRoomId, placeId: this.carInfo.examinationRoomId || "",
} }
CenterUDPClientInstance.sendData(param2) CenterUDPClientInstance.sendData(param2)
} }

View File

@ -6,7 +6,7 @@ import { MarkRule } from '../../judgeSDK/api/judgeSDK.d';
import { writeObjectOut } from '../../../api/judge'; import { writeObjectOut } from '../../../api/judge';
import JudgeTask from '../../judgeSDK/utils/judgeTask'; import JudgeTask from '../../judgeSDK/utils/judgeTask';
import FilePhoto from '../../judgeSDK/utils/filePhoto'; import FilePhoto from '../../judgeSDK/utils/filePhoto';
import { CarInfoType, MASYSSETTableType } from '../../../model'; import { CarInfoType, MASYSSETTableType, RegulatoryInterfaceParams, User } from '../../../model';
import { GetCurrentTime } from '../../../utils/Common'; import { GetCurrentTime } from '../../../utils/Common';
import FileUtils from '../../../utils/FileUtils'; import FileUtils from '../../../utils/FileUtils';
import { GetSyncData } from '../../../utils/table/Operation'; import { GetSyncData } from '../../../utils/table/Operation';
@ -16,6 +16,14 @@ interface SEL {
bgColor: string bgColor: string
} }
interface kfdmItemType {
xmdm: number,
kfdm: string,
markreal: number,
markcatalog: string
score: number
}
//考前模拟人工扣分 //考前模拟人工扣分
@Component @Component
export default struct DeductedPopup { export default struct DeductedPopup {
@ -28,14 +36,8 @@ export default struct DeductedPopup {
@State kslx: string = '' @State kslx: string = ''
@State ksxl: string = '' @State ksxl: string = ''
@State score: number = 100; @State score: number = 100;
@State judgeConfigObj: { [k: string]: any } = {} @State judgeConfigObj: Record<string, string> = {}
@State kfdmArr: { @State kfdmArr: kfdmItemType[] = []
xmdm: number,
kfdm: string,
markreal: number,
markcatalog: string
score: number
}[] = []
//开始考试前判绕车一周评判是否开启 //开始考试前判绕车一周评判是否开启
@State isOpen: boolean = false @State isOpen: boolean = false
//监管序列号 //监管序列号
@ -52,7 +54,7 @@ export default struct DeductedPopup {
@State universalMarkRules: MarkRule[] = [] @State universalMarkRules: MarkRule[] = []
@State manualMarkRules: MarkRule[] = [] @State manualMarkRules: MarkRule[] = []
@State lineBg: Array<string> = ['#4D4136', '#26231E'] @State lineBg: Array<string> = ['#4D4136', '#26231E']
@State selectedLine: number = undefined @State selectedLine: number = -1
@State carInfo: CarInfoType = { @State carInfo: CarInfoType = {
carId: '', carId: '',
examinationRoomId: '', examinationRoomId: '',
@ -66,23 +68,23 @@ export default struct DeductedPopup {
bgColor: '#B36E00' bgColor: '#B36E00'
} }
private context = getContext(this) as common.UIAbilityContext; private context = getContext(this) as common.UIAbilityContext;
private judgeTask: JudgeTask private judgeTask!: JudgeTask
private filePhoto: FilePhoto private filePhoto!: FilePhoto
// 过程照片拍照 // 过程照片拍照
getPhoto = async (empty?: boolean) => { getPhoto = async (empty?: boolean) => {
//单机模式返回空照片 //单机模式返回空照片
if (this.singlePlay) { if (this.singlePlay) {
return '' return ''
} else { } else {
const photoBase64: string = await this.filePhoto.getPhoto(); const photoBase64: string = await this.filePhoto.getPhoto() || "";
return photoBase64 return photoBase64
} }
} }
private avPlayer: VoiceAnnounce private avPlayer!: VoiceAnnounce
async aboutToAppear() { async aboutToAppear() {
this.carInfo = AppStorage.get<CarInfoType>('carInfo') this.carInfo = AppStorage.get<CarInfoType>('carInfo')!
this.singlePlay = AppStorage.get<boolean>('singlePlay') this.singlePlay = AppStorage.get<boolean>('singlePlay')!
this.avPlayer = new VoiceAnnounce(this.context); this.avPlayer = new VoiceAnnounce(this.context);
this.judgeTask = new JudgeTask(); this.judgeTask = new JudgeTask();
const mediaTest = new FilePhoto(this.context); const mediaTest = new FilePhoto(this.context);
@ -131,13 +133,13 @@ export default struct DeductedPopup {
async pointsDedute() { async pointsDedute() {
const index = this.currentIndex ? this.currentUniversalPageIndex : this.currentPageIndex; const index = this.currentIndex ? this.currentUniversalPageIndex : this.currentPageIndex;
const mark = this.universalMarkRules[index * 7 + this.selectedLine]; const mark = this.universalMarkRules[index * 7 + this.selectedLine];
const { judgeConfigObj, kssycs, avPlayer, judgeTask } = this; // const { judgeConfigObj, kssycs, avPlayer, judgeTask } = this;
this.kfdmArr.push({ this.kfdmArr.push({
xmdm: 1, xmdm: 1,
kfdm: mark.markserial, kfdm: mark.markserial || "",
markreal: mark.markreal, markreal: mark.markreal || 0,
markcatalog: mark.markcatalog, markcatalog: mark.markcatalog || "",
score: mark.score score: mark.score || 0
}) })
const kfdmArr = this.kfdmArr const kfdmArr = this.kfdmArr
@ -148,13 +150,14 @@ export default struct DeductedPopup {
}, 0); }, 0);
this.score = score this.score = score
this.confirmMark(this.kfdmArr.map((kf) => ({ // this.confirmMark(this.kfdmArr.map((kf) => ({
xmdm: kf.xmdm, // xmdm: kf.xmdm.toString(),
kfdm: kf.kfdm, // kfdm: kf.kfdm,
}))) // })))
if (judgeConfigObj['418'] == '1' || JudgeConfig.kfVoiceOpen) { if (this.judgeConfigObj['418'] == '1' || JudgeConfig.kfVoiceOpen) {
avPlayer.playAudio([`voice/${mark.markcatalog}.mp3`, `voice/mark_${Math.abs(mark.score)}.mp3`], false, () => { this.avPlayer.playAudio([`voice/${mark.markcatalog}.mp3`, `voice/mark_${Math.abs(mark.score!)}.mp3`], false,
() => {
this.closePopup(true) this.closePopup(true)
}); });
return return
@ -162,75 +165,29 @@ export default struct DeductedPopup {
this.closePopup(); this.closePopup();
return; return;
if (score < 90) {
this.closePopup(true)
avPlayer.playAudio(['voice/exam_waiting.mp3', `voice/kfdesc.mp3`])
judgeTask.addTask(async () => {
//扣分
await this.kfFn();
}, { isDelay: true })
judgeTask.addTask(async () => {
//项目结束
await this.endProject();
}, { isDelay: true })
judgeTask.addTask(async () => {
//结束考试
await this.endFn()
}, { isDelay: true })
}
;
let voiceURL =
score < 90 ? `voice/${kssycs == '1' ? 'exam_no_pass_finish' : 'exam_no_pass'}.mp3` : 'voice/exam_pass.mp3'
let kfScore = 0;
if (kfdmArr.length) {
kfdmArr.forEach((kf, index) => {
kfScore += Math.abs(Number(kf.markreal));
if (kfScore <= 100) {
judgeTask.addTask(() => {
if (index === kfdmArr.length - 1) {
avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`, voiceURL], false, () => {
this.endLoading(true)
})
} else {
avPlayer.playAudio([`voice/${kf.markcatalog}.mp3`])
}
})
}
})
}
this.confirmMark(this.kfdmArr.map((kf) => ({
xmdm: kf.xmdm,
kfdm: kf.kfdm,
})))
} }
//项目开始 //项目开始
async beginProject() { async beginProject() {
//项目开始 //过程照片 //扣分 //结束考试 //项目开始 //过程照片 //扣分 //结束考试
const carInfo: CarInfoType = this.carInfo; // const carInfo: CarInfoType = this.carInfo;
const { examSubject, plateNo } = carInfo; // const { examSubject, plateNo } = carInfo;
const { serialNumber, lsh, idCard, ksxl, kslx, ksdd } = this // const { serialNumber, lsh, idCard, ksxl, kslx, ksdd } = this
const time = GetCurrentTime(); const time = GetCurrentTime();
const beginData = { const beginData: RegulatoryInterfaceParams = {
xtlb: '17', xtlb: '17',
jkxlh: serialNumber, jkxlh: this.serialNumber.toString(),
jkid: '17C52', jkid: '17C52',
drvexam: { drvexam: {
// 考试科目 身份证号码 // 考试科目 身份证号码
lsh, lsh: this.lsh,
kskm: examSubject, kskm: this.carInfo.examSubject,
sfzmhm: idCard, sfzmhm: this.idCard,
ksxm: '40100', ksxm: '40100',
ksxl, ksxl: this.ksxl,
kchp: decodeURI(plateNo), kchp: decodeURI(this.carInfo.plateNo || ""),
ksdd: decodeURI(ksdd), ksdd: decodeURI(this.ksdd),
kslx: decodeURI(kslx) || '', kslx: decodeURI(this.kslx) || '',
kssj: time kssj: time
}, },
} }
@ -243,27 +200,27 @@ export default struct DeductedPopup {
//过程照片 //过程照片
async uploadProgressPhoto() { async uploadProgressPhoto() {
const { serialNumber, lsh, idCard, ksdd, kfdmArr, getPhoto } = this; // const { serialNumber, lsh, idCard, ksdd, kfdmArr, getPhoto } = this;
const carInfo = this.carInfo; // const carInfo = this.carInfo;
const { examSubject, plateNo, carNo } = carInfo; // const { examSubject, plateNo, carNo } = carInfo;
const time = GetCurrentTime(); const time = GetCurrentTime();
console.info('surenjun uploadProgressPhoto',) console.info('surenjun uploadProgressPhoto',)
const photoBase64 = await getPhoto() const photoBase64 = await this.getPhoto()
const photoData = { const photoData: RegulatoryInterfaceParams = {
xtlb: '17', xtlb: '17',
jkxlh: serialNumber, jkxlh: this.serialNumber.toString(),
jkid: '17C54', jkid: '17C54',
drvexam: { drvexam: {
lsh, lsh: this.lsh,
kskm: examSubject, kskm: this.carInfo.examSubject,
ksxm: '40100', ksxm: '40100',
sfzmhm: idCard, sfzmhm: this.idCard,
kchp: decodeURI(plateNo), kchp: decodeURI(this.carInfo.plateNo || ""),
zpsj: time, zpsj: time,
// zp: encodeURIComponent(photoBase64), // zp: encodeURIComponent(photoBase64),
zp: photoBase64, zp: photoBase64,
cs: 0, cs: 0,
ksdd: decodeURI(ksdd) ksdd: decodeURI(this.ksdd)
} }
}; };
const code = await writeObjectOut(photoData); const code = await writeObjectOut(photoData);
@ -272,27 +229,24 @@ export default struct DeductedPopup {
// 扣分 // 扣分
async kfFn() { async kfFn() {
const { serialNumber, lsh, idCard, ksdd, kfdmArr } = this; const kfLen = this.kfdmArr.length;
const kfLen = kfdmArr.length; const kf = this.kfdmArr[kfLen -1];
const kf = kfdmArr[kfLen -1];
const carInfo: CarInfoType = this.carInfo;
const { examSubject } = this.carInfo;
const time = GetCurrentTime(); const time = GetCurrentTime();
const kfData = { const kfData: RegulatoryInterfaceParams = {
xtlb: '17', xtlb: '17',
jkxlh: serialNumber, jkxlh: this.serialNumber.toString(),
jkid: '17C53', jkid: '17C53',
drvexam: { drvexam: {
lsh, lsh: this.lsh,
kskm: examSubject, kskm: this.carInfo.examSubject,
// 通用评判科二10000科三30000 // 通用评判科二10000科三30000
ksxm: 40100, ksxm: "40100",
kfxm: kf.markcatalog, kfxm: kf.markcatalog,
kfxmmx: `${'1'},${kf.kfdm}`, kfxmmx: `${'1'},${kf.kfdm}`,
sfzmhm: idCard, sfzmhm: this.idCard,
kchp: decodeURI(carInfo.plateNo), kchp: decodeURI(this.carInfo.plateNo || ""),
kffs: 2, kffs: 2,
ksdd: decodeURI(ksdd), ksdd: decodeURI(this.ksdd),
kfsj: time kfsj: time
} }
} }
@ -301,24 +255,21 @@ export default struct DeductedPopup {
// 项目结束 // 项目结束
async endProject() { async endProject() {
const carInfo = this.carInfo;
const { examSubject, plateNo, carNo } = carInfo;
const { lsh, idCard, serialNumber, ksdd, kslx, ksxl, } = this;
const time = GetCurrentTime(); const time = GetCurrentTime();
const endProjectData = { const endProjectData: RegulatoryInterfaceParams = {
xtlb: '17', xtlb: '17',
jkxlh: serialNumber, jkxlh: this.serialNumber.toString(),
jkid: '17C55', jkid: '17C55',
drvexam: { drvexam: {
lsh, lsh: this.lsh,
kskm: examSubject, kskm: this.carInfo.examSubject,
sfzmhm: idCard, sfzmhm: this.idCard,
ksxm: '40100', ksxm: '40100',
czlx: '1', czlx: '1',
ksxl, ksxl: this.ksxl,
kchp: decodeURI(plateNo), kchp: decodeURI(this.carInfo.plateNo || ""),
ksdd: decodeURI(ksdd), ksdd: decodeURI(this.ksdd),
kslx: encodeURI(kslx) || '', kslx: encodeURI(this.kslx) || '',
jssj: time jssj: time
} }
} }
@ -327,24 +278,21 @@ export default struct DeductedPopup {
//考试结束 //考试结束
async endFn() { async endFn() {
const { serialNumber, lsh, idCard, score, getPhoto } = this;
const carInfo: CarInfoType = this.carInfo;
const { examSubject, plateNo } = carInfo;
const time = GetCurrentTime(); const time = GetCurrentTime();
const photoBase64 = await getPhoto(); const photoBase64 = await this.getPhoto()
const endData = { const endData: RegulatoryInterfaceParams = {
xtlb: '17', xtlb: '17',
jkxlh: serialNumber, jkxlh: this.serialNumber.toString(),
jkid: '17C56', jkid: '17C56',
drvexam: { drvexam: {
lsh, lsh: this.lsh,
kchp: decodeURI(plateNo), kchp: decodeURI(this.carInfo.plateNo || ""),
kskm: examSubject, kskm: this.carInfo.examSubject,
sfzmhm: idCard, sfzmhm: this.idCard,
// zp: encodeURIComponent(photoBase64), // zp: encodeURIComponent(photoBase64),
zp: photoBase64, zp: photoBase64,
jssj: time, jssj: time,
kscj: (score * 1) > 0 ? score : 0, kscj: (this.score * 1) > 0 ? this.score : 0,
kslc: 0, kslc: 0,
dwlc: '', dwlc: '',
} }
@ -359,41 +307,52 @@ export default struct DeductedPopup {
syssetParams.forEach(sys => { syssetParams.forEach(sys => {
//监管序列号 //监管序列号
if (sys.v_no == '901') { if (sys.v_no == '901') {
this.serialNumber = sys.v_value || '123456' this.serialNumber = Number(sys.v_value) || 123456
} }
//364 绕车一周评判时机(1-开始考试后判 2-开始考试前判) //364 绕车一周评判时机(1-开始考试后判 2-开始考试前判)
if (sys.v_no == '364') { if (sys.v_no == '364') {
const isOpen = sys.v_value == 2 const isOpen = sys.v_value == "2"
if (isOpen) { if (isOpen) {
this.avPlayer.playAudio(['voice/上车准备.mp3']) this.avPlayer.playAudio(['voice/上车准备.mp3'])
} }
} }
this.judgeConfigObj[sys.v_no] = decodeURIComponent(sys.v_value) if (sys.v_no) {
this.judgeConfigObj[sys.v_no] = decodeURIComponent(sys.v_value || '');
}
}) })
} }
//获取markrule表数据 //获取markrule表数据
async initMarkRules(markRules ?: MarkRule[]) { async initMarkRules(markRules ?: MarkRule[]) {
const markRuleParams = markRules || (await getSyncData('MA_MARKRULE') as MarkRule[]) const markRuleParams = markRules || (await GetSyncData('MA_MARKRULE') as MarkRule[])
markRuleParams.forEach(mark => { markRuleParams.forEach(mark => {
const tempObj = { const tempObj: MarkRule = {
itemno: mark.itemno * 1, itemno: Number(mark.itemno),
markcatalog: mark.markcatalog, markcatalog: mark.markcatalog,
markshow: decodeURI(mark.markshow), markshow: decodeURI(mark.markshow || ""),
markreal: mark.markreal * 1, markreal: Number(mark.markreal),
markstandard: mark.markstandard * 1, markstandard: Number(mark.markstandard),
markserial: mark.markserial, markserial: mark.markserial,
kfxh: mark.kfxh, kfxh: mark.kfxh,
OnlyOneKind: mark.onlyoneid * 1, OnlyOneKind: Number(mark.onlyoneid),
NoCancelId: mark.nocancelid * 1, NoCancelId: Number(mark.nocancelid),
GPS_SID: mark.gps_sid == 0 ? false : true GPS_SID: mark.gps_sid == 0 ? false : true
} }
if (mark.itemno == 1 && Number(mark.markserial) > 100 && Number(mark.markserial) < 200) { if (mark.itemno == 1 && Number(mark.markserial) > 100 && Number(mark.markserial) < 200) {
this.markRuleListObj[`${mark.itemno}_${mark.markserial}`] = { this.markRuleListObj[`${mark.itemno}_${mark.markserial}`] = {
...tempObj, itemno: tempObj.itemno,
markcatalog: tempObj.markcatalog,
markshow: tempObj.markshow,
markreal: tempObj.markreal,
markstandard: tempObj.markstandard,
markserial: mark.markserial, markserial: mark.markserial,
kfxh: tempObj.kfxh,
OnlyOneKind: tempObj.OnlyOneKind,
NoCancelId: tempObj.NoCancelId,
GPS_SID: tempObj.GPS_SID,
}; };
this.universalMarkRules.push(tempObj) this.universalMarkRules.push(tempObj)
} }
@ -403,22 +362,22 @@ export default struct DeductedPopup {
// 获取考生信息 // 获取考生信息
async initStudent() { async initStudent() {
const students = await getSyncData('USER') const students = await GetSyncData<User>('USER')
const stuInfo = students[0] || {}; const stuInfo: User = students[0];
const { xm, sfzmhm, lsh, kszp, ksdd, kssycs, kslx, ksxl } = stuInfo; // const { xm, sfzmhm, lsh, kszp, ksdd, kssycs, kslx, ksxl } = stuInfo;
this.name = xm || '测试考生'; this.name = stuInfo.xm || '测试考生';
this.idCard = sfzmhm || '01234567891010'; this.idCard = stuInfo.sfzmhm || '01234567891010';
this.lsh = lsh; this.lsh = stuInfo.lsh;
this.kszp = kszp; this.kszp = stuInfo.kszp;
this.ksdd = ksdd; this.ksdd = stuInfo.ksdd;
this.kssycs = kssycs; this.kssycs = stuInfo.kssycs;
this.kslx = kslx; this.kslx = stuInfo.kslx || "";
this.ksxl = ksxl; this.ksxl = stuInfo.ksxl;
} }
//上一页 下一页 //上一页 下一页
goPage(typeIndex) { goPage(typeIndex: number) {
const currentIndex = this.currentIndex const currentIndex = this.currentIndex
if (currentIndex) { if (currentIndex) {
//通用评判 //通用评判
@ -430,26 +389,24 @@ export default struct DeductedPopup {
} }
//选中扣分项 //选中扣分项
getSelectedLine(index) { getSelectedLine(index: number) {
const { selectedLine, selectedLineStyle, lineBg } = this; if (this.selectedLine === index) {
if (selectedLine === index) { return this.selectedLineStyle.bgColor
return selectedLineStyle.bgColor
} }
if (index % 2 === 0) { if (index % 2 === 0) {
return lineBg[0] return this.lineBg[0]
} else { } else {
return lineBg[1] return this.lineBg[1]
} }
} }
//获取当前页的数据 //获取当前页的数据
getCurrentMarkRuleList() { getCurrentMarkRuleList() {
const { currentIndex, currentUniversalPageIndex, currentPageIndex, universalMarkRules } = this; if (this.currentIndex) {
if (currentIndex) {
//通用评判 //通用评判
return universalMarkRules.slice(currentUniversalPageIndex * 7, (currentUniversalPageIndex + 1) * 7) return this.universalMarkRules.slice(this.currentUniversalPageIndex * 7, (this.currentUniversalPageIndex + 1) * 7)
} else { } else {
return universalMarkRules.slice(currentPageIndex * 7, (currentPageIndex + 1) * 7) return this.universalMarkRules.slice(this.currentPageIndex * 7, (this.currentPageIndex + 1) * 7)
} }
} }
@ -459,7 +416,7 @@ export default struct DeductedPopup {
Column() { Column() {
Row() { Row() {
Row() { Row() {
ForEach(['人工评判'], (text, index) => { ForEach(['人工评判'], (text: string, index) => {
Row() { Row() {
Text(text) Text(text)
@ -549,7 +506,7 @@ export default struct DeductedPopup {
}.width('100%').justifyContent(FlexAlign.SpaceBetween) }.width('100%').justifyContent(FlexAlign.SpaceBetween)
Column() { Column() {
ForEach(this.getCurrentMarkRuleList(), (item, index) => { ForEach(this.getCurrentMarkRuleList(), (item: MarkRule, index) => {
Row() { Row() {
Text(`${item.markshow} (${item.markcatalog})`).fontColor('#FFF').fontSize(this.fontSize).fontWeight(500) Text(`${item.markshow} (${item.markcatalog})`).fontColor('#FFF').fontSize(this.fontSize).fontWeight(500)
Row() { Row() {

View File

@ -12,6 +12,9 @@
// } // }
@Component @Component
export default struct RealTime { export default struct RealTime {
private widthNumber: string | number | Resource = 0
private heightNumber: string | number | Resource = 0
build() { build() {
} }
} }