fix: 启动app传递数据
This commit is contained in:
		
							parent
							
								
									0aea22d2bf
								
							
						
					
					
						commit
						43d5302c71
					
				| @ -4,13 +4,13 @@ | |||||||
|       { |       { | ||||||
|         "name": "default", |         "name": "default", | ||||||
|         "material": { |         "material": { | ||||||
|           "certpath": "C:\\Users\\93218\\.ohos\\config\\openharmony\\auto_ohos_default_subject-two_com.oh.dts.cer", |           "certpath": "/Users/wangzhongjie/.ohos/config/openharmony/default_subject-two_Kl4t-ZSvZeuUm9s8O-e6FIH2VFR_OaNyhDP8kPjIWgU=.cer", | ||||||
|           "storePassword": "0000001A2150F207688978DC41AB971AFAACA19A2656EF603DF6DD262F11C00738919C0D1E8DC208ED16", |           "storePassword": "0000001B8D8B187B8B5E03868F4F858A00D5D8275FCDA4584925A7E271A58D44A2D8295E1A3911E47104ED", | ||||||
|           "keyAlias": "debugKey", |           "keyAlias": "debugKey", | ||||||
|           "keyPassword": "0000001AACF53E0E5E7326C00626448D07D00D283DB5B32263113CE3A96D18EB3EFC6EAD63AB73618A2F", |           "keyPassword": "0000001BCBA3C73D3DC9D012F14BD3CB41DAB2328BB987DEFD7CC6A4A7E0F9E0097F22B2DD06F0F35C2E9B", | ||||||
|           "profile": "C:\\Users\\93218\\.ohos\\config\\openharmony\\auto_ohos_default_subject-two_com.oh.dts.p7b", |           "profile": "/Users/wangzhongjie/.ohos/config/openharmony/default_subject-two_Kl4t-ZSvZeuUm9s8O-e6FIH2VFR_OaNyhDP8kPjIWgU=.p7b", | ||||||
|           "signAlg": "SHA256withECDSA", |           "signAlg": "SHA256withECDSA", | ||||||
|           "storeFile": "C:\\Users\\93218\\.ohos\\config\\openharmony\\auto_ohos_default_subject-two_com.oh.dts.p12" |           "storeFile": "/Users/wangzhongjie/.ohos/config/openharmony/default_subject-two_Kl4t-ZSvZeuUm9s8O-e6FIH2VFR_OaNyhDP8kPjIWgU=.p12" | ||||||
|         } |         } | ||||||
|       } |       } | ||||||
|     ], |     ], | ||||||
|  | |||||||
| @ -1,13 +1,15 @@ | |||||||
| { | { | ||||||
|   "lockfileVersion": 1, |   "lockfileVersion": 2, | ||||||
|   "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", |   "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | ||||||
|   "specifiers": { |   "specifiers": { | ||||||
|     "@ohos/hypium@1.0.6": "@ohos/hypium@1.0.6" |     "@ohos/hypium@1.0.6": "@ohos/hypium@1.0.6" | ||||||
|   }, |   }, | ||||||
|   "packages": { |   "packages": { | ||||||
|     "@ohos/hypium@1.0.6": { |     "@ohos/hypium@1.0.6": { | ||||||
|       "resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz", |       "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz", | ||||||
|       "integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ==" |       "integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ==", | ||||||
|  |       "registryType": "ohpm", | ||||||
|  |       "shasum": "3f5fed65372633233264b3447705b0831dfe7ea1" | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -1,10 +0,0 @@ | |||||||
| 
 |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
| export default interface IIdlServiceExt { |  | ||||||
|     processData(data: string, callback: processDataCallback): void; |  | ||||||
|     insertDataToMap(key: string, val: number, callback: insertDataToMapCallback): void; |  | ||||||
| } |  | ||||||
| export type processDataCallback = (errCode: number, returnValue: string) => void; |  | ||||||
| export type insertDataToMapCallback = (errCode: number) => void; |  | ||||||
| 
 |  | ||||||
| @ -1,51 +0,0 @@ | |||||||
| import IdlServiceExtStub from './idl_service_ext_stub'; |  | ||||||
| import hilog from '@ohos.hilog'; |  | ||||||
| import type { insertDataToMapCallback } from './i_idl_service_ext'; |  | ||||||
| import type { processDataCallback } from './i_idl_service_ext'; |  | ||||||
| import request, { tcpRequest } from '../common/utils/request'; |  | ||||||
| import pasteboard from '@ohos.pasteboard'; |  | ||||||
| 
 |  | ||||||
| const ERR_OK = 0; |  | ||||||
| const TAG: string = "[IdlServiceExtImpl]"; |  | ||||||
| const DOMAIN_NUMBER: number = 0xFF00; |  | ||||||
| 
 |  | ||||||
| // 开发者需要在这个类型里对接口进行实现
 |  | ||||||
| export default class ServiceExtImpl extends IdlServiceExtStub { |  | ||||||
|   processData(data: string, callback: processDataCallback): void { |  | ||||||
|     // 开发者自行实现业务逻辑
 |  | ||||||
|     hilog.info(DOMAIN_NUMBER, TAG, `js-test ServiceExtensionAbility--processData: ${data}`); |  | ||||||
|     console.log("lixiao receive", data) |  | ||||||
|     pasteboard.getSystemPasteboard().getData().then((res) => { |  | ||||||
|       let pasteData = res.getPrimaryText() |  | ||||||
|       console.log("lixiao receive paste", pasteData) |  | ||||||
|       request(JSON.parse(pasteData)).then(response => { |  | ||||||
|         console.log("lixiao success", JSON.stringify(response)) |  | ||||||
|         callback(0, JSON.stringify({ |  | ||||||
|           code: 0, |  | ||||||
|           data: response |  | ||||||
|         })); |  | ||||||
|         // callback(0, JSON.stringify(response));
 |  | ||||||
|       }).catch(async (err) => { |  | ||||||
|         callback(0, JSON.stringify({ |  | ||||||
|           code: 1, |  | ||||||
|           data: err |  | ||||||
|         })); |  | ||||||
|         console.log("lixiao error", JSON.stringify(err)) |  | ||||||
|       }) |  | ||||||
|     }).catch(err => { |  | ||||||
|       callback(0, JSON.stringify({ |  | ||||||
|         code: 1, |  | ||||||
|         data: { |  | ||||||
|           code: 2300007 |  | ||||||
|         } |  | ||||||
|       })); |  | ||||||
|       console.log("lixiao paste error", JSON.stringify(err)) |  | ||||||
|     }) |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   insertDataToMap(key: string, val: number, callback: insertDataToMapCallback): void { |  | ||||||
|     // 开发者自行实现业务逻辑
 |  | ||||||
|     hilog.info(DOMAIN_NUMBER, TAG, `js-test ServiceExtensionAbility--insertDataToMap, key: ${key}  val: ${val}`); |  | ||||||
|     callback(ERR_OK); |  | ||||||
|   } |  | ||||||
| } |  | ||||||
| @ -1,57 +0,0 @@ | |||||||
| 
 |  | ||||||
| 
 |  | ||||||
| import {processDataCallback} from "./i_idl_service_ext"; |  | ||||||
| import {insertDataToMapCallback} from "./i_idl_service_ext"; |  | ||||||
| import IIdlServiceExt from "./i_idl_service_ext"; |  | ||||||
| import rpc from "@ohos.rpc"; |  | ||||||
| 
 |  | ||||||
| export default class IdlServiceExtProxy implements IIdlServiceExt { |  | ||||||
|     constructor(proxy) { |  | ||||||
|         this.proxy = proxy; |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     processData(data: string, callback: processDataCallback): void |  | ||||||
|     { |  | ||||||
|         let _option = new rpc.MessageOption(); |  | ||||||
|         let _data = new rpc.MessageParcel(); |  | ||||||
|         let _reply = new rpc.MessageParcel(); |  | ||||||
|         // _data.writeString(data);
 |  | ||||||
|         _data.writeString(data) |  | ||||||
|         this.proxy.sendRequest(IdlServiceExtProxy.COMMAND_PROCESS_DATA, _data, _reply, _option).then(function(result) { |  | ||||||
|             if (result.errCode === 0) { |  | ||||||
|                 let _errCode = result.reply.readInt(); |  | ||||||
|                 if (_errCode != 0) { |  | ||||||
|                     let _returnValue = undefined; |  | ||||||
|                     callback(_errCode, _returnValue); |  | ||||||
|                     return; |  | ||||||
|                 } |  | ||||||
|                 let _returnValue = result.reply.readString(); |  | ||||||
|                 callback(_errCode, _returnValue); |  | ||||||
|             } else { |  | ||||||
|                 console.log("sendRequest failed, errCode: " + result.errCode); |  | ||||||
|             } |  | ||||||
|         }) |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     insertDataToMap(key: string, val: number, callback: insertDataToMapCallback): void |  | ||||||
|     { |  | ||||||
|         let _option = new rpc.MessageOption(); |  | ||||||
|         let _data = new rpc.MessageParcel(); |  | ||||||
|         let _reply = new rpc.MessageParcel(); |  | ||||||
|         _data.writeString(key); |  | ||||||
|         _data.writeInt(val); |  | ||||||
|         this.proxy.sendRequest(IdlServiceExtProxy.COMMAND_INSERT_DATA_TO_MAP, _data, _reply, _option).then(function(result) { |  | ||||||
|             if (result.errCode === 0) { |  | ||||||
|                 let _errCode = result.reply.readInt(); |  | ||||||
|                 callback(_errCode); |  | ||||||
|             } else { |  | ||||||
|                 console.log("sendRequest failed, errCode: " + result.errCode); |  | ||||||
|             } |  | ||||||
|         }) |  | ||||||
|     } |  | ||||||
| 
 |  | ||||||
|     static readonly COMMAND_PROCESS_DATA = 1; |  | ||||||
|     static readonly COMMAND_INSERT_DATA_TO_MAP = 2; |  | ||||||
|     private proxy |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| @ -1,86 +0,0 @@ | |||||||
| import { processDataCallback } from "./i_idl_service_ext"; |  | ||||||
| import { insertDataToMapCallback } from "./i_idl_service_ext"; |  | ||||||
| import IIdlServiceExt from "./i_idl_service_ext"; |  | ||||||
| import rpc from "@ohos.rpc"; |  | ||||||
| import common from '@ohos.app.ability.common'; |  | ||||||
| 
 |  | ||||||
| export default class IdlServiceExtStub extends rpc.RemoteObject implements IIdlServiceExt { |  | ||||||
|   protected context: common.ServiceExtensionContext |  | ||||||
| 
 |  | ||||||
|   constructor(des: string, context: common.ServiceExtensionContext) { |  | ||||||
|     super(des); |  | ||||||
|     this.context = context; |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   onRemoteMessageRequest(code: number, data: rpc.MessageSequence, reply: rpc.MessageSequence, option): Promise<boolean> { |  | ||||||
|     console.log("lixiao onRemoteRequest called, code = " + code); |  | ||||||
|     return new Promise<boolean>((resolve, reject) => { |  | ||||||
|       switch (code) { |  | ||||||
|         case IdlServiceExtStub.COMMAND_PROCESS_DATA: { |  | ||||||
|           // let _data = data.readString();
 |  | ||||||
|           let _data = data.readString() |  | ||||||
|           this.processData(_data, (errCode, returnValue) => { |  | ||||||
|             console.log("lixiao callback", returnValue); |  | ||||||
|             console.log("lixiao errCode", errCode); |  | ||||||
|             reply.writeInt(errCode); |  | ||||||
|             reply.writeString(returnValue); |  | ||||||
|             resolve(true) |  | ||||||
|           }); |  | ||||||
|           break |  | ||||||
|         } |  | ||||||
|         case IdlServiceExtStub.COMMAND_INSERT_DATA_TO_MAP: { |  | ||||||
|           let _key = data.readString(); |  | ||||||
|           let _val = data.readInt(); |  | ||||||
|           this.insertDataToMap(_key, _val, (errCode) => { |  | ||||||
|             reply.writeInt(errCode); |  | ||||||
|             resolve(true) |  | ||||||
|           }); |  | ||||||
|           break |  | ||||||
|         } |  | ||||||
|         default: { |  | ||||||
|           console.log("invalid request code" + code); |  | ||||||
|           reject(true) |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
|     }) |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   // onRemoteRequest(code: number, data, reply, option): boolean {
 |  | ||||||
|   //   console.log("lixiao onRemoteRequest called, code = " + code);
 |  | ||||||
|   //   switch (code) {
 |  | ||||||
|   //     case IdlServiceExtStub.COMMAND_PROCESS_DATA: {
 |  | ||||||
|   //       let _data = data.readString();
 |  | ||||||
|   //       this.processData(_data, (errCode, returnValue) => {
 |  | ||||||
|   //         reply.writeInt(errCode);
 |  | ||||||
|   //         if (errCode == 0) {
 |  | ||||||
|   //           reply.writeString(returnValue);
 |  | ||||||
|   //         }
 |  | ||||||
|   //       });
 |  | ||||||
|   //       return true;
 |  | ||||||
|   //     }
 |  | ||||||
|   //     case IdlServiceExtStub.COMMAND_INSERT_DATA_TO_MAP: {
 |  | ||||||
|   //       let _key = data.readString();
 |  | ||||||
|   //       let _val = data.readInt();
 |  | ||||||
|   //       this.insertDataToMap(_key, _val, (errCode) => {
 |  | ||||||
|   //         reply.writeInt(errCode);
 |  | ||||||
|   //       });
 |  | ||||||
|   //       return true;
 |  | ||||||
|   //     }
 |  | ||||||
|   //     default: {
 |  | ||||||
|   //       console.log("invalid request code" + code);
 |  | ||||||
|   //       break;
 |  | ||||||
|   //     }
 |  | ||||||
|   //   }
 |  | ||||||
|   //   return false;
 |  | ||||||
|   // }
 |  | ||||||
| 
 |  | ||||||
|   processData(data: string, callback: processDataCallback): void { |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   insertDataToMap(key: string, val: number, callback: insertDataToMapCallback): void { |  | ||||||
|   } |  | ||||||
| 
 |  | ||||||
|   static readonly COMMAND_PROCESS_DATA = 1; |  | ||||||
|   static readonly COMMAND_INSERT_DATA_TO_MAP = 2; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| @ -1,36 +0,0 @@ | |||||||
| import ServiceExtension from '@ohos.app.ability.ServiceExtensionAbility' |  | ||||||
| 
 |  | ||||||
| // import { ServiceExtensionAbility, Want } from '@kit.AbilityKit'; |  | ||||||
| // import { rpc } from '@kit.IPCKit'; |  | ||||||
| import hilog from '@ohos.hilog'; |  | ||||||
| import { tcpUtil } from '../common/utils/TcpRequest'; |  | ||||||
| import ServiceExtImpl from '../IdlServiceExt/idl_service_ext_impl'; |  | ||||||
| 
 |  | ||||||
| const TAG: string = '[ServiceExtAbility]'; |  | ||||||
| const DOMAIN_NUMBER: number = 0xFF00; |  | ||||||
| 
 |  | ||||||
| export default class ServiceExtAbility extends ServiceExtension { |  | ||||||
|   serviceExtImpl: ServiceExtImpl = new ServiceExtImpl('ExtImpl', this.context); |  | ||||||
| 
 |  | ||||||
|   async onCreate(want): Promise<void> { |  | ||||||
|     hilog.info(DOMAIN_NUMBER, TAG, `js-test ServiceExtensionAbility-- onCreate, want: ${want.abilityName}`); |  | ||||||
|   }; |  | ||||||
| 
 |  | ||||||
|   onRequest(want, startId: number): void { |  | ||||||
|     hilog.info(DOMAIN_NUMBER, TAG, `js-test ServiceExtensionAbility--onRequest, want: ${want.abilityName}`); |  | ||||||
|   }; |  | ||||||
| 
 |  | ||||||
|   onConnect(want) { |  | ||||||
|     hilog.info(DOMAIN_NUMBER, TAG, `js-test ServiceExtensionAbility--onConnect, want: ${want.abilityName}`); |  | ||||||
|     // 返回ServiceExtImpl对象,客户端获取后便可以与ServiceExtensionAbility进行通信 |  | ||||||
|     return this.serviceExtImpl; |  | ||||||
|   }; |  | ||||||
| 
 |  | ||||||
|   onDisconnect(want): void { |  | ||||||
|     hilog.info(DOMAIN_NUMBER, TAG, `js-test ServiceExtensionAbility--onDisconnect, want: ${want.abilityName}`); |  | ||||||
|   }; |  | ||||||
| 
 |  | ||||||
|   onDestroy(): void { |  | ||||||
|     hilog.info(DOMAIN_NUMBER, TAG, 'js-test ServiceExtensionAbility--onDestroy'); |  | ||||||
|   }; |  | ||||||
| }; |  | ||||||
| @ -1,26 +0,0 @@ | |||||||
| import common from '@ohos.app.ability.common'; |  | ||||||
| import hilog from '@ohos.hilog'; |  | ||||||
| import Want from '@ohos.app.ability.Want'; |  | ||||||
| 
 |  | ||||||
| const DOMAIN_NUMBER: number = 0xFF00; |  | ||||||
| // import { BusinessError } from '@ohos.base'; |  | ||||||
| import promptAction from '@ohos.promptAction'; |  | ||||||
| 
 |  | ||||||
| const TAG: string = '[ServiceInteractive]'; |  | ||||||
| let context: common.UIAbilityContext = getContext(this) as common.UIAbilityContext; // UIAbilityContext |  | ||||||
| let want: Want = { |  | ||||||
|   deviceId: '', |  | ||||||
|   bundleName: 'com.oh.dts', |  | ||||||
|   abilityName: 'ServiceExtAbility' |  | ||||||
| }; |  | ||||||
| context.startServiceExtensionAbility(want).then(() => { |  | ||||||
| 
 |  | ||||||
| 
 |  | ||||||
|   hilog.info(DOMAIN_NUMBER, TAG, `js-test ServiceInteractive-- Succeeded in starting ServiceExtensionAbility, want: ${want.abilityName}`); |  | ||||||
|   // // 成功启动后台服务 |  | ||||||
|   // promptAction.showToast({ |  | ||||||
|   //   message: $r('app.string.SuccessfullyStartBackendService') |  | ||||||
|   // }); |  | ||||||
| }).catch((err) => { |  | ||||||
|   hilog.error(DOMAIN_NUMBER, TAG, `Failed to start ServiceExtensionAbility. Code is ${err.code}, message is ${err.message}`); |  | ||||||
| }); |  | ||||||
| @ -25,7 +25,7 @@ interface WR { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| // 通用监管接口
 | // 通用监管接口
 | ||||||
| export async function writeObjectOut(params, filePath?: string): Promise<WR> { | export async function writeObjectOut(params,externalTransmission:boolean, filePath?: string): Promise<WR> { | ||||||
|   const singlePlay = globalThis.singlePlay |   const singlePlay = globalThis.singlePlay | ||||||
|   if (singlePlay) { |   if (singlePlay) { | ||||||
|     return { code: 1 } |     return { code: 1 } | ||||||
| @ -54,8 +54,7 @@ export async function writeObjectOut(params, filePath?: string): Promise<WR> { | |||||||
| 
 | 
 | ||||||
|   //新监管调用
 |   //新监管调用
 | ||||||
|   if (globalThis.isJGNew) { |   if (globalThis.isJGNew) { | ||||||
| 
 |     return await writeObjectOutNew(params, filePath,externalTransmission) | ||||||
|     return await writeObjectOutNew(params, filePath) |  | ||||||
|   } |   } | ||||||
|   drvexam.zp = drvexam.zp === undefined ? undefined : encodeURIComponent(drvexam.zp) |   drvexam.zp = drvexam.zp === undefined ? undefined : encodeURIComponent(drvexam.zp) | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -1,8 +1,11 @@ | |||||||
| import { getSyncData } from '../common/service/initable'; | import { getSyncData } from '../common/service/initable'; | ||||||
|  | import request from "../common/utils/request" | ||||||
| 
 | 
 | ||||||
|  | let baseHost = globalThis.host; | ||||||
| import FileUtil from '../common/utils/File'; | import FileUtil from '../common/utils/File'; | ||||||
|  | import FileLog from '../pages/judgeSDK/utils/fileLog'; | ||||||
| import pasteboard from '@ohos.pasteboard'; | import pasteboard from '@ohos.pasteboard'; | ||||||
| import emitter from '@ohos.events.emitter'; | import Want from '@ohos.app.ability.Want'; | ||||||
| 
 | 
 | ||||||
| //监管接口序列号映射
 | //监管接口序列号映射
 | ||||||
| const gjxlhObj = { | const gjxlhObj = { | ||||||
| @ -19,12 +22,12 @@ interface WR { | |||||||
|   code: number |   code: number | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export default async function writeObjectOutNew(data, filePath): Promise<WR> { | export default async function writeObjectOutNew(data, filePath, externalTransmission): Promise<WR> { | ||||||
|   const fileUtil = new FileUtil(globalThis.context); |   const fileUtil = new FileUtil(globalThis.context); | ||||||
|   const { jkid, drvexam } = data; |   const {jkid , drvexam} = data; | ||||||
|   const basic = await getBasicConfig(jkid); |   const basic = await getBasicConfig(jkid); | ||||||
|   const params = await getParams(jkid, drvexam); |   const params = await getParams(jkid, 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({ | ||||||
| @ -41,17 +44,16 @@ export default async function writeObjectOutNew(data, filePath): Promise<WR> { | |||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // let connectTimeout = sjbs === '02-21-000014' ?60000:1
 |   // let connectTimeout = sjbs === '02-21-000014' ?60000:1
 | ||||||
|   console.info('surenjun', '调用新监管,项目代码:', params.data.param.ksxm) |   console.info('surenjun', '调用新监管') | ||||||
|   let temp |   let temp | ||||||
|   try { |   let requestData = { | ||||||
|     let data = JSON.stringify({ |     host: globalThis.JGHOST, | ||||||
|       host: globalThis.JGHOST, |     method: 'post', | ||||||
|       method: 'post', |     //是否是新中心
 | ||||||
|       //是否是新中心
 |     isNewCenter: true, | ||||||
|       isNewCenter: true, |     xml: true, | ||||||
|       xml: true, |     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 | ||||||
|                   xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" |                   xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" | ||||||
|                   xmlns:xsd="http://www.w3.org/2001/XMLSchema" |                   xmlns:xsd="http://www.w3.org/2001/XMLSchema" | ||||||
| @ -69,46 +71,20 @@ export default async function writeObjectOutNew(data, filePath): Promise<WR> { | |||||||
|                     </writeObjectOut> |                     </writeObjectOut> | ||||||
|                  </SOAP-ENV:Body> |                  </SOAP-ENV:Body> | ||||||
|                </SOAP-ENV:Envelope>`, |                </SOAP-ENV:Envelope>`, | ||||||
|     }) |   } | ||||||
|     try { |   try { | ||||||
|  |     if (!externalTransmission) { | ||||||
|  |       temp = await request(requestData) | ||||||
|  |     } else { | ||||||
|       let systemPasteboard = pasteboard.getSystemPasteboard() |       let systemPasteboard = pasteboard.getSystemPasteboard() | ||||||
|       let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, data) |       let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, JSON.stringify(requestData)) | ||||||
|       await systemPasteboard.clear() |       await systemPasteboard.clear() | ||||||
|       await systemPasteboard.setData(pasteData) |       await systemPasteboard.setData(pasteData) | ||||||
|     } catch (e) { | 
 | ||||||
|       console.log("wzj pasteboard error", e, "项目代码:", params.data.param.ksxm) |       temp = { | ||||||
|  |         code: 1 | ||||||
|  |       } | ||||||
|     } |     } | ||||||
|     let fn = () => { |  | ||||||
|       return new Promise((resolve, reject) => { |  | ||||||
|         let tick = setTimeout(() => { |  | ||||||
|           emitter.emit({ |  | ||||||
|             eventId: 1 |  | ||||||
|           }) |  | ||||||
|           tick = null |  | ||||||
|           reject({ |  | ||||||
|             code: 2300028, |  | ||||||
|             message: "children process not response" |  | ||||||
|           }) |  | ||||||
|         }, 20 * 1000) |  | ||||||
|         console.log("wzj process start,项目代码:", params.data.param.ksxm) |  | ||||||
|         globalThis.serviceExtProxy.processData("1", (errorCode: number, retVal: string) => { |  | ||||||
|           console.log("lixiao process accept,项目代码:", params.data.param.ksxm, "  错误码:", errorCode, JSON.stringify(retVal)) |  | ||||||
|           if (tick != null) { |  | ||||||
|             clearTimeout(tick) |  | ||||||
|             let result = JSON.parse(retVal) |  | ||||||
|             if (result.code === 0) { |  | ||||||
|               resolve(result.data) |  | ||||||
|             } else { |  | ||||||
|               emitter.emit({ |  | ||||||
|                 eventId: 1 |  | ||||||
|               }) |  | ||||||
|               reject(result.data) |  | ||||||
|             } |  | ||||||
|           } |  | ||||||
|         }); |  | ||||||
|       }) |  | ||||||
|     } |  | ||||||
|     temp = await fn() |  | ||||||
|   } catch (e) { |   } catch (e) { | ||||||
|     console.log("新监管错误") |     console.log("新监管错误") | ||||||
|     temp = e |     temp = e | ||||||
| @ -118,7 +94,6 @@ export default async function writeObjectOutNew(data, filePath): Promise<WR> { | |||||||
|     await fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`, JSON.stringify(temp) + `\n`); |     await fileUtil.editFile(`${filePath}/wuxi_exam_data.txt`, JSON.stringify(temp) + `\n`); | ||||||
|   } |   } | ||||||
|   return temp |   return temp | ||||||
| 
 |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export async function getParams(jkid, drvexam) { | export async function getParams(jkid, drvexam) { | ||||||
| @ -234,10 +209,7 @@ export async function getParams(jkid, drvexam) { | |||||||
|             sfzmhm: drvexam.sfzmhm |             sfzmhm: drvexam.sfzmhm | ||||||
|           }, |           }, | ||||||
|         }, |         }, | ||||||
|         file: { |         file: { sjbs: gjxlhObj[jkid], param: [{ field: '', data: drvexam.zp }] } | ||||||
|           sjbs: gjxlhObj[jkid], |  | ||||||
|           param: [{ field: '', data: drvexam.zp }] |  | ||||||
|         } |  | ||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|     default: |     default: | ||||||
|  | |||||||
| @ -54,10 +54,11 @@ export async function startRecordVideo(param, td, context, dir, path?, index?) { | |||||||
|       } |       } | ||||||
| 
 | 
 | ||||||
|       // @ts-ignore
 |       // @ts-ignore
 | ||||||
|       var recordResult = rtsp_server.startRecordVideo(context, video_uri, fileName, date, dir); |       var recordResult = rtsp_server.startRecordVideo(context, video_uri, fileName, date,dir); | ||||||
|       const handleId = recordResult.dataInt; |       const handleId = recordResult.dataInt; | ||||||
|       reslove(handleId) |       reslove(handleId) | ||||||
|     } else { |     } | ||||||
|  |     else { | ||||||
|       console.log(`Rtsprecord startRecordVideo rtsp_server isnull`); |       console.log(`Rtsprecord startRecordVideo rtsp_server isnull`); | ||||||
|       reslove(0) |       reslove(0) | ||||||
|     } |     } | ||||||
| @ -73,10 +74,10 @@ export async function endRecordVideo(record_handleObj) { | |||||||
|       console.log(`Rtsprecord endRecordVideo begin`); |       console.log(`Rtsprecord endRecordVideo begin`); | ||||||
|       // @ts-ignore
 |       // @ts-ignore
 | ||||||
|       var recordResult = rtsp_server.endRecordVideo(record_handleObj[key]); |       var recordResult = rtsp_server.endRecordVideo(record_handleObj[key]); | ||||||
|       console.log(`Rtsprecord endRecordVideo record_handle` + record_handleObj[key].dataInt + ` filename:` + |       console.log(`Rtsprecord endRecordVideo record_handle` + record_handleObj[key].dataInt + ` filename:` + record_handleObj[key].fileName); | ||||||
|       record_handleObj[key].fileName); |  | ||||||
| 
 | 
 | ||||||
|     } else { |     } | ||||||
|  |     else { | ||||||
|       console.log(`Rtsprecord endRecordVideo handleId isnull`); |       console.log(`Rtsprecord endRecordVideo handleId isnull`); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| @ -122,8 +123,7 @@ async function getfilehandleCode(td, param, dir, path, index) { | |||||||
| } | } | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| export async function getUserAlbumItemByDisplayName(displayName: string, day?, | export async function getUserAlbumItemByDisplayName(displayName: string, day?, type?): Promise<photoAccessHelper.Album> { | ||||||
|                                                     type?): Promise<photoAccessHelper.Album> { |  | ||||||
|   let fetchResult = null |   let fetchResult = null | ||||||
|   let album: photoAccessHelper.Album = null |   let album: photoAccessHelper.Album = null | ||||||
|   try { |   try { | ||||||
| @ -136,9 +136,7 @@ export async function getUserAlbumItemByDisplayName(displayName: string, day?, | |||||||
|     }; |     }; | ||||||
|     const userFileMgr = photoAccessHelper.getPhotoAccessHelper(globalThis.context); |     const userFileMgr = photoAccessHelper.getPhotoAccessHelper(globalThis.context); | ||||||
| 
 | 
 | ||||||
|     fetchResult = |     fetchResult = await userFileMgr.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC, fetchOptions); | ||||||
|       await userFileMgr.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC, |  | ||||||
|         fetchOptions); |  | ||||||
|     console.log('get getUserAlbumItemByDisplayName, count: ' + JSON.stringify(fetchResult)); |     console.log('get getUserAlbumItemByDisplayName, count: ' + JSON.stringify(fetchResult)); | ||||||
|     if (fetchResult.getCount() > 0) { |     if (fetchResult.getCount() > 0) { | ||||||
|       const albums = await fetchResult.getLastObject(); |       const albums = await fetchResult.getLastObject(); | ||||||
| @ -169,8 +167,7 @@ interface takePhotoParam { | |||||||
|   name?: string, |   name?: string, | ||||||
|   base64?: string, |   base64?: string, | ||||||
|   fileSize?: number, |   fileSize?: number, | ||||||
|   errorCode?: number, |   errorCode?: number | ||||||
|   path?: string |  | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| /** | /** | ||||||
| @ -184,7 +181,7 @@ interface takePhotoParam { | |||||||
|  */ |  */ | ||||||
| const fileHelper = new FileHelper(); | const fileHelper = new FileHelper(); | ||||||
| 
 | 
 | ||||||
| export async function delPic(day, type) { | export async function delPic(day,type) { | ||||||
|   let phAccessHelper = photoAccessHelper.getPhotoAccessHelper(globalThis.context); |   let phAccessHelper = photoAccessHelper.getPhotoAccessHelper(globalThis.context); | ||||||
|   console.info('albumGetAssetsDemoCallback'); |   console.info('albumGetAssetsDemoCallback'); | ||||||
|   let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates(); |   let predicates: dataSharePredicates.DataSharePredicates = new dataSharePredicates.DataSharePredicates(); | ||||||
| @ -196,15 +193,13 @@ export async function delPic(day, type) { | |||||||
|     fetchColumns: [], |     fetchColumns: [], | ||||||
|     predicates: predicates |     predicates: predicates | ||||||
|   }; |   }; | ||||||
|   let albumList: photoAccessHelper.FetchResult<photoAccessHelper.Album> = |   let albumList: photoAccessHelper.FetchResult<photoAccessHelper.Album> = await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC, albumFetchOptions); | ||||||
|     await phAccessHelper.getAlbums(photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.USER_GENERIC, |  | ||||||
|       albumFetchOptions); |  | ||||||
|   let albums = await albumList.getAllObjects(); |   let albums = await albumList.getAllObjects(); | ||||||
|   for (let i = 0; i <= albums.length; i++) { |   for(let i=0;i<=albums.length;i++){ | ||||||
|     let albumName = albums[i].albumName |     let albumName=albums[i].albumName | ||||||
|     // isSevenDaysAgo(albumName, day)
 |     // isSevenDaysAgo(albumName, day)
 | ||||||
|     console.log('albumNamealbumName', albumName) |     console.log('albumNamealbumName',albumName) | ||||||
|     if (isSevenDaysAgo(albumName, day) && albumName != 'jt' && albumName != 'pz') { |     if (isSevenDaysAgo(albumName, day)&&albumName!='jt'&&albumName!='pz') { | ||||||
|       deleteAllFileByPiC(albumName, type) |       deleteAllFileByPiC(albumName, type) | ||||||
| 
 | 
 | ||||||
|     } |     } | ||||||
| @ -223,68 +218,40 @@ export async function takePhoto(param, context, dir, flag = 1, callback?) { | |||||||
|   // @ts-ignore
 |   // @ts-ignore
 | ||||||
|   // var snapResult = rtsp_server.getVideoSnapshot(context, video_uri, '', dir);
 |   // var snapResult = rtsp_server.getVideoSnapshot(context, video_uri, '', dir);
 | ||||||
|   if (flag == 0) { |   if (flag == 0) { | ||||||
|     // return new
 |     rtsp_server.detectVideoSnapshotSize(video_uri, fileName, (err, snapResult) => { | ||||||
|  |       console.log("baohaowen_detectLoop round end size1:" + snapResult.fileSize); | ||||||
|  |       callback({ fileSize: snapResult.fileSize, errorCode: snapResult.errorCode }) | ||||||
|  |     }); | ||||||
|  |   } | ||||||
|  |   else { | ||||||
|     return new Promise<takePhotoParam>(async (resolve, reject) => { |     return new Promise<takePhotoParam>(async (resolve, reject) => { | ||||||
|       rtsp_server.detectVideoSnapshotSize(video_uri, fileName, false, (err, snapResult) => { |       const time = await getCurrentTime() | ||||||
|         console.log("baohaowen_detectLoop round end size1:" + snapResult.fileSize, snapResult.dataString); |       const date = time.split(' ')[0] | ||||||
|         callback && callback({ |       let dirName=dir?dir:date | ||||||
|           fileSize: snapResult.fileSize, |       rtsp_server.getVideoSnapshot(context, video_uri, fileName,dirName, true,async (err, snapResult) => { | ||||||
|           errorCode: snapResult.errorCode, |         if(snapResult.result&&snapResult.errorCode==0){ | ||||||
|           base64: snapResult.dataString |           resolve({ | ||||||
|         }) |             base64: snapResult.dataString, | ||||||
|         resolve({ fileSize: snapResult.fileSize, errorCode: snapResult.errorCode, base64: snapResult.dataString }) |             name: snapResult.fileName, | ||||||
|       }); |  | ||||||
|     }) |  | ||||||
| 
 |  | ||||||
|   } else { |  | ||||||
|     return new Promise<takePhotoParam>(async (resolve, reject) => { |  | ||||||
|       // const time = await getCurrentTime()
 |  | ||||||
|       // const date = time.split(' ')[0]
 |  | ||||||
|       // let dirName = dir ? dir : date
 |  | ||||||
|       rtsp_server.detectVideoSnapshotSize(video_uri, fileName, true, (err, snapResult) => { |  | ||||||
|         if (snapResult.result && snapResult.errorCode == 0) { |  | ||||||
|           console.log("baohaowen_detectLoop round end size1:" + snapResult.fileSize, snapResult.dataString); |  | ||||||
|           callback && callback({ |  | ||||||
|             fileSize: snapResult.fileSize, |             fileSize: snapResult.fileSize, | ||||||
|             errorCode: snapResult.errorCode, |             errorCode: snapResult.errorCode | ||||||
|             base64: snapResult.dataString |  | ||||||
|           }) |           }) | ||||||
|           resolve({ fileSize: snapResult.fileSize, errorCode: snapResult.errorCode, base64: snapResult.dataString }) |         }else{ | ||||||
|         } else { |  | ||||||
|           promptAction.showToast({ |           promptAction.showToast({ | ||||||
|             message: `拍照失败`, |             message: `拍照失败`, | ||||||
|             duration: 3000 |             duration: 3000 | ||||||
|           }); |           }); | ||||||
|           reject(false) |           reject(false) | ||||||
|  |           // reject()
 | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|       }); |       }); | ||||||
|       // rtsp_server.getVideoSnapshot(context, video_uri, fileName, dirName, true, async (err, snapResult) => {
 |  | ||||||
|       //   if (snapResult.result && snapResult.errorCode == 0) {
 |  | ||||||
|       //     resolve({
 |  | ||||||
|       //       base64: snapResult.dataString,
 |  | ||||||
|       //       name: snapResult.fileName,
 |  | ||||||
|       //       fileSize: snapResult.fileSize,
 |  | ||||||
|       //       errorCode: snapResult.errorCode,
 |  | ||||||
|       //       path: snapResult.filePath
 |  | ||||||
|       //     })
 |  | ||||||
|       //   } else {
 |  | ||||||
|       //     promptAction.showToast({
 |  | ||||||
|       //       message: `拍照失败`,
 |  | ||||||
|       //       duration: 3000
 |  | ||||||
|       //     });
 |  | ||||||
|       //     reject(false)
 |  | ||||||
|       //     // reject()
 |  | ||||||
|       //   }
 |  | ||||||
|       //
 |  | ||||||
|       // });
 |  | ||||||
|     }) |     }) | ||||||
|   } |   } | ||||||
| } | } | ||||||
| 
 | export async function deleteAllPicturesFn(){ | ||||||
| export async function deleteAllPicturesFn() { |  | ||||||
|   fileHelper.deleteAllPictures(); |   fileHelper.deleteAllPictures(); | ||||||
|   deleteAllVideos(globalThis.context, photoAccessHelper.AlbumType.USER, photoAccessHelper.AlbumSubtype.VIDEO) |   deleteAllVideos(globalThis.context,photoAccessHelper.AlbumType.USER,photoAccessHelper.AlbumSubtype.VIDEO) | ||||||
| 
 | 
 | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| @ -294,8 +261,7 @@ export async function deleteAllFileByPiC(dirName, type = 1) { | |||||||
|   fileHelper.deleteFileOfAlbum(dirName, type); |   fileHelper.deleteFileOfAlbum(dirName, type); | ||||||
| } | } | ||||||
| 
 | 
 | ||||||
| export async function deleteAllVideos(context, type: photoAccessHelper.AlbumType, | export async function deleteAllVideos(context, type: photoAccessHelper.AlbumType, subType: photoAccessHelper.AlbumSubtype): Promise<void> { | ||||||
|                                       subType: photoAccessHelper.AlbumSubtype): Promise<void> { |  | ||||||
|   let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = null; |   let fetchResult: photoAccessHelper.FetchResult<photoAccessHelper.Album> = null; | ||||||
|   try { |   try { | ||||||
|     const userFileMgr = photoAccessHelper.getPhotoAccessHelper(context); |     const userFileMgr = photoAccessHelper.getPhotoAccessHelper(context); | ||||||
|  | |||||||
| @ -29,12 +29,7 @@ export default class EntryAbility extends UIAbility { | |||||||
|     const arrClose = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00] |     const arrClose = [0x55, 0xaa, 0x01, 0x00, 0x02, 0x00, 0x03, 0x00] | ||||||
|     const arrCloseBuffer = Array2Byte(arrClose).buffer |     const arrCloseBuffer = Array2Byte(arrClose).buffer | ||||||
|     globalThis?.lightLineUdp?.send(arrCloseBuffer); |     globalThis?.lightLineUdp?.send(arrCloseBuffer); | ||||||
|     let want: Want = { | 
 | ||||||
|       deviceId: '', |  | ||||||
|       bundleName: 'com.oh.dts', |  | ||||||
|       abilityName: 'ServiceExtAbility' |  | ||||||
|     }; |  | ||||||
|     await this.context.stopServiceExtensionAbility(want) |  | ||||||
|     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); |     hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onDestroy'); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -19,7 +19,6 @@ import UdpEvent from '../common/utils/UdpEvent'; | |||||||
| import { delPic } from '../common/service/videoService'; | import { delPic } from '../common/service/videoService'; | ||||||
| import imageBtn from './compontents/imageBtn'; | import imageBtn from './compontents/imageBtn'; | ||||||
| import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; | import VoiceAnnounce from './judgeSDK/utils/voiceAnnouncements'; | ||||||
| import IdlServiceExtProxy from '../IdlServiceExt/idl_service_ext_proxy'; |  | ||||||
| import Want from '@ohos.app.ability.Want'; | import Want from '@ohos.app.ability.Want'; | ||||||
| import emitter from '@ohos.events.emitter'; | import emitter from '@ohos.events.emitter'; | ||||||
| import { examJudgeVersion } from './judgeSDK/api'; | import { examJudgeVersion } from './judgeSDK/api'; | ||||||
| @ -60,7 +59,6 @@ struct Index { | |||||||
|   private interval = null; |   private interval = null; | ||||||
|   private avPlayer |   private avPlayer | ||||||
|   private context = getContext(this) as common.UIAbilityContext; |   private context = getContext(this) as common.UIAbilityContext; | ||||||
|   private serviceExtProxy: IdlServiceExtProxy |  | ||||||
| 
 | 
 | ||||||
|   @Styles |   @Styles | ||||||
|   commStyle(){ |   commStyle(){ | ||||||
| @ -353,76 +351,9 @@ struct Index { | |||||||
|     .backgroundImageSize({ width: '100%', height: '100%' }) |     .backgroundImageSize({ width: '100%', height: '100%' }) | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   async startServiceAbility() { |  | ||||||
|     let want: Want = { |  | ||||||
|       deviceId: '', |  | ||||||
|       bundleName: 'com.oh.dts', |  | ||||||
|       abilityName: 'ServiceExtAbility' |  | ||||||
|     }; |  | ||||||
| 
 | 
 | ||||||
|     await this.context.startServiceExtensionAbility(want).then(() => { |  | ||||||
|       // 成功启动后台服务 |  | ||||||
|       console.log('js-test index.ets Succeeded in starting ServiceExtensionAbility.'); |  | ||||||
|       let self = this; |  | ||||||
|       let options: common.ConnectOptions = { |  | ||||||
|         onConnect(elementName, remote): void { |  | ||||||
|           console.log('js-test index.ets onConnect callback'); |  | ||||||
|           if (remote === null) { |  | ||||||
|             console.log(`js-test index.ets onConnect remote is null`); |  | ||||||
|             return; |  | ||||||
|           } |  | ||||||
|           self.serviceExtProxy = new IdlServiceExtProxy(remote); |  | ||||||
|           globalThis.serviceExtProxy = self.serviceExtProxy |  | ||||||
|           console.log(`js-test index.ets processData, this.serviceExtProxy == `, self.serviceExtProxy); |  | ||||||
|           // 通过接口调用的方式进行通信,屏蔽了RPC通信的细节,简洁明了 |  | ||||||
|           // self.serviceExtProxy.processData(1, (errorCode: number, retVal: object) => { |  | ||||||
|           //   console.log(`js-test index.ets processData, errorCode: ${errorCode}, retVal: ${retVal}`); |  | ||||||
|           // }); |  | ||||||
|         }, |  | ||||||
|         onDisconnect(elementName): void { |  | ||||||
|           console.log('js-test index.ets onDisconnect callback'); |  | ||||||
|         }, |  | ||||||
|         onFailed(code): void { |  | ||||||
|           console.log('js-test index.ets onFailed callback', JSON.stringify(code)); |  | ||||||
|         } |  | ||||||
|       } |  | ||||||
| 
 |  | ||||||
|       // 建立连接后返回的Id需要保存下来,在解绑服务时需要作为参数传入 |  | ||||||
|       // let connectionId = context.connectServiceExtensionAbility(want, options); |  | ||||||
|       try { |  | ||||||
|         this.context.connectServiceExtensionAbility(want, options); |  | ||||||
|       } catch (e) { |  | ||||||
|         console.log('js-test index.ets connectServiceExtensionAbility err == ', JSON.stringify(e)); |  | ||||||
|       } |  | ||||||
|       // 成功连接后台服务 |  | ||||||
|       console.log('js-test index.ets connectServiceExtensionAbility success'); |  | ||||||
| 
 |  | ||||||
|     }).catch((err) => { |  | ||||||
|       console.log(`js-test index.ets Failed to start ServiceExtensionAbility. Code is ${err.code}, message is ${err.message}`); |  | ||||||
|     }); |  | ||||||
|   } |  | ||||||
| 
 | 
 | ||||||
|   async aboutToAppear() { |   async aboutToAppear() { | ||||||
|     emitter.on({ |  | ||||||
|       eventId: 1 |  | ||||||
|     }, async () => { |  | ||||||
|       let want: Want = { |  | ||||||
|         deviceId: '', |  | ||||||
|         bundleName: 'com.oh.dts', |  | ||||||
|         abilityName: 'ServiceExtAbility' |  | ||||||
|       }; |  | ||||||
|       try { |  | ||||||
|         console.log("lixiao, 开始重启服务") |  | ||||||
|         await this.context.stopServiceExtensionAbility(want) |  | ||||||
|         await this.startServiceAbility() |  | ||||||
|         console.log("lixiao, 重启服务成功") |  | ||||||
|       } catch (e) { |  | ||||||
|         console.log("lixiao, 重启服务失败", JSON.stringify(e)) |  | ||||||
|       } |  | ||||||
| 
 |  | ||||||
|     }) |  | ||||||
|     await this.startServiceAbility() |  | ||||||
| 
 |  | ||||||
|     this.avPlayer = new VoiceAnnounce(); |     this.avPlayer = new VoiceAnnounce(); | ||||||
|     this.initParamFlag = false |     this.initParamFlag = false | ||||||
|     this.delLoading = false |     this.delLoading = false | ||||||
| @ -433,7 +364,6 @@ struct Index { | |||||||
|     globalThis.errorDialog = this.errorDialog |     globalThis.errorDialog = this.errorDialog | ||||||
|     globalThis.udpEvent = new UdpEvent(); |     globalThis.udpEvent = new UdpEvent(); | ||||||
|     getSyncData('MA_SYSSET').then(async data => { |     getSyncData('MA_SYSSET').then(async data => { | ||||||
| 
 |  | ||||||
|       console.log('datadata', JSON.stringify(data)) |       console.log('datadata', JSON.stringify(data)) | ||||||
|       // @ts-ignore |       // @ts-ignore | ||||||
| 
 | 
 | ||||||
| @ -448,7 +378,6 @@ struct Index { | |||||||
|           delPic(Number(sys.v_value), 2) |           delPic(Number(sys.v_value), 2) | ||||||
|           delLog(Number(sys.v_value)) |           delLog(Number(sys.v_value)) | ||||||
|           // this.delLoading=false |           // this.delLoading=false | ||||||
| 
 |  | ||||||
|         } |         } | ||||||
|       }) |       }) | ||||||
|     }); |     }); | ||||||
|  | |||||||
| @ -55,6 +55,7 @@ import { | |||||||
| } from './api/index'; | } from './api/index'; | ||||||
| import { getSyncData, upDateTableByArray } from '../../common/service/initable'; | import { getSyncData, upDateTableByArray } from '../../common/service/initable'; | ||||||
| import promptAction from '@ohos.promptAction'; | import promptAction from '@ohos.promptAction'; | ||||||
|  | import Want from '@ohos.app.ability.Want'; | ||||||
| 
 | 
 | ||||||
| const judgeTag = 'SURENJUN_JUDGE' | const judgeTag = 'SURENJUN_JUDGE' | ||||||
| 
 | 
 | ||||||
| @ -116,7 +117,7 @@ export default class Judge { | |||||||
|     const examDataArr = examDataStr.split('\n'); |     const examDataArr = examDataStr.split('\n'); | ||||||
|     for (let examDataStr of examDataArr) { |     for (let examDataStr of examDataArr) { | ||||||
|       const examData = JSON.parse(examDataStr) |       const examData = JSON.parse(examDataStr) | ||||||
|       const code = await writeObjectOut(examData); |       const code = await writeObjectOut(examData, false); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   //上传无锡所过程数据
 |   //上传无锡所过程数据
 | ||||||
| @ -692,9 +693,12 @@ export default class Judge { | |||||||
|     this.isExamEnd = false; |     this.isExamEnd = false; | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|  |   private externalTransmission: boolean = false | ||||||
|  |   // 计算是否启动
 | ||||||
|  |   private whetherToStart: boolean | ||||||
|   //调用监管接口
 |   //调用监管接口
 | ||||||
|   sendWriteObjectOut = async (data, filePath) => { |   sendWriteObjectOut = async (data, filePath) => { | ||||||
|     const temp = await writeObjectOut(data, filePath); |     const temp = await writeObjectOut(data, this.externalTransmission, filePath); | ||||||
|     console.log("wzj", JSON.stringify(temp)) |     console.log("wzj", JSON.stringify(temp)) | ||||||
|     if (this.disConnectNum == 0) { |     if (this.disConnectNum == 0) { | ||||||
|       console.log("wzj", "第一次发送", JSON.stringify(data)) |       console.log("wzj", "第一次发送", JSON.stringify(data)) | ||||||
| @ -711,12 +715,34 @@ export default class Judge { | |||||||
|         } |         } | ||||||
|         return await this.sendWriteObjectOut(data, filePath) |         return await this.sendWriteObjectOut(data, filePath) | ||||||
|       } |       } | ||||||
|  |       if (this.disConnectNum >= 5) { | ||||||
|  |         this.externalTransmission = true | ||||||
|  |         let want: Want = { | ||||||
|  |           bundleName: 'com.oh.upload', // 替换为你的应用包名
 | ||||||
|  |           abilityName: 'EntryAbility', // 你的 Service Ability 名称
 | ||||||
|  |           moduleName: 'entry', // 你的模块名称,通常是 'entry',
 | ||||||
|  |           parameters: {} | ||||||
|  |         }; | ||||||
|  |         try { | ||||||
|  |           let context = this.judgeUI.context; | ||||||
|  |           context.startAbility(want) | ||||||
|  |             .then(() => { | ||||||
|  |             }) | ||||||
|  |             .catch((error) => { | ||||||
|  |               console.error(`拉起应用失败: ${error.code} - ${error.message}`); | ||||||
|  |             }); | ||||||
|  |         } catch (error) { | ||||||
|  |           console.error(`启动Ability异常: ${error.message}`); | ||||||
|  |         } | ||||||
|  |         return await this.sendWriteObjectOut(data, filePath) | ||||||
|  |       } | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     if (this.disConnectNum >= 5) { |     if (this.disConnectNum >= 5) { | ||||||
|       console.info('surenjun', '123') |       console.info('surenjun', '123') | ||||||
|       this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!'; |       this.judgeUI.errorMsg = '当前的考试过程信息网络传输异常,程序点击确认将重启!'; | ||||||
|       this.judgeUI.disConnectErrorOpen = true |       this.judgeUI.disConnectErrorOpen = true | ||||||
|  | 
 | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     this.disConnectNum = 0 |     this.disConnectNum = 0 | ||||||
|  | |||||||
| @ -13,16 +13,6 @@ | |||||||
|     "deliveryWithInstall": true, |     "deliveryWithInstall": true, | ||||||
|     "installationFree": false, |     "installationFree": false, | ||||||
|     "pages": "$profile:main_pages", |     "pages": "$profile:main_pages", | ||||||
|     "extensionAbilities": [ |  | ||||||
|       { |  | ||||||
|         "name": "ServiceExtAbility", |  | ||||||
|         "icon": "$media:icon", |  | ||||||
|         "description": "service", |  | ||||||
|         "type": "service", |  | ||||||
|         "exported": true, |  | ||||||
|         "srcEntry": "./ets/ServiceExtAbility/ServiceExtAbility.ets" |  | ||||||
|       } |  | ||||||
|     ], |  | ||||||
|     "abilities": [ |     "abilities": [ | ||||||
|       { |       { | ||||||
|         "name": "EntryAbility", |         "name": "EntryAbility", | ||||||
|  | |||||||
| @ -1,6 +1,6 @@ | |||||||
| { | { | ||||||
|   "hvigorVersion": "3.0.9", |   "hvigorVersion": "3.2.4", | ||||||
|   "dependencies": { |   "dependencies": { | ||||||
|     "@ohos/hvigor-ohos-plugin": "3.0.9" |     "@ohos/hvigor-ohos-plugin": "3.2.4" | ||||||
|   } |   } | ||||||
| } | } | ||||||
| @ -1,13 +1,15 @@ | |||||||
| { | { | ||||||
|   "lockfileVersion": 1, |   "lockfileVersion": 2, | ||||||
|   "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", |   "ATTENTION": "THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.", | ||||||
|   "specifiers": { |   "specifiers": { | ||||||
|     "@ohos/hypium@1.0.6": "@ohos/hypium@1.0.6" |     "@ohos/hypium@1.0.6": "@ohos/hypium@1.0.6" | ||||||
|   }, |   }, | ||||||
|   "packages": { |   "packages": { | ||||||
|     "@ohos/hypium@1.0.6": { |     "@ohos/hypium@1.0.6": { | ||||||
|       "resolved": "https://repo.harmonyos.com/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz", |       "resolved": "https://ohpm.openharmony.cn/ohpm/@ohos/hypium/-/hypium-1.0.6.tgz", | ||||||
|       "integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ==" |       "integrity": "sha512-bb3DWeWhYrFqj9mPFV3yZQpkm36kbcK+YYaeY9g292QKSjOdmhEIQR2ULPvyMsgSR4usOBf5nnYrDmaCCXirgQ==", | ||||||
|  |       "registryType": "ohpm", | ||||||
|  |       "shasum": "3f5fed65372633233264b3447705b0831dfe7ea1" | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
| } | } | ||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user