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

View File

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

View File

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