fix: 升级类型

This commit is contained in:
wangzhongjie 2025-02-19 10:22:03 +08:00
parent c4856b956f
commit 851981c12a
5 changed files with 149 additions and 65 deletions

View File

@ -25,36 +25,33 @@ interface WR {
} }
// 通用监管接口 // 通用监管接口
export async function writeObjectOut(params, filePath?: string): Promise<WR> { export async function writeObjectOut(params: ESObject, filePath?: string): Promise<WR> {
const singlePlay = globalThis.singlePlay const singlePlay: boolean = AppStorage.get('singlePlay')
if (singlePlay) { if (singlePlay) {
return { code: 1 } return { code: 1 }
} }
console.log('testsqlTag0') console.log('testsqlTag0')
//获取监管接口地址路径 //获取监管接口地址路径
if (!globalThis.JGPATH) { if (!globalThis.JGHOST) {
console.log('testsqlTag1')
const syssetParams = await getSyncData('MA_SYSSET') || []; const syssetParams = await getSyncData('MA_SYSSET') || [];
console.log('testsqlTag2')
//@ts-ignore
syssetParams.forEach(sys => { syssetParams.forEach(sys => {
if (sys.v_no == '839') { if (sys.v_no == '839') {
//是否是新监管 //是否是新监管
globalThis.isJGNew = sys.v_value == '3' // globalThis.isJGNew = sys.v_value == '3'
AppStorage.setOrCreate('isJGNew', sys.v_value == '3')
} }
if (sys.v_no == '900') { if (sys.v_no == '900') {
globalThis.JGHOST = validateIP(decodeURIComponent(sys.v_value)) // globalThis.JGHOST = validateIP(decodeURIComponent(sys.v_value))
AppStorage.setOrCreate('JGHOST', validateIP(decodeURIComponent(sys.v_value)))
} }
}) })
} }
const { xtlb, jkxlh, jkid, drvexam } = params; const { xtlb, jkxlh, jkid, drvexam } = params;
console.log('testsqlTag3') const isJGNew: boolean = AppStorage.get('isJGNew')
//新监管调用 //新监管调用
if (globalThis.isJGNew) { if (isJGNew) {
return await writeObjectOutNew(params, filePath) return await writeObjectOutNew(params, filePath)
} }
drvexam.zp = drvexam.zp === undefined ? undefined : encodeURIComponent(drvexam.zp) drvexam.zp = drvexam.zp === undefined ? undefined : encodeURIComponent(drvexam.zp)
@ -76,8 +73,9 @@ export async function writeObjectOut(params, filePath?: string): Promise<WR> {
} }
//对象转换成xml //对象转换成xml
const JGHOST: string = AppStorage.get("JGHOST")
const temp = await request<object>({ const temp = await request<object>({
host: globalThis.JGHOST as string, host: JGHOST,
url: '/dems_ws/services/TmriOutAccess?wsdl', url: '/dems_ws/services/TmriOutAccess?wsdl',
data: `<?xml version="1.0"?> data: `<?xml version="1.0"?>
<SOAP-ENV:Envelope <SOAP-ENV:Envelope
@ -133,7 +131,8 @@ 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('singlePlay')
if (singlePlay) { if (singlePlay) {
return return
} }
@ -169,7 +168,8 @@ 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('singlePlay')
if (singlePlay) { if (singlePlay) {
return return
} }
@ -202,7 +202,9 @@ 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('singlePlay')
if (singlePlay) { if (singlePlay) {
return return
} }
@ -227,7 +229,8 @@ export async function uploadExamMileage(params: UploadExamMileage) {
// 上传考试成绩 // 上传考试成绩
export async function uploadExamGrade(params) { export async function uploadExamGrade(params) {
const singlePlay = globalThis.singlePlay // const singlePlay = globalThis.singlePlay
const singlePlay: boolean = AppStorage.get('singlePlay')
if (singlePlay) { if (singlePlay) {
return return
} }

View File

@ -1,10 +1,10 @@
import { getSyncData } from '../common/service/initable'; import { getSyncData } from '../common/service/initable';
import request from "../utils/Request" import request from '../utils/Request';
import FileUtil from '../common/utils/File'; import FileUtil from '../common/utils/File';
import FileLog from '../pages/judgeSDK/utils/fileLog';
import http from '@ohos.net.http'; import http from '@ohos.net.http';
import App from '@system.app'; import common from '@ohos.app.ability.common';
import { DrvexamType, GetJudgeParamsType } from '../model';
//监管接口序列号映射 //监管接口序列号映射
const gjxlhObj: Record<string, string> = { const gjxlhObj: Record<string, string> = {
@ -21,21 +21,21 @@ interface WR {
code: number code: number
} }
export default async function writeObjectOutNew(data, filePath): Promise<WR> { export default async function writeObjectOutNew(data, filePath: string): Promise<WR> {
const context=AppStorage.get('context') const context: common.UIAbilityContext = AppStorage.get('context')
const fileUtil = new FileUtil(context); const fileUtil = new FileUtil(context);
const { jkid, drvexam } = data; // const { jkid, drvexam } = data;
const basic = await getBasicConfig(jkid); const basic = await getBasicConfig(data.jkid);
const params = await getParams(jkid, drvexam); const params = await getParams(data.jkid, data.drvexam);
const { wglb, jkxlh, glbm, jgbh, sjbs } = basic; // const { wglb, jkxlh, glbm, jgbh, sjbs } = basic;
if (filePath) { if (filePath) {
await fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`, JSON.stringify({ await fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`, JSON.stringify({
wglb, wglb: basic.wglb,
jkxlh, jkxlh: basic.jkxlh,
glbm, glbm: basic.glbm,
jgbh, jgbh: basic.jgbh,
sjbs, sjbs: basic.sjbs,
data: params.data, data: params.data,
file: { file: {
...params.file, param: [] ...params.file, param: []
@ -62,11 +62,11 @@ export default async function writeObjectOutNew(data, filePath): Promise<WR> {
> >
<SOAP-ENV:Body> <SOAP-ENV:Body>
<writeObjectOut xmlns="http://service.es.doron"> <writeObjectOut xmlns="http://service.es.doron">
<wglb>${wglb}</wglb> <wglb>${basic.wglb}</wglb>
<jkxlh>${jkxlh}</jkxlh> <jkxlh>${basic.jkxlh}</jkxlh>
<glbm>${glbm}</glbm> <glbm>${basic.glbm}</glbm>
<jgbh>${jgbh}</jgbh> <jgbh>${basic.jgbh}</jgbh>
<sjbs>${sjbs}</sjbs> <sjbs>${basic.sjbs}</sjbs>
<data>${JSON.stringify(params.data)}</data> <data>${JSON.stringify(params.data)}</data>
<file>${JSON.stringify(params.file)}</file> <file>${JSON.stringify(params.file)}</file>
</writeObjectOut> </writeObjectOut>
@ -84,8 +84,8 @@ export default async function writeObjectOutNew(data, filePath): Promise<WR> {
return temp return temp
} }
export async function getParams(jkid, drvexam) { export async function getParams(jkid: string, drvexam: DrvexamType): Promise<GetJudgeParamsType> {
const examSubject = globalThis.carInfo.examSubject; const examSubject: number = globalThis.carInfo.examSubject;
switch (jkid) { switch (jkid) {
//开始考试 //开始考试
case '17C51': case '17C51':
@ -95,7 +95,7 @@ export async function getParams(jkid, drvexam) {
param: { param: {
sfzmhm: drvexam.sfzmhm, sfzmhm: drvexam.sfzmhm,
kchp: decodeURI(drvexam.kchp), kchp: decodeURI(drvexam.kchp),
kskm: examSubject, kskm: examSubject.toString(),
ksxl: examSubject == 3 ? drvexam.ksxl : undefined, ksxl: examSubject == 3 ? drvexam.ksxl : undefined,
kssj: drvexam.kssj kssj: drvexam.kssj
} }
@ -103,7 +103,12 @@ export async function getParams(jkid, drvexam) {
file: { file: {
sjbs: gjxlhObj[jkid], sjbs: gjxlhObj[jkid],
// param: [{ field: '', data: examSubject == 2 ? encodeURIComponent(drvexam.zp) : drvexam.zp }] // param: [{ field: '', data: examSubject == 2 ? encodeURIComponent(drvexam.zp) : drvexam.zp }]
param: [{ field: '', data: drvexam.zp }] param: [
{
field: '',
data: drvexam.zp
}
]
} }
} }
//项目开始 //项目开始
@ -114,12 +119,12 @@ export async function getParams(jkid, drvexam) {
param: { param: {
sfzmhm: drvexam.sfzmhm, sfzmhm: drvexam.sfzmhm,
kskm: drvexam.kskm, kskm: drvexam.kskm,
ksxm: drvexam.ksxm,
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,
} }
}, },
file: { file: {
@ -137,7 +142,7 @@ export async function getParams(jkid, drvexam) {
kfsj: drvexam.kfsj, kfsj: drvexam.kfsj,
kfxm: drvexam.kfxm, kfxm: drvexam.kfxm,
kfxmmx: drvexam.kfxmmx, kfxmmx: drvexam.kfxmmx,
kskm: examSubject, kskm: examSubject.toString(),
ksxm: drvexam.ksxm, ksxm: drvexam.ksxm,
sfzmhm: drvexam.sfzmhm sfzmhm: drvexam.sfzmhm
} }
@ -172,7 +177,7 @@ export async function getParams(jkid, drvexam) {
param: { param: {
czlx: drvexam.czlx, czlx: drvexam.czlx,
jssj: drvexam.jssj, jssj: drvexam.jssj,
kskm: examSubject, 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,
@ -192,7 +197,7 @@ export async function getParams(jkid, drvexam) {
ghks: "0", ghks: "0",
jssj: drvexam.jssj, jssj: drvexam.jssj,
kscj: drvexam.kscj, kscj: drvexam.kscj,
kskm: examSubject, kskm: examSubject.toString(),
kslc: drvexam.kslc, kslc: drvexam.kslc,
sfzmhm: drvexam.sfzmhm sfzmhm: drvexam.sfzmhm
}, },
@ -210,11 +215,9 @@ async function getBasicConfig(jkid) {
const examSubject = globalThis.carInfo.examSubject; const examSubject = globalThis.carInfo.examSubject;
const syssetParam = await getSyncData('MA_SYSSET'); const syssetParam = await getSyncData('MA_SYSSET');
let syssetObj = {}; let syssetObj = {};
//@ts-ignore
syssetParam.forEach(sys => { syssetParam.forEach(sys => {
syssetObj[sys.v_no] = decodeURIComponent(sys.v_value) syssetObj[sys.v_no] = decodeURIComponent(sys.v_value)
}); });
return { return {
//外挂类别 //外挂类别
wglb: examSubject == 2 ? "700203" : "700204", wglb: examSubject == 2 ? "700203" : "700204",

View File

@ -18,11 +18,13 @@ export interface CarConfigurationParams {
body: Record<string, string>; body: Record<string, string>;
} }
// 车辆信息
export interface CarInfoType { export interface CarInfoType {
carId?: string; carId?: string;
examinationRoomId?: string; examinationRoomId?: string;
plateNo?: string; plateNo?: string;
carNo?: string; carNo?: string;
examSubject?: string;
} }

View File

@ -1,13 +1,98 @@
// ------------------------------
// 基础共用类型
// ------------------------------
/** 基础考试字段 */
interface BaseExamFields {
kchp?: string;
sfzmhm?: string;
ksxl?: string;
kssj?: string;
kskm?: string;
ksxm?: string;
kscj?: string;
kslc?: string;
dwlc?: string;
zpsj?: string;
jssj?: string;
czlx?: string;
cs?: string;
}
// ------------------------------
// 独立接口
// ------------------------------
/** Amplify 项目配置 */
export interface AmplifyItem { export interface AmplifyItem {
name: string; name: string;
projectCode: string; projectCode: string;
projectCodeCenter: string; projectCodeCenter: string;
} }
/** UDP 通信参数 */
export interface UDPParamType { export interface UDPParamType {
id?: number; id?: number;
list?: number[]; list?: number[];
carNo?: string; carNo?: string;
placeId?: string; placeId?: string;
sendCallback?: () => void; sendCallback?: () => void;
}
/** 扣分代码项 */
export interface KfdmType {
xmdm: number;
kfdm: string;
markreal: number;
markcatalog: string;
score: number;
}
// ------------------------------
// 考试评判相关类型
// ------------------------------
/** 评判文件数据项 */
interface JudgeFileParam {
field?: string;
data?: string;
}
/** 评判请求参数 */
export interface GetJudgeParamsType {
data?: JudgeData;
file?: JudgeFile;
}
/** 评判数据主体 */
interface JudgeData {
sjbs?: string;
param?: JudgeParams;
}
/** 考试评判参数 */
interface JudgeParams extends BaseExamFields {
sbbh?: string;
kffs?: string;
kfsj?: string;
kfxm?: string;
kfxmmx?: string;
ghks?: string;
}
/** 评判文件结构 */
interface JudgeFile {
sjbs?: string;
param?: JudgeFileParam[];
}
/** 考试过程数据 */
export interface DrvexamType extends BaseExamFields {
zp?: string;
sbxh?: string;
kffs?: string;
kfsj?: string;
kfxm?: string;
kfxmmx?: string;
ghks?: string;
} }

View File

@ -8,6 +8,7 @@ import { MarkRule, SYSSET } 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, KfdmType } from '../../../model';
interface SEL { interface SEL {
fontColor: string fontColor: string
@ -27,13 +28,7 @@ export default struct DeductedPopup {
@State ksxl: string = '' @State ksxl: string = ''
@State score: number = 100; @State score: number = 100;
@State judgeConfigObj: { [k: string]: any } = {} @State judgeConfigObj: { [k: string]: any } = {}
@State kfdmArr: { @State kfdmArr: KfdmType[] = []
xmdm: number,
kfdm: string,
markreal: number,
markcatalog: string
score: number
}[] = []
//开始考试前判绕车一周评判是否开启 //开始考试前判绕车一周评判是否开启
@State isOpen: boolean = false @State isOpen: boolean = false
//监管序列号 //监管序列号
@ -51,27 +46,26 @@ export default struct DeductedPopup {
@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 = undefined
@State carInfo: object = {} @State carInfo: CarInfoType = {}
@State singlePlay: boolean = false @State singlePlay: boolean = false
@State selectedLineStyle: SEL = { @State selectedLineStyle: SEL = {
fontColor: '#FFF', fontColor: '#FFF',
bgColor: '#B36E00' bgColor: '#B36E00'
} }
private context = getContext(this) as common.UIAbilityContext;
private judgeTask: JudgeTask
private filePhoto: FilePhoto
// 过程照片拍照 // 过程照片拍照
getPhoto = async (empty?: boolean) => { getPhoto = async (empty?: boolean) => {
//单机模式返回空照片 //单机模式返回空照片
if (this.singlePlay) { if (this.singlePlay) {
return '' return ''
} else { } else {
const { filePhoto } = this; const photoBase64 = await this.filePhoto.getPhoto();
const photoBase64 = await filePhoto.getPhoto();
return photoBase64 return photoBase64
} }
} }
private context = getContext(this) as common.UIAbilityContext; private avPlayer: VoiceAnnounce
private judgeTask: JudgeTask
private filePhoto: FilePhoto
private avPlayer
async aboutToAppear() { async aboutToAppear() {
this.carInfo = AppStorage.get('carInfo') this.carInfo = AppStorage.get('carInfo')
@ -82,8 +76,7 @@ export default struct DeductedPopup {
this.filePhoto = mediaTest this.filePhoto = mediaTest
//上车准备 //上车准备
// this.universalMarkRules = this.markRules.filter(item => this.currentItems.includes(item.itemno+'')) // this.universalMarkRules = this.markRules.filter(item => this.currentItems.includes(item.itemno+''))
const { isTrajectoryOpen } = judgeConfig; if (judgeConfig.isTrajectoryOpen) {
if (isTrajectoryOpen) {
await this.initDb() await this.initDb()
} else { } else {
await this.initSysset() await this.initSysset()
@ -595,10 +588,8 @@ export default struct DeductedPopup {
private closePopup: Function = () => { private closePopup: Function = () => {
} }
private confirmMark: Function = (itemno: number, serial: string) => { private confirmMark: Function = (itemno: number, serial: string) => {
} }
private endLoading: Function = () => { private endLoading: Function = () => {
} }
} }