master
2022-03-16 26d7c4cb292025dad56635dc02bf32a348ee62ef
befor merge
6个文件已修改
2个文件已添加
1150 ■■■■■ 已修改文件
src/app/modules/base/controller/admin/open.ts 106 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/app/modules/base/entity/app/commentity.ts 889 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/app/modules/base/schedule/create_obj_entity.ts 71 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/app/modules/base/service/dataapi/dataapi.ts 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/app/modules/device/controller/app/device.ts 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/app/modules/device/entity/device.ts 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/app/modules/deviceGroup/controller/admin/deviceGroup.ts 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/app/modules/deviceGroup/controller/app/deviceGroup.ts 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/app/modules/base/controller/admin/open.ts
@@ -10,15 +10,18 @@
import { Context } from 'egg';
import { CoolController, BaseController } from '@cool-midway/core';
import { LoginDTO } from '../../dto/login';
import * as fs from 'fs';
import { BaseSysLoginService } from '../../service/sys/login';
import { BaseSysParamService } from '../../service/sys/param';
import { DataService } from '../../service/dataapi/dataapi';
import { CommEntity } from '../../entity/app/commentity';
/**
 * 不需要登录的后台接口
 */
@Provide()
@CoolController()
@CoolController({api: ['add', 'delete', 'update', 'info', 'list', 'page'],
entity: CommEntity})
export class BaseOpenController extends BaseController {
  @Inject()
  baseSysLoginService: BaseSysLoginService;
@@ -27,7 +30,7 @@
  baseSysParamService: BaseSysParamService;
  @Inject()
  dataService: DataService;
  dataService: DataService;
  @Inject()
  ctx: Context;
@@ -85,19 +88,98 @@
  /**
   * 获得数据
   */
   @Get('/getdata', { summary: '数据接口' })
   async getData(@Query(ALL) params: any) {
     console.log('-------------------------------------------------------');
     console.log(params);
     return this.ok(await this.dataService.getData(params));
   }
  @Get('/getdata', { summary: '数据接口' })
  async getData(@Query(ALL) params: any) {
    ``
    console.log('-------------------------------------------------------');
    console.log(params);
    return this.ok(await this.dataService.getData(params));
  }
  /**
   * 获得数据
   */
   @Post('/postdata', { summary: '数据接口' })
   async postData(@Query(ALL) params: any) {
     return this.ok(await this.dataService.getData(params));
   }
  @Post('/postdata', { summary: '数据接口' })
  async postData(@Query(ALL) params: any) {
    return this.ok(await this.dataService.getData(params));
  }
  @Get('/createEntity', {})
  async createEntity() {
    console.log('生成综合实体类任务开始执行');
    const startTime = Date.now();
    const columns = await this.dataService.getDataByNative({ "bid": "getColumns", "pageindex": "1", "pagesize": "300" })  //bid_obj_[0], query?.pageindex || null , query?.pagesize || null, query
    // console.log(columns)
    const columnstr = [];
    columnstr.push(`import { EntityModel } from '@midwayjs/orm';
    import { BaseEntity } from '@cool-midway/core';
    import { Column, Double } from 'typeorm';
    /**
     * 综合实体类
     */
    @EntityModel('t_sys_comm_column')
    export class CommEntity extends BaseEntity { \n`)
    columns.forEach(element => {  //{ column_name: 'avg_task_time', data_type: 'int' },
      //select table_name,column_name,data_type,column_type,is_nullable,column_default,ordinal_position,column_key,column_comment from view_columninfo order by table_name,column_name;
      columnstr.push(`@Column({ comment:'${element.column_comment}', type:'${element.data_type}', default:'${element.column_default}'})\n`)
      //varchar  int   text  double  datetime  bigint   enum  mediumtext  longtext  tinyint  decimal
      let fieldType = 'string';
      switch (element.data_type) {
        case 'varchar':
          fieldType = 'string'
          break;
        case 'text':
          fieldType = 'string'
          break;
        case 'int':
          fieldType = 'number'
          break;
        case 'bigint':
          fieldType = 'number'
          break;
        case 'tinyint':
          fieldType = 'number'
          break;
        case 'datetime':
          fieldType = 'Date'
          break;
        case 'double':
          fieldType = 'Double'
          break;
        case 'decimal':
          fieldType = 'Double'
          break;
        default:
          break;
      }
      // let fieldType = element.data_type=='varchar' ? 'string' : element.data_type=='int' ? 'number' : element.data_type=='bigint' ? 'number' : element.data_type=='tinyint' ? 'number'
      columnstr.push(`${element.tbname}_${element.column_name}: ${fieldType};\n`)
      columnstr.push(`\n`)
    });
    columnstr.push(`}`)
    if (fs.existsSync('../entity/app/commentity.ts')) {
      console.log(' file is exists')
    } else {
      console.log(' file is not exists')
      // API
      fs.writeFile('./src/app/modules/base/entity/app/commentity.ts',
        columnstr.join(''), (error) => {
          // 创建失败
          if (error) {
            console.log(`创建失败:${error}`)
          }
          // 创建成功
          console.log(`创建成功!`)
        })
    }
    //读取文件内容,并转化为Json对象
    // let userBugsJson = JSON.parse(fs.readFileSync("app/public/static/Data.json", "utf8"));
    // //获取Json里key为data的数据
    // const data = userBugsJson['data'];
    // return data;
    console.log(`生成综合实体类任务结束,耗时:${Date.now() - startTime}ms`);
  }
}
src/app/modules/base/entity/app/commentity.ts
New file
@@ -0,0 +1,889 @@
import { EntityModel } from '@midwayjs/orm';
import { BaseEntity } from '@cool-midway/core';
import { Column, Double } from 'typeorm';
/**
 * 综合实体类
 */
@EntityModel('t_sys_comm_column')
export class CommEntity extends BaseEntity {
  @Column({ comment: '附件名称', type: 'varchar', default: 'null' })
  deviceattachment_attach_name: string;
  @Column({ comment: '顺序编号', type: 'varchar', default: 'null' })
  deviceattachment_attach_sort: string;
  @Column({ comment: '附件类型, 1-使用说明  2-安装位置照片 ...', type: 'varchar', default: 'null' })
  deviceattachment_attach_type: string;
  @Column({ comment: '附件访问路径', type: 'varchar', default: 'null' })
  deviceattachment_attach_url: string;
  @Column({ comment: '附件提供人', type: 'varchar', default: 'null' })
  deviceattachment_configurator: string;
  @Column({ comment: '设备物理ID', type: 'varchar', default: 'null' })
  deviceattachment_device_id: string;
  @Column({ comment: '逻辑ID', type: 'varchar', default: 'null' })
  deviceattachment_logic_id: string;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  deviceattachment_remark: string;
  @Column({ comment: '状态,1-启用  0-停用', type: 'int', default: '1' })
  deviceattachment_status: number;
  @Column({ comment: '分组设置人员', type: 'varchar', default: 'null' })
  devicegroup_configurator: string;
  @Column({ comment: '逻辑ID', type: 'varchar', default: 'null' })
  devicegroup_logic_id: string;
  @Column({ comment: '备注', type: 'varchar', default: '无' })
  devicegroup_remark: string;
  @Column({ comment: '状态', type: 'tinyint', default: '1' })
  devicegroup_status: number;
  @Column({ comment: '设备物理ID', type: 'varchar', default: 'null' })
  deviceopreraterecord_device_id: string;
  @Column({ comment: '设备逻辑ID', type: 'varchar', default: 'null' })
  deviceopreraterecord_logic_id: string;
  @Column({ comment: '运维内容', type: 'varchar', default: 'null' })
  deviceopreraterecord_operate_content: string;
  @Column({ comment: '运维类型  1-巡检  2-维修', type: 'varchar', default: 'null' })
  deviceopreraterecord_operate_type: string;
  @Column({ comment: '运维人员', type: 'varchar', default: 'null' })
  deviceopreraterecord_operator: string;
  @Column({ comment: '附件访问路径', type: 'varchar', default: 'null' })
  deviceopreraterecord_pic_url: string;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  deviceopreraterecord_remark: string;
  @Column({ comment: '状态,1-启用  0-停用', type: 'int', default: '1' })
  deviceopreraterecord_status: number;
  @Column({ comment: '高度', type: 'double', default: '40' })
  basedeviceinfo_altitude: Double;
  @Column({ comment: '账号', type: 'varchar', default: 'admin' })
  basedeviceinfo_device_account: string;
  @Column({ comment: '物理ID', type: 'varchar', default: 'null' })
  basedeviceinfo_device_id: string;
  @Column({ comment: '端口', type: 'varchar', default: '8001' })
  basedeviceinfo_device_port: string;
  @Column({ comment: '密码', type: 'varchar', default: '123456' })
  basedeviceinfo_device_psw: string;
  @Column({ comment: '设备尺寸', type: 'varchar', default: '110*110' })
  basedeviceinfo_dimension: string;
  @Column({ comment: '航向角', type: 'varchar', default: '90' })
  basedeviceinfo_heading_angle: string;
  @Column({ comment: 'IP地址', type: 'varchar', default: '127.0.0.1' })
  basedeviceinfo_ipaddress: string;
  @Column({ comment: '纬度', type: 'double', default: '31' })
  basedeviceinfo_latitude: Double;
  @Column({ comment: '安装位置', type: 'varchar', default: '华能电厂二号煤棚-第一马道-北' })
  basedeviceinfo_location: string;
  @Column({ comment: '逻辑ID', type: 'varchar', default: 'null' })
  basedeviceinfo_logic_id: string;
  @Column({ comment: '经度', type: 'double', default: '121' })
  basedeviceinfo_longitude: Double;
  @Column({ comment: '设备名称', type: 'varchar', default: '可见光-毫米波-采集设备' })
  basedeviceinfo_name: string;
  @Column({ comment: '运维负责人', type: 'varchar', default: 'null' })
  basedeviceinfo_operator: string;
  @Column({ comment: '俯仰角', type: 'varchar', default: '90' })
  basedeviceinfo_petch_angle: string;
  @Column({ comment: '设备精度', type: 'varchar', default: '3' })
  basedeviceinfo_precision: string;
  @Column({ comment: '备注', type: 'varchar', default: '无' })
  basedeviceinfo_remark: string;
  @Column({ comment: '横滚角', type: 'varchar', default: '90' })
  basedeviceinfo_roll_angle: string;
  @Column({ comment: '状态', type: 'int', default: '1' })
  basedeviceinfo_status: number;
  @Column({ comment: '配置人', type: 'varchar', default: 'null' })
  basedeviceparams_configurator: string;
  @Column({ comment: '设备物理ID', type: 'varchar', default: 'null' })
  basedeviceparams_device_id: string;
  @Column({ comment: '设备逻辑ID', type: 'varchar', default: 'null' })
  basedeviceparams_logic_id: string;
  @Column({ comment: 'key', type: 'varchar', default: 'null' })
  basedeviceparams_param_key: string;
  @Column({ comment: '参数类型', type: 'int', default: 'null' })
  basedeviceparams_param_type: number;
  @Column({ comment: '参数值', type: 'varchar', default: 'null' })
  basedeviceparams_param_value: string;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  basedeviceparams_remark: string;
  @Column({ comment: '状态,1-启用  0-停用', type: 'int', default: '1' })
  basedeviceparams_status: number;
  @Column({ comment: '配置人', type: 'varchar', default: 'null' })
  basedevicesection_configurator: string;
  @Column({ comment: '设备物理ID', type: 'varchar', default: 'null' })
  basedevicesection_device_id: string;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  basedevicesection_remark: string;
  @Column({ comment: '组件名称', type: 'varchar', default: 'null' })
  basedevicesection_section_name: string;
  @Column({ comment: '顺序编号', type: 'varchar', default: 'null' })
  basedevicesection_section_sort: string;
  @Column({ comment: '组件类型', type: 'int', default: 'null' })
  basedevicesection_section_type: number;
  @Column({ comment: '状态,1-启用  0-停用', type: 'int', default: '1' })
  basedevicesection_status: number;
  @Column({ comment: '类别   1-心跳   2-告警', type: 'int', default: 'null' })
  basedevicestatus_alarm_type: number;
  @Column({ comment: '设备物理ID', type: 'varchar', default: 'null' })
  basedevicestatus_device_id: string;
  @Column({ comment: '设备逻辑ID', type: 'varchar', default: 'null' })
  basedevicestatus_logic_id: string;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  basedevicestatus_remark: string;
  @Column({ comment: '上报内容,可以是json格式', type: 'varchar', default: 'null' })
  basedevicestatus_report_content: string;
  @Column({ comment: '上报时间', type: 'datetime', default: 'null' })
  basedevicestatus_report_time: Date;
  @Column({ comment: '状态,1-启用  0-停用', type: 'int', default: '1' })
  basedevicestatus_status: number;
  @Column({ comment: '旋转直径', type: 'varchar', default: 'null' })
  doutrubine_diameter_wheel: string;
  @Column({ comment: 'dou_wheel_volumn', type: 'varchar', default: 'null' })
  doutrubine_dou_wheel_volumn: string;
  @Column({ comment: 'max_reclaiming', type: 'varchar', default: 'null' })
  doutrubine_max_reclaiming: string;
  @Column({ comment: '煤堆2', type: 'varchar', default: 'null' })
  doutrubine_max_windrow: string;
  @Column({ comment: 'petch_angle', type: 'varchar', default: 'null' })
  doutrubine_petch_angle: string;
  @Column({ comment: '旋转直径', type: 'varchar', default: 'null' })
  doutrubine_pie_height_down: string;
  @Column({ comment: '旋转直径', type: 'varchar', default: 'null' })
  doutrubine_pie_height_up: string;
  @Column({ comment: 'rated_reclaiming', type: 'varchar', default: 'null' })
  doutrubine_rated_reclaiming: string;
  @Column({ comment: '煤堆1', type: 'varchar', default: 'null' })
  doutrubine_rated_windrow: string;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  doutrubine_remark: string;
  @Column({ comment: '状态', type: 'tinyint', default: '1' })
  doutrubine_status: number;
  @Column({ comment: '斗轮机名称', type: 'varchar', default: 'null' })
  doutrubine_trubine_name: string;
  @Column({ comment: '斗轮机编号', type: 'varchar', default: 'null' })
  doutrubine_trubine_no: string;
  @Column({ comment: '型号尺寸', type: 'varchar', default: 'null' })
  doutrubine_trubine_size: string;
  @Column({ comment: '斗轮机类别', type: 'varchar', default: 'null' })
  doutrubine_trubine_type: string;
  @Column({ comment: '高度', type: 'double', default: 'null' })
  trubinelocation_elevation: Double;
  @Column({ comment: '方位角', type: 'varchar', default: 'null' })
  trubinelocation_heading_angle: string;
  @Column({ comment: '经度', type: 'double', default: 'null' })
  trubinelocation_latitude: Double;
  @Column({ comment: '纬度', type: 'double', default: 'null' })
  trubinelocation_longitude: Double;
  @Column({ comment: '精度', type: 'varchar', default: 'null' })
  trubinelocation_precision: string;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  trubinelocation_remark: string;
  @Column({ comment: '1-启用   0-禁用', type: 'int', default: '1' })
  trubinelocation_status: number;
  @Column({ comment: '分类ID', type: 'bigint', default: 0 })
  baseentity_classifyId: number;
  @Column({ comment: '类型', type: 'varchar', default: 'null' })
  baseentity_type: string;
  @Column({ comment: '地址', type: 'varchar', default: 'null' })
  baseentity_url: string;
  @Column({ comment: '账号', type: 'varchar', default: 'null' })
  interfacelist_auth_account: string;
  @Column({ comment: '密码', type: 'varchar', default: 'null' })
  interfacelist_auth_psw: string;
  @Column({ comment: '认证方式', type: 'varchar', default: 'null' })
  interfacelist_interface_auth: string;
  @Column({ comment: '接口IP', type: 'varchar', default: 'null' })
  interfacelist_interface_ip: string;
  @Column({ comment: '接口名称', type: 'varchar', default: 'null' })
  interfacelist_interface_name: string;
  @Column({ comment: '端口', type: 'varchar', default: 'null' })
  interfacelist_interface_port: string;
  @Column({ comment: '接口协议', type: 'varchar', default: 'null' })
  interfacelist_interface_protocal: string;
  @Column({ comment: '接口类型', type: 'varchar', default: 'null' })
  interfacelist_interface_type: string;
  @Column({ comment: '接口地址', type: 'varchar', default: 'null' })
  interfacelist_interface_url: string;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  interfacelist_remark: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  interfacelist_share_service: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  interfacelist_share_url: string;
  @Column({ comment: '', type: 'int', default: 'null' })
  interfacelist_status: number;
  @Column({ comment: '调用结束时间', type: 'datetime', default: 'null' })
  interfacerecord_end_time: Date;
  @Column({ comment: '接口调用地址', type: 'varchar', default: 'null' })
  interfacerecord_interface_direct: string;
  @Column({ comment: '接口清单ID', type: 'varchar', default: 'null' })
  interfacerecord_interface_id: string;
  @Column({ comment: '调用参数,json格式', type: 'varchar', default: 'null' })
  interfacerecord_params: string;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  interfacerecord_remark: string;
  @Column({ comment: '请求类型', type: 'varchar', default: 'null' })
  interfacerecord_request_type: string;
  @Column({ comment: '调用结果', type: 'varchar', default: 'null' })
  interfacerecord_result: string;
  @Column({ comment: '开始时间', type: 'datetime', default: 'null' })
  interfacerecord_start_time: Date;
  @Column({ comment: '1-启用   0-禁用', type: 'int', default: '1' })
  interfacerecord_status: number;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_citycode: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_cityEn: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_cityname: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_cloud: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_humidity: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_iconDay: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_iconNight: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_moonPhase: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_moonPhaseIcon: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_moonrise: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_moonset: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_posttime: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_precip: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_pressure: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_responsedata: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_sunrise: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_sunset: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_tempMax: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_tempMin: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_textDay: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_textNight: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_type: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_uvIndex: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_vis: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_wind360Day: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_wind360Night: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_windDirDay: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_windDirNight: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_windScaleDay: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_windScaleNight: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_windSpeedDay: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherday_windSpeedNight: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherhour_citycode: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherhour_cityEn: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherhour_cityname: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherhour_cloud: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherhour_dew: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherhour_feelsLike: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherhour_humidity: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherhour_icon: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherhour_posttime: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherhour_precip: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherhour_pressure: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherhour_responsedata: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherhour_temp: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherhour_text: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherhour_type: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherhour_vis: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherhour_wind360: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherhour_windDir: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherhour_windScale: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  weatherhour_windSpeed: string;
  @Column({ comment: 'id', type: 'varchar', default: 'null' })
  hnall_logic_id: string;
  @Column({ comment: '', type: 'int', default: 'null' })
  comconfig_com_model_id: number;
  @Column({ comment: '', type: 'int', default: 'null' })
  comconfig_model_id: number;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  comconfig_remark: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  comconfig_sortby: string;
  @Column({ comment: '', type: 'int', default: 'null' })
  comconfig_status: number;
  @Column({ comment: '数据内容', type: 'varchar', default: 'null' })
  modelcombination_data_content: string;
  @Column({ comment: '数据文件路径,url格式,域名可由服务端或者前端配置', type: 'varchar', default: 'null' })
  modelcombination_data_path: string;
  @Column({ comment: '1-周期任务   0-即时任务', type: 'int', default: 'null' })
  modelcombination_is_periodic: number;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  modelcombination_remark: string;
  @Column({ comment: '1-启用   0-禁用', type: 'int', default: 'null' })
  modelcombination_status: number;
  @Column({ comment: '任务ID,周期任务表或者即时任务表主键', type: 'int', default: 'null' })
  modelcombination_task_id: number;
  @Column({ comment: '监测记录ID', type: 'int', default: 'null' })
  modelcombination_task_monitor_id: number;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  pointcloud_remark: string;
  @Column({ comment: '数据内容', type: 'varchar', default: 'null' })
  pointmodel_data_content: string;
  @Column({ comment: '数据文件路径,存放url', type: 'varchar', default: 'null' })
  pointmodel_data_path: string;
  @Column({ comment: '设备物理ID', type: 'varchar', default: 'null' })
  pointmodel_device_id: string;
  @Column({ comment: '1-周期任务   0-即时性任务', type: 'int', default: 'null' })
  pointmodel_is_periodic: number;
  @Column({ comment: '点云数据来源的设备逻辑编号', type: 'varchar', default: 'null' })
  pointmodel_logic_id: string;
  @Column({ comment: '点云名称,格式:以${logic_id#YYYYMMDDHHMMSS}', type: 'varchar', default: 'null' })
  pointmodel_name: string;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  pointmodel_remark: string;
  @Column({ comment: '状态, 1-启用  0-禁用', type: 'int', default: '1' })
  pointmodel_status: number;
  @Column({ comment: '任务ID,周期任务表或者即时任务表主键', type: 'int', default: 'null' })
  pointmodel_task_id: number;
  @Column({ comment: '监测记录id', type: 'int', default: 'null' })
  pointmodel_task_monitor_id: number;
  @Column({ comment: '数据内容', type: 'varchar', default: 'null' })
  modelstatic_data_content: string;
  @Column({ comment: '数据文件路径,存放url', type: 'varchar', default: 'null' })
  modelstatic_data_path: string;
  @Column({ comment: '物理模型的逻辑ID', type: 'varchar', default: 'null' })
  modelstatic_logic_id: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  modelstatic_name: string;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  modelstatic_remark: string;
  @Column({ comment: '状态, 1-启用  0-禁用', type: 'int', default: '1' })
  modelstatic_status: number;
  @Column({ comment: '数据内容', type: 'varchar', default: 'null' })
  colletdata_data_content: string;
  @Column({ comment: '数据存储路径,url格式,域名可由服务端或者前端配置进行访问', type: 'varchar', default: 'null' })
  colletdata_data_path: string;
  @Column({ comment: '1-周期任务   0-即时性任务', type: 'int', default: 'null' })
  colletdata_is_periodic: number;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  colletdata_remark: string;
  @Column({ comment: '', type: 'int', default: '1' })
  colletdata_status: number;
  @Column({ comment: '任务ID,周期任务表主键或者即时任务表主键', type: 'int', default: 'null' })
  colletdata_task_id: number;
  @Column({ comment: '监测记录ID', type: 'int', default: 'null' })
  colletdata_task_monitor_id: number;
  @Column({ comment: '', type: 'int', default: 'null' })
  colletmeta_collet_data_id: number;
  @Column({ comment: '', type: 'int', default: 'null' })
  colletmeta_meta_data_id: number;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  colletmeta_remark: string;
  @Column({ comment: '', type: 'int', default: '1' })
  colletmeta_status: number;
  @Column({ comment: '数据文件内容描述', type: 'varchar', default: 'null' })
  metadata_data_content: string;
  @Column({ comment: '数据文件路径,url格式,域名可由前端或者服务端配置', type: 'varchar', default: 'null' })
  metadata_data_path: string;
  @Column({ comment: '设备ID', type: 'varchar', default: 'null' })
  metadata_device_id: string;
  @Column({ comment: '执行记录', type: 'int', default: 'null' })
  metadata_exec_record_id: number;
  @Column({ comment: '1-周期任务   0-即时性任务', type: 'int', default: 'null' })
  metadata_is_periodic: number;
  @Column({ comment: '逻辑ID', type: 'varchar', default: 'null' })
  metadata_logic_id: string;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  metadata_remark: string;
  @Column({ comment: '状态,1-有效  0-无效  默认为1', type: 'int', default: '1' })
  metadata_status: number;
  @Column({ comment: '任务ID', type: 'int', default: 'null' })
  metadata_task_id: number;
  @Column({ comment: '监测记录ID', type: 'int', default: 'null' })
  metadata_task_monitor_id: number;
  @Column({ comment: '点云计算花费时间,单位毫秒', type: 'int', default: 'null' })
  statdata_avg_caculater_time: number;
  @Column({ comment: '平均文件大小', type: 'int', default: 'null' })
  statdata_avg_filesize: number;
  @Column({ comment: '平均花费时间,单位毫秒', type: 'int', default: 'null' })
  statdata_avg_task_time: number;
  @Column({ comment: '数据传输时间,毫秒', type: 'int', default: 'null' })
  statdata_avg_transmission_time: number;
  @Column({ comment: 'CPU 占用率,百分比', type: 'int', default: 'null' })
  statdata_cpu_rate: number;
  @Column({ comment: '统计截止时间', type: 'datetime', default: 'null' })
  statdata_end_time: Date;
  @Column({ comment: '内存,', type: 'int', default: 'null' })
  statdata_memory: number;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  statdata_remark: string;
  @Column({ comment: '统计起始时间', type: 'datetime', default: 'null' })
  statdata_start_time: Date;
  @Column({ comment: '', type: 'int', default: '1' })
  statdata_status: number;
  @Column({ comment: '任务类型:  1-抓图  2-雷达扫描  3-除尘 ', type: 'int', default: 'null' })
  statdata_task_type: number;
  @Column({ comment: '统计时间粒度,5-5分钟  10-10分钟 30-30分钟  60-60分钟 1440-1天 43200-1月  ', type: 'int', default: 'null' })
  statdata_time: number;
  @Column({ comment: '煤种标记', type: 'varchar', default: 'null' })
  planinventory_coal_marker: string;
  @Column({ comment: '煤堆体积', type: 'varchar', default: 'null' })
  planinventory_coal_volume: string;
  @Column({ comment: '煤堆重量,单位吨', type: 'varchar', default: 'null' })
  planinventory_coal_weight: string;
  @Column({ comment: '组合点云ID', type: 'int', default: 'null' })
  planinventory_com_model_id: number;
  @Column({ comment: '盘煤计划ID', type: 'int', default: 'null' })
  planinventory_plan_id: number;
  @Column({ comment: '盘煤名称', type: 'varchar', default: 'null' })
  planinventory_plan_name: string;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  planinventory_remark: string;
  @Column({ comment: '1-启用   0-禁用', type: 'int', default: '1' })
  planinventory_status: number;
  @Column({ comment: '设备物理ID', type: 'varchar', default: 'null' })
  execrecord_device_id: string;
  @Column({ comment: '设备执行任务时刻的相关参数,json格式。', type: 'varchar', default: 'null' })
  execrecord_device_params: string;
  @Column({ comment: '结束时间,任务执行完成时间', type: 'datetime', default: 'null' })
  execrecord_end_time: Date;
  @Column({ comment: '执行结果', type: 'varchar', default: 'null' })
  execrecord_exec_result: string;
  @Column({ comment: '执行耗时', type: 'varchar', default: 'null' })
  execrecord_exec_time: string;
  @Column({ comment: '1-周期任务   0-即时性任务', type: 'int', default: 'null' })
  execrecord_is_periodic: number;
  @Column({ comment: '设备的逻辑ID', type: 'varchar', default: 'null' })
  execrecord_logic_id: string;
  @Column({ comment: '服务端数据接收时间', type: 'datetime', default: 'null' })
  execrecord_receive_time: Date;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  execrecord_remark: string;
  @Column({ comment: '数据回传时间', type: 'datetime', default: 'null' })
  execrecord_send_time: Date;
  @Column({ comment: '开始时间,设备收到指令时间', type: 'datetime', default: 'null' })
  execrecord_start_time: Date;
  @Column({ comment: '无意义,框架需要', type: 'int', default: '1' })
  execrecord_status: number;
  @Column({ comment: '任务指令', type: 'varchar', default: 'null' })
  execrecord_task_command: string;
  @Column({ comment: '任务ID,对应t_task_periodic_setting的主键,或者t_task_immediately主键', type: 'int', default: 'null' })
  execrecord_task_id: number;
  @Column({ comment: '监测记录ID,对应t_task_monitor的主键', type: 'int', default: 'null' })
  execrecord_task_monitor_id: number;
  @Column({ comment: '逻辑ID', type: 'varchar', default: 'null' })
  taskimmediately_logic_ids: string;
  @Column({ comment: '设置时间', type: 'varchar', default: 'null' })
  taskimmediately_operate_time: string;
  @Column({ comment: '操作人', type: 'varchar', default: 'null' })
  taskimmediately_operator: string;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  taskimmediately_remark: string;
  @Column({ comment: '0-未执行    1-执行中    2-已执行', type: 'int', default: 'null' })
  taskimmediately_status: number;
  @Column({ comment: '任务指令', type: 'varchar', default: 'null' })
  taskimmediately_task_command: string;
  @Column({ comment: '任务内容描述', type: 'varchar', default: 'null' })
  taskimmediately_task_content: string;
  @Column({ comment: '任务参数,如点云参数', type: 'varchar', default: 'null' })
  taskimmediately_task_params: string;
  @Column({ comment: '任务类型:  1-抓图  2-雷达扫描  3-除尘 ', type: 'int', default: 'null' })
  taskimmediately_task_type: number;
  @Column({ comment: '1-周期任务   0-即时性任务', type: 'int', default: 'null' })
  messagerecord_is_periodic: number;
  @Column({ comment: '消息', type: 'varchar', default: 'null' })
  messagerecord_message: string;
  @Column({ comment: '发送源 ', type: 'varchar', default: 'null' })
  messagerecord_msg_source: string;
  @Column({ comment: '发送目标', type: 'varchar', default: 'null' })
  messagerecord_msg_target: string;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  messagerecord_remark: string;
  @Column({ comment: '发送时间', type: 'datetime', default: 'null' })
  messagerecord_send_time: Date;
  @Column({ comment: '消息状态 1-已发送   0-未发送  默认为0', type: 'int', default: '0' })
  messagerecord_status: number;
  @Column({ comment: '任务来源ID', type: 'int', default: 'null' })
  messagerecord_task_id: number;
  @Column({ comment: '监测记录ID', type: 'int', default: 'null' })
  messagerecord_task_monitor_id: number;
  @Column({ comment: '周期任务周期设置,调度表达式', type: 'varchar', default: 'null' })
  taskmonitor_crontab_rule: string;
  @Column({ comment: '1-周期任务   0-即时性任务', type: 'int', default: 'null' })
  taskmonitor_is_periodic: number;
  @Column({ comment: '设备逻辑id集合,逗号分隔', type: 'varchar', default: 'null' })
  taskmonitor_logic_ids: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  taskmonitor_operator: string;
  @Column({ comment: '', type: 'datetime', default: 'null' })
  taskmonitor_opertate_time: Date;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  taskmonitor_remark: string;
  @Column({ comment: '0-未执行    1-执行中    2-已执行', type: 'int', default: '0' })
  taskmonitor_status: number;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  taskmonitor_task_command: string;
  @Column({ comment: '', type: 'varchar', default: 'null' })
  taskmonitor_task_content: string;
  @Column({ comment: '任务ID, 周期任务的主键或者是即时任务的主键', type: 'int', default: 'null' })
  taskmonitor_task_id: number;
  @Column({ comment: '任务参数', type: 'varchar', default: 'null' })
  taskmonitor_task_params: string;
  @Column({ comment: '任务类型:  1-抓图  2-雷达扫描  3-除尘 ', type: 'int', default: 'null' })
  taskmonitor_task_type: number;
  @Column({ comment: '周期任务', type: 'varchar', default: 'null' })
  periodicsetting_crontab_rule: string;
  @Column({ comment: '任务结束时间', type: 'datetime', default: 'null' })
  periodicsetting_end_time: Date;
  @Column({ comment: '设备分组ID', type: 'int', default: 'null' })
  periodicsetting_group_id: number;
  @Column({ comment: '设置人', type: 'varchar', default: 'null' })
  periodicsetting_operator: string;
  @Column({ comment: '备注', type: 'varchar', default: 'null' })
  periodicsetting_remark: string;
  @Column({ comment: '状态', type: 'tinyint', default: '1' })
  periodicsetting_status: number;
  @Column({ comment: '任务命令格式', type: 'varchar', default: 'null' })
  periodicsetting_task_command: string;
  @Column({ comment: '任务内容描述', type: 'varchar', default: 'null' })
  periodicsetting_task_content: string;
  @Column({ comment: '任务参数', type: 'varchar', default: 'null' })
  periodicsetting_task_params: string;
  @Column({ comment: '任务类型', type: 'int', default: 'null' })
  periodicsetting_task_type: number;
  @Column({ comment: '年龄', type: 'int', default: 'null' })
  tuser_age: number;
  @Column({ comment: '出生日期', type: 'datetime', default: 'null' })
  tuser_birthDate: Date;
  @Column({ comment: '头像', type: 'varchar', default: 'null' })
  tuser_headImg: string;
  @Column({ comment: '介绍', type: 'varchar', default: 'null' })
  tuser_introduce: string;
  @Column({ comment: '姓名', type: 'varchar', default: 'null' })
  tuser_name: string;
  @Column({ comment: '性别 0-未知 1-男 2-女', type: 'tinyint', default: '0' })
  tuser_type: number;
}
src/app/modules/base/schedule/create_obj_entity.ts
New file
@@ -0,0 +1,71 @@
// src/schedule/hello.ts
import { Provide, Inject, Schedule, CommonSchedule } from '@midwayjs/decorator';
import { DataService } from '../service/dataapi/dataapi';
import * as fs from 'fs';
import { ILogger } from '@midwayjs/logger';
/**
 * 日志定时任务
 */
@Provide()
@Schedule({
    cron: '00 53 15 * * *', // 每天0点执行
    type: 'worker', // 指定某一个 worker 执行
})
export class BaseEntitySchedule implements CommonSchedule {
    @Inject()
    dataService: DataService;
    @Inject()
    logger: ILogger;
    // 定时执行的具体任务
    async exec() {
        this.logger.info('生成综合实体类任务开始执行');
        const startTime = Date.now();
        if (fs.existsSync('../entity/app/commentity.ts')) {
            console.log(' file is exists')
        } else {
            console.log(' file is not exists')
            // API
            fs.writeFile('./src/app/modules/base/entity/app/commentity.ts',
            `import { EntityModel } from '@midwayjs/orm';
            import { BaseEntity } from '@cool-midway/core';
            import { Column } from 'typeorm';
            /**
             * 文件空间信息
             */
            @EntityModel('t_sys_comm_column')
            export class CommEntity extends BaseEntity {
              @Column({ comment: '地址' })
              url: string;
              @Column({ comment: '类型' })
              type: string;
              @Column({ comment: '分类ID', type: 'bigint', nullable: true })
              classifyId: number;
            }`, (error) => {
                // 创建失败
                if(error){
                    console.log(`创建失败:${error}`)
                }
                // 创建成功
                console.log(`创建成功!`)
            })
        }
        const columns = await this.dataService.getData({"bid":"getColumns", "pageindex":"1", "pagesize":"300"})  //bid_obj_[0], query?.pageindex || null , query?.pagesize || null, query
        console.log(columns)
        //读取文件内容,并转化为Json对象
        // let userBugsJson = JSON.parse(fs.readFileSync("app/public/static/Data.json", "utf8"));
        // //获取Json里key为data的数据
        // const data = userBugsJson['data'];
        // return data;
        this.logger.info(`生成综合实体类任务结束,耗时:${Date.now() - startTime}ms`);
    }
}
src/app/modules/base/service/dataapi/dataapi.ts
@@ -2,6 +2,8 @@
import { BaseService, ICoolCache, } from '@cool-midway/core';
import * as _ from 'lodash';
import { MysqlUtil } from '../../utils/mysqlutil';
// 引入读写核心模块
/**
 * 系统用户
@@ -26,12 +28,33 @@
    // ); // 部门权限
    const bidsql = `select * from t_sys_business_config where id_='${query.bid}' limit 0,1`;    
    const bid_obj_ = await this.nativeQuery(bidsql);
    console.log(bid_obj_)
    let sqlObj = this.mysqlUtil.create_sql(bid_obj_[0], query?.pageindex || null , query?.pagesize || null, query);
    if (sqlObj?.status == 0) {
        return sqlObj?.msg;
    }
    return this.sqlRenderPage(sqlObj?.sql, query);
  }
  /**
   * 分页查询
   * @param query
   */
   async getDataByNative(query) {
    // const { keyWord, status, departmentIds = [] } = query;
    // const permsDepartmentArr = await this.baseSysPermsService.departmentIds(
    //   this.ctx.admin.userId
    // ); // 部门权限
    const bidsql = `select * from t_sys_business_config where id_='${query.bid}' limit 0,1`;
    const bid_obj_ = await this.nativeQuery(bidsql);
    console.log(bid_obj_)
    let sqlObj = this.mysqlUtil.create_sql(bid_obj_[0], query?.pageindex || null , query?.pagesize || null, query);
    if (sqlObj?.status == 0) {
        return sqlObj?.msg;
    }
    return this.nativeQuery(sqlObj?.sql)
  }
  /**
   * 分页查询
@@ -50,6 +73,5 @@
    }
    return this.sqlRenderPage(sqlObj?.sql, query);
  }
}
src/app/modules/device/controller/app/device.ts
@@ -8,7 +8,7 @@
@Provide()
@CoolController(
  {
    api: ['add', 'delete', 'update', 'info', 'list', 'page'],
    api: ['delete', 'update', 'info', 'list', 'page'],
    entity: DemoDeviceEntity
  }
)
src/app/modules/device/entity/device.ts
@@ -5,7 +5,7 @@
/**
 * 商品
 */
@EntityModel('device')
@EntityModel('t_base_deviceinfo')
export class DemoDeviceEntity extends BaseEntity {
  @PrimaryGeneratedColumn({ comment: 'id' })
  id: number;
@@ -22,10 +22,10 @@
  @Column({ comment: '安装位置', default: "华能电厂二号煤棚-第一马道-北" })
  location: string;
  @Column({ comment: '经度', type: 'double', default: 121.222222222 })
  @Column({ comment: '经度', type: 'double', default: 121.222222 })
  longitude: number;
  @Column({ comment: '纬度', type: 'double', default: 31.222222222 })
  @Column({ comment: '纬度', type: 'double', default: 31.222222 })
  latitude: number;
  @Column({ comment: '高度', type: 'double', default: 40 })
src/app/modules/deviceGroup/controller/admin/deviceGroup.ts
@@ -1,13 +1,13 @@
import { Provide } from '@midwayjs/decorator';
import { CoolController, BaseController } from '@cool-midway/core';
import { DemodeviceGroupEntity } from '../../entity/deviceGroup';
// import { Provide } from '@midwayjs/decorator';
// import { CoolController, BaseController } from '@cool-midway/core';
// import { DemodeviceGroupEntity } from '../../entity/deviceGroup';
/**
 * 描述
 */
@Provide()
@CoolController({
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  entity: DemodeviceGroupEntity,
})
export class DemoAdmindeviceGroupController extends BaseController { }
// /**
//  * 描述
//  */
// @Provide()
// @CoolController({
//   api: ['add', 'delete', 'update', 'info', 'list', 'page'],
//   entity: DemodeviceGroupEntity,
// })
// export class DemoAdmindeviceGroupController extends BaseController { }
src/app/modules/deviceGroup/controller/app/deviceGroup.ts
@@ -1,15 +1,15 @@
import { Provide } from '@midwayjs/decorator';
import { CoolController, BaseController } from '@cool-midway/core';
import { DemodeviceGroupEntity } from '../../entity/deviceGroup';
// import { Provide } from '@midwayjs/decorator';
// import { CoolController, BaseController } from '@cool-midway/core';
// import { DemodeviceGroupEntity } from '../../entity/deviceGroup';
/**
 * test
 */
@Provide()
@CoolController(
  {
    api: ['add', 'delete', 'update', 'info', 'list', 'page'],
    entity: DemodeviceGroupEntity
  }
)
export class DemoAppdGController extends BaseController { }
// /**
//  * test
//  */
// @Provide()
// @CoolController(
//   {
//     api: ['add', 'delete', 'update', 'info', 'list', 'page'],
//     entity: DemodeviceGroupEntity
//   }
// )
// export class DemoAppdGController extends BaseController { }