Forráskód Böngészése

修改中试平台管理 服务支撑

zs 9 hónapja
szülő
commit
8141e1d28c

+ 1 - 2
src/controller/platform/footplate.controller.ts

@@ -3,11 +3,10 @@ import { FootplateService } from '../../service/platform/footplate.service';
 import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
 import { Validate } from '@midwayjs/validate';
 import { omit, pick } from 'lodash';
-import { BaseController } from '../../frame/BaseController';
 import { ServiceError, ErrorCode } from '../../error/service.error';
+import { BaseController } from '../../frame/BaseController';
 import { QVO_footplate, FVO_footplate, CVO_footplate, UVAO_footplate } from '../../interface/platform/footplate.interface';
 const namePrefix = '中试平台';
-
 @ApiTags(['中试平台'])
 @Controller('/footplate', { tagName: namePrefix })
 export class footplateController implements BaseController {

+ 66 - 0
src/controller/platform/support.controller.ts

@@ -0,0 +1,66 @@
+import { Controller, Inject, Get, Param, Post, Body, Del, Query } from '@midwayjs/core';
+import { SupportService } from '../../service/platform/support.service';
+import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+import { omit, pick } from 'lodash';
+import { ServiceError, ErrorCode } from '../../error/service.error';
+import { BaseController } from '../../frame/BaseController';
+import { QVO_support, FVO_support, CVO_support, UVAO_support } from '../../interface/platform/support.interface';
+const namePrefix = '服务支撑';
+@ApiTags(['服务支撑'])
+@Controller('/support', { tagName: namePrefix })
+export class supportController implements BaseController {
+  @Inject()
+  service: SupportService;
+
+  @Get('/')
+  @ApiTags('列表查询')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_support })
+  async index(@Query() query: object) {
+    const qobj = omit(query, ['skip', 'limit']);
+    const others = pick(query, ['skip', 'limit']);
+    const qbr = this.service.queryBuilder(qobj);
+    const result = await this.service.query(qbr, others);
+    return result;
+  }
+
+  @Get('/:id')
+  @ApiTags('单查询')
+  @ApiResponse({ type: FVO_support })
+  async fetch(@Param('id') id: number) {
+    const qbr = this.service.queryBuilder({ id });
+    const data = await this.service.fetch(qbr);
+    const result = new FVO_support(data);
+    return result;
+  }
+
+  @Post('/', { routerName: `创建${namePrefix}` })
+  @ApiTags('创建数据')
+  @Validate()
+  @ApiResponse({ type: CVO_support })
+  async create(@Body() data: object) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_support(dbData);
+    return result;
+  }
+
+  @Post('/:id', { routerName: `修改${namePrefix}` })
+  @ApiTags('修改数据')
+  @Validate()
+  @ApiResponse({ type: UVAO_support })
+  async update(@Param('id') id: number, @Body() data: object) {
+    if (!id) throw new ServiceError(ErrorCode.ID_NOT_FOUND);
+    const result = await this.service.update({ id }, data);
+    return result;
+  }
+
+  @Del('/:id', { routerName: `删除${namePrefix}` })
+  @ApiTags('删除数据')
+  @Validate()
+  async delete(@Param('id') id: number) {
+    if (!id) throw new ServiceError(ErrorCode.ID_NOT_FOUND);
+    const result = await this.service.delete({ id });
+    return result;
+  }
+}

+ 0 - 1
src/entity/platform/demand.entity.ts

@@ -33,7 +33,6 @@ export class Demand extends BaseModel {
   is_use: string;
   @Column({ type: 'character varying', nullable: true, comment: '状态' })
   status: string;
-
   @Column({ type: 'character varying', nullable: true, comment: '所属产业' })
   industry: string;
   @Column({ type: 'character varying', nullable: true, comment: '所属企业' })

+ 2 - 0
src/entity/platform/footplate.entity.ts

@@ -7,6 +7,8 @@ export class Footplate extends BaseModel {
   user: number;
   @Column({ type: 'character varying', nullable: true, comment: '所属产业' })
   industry: string;
+  @Column({ type: 'jsonb', nullable: true, comment: '标签' })
+  tags: Array<any>;
   @Column({ type: 'character varying', nullable: true, comment: '名称' })
   name: string;
   @Column({ type: 'character varying', nullable: true, comment: '建设主体' })

+ 0 - 1
src/entity/platform/project.entity.ts

@@ -29,7 +29,6 @@ export class Project extends BaseModel {
   is_use: string;
   @Column({ type: 'character varying', nullable: true, comment: '状态' })
   status: string;
-
   @Column({ type: 'character varying', nullable: true, comment: '项目主体' })
   main: string;
   @Column({ type: 'character varying', nullable: true, comment: '项目进展' })

+ 2 - 0
src/entity/platform/sector.entity.ts

@@ -9,6 +9,8 @@ export class Sector extends BaseModel {
   href: string;
   @Column({ type: 'character varying', nullable: true, comment: '英文标题' })
   English: string;
+  @Column({ type: 'jsonb', nullable: true, comment: '合作伙伴' })
+  partner: Array<any>;
   @Column({ type: 'integer', nullable: true, comment: '排序' })
   sort: number;
   @Column({ type: 'character varying', nullable: true, comment: '备注' })

+ 32 - 0
src/entity/platform/support.entity.ts

@@ -0,0 +1,32 @@
+import { Entity, Column } from 'typeorm';
+import { BaseModel } from '../../frame/BaseModel';
+// 中试平台
+@Entity('support')
+export class Support extends BaseModel {
+  @Column({ type: 'integer', nullable: true, comment: '平台用户id' })
+  user: number;
+  @Column({ type: 'character varying', nullable: true, comment: '所属产业' })
+  industry: string;
+  @Column({ type: 'jsonb', nullable: true, comment: '标签' })
+  tags: Array<any>;
+  @Column({ type: 'character varying', nullable: true, comment: '名称' })
+  name: string;
+  @Column({ type: 'character varying', nullable: true, comment: '服务领域' })
+  field: string;
+  @Column({ type: 'character varying', nullable: true, comment: '登记时间' })
+  time: string;
+  @Column({ type: 'jsonb', nullable: true, comment: '所在地区' })
+  area: Array<any>;
+  @Column({ type: 'character varying', nullable: true, comment: '地址' })
+  address: string;
+  @Column({ type: 'character varying', nullable: true, comment: '联系人' })
+  contacts: string;
+  @Column({ type: 'character varying', nullable: true, comment: '联系电话' })
+  phone: string;
+  @Column({ type: 'character varying', nullable: true, comment: '简介' })
+  brief: string;
+  @Column({ type: 'character varying', nullable: true, comment: '是否使用', default: '0' })
+  is_use: string;
+  @Column({ type: 'character varying', nullable: true, comment: '状态', default: '0' })
+  status: string;
+}

+ 0 - 5
src/entity/system/admin.entity.ts

@@ -6,10 +6,8 @@ import * as bcrypt from 'bcryptjs';
 export class Admin extends BaseModel {
   @Column({ type: 'character varying', nullable: true, comment: '管理员名称' })
   nick_name: string;
-
   @Column({ type: 'character varying', comment: '账号', unique: true })
   account: string;
-
   @Column({
     type: 'character varying',
     select: false,
@@ -25,13 +23,10 @@ export class Admin extends BaseModel {
     },
   })
   password: string; //TODO:需要重新加密
-
   @Column({ type: 'jsonb', nullable: true, comment: '角色id数组' })
   role: string[];
-
   @Column({ type: 'integer', nullable: true, comment: '部门id' })
   dept: number;
-
   @Column({ type: 'character varying', default: '0', comment: '是否使用: 0:使用;1:禁用' })
   is_use: string;
   @Column({ type: 'character varying', default: '1', comment: '是否是超级管理员: 0:是;1否' })

+ 1 - 1
src/interface/platform/collection.interface.ts

@@ -8,7 +8,7 @@ export class FVO_collection {
   @ApiProperty({ description: '数据id' })
   id: number = undefined;
   @ApiProperty({ description: '平台用户id' })
-  'user': string = undefined;
+  'user': number = undefined;
   @ApiProperty({ description: '来源id' })
   'source': string = undefined;
   @ApiProperty({ description: '类型' })

+ 11 - 4
src/interface/platform/footplate.interface.ts

@@ -9,7 +9,9 @@ export class FVO_footplate {
   @ApiProperty({ description: '数据id' })
   id: number = undefined;
   @ApiProperty({ description: '平台用户id' })
-  'user': string = undefined;
+  'user': number = undefined;
+  @ApiProperty({ description: '标签' })
+  'tags': Array<any> = undefined;
   @ApiProperty({ description: '所属产业' })
   'industry': string = undefined;
   @ApiProperty({ description: '名称' })
@@ -38,7 +40,9 @@ export class FVO_footplate {
 
 export class QDTO_footplate extends SearchBase {
   @ApiProperty({ description: '平台用户id' })
-  'user': string = undefined;
+  'user': number = undefined;
+  @ApiProperty({ description: '标签' })
+  'tags': Array<any> = undefined;
   @ApiProperty({ description: '所属产业' })
   'industry': string = undefined;
   @ApiProperty({ description: '名称' })
@@ -68,8 +72,11 @@ export class QVO_footplate extends FVO_footplate {
 
 export class CDTO_footplate {
   @ApiProperty({ description: '平台用户id' })
-  @Rule(RuleType['string']().empty(''))
-  'user': string = undefined;
+  @Rule(RuleType['number']().empty(''))
+  'user': number = undefined;
+  @ApiProperty({ description: '标签' })
+  @Rule(RuleType['array']().empty(''))
+  'tags': Array<any> = undefined;
   @ApiProperty({ description: '所属产业' })
   @Rule(RuleType['string']().empty(''))
   'industry': string = undefined;

+ 5 - 0
src/interface/platform/sector.interface.ts

@@ -16,6 +16,8 @@ export class FVO_sector {
   'sort': number = undefined;
   @ApiProperty({ description: '英文标题' })
   'English': string = undefined;
+  @ApiProperty({ description: '合作伙伴' })
+  'partner': Array<any> = undefined;
   @ApiProperty({ description: '备注' })
   'remark': string = undefined;
   @ApiProperty({ description: '是否使用' })
@@ -46,6 +48,9 @@ export class CDTO_sector {
   @ApiProperty({ description: '英文标题' })
   @Rule(RuleType['string']().empty(''))
   'English': string = undefined;
+  @ApiProperty({ description: '合作伙伴' })
+  @Rule(RuleType['array']().empty(''))
+  'partner': Array<any> = undefined;
   @ApiProperty({ description: '排序' })
   @Rule(RuleType['number']().empty(''))
   'sort': number = undefined;

+ 129 - 0
src/interface/platform/support.interface.ts

@@ -0,0 +1,129 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { SearchBase } from '../../frame/SearchBase';
+import { dealVO } from '../../frame/VOBase';
+export class FVO_support {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  id: number = undefined;
+  @ApiProperty({ description: '平台用户id' })
+  'user': number = undefined;
+  @ApiProperty({ description: '标签' })
+  'tags': Array<any> = undefined;
+  @ApiProperty({ description: '所属产业' })
+  'industry': string = undefined;
+  @ApiProperty({ description: '名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '登记时间' })
+  'time': string = undefined;
+  @ApiProperty({ description: '服务领域' })
+  'field': string = undefined;
+  @ApiProperty({ description: '所在地区' })
+  'area': Array<any> = undefined;
+  @ApiProperty({ description: '地址' })
+  'address': string = undefined;
+  @ApiProperty({ description: '联系人' })
+  'contacts': string = undefined;
+  @ApiProperty({ description: '联系电话' })
+  'phone': string = undefined;
+  @ApiProperty({ description: '简介' })
+  'brief': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  'is_use': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+}
+
+export class QDTO_support extends SearchBase {
+  @ApiProperty({ description: '平台用户id' })
+  'user': number = undefined;
+  @ApiProperty({ description: '标签' })
+  'tags': Array<any> = undefined;
+  @ApiProperty({ description: '所属产业' })
+  'industry': string = undefined;
+  @ApiProperty({ description: '名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '登记时间' })
+  'time': string = undefined;
+  @ApiProperty({ description: '服务领域' })
+  'field': string = undefined;
+  @ApiProperty({ description: '联系人' })
+  'contacts': string = undefined;
+  @ApiProperty({ description: '联系电话' })
+  'phone': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  'is_use': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+}
+
+export class QVO_support extends FVO_support {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_support {
+  @ApiProperty({ description: '平台用户id' })
+  @Rule(RuleType['number']().empty(''))
+  'user': number = undefined;
+  @ApiProperty({ description: '标签' })
+  @Rule(RuleType['array']().empty(''))
+  'tags': Array<any> = undefined;
+  @ApiProperty({ description: '所属产业' })
+  @Rule(RuleType['string']().empty(''))
+  'industry': string = undefined;
+  @ApiProperty({ description: '名称' })
+  @Rule(RuleType['string']().empty(''))
+  'name': string = undefined;
+  @ApiProperty({ description: '登记时间' })
+  @Rule(RuleType['string']().empty(''))
+  'time': string = undefined;
+  @ApiProperty({ description: '服务领域' })
+  @Rule(RuleType['string']().empty(''))
+  'field': string = undefined;
+  @ApiProperty({ description: '所在地区' })
+  @Rule(RuleType['array']().empty(''))
+  'area': Array<any> = undefined;
+  @ApiProperty({ description: '地址' })
+  @Rule(RuleType['string']().empty(''))
+  'address': string = undefined;
+  @ApiProperty({ description: '联系人' })
+  @Rule(RuleType['string']().empty(''))
+  'contacts': string = undefined;
+  @ApiProperty({ description: '联系电话' })
+  @Rule(RuleType['string']().empty(''))
+  'phone': string = undefined;
+  @ApiProperty({ description: '简介' })
+  @Rule(RuleType['string']().empty(''))
+  'brief': string = undefined;
+  @ApiProperty({ description: '是否使用' })
+  @Rule(RuleType['string']().empty(''))
+  'is_use': string = undefined;
+  @ApiProperty({ description: '状态' })
+  @Rule(RuleType['string']().empty(''))
+  'status': string = undefined;
+}
+
+export class CVO_support extends FVO_support {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_support extends CDTO_support {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['number']().empty(''))
+  id: number = undefined;
+}
+
+export class UVAO_support extends FVO_support {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 2 - 2
src/interface/users/investment.interface.ts

@@ -55,8 +55,8 @@ export class QVO_investment extends FVO_investment {
 
 export class CDTO_investment {
   @ApiProperty({ description: '平台用户id' })
-  @Rule(RuleType['string']().empty(''))
-  'user': string = undefined;
+  @Rule(RuleType['number']().empty(''))
+  'user': number = undefined;
   @ApiProperty({ description: '投资人姓名' })
   @Rule(RuleType['string']().empty(''))
   'name': string = undefined;

+ 10 - 0
src/service/platform/support.service.ts

@@ -0,0 +1,10 @@
+import { Provide } from '@midwayjs/core';
+import { InjectEntityModel } from '@midwayjs/typeorm';
+import { Repository } from 'typeorm';
+import { Support } from '../../entity/platform/support.entity';
+import { BaseService } from '../../frame/BaseService';
+@Provide()
+export class SupportService extends BaseService<Support> {
+  @InjectEntityModel(Support)
+  model: Repository<Support>;
+}