Compare commits
3 Commits
aa878365fe
...
059471385f
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
059471385f | ||
|
|
2f683c70e2 | ||
|
|
4330fcfd5f |
@ -5,6 +5,7 @@ import { MASYSSETTableType, RegulatoryInterfaceParams } from '../model';
|
|||||||
import { GetSyncData } from '../utils/table/Operation';
|
import { GetSyncData } from '../utils/table/Operation';
|
||||||
import { GetCurrentTime } from '../utils/Common';
|
import { GetCurrentTime } from '../utils/Common';
|
||||||
import FileUtils from '../utils/FileUtils';
|
import FileUtils from '../utils/FileUtils';
|
||||||
|
import common from '@ohos.app.ability.common';
|
||||||
|
|
||||||
let baseHost: string = AppStorage.get<string>('host');
|
let baseHost: string = AppStorage.get<string>('host');
|
||||||
|
|
||||||
@ -26,7 +27,9 @@ interface WR {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 通用监管接口
|
// 通用监管接口
|
||||||
export async function writeObjectOut(params: RegulatoryInterfaceParams, filePath?: string): Promise<WR> {
|
export async function writeObjectOut(params: RegulatoryInterfaceParams, filePath: string,
|
||||||
|
context: common.UIAbilityContext): Promise<WR> {
|
||||||
|
|
||||||
const singlePlay: boolean = AppStorage.get<boolean>('singlePlay')
|
const singlePlay: boolean = AppStorage.get<boolean>('singlePlay')
|
||||||
if (singlePlay) {
|
if (singlePlay) {
|
||||||
return { code: 1 }
|
return { code: 1 }
|
||||||
@ -52,7 +55,7 @@ export async function writeObjectOut(params: RegulatoryInterfaceParams, filePath
|
|||||||
const isJGNew: boolean = AppStorage.get<boolean>('isJGNew')
|
const isJGNew: boolean = AppStorage.get<boolean>('isJGNew')
|
||||||
//新监管调用
|
//新监管调用
|
||||||
if (isJGNew) {
|
if (isJGNew) {
|
||||||
return await writeObjectOutNew(params, filePath)
|
return await writeObjectOutNew(params, filePath, context)
|
||||||
}
|
}
|
||||||
params.drvexam.zp = params.drvexam.zp === undefined ? undefined : encodeURIComponent(drvexam.zp)
|
params.drvexam.zp = params.drvexam.zp === undefined ? undefined : encodeURIComponent(drvexam.zp)
|
||||||
|
|
||||||
@ -73,7 +76,7 @@ export async function writeObjectOut(params: RegulatoryInterfaceParams, filePath
|
|||||||
}
|
}
|
||||||
|
|
||||||
//对象转换成xml
|
//对象转换成xml
|
||||||
JGHOST = AppStorage.get<string>("JGHOST")
|
JGHOST = AppStorage.get<string>("JGHOST") || ""
|
||||||
const temp = await request<object>({
|
const temp = await request<object>({
|
||||||
host: JGHOST,
|
host: JGHOST,
|
||||||
url: '/dems_ws/services/TmriOutAccess?wsdl',
|
url: '/dems_ws/services/TmriOutAccess?wsdl',
|
||||||
@ -132,7 +135,7 @@ interface UploadExamProgressDataParams {
|
|||||||
// 过程文件上传
|
// 过程文件上传
|
||||||
export async function uploadExamProgressData(params: UploadExamProgressDataParams) {
|
export async function uploadExamProgressData(params: UploadExamProgressDataParams) {
|
||||||
// const singlePlay = globalThis.singlePlay
|
// const singlePlay = globalThis.singlePlay
|
||||||
const singlePlay: boolean = AppStorage.get<boolean>('singlePlay')
|
const singlePlay: boolean = AppStorage.get<boolean>('singlePlay') || false
|
||||||
if (singlePlay) {
|
if (singlePlay) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -169,7 +172,7 @@ interface UploadExamProgressDataParams2 {
|
|||||||
|
|
||||||
export async function uploadExamProgressData2(params: UploadExamProgressDataParams2) {
|
export async function uploadExamProgressData2(params: UploadExamProgressDataParams2) {
|
||||||
// const singlePlay = globalThis.singlePlay
|
// const singlePlay = globalThis.singlePlay
|
||||||
const singlePlay: boolean = AppStorage.get<boolean>('singlePlay')
|
const singlePlay: boolean = AppStorage.get<boolean>('singlePlay') || false
|
||||||
if (singlePlay) {
|
if (singlePlay) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -204,7 +207,7 @@ interface UploadExamMileage {
|
|||||||
// 上传考试里程
|
// 上传考试里程
|
||||||
export async function uploadExamMileage(params: UploadExamMileage) {
|
export async function uploadExamMileage(params: UploadExamMileage) {
|
||||||
// const singlePlay = globalThis.singlePlay
|
// const singlePlay = globalThis.singlePlay
|
||||||
const singlePlay: boolean = AppStorage.get<boolean>('singlePlay')
|
const singlePlay: boolean = AppStorage.get<boolean>('singlePlay') || false
|
||||||
|
|
||||||
if (singlePlay) {
|
if (singlePlay) {
|
||||||
return
|
return
|
||||||
@ -231,7 +234,7 @@ export async function uploadExamMileage(params: UploadExamMileage) {
|
|||||||
// 上传考试成绩
|
// 上传考试成绩
|
||||||
export async function uploadExamGrade(params: ESObject) {
|
export async function uploadExamGrade(params: ESObject) {
|
||||||
// const singlePlay = globalThis.singlePlay
|
// const singlePlay = globalThis.singlePlay
|
||||||
const singlePlay: boolean = AppStorage.get<boolean>('singlePlay')
|
const singlePlay: boolean = AppStorage.get<boolean>('singlePlay') || false
|
||||||
if (singlePlay) {
|
if (singlePlay) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|||||||
@ -28,8 +28,9 @@ interface WR {
|
|||||||
code: number
|
code: number
|
||||||
}
|
}
|
||||||
|
|
||||||
export default async function writeObjectOutNew(data: RegulatoryInterfaceParams, filePath: string): Promise<WR> {
|
export default async function writeObjectOutNew(data: RegulatoryInterfaceParams, filePath: string,
|
||||||
const context: common.UIAbilityContext = AppStorage.get('context')
|
context: common.UIAbilityContext): Promise<WR> {
|
||||||
|
// const context: common.UIAbilityContext = AppStorage.get('context')
|
||||||
const fileUtil = new FileUtils(context);
|
const fileUtil = new FileUtils(context);
|
||||||
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);
|
||||||
|
|||||||
@ -172,6 +172,7 @@ struct UserInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
private context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext;
|
||||||
private title = ''
|
private title = ''
|
||||||
private type = '2'
|
private type = '2'
|
||||||
errorDialog: CustomDialogController = new CustomDialogController({
|
errorDialog: CustomDialogController = new CustomDialogController({
|
||||||
@ -199,7 +200,6 @@ struct UserInfo {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
private avPlayer!: VoiceAnnounce
|
private avPlayer!: VoiceAnnounce
|
||||||
private context = getContext(this) as common.UIAbilityContext;
|
|
||||||
private labelBlocks: LabelBlockType[] = [
|
private labelBlocks: LabelBlockType[] = [
|
||||||
{ label: '考生姓名', key: 'xm' },
|
{ label: '考生姓名', key: 'xm' },
|
||||||
{ label: '身份证号', key: 'sfzmhm' },
|
{ label: '身份证号', key: 'sfzmhm' },
|
||||||
@ -1045,7 +1045,7 @@ struct UserInfo {
|
|||||||
jkid: '17C51',
|
jkid: '17C51',
|
||||||
}
|
}
|
||||||
console.info('surenjunjianguan', JSON.stringify(param))
|
console.info('surenjunjianguan', JSON.stringify(param))
|
||||||
const temp = await writeObjectOut(param);
|
const temp = await writeObjectOut(param, "", this.context);
|
||||||
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)
|
||||||
|
|||||||
@ -190,12 +190,12 @@ 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,
|
||||||
firstImage: this.firstImage.substr(22),
|
firstImage: this.firstImage.substr(22),
|
||||||
secondImage: data.base64 || "",
|
secondImage: data?.base64 || "",
|
||||||
type: "2",
|
type: "2",
|
||||||
verifyType: "1"
|
verifyType: "1"
|
||||||
})
|
})
|
||||||
|
|||||||
@ -191,7 +191,7 @@ export default struct DeductedPopup {
|
|||||||
kssj: time
|
kssj: time
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
const code = await writeObjectOut(beginData)
|
const code = await writeObjectOut(beginData, "", this.context)
|
||||||
//TODO code待处理
|
//TODO code待处理
|
||||||
// if (code == 1) {
|
// if (code == 1) {
|
||||||
//
|
//
|
||||||
@ -223,7 +223,7 @@ export default struct DeductedPopup {
|
|||||||
ksdd: decodeURI(this.ksdd)
|
ksdd: decodeURI(this.ksdd)
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
const code = await writeObjectOut(photoData);
|
const code = await writeObjectOut(photoData, "", this.context);
|
||||||
console.info('surenjun uploadProgressPhoto end',)
|
console.info('surenjun uploadProgressPhoto end',)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -250,7 +250,7 @@ export default struct DeductedPopup {
|
|||||||
kfsj: time
|
kfsj: time
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const code = await writeObjectOut(kfData);
|
const code = await writeObjectOut(kfData, "", this.context);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 项目结束
|
// 项目结束
|
||||||
@ -273,7 +273,7 @@ export default struct DeductedPopup {
|
|||||||
jssj: time
|
jssj: time
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const code = await writeObjectOut(endProjectData);
|
const code = await writeObjectOut(endProjectData, "", this.context);
|
||||||
}
|
}
|
||||||
|
|
||||||
//考试结束
|
//考试结束
|
||||||
@ -297,7 +297,7 @@ export default struct DeductedPopup {
|
|||||||
dwlc: '',
|
dwlc: '',
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
const code = await writeObjectOut(endData);
|
const code = await writeObjectOut(endData, "", this.context);
|
||||||
}
|
}
|
||||||
|
|
||||||
//获取sysset表数据
|
//获取sysset表数据
|
||||||
|
|||||||
@ -179,6 +179,38 @@ export default class Judge {
|
|||||||
private isExamEnd: boolean
|
private isExamEnd: boolean
|
||||||
// 是否发送udp
|
// 是否发送udp
|
||||||
private isUdpEnd: boolean = false
|
private isUdpEnd: boolean = false
|
||||||
|
// 处理udp plc信号
|
||||||
|
handleUdp = async (msg: string) => {
|
||||||
|
console.info('plc信号', msg)
|
||||||
|
const stachArr = msg.split(',')
|
||||||
|
if (stachArr[0] != '#DN_GD' || this.isUdpEnd) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
const plcData = await this.getPlcData(msg);
|
||||||
|
// 4.过程数据
|
||||||
|
await this.fileLog.setExamJudgeData(JSON.stringify(plcData))
|
||||||
|
//检测到有无锡所设备接入,需要发送特定的数据,供检测
|
||||||
|
// if (this.usbService.isWXUSBDevice) {
|
||||||
|
// const str = await senorToWXDataStr(msg);
|
||||||
|
// this.usbService.sendUSB(str)
|
||||||
|
// }
|
||||||
|
const param350: number = Reflect.get(this.judgeUI.judgeConfigObj, '350')
|
||||||
|
this.judgeUI.sd = ((param350 == 0 ? plcData.gps.sd : plcData.sensor.cs) as number * 1.852).toFixed(0) + ''
|
||||||
|
this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + ''
|
||||||
|
//TODO 暂时关闭差分检测异常
|
||||||
|
// await this.checkDwzt(plcData.gps.dwzt,plcData.gps.jdzt);
|
||||||
|
if (!this.isExamEnd) {
|
||||||
|
await examJudgeRealExam(plcData)
|
||||||
|
}
|
||||||
|
let udpIndex = AppStorage.get<number>('udpIndex');
|
||||||
|
if (udpIndex % 5 === 0 && !this.isUdpEnd) {
|
||||||
|
// TODO UPD缺失
|
||||||
|
// const judgeUdp = globalThis.judgeUdp
|
||||||
|
// const bytes = await this.getMessageHeartbeat(this.isExamEnd);
|
||||||
|
// judgeUdp.send(bytes)
|
||||||
|
}
|
||||||
|
AppStorage.setOrCreate('udpIndex', udpIndex++)
|
||||||
|
}
|
||||||
//是否手动结束考试
|
//是否手动结束考试
|
||||||
private isManual: boolean
|
private isManual: boolean
|
||||||
//UDP服务序列号
|
//UDP服务序列号
|
||||||
@ -226,60 +258,6 @@ export default class Judge {
|
|||||||
console.info(judgeTag, '过程数据文件上传 end')
|
console.info(judgeTag, '过程数据文件上传 end')
|
||||||
}
|
}
|
||||||
private judgeTask: JudgeTask
|
private judgeTask: JudgeTask
|
||||||
// 检测扣分、结束项目时该项目是否开始
|
|
||||||
checkProjectIsStart = async (xmdm: number, currentType: 1 | 2, kf?: JudgeEventKf) => {
|
|
||||||
if (xmdm == 20) {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
const judgeUI = this.judgeUI;
|
|
||||||
const judgeTask = this.judgeTask;
|
|
||||||
const projectsObj = this.judgeUI.projectsObj
|
|
||||||
const currentProject: ProjectInfo = Reflect.get(projectsObj, xmdm)
|
|
||||||
const isUpload = currentProject.isUpload
|
|
||||||
|
|
||||||
//如果项目没有开始
|
|
||||||
console.info('surenjun isUpload=>', isUpload)
|
|
||||||
if (!isUpload) {
|
|
||||||
console.info(judgeTag, '项目补传开始')
|
|
||||||
//项目开始补传
|
|
||||||
judgeTask.addTask(async () => {
|
|
||||||
await this.beginProject(xmdm)
|
|
||||||
}, {
|
|
||||||
isDelay: true
|
|
||||||
})
|
|
||||||
judgeTask.addTask(async () => {
|
|
||||||
await this.uploadProgressPhoto(xmdm)
|
|
||||||
}, {
|
|
||||||
isDelay: true
|
|
||||||
})
|
|
||||||
currentProject.isUpload = true;
|
|
||||||
Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject)
|
|
||||||
//扣分补传
|
|
||||||
if (currentType == 2) {
|
|
||||||
judgeTask.addTask(async () => {
|
|
||||||
await this.pointsDedute(xmdm, kf)
|
|
||||||
}, {
|
|
||||||
isDelay: true
|
|
||||||
})
|
|
||||||
}
|
|
||||||
//扣分补传判断是否合格 不合格补传项目结束
|
|
||||||
if (currentType == 1 || (currentType == 2 && this.totalScore < judgeUI.passingScore)) {
|
|
||||||
judgeTask.addTask(async () => {
|
|
||||||
await this.endProject(xmdm)
|
|
||||||
}, {
|
|
||||||
isDelay: true
|
|
||||||
})
|
|
||||||
currentProject.isEnd = true;
|
|
||||||
Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject)
|
|
||||||
}
|
|
||||||
judgeTask.addTask(async () => {
|
|
||||||
this.checkExamIsEnd()
|
|
||||||
})
|
|
||||||
return false;
|
|
||||||
} else {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private tempData: Plc
|
private tempData: Plc
|
||||||
//实时计算gps经纬度距离
|
//实时计算gps经纬度距离
|
||||||
handDistance = async () => {
|
handDistance = async () => {
|
||||||
@ -443,38 +421,6 @@ export default class Judge {
|
|||||||
AppStorage.setOrCreate('msgStr', plc)
|
AppStorage.setOrCreate('msgStr', plc)
|
||||||
return tempData
|
return tempData
|
||||||
}
|
}
|
||||||
// 处理udp plc信号
|
|
||||||
handleUdp = async (msg: string) => {
|
|
||||||
console.info('plc信号', msg)
|
|
||||||
const stachArr = msg.split(',')
|
|
||||||
if (stachArr[0] != '#DN_GD' || this.isUdpEnd) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const plcData = await this.getPlcData(msg);
|
|
||||||
// 4.过程数据
|
|
||||||
await this.fileLog.setExamJudgeData(JSON.stringify(plcData))
|
|
||||||
//检测到有无锡所设备接入,需要发送特定的数据,供检测
|
|
||||||
// if (this.usbService.isWXUSBDevice) {
|
|
||||||
// const str = await senorToWXDataStr(msg);
|
|
||||||
// this.usbService.sendUSB(str)
|
|
||||||
// }
|
|
||||||
const param350: number = Reflect.get(this.judgeUI.judgeConfigObj, '350')
|
|
||||||
this.judgeUI.sd = ((param350 == 0 ? plcData.gps.sd : plcData.sensor.cs) as number * 1.852).toFixed(0) + ''
|
|
||||||
this.judgeUI.dw = (Math.floor(plcData.sensor.dw as number) || 0) + ''
|
|
||||||
//TODO 暂时关闭差分检测异常
|
|
||||||
// await this.checkDwzt(plcData.gps.dwzt,plcData.gps.jdzt);
|
|
||||||
if (!this.isExamEnd) {
|
|
||||||
await examJudgeRealExam(plcData)
|
|
||||||
}
|
|
||||||
let udpIndex = AppStorage.get<number>('udpIndex');
|
|
||||||
if (udpIndex % 5 === 0 && !this.isUdpEnd) {
|
|
||||||
// TODO UPD缺失
|
|
||||||
// const judgeUdp = globalThis.judgeUdp
|
|
||||||
// const bytes = await this.getMessageHeartbeat(this.isExamEnd);
|
|
||||||
// judgeUdp.send(bytes)
|
|
||||||
}
|
|
||||||
AppStorage.setOrCreate('udpIndex', udpIndex++)
|
|
||||||
}
|
|
||||||
// 处理轨迹plc信号
|
// 处理轨迹plc信号
|
||||||
handleTrajectoryUdp = async (strArr: string[]) => {
|
handleTrajectoryUdp = async (strArr: string[]) => {
|
||||||
// const { fileLog, setJudgeItem, setJudgeMark, endExam } = this;
|
// const { fileLog, setJudgeItem, setJudgeMark, endExam } = this;
|
||||||
@ -513,9 +459,9 @@ export default class Judge {
|
|||||||
}
|
}
|
||||||
//本地轨迹回放地址
|
//本地轨迹回放地址
|
||||||
private trajectoryPath: string
|
private trajectoryPath: string
|
||||||
//当前科目二的考试项目
|
|
||||||
// private currentKm2ItemsObj: any
|
// private currentKm2ItemsObj: any
|
||||||
private isTrajectoryOpen: boolean;
|
private isTrajectoryOpen: boolean;
|
||||||
|
//当前科目二的考试项目
|
||||||
// 调代理接口是否断网了
|
// 调代理接口是否断网了
|
||||||
private isJudgeDisConnect: boolean;
|
private isJudgeDisConnect: boolean;
|
||||||
// 断网数据补传
|
// 断网数据补传
|
||||||
@ -527,9 +473,70 @@ export default class Judge {
|
|||||||
const examDataStr = await this.fileUtil.readFile(`${folderPath}/wuxi_dis_progress_data.txt`);
|
const examDataStr = await this.fileUtil.readFile(`${folderPath}/wuxi_dis_progress_data.txt`);
|
||||||
const examDataArr = examDataStr.split('\n');
|
const examDataArr = examDataStr.split('\n');
|
||||||
for (let examDataStr of examDataArr) {
|
for (let examDataStr of examDataArr) {
|
||||||
const code = await writeObjectOut(JSON.parse(examDataStr));
|
const code = await writeObjectOut(JSON.parse(examDataStr), "", this.context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// 考试过程照片
|
||||||
|
uploadProgressPhoto = async (ksxm: number) => {
|
||||||
|
const time = GetCurrentTime();
|
||||||
|
const judgeUI = this.judgeUI
|
||||||
|
const plcData = this.plcData
|
||||||
|
const photoBase64 = await this.getPhoto();
|
||||||
|
const carInfo = AppStorage.get<CarInfoType>('carInfo');
|
||||||
|
|
||||||
|
const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, ksxm)
|
||||||
|
const judgeConfig_305: number = Reflect.get(judgeUI.judgeConfigObj, '305')
|
||||||
|
const drvexam: DrvexamType = {
|
||||||
|
lsh: judgeUI.lsh,
|
||||||
|
kskm: carInfo.examSubject,
|
||||||
|
ksxm: project.projectCodeCenter,
|
||||||
|
sfzmhm: judgeUI.idCard,
|
||||||
|
kchp: encodeURI(carInfo.plateNo),
|
||||||
|
zpsj: time,
|
||||||
|
zp: photoBase64,
|
||||||
|
cs: Math.floor((judgeConfig_305 == 0 ? plcData.gps.sd : plcData.sensor.cs) * 1.852),
|
||||||
|
ksdd: encodeURI(judgeUI.ksdd)
|
||||||
|
}
|
||||||
|
const data: RegulatoryInterfaceParams = {
|
||||||
|
xtlb: '17',
|
||||||
|
jkxlh: judgeUI.serialNumber,
|
||||||
|
jkid: '17C54',
|
||||||
|
drvexam
|
||||||
|
};
|
||||||
|
const temp: WR = await this.sendWriteObjectOut(data, this.filePath);
|
||||||
|
if (temp.code === 2300007) {
|
||||||
|
this.isJudgeDisConnect = true
|
||||||
|
}
|
||||||
|
promptWxCode('17C54', temp.code)
|
||||||
|
console.info(judgeTag, '上传照片 end')
|
||||||
|
}
|
||||||
|
private artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11]
|
||||||
|
private lane: LANE = {
|
||||||
|
road: '', num: 0, count: 0
|
||||||
|
}
|
||||||
|
private videoData: RecordHandleType
|
||||||
|
private disConnectNum: number = 0;
|
||||||
|
//调用监管接口
|
||||||
|
sendWriteObjectOut: SendWriteObjectOut = async (data, filePath) => {
|
||||||
|
const temp = await writeObjectOut(data, filePath, this.context);
|
||||||
|
console.log("wzj", JSON.stringify(temp))
|
||||||
|
//断网&网络超时次数计算
|
||||||
|
if (temp.code == 2300007 || temp.code == 2300028) {
|
||||||
|
this.disConnectNum += 1;
|
||||||
|
if (this.disConnectNum < 5) {
|
||||||
|
return await this.sendWriteObjectOut(data, filePath)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (this.disConnectNum >= 5) {
|
||||||
|
console.info('surenjun', '123')
|
||||||
|
this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!';
|
||||||
|
this.judgeUI.disConnectErrorOpen = true
|
||||||
|
}
|
||||||
|
|
||||||
|
this.disConnectNum = 0
|
||||||
|
return temp
|
||||||
|
}
|
||||||
// 项目开始接口同步
|
// 项目开始接口同步
|
||||||
beginProject = async (ksxm: number) => {
|
beginProject = async (ksxm: number) => {
|
||||||
const carInfo = AppStorage.get<CarInfoType>('carInfo');
|
const carInfo = AppStorage.get<CarInfoType>('carInfo');
|
||||||
@ -599,66 +606,59 @@ export default class Judge {
|
|||||||
console.info(judgeTag, '项目结束 end')
|
console.info(judgeTag, '项目结束 end')
|
||||||
promptWxCode('17C55', temp.code)
|
promptWxCode('17C55', temp.code)
|
||||||
}
|
}
|
||||||
private artSubject3ProjectsCodesArr: number[] = [3, 9, 4, 10, 12, 11]
|
// 检测扣分、结束项目时该项目是否开始
|
||||||
private lane: LANE = {
|
checkProjectIsStart = async (xmdm: number, currentType: 1 | 2, kf?: JudgeEventKf) => {
|
||||||
road: '', num: 0, count: 0
|
if (xmdm == 20) {
|
||||||
}
|
return true
|
||||||
private videoData: RecordHandleType
|
}
|
||||||
private disConnectNum: number = 0;
|
const judgeUI = this.judgeUI;
|
||||||
//调用监管接口
|
const judgeTask = this.judgeTask;
|
||||||
sendWriteObjectOut: SendWriteObjectOut = async (data, filePath) => {
|
const projectsObj = this.judgeUI.projectsObj
|
||||||
const temp = await writeObjectOut(data, filePath);
|
const currentProject: ProjectInfo = Reflect.get(projectsObj, xmdm)
|
||||||
console.log("wzj", JSON.stringify(temp))
|
const isUpload = currentProject.isUpload
|
||||||
//断网&网络超时次数计算
|
|
||||||
if (temp.code == 2300007 || temp.code == 2300028) {
|
//如果项目没有开始
|
||||||
this.disConnectNum += 1;
|
console.info('surenjun isUpload=>', isUpload)
|
||||||
if (this.disConnectNum < 5) {
|
if (!isUpload) {
|
||||||
return await this.sendWriteObjectOut(data, filePath)
|
console.info(judgeTag, '项目补传开始')
|
||||||
|
//项目开始补传
|
||||||
|
judgeTask.addTask(async () => {
|
||||||
|
await this.beginProject(xmdm)
|
||||||
|
}, {
|
||||||
|
isDelay: true
|
||||||
|
})
|
||||||
|
judgeTask.addTask(async () => {
|
||||||
|
await this.uploadProgressPhoto(xmdm)
|
||||||
|
}, {
|
||||||
|
isDelay: true
|
||||||
|
})
|
||||||
|
currentProject.isUpload = true;
|
||||||
|
Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject)
|
||||||
|
//扣分补传
|
||||||
|
if (currentType == 2) {
|
||||||
|
judgeTask.addTask(async () => {
|
||||||
|
await this.pointsDedute(xmdm, kf)
|
||||||
|
}, {
|
||||||
|
isDelay: true
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
//扣分补传判断是否合格 不合格补传项目结束
|
||||||
|
if (currentType == 1 || (currentType == 2 && this.totalScore < judgeUI.passingScore)) {
|
||||||
|
judgeTask.addTask(async () => {
|
||||||
|
await this.endProject(xmdm)
|
||||||
|
}, {
|
||||||
|
isDelay: true
|
||||||
|
})
|
||||||
|
currentProject.isEnd = true;
|
||||||
|
Reflect.set(this.judgeUI.projectsObj, xmdm, currentProject)
|
||||||
|
}
|
||||||
|
judgeTask.addTask(async () => {
|
||||||
|
this.checkExamIsEnd()
|
||||||
|
})
|
||||||
|
return false;
|
||||||
|
} else {
|
||||||
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.disConnectNum >= 5) {
|
|
||||||
console.info('surenjun', '123')
|
|
||||||
this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!';
|
|
||||||
this.judgeUI.disConnectErrorOpen = true
|
|
||||||
}
|
|
||||||
|
|
||||||
this.disConnectNum = 0
|
|
||||||
return temp
|
|
||||||
}
|
|
||||||
// 考试过程照片
|
|
||||||
uploadProgressPhoto = async (ksxm: number) => {
|
|
||||||
const time = GetCurrentTime();
|
|
||||||
const judgeUI = this.judgeUI
|
|
||||||
const plcData = this.plcData
|
|
||||||
const photoBase64 = await this.getPhoto();
|
|
||||||
const carInfo = AppStorage.get<CarInfoType>('carInfo');
|
|
||||||
|
|
||||||
const project: ProjectInfo = Reflect.get(judgeUI.projectsObj, ksxm)
|
|
||||||
const judgeConfig_305: number = Reflect.get(judgeUI.judgeConfigObj, '305')
|
|
||||||
const drvexam: DrvexamType = {
|
|
||||||
lsh: judgeUI.lsh,
|
|
||||||
kskm: carInfo.examSubject,
|
|
||||||
ksxm: project.projectCodeCenter,
|
|
||||||
sfzmhm: judgeUI.idCard,
|
|
||||||
kchp: encodeURI(carInfo.plateNo),
|
|
||||||
zpsj: time,
|
|
||||||
zp: photoBase64,
|
|
||||||
cs: Math.floor((judgeConfig_305 == 0 ? plcData.gps.sd : plcData.sensor.cs) * 1.852),
|
|
||||||
ksdd: encodeURI(judgeUI.ksdd)
|
|
||||||
}
|
|
||||||
const data: RegulatoryInterfaceParams = {
|
|
||||||
xtlb: '17',
|
|
||||||
jkxlh: judgeUI.serialNumber,
|
|
||||||
jkid: '17C54',
|
|
||||||
drvexam
|
|
||||||
};
|
|
||||||
const temp: WR = await this.sendWriteObjectOut(data, this.filePath);
|
|
||||||
if (temp.code === 2300007) {
|
|
||||||
this.isJudgeDisConnect = true
|
|
||||||
}
|
|
||||||
promptWxCode('17C54', temp.code)
|
|
||||||
console.info(judgeTag, '上传照片 end')
|
|
||||||
}
|
}
|
||||||
|
|
||||||
constructor(judgeUI: JudgeUI) {
|
constructor(judgeUI: JudgeUI) {
|
||||||
|
|||||||
@ -1,8 +1,6 @@
|
|||||||
import Prompt from '@system.prompt'
|
|
||||||
|
|
||||||
const TAG = 'SURENJUN_JUDGE'
|
const TAG = 'SURENJUN_JUDGE'
|
||||||
|
|
||||||
interface DelayConfig{
|
interface DelayConfig {
|
||||||
isDelay: boolean
|
isDelay: boolean
|
||||||
delayTime?: number
|
delayTime?: number
|
||||||
}
|
}
|
||||||
@ -12,47 +10,46 @@ interface QUEUE {
|
|||||||
delayConfig?: DelayConfig
|
delayConfig?: DelayConfig
|
||||||
}
|
}
|
||||||
|
|
||||||
type GoTask = (currentTask:QUEUE)=>Promise<boolean>
|
type GoTask = (currentTask: QUEUE) => Promise<boolean>
|
||||||
|
|
||||||
export default class JudgeTask {
|
export default class JudgeTask {
|
||||||
private queue?:QUEUE[] = []
|
|
||||||
private status: string
|
|
||||||
|
|
||||||
constructor() {
|
|
||||||
this.queue = []
|
|
||||||
this.status = 'end'
|
|
||||||
}
|
|
||||||
|
|
||||||
//执行任务
|
//执行任务
|
||||||
goTask:GoTask = async (currentTask:QUEUE) => {
|
goTask: GoTask = async (currentTask: QUEUE) => {
|
||||||
const fn = currentTask.fn;
|
const fn = currentTask.fn;
|
||||||
const delayConfig = currentTask.delayConfig || {isDelay:false,delayTime:1000}
|
const delayConfig = currentTask.delayConfig || {
|
||||||
|
isDelay: false, delayTime: 1000
|
||||||
|
}
|
||||||
const isDelay = delayConfig.isDelay
|
const isDelay = delayConfig.isDelay
|
||||||
const delayTime = delayConfig.delayTime
|
const delayTime = delayConfig.delayTime
|
||||||
|
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
private queue?: QUEUE[] = []
|
||||||
|
private status: string
|
||||||
executeQueue = async () => {
|
executeQueue = async () => {
|
||||||
const queue = this.queue;
|
const queue = this.queue;
|
||||||
const executeQueue = this.executeQueue
|
const executeQueue = this.executeQueue
|
||||||
if (queue.length) {
|
if (queue?.length) {
|
||||||
for (const currentTask of queue) {
|
for (const currentTask of queue) {
|
||||||
await this.goTask(currentTask)
|
await this.goTask(currentTask)
|
||||||
this.queue.shift()
|
this.queue?.shift()
|
||||||
await executeQueue()
|
await executeQueue()
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
this.status = 'end'
|
this.status = 'end'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
addTask = async (fn: Function, delayConfig?: DelayConfig) => {
|
||||||
addTask = async (fn:Function, delayConfig?: DelayConfig) => {
|
this.queue?.push({
|
||||||
this.queue.push({
|
|
||||||
fn, delayConfig
|
fn, delayConfig
|
||||||
});
|
});
|
||||||
if (this.status == 'end' && this.queue.length === 1) {
|
if (this.status == 'end' && this.queue?.length === 1) {
|
||||||
await this.executeQueue();
|
await this.executeQueue();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
constructor() {
|
||||||
|
this.queue = []
|
||||||
|
this.status = 'end'
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -78,7 +78,7 @@ export async function endRecordVideo(record_handleObj: RecordHandleType) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
export async function saveStartRecordVideo(path: string, context?: common.UIAbilityContext): Promise<RecordHandleType> {
|
export async function saveStartRecordVideo(path: string, context: common.UIAbilityContext): Promise<RecordHandleType> {
|
||||||
return new Promise(async (resolve, reject) => {
|
return new Promise(async (resolve, reject) => {
|
||||||
const fileUtil = new FileUtils(context)
|
const fileUtil = new FileUtils(context)
|
||||||
const fileHelper = new FileHelper(context);
|
const fileHelper = new FileHelper(context);
|
||||||
@ -130,7 +130,7 @@ interface takePhotoParam {
|
|||||||
* @returns
|
* @returns
|
||||||
*/
|
*/
|
||||||
|
|
||||||
export async function delPic(day: number, type: number, context?: common.UIAbilityContext) {
|
export async function delPic(day: number, type: number, context: common.UIAbilityContext) {
|
||||||
let phAccessHelper = photoAccessHelper.getPhotoAccessHelper(context);
|
let phAccessHelper = photoAccessHelper.getPhotoAccessHelper(context);
|
||||||
console.log('albumGetAssetsDemoCallback');
|
console.log('albumGetAssetsDemoCallback');
|
||||||
let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
|
let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
|
||||||
@ -155,41 +155,61 @@ export async function delPic(day: number, type: number, context?: common.UIAbili
|
|||||||
}
|
}
|
||||||
|
|
||||||
export async function takePhoto(param: VideoConfig, context: common.UIAbilityContext, dir: string, flag = 1,
|
export async function takePhoto(param: VideoConfig, context: common.UIAbilityContext, dir: string, flag = 1,
|
||||||
callback?: (data: TakePhotoCallbackData) => void) {
|
callback?: (data: TakePhotoCallbackData) => void): Promise<takePhotoParam | void> {
|
||||||
let video_uri = `rtsp://${param.userName}:${param.pwd}@${param.ip}:${param.port}/h264/ch${param.pztd}/main/av_stream`;
|
let video_uri = `rtsp://${param.userName}:${param.pwd}@${param.ip}:${param.port}/h264/ch${param.pztd}/main/av_stream`;
|
||||||
|
|
||||||
const num = Math.floor(Math.random() * 10000)
|
const num = Math.floor(Math.random() * 10000);
|
||||||
const fileName = `picture_record${num}.jpg`
|
const fileName = `picture_record${num}.jpg`;
|
||||||
|
|
||||||
if (flag == 0) {
|
if (flag == 0) {
|
||||||
rtsp_server.detectVideoSnapshotSize(video_uri, fileName, (err: BusinessError, snapResult: record.RtspResult) => {
|
return new Promise<void>((resolve, reject) => {
|
||||||
callback({ fileSize: snapResult.fileSize, errorCode: snapResult.errorCode })
|
rtsp_server.detectVideoSnapshotSize(video_uri, fileName, (err: BusinessError, snapResult: record.RtspResult) => {
|
||||||
|
if (snapResult && snapResult.errorCode === 0) {
|
||||||
|
if (callback) {
|
||||||
|
callback({
|
||||||
|
fileSize: snapResult.fileSize,
|
||||||
|
errorCode: snapResult.errorCode,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
resolve();
|
||||||
|
} else {
|
||||||
|
promptAction.showToast({
|
||||||
|
message: `拍照失败`,
|
||||||
|
duration: 3000,
|
||||||
|
});
|
||||||
|
reject(err);
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return new Promise<takePhotoParam>(async (resolve, reject) => {
|
return new Promise<takePhotoParam>(async (resolve, reject) => {
|
||||||
const time = GetCurrentTime()
|
const time = GetCurrentTime();
|
||||||
const date = time.split(' ')[0]
|
const date = time.split(' ')[0];
|
||||||
let dirName = dir ? dir : date
|
let dirName = dir ? dir : date;
|
||||||
rtsp_server.getVideoSnapshot(context, video_uri, fileName, dirName, true,
|
rtsp_server.getVideoSnapshot(
|
||||||
|
context,
|
||||||
|
video_uri,
|
||||||
|
fileName,
|
||||||
|
dirName,
|
||||||
|
true,
|
||||||
async (err: BusinessError, snapResult: record.RtspResult) => {
|
async (err: BusinessError, snapResult: record.RtspResult) => {
|
||||||
if (snapResult.result && snapResult.errorCode == 0) {
|
if (snapResult.result && snapResult.errorCode === 0) {
|
||||||
resolve({
|
resolve({
|
||||||
base64: snapResult.dataString,
|
base64: snapResult.dataString,
|
||||||
name: snapResult.fileName,
|
name: snapResult.fileName,
|
||||||
fileSize: snapResult.fileSize,
|
fileSize: snapResult.fileSize,
|
||||||
errorCode: snapResult.errorCode
|
errorCode: snapResult.errorCode,
|
||||||
})
|
});
|
||||||
} else {
|
} else {
|
||||||
promptAction.showToast({
|
promptAction.showToast({
|
||||||
message: `拍照失败`,
|
message: `拍照失败`,
|
||||||
duration: 3000
|
duration: 3000,
|
||||||
});
|
});
|
||||||
reject(false)
|
reject(false);
|
||||||
// reject()
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
});
|
);
|
||||||
})
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -202,14 +222,14 @@ export async function deleteAllFileByPiC(dirName: string, type = 1, context: com
|
|||||||
|
|
||||||
export async function deleteAllVideos(context: common.UIAbilityContext, type: photoAccessHelper.AlbumType,
|
export async function deleteAllVideos(context: common.UIAbilityContext, type: photoAccessHelper.AlbumType,
|
||||||
subType: photoAccessHelper.AlbumSubtype): Promise<void> {
|
subType: photoAccessHelper.AlbumSubtype): Promise<void> {
|
||||||
let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = null;
|
let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> | null = null;
|
||||||
let count = 0;
|
let count = 0;
|
||||||
try {
|
try {
|
||||||
const userFileMgr = photoAccessHelper.getPhotoAccessHelper(context);
|
const userFileMgr = photoAccessHelper.getPhotoAccessHelper(context);
|
||||||
fetchResult = await userFileMgr.getAlbums(type, subType);
|
fetchResult = await userFileMgr.getAlbums(type, subType);
|
||||||
for (let i = 0; i < fetchResult.getCount(); i++) {
|
for (let i = 0; i < fetchResult.getCount(); i++) {
|
||||||
let albumAsset: photoAccessHelper.Album = await fetchResult.getObjectByPosition(i);
|
let albumAsset: photoAccessHelper.Album = await fetchResult.getObjectByPosition(i);
|
||||||
let photoFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> = null;
|
let photoFetchResult: photoAccessHelper.FetchResult<photoAccessHelper.PhotoAsset> | null = null;
|
||||||
try {
|
try {
|
||||||
let predicates = new dataSharePredicates.DataSharePredicates();
|
let predicates = new dataSharePredicates.DataSharePredicates();
|
||||||
let fetchOptions: photoAccessHelper.FetchOptions = {
|
let fetchOptions: photoAccessHelper.FetchOptions = {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user