From 34f77cac8da040827afb9b1d72c417006f995267 Mon Sep 17 00:00:00 2001 From: lixiao <932184220@qq.com> Date: Wed, 12 Feb 2025 09:16:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96api?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- entry/src/main/ets/api/judge.ets | 54 +- .../ets/api/{judgeNew.ts => judgeNew.ets} | 50 +- .../src/main/ets/api/{login.ts => login.ets} | 24 +- entry/src/main/ets/api/systemRest.ts | 31 - entry/src/main/ets/api/typings.d.ts | 964 ------------------ .../ets/api/{userInfo.ts => userInfo.ets} | 51 +- entry/src/main/ets/utils/Request.ets | 2 +- 7 files changed, 117 insertions(+), 1059 deletions(-) rename entry/src/main/ets/api/{judgeNew.ts => judgeNew.ets} (86%) rename entry/src/main/ets/api/{login.ts => login.ets} (50%) delete mode 100644 entry/src/main/ets/api/systemRest.ts delete mode 100644 entry/src/main/ets/api/typings.d.ts rename entry/src/main/ets/api/{userInfo.ts => userInfo.ets} (76%) diff --git a/entry/src/main/ets/api/judge.ets b/entry/src/main/ets/api/judge.ets index 52383b63..e4a29c14 100644 --- a/entry/src/main/ets/api/judge.ets +++ b/entry/src/main/ets/api/judge.ets @@ -3,7 +3,6 @@ import { getCurrentTime } from '../common/utils/tools'; import { getSyncData } from '../common/service/initable'; import writeObjectOutNew from './judgeNew'; import FileUtil from '../common/utils/File'; -import tempRequest from '../common/utils/tempRequest'; import http from '@ohos.net.http'; let baseHost = globalThis.host; @@ -78,7 +77,7 @@ export async function writeObjectOut(params, filePath?: string): Promise { //对象转换成xml const temp = await request({ - host: globalThis.JGHOST, + host: globalThis.JGHOST as string, url: '/dems_ws/services/TmriOutAccess?wsdl', data: ` { return temp } -interface uploadExamProgressDataParams{ +interface UploadExamProgressDataParams { carId: string examinationRoomId: string type: string @@ -133,13 +132,12 @@ interface uploadExamProgressDataParams{ } // 过程文件上传 -export async function uploadExamProgressData(params:uploadExamProgressDataParams) { +export async function uploadExamProgressData(params: UploadExamProgressDataParams) { const singlePlay = globalThis.singlePlay - const { carId, examinationRoomId, type, time, cardNo, examData, examStartTime, examEndTime } = params if (singlePlay) { return } - return tempRequest({ + return request({ url: '/der2/services/exam/uploadExamDataFile.ws', data: ` @@ -159,9 +157,19 @@ export async function uploadExamProgressData(params:uploadExamProgressDataParams }) } -export async function uploadExamProgressData2(params) { +interface UploadExamProgressDataParams2 { + carId: string + examinationRoomId: string + type: string + time: string + cardNo: string + examData: string + examStartTime: string + examEndTime: string +} + +export async function uploadExamProgressData2(params: UploadExamProgressDataParams2) { const singlePlay = globalThis.singlePlay - const { carId, examinationRoomId, type, time, cardNo, examData, examStartTime, examEndTime } = params if (singlePlay) { return } @@ -169,15 +177,15 @@ export async function uploadExamProgressData2(params) { url: '/der2/services/exam/uploadExamDataFile.ws', data: ` - + - ${carId} - ${examinationRoomId} - ${examData} - ${type} - ${cardNo} - ${examStartTime} - ${examEndTime} + ${params.carId} + ${params.examinationRoomId} + ${params.examData} + ${params.type} + ${params.cardNo} + ${params.examStartTime} + ${params.examEndTime} `, method: http.RequestMethod.POST, @@ -185,8 +193,15 @@ export async function uploadExamProgressData2(params) { }) } +interface UploadExamMileage { + carId: string + examinationRoomId: string + lsh: string + kslc: string +} + // 上传考试里程 -export async function uploadExamMileage(params) { +export async function uploadExamMileage(params: UploadExamMileage) { const singlePlay = globalThis.singlePlay if (singlePlay) { return @@ -233,16 +248,17 @@ export async function uploadExamGrade(params) { } function validateIP(path: string) { - const reg = new RegExp(/(\w+):\/\/([^/:]+)(:\d*)?/) + const reg = new RegExp(`(\w+):\/\/([^/:]+)(:\d*)?`) const result = path.match(reg); return result[0] } // 上传运行时常 -export async function uploadHarmonyLiCheng(data) { +export async function uploadHarmonyLiCheng(data: object) { return request({ url: '/der2/services/data/harmonyLiCheng.ws', data, method: http.RequestMethod.POST, + xml: false }) } diff --git a/entry/src/main/ets/api/judgeNew.ts b/entry/src/main/ets/api/judgeNew.ets similarity index 86% rename from entry/src/main/ets/api/judgeNew.ts rename to entry/src/main/ets/api/judgeNew.ets index 9fac6e5d..1795ebb6 100644 --- a/entry/src/main/ets/api/judgeNew.ts +++ b/entry/src/main/ets/api/judgeNew.ets @@ -1,11 +1,12 @@ import { getSyncData } from '../common/service/initable'; -import request from "../common/utils/request" -let baseHost = globalThis.host; +import request from "../utils/Request" + import FileUtil from '../common/utils/File'; import FileLog from '../pages/judgeSDK/utils/fileLog'; +import http from '@ohos.net.http'; //监管接口序列号映射 -const gjxlhObj = { +const gjxlhObj: Record = { '17C51': '02-21-000009', '17C52': '02-21-000010', '17C53': '02-21-000011', @@ -14,33 +15,39 @@ const gjxlhObj = { '17C56': '02-21-000014', } -interface WR{ - message?:string - code:number +interface WR { + message?: string + code: number } -export default async function writeObjectOutNew(data,filePath): Promise { +export default async function writeObjectOutNew(data, filePath): Promise { const fileUtil = new FileUtil(globalThis.context); - const {jkid , drvexam} = data; + const { jkid, drvexam } = data; const basic = await getBasicConfig(jkid); const params = await getParams(jkid, drvexam); - const {wglb,jkxlh,glbm,jgbh,sjbs} = basic; + const { wglb, jkxlh, glbm, jgbh, sjbs } = basic; - if(filePath){ - await fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`,JSON.stringify({ - wglb,jkxlh,glbm,jgbh,sjbs, - data:params.data, - file:{...params.file,param:[]}, + if (filePath) { + await fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`, JSON.stringify({ + wglb, + jkxlh, + glbm, + jgbh, + sjbs, + data: params.data, + file: { + ...params.file, param: [] + }, })); } // let connectTimeout = sjbs === '02-21-000014' ?60000:1 - console.info('surenjun','调用新监管') - let temp + console.info('surenjun', '调用新监管') + let temp: WR try { - temp = await request({ - host: globalThis.JGHOST, - method: 'post', + temp = await request({ + host: globalThis.JGHOST as string, + method: http.RequestMethod.POST, //是否是新中心 isNewCenter: true, xml: true, @@ -69,11 +76,10 @@ export default async function writeObjectOutNew(data,filePath): Promise { temp = e } console.log("temp message: ", JSON.stringify(temp)) - if(filePath){ - await fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`,JSON.stringify(temp) +`\n`); + if (filePath) { + await fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`, JSON.stringify(temp) + `\n`); } return temp - } export async function getParams(jkid, drvexam) { diff --git a/entry/src/main/ets/api/login.ts b/entry/src/main/ets/api/login.ets similarity index 50% rename from entry/src/main/ets/api/login.ts rename to entry/src/main/ets/api/login.ets index 98a11804..d29fd92a 100644 --- a/entry/src/main/ets/api/login.ts +++ b/entry/src/main/ets/api/login.ets @@ -1,10 +1,18 @@ -import request from "../common/utils/request" +import request from "../utils/Request" +import http from "@ohos.net.http" -export async function examinerLogin(params){ - return request({ - url:'/der2/services/exam/examinerLogin.ws', - data:` +interface ExaminerLoginParams { + carId + examinationRoomId + username + password +} + +export async function examinerLogin(params: ExaminerLoginParams) { + return request({ + url: '/der2/services/exam/examinerLogin.ws', + data: ` ${params.carId} @@ -13,7 +21,7 @@ export async function examinerLogin(params){ ${params.password} `, - method:'post', - xml:true, - }) + method: http.RequestMethod.POST, + xml: true, + }) } \ No newline at end of file diff --git a/entry/src/main/ets/api/systemRest.ts b/entry/src/main/ets/api/systemRest.ts deleted file mode 100644 index 6708ac57..00000000 --- a/entry/src/main/ets/api/systemRest.ts +++ /dev/null @@ -1,31 +0,0 @@ -// @ts-ignore -/* eslint-disable */ -import request from '../common/utils/http'; - -/** 2.考试中心执行参数同步 由外部(考试平台)调用,主动请求参数平台同步基础数据 GET /system/doParamBaseDataSync */ -export async function doParamBaseDataSyncUsingGet(options?: { [key: string]: any }) { - return request('/system/doParamBaseDataSync', { - method: 'GET', - ...(options || {}), - }); -} - -/** 3.考试中心执行参数数据同步 由外部(考试平台)调用,主动请求参数平台同步参数数据 GET /system/doParamConfigDataSync */ -export async function doParamConfigDataSyncUsingGet(options?: { [key: string]: any }) { - return request('/system/doParamConfigDataSync', { - method: 'GET', - ...(options || {}), - }); -} - -/** 1.用户登录 用户登录接口,获取用户相关信息和登录Token,登录后调用后台接口时,将Token放到请求头中 POST /system/userLogin.do */ -export async function userLoginUsingPost(body: API.Pinyin_21, options?: { [key: string]: any }) { - return request('/system/userLogin.do', { - method: 'POST', - headers: { - 'Content-Type': 'application/json;charset=UTF-8', - }, - data: body, - ...(options || {}), - }); -} diff --git a/entry/src/main/ets/api/typings.d.ts b/entry/src/main/ets/api/typings.d.ts deleted file mode 100644 index df222d1f..00000000 --- a/entry/src/main/ets/api/typings.d.ts +++ /dev/null @@ -1,964 +0,0 @@ -declare namespace API { - type CarBrand_ = { - /** 品牌名 {type_name} */ - brandName?: string; - /** 创建者 */ - createBy?: string; - /** 创建时间 */ - createTime?: string; - /** 百米脉冲 */ - hundredMeterPulse?: string; - /** 主键 */ - id?: number; - /** 签到序号起始点 */ - signNumber?: number; - /** SIMPLE_NAME */ - simpleName?: string; - /** 更新者 */ - updateBy?: string; - /** 更新时间 */ - updateTime?: string; - }; - - type CarInfo_ = { - /** 监管分车时间 */ - assignTime?: string; - /** 车辆品牌id [car_brand.id] {cartypeid} */ - carBrandId?: number; - /** 考车自检状态(0:不用检查,1:待检查,2:检查通过,3:检查不通过) */ - carCheckStatus?: string; - /** 考车实际IP {carip} */ - carIp?: string; - /** 考车对应mac地址 */ - carMac?: string; - /** 考车编号 {carno} */ - carNo?: string; - /** 考车身份证号 */ - cardNoArray?: string; - /** 创建者 */ - createBy?: string; - /** 创建时间 */ - createTime?: string; - /** 删除标记(0:存在,2:已经删除)(status) */ - delFlag?: string; - /** 考点id [sys_dept.dept_id] {exampointid} */ - deptId?: number; - /** 设备号 */ - deviceNo?: string; - /** 考车状态(1:正常,2:停用,3:异常) */ - deviceStatus?: string; - /** 准驾车型 {cartype} */ - drivingLicenseType?: string; - /** 终点库位号 {zdkwh} */ - endPointNo?: string; - /** 考车路线 */ - examLineArray?: string; - /** 所属考官对应的用户id [sys_user.user_id] */ - examManId?: number; - /** 考试场次 {kscc} */ - examRound?: number; - /** 当前登录随车考试员id [examiner_info.id] */ - examinerId?: number; - /** 考场区域代号 */ - fieldId?: string; - /** 百米脉冲 */ - hundredMeterPulse?: string; - /** 主键 */ - id?: number; - /** 监控审核人脸识别方式(0:无人脸识别,1:视频截图方式,2:考车上传方式) {isface} */ - isFace?: string; - /** 是否更新map_collect (0:否,1:是) {is_mapcollect} */ - isMapCollect?: string; - /** 是否需要审核(0:否,1:是) */ - isReview?: string; - /** 上一次登录随车考试员 [examiner_info.id] */ - lastExaminerId?: number; - /** 考车号牌 {carcode} */ - licensePlate?: string; - /** 模型id [model_info.id] {modelid} */ - modelId?: number; - /** 导航线路 {dhxl} */ - navigationLine?: string; - /** 考车对应软件版本 */ - softwareVersion?: string; - /** 更新者 */ - updateBy?: string; - /** 更新时间 */ - updateTime?: string; - /** 车辆型号 */ - vehicleModel?: string; - /** 考车对应车辆识别代号 */ - vin?: string; - /** 考试路线 */ - wayNo?: number; - }; - - type ExamInfoVo = { - bk1?: string; - bz1?: string; - cartype?: string; - czlx?: string; - fieldid?: string; - flag?: string; - fz?: string; - jdxx?: string; - jxmc?: string; - kchp?: string; - kfxm?: string; - kscc?: string; - kscx?: string; - ksdd?: string; - kskm?: string; - kslx?: string; - ksmjzp?: string; - kssycs?: string; - ksxl?: string; - ksy1?: string; - ksy1sfzmhm?: string; - ksy2?: string; - ksy2sfzmhm?: string; - kszp?: string; - kszt?: string; - ktbh?: string; - lsh?: string; - motorType?: string; - roadway?: string; - securityGuard?: string; - sfcode?: string; - sfzmhm?: string; - updatetime?: string; - xb?: string; - xh?: string; - xldm?: string; - xm?: string; - ykrq?: string; - yycs?: string; - zkzmbh?: string; - zwxx1?: string; - zwxx2?: string; - zwxx3?: string; - zwxx4?: string; - }; - - type ExamPointInfo_ = { - /** 考场地址 {address} */ - address?: string; - /** 考场车辆类型(1:小车,2:大车,3:摩托){is_motor} */ - carType?: string; - /** 创建者 */ - createBy?: string; - /** 创建时间 */ - createTime?: string; - /** 所属部门id [sys_dept.dept_id] {organize_id} */ - deptId?: number; - /** 考点名称 {name} */ - deptName?: string; - /** 准驾车型(列表,逗号隔开) {car_type} */ - drivingLicenseType?: string; - /** 考点代码 {code} */ - examPointCode?: string; - /** 考点全称 {fullname} */ - fullName?: string; - /** 主键 */ - id?: number; - /** 联系人 {contact} */ - master?: string; - /** 联系电话 {phone} */ - phone?: string; - /** 电子地图映射信息json */ - photoInfo?: string; - /** 电子地图图片路径 {path} */ - photoPath?: string; - /** 备注 */ - remark?: string; - /** 考试科目 {type} */ - subjectType?: string; - /** 更新者 */ - updateBy?: string; - /** 更新时间 */ - updateTime?: string; - }; - - type GpsIPUdpIP_ = { - /** 车辆品牌名称 */ - carBrandName?: string; - /** 准驾车型(C1、C2...) */ - drivingLicenseType?: string; - /** GPS差分服务器地址 */ - gpsAddress?: string; - /** 是否需要自检(0:不需要自检,1:需要自检) */ - isNeedCheck?: string; - /** 百米脉冲 */ - pulse?: string; - /** 考试科目 */ - subjectType?: string; - /** UDP服务器数据端口号 */ - udpDataPort?: string; - /** UDP服务器ip */ - udpIp?: string; - /** UDP服务器消息端口号 */ - udpMessagePort?: string; - /** 语音对讲服务ip */ - voiceIp?: string; - /** 语音对讲服务端口号 */ - voicePort?: string; - }; - - type GpsIPUdpIP2 = { - /** 车牌号 */ - licensePlate: string; - /** 评判版本号 */ - softwareVersion: string; - }; - - type MarkRuleSet = { - itemName?: string; - itemno?: string; - kfxh?: string; - markcatalog?: string; - markdepend?: string; - markreal?: string; - markserial?: string; - markshow?: string; - markstandard?: string; - }; - - type paramConfigDataSyncUsingGETParams = { - /** tableName */ - tableName: string; - }; - - type Pinyin__ = { - /** 车牌号 */ - licensePlate: string; - /** 考试里程{kslc} */ - mileage: number; - /** 流水号 */ - serialNo: string; - /** 特殊扣分内容 */ - specialSub?: string; - }; - - type Pinyin_10 = { - /** 考车id */ - gunCameraInfos?: Pinyin_9[]; - }; - - type Pinyin_11 = { - /** 小红球程序编号 */ - deviceNo: string; - /** 小红球消息 */ - message: string; - }; - - type Pinyin_12 = { - kaoShengXinXi?: ExamInfoVo[]; - }; - - type Pinyin_13 = { - b2no?: string; - c1no?: string; - c2no?: string; - c5no?: string; - deviceNo?: string; - fieldId?: string; - kscc?: string; - }; - - type Pinyin_14 = { - judgeVersion?: string; - kdid?: string; - kskm?: string; - markRuleSet?: MarkRuleSet[]; - shellVersion?: string; - speendParam?: string; - vehicleSpeend?: VehicleSpeend[]; - }; - - type Pinyin_15 = { - /** 小红球程序编号 */ - deviceNo: string; - }; - - type Pinyin_16 = { - aqyphoto?: string; - aqysfzmhm?: string; - aqyxm?: string; - bkhgkssj?: string; - jxmc?: string; - kch?: string; - kchp?: string; - kclx?: string; - kcmc?: string; - kscs?: string; - kscx?: string; - ksxl?: string; - ksyphoto?: string; - ksysfzmhm?: string; - ksyxm?: string; - lsh?: string; - sfzmhm?: string; - xm?: string; - yycs?: string; - zp1?: string; - zp2?: string; - zwh?: string; - }; - - type Pinyin_17 = { - /** 考车编号 */ - carNo: string; - /** 小红球程序编号 */ - deviceNo: string; - /** 流水号 */ - serialNo: string; - }; - - type Pinyin_18 = { - /** 随车考试员编号 */ - examinerCode?: string; - /** 车牌号 */ - licensePlate: string; - /** 流水号 */ - serialNo: string; - }; - - type Pinyin_19 = { - /** 安徽已考项目 */ - ahykxx?: string; - /** 大车初考项目 */ - firstABykxx?: string; - /** 考试剩余次数 */ - kssycs?: string; - /** 考试预约流水号 */ - lsh?: string; - /** 摩托车考试模式 */ - motorType?: string; - /** 大车补考项目 */ - secondABykxx?: string; - /** 约考信息,内容如:开始时间;里程;考试项目;扣分项目;特殊地方扣分明细 */ - ykxx?: string; - }; - - type Pinyin_2 = { - /** 文件base64 */ - examData: string; - /** 考试结束时间 */ - examEndTime: string; - /** 考试开始时间 */ - examStartTime: string; - /** 文件名称(type=2/3时需要传) */ - fileName?: string; - /** 车牌号 */ - licensePlate: string; - /** 流水号 */ - serialNo: string; - /** 文件类型,鸿蒙考车固定传1(0:本地轨迹,1:监管轨迹,2:轨迹回放,3:注意力识别) */ - type: string; - }; - - type Pinyin_20 = { - /** 考车请求时间,跟下面请求数据data中的业务发生时间相同,这里用作设备时差校验 */ - carSendTime: string; - /** 请求数据,详见无锡所接口文档。JSON对象 */ - data: Record; - /** 文件列表 */ - files?: WxsBaseFileBean[]; - /** 车牌号 */ - licensePlate: string; - /** 接口编号,例如:02-21-000009(考试开始) */ - restCode: string; - }; - - type Pinyin_21 = { - /** 设备imei号 */ - imei: string; - /** 用户登录时间戳 */ - loginTime: number; - /** md5加密串(根据imei号+时间戳+盐混淆) */ - signKey: string; - }; - - type Pinyin_22 = { - /** 中心服务器当前时间 */ - time?: string; - }; - - type Pinyin_23 = { - /** 设备名称 */ - deviceName: string; - /** 设备编号 */ - deviceNo: string; - /** 设备类型(1:考车;2:闸机;3:大屏;4:指纹仪;5:拍照) */ - type: string; - }; - - type Pinyin_24 = { - /** 考试项目 */ - bk1?: string; - /** 备注1 0,0, */ - bz1?: string; - /** 考试车型,考生表的carType */ - cartype?: string; - /** 操作类型 */ - czlx?: string; - /** 考试区域 */ - fieldid?: string; - /** 考试是否合格 */ - flag?: string; - /** 考试分组 */ - fz?: string; - /** 阶段信息 */ - jdxx?: string; - /** 驾校名称 */ - jxmc?: string; - /** 考车号牌 */ - kchp?: string; - /** 扣分项目 */ - kfxm?: string; - /** 考试场次 */ - kscc?: string; - /** 考试车型 */ - kscx?: string; - /** 考试地点,考场编号 */ - ksdd?: string; - /** 考试科目 */ - kskm?: string; - /** 考试类型 */ - kslx?: string; - /** ksmjzp */ - ksmjzp?: string; - /** 考试剩余次数 */ - kssycs?: string; - /** 考试线路-实用 */ - ksxl?: string; - /** 考试员姓名1 */ - ksy1?: string; - /** 考试员1身份证号 */ - ksy1sfzmhm?: string; - /** 考试员随车考试员2 */ - ksy2?: string; - /** 考试员2身份证号 */ - ksy2sfzmhm?: string; - /** 考生照片,base64编码 */ - kszp?: string; - /** 考试状态 */ - kszt?: string; - /** 考台编号 */ - ktbh?: string; - /** 考试预约流水号 */ - lsh?: string; - /** 摩托车考试模式 1.先考科目2,再考科目3 2.科目2 3.科目3 4.先考科目3,再考科目2 */ - motorType?: string; - /** 车道 */ - roadway?: string; - /** 安全员姓名 */ - securityGuard?: string; - /** 6位身份编码 */ - sfcode?: string; - /** 身份证号 */ - sfzmhm?: string; - /** 上车更新时间 */ - updatetime?: string; - /** 考生性别 */ - xb?: string; - /** 序号 */ - xh?: string; - /** 监管线路代码,上传用 */ - xldm?: string; - /** 考生姓名 */ - xm?: string; - /** 约考日期 */ - ykrq?: string; - /** 预约次数 */ - yycs?: string; - /** 准考证明编号,admissionNo */ - zkzmbh?: string; - /** 指纹1 */ - zwxx1?: string; - /** 指纹2 */ - zwxx2?: string; - /** 指纹3 */ - zwxx3?: string; - /** 指纹4 */ - zwxx4?: string; - }; - - type Pinyin_25 = { - /** 设备号 */ - deviceNo: string; - /** 照片1 */ - firstImage: string; - /** 照片2 */ - secondImage: string; - /** 身份证号码 */ - sfzh: string; - }; - - type Pinyin_26 = { - /** 车牌号 */ - licensePlate: string; - /** 流水号 */ - serialNo: string; - }; - - type Pinyin_27 = { - /** 类别(1:外壳,2:视屏,3:评判,4:接口) */ - category: string; - /** 车牌号 */ - licensePlate: string; - /** 日志内容 */ - logData: string; - /** 考车日志类型(1:升级日,2:错误日志) */ - logType: string; - /** 考车发生时间(格式:yyyy-MM-dd HH:mm:ss) */ - vehicleTime: string; - }; - - type Pinyin_28 = { - /** 设备编号 */ - deviceNo: string; - }; - - type Pinyin_29 = { - /** 自检结果附带信息 */ - condition: string; - /** 自检结果(1:合格,0:不合格) */ - flag: string; - /** 车牌号 */ - licensePlate: string; - }; - - type Pinyin_3 = { - /** 车牌号 */ - licensePlate: string; - }; - - type Pinyin_30 = { - /** 考车编号 */ - carNo?: string; - /** 车辆类型 */ - carType?: string; - /** 身份证号 */ - cardNo?: string; - /** 设备编号 */ - deviceNo?: string; - faceVerifyRes?: string; - /** fieldId */ - fieldId?: string; - fingerVerifyRes?: string; - /** 体温是否正常标志 */ - health?: string; - /** 6位身份编码 */ - idNoSix?: string; - /** 考官证件号码 */ - kgCardNo?: string; - /** 人工过门禁原因 */ - manualReason?: string; - /** mixModel */ - mixModel?: string; - /** 人脸识别度 */ - rlsbValue?: string; - /** 流水号 */ - serialNo?: string; - sfzzp?: string; - /** 考试科目 */ - subjectType?: string; - /** 体温值 */ - temperature?: string; - /** 体温照片1 */ - twzp1?: string; - /** 体温照片2 */ - twzp2?: string; - /** 照片 */ - zp?: string; - zw1?: string; - zw2?: string; - zw3?: string; - zw4?: string; - }; - - type Pinyin_31 = { - /** 模型内容(base64) */ - content: string; - /** 文件名 */ - filename: string; - }; - - type Pinyin_32 = { - /** 车牌号 */ - licensePlate: string; - }; - - type Pinyin_33 = { - /** 车牌号码 */ - licensePlate: string; - }; - - type Pinyin_34 = { - /** 车牌号 */ - licensePlate: string; - }; - - type Pinyin_35 = { - /** 是否需要自检(0:不需要自检,1:需要自检) */ - isNeedCheck?: string; - /** 自检项目 */ - items?: string; - /** 串口号 */ - portNo?: string; - /** 重试次数 */ - retryTime?: string; - /** (1:取反,0:不取反)例如安全带取反且离合器不取反即(1^0) */ - reverse?: string; - }; - - type Pinyin_36 = { - /** 住址 */ - addr?: string; - /** 设备编号 */ - deviceNo?: string; - /** fieldId */ - fieldId?: string; - /** 考官证件号码 */ - kgsfzmhm?: string; - /** 考试科目 */ - kskm?: string; - /** 流水号 */ - lsh?: string; - /** mixModel */ - mixModel?: string; - /** 身份证号 */ - sfzh: string; - /** 姓名 */ - xm?: string; - }; - - type Pinyin_37 = { - /** 设备号 */ - deviceNo?: string; - /** 照片1 */ - firstImage?: string; - /** 考试科目 */ - kskm?: string; - /** 认证次数 */ - rzcs?: string; - /** 照片2 */ - secondImage: string; - /** 身份证号码 */ - sfzh: string; - /** 设备类型(1、门禁2、考车3、过程) */ - type: string; - /** 审核类型(2、人工审核) */ - verifyType?: string; - }; - - type Pinyin_38 = { - /** 设备硬件号 */ - deviceNo: string; - /** 门禁程序版本号 */ - gateVersion: string; - }; - - type Pinyin_39 = { - /** 随车考试员登录用户名(可以是身份证号、员工号、制卡号等等) */ - examinerName: string; - /** 随车考试员密码 */ - examinerPwd?: string; - /** 车牌号 */ - licensePlate: string; - }; - - type Pinyin_4 = { - /** 考生信息列表 */ - studentList?: Pinyin_24[]; - }; - - type Pinyin_40 = { - /** 指纹信息1 */ - finger1?: string; - /** 指纹信息2 */ - finger2?: string; - /** 随车考试员姓名 */ - name?: string; - }; - - type Pinyin_5 = { - /** 车牌号码 */ - licensePlate: string; - /** 表名,大写 */ - tableName: string; - }; - - type Pinyin_6 = { - /** car_mac */ - car_mac: string; - /** 设备类型(1:海康,2:大华) */ - equipment_type: string; - /** 第一路通道 */ - first_channel: string; - /** 第一路ip */ - first_ip: string; - /** 第一路密码 */ - first_password: string; - /** 第一路端口 */ - first_port: string; - /** 第一路用户名 */ - first_username: string; - /** 第四路通道 */ - fourth_channel: string; - /** 第四路ip */ - fourth_ip: string; - /** 第四路密码 */ - fourth_password: string; - /** 第四路端口 */ - fourth_port: string; - /** 第四路用户名 */ - fourth_username: string; - /** 连接类型(0:主码流TCP方式,1:子码流TCP方式,2:主码流UDP方式,3:子码流UDP方式) */ - line_type: string; - /** 拍照通道 */ - photo_channel: string; - /** 叠加内容1(1.考生姓名,身份证号,3.当前项目,4.当前时间) */ - photo_overlay_text_content1: string; - /** 叠加内容2(1.考生姓名,身份证号,3.当前项目,4.当前时间,0:空) */ - photo_overlay_text_content2: string; - /** 叠加内容3(1.考生姓名,身份证号,3.当前项目,4.当前时间,0:空) */ - photo_overlay_text_content3: string; - /** 照片叠加文字(1:启用,0:关闭) */ - photo_overlay_text_enable: string; - /** 位置(1:左上角,2:右上角,3:左下角,4.右下角) */ - photo_overlay_text_position: string; - /** 文字大小 */ - photo_overlay_text_size: string; - /** 分割符(1:/,2:*\,3:换行) */ - photo_overlay_text_split: string; - /** 启用过程人脸比对 {process_face_comparion_enable} */ - process_face_comparion_enable: string; - /** 过程人脸比对模式(1:启用,0:关闭) {process_face_comparion_mode} */ - process_face_comparion_mode: string; - /** 第二路通道 */ - second_channel: string; - /** 第二路ip */ - second_ip: string; - /** 第二路密码 */ - second_password: string; - /** 第二路端口 */ - second_port: string; - /** 第二路用户名 */ - second_username: string; - /** 第三路通道 */ - third_channel: string; - /** 第三路ip */ - third_ip: string; - /** 第三路密码 */ - third_password: string; - /** 第三路端口 */ - third_port: string; - /** 第三路用户名 */ - third_username: string; - /** 视频路数 */ - video_channel: string; - /** 录像方式(0:本地录像,1:本地不录象) */ - video_mode: string; - /** 视频遮挡 */ - video_occlusion: string; - /** 视频遮挡范围(1:一路,2:二路,3:三路,4:四路) */ - video_occlusion_range: string; - /** 视频叠加位置X */ - video_overlay_position_x: string; - /** 视频叠加位置Y */ - video_overlay_position_y: string; - /** 视频叠加内容1(1:考生姓名,2:身份证号,3:当前项目,4:当前时间) */ - video_overlay_text_content1: string; - /** 视频叠加内容2(1:考生姓名,2:身份证号,3:当前项目,4:当前时间,0:空) */ - video_overlay_text_content2: string; - /** 视频叠加内容3(1:考生姓名,2:身份证号,3:当前项目,4:当前时间,0:空) */ - video_overlay_text_content3: string; - /** 视频叠加文字(1:启用,0:关闭) */ - video_overlay_text_enable: string; - /** 视频叠加分割符(1:/,2:*\,3:换行) */ - video_overlay_text_split: string; - /** 录像范围(1:一路,2:二路,3:三路,4:四路) */ - video_range: string; - /** 本考车对应视频合成服务器IP(填错将不能开始考试) */ - video_synthesis_server_ip: string; - /** 本考车对应视频合成服务器端口(填错将不能开始考试) */ - video_synthesis_server_port: string; - /** 本考车对应视频合成信息处理系统IP(填错或不填将可能导致录像丢失) */ - video_synthesis_system_ip: string; - /** 本考车对应视频合成信息处理系统本地响应端口(填错或不填将可能导致录像丢失) */ - video_synthesis_system_port: string; - }; - - type Pinyin_7 = { - /** 车牌号 */ - licensePlate: string; - }; - - type Pinyin_8 = { - /** 车辆品牌列表 */ - carBrandList?: CarBrand_[]; - /** 考车列表 */ - carInfoList?: CarInfo_[]; - /** 考点列表 */ - examPointInfoList?: ExamPointInfo_[]; - }; - - type Pinyin_9 = { - /** 摄像头通道号 */ - channel?: string; - /** 硬盘录像机ip */ - deviceIP?: string; - /** 监管场地编号 */ - equipmentId?: string; - /** 非全景绑定的全景 */ - fullId?: string; - /** 全景区域坐标 */ - gpsArea?: string; - /** 摄像头id */ - id?: string; - /** 是否全景摄像头 */ - isFull?: string; - /** 硬盘录像机密码 */ - password?: string; - /** 硬盘录像机端口 */ - port?: string; - /** 硬盘录像机用户名 */ - user?: string; - }; - - type ROf_ = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_4; - /** 返回消息 */ - msg: string; - }; - - type ROf10 = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_31; - /** 返回消息 */ - msg: string; - }; - - type ROf11 = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_35; - /** 返回消息 */ - msg: string; - }; - - type ROf12 = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_40; - /** 返回消息 */ - msg: string; - }; - - type ROf2 = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_6; - /** 返回消息 */ - msg: string; - }; - - type ROf3 = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_8; - /** 返回消息 */ - msg: string; - }; - - type ROf4 = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_10; - /** 返回消息 */ - msg: string; - }; - - type ROf5 = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_12; - /** 返回消息 */ - msg: string; - }; - - type ROf6 = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_14; - /** 返回消息 */ - msg: string; - }; - - type ROf7 = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_16; - /** 返回消息 */ - msg: string; - }; - - type ROf8 = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_19; - /** 返回消息 */ - msg: string; - }; - - type ROf9 = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: Pinyin_22; - /** 返回消息 */ - msg: string; - }; - - type ROfGpsIPUdpIP_ = { - /** 状态码 1成功 0通用失败 */ - code: number; - data?: GpsIPUdpIP_; - /** 返回消息 */ - msg: string; - }; - - type ROfListOfobject = { - /** 状态码 1成功 0通用失败 */ - code: number; - /** 承载数据 */ - data?: Record[]; - /** 返回消息 */ - msg: string; - }; - - type ROfobject = { - /** 状态码 1成功 0通用失败 */ - code: number; - /** 承载数据 */ - data?: Record; - /** 返回消息 */ - msg: string; - }; - - type VehicleSpeend = { - carType?: string; - speend?: string; - }; - - type WxsBaseFileBean = { - /** 文件内容base64编码 */ - data: string; - /** 文件类别或id */ - fileid: string; - }; -} diff --git a/entry/src/main/ets/api/userInfo.ts b/entry/src/main/ets/api/userInfo.ets similarity index 76% rename from entry/src/main/ets/api/userInfo.ts rename to entry/src/main/ets/api/userInfo.ets index 388015af..30742897 100644 --- a/entry/src/main/ets/api/userInfo.ts +++ b/entry/src/main/ets/api/userInfo.ets @@ -1,5 +1,6 @@ -import request from "../common/utils/request" +import request from "../utils/Request" import tempRequest from '../common/utils/tempRequest' +import http from "@ohos.net.http" /** * 照片比对 @@ -11,8 +12,16 @@ import tempRequest from '../common/utils/tempRequest' * @param verifyType 不传或者传1为标准,传2为人工审核 */ -export async function faceCompare(params) { - return request({ +interface FaceCompareParams { + sfzh: string + firstImage: string + secondImage: string + type: string + verifyType: string +} + +export async function faceCompare(params: FaceCompareParams) { + return request({ url: '/der2/services/imageCompare/base64ImageStrCompare.ws', data: ` @@ -24,33 +33,40 @@ export async function faceCompare(params) { ${params.verifyType} `, - method: 'post', + method: http.RequestMethod.POST, xml: true }) } -export async function getExaminationStudentInfo(params) { - return tempRequest({ +export async function getExaminationStudentInfo(params: object) { + return request({ url: '/der2/services/exam/getExaminationStudentInfo.ws', data: params, - method: 'post', + method: http.RequestMethod.POST, xml: true }) } //缺考 -export async function examinationStuAbsent(params) { +export async function examinationStuAbsent(params: object) { return request({ url: '/der2/services/exam/examinationStuAbsent.ws', data: params, - method: 'post', + method: http.RequestMethod.POST, xml: true }) } +interface GetExaminationItemParams { + time: string + carId: string + examinationRoomId: string + lsh: string +} + //获取断点续考 -export async function getExaminationItem(params) { +export async function getExaminationItem(params: GetExaminationItemParams) { return request({ url: '/der2/services/exam/getExaminationItem.ws', data: ` @@ -63,17 +79,24 @@ export async function getExaminationItem(params) { ${params.lsh} `, - method: 'post', + method: http.RequestMethod.POST, xml: true }) } +interface GetPhotosForOtherParams { + time: string + sfzmhm: string + zptype: string + ksrq: string +} + //参数下发读表接口 -export async function getPhotosForOther(params) { +export async function getPhotosForOther(params: GetPhotosForOtherParams) { return request({ url: '/der2/services/third/getPhotosForOther.ws', data: `${params.sfzmhm}2${params.zptype}${params.ksrq}`, - method: 'post', + method: http.RequestMethod.POST, xml: true, } ) @@ -84,7 +107,7 @@ export async function setVideoText() { url: 'http://admin:12345qwe@192.168.36.94/PSIA/Custom/SelfExt/OSD/channels/2/textOverlay', data: ` 1true0012222true0022223false004false005false006false007false008false00`, - method: 'put', + method: http.RequestMethod.PUT, xml: true }) } \ No newline at end of file diff --git a/entry/src/main/ets/utils/Request.ets b/entry/src/main/ets/utils/Request.ets index 1fc1d849..cbb86781 100644 --- a/entry/src/main/ets/utils/Request.ets +++ b/entry/src/main/ets/utils/Request.ets @@ -108,7 +108,7 @@ function dealCenterCode(message: string, isNewCenter: boolean): CenterCodeResult } } -export default function Request(options: RequestOption): Promise { +export default function Request(options: RequestOption): Promise { return new Promise((resolve, reject) => { const instance = http.createHttp() const baseURL = options.host || base