Compare commits
	
		
			No commits in common. "63f4248e9f33b4d6968c5e15d3955b1a1b43ec47" and "df6ccfa6899a7bebac78c7494628f85a96bf34e3" have entirely different histories.
		
	
	
		
			63f4248e9f
			...
			df6ccfa689
		
	
		
@ -87,8 +87,7 @@ export async function initCarInfoCache(params: initCarInfoCacheParams) {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
//参数下发读表接口
 | 
					//参数下发读表接口
 | 
				
			||||||
export async function initCenterCache(params: object, url: string) {
 | 
					export async function initCenterCache(params: object, url: string) {
 | 
				
			||||||
  const timeInfo: TimeSynchronizationRspBody =
 | 
					  const timeInfo: TimeSynchronizationRspBody = AppStorage.get<TimeSynchronizationRspBody>('timeInfo')
 | 
				
			||||||
    AppStorage.get<TimeSynchronizationRspBody>('timeInfo') ?? { /* default values */ };
 | 
					 | 
				
			||||||
  return await request<object>({
 | 
					  return await request<object>({
 | 
				
			||||||
    url: '/para/initCenterCache.ws',
 | 
					    url: '/para/initCenterCache.ws',
 | 
				
			||||||
    data: params,
 | 
					    data: params,
 | 
				
			||||||
@ -113,8 +112,7 @@ export async function initCenterCacheByKSPT(params: object, url: string) {
 | 
				
			|||||||
//从参数平台获取模型
 | 
					//从参数平台获取模型
 | 
				
			||||||
// TODO 类型需要补全
 | 
					// TODO 类型需要补全
 | 
				
			||||||
export async function initEsModel(params: InitModelParams) {
 | 
					export async function initEsModel(params: InitModelParams) {
 | 
				
			||||||
  const timeInfo: TimeSynchronizationRspBody =
 | 
					  const timeInfo: TimeSynchronizationRspBody = AppStorage.get<TimeSynchronizationRspBody>('timeInfo')
 | 
				
			||||||
    AppStorage.get<TimeSynchronizationRspBody>('timeInfo') ?? { /* default values */ };
 | 
					 | 
				
			||||||
  return await request<InitModelResponse>({
 | 
					  return await request<InitModelResponse>({
 | 
				
			||||||
    url: '/para/initEsModel.ws',
 | 
					    url: '/para/initEsModel.ws',
 | 
				
			||||||
    data: params,
 | 
					    data: params,
 | 
				
			||||||
 | 
				
			|||||||
@ -5,6 +5,7 @@ import { GlobalConfig } from '../config/global';
 | 
				
			|||||||
import Want from '@ohos.app.ability.Want';
 | 
					import Want from '@ohos.app.ability.Want';
 | 
				
			||||||
import AbilityConstant from '@ohos.app.ability.AbilityConstant';
 | 
					import AbilityConstant from '@ohos.app.ability.AbilityConstant';
 | 
				
			||||||
import { BaseInfoType, CarInfoType, EnvironmentConfigurationType, ExaminerInfoType } from '../model';
 | 
					import { BaseInfoType, CarInfoType, EnvironmentConfigurationType, ExaminerInfoType } from '../model';
 | 
				
			||||||
 | 
					import { tcpUtil } from '../utils/TcpRequest';
 | 
				
			||||||
import DB from '../utils/DbSql';
 | 
					import DB from '../utils/DbSql';
 | 
				
			||||||
import { DrivingDataStorage } from '../utils/business/DrivingDataStorage';
 | 
					import { DrivingDataStorage } from '../utils/business/DrivingDataStorage';
 | 
				
			||||||
import { InitTable } from '../utils/table/Operation';
 | 
					import { InitTable } from '../utils/table/Operation';
 | 
				
			||||||
@ -41,6 +42,7 @@ export default class EntryAbility extends UIAbility {
 | 
				
			|||||||
  async onWindowStageCreate(windowStage: window.WindowStage) {
 | 
					  async onWindowStageCreate(windowStage: window.WindowStage) {
 | 
				
			||||||
    // Main window is created, set main page for this ability
 | 
					    // Main window is created, set main page for this ability
 | 
				
			||||||
    hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
 | 
					    hilog.info(0x0000, 'testTag', '%{public}s', 'Ability onWindowStageCreate');
 | 
				
			||||||
 | 
					    await tcpUtil.init()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    AppStorage.setOrCreate<CarInfoType>('carInfo', {})
 | 
					    AppStorage.setOrCreate<CarInfoType>('carInfo', {})
 | 
				
			||||||
    AppStorage.setOrCreate<ExaminerInfoType>('examinerInfo', {})
 | 
					    AppStorage.setOrCreate<ExaminerInfoType>('examinerInfo', {})
 | 
				
			||||||
@ -50,8 +52,8 @@ export default class EntryAbility extends UIAbility {
 | 
				
			|||||||
    AppStorage.setOrCreate<string>('deviceNo', "") //设备号
 | 
					    AppStorage.setOrCreate<string>('deviceNo', "") //设备号
 | 
				
			||||||
    AppStorage.setOrCreate<BaseInfoType>('baseInfo', {
 | 
					    AppStorage.setOrCreate<BaseInfoType>('baseInfo', {
 | 
				
			||||||
      hasAuth: false,
 | 
					      hasAuth: false,
 | 
				
			||||||
      version: GlobalConfig.version.jn.km3[0] || "",
 | 
					      version: GlobalConfig.version.jn.km3[0],
 | 
				
			||||||
      judgeVersion: GlobalConfig.version.jn.km3[1] || "",
 | 
					      judgeVersion: GlobalConfig.version.jn.km3[1],
 | 
				
			||||||
      tcpSendNum: 0,
 | 
					      tcpSendNum: 0,
 | 
				
			||||||
      videoVersion: '1.0',
 | 
					      videoVersion: '1.0',
 | 
				
			||||||
      ratio: 1700 / 960, //适配比例
 | 
					      ratio: 1700 / 960, //适配比例
 | 
				
			||||||
 | 
				
			|||||||
@ -90,11 +90,10 @@ export interface BaseInfoType {
 | 
				
			|||||||
  deviceNo?: string
 | 
					  deviceNo?: string
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface kfdmObj {
 | 
					interface kfdmObj{
 | 
				
			||||||
  xmdm: number
 | 
					  xmdm:number
 | 
				
			||||||
  kfdm: string
 | 
					  kfdm:string
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					 | 
				
			||||||
// 路由参数
 | 
					// 路由参数
 | 
				
			||||||
export interface RouteParamsType {
 | 
					export interface RouteParamsType {
 | 
				
			||||||
  sczb?: string;
 | 
					  sczb?: string;
 | 
				
			||||||
@ -151,7 +150,7 @@ export interface GlobalConfigType {
 | 
				
			|||||||
  picSavePath?: string
 | 
					  picSavePath?: string
 | 
				
			||||||
  videoSavePath?: string
 | 
					  videoSavePath?: string
 | 
				
			||||||
  host?: string
 | 
					  host?: string
 | 
				
			||||||
  version: VersionType
 | 
					  version?: VersionType
 | 
				
			||||||
  //   几代机
 | 
					  //   几代机
 | 
				
			||||||
  modelNo?: string
 | 
					  modelNo?: string
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -173,6 +172,6 @@ interface VersionInfo {
 | 
				
			|||||||
export interface centerCallBackMsgType {
 | 
					export interface centerCallBackMsgType {
 | 
				
			||||||
  id: number;
 | 
					  id: number;
 | 
				
			||||||
  length: number;
 | 
					  length: number;
 | 
				
			||||||
  body: number[];
 | 
					  body:number[];
 | 
				
			||||||
  sendId: number;
 | 
					  sendId:number;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@ -1,7 +1,7 @@
 | 
				
			|||||||
import TopLogo from './compontents/TopLogo';
 | 
					import TopLogo from './compontents/TopLogo';
 | 
				
			||||||
 | 
					import { getSyncData } from '../common/service/initable';
 | 
				
			||||||
import router from '@ohos.router';
 | 
					import router from '@ohos.router';
 | 
				
			||||||
import { MASYSTEMPARMType, RouteParamsType } from '../model';
 | 
					import { MASYSTEMPARMType, RouteParamsType } from '../model';
 | 
				
			||||||
import { GetSyncData } from '../utils/table/Operation';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
const cBg = $rawfile('judge/km3/road/luxian_pre.png');
 | 
					const cBg = $rawfile('judge/km3/road/luxian_pre.png');
 | 
				
			||||||
const lBg = $rawfile('judge/km3/road/luxian_nor.png');
 | 
					const lBg = $rawfile('judge/km3/road/luxian_nor.png');
 | 
				
			||||||
@ -17,7 +17,7 @@ struct Index {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  async aboutToAppear() {
 | 
					  async aboutToAppear() {
 | 
				
			||||||
    //读取systemparam表的no1等于4的
 | 
					    //读取systemparam表的no1等于4的
 | 
				
			||||||
    const systemParms: Array<MASYSTEMPARMType> = await GetSyncData('MA_SYSTEMPARM') as MASYSTEMPARMType[];
 | 
					    const systemParms: Array<MASYSTEMPARMType> = await getSyncData('MA_SYSTEMPARM') as MASYSTEMPARMType[];
 | 
				
			||||||
    systemParms.forEach((systemParm: MASYSTEMPARMType) => {
 | 
					    systemParms.forEach((systemParm: MASYSTEMPARMType) => {
 | 
				
			||||||
      //TODO 字段名称待修改
 | 
					      //TODO 字段名称待修改
 | 
				
			||||||
      // const { no1, no2, no3, txt1, txt2 } = systemParm;
 | 
					      // const { no1, no2, no3, txt1, txt2 } = systemParm;
 | 
				
			||||||
 | 
				
			|||||||
@ -8,7 +8,7 @@ import IDCardSDK from '@ohos.idcard';
 | 
				
			|||||||
import common from '@ohos.app.ability.common';
 | 
					import common from '@ohos.app.ability.common';
 | 
				
			||||||
import promptAction from '@ohos.promptAction';
 | 
					import promptAction from '@ohos.promptAction';
 | 
				
			||||||
import FilePhoto from './judgeSDK/utils/filePhoto';
 | 
					import FilePhoto from './judgeSDK/utils/filePhoto';
 | 
				
			||||||
 | 
					// import { sqlInsertCommonFn, upDateTableByArray } from '../common/service/initable';
 | 
				
			||||||
import { CandidateData, EmptyCandidateObject } from '../mock/CandidateData';
 | 
					import { CandidateData, EmptyCandidateObject } from '../mock/CandidateData';
 | 
				
			||||||
import BoardPrePareSetPopup from './compontents/judge/BoardPrePareSetPopup';
 | 
					import BoardPrePareSetPopup from './compontents/judge/BoardPrePareSetPopup';
 | 
				
			||||||
import LoadingPopup from './compontents/judge/LoadingPopup';
 | 
					import LoadingPopup from './compontents/judge/LoadingPopup';
 | 
				
			||||||
@ -209,6 +209,20 @@ struct UserInfo {
 | 
				
			|||||||
    { label: '考试员名', key: 'ksy2' },
 | 
					    { label: '考试员名', key: 'ksy2' },
 | 
				
			||||||
  ]
 | 
					  ]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  private onCenterMsg = (val: centerCallBackMsgType) => {
 | 
				
			||||||
 | 
					    if (val.id == 32) {
 | 
				
			||||||
 | 
					      AppStorage.setOrCreate('signNum', val.body[1])
 | 
				
			||||||
 | 
					      if (val.body[0] == 7) {
 | 
				
			||||||
 | 
					        //缺考处理
 | 
				
			||||||
 | 
					        this.getqkFn()
 | 
				
			||||||
 | 
					        this.signNum = val.body[1]
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    } else if (val.id == 42) {
 | 
				
			||||||
 | 
					      //收到中心缺考确认消息
 | 
				
			||||||
 | 
					      this.qkFn()
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  aboutToAppear() {
 | 
					  aboutToAppear() {
 | 
				
			||||||
    this.avPlayer = new VoiceAnnounce();
 | 
					    this.avPlayer = new VoiceAnnounce();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@ -1327,20 +1341,6 @@ struct UserInfo {
 | 
				
			|||||||
    .backgroundImage($r('app.media.bg'))
 | 
					    .backgroundImage($r('app.media.bg'))
 | 
				
			||||||
    .backgroundImageSize({ width: '100%', height: '100%' })
 | 
					    .backgroundImageSize({ width: '100%', height: '100%' })
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					 | 
				
			||||||
  private onCenterMsg = (val: centerCallBackMsgType) => {
 | 
					 | 
				
			||||||
    if (val.id == 32) {
 | 
					 | 
				
			||||||
      AppStorage.setOrCreate('signNum', val.body[1])
 | 
					 | 
				
			||||||
      if (val.body[0] == 7) {
 | 
					 | 
				
			||||||
        //缺考处理
 | 
					 | 
				
			||||||
        this.getqkFn()
 | 
					 | 
				
			||||||
        this.signNum = val.body[1]
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    } else if (val.id == 42) {
 | 
					 | 
				
			||||||
      //收到中心缺考确认消息
 | 
					 | 
				
			||||||
      this.qkFn()
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  }
 | 
					 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// 头像组件
 | 
					// 头像组件
 | 
				
			||||||
 | 
				
			|||||||
@ -1,15 +1,15 @@
 | 
				
			|||||||
 | 
					import { voiceService } from '../../service/voiceService';
 | 
				
			||||||
import { faceCompare } from '../../api/userInfo';
 | 
					import { faceCompare } from '../../api/userInfo';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
import common from '@ohos.app.ability.common';
 | 
					import common from '@ohos.app.ability.common';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					import { takePhoto } from '../../service/videoService';
 | 
				
			||||||
import { GlobalConfig } from '../../config/index';
 | 
					import { GlobalConfig } from '../../config/index';
 | 
				
			||||||
import { VideoConfigData } from '../../mock';
 | 
					import { VideoConfigData } from '../../mock';
 | 
				
			||||||
import { CarInfoType, UDPParamType, VideoConfig } from '../../model';
 | 
					import { CarInfoType, UDPParamType, VideoConfig } from '../../model';
 | 
				
			||||||
import { NumberToByteArray } from '../../utils/Common';
 | 
					import { NumberToByteArray } from '../../utils/Common';
 | 
				
			||||||
import FileUtils from '../../utils/FileUtils';
 | 
					import FileUtils from '../../utils/FileUtils';
 | 
				
			||||||
import { CenterUDPClientInstance } from '../../utils/business/CenterUdpBusiness';
 | 
					import { CenterUDPClientInstance } from '../../utils/business/CenterUdpBusiness';
 | 
				
			||||||
import { takePhoto } from '../../utils/Video';
 | 
					 | 
				
			||||||
import { voiceService } from '../../utils/Voice';
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
interface ParamType {
 | 
					interface ParamType {
 | 
				
			||||||
  id?: number;
 | 
					  id?: number;
 | 
				
			||||||
@ -257,25 +257,25 @@ export default struct FaceCompare {
 | 
				
			|||||||
        CenterUDPClientInstance.sendData(param2)
 | 
					        CenterUDPClientInstance.sendData(param2)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }, 1000)
 | 
					    }, 1000)
 | 
				
			||||||
    CenterUDPClientInstance.onMsg((val) => {
 | 
					    CenterUDPClientInstance.getData((val)=>{
 | 
				
			||||||
      if (AppStorage.get('statue') != 3) {
 | 
					        if (AppStorage.get('statue') != 3) {
 | 
				
			||||||
        return
 | 
					          return
 | 
				
			||||||
      }
 | 
					        }
 | 
				
			||||||
      if (val.id == 48) {
 | 
					        if (val.id == 48) {
 | 
				
			||||||
        if (val.body[13] == 1) {
 | 
					          if (val.body[13] == 1) {
 | 
				
			||||||
          this.showFaceCompareFlag = !this.showFaceCompareFlag
 | 
					            this.showFaceCompareFlag = !this.showFaceCompareFlag
 | 
				
			||||||
          this.showFaceCompare = !this.showFaceCompare
 | 
					            this.showFaceCompare = !this.showFaceCompare
 | 
				
			||||||
          this.vocObj && this.vocObj.releasePlayer()
 | 
					            this.vocObj && this.vocObj.releasePlayer()
 | 
				
			||||||
          this.faceCompareSucess = 1
 | 
					            this.faceCompareSucess = 1
 | 
				
			||||||
          clearInterval(this.interval)
 | 
					            clearInterval(this.interval)
 | 
				
			||||||
        } else if (val.body[13] == 1 && this.callBackFlag) {
 | 
					          } else if (val.body[13] == 1 && this.callBackFlag) {
 | 
				
			||||||
          AppStorage.setOrCreate('statue', 2)
 | 
					            AppStorage.setOrCreate('statue', 2)
 | 
				
			||||||
          this.vocObj && this.vocObj.playAudio({
 | 
					            this.vocObj && this.vocObj.playAudio({
 | 
				
			||||||
            type: 1,
 | 
					              type: 1,
 | 
				
			||||||
            name: 'face_chekc_fail.wav'
 | 
					              name: 'face_chekc_fail.wav'
 | 
				
			||||||
          })
 | 
					            })
 | 
				
			||||||
 | 
					          }
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
@ -2,7 +2,7 @@ import router from '@ohos.router';
 | 
				
			|||||||
import RealTime from '../compontents/judge/RealTime';
 | 
					import RealTime from '../compontents/judge/RealTime';
 | 
				
			||||||
import { GPSData, SignalData } from '../../mock';
 | 
					import { GPSData, SignalData } from '../../mock';
 | 
				
			||||||
import { SignalDataType } from '../../model';
 | 
					import { SignalDataType } from '../../model';
 | 
				
			||||||
import { ObtainUdpBusinessInstance } from '../../utils/business/ObtainUdpBusiness';
 | 
					import { ObtainSignalData } from '../../utils/business/ObtainSignalData';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@Component
 | 
					@Component
 | 
				
			||||||
export default struct SignDisplayCom {
 | 
					export default struct SignDisplayCom {
 | 
				
			||||||
@ -327,14 +327,16 @@ export default struct SignDisplayCom {
 | 
				
			|||||||
    // const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt')
 | 
					    // const data = await fileUtil.readFile(GlobalConfig.comoonfileWriteAddress + '/config/ipConfig.txt')
 | 
				
			||||||
    // this.udplocalIp=JSON.parse(data)?.udplocalIp||'192.168.7.170'
 | 
					    // this.udplocalIp=JSON.parse(data)?.udplocalIp||'192.168.7.170'
 | 
				
			||||||
    this.ratio = this.ratio * (this.scaleNum || 1);
 | 
					    this.ratio = this.ratio * (this.scaleNum || 1);
 | 
				
			||||||
 | 
					    const that = this
 | 
				
			||||||
 | 
					    const { showBack, getSignal } = this
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if (this.showBack) {
 | 
					    if (showBack) {
 | 
				
			||||||
      this.ratio = 1.4
 | 
					      this.ratio = 1.4
 | 
				
			||||||
      ObtainUdpBusinessInstance.onMsg((msg) => {
 | 
					      ObtainSignalData.getData((msg)=>{
 | 
				
			||||||
        if (msg) {
 | 
					          if (msg) {
 | 
				
			||||||
          this.getSignal(msg)
 | 
					            getSignal(msg)
 | 
				
			||||||
        }
 | 
					          }
 | 
				
			||||||
      })
 | 
					      })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
@ -342,7 +344,7 @@ export default struct SignDisplayCom {
 | 
				
			|||||||
      this.signalTimer = setInterval(() => {
 | 
					      this.signalTimer = setInterval(() => {
 | 
				
			||||||
        const msgStr = AppStorage.get<string>('msgStr')
 | 
					        const msgStr = AppStorage.get<string>('msgStr')
 | 
				
			||||||
        if (msgStr) {
 | 
					        if (msgStr) {
 | 
				
			||||||
          this.getSignal(msgStr)
 | 
					          getSignal(msgStr)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }, 200)
 | 
					      }, 200)
 | 
				
			||||||
@ -351,9 +353,10 @@ export default struct SignDisplayCom {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  onPageShow() {
 | 
					  onPageShow() {
 | 
				
			||||||
    const getSignal = this.getSignal;
 | 
					    const getSignal = this.getSignal;
 | 
				
			||||||
 | 
					    const that = this
 | 
				
			||||||
    const showBack = this.showBack;
 | 
					    const showBack = this.showBack;
 | 
				
			||||||
    if (showBack) {
 | 
					    if (showBack) {
 | 
				
			||||||
      ObtainUdpBusinessInstance.onMsg((msg) => {
 | 
					      ObtainSignalData.getData((msg)=>{
 | 
				
			||||||
        if (msg) {
 | 
					        if (msg) {
 | 
				
			||||||
          getSignal(msg)
 | 
					          getSignal(msg)
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
				
			|||||||
@ -2,13 +2,11 @@
 | 
				
			|||||||
export default struct imageBtn {
 | 
					export default struct imageBtn {
 | 
				
			||||||
  //状态变量unPressed,用于控制按钮的状态
 | 
					  //状态变量unPressed,用于控制按钮的状态
 | 
				
			||||||
  @State unPressed: boolean = true
 | 
					  @State unPressed: boolean = true
 | 
				
			||||||
  btnWidth?: string | number
 | 
					  btnWidth: string | number
 | 
				
			||||||
  btnHeight?: string | number
 | 
					  btnHeight: string | number
 | 
				
			||||||
  imgSrc?: Resource
 | 
					  imgSrc:Resource
 | 
				
			||||||
  opacityNum: number = 1
 | 
					  opacityNum:number=1
 | 
				
			||||||
 | 
					  @Styles customStyle(){
 | 
				
			||||||
  @Styles
 | 
					 | 
				
			||||||
  customStyle(){
 | 
					 | 
				
			||||||
    .width('100%')
 | 
					    .width('100%')
 | 
				
			||||||
    .height('100%')
 | 
					    .height('100%')
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@ -22,7 +20,8 @@ export default struct imageBtn {
 | 
				
			|||||||
            // 判断当前组件为放开状态
 | 
					            // 判断当前组件为放开状态
 | 
				
			||||||
            if (this.unPressed) {
 | 
					            if (this.unPressed) {
 | 
				
			||||||
              // 插入Row组件,配置过渡效果
 | 
					              // 插入Row组件,配置过渡效果
 | 
				
			||||||
              Image(this.imgSrc)// 水波纹扩散动画:Row组件backgroundColor属性变更(#fff -> #ccc),系统插入动画过渡效果,从组建的中心点开始放大,scale{0,0}变更scale{1,1}
 | 
					              Image(this.imgSrc)
 | 
				
			||||||
 | 
					                // 水波纹扩散动画:Row组件backgroundColor属性变更(#fff -> #ccc),系统插入动画过渡效果,从组建的中心点开始放大,scale{0,0}变更scale{1,1}
 | 
				
			||||||
                .transition({
 | 
					                .transition({
 | 
				
			||||||
                  type: TransitionType.Insert,
 | 
					                  type: TransitionType.Insert,
 | 
				
			||||||
                  opacity: 0,
 | 
					                  opacity: 0,
 | 
				
			||||||
@ -39,11 +38,10 @@ export default struct imageBtn {
 | 
				
			|||||||
                    duration: 500,
 | 
					                    duration: 500,
 | 
				
			||||||
                    // 聚拢动画播放完成后,需要衔接扩散动画,此时Row组件backgroundColor属性变更(#fff -> #ccc),插入动画过渡效果,scale{0,0}变化为scale{1,1}
 | 
					                    // 聚拢动画播放完成后,需要衔接扩散动画,此时Row组件backgroundColor属性变更(#fff -> #ccc),插入动画过渡效果,scale{0,0}变化为scale{1,1}
 | 
				
			||||||
                    onFinish: () => {
 | 
					                    onFinish: () => {
 | 
				
			||||||
                      this.opacityNum = 1
 | 
					                      this.opacityNum=1
 | 
				
			||||||
                    }
 | 
					                    } },
 | 
				
			||||||
                  },
 | 
					 | 
				
			||||||
                    () => {
 | 
					                    () => {
 | 
				
			||||||
                      this.opacityNum = 0.2
 | 
					                      this.opacityNum=0.2
 | 
				
			||||||
                    })
 | 
					                    })
 | 
				
			||||||
                })
 | 
					                })
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
 | 
				
			|||||||
@ -134,7 +134,7 @@ class DbUtils {
 | 
				
			|||||||
        this.rdbStore.querySql(sql, []).then((res: relationalStore.ResultSet) => {
 | 
					        this.rdbStore.querySql(sql, []).then((res: relationalStore.ResultSet) => {
 | 
				
			||||||
          console.log(DbTag, "sql query", JSON.stringify(res))
 | 
					          console.log(DbTag, "sql query", JSON.stringify(res))
 | 
				
			||||||
          if (res.rowCount <= 0) {
 | 
					          if (res.rowCount <= 0) {
 | 
				
			||||||
            resolve(0 as T)
 | 
					            resolve(null)
 | 
				
			||||||
          } else {
 | 
					          } else {
 | 
				
			||||||
            res.goToNextRow()
 | 
					            res.goToNextRow()
 | 
				
			||||||
            resolve(res.getLong(0) as T)
 | 
					            resolve(res.getLong(0) as T)
 | 
				
			||||||
 | 
				
			|||||||
@ -7,7 +7,7 @@ import { BusinessError } from '@ohos.base'
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export default class FileUtils {
 | 
					export default class FileUtils {
 | 
				
			||||||
  public destFile?: string
 | 
					  public destFile: string
 | 
				
			||||||
  public filePathFdObj: Record<string, fs.File> = {}
 | 
					  public filePathFdObj: Record<string, fs.File> = {}
 | 
				
			||||||
  private context: common.UIAbilityContext
 | 
					  private context: common.UIAbilityContext
 | 
				
			||||||
  private absolutePath = '/mnt/hmdfs/100/account/device_view/local/files/duolun'
 | 
					  private absolutePath = '/mnt/hmdfs/100/account/device_view/local/files/duolun'
 | 
				
			||||||
@ -59,7 +59,6 @@ export default class FileUtils {
 | 
				
			|||||||
      return file.fd
 | 
					      return file.fd
 | 
				
			||||||
    } catch (e) {
 | 
					    } catch (e) {
 | 
				
			||||||
      this.handleError('editFile文件失败', e, filePath)
 | 
					      this.handleError('editFile文件失败', e, filePath)
 | 
				
			||||||
      return undefined
 | 
					 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -6,14 +6,14 @@ import { VoiceTag } from '../config';
 | 
				
			|||||||
type AVPlayerCallback = (status: string, val?: string) => void;
 | 
					type AVPlayerCallback = (status: string, val?: string) => void;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
export class voiceService {
 | 
					export class voiceService {
 | 
				
			||||||
  private avPlayer: media.AVPlayer | null = null;
 | 
					  private avPlayer: media.AVPlayer = null;
 | 
				
			||||||
  private fileSize: number = -1;
 | 
					  private fileSize: number = -1;
 | 
				
			||||||
  private fd: number = 0;
 | 
					  private fd: number = 0;
 | 
				
			||||||
  private playerName: string = '';
 | 
					  private playerName: string = '';
 | 
				
			||||||
  private type: number = 1;
 | 
					  private type: number = 1;
 | 
				
			||||||
  private endFlag: Boolean = false;
 | 
					  private endFlag: Boolean = false;
 | 
				
			||||||
  private mediaArray: Array<string> = [];
 | 
					  private mediaArray: Array<string> = [];
 | 
				
			||||||
  private callBack: AVPlayerCallback | null = null;
 | 
					  private callBack: AVPlayerCallback = null;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  constructor(callBack: AVPlayerCallback) {
 | 
					  constructor(callBack: AVPlayerCallback) {
 | 
				
			||||||
    // 创建avPlayer实例对象
 | 
					    // 创建avPlayer实例对象
 | 
				
			||||||
@ -30,14 +30,14 @@ export class voiceService {
 | 
				
			|||||||
    console.log(VoiceTag, ' avPlayerFdSrc setAVPlayerCallback begin')
 | 
					    console.log(VoiceTag, ' avPlayerFdSrc setAVPlayerCallback begin')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // error回调监听函数,当avPlayer在操作过程中出现错误时调用reset接口触发重置流程
 | 
					    // error回调监听函数,当avPlayer在操作过程中出现错误时调用reset接口触发重置流程
 | 
				
			||||||
    this.avPlayer!.on('error', (err: BusinessError) => {
 | 
					    this.avPlayer.on('error', (err: BusinessError) => {
 | 
				
			||||||
      console.error(VoiceTag, `Invoke avPlayer failed, code is ${err.code}, message is ${err.message}`);
 | 
					      console.error(VoiceTag, `Invoke avPlayer failed, code is ${err.code}, message is ${err.message}`);
 | 
				
			||||||
      this.avPlayer!.reset(); // 调用reset重置资源,触发idle状态
 | 
					      this.avPlayer.reset(); // 调用reset重置资源,触发idle状态
 | 
				
			||||||
    })
 | 
					    })
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // 状态机变化回调函数
 | 
					    // 状态机变化回调函数
 | 
				
			||||||
    this.avPlayer!.on('stateChange', async (state, reason) => {
 | 
					    this.avPlayer.on('stateChange', async (state, reason) => {
 | 
				
			||||||
      switch (state) {
 | 
					      switch (state) {
 | 
				
			||||||
        case 'idle': // 成功调用reset接口后触发该状态机上报
 | 
					        case 'idle': // 成功调用reset接口后触发该状态机上报
 | 
				
			||||||
          // callBack('idle');
 | 
					          // callBack('idle');
 | 
				
			||||||
@ -55,7 +55,7 @@ export class voiceService {
 | 
				
			|||||||
          break;
 | 
					          break;
 | 
				
			||||||
        case 'initialized': // avplayer 设置播放源后触发该状态上报
 | 
					        case 'initialized': // avplayer 设置播放源后触发该状态上报
 | 
				
			||||||
          console.info(VoiceTag, ' AVPlayerstate initialized called.');
 | 
					          console.info(VoiceTag, ' AVPlayerstate initialized called.');
 | 
				
			||||||
          this.avPlayer!.prepare().then(() => {
 | 
					          this.avPlayer.prepare().then(() => {
 | 
				
			||||||
            console.info(VoiceTag, ' AVPlayer prepare succeeded.');
 | 
					            console.info(VoiceTag, ' AVPlayer prepare succeeded.');
 | 
				
			||||||
          }, (err: BusinessError) => {
 | 
					          }, (err: BusinessError) => {
 | 
				
			||||||
            console.error(VoiceTag, ` Invoke prepare failed, code is ${err.code}, message is ${err.message}`);
 | 
					            console.error(VoiceTag, ` Invoke prepare failed, code is ${err.code}, message is ${err.message}`);
 | 
				
			||||||
@ -63,7 +63,7 @@ export class voiceService {
 | 
				
			|||||||
          callBack('initialized');
 | 
					          callBack('initialized');
 | 
				
			||||||
          break;
 | 
					          break;
 | 
				
			||||||
        case 'prepared': // prepare调用成功后上报该状态机
 | 
					        case 'prepared': // prepare调用成功后上报该状态机
 | 
				
			||||||
          this.avPlayer!.play();
 | 
					          this.avPlayer.play();
 | 
				
			||||||
          callBack('prepared');
 | 
					          callBack('prepared');
 | 
				
			||||||
          break;
 | 
					          break;
 | 
				
			||||||
        case 'playing': // play成功调用后触发该状态机上报
 | 
					        case 'playing': // play成功调用后触发该状态机上报
 | 
				
			||||||
@ -74,12 +74,12 @@ export class voiceService {
 | 
				
			|||||||
          break;
 | 
					          break;
 | 
				
			||||||
        case 'completed': // 播放结束后触发该状态机上报
 | 
					        case 'completed': // 播放结束后触发该状态机上报
 | 
				
			||||||
          console.info(VoiceTag, ' AVPlayer state completed called.');
 | 
					          console.info(VoiceTag, ' AVPlayer state completed called.');
 | 
				
			||||||
          this.avPlayer!.stop(); //调用播放结束接口
 | 
					          this.avPlayer.stop(); //调用播放结束接口
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          break;
 | 
					          break;
 | 
				
			||||||
        case 'stopped': // stop接口成功调用后触发该状态机上报
 | 
					        case 'stopped': // stop接口成功调用后触发该状态机上报
 | 
				
			||||||
          console.info(VoiceTag, ' AVPlayer state stopped called.');
 | 
					          console.info(VoiceTag, ' AVPlayer state stopped called.');
 | 
				
			||||||
          this.avPlayer!.reset(); // 调用reset接口初始化avplayer状态
 | 
					          this.avPlayer.reset(); // 调用reset接口初始化avplayer状态
 | 
				
			||||||
          // callBack('stopped');
 | 
					          // callBack('stopped');
 | 
				
			||||||
          break;
 | 
					          break;
 | 
				
			||||||
        case 'released':
 | 
					        case 'released':
 | 
				
			||||||
@ -97,18 +97,14 @@ export class voiceService {
 | 
				
			|||||||
  // 以下为使用资源管理接口获取打包在HAP内的媒体资源文件并通过fdSrc属性进行播放示例
 | 
					  // 以下为使用资源管理接口获取打包在HAP内的媒体资源文件并通过fdSrc属性进行播放示例
 | 
				
			||||||
  avPlayerFdSrc(name: string) {
 | 
					  avPlayerFdSrc(name: string) {
 | 
				
			||||||
    const context: common.UIAbilityContext = AppStorage.get('context')
 | 
					    const context: common.UIAbilityContext = AppStorage.get('context')
 | 
				
			||||||
    if (!context) {
 | 
					 | 
				
			||||||
      console.log(VoiceTag, ' context is null');
 | 
					 | 
				
			||||||
      return
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    context.resourceManager.getRawFd(name, async (error, value) => {
 | 
					    context.resourceManager.getRawFd(name, async (error, value) => {
 | 
				
			||||||
      if (error != null) {
 | 
					      if (error != null) {
 | 
				
			||||||
        console.log(VoiceTag, ` callback getRawFd failed error code: ${error.code}, message: ${error.message}.`);
 | 
					        console.log(VoiceTag, ` callback getRawFd failed error code: ${error.code}, message: ${error.message}.`);
 | 
				
			||||||
      } else {
 | 
					      } else {
 | 
				
			||||||
        console.log(VoiceTag, this.avPlayer)
 | 
					        console.log(VoiceTag, this.avPlayer)
 | 
				
			||||||
        if (this.avPlayer) {
 | 
					        if (this.avPlayer) {
 | 
				
			||||||
          await this.avPlayer!.reset()
 | 
					          await this.avPlayer.reset()
 | 
				
			||||||
          this.avPlayer!.fdSrc = value;
 | 
					          this.avPlayer.fdSrc = value;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        // 为fdSrc赋值触发initialized状态机上报
 | 
					        // 为fdSrc赋值触发initialized状态机上报
 | 
				
			||||||
@ -120,15 +116,15 @@ export class voiceService {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  // 以下为通过url设置网络地址来实现播放直播码流的
 | 
					  // 以下为通过url设置网络地址来实现播放直播码流的
 | 
				
			||||||
  avPlayerLive(url: string) {
 | 
					  avPlayerLive(url: string) {
 | 
				
			||||||
    this.avPlayer!.url = url
 | 
					    this.avPlayer.url = url
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  releasePlayer() {
 | 
					  releasePlayer() {
 | 
				
			||||||
    this.avPlayer && this.avPlayer!.release();
 | 
					    this.avPlayer && this.avPlayer.release();
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  avPlayerStop() {
 | 
					  avPlayerStop() {
 | 
				
			||||||
    this.avPlayer && this.avPlayer!.stop((err: BusinessError) => {
 | 
					    this.avPlayer && this.avPlayer.stop((err: BusinessError) => {
 | 
				
			||||||
      if (err == null) {
 | 
					      if (err == null) {
 | 
				
			||||||
        this.endFlag = true
 | 
					        this.endFlag = true
 | 
				
			||||||
        console.info(VoiceTag, 'stop success');
 | 
					        console.info(VoiceTag, 'stop success');
 | 
				
			||||||
 | 
				
			|||||||
@ -3,26 +3,26 @@ import dayTs from '../Date';
 | 
				
			|||||||
import FileUtils from '../FileUtils';
 | 
					import FileUtils from '../FileUtils';
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class drivingDataStorage {
 | 
					class drivingDataStorage {
 | 
				
			||||||
  public folderPath?: string
 | 
					  public folderPath: string
 | 
				
			||||||
  public time?: string
 | 
					  public time: string
 | 
				
			||||||
  public totalDistance?: number
 | 
					  public totalDistance: number
 | 
				
			||||||
  public totalTime?: number
 | 
					  public totalTime: number
 | 
				
			||||||
  public date?: string
 | 
					  public date: string
 | 
				
			||||||
  public fd?: number
 | 
					  public fd: number
 | 
				
			||||||
  private fileUtil?: FileUtils
 | 
					  private fileUtil: FileUtils
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  constructor() {
 | 
					  constructor() {
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //   初始化文件夹
 | 
					  //   初始化文件夹
 | 
				
			||||||
  async initializeTheDrivingDataFolder() {
 | 
					  async initializeTheDrivingDataFolder() {
 | 
				
			||||||
    const folderPath = await this.fileUtil!.initFolder(`/车辆行驶距离统计`);
 | 
					    const folderPath = await this.fileUtil.initFolder(`/车辆行驶距离统计`);
 | 
				
			||||||
    this.time = dayTs().format("HH:mm:ss")
 | 
					    this.time = dayTs().format("HH:mm:ss")
 | 
				
			||||||
    this.date = dayTs().format("YYYY_MM_DD")
 | 
					    this.date = dayTs().format("YYYY_MM_DD")
 | 
				
			||||||
    this.folderPath = folderPath;
 | 
					    this.folderPath = folderPath;
 | 
				
			||||||
    this.totalDistance = 0;
 | 
					    this.totalDistance = 0;
 | 
				
			||||||
    this.totalTime = 0;
 | 
					    this.totalTime = 0;
 | 
				
			||||||
    this.fd = await this.fileUtil!.editFile(
 | 
					    this.fd = await this.fileUtil.editFile(
 | 
				
			||||||
      `${folderPath}/${this.date}.txt`,
 | 
					      `${folderPath}/${this.date}.txt`,
 | 
				
			||||||
      `程序启动时间:${this.time} 累计行驶距离:${this.totalDistance}m 累计运行时常:${this.totalTime}min`)
 | 
					      `程序启动时间:${this.time} 累计行驶距离:${this.totalDistance}m 累计运行时常:${this.totalTime}min`)
 | 
				
			||||||
    return folderPath
 | 
					    return folderPath
 | 
				
			||||||
@ -30,13 +30,12 @@ class drivingDataStorage {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  // 设置行驶过程数据
 | 
					  // 设置行驶过程数据
 | 
				
			||||||
  async setDrivingProcessData(str: number) {
 | 
					  async setDrivingProcessData(str: number) {
 | 
				
			||||||
    const content = await this.fileUtil!.readFile(`${this.folderPath}/${this.date}.txt`) || '';
 | 
					    const content = await this.fileUtil.readFile(`${this.folderPath}/${this.date}.txt`) || '';
 | 
				
			||||||
    const contentArr = content.split('\n').filter(item => item)
 | 
					    const contentArr = content.split('\n').filter(item => item)
 | 
				
			||||||
    this.totalDistance = (this.totalDistance || 0) + (str * 1 > 200 ? 200 : str * 1);
 | 
					    this.totalDistance += (str * 1 > 200 ? 200 : str * 1)
 | 
				
			||||||
    this.totalTime = (this.totalTime || 0) + 1;
 | 
					    this.totalTime += 1;
 | 
				
			||||||
    contentArr[contentArr.length - 1] =
 | 
					    contentArr[contentArr.length - 1] =
 | 
				
			||||||
      `程序启动时间:${this.time} 累计行驶距离:${(this.totalDistance ||
 | 
					      `程序启动时间:${this.time} 累计行驶距离:${(this.totalDistance).toFixed(2)}m 累计运行时常:${Math.ceil(this.totalTime /
 | 
				
			||||||
        0).toFixed(2)}m 累计运行时常:${Math.ceil((this.totalTime || 0) /
 | 
					 | 
				
			||||||
        60)}min` + '\n'
 | 
					        60)}min` + '\n'
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -47,7 +46,7 @@ class drivingDataStorage {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  //   关闭文件读写
 | 
					  //   关闭文件读写
 | 
				
			||||||
  public close() {
 | 
					  public close() {
 | 
				
			||||||
    this.fileUtil!.closeFile(`${this.folderPath}/${this.date}.txt`)
 | 
					    this.fileUtil.closeFile(`${this.folderPath}/${this.date}.txt`)
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -11,10 +11,7 @@ import FileUtils from '../FileUtils';
 | 
				
			|||||||
// 建表操作
 | 
					// 建表操作
 | 
				
			||||||
export async function InitTable() {
 | 
					export async function InitTable() {
 | 
				
			||||||
  Object.keys(ParameterPlatform).forEach(async (item) => {
 | 
					  Object.keys(ParameterPlatform).forEach(async (item) => {
 | 
				
			||||||
    const platformItem = ParameterPlatform.get(item);
 | 
					    await DB.executeSql(ParameterPlatform.get(item).sqlCreate);
 | 
				
			||||||
    if (platformItem) {
 | 
					 | 
				
			||||||
      await DB.executeSql(platformItem.sqlCreate);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -59,16 +56,12 @@ export function UpdateTableByArray(tableName: string, arr: Array<User>): Promise
 | 
				
			|||||||
//依据表名同步获取数据
 | 
					//依据表名同步获取数据
 | 
				
			||||||
export async function GetSyncData<T>(tableName: string): Promise<T[]> {
 | 
					export async function GetSyncData<T>(tableName: string): Promise<T[]> {
 | 
				
			||||||
  return new Promise((resolve, reject) => {
 | 
					  return new Promise((resolve, reject) => {
 | 
				
			||||||
    const platform = ParameterPlatform.get(tableName);
 | 
					    const columns: ColumnInfo[] = ParameterPlatform.get(tableName).columns.map((res: string) => {
 | 
				
			||||||
    if (!platform || !platform.columns) {
 | 
					 | 
				
			||||||
      throw new Error(`Invalid tableName or columns not found for table: ${tableName}`);
 | 
					 | 
				
			||||||
    }
 | 
					 | 
				
			||||||
    const columns: ColumnInfo[] = platform.columns.map((res: string) => {
 | 
					 | 
				
			||||||
      return {
 | 
					      return {
 | 
				
			||||||
        name: res,
 | 
					        name: res,
 | 
				
			||||||
        columnName: res,
 | 
					        columnName: res,
 | 
				
			||||||
        type: ColumnType.STRING
 | 
					        type: ColumnType.STRING
 | 
				
			||||||
      } as ColumnInfo;
 | 
					      } as ColumnInfo
 | 
				
			||||||
    });
 | 
					    });
 | 
				
			||||||
    DB.queryListBySql<T>(`select * from ${tableName}`, columns).then((res: T[]) => {
 | 
					    DB.queryListBySql<T>(`select * from ${tableName}`, columns).then((res: T[]) => {
 | 
				
			||||||
      resolve(res);
 | 
					      resolve(res);
 | 
				
			||||||
@ -94,7 +87,7 @@ export async function DeleteSyncTable(tableName: string): Promise<boolean> {
 | 
				
			|||||||
// 初始化中心表
 | 
					// 初始化中心表
 | 
				
			||||||
export async function InitializeTheCentralTable(params: InitializeTheCentralTableType): Promise<boolean> {
 | 
					export async function InitializeTheCentralTable(params: InitializeTheCentralTableType): Promise<boolean> {
 | 
				
			||||||
  return new Promise(async (resolve, reject) => {
 | 
					  return new Promise(async (resolve, reject) => {
 | 
				
			||||||
    const fileUtil = new FileUtils(params.context!);
 | 
					    const fileUtil = new FileUtils(params.context)
 | 
				
			||||||
    let flag = false
 | 
					    let flag = false
 | 
				
			||||||
    // 单机模式
 | 
					    // 单机模式
 | 
				
			||||||
    if (params.singlePlay) {
 | 
					    if (params.singlePlay) {
 | 
				
			||||||
@ -126,34 +119,32 @@ export async function InitializeTheCentralTable(params: InitializeTheCentralTabl
 | 
				
			|||||||
      host: params.host
 | 
					      host: params.host
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    const res: ResponseDataType = await initialization(str)
 | 
					    const res: ResponseDataType = await initialization(str)
 | 
				
			||||||
    if (!res || !res.initializationRsp || res.initializationRsp.head.resultCode === "1") {
 | 
					    if (!res || res.initializationRsp.head.resultCode == "1") {
 | 
				
			||||||
      resolve(false);
 | 
					      resolve(false)
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    if (res.initializationRsp && res.initializationRsp.body) {
 | 
					    for (const key of Object.keys(res.initializationRsp.body)) {
 | 
				
			||||||
      for (const key of Object.keys(res.initializationRsp.body)) {
 | 
					      if (CenterMap[key]) {
 | 
				
			||||||
        if (CenterMap[key]) {
 | 
					        continue
 | 
				
			||||||
          continue
 | 
					      }
 | 
				
			||||||
        }
 | 
					      // TODO 后续替换类型
 | 
				
			||||||
        // TODO 后续替换类型
 | 
					      let arrList: ESObject[] = []
 | 
				
			||||||
        let arrList: ESObject[] = []
 | 
					      if (res.initializationRsp.body[key] instanceof Array) {
 | 
				
			||||||
        if (res.initializationRsp.body[key] instanceof Array) {
 | 
					        arrList = res.initializationRsp.body[key]
 | 
				
			||||||
          arrList = res.initializationRsp.body[key]
 | 
					      } else {
 | 
				
			||||||
        } else {
 | 
					        arrList.push(res.initializationRsp.body[key])
 | 
				
			||||||
          arrList.push(res.initializationRsp.body[key])
 | 
					      }
 | 
				
			||||||
        }
 | 
					      const folderPath = await fileUtil.initFolder(`/config/tableList`);
 | 
				
			||||||
        const folderPath = await fileUtil.initFolder(`/config/tableList`);
 | 
					      fileUtil.addFile(`${folderPath}/${RemappingTableName.get(key)}.txt`, JSON.stringify(arrList))
 | 
				
			||||||
        fileUtil.addFile(`${folderPath}/${RemappingTableName.get(key)}.txt`, JSON.stringify(arrList))
 | 
					      try {
 | 
				
			||||||
        try {
 | 
					        const result = await SqlInsertTable(RemappingTableName.get(key), arrList)
 | 
				
			||||||
          const result = await SqlInsertTable(RemappingTableName.get(key)!, arrList);
 | 
					        if (!result) {
 | 
				
			||||||
          if (!result) {
 | 
					          Prompt.showToast({
 | 
				
			||||||
            Prompt.showToast({
 | 
					            message: '初始化数据库失败'
 | 
				
			||||||
              message: '初始化数据库失败'
 | 
					          })
 | 
				
			||||||
            })
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
          resolve(result)
 | 
					 | 
				
			||||||
        } catch (e) {
 | 
					 | 
				
			||||||
          reject(e)
 | 
					 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
 | 
					        resolve(result)
 | 
				
			||||||
 | 
					      } catch (e) {
 | 
				
			||||||
 | 
					        reject(e)
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  })
 | 
					  })
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user