Compare commits

...

4 Commits

18 changed files with 405 additions and 364 deletions

View File

@ -1,6 +1,6 @@
import request from "../utils/Request"
import http from "@ohos.net.http"
import { InitializeTheCentralTableType, ResponseDataType } from "../model"
import { InitializeTheCentralTableType, ObtainCarExamInfoParams, ResponseDataType } from "../model"
interface timeSynchronizationParams {
time: string
@ -50,13 +50,9 @@ export async function timeSynchronizationHTTP(params: timeSynchronizationHTTPPar
})
}
interface obtainCarExamInfoParams {
time: string
deviceNo: string
}
//获取考车信息
export async function obtainCarExamInfo(params: obtainCarExamInfoParams) {
export async function obtainCarExamInfo(params: ObtainCarExamInfoParams) {
return request<object>({
url: '/der2/services/exam/obtainCarExamInfo.ws',
data: `<?xml version="1.0" encoding="UTF-8" ?>
@ -88,7 +84,7 @@ export async function initCarInfoCache(params: initCarInfoCacheParams) {
//参数下发读表接口
export async function initCenterCache(params: object, url: string) {
const timeInfo = AppStorage.get('timeInfo')
const timeInfo: string = AppStorage.get('timeInfo')
return await request<object>({
url: '/para/initCenterCache.ws',
data: params,

View File

@ -4,6 +4,8 @@ import { getSyncData } from '../common/service/initable';
import writeObjectOutNew from './judgeNew';
import FileUtil from '../common/utils/File';
import http from '@ohos.net.http';
import { MASYSSETTableType, RegulatoryInterfaceParams } from '../model';
import { GetSyncData } from '../utils/table/Operation';
let baseHost: string = AppStorage.get('host');
@ -25,7 +27,7 @@ interface WR {
}
// 通用监管接口
export async function writeObjectOut(params: ESObject, filePath?: string): Promise<WR> {
export async function writeObjectOut(params: RegulatoryInterfaceParams, filePath?: string): Promise<WR> {
const singlePlay: boolean = AppStorage.get('singlePlay')
if (singlePlay) {
return { code: 1 }
@ -33,7 +35,7 @@ export async function writeObjectOut(params: ESObject, filePath?: string): Promi
let JGHOST: string = AppStorage.get("JGHOST")
//获取监管接口地址路径
if (!JGHOST) {
const syssetParams = await getSyncData('MA_SYSSET') || [];
const syssetParams: MASYSSETTableType[] = await GetSyncData<MASYSSETTableType>("MA_SYSSET");
syssetParams.forEach(sys => {
if (sys.v_no == '839') {

View File

@ -1,6 +1,6 @@
import request from '../utils/Request'
import http from '@ohos.net.http'
import { FaceCompareResp } from '../model'
import { FaceCompareResp, GetExaminationItemRsp, GetExaminationStudentInfoResponse } from '../model'
/**
* 照片比对
@ -39,8 +39,8 @@ export async function faceCompare(params: FaceCompareParams) {
}
export async function getExaminationStudentInfo(params: object) {
return request({
export async function getExaminationStudentInfo(params: ESObject) {
return request<GetExaminationStudentInfoResponse>({
url: '/der2/services/exam/getExaminationStudentInfo.ws',
data: params,
method: http.RequestMethod.POST,
@ -67,7 +67,7 @@ interface GetExaminationItemParams {
//获取断点续考
export async function getExaminationItem(params: GetExaminationItemParams) {
return request({
return request<GetExaminationItemRsp>({
url: '/der2/services/exam/getExaminationItem.ws',
data: `<getExaminationItemReq>
<head>

View File

@ -1,17 +0,0 @@
//考官登录信息
// export async function examinerLoginService(params) {
// let res: any = await examinerLogin(params)
// AppStorage.setOrCreate('examinerInfo', res?.examinerLoginRsp?.body)
// console.log('jiangsong1: examinerLoginService' + JSON.stringify(res))
// //{"examinerLoginRsp":{"head":{"resultCode":"0","resultMessage":"%E8%80%83%E8%AF%95%E5%91%98%E7%99%BB%E5%BD%95-%E6%88%90%E5%8A%9F","time":"2023-06-01 10:06:39"},"body":{"code":"006","name":"%E8%80%836","statusRgpp":"1"}}}
// return res
// }
//获取考车信息
// export async function initParseCarInfo(params) {
// let res: any = await initCarInfoCache(params)
// console.log('jiangsong1: examinerLoginService' + JSON.stringify(res))
// //{"examinerLoginRsp":{"head":{"resultCode":"0","resultMessage":"%E8%80%83%E8%AF%95%E5%91%98%E7%99%BB%E5%BD%95-%E6%88%90%E5%8A%9F","time":"2023-06-01 10:06:39"},"body":{"code":"006","name":"%E8%80%836","statusRgpp":"1"}}}
// return res
// }

View File

@ -1,10 +1,8 @@
// @ts-nocheck
import promptAction from '@ohos.promptAction'
import router from '@ohos.router'
import { dateFormat } from '../utils/tools'
import FileUtil from '../../common/utils/File'
import { deleteAllFileByPiC, takePhoto } from '../../service/videoService'
// import { VideoConfigData } from '../../mock';
import {
delSyncTable,
getDataBaseTable,
@ -90,7 +88,6 @@ export async function setVideoParam() {
}
let fileFd
//配置流水号
export async function setliushuiNum() {
@ -277,7 +274,6 @@ export async function takePhotoFn(context) {
}, 3000)
}
let fd
const devPath = "/dev/ttyS3"
let chuankoufd

View File

@ -1,48 +0,0 @@
import { obtainCarExamInfo } from '../../api/index'
import { dateFormat } from '../utils/tools'
import promptAction from '@ohos.promptAction'
import { GlobalConfig } from '../../config/index'
import FileUtil from '../../common/utils/File'
//获取设备信息
export async function getDeviceInfo(context) {
return new Promise(async (resolve, reject) => {
const fileUtil = new FileUtil(context)
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/deviceNo.txt');
if (data === '' || data === undefined) {
promptAction.showToast({
message: `请先进行设备注册`,
duration: 3000
});
AppStorage.setOrCreate('type', 1)
AppStorage.setOrCreate('title', '请先进行设备注册')
globalThis.errorDialog.open()
resolve('')
} else {
const fileData = JSON.parse(data)
AppStorage.setOrCreate('deviceNo', fileData.deviceName)
// getCarInfo()
resolve(fileData.deviceName)
}
})
}
//获取考车信息
export async function getCarInfo() {
let date = new Date();
let params = { time: dateFormat(date), deviceNo: AppStorage.get('deviceNo') };
let res: any = await obtainCarExamInfo(params)
if (!res?.obtainCarExamInfoRsp?.body) {
// router.pushUrl({
// url: 'pages/Register',
// }, router.RouterMode.Single);
} else {
const carInfo=res.obtainCarExamInfoRsp.body
carInfo.plateNo= decodeURIComponent(carInfo.plateNo)
AppStorage.setOrCreate('carInfo',carInfo)
}
return res
}

View File

@ -93,4 +93,5 @@ export interface BaseInfoType {
export interface RouteParamsType {
sczb?: string;
kfdm?: string;
type?: string;
}

View File

@ -88,6 +88,7 @@ interface JudgeFile {
/** 考试过程数据 */
export interface DrvexamType extends BaseExamFields {
lsh?: string;
zp?: string;
sbxh?: string;
kffs?: string;
@ -95,4 +96,7 @@ export interface DrvexamType extends BaseExamFields {
kfxm?: string;
kfxmmx?: string;
ghks?: string;
ksxtbh?: string;
ksysfzmhm?: string;
Ksy2sfzmhm?: string;
}

View File

@ -78,4 +78,16 @@ export interface InitializeTheCentralTableType {
host?: string
videoVersion?: string
context?: common.UIAbilityContext
mode?: string
paraKdid?: string
kdid?: string
centerHost?: string
}
// 以下是各个表的类型
export interface MASYSSETTableType {
id?: string
v_no?: string
v_name?: string
v_value?: string
}

View File

@ -1,3 +1,5 @@
import { DrvexamType } from ".";
export interface RegistrationDeviceNoRsp {
registrationDeviceNoRsp: RegistrationDeviceNoRspDetails;
}
@ -17,9 +19,12 @@ interface ImageCompareRsp {
body: ESObject
}
export interface GetExaminationStudentInfoResponse {
getExaminationStudentInfoRsp: ImageCompareRsp
}
export interface FaceCompareResp {
imageCompareRsp?: ImageCompareRsp
}
export interface ResponseDataType {
@ -34,6 +39,9 @@ export interface ExaminerLoginInfo {
username?: string;
kgxm?: string;
ksyh?: string;
plateNo?: string
isNeedCheck?: string
examSubject?: string
}
export interface SpzdType {
@ -77,3 +85,36 @@ interface CarConfigurationInfoResponseBody {
interface ES_CHECK_CAR_ITEMItem {
ITEMS: string;
}
export interface ObtainCarExamInfoParams {
time: string
deviceNo: string
}
//监管接口参数
export interface RegulatoryInterfaceParams {
xtlb?: string;
jkxlh?: string;
jkid?: string;
drvexam?: DrvexamType
}
export interface BeginExamRequest {
keystr?: string;
message?: string | Resource;
code?: number
}
// { getExaminationItemRsp: { body: { ykxx: '' } } }
export interface GetExaminationItemRsp {
getExaminationItemRsp: GetExaminationItemRspDetails
}
interface GetExaminationItemRspDetails {
head?: Head;
body: GetExaminationItemRspBody;
}
interface GetExaminationItemRspBody {
ykxx: string;
}

View File

@ -1,6 +1,6 @@
import common from '@ohos.app.ability.common';
import router from '@ohos.router';
import { getCarInfo, getDeviceInfo } from '../common/service/terminalService';
import { getCurrentTime, setCurrentTime, string2Bytes } from '../common/utils/tools';
import { FileHelper } from '../common/service/FileHelper';
import { getEsCarModel, getSyncData, } from '../common/service/initable';
@ -14,15 +14,16 @@ import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
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 '../service/videoService';
import imageBtn from './compontents/imageBtn';
import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
import { BaseInfoType } from '../model/Common';
import { CarInfoType } from '../model/CarCheck';
import { TimeInfo } from '../model';
import { InitializeTheCentralTableType, MASYSSETTableType, TimeInfo } from '../model';
import { GetCarInfo, GetDeviceInfo, UseAuth } from './Index/utils';
import { GetSyncData, InitializeTheCentralTable } from '../utils/table/Operation';
import { BusinessError } from '@ohos.base';
// import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements';
@Entry
@Component
@ -56,9 +57,7 @@ struct Index {
alignment: DialogAlignment.Center,
},
)
private fileUtil: FileUtil
private interval = -1;
// private vocObj = null;
private avPlayer: VoiceAnnounce
private timeInfo: TimeInfo
private context = getContext(this) as common.UIAbilityContext;
@ -364,29 +363,20 @@ struct Index {
this.angle = 0
this.loading = false
AppStorage.set('lsh', '1111111111111')
globalThis.errorDialog = this.errorDialog
globalThis.udpEvent = new UdpEvent();
getSyncData('MA_SYSSET').then(async data => {
data.forEach(async sys => {
//判断是否能点开始考试
if (sys.v_no === '305') {
console.log('syssyssyssys')
// this.delLoading=true
// globalThis.param854Str=sys.v_value
delPic(Number(sys.v_value), 1)
delPic(Number(sys.v_value), 2)
// this.delLoading=false
// TODO 未改
// globalThis.errorDialog = this.errorDialog
// globalThis.udpEvent = new UdpEvent();
GetSyncData<MASYSSETTableType>("MA_SYSSET").then((res: MASYSSETTableType[]) => {
res.forEach((element) => {
if (element.v_no === "305") {
delPic(Number(element.v_value), 1)
delPic(Number(element.v_value), 2)
}
})
});
});
}
aboutToDisappear() {
// this.vocObj && this.vocObj.releasePlayer()
}
async testXMLToJSONInWorker() {
if (this.loading) {
return
@ -395,13 +385,13 @@ struct Index {
// console.log('mode',mode)
const param = {
const param: InitializeTheCentralTableType = {
carId: this.carInfo?.carId,
examinationRoomId: this.carInfo?.examinationRoomId,
judgeVersion: this.baseInfo.judgeVersion,
shellVersion: this.baseInfo.version,
paraKdid: this.timeInfo?.paraKdid || this.timeInfo?.kdid,
kdid: this..timeInfo?.kdid || this.timeInfo?.paraKdid,
kdid: this.timeInfo?.kdid || this.timeInfo?.paraKdid,
mode: this.timeInfo?.mode,
context: this.context,
host: AppStorage.get('host'),
@ -411,27 +401,16 @@ struct Index {
this.loading = true
console.log("sql 1111")
getSingleCenterTable(param).then((ret) => {
console.log('teststetfinsh1', ret)
// DB.queryListBySql('select * from MA_SYSSET', [{
// name: "v_no",
// type: ColumnType.STRING,
// columnName: "v_no"
// }]).then((res) => {
// console.log('sql success', JSON.stringify(res))
// }).catch((err) => {
// console.log('sql error1', err)
// })
// getSingleCenterTable(param).then((ret) => {
InitializeTheCentralTable(param).then((ret) => {
if (ret) {
getSyncData('MA_SYSSET').then(data => {
console.log('datadata', JSON.stringify(data))
GetSyncData<MASYSSETTableType>("MA_SYSSET").then(data => {
data.forEach(sys => {
//判断是否能点开始考试
if (sys.v_no === '854') {
AppStorage.setOrCreate('param854Str', sys.v_value)
}
if (sys.v_no === '824' && decodeURIComponent(sys.v_value) == '0') {
// this.Param612Str= decodeURIComponent(sys.v_value)
router.pushUrl({
url: 'pages/CarCheck',
params: {
@ -448,47 +427,7 @@ struct Index {
}
})
// workerInstance.postMessage(param);
// workerInstance.onmessage = (e: MessageEvents): void => {
// console.log("baoyihu after postMessage :", JSON.stringify(e.data));
// // @ts-ignore
// let workData: WorkData = e.data;
// this.loading = false
// if (workData.isComplete) {
// if(globalThis.singlePlay){
// router.pushUrl({
// url: 'pages/UserInfo',
// }, router.RouterMode.Single)
// return
// }
// getSyncData('MA_SYSSET').then(data => {
// console.log('datadata', JSON.stringify(data))
// // @ts-ignore
// data.forEach(sys => {
// //判断是否能点开始考试
// if(sys.v_no === '854'){
// globalThis.param854Str=sys.v_value
// }
// if (sys.v_no === '824'&&decodeURIComponent(sys.v_value)=='0') {
// // this.Param612Str= decodeURIComponent(sys.v_value)
// router.pushUrl({
// url:'pages/CarCheck',
// params: {
// 'fromIndex':true
// }
// }, router.RouterMode.Single)
// }else{
// router.pushUrl({
// url: 'pages/ExaminerLogin',
// }, router.RouterMode.Single)
// }
// })
// });
//
// }
// workerInstance.terminate();
//
// }
}
async heartMsg() {
@ -503,24 +442,28 @@ struct Index {
for (let i = 0; i < str.length; i++) {
tmpList.push(string2Bytes(str.charCodeAt(i), 1 * 8)[0])
}
const param = {
id: 31,
list: tmpList,
carNo: this.carInfo.carNo,
placeId: this.carInfo.examinationRoomId
}
// TODO 未改
// const param = {
// id: 31,
// list: tmpList,
// carNo: this.carInfo.carNo,
// placeId: this.carInfo.examinationRoomId
// }
// globalThis.udpClient2.initHeartSendMsg(param,this.context)
if (globalThis.udpClient2.getStatus()) {
globalThis.udpClient2.sendMsgExt(param, this.context)
}
// if (globalThis.udpClient2.getStatus()) {
// globalThis.udpClient2.sendMsgExt(param, this.context)
// }
}
async onPageShow() {
console.log('ttttt', 1111)
this.singlePlay = AppStorage.get('singlePlay')
this.baseInfo = AppStorage.get('baseInfo') as BaseInfoType
await this.userAuth();
// await this.userAuth();
UseAuth(this.context).then(() => {
this.initParams()
}).catch(() => {
});
if (this.singlePlay == undefined || this.singlePlay == null) {
// setVideoParam()
console.log('diyidiy')
@ -534,7 +477,7 @@ struct Index {
// })
// let rawFile = value;
})
.catch(error => {
.catch((error: BusinessError) => {
console.log("getRawFileContent promise error is " + error);
});
@ -558,45 +501,12 @@ struct Index {
}
userAuth() {
return new Promise((reslove, reject) => {
const permissions: Array<Permissions> =
["ohos.permission.SET_TIME", "ohos.permission.READ_IMAGEVIDEO", "ohos.permission.DISTRIBUTED_DATASYNC",
'ohos.permission.CONNECTIVITY_INTERNAL', 'ohos.permission.CAMERA', 'ohos.permission.READ_MEDIA',
'ohos.permission.WRITE_MEDIA', 'ohos.permission.FILE_ACCESS_MANAGER'];
let context = this.context;
let atManager = abilityAccessCtrl.createAtManager();
// requestPermissionsFromUser会判断权限的授权状态来决定是否唤起弹窗
atManager.requestPermissionsFromUser(context, permissions).then((data) => {
this.initParams()
let grantStatus: Array<number> = data.authResults;
let length: number = grantStatus.length;
for (let i = 0; i < length; i++) {
if (grantStatus[i] === 0) {
// 用户授权,可以继续访问目标操作
reslove(true)
} else {
reject()
// 用户拒绝授权,提示用户必须授权才能访问当前页面的功能,并引导用户到系统设置中打开相应的权限
return;
}
}
// 授权成功
}).catch((err) => {
console.error(`Failed to request permissions from user. Code is ${err.code}, message is ${err.message}`);
})
})
}
async initParams() {
//设置plc udp 同步requesthost
await getUDP(this.context, false)
this.loading = false
await getDeviceInfo(this.context)
await getCarInfo()
await GetDeviceInfo(this.context)
await GetCarInfo()
await getUDP2(this.context, false)
getTCP()
this.carInfo = AppStorage.get('carInfo')
@ -626,10 +536,6 @@ struct Index {
}
}, 1000)
this.createAlbum()
//下载模型
// await this.getModel()
// const arr = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x01, 0x03, 0x00]
// globalThis.udpClientByTopLine.sendMsg(Array2Byte(arr).buffer)
}
async getModel() {

View File

@ -0,0 +1,71 @@
import common from "@ohos.app.ability.common";
import FileUtil from "../../common/utils/File";
import { GlobalConfig } from "../../config";
import Prompt from "@system.prompt";
import { CarConfigurationParamsType, ObtainCarExamInfoParams } from "../../model";
import dayTs from "../../utils/Date";
import { obtainCarExamInfo } from "../../api";
import abilityAccessCtrl, { Permissions } from '@ohos.abilityAccessCtrl';
import { BusinessError } from "@ohos.base";
//获取设备信息
export async function GetDeviceInfo(context: common.UIAbilityContext): Promise<string> {
return new Promise(async (resolve, reject) => {
const fileUtil = new FileUtil(context)
const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/deviceNo.txt');
if (data === '' || data === undefined) {
Prompt.showToast({
message: "请先进行设备注册!",
duration: 3000
})
AppStorage.setOrCreate('type', 1)
AppStorage.setOrCreate('title', '请先进行设备注册')
resolve("")
} else {
const fileData: CarConfigurationParamsType = JSON.parse(data)
AppStorage.setOrCreate('deviceNo', fileData.deviceName)
resolve(fileData.deviceName)
}
})
}
export async function GetCarInfo() {
let date = new Date();
let params: ObtainCarExamInfoParams = {
time: dayTs(date).format("YYYY-MM-DD HH:mm:ss"),
deviceNo: AppStorage.get('deviceNo')
};
// TODO 待完善
let res: ESObject = await obtainCarExamInfo(params)
if (res.obtainCarExamInfoRsp.body) {
const carInfo: ESObject = res?.obtainCarExamInfoRsp?.body
carInfo.plateNo = decodeURIComponent(carInfo.plateNo)
AppStorage.setOrCreate('carInfo', carInfo)
}
}
export async function UseAuth(context: common.UIAbilityContext): Promise<boolean> {
return new Promise((resolve, reject) => {
const permissions: Array<Permissions> =
["ohos.permission.SET_TIME", "ohos.permission.READ_IMAGEVIDEO", "ohos.permission.DISTRIBUTED_DATASYNC",
'ohos.permission.CONNECTIVITY_INTERNAL', 'ohos.permission.CAMERA', 'ohos.permission.READ_MEDIA',
'ohos.permission.WRITE_MEDIA', 'ohos.permission.FILE_ACCESS_MANAGER'];
abilityAccessCtrl.createAtManager().requestPermissionsFromUser(context, permissions).then(res => {
let grantStatus: Array<number> = res.authResults;
let length: number = grantStatus.length;
for (let i = 0; i < length; i++) {
if (grantStatus[i] === 0) {
// 用户授权,可以继续访问目标操作
resolve(true)
} else {
reject(false)
// 用户拒绝授权,提示用户必须授权才能访问当前页面的功能,并引导用户到系统设置中打开相应的权限
return;
}
}
}).catch((err: BusinessError) => {
console.log("获取权限失败", JSON.stringify(err))
reject(false)
})
})
}

View File

@ -30,7 +30,8 @@ import { judgeConfig } from './judgeSDK/utils/judgeConfig';
import FileUtil from '../common/utils/File';
import SignDisplayCom from './compontents/signDisplayCom';
import { CarInfoType, CommonType, KfdmType } from '../model';
import { CarInfoType, CommonType, KfdmType, User } from '../model';
import { GetSyncData } from '../utils/table/Operation';
@Entry
@Component
@ -215,7 +216,7 @@ struct Index {
// 获取考生信息
async initStudent() {
const students = await getSyncData('USER')
const students = await GetSyncData<User>('USER')
const stuInfo = students[0] || {};
const { xm, sfzmhm, lsh, kszp, ksdd, kssycs, kslx, ksxl, xldm } = stuInfo;
this.name = xm || '测试考生';

View File

@ -10,7 +10,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 { getSyncData, sqlInsertCommonFn, upDateTableByArray } from '../common/service/initable';
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';
@ -21,8 +21,25 @@ import errorMsgDialog from './compontents/errorMsgDialog';
import imageBtn from './compontents/imageBtn';
import FileUtil from '../common/utils/File';
import DB, { ColumnType } from '../common/database/DbSql';
import { CarInfoType, IdCard, LabelBlockType, QKParamType, SckType, SystemParamType, User } from '../model';
import {
BeginExamRequest,
CarInfoType,
DrvexamType,
ExaminerLoginInfo,
GetExaminationItemRsp,
IdCard,
LabelBlockType,
MASYSSETTableType,
QKParamType,
RegulatoryInterfaceParams,
RouteParamsType,
SckType,
SystemParamType,
User
} from '../model';
import { BusinessError } from '@ohos.base';
import { GetSyncData } from '../utils/table/Operation';
import { GetCurrentUserKeyValue } from './UserInfo/utils';
@Entry
@Component
@ -208,13 +225,15 @@ struct UserInfo {
this.initData()
//身份证读卡器初始化
// this.openDeviceByIDCard()
const routerParam = router.getParams() || { type: 0 };
const routerParam: RouteParamsType = router.getParams() as RouteParamsType
console.log('routerParam', JSON.stringify(routerParam))
if (!this.singlePlay) {
if (routerParam.type != 1) {
this.list = await getSyncData('USERLIST')
const data = await getSyncData('USER')
if (routerParam.type != "1") {
// this.list = await getSyncData('USERLIST')
this.list = await GetSyncData<User>("USERLIST")
// const data = await getSyncData('USER')
const data = await GetSyncData<User>("USER")
console.log('useruser,', JSON.stringify(this.list))
console.log('useruser1,', JSON.stringify(data))
@ -271,16 +290,16 @@ struct UserInfo {
// }
this.sczbkf = [];
initJudgeUdp()
// TODO UDP更改
//监听远程开始考试
globalThis.udpEvent.onBeginExam(async () => {
console.info('surenjun', 'userInfo收到UdpEvent事件')
if (this.isBoardPrePareSetPopupOpen && !this.isFirstBoardPrePareSetPopupBtnShow) {
await this.prePareSCZB()
} else {
await this.prePareExam()
}
})
// globalThis.udpEvent.onBeginExam(async () => {
// console.info('surenjun', 'userInfo收到UdpEvent事件')
// if (this.isBoardPrePareSetPopupOpen && !this.isFirstBoardPrePareSetPopupBtnShow) {
// await this.prePareSCZB()
// } else {
// await this.prePareExam()
// }
// })
}
@ -298,12 +317,12 @@ struct UserInfo {
stopDeviceById() {
if (this.faceFlag == '1') {
testNapi && testNapi.StopReadCard()
testNapi.StopReadCard()
}
}
// 通过身份证获取当前学员
async getCurrentStudent(id) {
async getCurrentStudent(id: string) {
let flag = false
// this.pageIndex
console.log('currentidid', id)
@ -320,13 +339,11 @@ struct UserInfo {
this.examinerLoginInfo.ksyh = res.ksy1sfzmhm
AppStorage.setOrCreate('examinerLoginInfo', this.examinerLoginInfo)
AppStorage.setOrCreate('lsh', res.lsh)
const { examSubject } = this.carInfo;
// this.currentUser.kszp=this.photo+res.kszp
// this.currentUser.ksmjzp=this.photo+this.currentUser.ksmjzp
// const { examSubject } = this.carInfo;
if (this.singlePlay) {
this.stopDeviceById()
router.pushUrl({
url: examSubject == 3 ? 'pages/Roads' : 'pages/Judge',
url: this.carInfo.examSubject == "3" ? 'pages/Roads' : 'pages/Judge',
params: {
sczb: Number(this.isBoardPrePareSetPopupOpen),
kfdm: this.sczbkf,
@ -389,7 +406,7 @@ struct UserInfo {
thisVar.address = baseInfos[4];
thisVar.idCard = baseInfos[5];
setTimeout(() => {
thisVar.getCurrentStudent(baseInfos[5])
this.getCurrentStudent(baseInfos[5])
}, 1000)
}
@ -445,20 +462,21 @@ struct UserInfo {
}
async heartMsg() {
globalThis.udpClient2 & globalThis.udpClient2.setMsgCallBack(async (val) => {
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') {
//收到中心缺考确认消息
console.log('qkfnqkfn', val.body[0])
this.qkFn()
}
})
// TODO UDP缺失
// globalThis.udpClient2 & globalThis.udpClient2.setMsgCallBack(async (val) => {
// 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') {
// //收到中心缺考确认消息
// console.log('qkfnqkfn', val.body[0])
// this.qkFn()
// }
// })
}
//考点端查询缺考指令内容消息请求
@ -471,16 +489,18 @@ struct UserInfo {
carNo: this.carInfo.carNo as string,
placeId: this.carInfo.examinationRoomId as string
}
globalThis.udpClient2.sendMsgExt(param, this.context)
// TODO UDP缺失
// globalThis.udpClient2.sendMsgExt(param, this.context)
}
async initSysset() {
const that = this;
DB.queryListBySql("select * from MA_SYSSET", ['id', 'v_no', 'v_name', 'v_value'].map(item => ({
type: ColumnType.STRING,
name: item,
columnName: item
}))).then((syssetParams: any) => {
// DB.queryListBySql("select * from MA_SYSSET", ['id', 'v_no', 'v_name', 'v_value'].map(item => ({
// type: ColumnType.STRING,
// name: item,
// columnName: item
// }))).then((syssetParams: any) => {
GetSyncData<MASYSSETTableType>("MA_SYSSET").then((syssetParams: MASYSSETTableType[]) => {
const serialNumberArr = syssetParams.filter(sys => sys.v_no === '901')
that.jkxlh = serialNumberArr?.[0]?.v_value || ''
const ksxtbhArr = syssetParams.filter(sys => sys.v_no === '902')
@ -556,15 +576,9 @@ struct UserInfo {
if (!Number(this.systemParam.Param305Str)) {
that.systemParam.Param305Str = '2'
}
// console.log('Param305Str',that.systemParam.Param305Str)
// delHilog(this.Param305Str)
// delPic(that.systemParam.Param305Str,1)
// delPic(that.systemParam.Param305Str,2)
}
})
// faceParam?.[0]?.v_value ||
//0不自动更新 1自动更新不限次数 2没有考生更新2次
if (that.studentRefreshStatue == '2') {
@ -596,14 +610,6 @@ struct UserInfo {
// this.getExaminationItemFn()
}
})
// const db = new AccountTable(() => {
// }, MA_SYSSET);
// db.getRdbStore(() => {
// db.query('0', (syssetParams) => {
//
//
// })
// })
}
//人脸比对窗口关闭
@ -665,23 +671,28 @@ struct UserInfo {
setTimeout(() => {
this.updateTimeLimit = false
}, 3000)
// @ts-ignore
if (!res || res?.getExaminationStudentInfoRsp?.head?.resultCode == '1') {
this.dataList = []
this.list = []
return
}
let dataList = []
let dataList: User[] = []
this.list = []
// @ts-ignore
for (let key in res.getExaminationStudentInfoRsp.body) {
// @ts-ignore
const a = res.getExaminationStudentInfoRsp.body[key]
if (a instanceof Array) {
dataList = a
// for (let key in res.getExaminationStudentInfoRsp.body) {
// const a = res.getExaminationStudentInfoRsp.body[key]
// if (a instanceof Array) {
// dataList = a
// } else {
// dataList = [a]
// }
// }
for (const key of Object.keys(res.getExaminationStudentInfoRsp.body)) {
const a: User[] | User = res.getExaminationStudentInfoRsp.body[key];
if (Array.isArray(a)) {
dataList = a;
} else {
dataList = [a]
dataList = [a];
}
}
if (dataList.length) {
@ -698,9 +709,10 @@ struct UserInfo {
this.startExam = true
}
listData.id = index.toString()
for (let i in listData) {
listData[i] = decodeURI(listData[i])
}
// TODO 需要修改
// for (let i in listData) {
// listData[i] = decodeURI(listData[i])
// }
if (this.systemParam.Param828Str == '1' || this.systemParam.Param828Str == '2') {
// listData.ksy2=listData.ksy1;
listData.ksy2 = this.examinerLoginInfo.kgxm
@ -747,12 +759,13 @@ struct UserInfo {
}
this.pageIndex = 0
getSyncData('USER').then(data => {
// getSyncData('USER').then(data => {
GetSyncData<User>("USER").then(data => {
if (data?.[0]) {
this.getCurrentStudent(data[0].sfzmhm)
}
})
}).catch((error) => {
}).catch((error: BusinessError) => {
this.updateTimeLimit = false
this.errorDialog.close()
console.log('error12error' + error)
@ -793,7 +806,6 @@ struct UserInfo {
}
globalThis.udpClient2.sendMsgExt(param, this.context)
// @ts-ignore
if (res.examinationStuAbsentRsp.head.resultCode == '0') {
this.pageIndex = 0
this.qkFlag = false
@ -811,15 +823,14 @@ struct UserInfo {
if (!this.currentUser.lsh || this.singlePlay) {
return
}
const { carId, examinationRoomId } = this.carInfo;
// const { carId, examinationRoomId } = this.carInfo;
const examItems = await getExaminationItem({
time: getCurrentTime(),
carId,
time: await getCurrentTime() || "",
carId: this.carInfo.carId,
lsh: this.currentUser.lsh || '',
examinationRoomId
examinationRoomId: this.carInfo.examinationRoomId
});
// @ts-ignore
if (examItems?.getExaminationItemRsp?.body?.kssycs != 0) {
this.getExaminationStudentInfoFn()
} else {
@ -832,16 +843,14 @@ struct UserInfo {
async sfbdinterfaceFn() {
AppStorage.setOrCreate('statue', 4)
this.stepFlag = true
const { carId, examinationRoomId } = this.carInfo;
let examItems = { getExaminationItemRsp: { body: { ykxx: '' } } };
let examItems: GetExaminationItemRsp = { getExaminationItemRsp: { body: { ykxx: '' } } };
if (!this.singlePlay) {
//获取已考项目
// @ts-ignore
examItems = await getExaminationItem({
time: getCurrentTime(),
carId,
time: await getCurrentTime(),
carId: this.carInfo.carId,
lsh: this.currentUser.lsh || '',
examinationRoomId
examinationRoomId: this.carInfo.examinationRoomId
});
}
this.currentUser.id = '1'
@ -850,17 +859,17 @@ struct UserInfo {
avPlayer.playAudio([`voice/监管通信中.mp3`], false, async () => {
console.info('surenjun', '播放结束开始考试接口调用')
const { code, keystr, message } = await this.beginExam() || {};
// const { code, keystr, message } = await this.beginExam() || {};
const res = await this.beginExam()
console.info('surenjun', '开始考试接口调用结束')
// console.info('surenjun',code +'')
//@ts-ignore TODO code转换
//TODO code转换
if (code != 1) {
avPlayer.playAudio([code == -200 ? 'voice/photo_error.mp3' : 'voice/监管审核未通过.mp3']);
if (res.code != 1) {
avPlayer.playAudio([res.code == -200 ? 'voice/photo_error.mp3' : 'voice/监管审核未通过.mp3']);
this.isLoadingPopupVisible = false
this.isExamStart = false
promptAction.showToast({
message,
message: res.message,
duration: 4000
})
return
@ -876,7 +885,7 @@ struct UserInfo {
sczb: Number(this.isBoardPrePareSetPopupOpen),
kfdm: this.sczbkf,
//真实监管项目
kString: decodeURIComponent(keystr || '')
kString: decodeURIComponent(res.keystr || '')
}
}, router.RouterMode.Single);
this.updateTimeLimit = false
@ -887,19 +896,21 @@ struct UserInfo {
// 检测车门、熄火信号
async checkSignal(): Promise<boolean> {
const { isCheckFireOpen } = judgeConfig
const { systemParam, isBoardPrePareSetPopupOpen } = this;
const Param803Str = systemParam.Param803Str
// const { isCheckFireOpen } = judgeConfig
// const { systemParam } = this;
const Param803Str = this.systemParam.Param803Str
if (Param803Str === '') {
return true
}
return new Promise((resolve, reject) => {
if (isCheckFireOpen) {
if (judgeConfig.isCheckFireOpen) {
resolve(true)
return
}
let plcValue = globalThis.udpClient.getCurrentMessage();
const msgArr = plcValue.split(',') || ''
// TODO UDP缺失
// let plcValue = globalThis.udpClient.getCurrentMessage();
let plcValue = "";
const msgArr = plcValue.split(',').map(Number) || ''
const mkg = msgArr[14];
const fdjzs = msgArr[25];
const aqd = msgArr[19];
@ -947,7 +958,7 @@ struct UserInfo {
}
//请点火
if (fdjzs * 1 <= 0 && Param803Str.includes('5')) {
if (fdjzs <= 0 && Param803Str.includes('5')) {
this.avPlayer.playAudio(['voice/点火.mp3'])
promptAction.showToast({
message: '请点火',
@ -969,7 +980,7 @@ struct UserInfo {
// if (isBoardPrePareSetPopupOpen) {
if (false) {
//请熄火
if (fdjzs * 1 > 0) {
if (fdjzs > 0) {
this.avPlayer.playAudio(['voice/熄火.mp3'])
promptAction.showToast({
message: '请熄火',
@ -991,9 +1002,8 @@ struct UserInfo {
}
// 开始考试
async beginExam() {
const { carId, examinationRoomId } = this.carInfo;
const { examSubject, plateNo } = this.carInfo;
async beginExam(): Promise<BeginExamRequest> {
// const { examSubject, plateNo } = this.carInfo;
const date = new Date()
const startHourTime = await getCurrentHourTime()
AppStorage.setOrCreate('startHourTime', startHourTime)
@ -1003,19 +1013,19 @@ struct UserInfo {
this.isLoadingPopupVisible = false
return { code: -200 }
}
const drvexam = {
lsh: this.currentUser.lsh || '',
kskm: examSubject,
const drvexam: DrvexamType = {
lsh: "this.currentUser.lsh",
kskm: this.carInfo.examSubject,
ksxtbh: this.ksxtbh || '222',
sfzmhm: this.currentUser.sfzmhm || '',
ksysfzmhm: this.currentUser.ksy1sfzmhm || '',
ksxl: this.currentUser.xldm,
zp: photoBase64,
kssj: dateFormat(date) || '',
kchp: decodeURI(plateNo),
kchp: decodeURI(this.carInfo.plateNo),
Ksy2sfzmhm: this.currentUser.ksy2sfzmhm || ''
}
const param = {
const param: RegulatoryInterfaceParams = {
drvexam,
xtlb: '17',
//接口序列号
@ -1039,7 +1049,7 @@ struct UserInfo {
this.currentUser.id = '0'
DB.insertData("USER", this.currentUser).then(res => {
console.log("USER insert success",)
}).catch(err => {
}).catch((err: BusinessError) => {
console.log("USER insert fail", JSON.stringify(err))
})
// await upDateTableByArray('USER', [this.currentUser])
@ -1062,8 +1072,9 @@ struct UserInfo {
outClick() {
clearInterval(this.interval)
this.stopDeviceById()
globalThis.udpClient2 && globalThis.udpClient2?.setMsgCallBack(() => {
})
// TODO 缺失UDP
// globalThis.udpClient2 && globalThis.udpClient2?.setMsgCallBack(() => {
// })
}
// 几个按钮公共样式
@ -1082,7 +1093,7 @@ struct UserInfo {
TopLogo({ outFlag: $outFlag }).margin({ bottom: 10 })
Row() {
Row() {
ForEach(this.dataList, (item) => {
ForEach(this.dataList, (item: User) => {
Flex({ justifyContent: FlexAlign.Center, alignItems: ItemAlign.Center }) {
Column() {
CommText({
@ -1137,10 +1148,10 @@ struct UserInfo {
Flex({ justifyContent: FlexAlign.SpaceBetween }) {
Row() {
Column() {
if (this.currentUser['kszp']) {
if (this.currentUser.kszp) {
Avatar({
ratio: this.ratio,
url: this.currentUser['kszp'] ? this.currentUser['kszp'] : ''
url: this.currentUser.kszp ? this.currentUser.kszp : ''
})
} else {
Avatar({
@ -1148,10 +1159,10 @@ struct UserInfo {
url: ""
})
}
if (this.currentUser['ksmjzp']) {
if (this.currentUser.ksmjzp) {
Avatar({
ratio: this.ratio,
url: this.currentUser['ksmjzp'] ? this.currentUser['ksmjzp'] : ''
url: this.currentUser.ksmjzp ? this.currentUser.ksmjzp : ''
})
} else {
@ -1163,8 +1174,12 @@ struct UserInfo {
}
Column() {
ForEach(this.labelBlocks, (item) => {
LabelBlock({ label: item.label, ratio: this.ratio, value: this.currentUser[item.key] })
ForEach(this.labelBlocks, (item: LabelBlockType) => {
LabelBlock({
label: item.label,
ratio: this.ratio,
value: GetCurrentUserKeyValue(this.currentUser, item.key)
})
})
}
}
@ -1284,10 +1299,10 @@ struct UserInfo {
// 上车准备弹窗
if (this.isBoardPrePareSetPopupShow) {
BoardPrePareSetPopup({
closePopup: (bool) => {
closePopup: () => {
this.isBoardPrePareSetPopupShow = false;
},
confirmMark: (kfdm) => {
confirmMark: (kfdm: SckType[]) => {
this.sczbkf = kfdm
}
})

View File

@ -0,0 +1,54 @@
import { User } from "../../model";
export const GetCurrentUserKeyValue = (user: User, key: string): string => {
switch (key) {
case "sfzmhm":
return user.sfzmhm;
case "xm":
return user.xm;
case "lsh":
return user.lsh;
case "ksy1":
return user.ksy1;
case "ksy2":
return user.ksy2;
case "id":
return user.id;
case "kszp":
return user.kszp;
case "ksmjzp":
return user.ksmjzp;
case "bz1":
return user.bz1;
case "jxmc":
return user.jxmc;
case "kchp":
return user.kchp;
case "kscx":
return user.kscx;
case "ksdd":
return user.ksdd;
case "kssycs":
return user.kssycs;
case "ksxl":
return user.ksxl;
case "ksy1sfzmhm":
return user.ksy1sfzmhm;
case "kszt":
return user.kszt;
case "xb":
return user.xb;
case "xh":
return user.xh;
case "xldm":
return user.xldm;
case "yycs":
return user.yycs;
case "ksy2sfzmhm":
return user.ksy2sfzmhm;
case "kslx":
return user.kslx || '';
default:
return '';
}
}

View File

@ -7,6 +7,7 @@ import { FileHelper } from '../common/service/FileHelper';
import FileUtil from '../common/utils/File';
import { GlobalConfig } from '../config';
import promptAction from '@ohos.promptAction';
import common from '@ohos.app.ability.common';
const rtsp_server = record.createServer();
//开始录屏
@ -82,7 +83,7 @@ export async function endRecordVideo(record_handleObj) {
export async function saveStartRecordVideo(path) {
return new Promise(async (reslove, reject) => {
const context=AppStorage.get('context')
const context = AppStorage.get('context')
const fileUtil = new FileUtil(context)
const fileHelper = new FileHelper();
const date = dateFormat(new Date).split(' ')[0]
@ -110,7 +111,7 @@ export async function saveStartRecordVideo(path) {
async function getfilehandleCode(td, param, dir, path, index) {
return new Promise(async (reslove, reject) => {
console.log('pathpath1', path)
const context=AppStorage.get('context')
const context = AppStorage.get('context')
const record_handle = await startRecordVideo(param, td, context, dir, path, index)
// this.rocordHandleObj['rocord_handle'+td] = record_handle
@ -132,7 +133,7 @@ export async function getUserAlbumItemByDisplayName(displayName: string, day?,
fetchColumns: [],
predicates: predicates
};
const context=AppStorage.get('context')
const context = AppStorage.get('context')
const userFileMgr = photoAccessHelper.getPhotoAccessHelper(context);
fetchResult =
@ -182,8 +183,8 @@ interface takePhotoParam {
*/
const fileHelper = new FileHelper();
export async function delPic(day, type) {
const context=AppStorage.get('context')
export async function delPic(day: number, type: number) {
const context: common.UIAbilityContext = AppStorage.get('context')
let phAccessHelper = photoAccessHelper.getPhotoAccessHelper(context);
console.info('albumGetAssetsDemoCallback');
let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates();
@ -255,7 +256,7 @@ export async function takePhoto(param, context, dir, flag = 1, callback?) {
export async function deleteAllPicturesFn() {
fileHelper.deleteAllPictures();
const context=AppStorage.get('context')
const context = AppStorage.get('context')
deleteAllVideos(context, photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.VIDEO)
}

View File

@ -12,15 +12,6 @@ class UdpClient {
private disconnectEvents: Array<Function> = []
private dealMethod: DealMethod
private dealMessage() {
this.udp?.on("message", value => {
let result = this?.dealMethod(value.message)
this.messageEvents.forEach(cb => {
cb(result)
})
})
}
init(udpLocalIp: string, udpLocalIpPort: string, udpOppositeIp: string, udpOppositeIpPort: string) {
this.localIp = udpLocalIp
this.oppositeIp = udpOppositeIp
@ -70,12 +61,25 @@ class UdpClient {
})
})
}
private dealMessage() {
this.udp?.on("message", value => {
let result = this?.dealMethod(value.message)
this.messageEvents.forEach(cb => {
cb(result)
})
})
}
}
export const objUDPClient = new UdpClient()
// 中心心跳
export const centerUDPClient = new UdpClient()
// 中心GPS
// 顶灯
export const lightUDPClient = new UdpClient()
// 获取后置机信号
export const judgeUDPClient = new UdpClient()

View File

@ -6,7 +6,6 @@ import Prompt from '@system.prompt';
import { initialization } from '../../api';
import FileUtil from '../../common/utils/File';
import { GlobalConfig } from '../../config';
import { sqlInsertCommonFn } from '../../common/service/initable';
// 建表操作
export async function InitTable() {
@ -54,7 +53,7 @@ export function UpdateTableByArray(tableName: string, arr: Array<User>): Promise
//依据表名同步获取数据
export async function GetSyncData(tableName: string): Promise<boolean> {
export async function GetSyncData<T>(tableName: string): Promise<T[]> {
return new Promise((resolve, reject) => {
const columns: ColumnInfo[] = ParameterPlatform[tableName].columns.map((res: string) => {
return {
@ -62,14 +61,13 @@ export async function GetSyncData(tableName: string): Promise<boolean> {
columnName: res,
type: ColumnType.STRING
} as ColumnInfo
})
// TODO 需要完善此处类型
DB.queryListBySql<ESObject>(`select * from ${tableName}`, columns).then(() => {
resolve(true)
});
DB.queryListBySql<T>(`select * from ${tableName}`, columns).then((res: T[]) => {
resolve(res);
}).catch((err: BusinessError) => {
reject(err)
})
})
reject(err);
});
});
}
// TODO 后续废弃这个方法,直接调用DB.deleteByName
@ -136,13 +134,17 @@ export async function InitializeTheCentralTable(params: InitializeTheCentralTabl
}
const folderPath = await fileUtil.initFolder(`/config/tableList`);
fileUtil.addFile(`${folderPath}/${RemappingTableName[key]}.txt`, JSON.stringify(arrList))
const result = await SqlInsertTable(RemappingTableName[key], arrList)
if (!result) {
Prompt.showToast({
message: '初始化数据库失败'
})
try {
const result = await SqlInsertTable(RemappingTableName[key], arrList)
if (!result) {
Prompt.showToast({
message: '初始化数据库失败'
})
}
resolve(result)
} catch (e) {
reject(e)
}
resolve(result)
}
})
}