zs пре 9 месеци
родитељ
комит
fca8b6381c

+ 1 - 0
src/controller/platform/score.controller.ts

@@ -41,6 +41,7 @@ export class ScoreController implements BaseController {
   @Validate()
   @ApiResponse({ type: CVO_score })
   async create(@Body() data: object) {
+    await this.service.createExamine(data);
     const dbData = await this.service.create(data);
     const result = new CVO_score(dbData);
     return result;

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

@@ -11,6 +11,8 @@ export class Notes extends BaseModel {
   file: Array<any>;
   @Column({ type: 'character varying', nullable: true, comment: '简介' })
   brief: string;
+  @Column({ type: 'character varying', nullable: true, comment: '内容' })
+  content: string;
   @Column({ type: 'character varying', nullable: true, comment: '是否使用', default: '0' })
   is_use: string;
   @Column({ type: 'character varying', nullable: true, comment: '状态', default: '0' })

+ 15 - 3
src/entity/platform/sector.entity.ts

@@ -5,18 +5,30 @@ import { BaseModel } from '../../frame/BaseModel';
 export class Sector extends BaseModel {
   @Column({ type: 'character varying', nullable: true, comment: '标题' })
   title: string;
-  @Column({ type: 'character varying', nullable: true, comment: '路由' })
+  @Column({ type: 'character varying', nullable: true, comment: '合作方链接渠道' })
   href: string;
   @Column({ type: 'jsonb', nullable: true, comment: '背景图', default: [] })
   file: Array<any>;
+  @Column({ type: 'jsonb', nullable: true, comment: '轮播图', default: [] })
+  carousel: Array<any>;
   @Column({ type: 'jsonb', nullable: true, comment: '合作伙伴', default: [] })
   partner: Array<any>;
+  @Column({ type: 'jsonb', nullable: true, comment: '企业成员', default: [] })
+  companyPerson: Array<any>;
+  @Column({ type: 'jsonb', nullable: true, comment: '新闻', default: [] })
+  news: Array<any>;
+  @Column({ type: 'integer', nullable: true, comment: '专家数' })
+  expertNum: number;
   @Column({ type: 'integer', nullable: true, comment: '排序' })
   sort: number;
   @Column({ type: 'character varying', nullable: true, comment: '简介' })
   brief: string;
-  @Column({ type: 'character varying', nullable: true, comment: '备注' })
-  remark: string;
+  @Column({ type: 'character varying', nullable: true, comment: '发展进程' })
+  process: string;
+  @Column({ type: 'character varying', nullable: true, comment: '合作情况' })
+  situation: string;
+  @Column({ type: 'character varying', nullable: true, comment: '重大活动' })
+  activity: string;
   @Column({ type: 'character varying', nullable: true, comment: '是否使用', default: '0' })
   is_use: string;
 }

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

@@ -16,6 +16,8 @@ export class FVO_notes {
   'name': string = undefined;
   @ApiProperty({ description: '简介' })
   'brief': string = undefined;
+  @ApiProperty({ description: '内容' })
+  'content': string = undefined;
   @ApiProperty({ description: '是否使用' })
   'is_use': string = undefined;
   @ApiProperty({ description: '状态' })
@@ -53,6 +55,9 @@ export class CDTO_notes {
   @ApiProperty({ description: '简介' })
   @Rule(RuleType['string']().empty(''))
   'brief': string = undefined;
+  @ApiProperty({ description: '内容' })
+  @Rule(RuleType['string']().empty(''))
+  'content': string = undefined;
   @ApiProperty({ description: '是否使用' })
   @Rule(RuleType['string']().empty(''))
   'is_use': string = undefined;

+ 45 - 13
src/interface/platform/sector.interface.ts

@@ -10,18 +10,30 @@ export class FVO_sector {
   id: number = undefined;
   @ApiProperty({ description: '标题' })
   'title': string = undefined;
-  @ApiProperty({ description: '路由' })
+  @ApiProperty({ description: '合作方链接渠道' })
   'href': string = undefined;
-  @ApiProperty({ description: '排序' })
-  'sort': number = undefined;
-  @ApiProperty({ description: '简介' })
-  'brief': string = undefined;
   @ApiProperty({ description: '背景图片' })
   'file': Array<any> = undefined;
+  @ApiProperty({ description: '轮播图' })
+  'carousel': Array<any> = undefined;
   @ApiProperty({ description: '合作伙伴' })
   'partner': Array<any> = undefined;
-  @ApiProperty({ description: '备注' })
-  'remark': string = undefined;
+  @ApiProperty({ description: '企业成员' })
+  'companyPerson': Array<any> = undefined;
+  @ApiProperty({ description: '新闻' })
+  'news': Array<any> = undefined;
+  @ApiProperty({ description: '专家数' })
+  'expertNum': number = undefined;
+  @ApiProperty({ description: '排序' })
+  'sort': number = undefined;
+  @ApiProperty({ description: '简介' })
+  'brief': string = undefined;
+  @ApiProperty({ description: '发展进程' })
+  'process': string = undefined;
+  @ApiProperty({ description: '合作情况' })
+  'situation': string = undefined;
+  @ApiProperty({ description: '重大活动' })
+  'activity': string = undefined;
   @ApiProperty({ description: '是否使用' })
   'is_use': string = undefined;
 }
@@ -29,6 +41,8 @@ export class FVO_sector {
 export class QDTO_sector extends SearchBase {
   @ApiProperty({ description: '标题' })
   'title': string = undefined;
+  @ApiProperty({ description: '排序' })
+  'sort': number = undefined;
   @ApiProperty({ description: '是否使用' })
   'is_use': string = undefined;
 }
@@ -44,24 +58,42 @@ export class CDTO_sector {
   @ApiProperty({ description: '标题' })
   @Rule(RuleType['string']().empty(''))
   'title': string = undefined;
-  @ApiProperty({ description: '路由' })
+  @ApiProperty({ description: '合作方链接渠道' })
   @Rule(RuleType['string']().empty(''))
   'href': string = undefined;
-  @ApiProperty({ description: '简介' })
-  @Rule(RuleType['string']().empty(''))
-  'brief': string = undefined;
   @ApiProperty({ description: '背景图片' })
   @Rule(RuleType['array']().empty(''))
   'file': Array<any> = undefined;
+  @ApiProperty({ description: '轮播图' })
+  @Rule(RuleType['array']().empty(''))
+  'carousel': Array<any> = undefined;
+  @ApiProperty({ description: '新闻' })
+  @Rule(RuleType['array']().empty(''))
+  'news': Array<any> = undefined;
   @ApiProperty({ description: '合作伙伴' })
   @Rule(RuleType['array']().empty(''))
   'partner': Array<any> = undefined;
+  @ApiProperty({ description: '企业成员' })
+  @Rule(RuleType['array']().empty(''))
+  'companyPerson': Array<any> = undefined;
+  @ApiProperty({ description: '专家数' })
+  @Rule(RuleType['number']().empty(''))
+  'expertNum': number = undefined;
   @ApiProperty({ description: '排序' })
   @Rule(RuleType['number']().empty(''))
   'sort': number = undefined;
-  @ApiProperty({ description: '备注' })
+  @ApiProperty({ description: '简介' })
+  @Rule(RuleType['string']().empty(''))
+  'brief': string = undefined;
+  @ApiProperty({ description: '发展进程' })
+  @Rule(RuleType['string']().empty(''))
+  'process': string = undefined;
+  @ApiProperty({ description: '合作情况' })
+  @Rule(RuleType['string']().empty(''))
+  'situation': string = undefined;
+  @ApiProperty({ description: '重大活动' })
   @Rule(RuleType['string']().empty(''))
-  'remark': string = undefined;
+  'activity': string = undefined;
   @ApiProperty({ description: '是否使用' })
   @Rule(RuleType['string']().empty(''))
   'is_use': string = undefined;

+ 30 - 1
src/service/platform/match.service.ts

@@ -6,6 +6,8 @@ import { BaseServiceV2 } from '../../frame/BaseServiceV2';
 import { ProjectService } from './project.service';
 import { MatchPathService } from './matchPath.service';
 import dayjs = require('dayjs');
+import { ScoreService } from './score.service';
+import { SignService } from './sign.service';
 @Provide()
 export class MatchService extends BaseServiceV2 {
   @InjectEntityModel(Match)
@@ -16,18 +18,45 @@ export class MatchService extends BaseServiceV2 {
 
   @Inject()
   matchService: MatchPathService;
+
+  @Inject()
+  scoreService: ScoreService;
+
+  @Inject()
+  signService: SignService;
+
   getQueryColumnsOpera() {
     const obj = {
       tags: this.Opera.Json,
     };
     return obj;
   }
-  // 赛事完成后,导入项目库,贴 赛事 标签,支持筛选
+  // 赛事进行中第一部创建报名分数
   async updateProject({ id }, data) {
     const builder = this.model.createQueryBuilder();
     this.completeBuilderCondition({ id });
     const match = await builder.getOne();
     if (match && match.match_status === '2') {
+      // 如果赛事改为进行中将赛事流程按排序进行查询
+      const path = await this.matchService.query({ match: id, is_use: '0' }, { order: { order_num: 'ASC' } });
+      if (path && path.total > 0) {
+        // 如果有赛事流程就查询报名信息
+        const sign = await this.signService.query({ match: id, status: '1' });
+        const score = await this.scoreService.query({ match: id, matchPath: path.data[0].id });
+        // 检测该流程的分数 全部删除重新分配
+        if (score && score.total > 0) {
+          for (const val of score.data) {
+            await this.scoreService.delete(val.id);
+          }
+        }
+        // 重新分配分数
+        for (const val of sign.data) {
+          await this.scoreService.create({ match: id, matchPath: path.data[0].id, sign: val.id });
+        }
+      }
+    }
+    // 赛事状态修改为结束 将赛事信息整理存入项目库中
+    if (match && match.match_status === '3') {
       const result = await this.projectService.query({ user: match.user, name: match.name });
       if (result && result.total > 0) {
         await this.projectService.update({ id: result.data[0].id }, { user: match.user, name: match.name, industry: match.industry, tags: ['赛事'], time: dayjs().format('YYYY-MM-DD'), source: '赛事', status: '1' });

+ 9 - 1
src/service/platform/score.service.ts

@@ -1,11 +1,12 @@
 import { Score } from '../../entity/platform/score.entity';
 import { Provide, Inject } from '@midwayjs/core';
 import { InjectEntityModel } from '@midwayjs/typeorm';
-import { Repository } from 'typeorm';
+import { Repository, Equal } from 'typeorm';
 import { BaseServiceV2 } from '../../frame/BaseServiceV2';
 import { get } from 'lodash';
 import { SignService } from './sign.service';
 import { MatchPathService } from './matchPath.service';
+import { ErrorCode, ServiceError } from '../../error/service.error';
 @Provide()
 export class ScoreService extends BaseServiceV2 {
   @InjectEntityModel(Score)
@@ -17,6 +18,13 @@ export class ScoreService extends BaseServiceV2 {
   @Inject()
   signService: SignService;
 
+  // 分数检查
+  async createExamine(data) {
+    const { match, matchPath, sign } = data;
+    const result = await this.model.findOne({ where: { matchPath: Equal(matchPath), sign: Equal(sign), match: Equal(match) } });
+    if (result) throw new ServiceError(ErrorCode.SERVICE_COPY);
+  }
+
   /**
    * 填充赛事信息
    * @param {object} data 数据