fix: 优化代码格式,统一空格和分号使用

This commit is contained in:
wangzhongjie 2025-04-01 11:22:17 +08:00
parent fca24538d0
commit 6984855346
3 changed files with 91 additions and 94 deletions

View File

@ -2,7 +2,7 @@ import common from '@ohos.app.ability.common';
// ------------------------------ // ------------------------------
// 基础共用类型 // 基础共用类型
// ------------------------------ // ------------------------------
import { MA_SYSTEMPARMType } from './Table' import { MA_SYSTEMPARMType } from './Table';
/** 基础考试字段 */ /** 基础考试字段 */
interface BaseExamFields { interface BaseExamFields {
@ -214,9 +214,9 @@ export interface Plc {
extend: object extend: object
//轨迹回放需要 //轨迹回放需要
method?: string method?: string
itemno: string itemno?: string
type: 1 | 2 type?: 1 | 2
serial: 1 | 2 serial?: 1 | 2
} }
interface Qfsj { interface Qfsj {
@ -723,6 +723,7 @@ interface UdpKf{
kfxh: string kfxh: string
directives: string directives: string
} }
export interface JudgeUdpKf { export interface JudgeUdpKf {
data: UdpKf data: UdpKf
} }

View File

@ -8,7 +8,6 @@ interface StuInfo {
idCard: string idCard: string
} }
const LOGTAG = 'LOGTAG'
export default class FileLog { export default class FileLog {
public folderPath: string public folderPath: string
@ -27,48 +26,46 @@ export default class FileLog {
// 过程文件数据 // 过程文件数据
public setExamProgressData = async (str: Object) => { public setExamProgressData = async (str: Object) => {
this.progressDataFd = this.progressDataFd =
await this.fileUtil.editFile(`${this.folderPath}/exam_progress_data.txt`, JSON.stringify(str), await this.fileUtil.editFile(`${this.folderPath}/exam_progress_data.txt`, JSON.stringify(str));
this.progressDataFd);
} }
// 无锡所接口数据 // 无锡所接口数据
public setExamJudgeWuxiData = async (str: string) => { public setExamJudgeWuxiData = async (str: string) => {
this.examJudgeWuxiDataFd = this.examJudgeWuxiDataFd =
await this.fileUtil.editFile(`${this.folderPath}/wuxi_exam_data.txt`, str, this.examJudgeWuxiDataFd); await this.fileUtil.editFile(`${this.folderPath}/wuxi_exam_data.txt`, str);
} }
// 无锡所过程数据 // 无锡所过程数据
public setExamJudgeWuxiProgressData = async (str: string) => { public setExamJudgeWuxiProgressData = async (str: string) => {
this.examJudgeWuxiProgressDataFd = this.examJudgeWuxiProgressDataFd =
await this.fileUtil.editFile(`${this.folderPath}/wuxi_progress_data.txt`, str, this.examJudgeWuxiProgressDataFd); await this.fileUtil.editFile(`${this.folderPath}/wuxi_progress_data.txt`, str);
} }
// plc文件数据 // plc文件数据
public setPlcProgressData = async (str: Object) => { public setPlcProgressData = async (str: Object) => {
this.plcDataFd = this.plcDataFd =
await this.fileUtil.editFile(`${this.folderPath}/plc_data.txt`, JSON.stringify(str), this.plcDataFd); await this.fileUtil.editFile(`${this.folderPath}/plc_data.txt`, JSON.stringify(str));
} }
// 过程评判json数据 // 过程评判json数据
public setExamJudgeData = async (str: string) => { public setExamJudgeData = async (str: string) => {
this.examJudgeDataFd = this.examJudgeDataFd =
await this.fileUtil.editFile(`${this.folderPath}/judge_exam_data.txt`, str, this.examJudgeDataFd); await this.fileUtil.editFile(`${this.folderPath}/judge_exam_data.txt`, str);
} }
// 过程评判回调数据 // 过程评判回调数据
public setExamJudgeCallbackData = async (str: string) => { public setExamJudgeCallbackData = async (str: string) => {
this.examJudgeCallbackDataFd = this.examJudgeCallbackDataFd =
await this.fileUtil.editFile(`${this.folderPath}/judge_progress_callback_data.txt`, str, await this.fileUtil.editFile(`${this.folderPath}/judge_progress_callback_data.txt`, str);
this.examJudgeCallbackDataFd);
} }
// 过程评判日志调数据 // 过程评判日志调数据
public setExamJudgeLogData = async (str: string) => { public setExamJudgeLogData = async (str: string) => {
this.examJudgeLogDataFd = this.examJudgeLogDataFd =
await this.fileUtil.editFile(`${this.folderPath}/judge_log_data.txt`, str, this.examJudgeLogDataFd); await this.fileUtil.editFile(`${this.folderPath}/judge_log_data.txt`, str);
} }
// 设置四合一画面数据 // 设置四合一画面数据
public setFourAndOneLogData = async (str: string) => { public setFourAndOneLogData = async (str: string) => {
this.fourAndOneLogDataFd = this.fourAndOneLogDataFd =
await this.fileUtil.editFile(`${this.folderPath}/four_one_log_data.txt`, str, this.fourAndOneLogDataFd); await this.fileUtil.editFile(`${this.folderPath}/four_one_log_data.txt`, str);
} }
public setFourAndOneLogDataBytes = async (str: string) => { public setFourAndOneLogDataBytes = async (str: string) => {
this.fourAndOneLogDataBytesFd = this.fourAndOneLogDataBytesFd =
await this.fileUtil.editFile(`${this.folderPath}/four_one_log_byte_data.txt`, str, this.fourAndOneLogDataBytesFd); await this.fileUtil.editFile(`${this.folderPath}/four_one_log_byte_data.txt`, str);
} }
// 无锡所轨迹数据 // 无锡所轨迹数据
public setExamLineData = async (plcStr: string) => { public setExamLineData = async (plcStr: string) => {
@ -101,13 +98,12 @@ export default class FileLog {
/*结束符*/ time, /*结束符*/ time,
]; ];
this.examLineDataFd = this.examLineDataFd =
await this.fileUtil.editFile(`${this.folderPath}/exam_wuxi_data.txt`, JSON.stringify(lineData), await this.fileUtil.editFile(`${this.folderPath}/exam_wuxi_data.txt`, JSON.stringify(lineData));
this.examLineDataFd);
}; };
private stuInfo: StuInfo // private stuInfo: StuInfo
// 设置文件夹 // 设置文件夹
public initFileLogo = async (stuInfo: StuInfo) => { public initFileLogo = async (stuInfo: StuInfo) => {
this.stuInfo = stuInfo; // this.stuInfo = stuInfo;
const time = GetCurrentTime() const time = GetCurrentTime()
const date = time.split(' ')[0].split('-').join('_') const date = time.split(' ')[0].split('-').join('_')
const hourTime = time.split(' ')[1].split(':').join('_') const hourTime = time.split(' ')[1].split(':').join('_')

View File

@ -1,10 +1,10 @@
import { testMarkRules, testRealExam } from '../dataTest/index'; import { testRealExam } from '../dataTest/index';
import { GetCurrentTime, NumberToByteArray } from '../../../utils/Common'; import { NumberToByteArray } from '../../../utils/Common';
import systemTime from '@ohos.systemDateTime'; import systemTime from '@ohos.systemDateTime';
import { Array2Byte } from './Common'; import { Array2Byte } from './Common';
import { CarInfoType } from '../../../model'; import { CarInfoType } from '../../../model';
import { Gps, Lane,Plc,Vision,Radar, Sensor,DefaultJudgeConfigObj, JudgeLane} from '../../../model/Judge' import { DefaultJudgeConfigObj, Gps, JudgeLane, Plc, Radar, Sensor, Vision } from '../../../model/Judge';
interface Extend {} interface Extend {}
@ -147,7 +147,7 @@ export function getKmProjectVoice(
case 41100: case 41100:
return type === 1 return type === 1
? (param512Str[2] == 3 ? 411001 : undefined) ? (param512Str[2] == 3 ? 411001 : undefined)
: (param544Str.includes(xmxh) ? undefined : (param544Str.length === 0 ? undefined : 411004)) : (param544Str.includes(Number(xmxh)) ? undefined : (param544Str.length === 0 ? undefined : 411004))
//通过车站 //通过车站
case 41200: case 41200: