fix: 提交
This commit is contained in:
		
							parent
							
								
									8d7173c545
								
							
						
					
					
						commit
						c3c8783969
					
				| @ -4,6 +4,7 @@ import { getSyncData } from '../common/service/initable'; | |||||||
| import writeObjectOutNew from './judgeNew'; | import writeObjectOutNew from './judgeNew'; | ||||||
| import FileUtil from '../common/utils/File'; | import FileUtil from '../common/utils/File'; | ||||||
| import tempRequest from '../common/utils/tempRequest'; | import tempRequest from '../common/utils/tempRequest'; | ||||||
|  | import pasteboard from '@ohos.pasteboard'; | ||||||
| 
 | 
 | ||||||
| let baseHost = globalThis.host; | let baseHost = globalThis.host; | ||||||
| 
 | 
 | ||||||
| @ -25,7 +26,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 +55,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) | ||||||
| 
 | 
 | ||||||
| @ -73,8 +73,38 @@ export async function writeObjectOut(params, filePath?: string): Promise<WR> { | |||||||
|     }) + `\n`); |     }) + `\n`); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   //对象转换成xml
 |   // //对象转换成xml
 | ||||||
|   const temp = await request({ |   // const temp = await request({
 | ||||||
|  |   //   host: globalThis.JGHOST,
 | ||||||
|  |   //   url: '/dems_ws/services/TmriOutAccess?wsdl',
 | ||||||
|  |   //   data: `<?xml version="1.0"?>
 | ||||||
|  |   //               <SOAP-ENV:Envelope
 | ||||||
|  |   //                 xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
 | ||||||
|  |   //                 xmlns:xsd="http://www.w3.org/2001/XMLSchema"
 | ||||||
|  |   //                 xmlns:xs="http://www.w3.org/2001/XMLSchema-instance"
 | ||||||
|  |   //                >
 | ||||||
|  |   //                <SOAP-ENV:Body>
 | ||||||
|  |   //                   <writeObjectOut  xmlns="http://service.es.doron">
 | ||||||
|  |   //                     <xtlb>${xtlb}</xtlb>
 | ||||||
|  |   //                     <jkxlh>${jkxlh}</jkxlh>
 | ||||||
|  |   //                     <jkid>${jkid}</jkid>
 | ||||||
|  |   //                     <UTF8XmlDoc>
 | ||||||
|  |   //                     <![CDATA[
 | ||||||
|  |   //                       <?xm lversion="1.0 "encoding="GBK"?>
 | ||||||
|  |   //                       <root>
 | ||||||
|  |   //                         <drvexam>
 | ||||||
|  |   //                           ${drvexamArrs}
 | ||||||
|  |   //                         </drvexam>
 | ||||||
|  |   //                       </root>
 | ||||||
|  |   //                     ]]>
 | ||||||
|  |   //                     </UTF8XmlDoc>
 | ||||||
|  |   //                   </writeObjectOut>
 | ||||||
|  |   //                </SOAP-ENV:Body>
 | ||||||
|  |   //              </SOAP-ENV:Envelope>`,
 | ||||||
|  |   //   method: 'post',
 | ||||||
|  |   //   xml: true
 | ||||||
|  |   // },)
 | ||||||
|  |   let requestData = { | ||||||
|     host: globalThis.JGHOST, |     host: globalThis.JGHOST, | ||||||
|     url: '/dems_ws/services/TmriOutAccess?wsdl', |     url: '/dems_ws/services/TmriOutAccess?wsdl', | ||||||
|     data: `<?xml version="1.0"?>
 |     data: `<?xml version="1.0"?>
 | ||||||
| @ -103,7 +133,25 @@ export async function writeObjectOut(params, filePath?: string): Promise<WR> { | |||||||
|                </SOAP-ENV:Envelope>`, |                </SOAP-ENV:Envelope>`, | ||||||
|     method: 'post', |     method: 'post', | ||||||
|     xml: true |     xml: true | ||||||
|   },) |   } | ||||||
|  |   let temp = {} | ||||||
|  |   try { | ||||||
|  |     if (!externalTransmission) { | ||||||
|  |       temp = await request(requestData) | ||||||
|  |     } else { | ||||||
|  |       let systemPasteboard = pasteboard.getSystemPasteboard() | ||||||
|  |       let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, JSON.stringify(requestData)) | ||||||
|  |       await systemPasteboard.clear() | ||||||
|  |       await systemPasteboard.setData(pasteData) | ||||||
|  | 
 | ||||||
|  |       temp = { | ||||||
|  |         code: 1 | ||||||
|  |       } | ||||||
|  |     } | ||||||
|  |   } catch (e) { | ||||||
|  |     console.log("新监管错误") | ||||||
|  |     temp = e | ||||||
|  |   } | ||||||
|   if (filePath) { |   if (filePath) { | ||||||
|     const fileUtil = new FileUtil(globalThis.context); |     const fileUtil = new FileUtil(globalThis.context); | ||||||
|     await fileUtil.initFolder(filePath); |     await fileUtil.initFolder(filePath); | ||||||
|  | |||||||
| @ -3,6 +3,7 @@ import request from "../common/utils/request" | |||||||
| let baseHost = globalThis.host; | let baseHost = globalThis.host; | ||||||
| import FileUtil from '../common/utils/File'; | import FileUtil from '../common/utils/File'; | ||||||
| import FileLog from '../pages/judgeSDK/utils/fileLog'; | import FileLog from '../pages/judgeSDK/utils/fileLog'; | ||||||
|  | import pasteboard from '@ohos.pasteboard'; | ||||||
| 
 | 
 | ||||||
| //监管接口序列号映射
 | //监管接口序列号映射
 | ||||||
| const gjxlhObj = { | const gjxlhObj = { | ||||||
| @ -19,33 +20,38 @@ 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({ | ||||||
|       wglb,jkxlh,glbm,jgbh,sjbs, |       wglb, | ||||||
|       data:params.data, |       jkxlh, | ||||||
|       file:{...params.file,param:[]}, |       glbm, | ||||||
|  |       jgbh, | ||||||
|  |       sjbs, | ||||||
|  |       data: params.data, | ||||||
|  |       file: { | ||||||
|  |         ...params.file, param: [] | ||||||
|  |       }, | ||||||
|     })); |     })); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // let connectTimeout = sjbs === '02-21-000014' ?60000:1
 |   // let connectTimeout = sjbs === '02-21-000014' ?60000:1
 | ||||||
|   console.info('surenjun','调用新监管') |   console.info('surenjun', '调用新监管') | ||||||
|   let temp |   let temp | ||||||
|   try { |   let requestData = { | ||||||
|     temp = await request({ |     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" | ||||||
| @ -63,17 +69,29 @@ export default async function writeObjectOutNew(data,filePath): Promise<WR> { | |||||||
|                     </writeObjectOut> |                     </writeObjectOut> | ||||||
|                  </SOAP-ENV:Body> |                  </SOAP-ENV:Body> | ||||||
|                </SOAP-ENV:Envelope>`, |                </SOAP-ENV:Envelope>`, | ||||||
|     }) |   } | ||||||
|  |   try { | ||||||
|  |     if (!externalTransmission) { | ||||||
|  |       temp = await request(requestData) | ||||||
|  |     } else { | ||||||
|  |       let systemPasteboard = pasteboard.getSystemPasteboard() | ||||||
|  |       let pasteData = pasteboard.createData(pasteboard.MIMETYPE_TEXT_PLAIN, JSON.stringify(requestData)) | ||||||
|  |       await systemPasteboard.clear() | ||||||
|  |       await systemPasteboard.setData(pasteData) | ||||||
|  | 
 | ||||||
|  |       temp = { | ||||||
|  |         code: 1 | ||||||
|  |       } | ||||||
|  |     } | ||||||
|   } catch (e) { |   } catch (e) { | ||||||
|     console.log("新监管错误") |     console.log("新监管错误") | ||||||
|     temp = e |     temp = e | ||||||
|   } |   } | ||||||
|   console.log("temp message: ", JSON.stringify(temp)) |   console.log("temp message: ", JSON.stringify(temp)) | ||||||
|   if(filePath){ |   if (filePath) { | ||||||
|    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) { | ||||||
|  | |||||||
| @ -1094,7 +1094,7 @@ struct UserInfo { | |||||||
|       jkid: '17C51', |       jkid: '17C51', | ||||||
|     } |     } | ||||||
|     console.info('surenjunjianguan', JSON.stringify(param)) |     console.info('surenjunjianguan', JSON.stringify(param)) | ||||||
|     const temp = await writeObjectOut(param); |     const temp = await writeObjectOut(param,false); | ||||||
|     globalThis.lsh = this.currentUser.lsh |     globalThis.lsh = this.currentUser.lsh | ||||||
|     globalThis.ksyh = this.currentUser.ksy1sfzmhm |     globalThis.ksyh = this.currentUser.ksy1sfzmhm | ||||||
|     return temp |     return temp | ||||||
|  | |||||||
| @ -226,7 +226,7 @@ export default struct DeductedPopup { | |||||||
|         kssj: time |         kssj: time | ||||||
|       }, |       }, | ||||||
|     } |     } | ||||||
|     const code = await writeObjectOut(beginData) |     const code = await writeObjectOut(beginData,false) | ||||||
|     //TODO code待处理 |     //TODO code待处理 | ||||||
|     // if (code == 1) { |     // if (code == 1) { | ||||||
|     // |     // | ||||||
| @ -257,7 +257,7 @@ export default struct DeductedPopup { | |||||||
|         ksdd: decodeURI(ksdd) |         ksdd: decodeURI(ksdd) | ||||||
|       } |       } | ||||||
|     }; |     }; | ||||||
|     const code = await writeObjectOut(photoData); |     const code = await writeObjectOut(photoData,false); | ||||||
|     console.info('surenjun uploadProgressPhoto end',) |     console.info('surenjun uploadProgressPhoto end',) | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
| @ -285,7 +285,7 @@ export default struct DeductedPopup { | |||||||
|         kfsj: time |         kfsj: time | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     const code = await writeObjectOut(kfData); |     const code = await writeObjectOut(kfData,false); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   // 项目结束 |   // 项目结束 | ||||||
| @ -309,7 +309,7 @@ export default struct DeductedPopup { | |||||||
|         jssj: time |         jssj: time | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     const code = await writeObjectOut(endProjectData); |     const code = await writeObjectOut(endProjectData,false); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   //考试结束 |   //考试结束 | ||||||
| @ -335,7 +335,7 @@ export default struct DeductedPopup { | |||||||
|         dwlc: '', |         dwlc: '', | ||||||
|       } |       } | ||||||
|     } |     } | ||||||
|     const code = await writeObjectOut(endData); |     const code = await writeObjectOut(endData,false); | ||||||
|   } |   } | ||||||
| 
 | 
 | ||||||
|   //获取sysset表数据 |   //获取sysset表数据 | ||||||
|  | |||||||
| @ -56,6 +56,8 @@ import { | |||||||
| } from './api/index'; | } from './api/index'; | ||||||
| import { getSyncData, upDateTableByArray } from '../../common/service/initable'; | import { getSyncData, upDateTableByArray } from '../../common/service/initable'; | ||||||
| import { GlobalConfig } from '../../config'; | import { GlobalConfig } from '../../config'; | ||||||
|  | import Want from '@ohos.app.ability.Want'; | ||||||
|  | 
 | ||||||
| const judgeTag = 'SURENJUN_JUDGE' | const judgeTag = 'SURENJUN_JUDGE' | ||||||
| 
 | 
 | ||||||
| function ifNeedRetry(code: number | string): boolean { | function ifNeedRetry(code: number | string): boolean { | ||||||
| @ -115,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); | ||||||
|     } |     } | ||||||
|   } |   } | ||||||
|   //上传无锡所过程数据
 |   //上传无锡所过程数据
 | ||||||
| @ -621,10 +623,12 @@ export default class Judge { | |||||||
|   private videoData: any |   private videoData: any | ||||||
|   private disConnectNum: number = 0; |   private disConnectNum: number = 0; | ||||||
|   //调用监管接口
 |   //调用监管接口
 | ||||||
| 
 |   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)) | ||||||
| @ -641,12 +645,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 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user