zs há 1 ano atrás
pai
commit
9e640d3093

+ 0 - 0
npm


+ 1 - 1
src/controller/analysis.controller.ts

@@ -64,7 +64,7 @@ export class AnalysisController extends BaseController {
   @Post('/:id')
   @Validate()
   @ApiResponse({ type: UVAO_analysis })
-  async update(@Param('id') id: string, @Body() body: UDTO_analysis) {
+  async update(@Param('id') id: string, @Body() body: any) {
     const result = await this.service.updateOne(id, body);
     return result;
   }

+ 2 - 2
src/controller/apply.controller.ts

@@ -16,7 +16,7 @@ import {
   FVO_apply,
   QDTO_apply,
   QVO_apply,
-  UDTO_apply,
+  // UDTO_apply,
   UVAO_apply,
 } from '../interface/apply.interface';
 import { ApiResponse, ApiTags, ApiQuery } from '@midwayjs/swagger';
@@ -64,7 +64,7 @@ export class ApplyController extends BaseController {
   @Post('/:id')
   @Validate()
   @ApiResponse({ type: UVAO_apply })
-  async update(@Param('id') id: string, @Body() body: UDTO_apply) {
+  async update(@Param('id') id: string, @Body() body: any) {
     const result = await this.service.update(id, body);
     return result;
   }

+ 0 - 2
src/entity/apply.entity.ts

@@ -79,6 +79,4 @@ export class Apply extends BaseModel {
   techol_alter: string;
   @prop({ required: false, index: false, zh: '审核记录' })
   record: Array<any>;
-  @prop({ required: false, index: false, zh: '审核意见' })
-  desc: string;
 }

+ 0 - 5
src/interface/apply.interface.ts

@@ -68,8 +68,6 @@ export class FVO_apply {
   'techol_alter': string = undefined;
   @ApiProperty({ description: '审核记录' })
   'record': Array<any> = undefined;
-  @ApiProperty({ description: '审核意见' })
-  'desc': string = undefined;
 }
 
 export class QDTO_apply extends SearchBase {
@@ -212,9 +210,6 @@ export class CDTO_apply {
   @ApiProperty({ description: '审核记录' })
   @Rule(RuleType['array']().empty(''))
   'record': Array<any> = undefined;
-  @ApiProperty({ description: '审核意见' })
-  @Rule(RuleType['string']().empty(''))
-  'desc': string = undefined;
 }
 
 export class CVO_apply extends FVO_apply {

+ 111 - 0
src/service/analysis.service.ts

@@ -3,9 +3,120 @@ import { InjectEntityModel } from '@midwayjs/typegoose';
 import { ReturnModelType } from '@typegoose/typegoose';
 import { BaseService } from 'free-midway-component';
 import { Analysis } from '../entity/analysis.entity';
+import { ExamNotice } from '../entity/examNotice.entity';
+const moment = require('moment');
 type modelType = ReturnModelType<typeof Analysis>;
 @Provide()
 export class AnalysisService extends BaseService<modelType> {
   @InjectEntityModel(Analysis)
   model: modelType;
+
+  @InjectEntityModel(ExamNotice)
+  examModel: ReturnModelType<typeof ExamNotice>;
+
+  //添加处理数据
+  async create(body) {
+    const { status, user_id, admin_id, user_name, name } = body;
+    if (status === '0') {
+      const info = {
+        status: status,
+        create_time: moment().format('YYYY-MM-DD HH:mm:ss'),
+        save_id: user_id,
+        save_name: user_name,
+        content: `${user_name}提交了${name}专利的查新检索交底单,请及时查看并处理`,
+      };
+      if (body.record) body.record.push(info);
+      else body.record = [info];
+      const exam = {
+        send_id: user_id,
+        send_date: info.create_time,
+        receive_id: admin_id,
+        content: info.content,
+        is_read: '0',
+      };
+      await this.examModel.create(exam);
+    }
+    const res = await this.model.create(body);
+    return res;
+  }
+
+  // 修改处理数据
+  async update(id, body) {
+    const { status, user_id, user_name, name, admin_id, admin_name, desc } =
+      body;
+    if (status === '0') {
+      const info = {
+        status: status,
+        create_time: moment().format('YYYY-MM-DD HH:mm:ss'),
+        save_id: user_id,
+        save_name: user_name,
+        content: `${user_name}提交了${name}专利的查新检索交底单,请及时查看并处理`,
+      };
+      if (body.record) body.record.push(info);
+      else body.record = [info];
+      const exam = {
+        send_id: user_id,
+        send_date: info.create_time,
+        receive_id: admin_id,
+        content: info.content,
+        is_read: '0',
+      };
+      await this.examModel.create(exam);
+    } else if (status === '1' || status === '2') {
+      const info = {
+        status: status,
+        create_time: moment().format('YYYY-MM-DD HH:mm:ss'),
+        save_id: admin_id,
+        save_name: admin_name,
+        content: `${user_name}提交了${name}专利的查新检索交底单已经审核完成,审核意见:${desc},请及时查看审核通知消息`,
+      };
+      if (body.record) body.record.push(info);
+      else body.record = [info];
+      const exam = {
+        send_id: admin_id,
+        send_date: info.create_time,
+        receive_id: user_id,
+        content: info.content,
+        is_read: '0',
+      };
+      await this.examModel.create(exam);
+    } else if (status === '3') {
+      const info = {
+        status: status,
+        create_time: moment().format('YYYY-MM-DD HH:mm:ss'),
+        save_id: admin_id,
+        save_name: admin_name,
+        content: `${user_name}提交了${name}专利的查新检索交底单已发报告,请及时查看审核通知消息`,
+      };
+      if (body.record) body.record.push(info);
+      else body.record = [info];
+      const exam = {
+        send_id: admin_id,
+        send_date: info.create_time,
+        receive_id: user_id,
+        content: info.content,
+        is_read: '0',
+      };
+      await this.examModel.create(exam);
+    } else if (status === '4') {
+      const info: any = {
+        status: status,
+        create_time: moment().format('YYYY-MM-DD HH:mm:ss'),
+        save_id: user_id,
+        save_name: user_name,
+        content: `${user_name}提交了${name}专利的查新检索交底单,审核意见:${desc},报告已接收`,
+      };
+      if (body.record) body.record.push(info);
+      else body.record = [info];
+      const exam = {
+        send_id: user_id,
+        send_date: info.create_time,
+        receive_id: admin_id,
+        content: info.content,
+        is_read: '0',
+      };
+      await this.examModel.create(exam);
+    }
+    await this.model.updateOne({ _id: id }, body);
+  }
 }

+ 21 - 1
src/service/apply.service.ts

@@ -39,6 +39,8 @@ export class ApplyService extends BaseService<modelType> {
     const res = await this.model.create(body);
     return res;
   }
+
+  // 修改处理数据
   async update(id, body) {
     const {
       status,
@@ -51,7 +53,25 @@ export class ApplyService extends BaseService<modelType> {
       admin_name,
       desc,
     } = body;
-    if (status === '1' || status === '2') {
+    if (status === '0') {
+      const info = {
+        status: status,
+        create_time: moment().format('YYYY-MM-DD HH:mm:ss'),
+        save_id: user_id,
+        save_name: user_name,
+        content: `${user_name}提交了${name}专利审批单,请及时查看并处理`,
+      };
+      if (body.record) body.record.push(info);
+      else body.record = [info];
+      const exam = {
+        send_id: user_id,
+        send_date: info.create_time,
+        receive_id: mech_id,
+        content: info.content,
+        is_read: '0',
+      };
+      await this.examModel.create(exam);
+    } else if (status === '1' || status === '2') {
       const info = {
         status: status,
         create_time: moment().format('YYYY-MM-DD HH:mm:ss'),