Jelajahi Sumber

添加成果评价表

zs 2 tahun lalu
induk
melakukan
d5ffd31626

+ 89 - 0
src/controller/achieveApply.controller.ts

@@ -0,0 +1,89 @@
+import {
+  Body,
+  Controller,
+  Del,
+  Get,
+  Inject,
+  Param,
+  Post,
+  Query,
+} from '@midwayjs/decorator';
+import { BaseController } from 'free-midway-component';
+import { AchieveApplyService } from '../service/achieveApply.service';
+import {
+  CDTO_achieveApply,
+  CVO_achieveApply,
+  FVO_achieveApply,
+  QDTO_achieveApply,
+  QVO_achieveApply,
+  UDTO_achieveApply,
+  UVAO_achieveApply,
+} from '../interface/achieveApply.interface';
+import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
+import { Validate } from '@midwayjs/validate';
+@ApiTags(['成果申请表'])
+@Controller('/achieveApply')
+export class AchieveApplyController extends BaseController {
+  @Inject()
+  service: AchieveApplyService;
+
+  @Post('/')
+  @Validate()
+  @ApiResponse({ type: CVO_achieveApply })
+  async create(@Body() data: CDTO_achieveApply) {
+    const dbData = await this.service.create(data);
+    const result = new CVO_achieveApply(dbData);
+    return result;
+  }
+  @Get('/')
+  @ApiQuery({ name: 'query' })
+  @ApiResponse({ type: QVO_achieveApply })
+  async query(
+    @Query() filter: QDTO_achieveApply,
+    @Query('skip') skip: number,
+    @Query('limit') limit: number
+  ) {
+    const list = await this.service.query(filter, { skip, limit });
+    const data = [];
+    for (const i of list) {
+      const newData = new QVO_achieveApply(i);
+      data.push(newData);
+    }
+    const total = await this.service.count(filter);
+    return { data, total };
+  }
+
+  @Get('/:id')
+  @ApiResponse({ type: FVO_achieveApply })
+  async fetch(@Param('id') id: string) {
+    const data = await this.service.fetch(id);
+    const result = new FVO_achieveApply(data);
+    return result;
+  }
+
+  @Post('/:id')
+  @Validate()
+  @ApiResponse({ type: UVAO_achieveApply })
+  async update(@Param('id') id: string, @Body() body: UDTO_achieveApply) {
+    const result = await this.service.updateOne(id, body);
+    return result;
+  }
+
+  @Del('/:id')
+  @Validate()
+  async delete(@Param('id') id: string) {
+    await this.service.delete(id);
+    return 'ok';
+  }
+  async createMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async updateMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+
+  async deleteMany(...args: any[]) {
+    throw new Error('Method not implemented.');
+  }
+}

+ 159 - 0
src/entity/achieveApply.entity.ts

@@ -0,0 +1,159 @@
+import { modelOptions, prop } from '@typegoose/typegoose';
+import { BaseModel } from 'free-midway-component';
+@modelOptions({
+  schemaOptions: { collection: 'achieveApply' },
+})
+export class AchieveApply extends BaseModel {
+  @prop({ required: false, index: true, zh: '用户id' })
+  user_id: string;
+  @prop({
+    required: false,
+    index: true,
+    zh: '状态',
+    remark: '字典表:achieve_apply_status',
+    default: '0',
+  })
+  status: string;
+  @prop({ required: false, index: true, zh: '成果编号' })
+  num: string;
+  @prop({ required: false, index: true, zh: '成果名称' })
+  name: string;
+  @prop({
+    required: false,
+    index: false,
+    zh: '成果类型',
+    remark: '字典表:achieve_apply_type',
+  })
+  type: Array<any>;
+  @prop({
+    required: false,
+    index: false,
+    zh: '成果形式',
+    remark: '字典表:achieve_apply_form',
+  })
+  form: Array<any>;
+  @prop({ required: false, index: true, zh: '成果取得时间' })
+  get_time: string;
+  @prop({ required: false, index: true, zh: '申请人' })
+  apply_personal: string;
+  @prop({ required: false, index: true, zh: '申请人手机号' })
+  apply_phone: string;
+  @prop({ required: false, index: true, zh: '申请人单位' })
+  apply_company: string;
+  @prop({ required: false, index: true, zh: '联系地址' })
+  apply_address: string;
+  @prop({
+    required: false,
+    index: true,
+    zh: '申请人/申请单位属性',
+    remark: '字典表:achieve_apply_nature',
+  })
+  apply_nature: string;
+  @prop({ required: false, index: true, zh: '联系人' })
+  contact: string;
+  @prop({ required: false, index: true, zh: '手机号' })
+  phone: string;
+  @prop({ required: false, index: true, zh: '电子邮箱' })
+  email: string;
+  @prop({ required: false, index: false, zh: '传真' })
+  fax: string;
+  @prop({
+    required: false,
+    index: false,
+    zh: '评价目的',
+    remark: '字典表:achieve_apply_objective',
+  })
+  objective: string;
+  @prop({
+    required: false,
+    index: false,
+    zh: '成果所处阶段',
+    remark: '字典表:achieve_apply_stage',
+  })
+  stage: string;
+  @prop({ required: false, index: false, zh: '成果的影响及作用' })
+  influence: string;
+  @prop({
+    required: false,
+    index: false,
+    zh: '经济效益',
+    remark:
+      '经济效益产值output,经济效益利润profit,经济效益税收revenue,社会效益shxy',
+  })
+  benefit: object;
+  @prop({
+    required: false,
+    index: false,
+    zh: '其他信息',
+    remark: '吉发号jfh,第几号num,签字sign,所在地address,邮编yb,隶属ls',
+  })
+  other: object;
+  @prop({
+    required: false,
+    index: false,
+    zh: '参加单位',
+    remark:
+      '参加单位1one_name,参加单位1所在地one_address,参加单位2two_name,参加单位2所在地two_address',
+  })
+  part_company: object;
+  @prop({
+    required: false,
+    index: false,
+    zh: '国家奖励',
+    remark: '国家奖励项num,国家奖励名称name,国家奖励等级grade',
+  })
+  gj_reward: object;
+  @prop({
+    required: false,
+    index: false,
+    zh: '省级奖励',
+    remark: '省级奖励项num,省级奖励名称name,省级奖励等级grade',
+  })
+  sj_reward: object;
+  @prop({
+    required: false,
+    index: false,
+    zh: '国家计划',
+    remark: '国家计划项num,国家计划经费money',
+  })
+  gj_plan: object;
+  @prop({
+    required: false,
+    index: false,
+    zh: '省级计划',
+    remark: '省级计划项num,省级计划经费money',
+  })
+  sj_plan: object;
+  @prop({
+    required: false,
+    index: false,
+    zh: '内容简介',
+    remark:
+      '  成果简介:blurb     应用领域和技术原理:field     性能指标:kpi_index     与国内外同类技术比较:compare     成果的创造性,先进性:advanced     作用意义:sense【string】     推广应用的范围,条件和前景:prospect     存在的问题和改进意见:opinion',
+  })
+  brief: object;
+  @prop({
+    required: false,
+    index: false,
+    zh: '主研人员名单',
+    remark:
+      ' 姓名:name    性别:gender    身份证号:card    出生年月日:birth    年龄:age    手机号:phone    电子邮箱:email    文化程度:education    学位:degree    从事专业:major    职务:zw    职称:zc    工作单位:company    是否留学归国:is_abroad    项目中所承担的主要工作:work    对成果创造性贡献:devote',
+  })
+  research: Array<any>;
+  @prop({
+    required: false,
+    index: false,
+    zh: '委托方提供资料清单',
+    remark:
+      '工作报告(必备):work   技术报告(必备):techol   国内外对比报告(必备):compare   经济效益分析(必备):benefit   科技查新报告(必备):science   技术检测报告:detect   用户证明:prove   专利证书:patetncert   软件著作权:software   论文:treatise   工法:gf   企业标准等证明材料:standard',
+  })
+  data_list: object;
+  @prop({
+    required: false,
+    index: false,
+    zh: '其他文件',
+    remark:
+      '现场测试(检测,测产)意见:scene 评价意见:desc 评价专家组名单:nameList',
+  })
+  other_file: object;
+}

+ 246 - 0
src/interface/achieveApply.interface.ts

@@ -0,0 +1,246 @@
+import { Rule, RuleType } from '@midwayjs/validate';
+import { ApiProperty } from '@midwayjs/swagger';
+import { SearchBase } from 'free-midway-component';
+import get = require('lodash/get');
+const dealVO = (cla, data) => {
+  for (const key in cla) {
+    const val = get(data, key);
+    if (val || val === 0) cla[key] = val;
+  }
+};
+export class FVO_achieveApply {
+  constructor(data: object) {
+    dealVO(this, data);
+  }
+  @ApiProperty({ description: '数据id' })
+  _id: string = undefined;
+  @ApiProperty({ description: '用户id' })
+  'user_id': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+  @ApiProperty({ description: '成果编号' })
+  'num': string = undefined;
+  @ApiProperty({ description: '成果名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '成果类型' })
+  'type': Array<any> = undefined;
+  @ApiProperty({ description: '成果形式' })
+  'form': Array<any> = undefined;
+  @ApiProperty({ description: '成果取得时间' })
+  'get_time': string = undefined;
+  @ApiProperty({ description: '申请人' })
+  'apply_personal': string = undefined;
+  @ApiProperty({ description: '申请人手机号' })
+  'apply_phone': string = undefined;
+  @ApiProperty({ description: '申请人单位' })
+  'apply_company': string = undefined;
+  @ApiProperty({ description: '联系地址' })
+  'apply_address': string = undefined;
+  @ApiProperty({ description: '申请人/申请单位属性' })
+  'apply_nature': string = undefined;
+  @ApiProperty({ description: '联系人' })
+  'contact': string = undefined;
+  @ApiProperty({ description: '手机号' })
+  'phone': string = undefined;
+  @ApiProperty({ description: '电子邮箱' })
+  'email': string = undefined;
+  @ApiProperty({ description: '传真' })
+  'fax': string = undefined;
+  @ApiProperty({ description: '评价目的' })
+  'objective': string = undefined;
+  @ApiProperty({ description: '成果所处阶段' })
+  'stage': string = undefined;
+  @ApiProperty({ description: '成果的影响及作用' })
+  'influence': string = undefined;
+  @ApiProperty({ description: '经济效益' })
+  'benefit': object = undefined;
+  @ApiProperty({ description: '其他信息' })
+  'other': object = undefined;
+  @ApiProperty({ description: '参加单位' })
+  'part_company': object = undefined;
+  @ApiProperty({ description: '国家奖励' })
+  'gj_reward': object = undefined;
+  @ApiProperty({ description: '省级奖励' })
+  'sj_reward': object = undefined;
+  @ApiProperty({ description: '国家计划' })
+  'gj_plan': object = undefined;
+  @ApiProperty({ description: '省级计划' })
+  'sj_plan': object = undefined;
+  @ApiProperty({ description: '内容简介' })
+  'brief': object = undefined;
+  @ApiProperty({ description: '主研人员名单' })
+  'research': Array<any> = undefined;
+  @ApiProperty({ description: '委托方提供资料清单' })
+  'data_list': object = undefined;
+  @ApiProperty({ description: '其他文件' })
+  'other_file': object = undefined;
+}
+
+export class QDTO_achieveApply extends SearchBase {
+  constructor() {
+    const like_prop = [];
+    const props = [
+      'user_id',
+      'status',
+      'num',
+      'name',
+      'get_time',
+      'apply_personal',
+      'apply_phone',
+      'apply_company',
+      'apply_address',
+      'apply_nature',
+      'contact',
+      'phone',
+      'email',
+    ];
+    const mapping = [];
+    super({ like_prop, props, mapping });
+  }
+  @ApiProperty({ description: '用户id' })
+  'user_id': string = undefined;
+  @ApiProperty({ description: '状态' })
+  'status': string = undefined;
+  @ApiProperty({ description: '成果编号' })
+  'num': string = undefined;
+  @ApiProperty({ description: '成果名称' })
+  'name': string = undefined;
+  @ApiProperty({ description: '成果取得时间' })
+  'get_time': string = undefined;
+  @ApiProperty({ description: '申请人' })
+  'apply_personal': string = undefined;
+  @ApiProperty({ description: '申请人手机号' })
+  'apply_phone': string = undefined;
+  @ApiProperty({ description: '申请人单位' })
+  'apply_company': string = undefined;
+  @ApiProperty({ description: '联系地址' })
+  'apply_address': string = undefined;
+  @ApiProperty({ description: '申请人/申请单位属性' })
+  'apply_nature': string = undefined;
+  @ApiProperty({ description: '联系人' })
+  'contact': string = undefined;
+  @ApiProperty({ description: '手机号' })
+  'phone': string = undefined;
+  @ApiProperty({ description: '电子邮箱' })
+  'email': string = undefined;
+}
+
+export class QVO_achieveApply extends FVO_achieveApply {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class CDTO_achieveApply {
+  @ApiProperty({ description: '用户id' })
+  @Rule(RuleType['string']().empty(''))
+  'user_id': string = undefined;
+  @ApiProperty({ description: '状态' })
+  @Rule(RuleType['string']().empty(''))
+  'status': string = undefined;
+  @ApiProperty({ description: '成果编号' })
+  @Rule(RuleType['string']().empty(''))
+  'num': string = undefined;
+  @ApiProperty({ description: '成果名称' })
+  @Rule(RuleType['string']().empty(''))
+  'name': string = undefined;
+  @ApiProperty({ description: '成果类型' })
+  @Rule(RuleType['array']().empty(''))
+  'type': Array<any> = undefined;
+  @ApiProperty({ description: '成果形式' })
+  @Rule(RuleType['array']().empty(''))
+  'form': Array<any> = undefined;
+  @ApiProperty({ description: '成果取得时间' })
+  @Rule(RuleType['string']().empty(''))
+  'get_time': string = undefined;
+  @ApiProperty({ description: '申请人' })
+  @Rule(RuleType['string']().empty(''))
+  'apply_personal': string = undefined;
+  @ApiProperty({ description: '申请人手机号' })
+  @Rule(RuleType['string']().empty(''))
+  'apply_phone': string = undefined;
+  @ApiProperty({ description: '申请人单位' })
+  @Rule(RuleType['string']().empty(''))
+  'apply_company': string = undefined;
+  @ApiProperty({ description: '联系地址' })
+  @Rule(RuleType['string']().empty(''))
+  'apply_address': string = undefined;
+  @ApiProperty({ description: '申请人/申请单位属性' })
+  @Rule(RuleType['string']().empty(''))
+  'apply_nature': string = undefined;
+  @ApiProperty({ description: '联系人' })
+  @Rule(RuleType['string']().empty(''))
+  'contact': string = undefined;
+  @ApiProperty({ description: '手机号' })
+  @Rule(RuleType['string']().empty(''))
+  'phone': string = undefined;
+  @ApiProperty({ description: '电子邮箱' })
+  @Rule(RuleType['string']().empty(''))
+  'email': string = undefined;
+  @ApiProperty({ description: '传真' })
+  @Rule(RuleType['string']().empty(''))
+  'fax': string = undefined;
+  @ApiProperty({ description: '评价目的' })
+  @Rule(RuleType['string']().empty(''))
+  'objective': string = undefined;
+  @ApiProperty({ description: '成果所处阶段' })
+  @Rule(RuleType['string']().empty(''))
+  'stage': string = undefined;
+  @ApiProperty({ description: '成果的影响及作用' })
+  @Rule(RuleType['string']().empty(''))
+  'influence': string = undefined;
+  @ApiProperty({ description: '经济效益' })
+  @Rule(RuleType['object']().empty(''))
+  'benefit': object = undefined;
+  @ApiProperty({ description: '其他信息' })
+  @Rule(RuleType['object']().empty(''))
+  'other': object = undefined;
+  @ApiProperty({ description: '参加单位' })
+  @Rule(RuleType['object']().empty(''))
+  'part_company': object = undefined;
+  @ApiProperty({ description: '国家奖励' })
+  @Rule(RuleType['object']().empty(''))
+  'gj_reward': object = undefined;
+  @ApiProperty({ description: '省级奖励' })
+  @Rule(RuleType['object']().empty(''))
+  'sj_reward': object = undefined;
+  @ApiProperty({ description: '国家计划' })
+  @Rule(RuleType['object']().empty(''))
+  'gj_plan': object = undefined;
+  @ApiProperty({ description: '省级计划' })
+  @Rule(RuleType['object']().empty(''))
+  'sj_plan': object = undefined;
+  @ApiProperty({ description: '内容简介' })
+  @Rule(RuleType['object']().empty(''))
+  'brief': object = undefined;
+  @ApiProperty({ description: '主研人员名单' })
+  @Rule(RuleType['array']().empty(''))
+  'research': Array<any> = undefined;
+  @ApiProperty({ description: '委托方提供资料清单' })
+  @Rule(RuleType['object']().empty(''))
+  'data_list': object = undefined;
+  @ApiProperty({ description: '其他文件' })
+  @Rule(RuleType['object']().empty(''))
+  'other_file': object = undefined;
+}
+
+export class CVO_achieveApply extends FVO_achieveApply {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}
+
+export class UDTO_achieveApply extends CDTO_achieveApply {
+  @ApiProperty({ description: '数据id' })
+  @Rule(RuleType['string']().empty(''))
+  _id: string = undefined;
+}
+
+export class UVAO_achieveApply extends FVO_achieveApply {
+  constructor(data: object) {
+    super(data);
+    dealVO(this, data);
+  }
+}

+ 11 - 0
src/service/achieveApply.service.ts

@@ -0,0 +1,11 @@
+import { Provide } from '@midwayjs/decorator';
+import { InjectEntityModel } from '@midwayjs/typegoose';
+import { ReturnModelType } from '@typegoose/typegoose';
+import { BaseService } from 'free-midway-component';
+import { AchieveApply } from '../entity/achieveApply.entity';
+type modelType = ReturnModelType<typeof AchieveApply>;
+@Provide()
+export class AchieveApplyService extends BaseService<modelType> {
+  @InjectEntityModel(AchieveApply)
+  model: modelType;
+}