| | |
| | | "url": "https://cool-js.com" |
| | | }, |
| | | "author": "COOL", |
| | | "license": "MIT" |
| | | "license": "MIT", |
| | | "packageManager": "pnpm@11.12.0+sha512.820a6fbd0d9f04c226638002aead1e45340a9139dd5dc077c1d83ef44aa2481c8eb6637b4c9aa696a3c7e35ba818e49cf27213e5f2b91138d09b7a3e26e898ba" |
| | | } |
| New file |
| | |
| | | allowBuilds: |
| | | esbuild: true |
| | | javascript-obfuscator: true |
| | | msgpackr-extract: true |
| New file |
| | |
| | | import { CoolController, BaseController } from '@cool-midway/core'; |
| | | import { PushDevicealarmEntity } from '../../entity/devicealarm'; |
| | | import { PushDevicealarmService } from '../../service/devicealarm'; |
| | | import { BaseSysDepartmentEntity } from '../../../base/entity/sys/department'; |
| | | |
| | | /** |
| | | * 设备告警消息 |
| | | */ |
| | | @CoolController({ |
| | | api: ['add', 'delete', 'update', 'info', 'list', 'page'], |
| | | entity: PushDevicealarmEntity, |
| | | service: PushDevicealarmService, |
| | | pageQueryOp: { |
| | | keyWordLikeFields: ['b.iotName', 'a.devSerial', 'c.name'], |
| | | select: [ |
| | | 'a.*', |
| | | 'c.name as departmentName', |
| | | 'b.iotName as deviceName' |
| | | ], |
| | | join: [ |
| | | { |
| | | entity: 't_basicdata_iot' as any, |
| | | alias: 'b', |
| | | condition: 'a.devSerial = b.iotCode', |
| | | type: 'leftJoin' |
| | | }, |
| | | { |
| | | entity: BaseSysDepartmentEntity, |
| | | alias: 'c', |
| | | condition: 'b.departmentId = c.id', |
| | | type: 'leftJoin' |
| | | } |
| | | ], |
| | | fieldEq: [ |
| | | { column: 'a.devSerial', requestParam: 'devSerial' }, |
| | | { column: 'a.alarmType', requestParam: 'alarmType' }, |
| | | { column: 'c.name', requestParam: 'departmentName' } |
| | | ], |
| | | fieldLike: [ |
| | | { column: 'c.name', requestParam: 'departmentName' } |
| | | ] |
| | | } |
| | | }) |
| | | export class AdminPushDevicealarmController extends BaseController {} |
| New file |
| | |
| | | import { BaseEntity } from '../../base/entity/base'; |
| | | import { Column, Entity, Index } from 'typeorm'; |
| | | |
| | | /** |
| | | * 设备告警消息 |
| | | */ |
| | | @Entity('t_push_device_alarm') |
| | | export class PushDevicealarmEntity extends BaseEntity { |
| | | @Index() |
| | | @Column({ comment: '设备序列号' }) |
| | | devSerial: string; |
| | | |
| | | @Column({ comment: '通道号' }) |
| | | channelNo: string; |
| | | |
| | | @Column({ comment: '报警消息ID' }) |
| | | alarmId: string; |
| | | |
| | | @Column({ comment: '报警时间戳' }) |
| | | alarmTime: string; |
| | | |
| | | @Column({ comment: '报警类型' }) |
| | | alarmType: string; |
| | | |
| | | @Column({ comment: '通道名称' }) |
| | | channelName: string; |
| | | |
| | | @Column({ comment: '通道类型', dict: ['视频通道', 'IO通道'], default: 0 }) |
| | | channelType: number; |
| | | |
| | | @Column({ comment: '加密密码', nullable: true }) |
| | | checksum: string; |
| | | |
| | | @Column({ comment: '图片加密类型', dict: ['不加密', '用户加密', '平台加密'], default: 0 }) |
| | | crypt: number; |
| | | |
| | | @Column({ comment: '自定义信息', nullable: true }) |
| | | customInfo: string; |
| | | |
| | | @Column({ comment: '自定义协议类型', nullable: true }) |
| | | customType: string; |
| | | |
| | | @Column({ comment: '告警描述', nullable: true }) |
| | | describe: string; |
| | | |
| | | @Column({ comment: '位置信息', nullable: true }) |
| | | location: string; |
| | | |
| | | @Column({ comment: '关联ID', nullable: true }) |
| | | relationId: string; |
| | | |
| | | @Column({ comment: '报警状态', dict: ['开始', '停止'], default: 0 }) |
| | | status: number; |
| | | |
| | | @Column({ comment: '告警图片列表', type: 'json', nullable: true }) |
| | | pictureList: Array<{ url: string; id: string }>; |
| | | } |
| New file |
| | |
| | | import { Provide } from '@midwayjs/core'; |
| | | import { BaseService } from '@cool-midway/core'; |
| | | import { InjectEntityModel } from '@midwayjs/typeorm'; |
| | | import { Repository } from 'typeorm'; |
| | | import { PushDevicealarmEntity } from '../entity/devicealarm'; |
| | | |
| | | /** |
| | | * 设备告警消息服务 |
| | | */ |
| | | @Provide() |
| | | export class PushDevicealarmService extends BaseService { |
| | | @InjectEntityModel(PushDevicealarmEntity) |
| | | pushDevicealarmEntity: Repository<PushDevicealarmEntity>; |
| | | |
| | | } |
| | |
| | | import { PushCameraGpsEntity } from '../entity/cameragps'; |
| | | import { PushVehicleGpsEntity } from '../entity/vehiclegps'; |
| | | import { PushDeviceOnoffEntity } from '../entity/deviceonoff'; |
| | | import { PushDevicealarmEntity } from '../entity/devicealarm'; |
| | | import { CachingFactory, MidwayCache } from '@midwayjs/cache-manager'; |
| | | |
| | | /** |
| | |
| | | @InjectEntityModel(PushDeviceOnoffEntity) |
| | | pushDeviceOnoffEntity: Repository<PushDeviceOnoffEntity>; |
| | | |
| | | @InjectEntityModel(PushDevicealarmEntity) |
| | | pushDevicealarmEntity: Repository<PushDevicealarmEntity>; |
| | | |
| | | @InjectEntityModel(PushAuditlogEntity) |
| | | pushAuditlogEntity: Repository<PushAuditlogEntity>; |
| | |
| | | } |
| | | |
| | | // 萤石告警 |
| | | /* |
| | | case 'ys.alarm': { |
| | | await this.pushAlarmRepo.save({ |
| | | messageId, |
| | | raw: JSON.stringify(body), |
| | | createTime: new Date(), |
| | | await this.pushDevicealarmEntity.save({ |
| | | devSerial: body.devSerial, |
| | | channelNo: body.channelNo || String(body.channel), |
| | | alarmId: body.alarmId, |
| | | alarmTime: body.alarmTime, |
| | | alarmType: body.alarmType, |
| | | channelName: body.channelName, |
| | | channelType: body.channelType ? Number(body.channelType) : 1, |
| | | checksum: body.checksum, |
| | | crypt: body.crypt ? Number(body.crypt) : 0, |
| | | customInfo: body.customInfo, |
| | | customType: body.customType, |
| | | describe: body.describe, |
| | | location: body.location, |
| | | relationId: body.relationId, |
| | | status: body.status ? Number(body.status) : 1, |
| | | pictureList: body.pictureList || [] |
| | | }); |
| | | break; |
| | | } |
| | | */ |
| | | |
| | | // 海康 ISAPI |
| | | //case 'ys.open.isapi': { |