Bladeren bron

修改信息

zs 8 maanden geleden
bovenliggende
commit
9a32deab63
2 gewijzigde bestanden met toevoegingen van 25 en 11 verwijderingen
  1. 19 10
      src/public/importMapping.ts
  2. 6 1
      src/service/util.service.ts

+ 19 - 10
src/public/importMapping.ts

@@ -82,16 +82,25 @@ const company = [
   { index: 4, field: 'representative', zh: '法定代表人' },
   { index: 5, field: 'email', zh: '电子邮箱' },
   { index: 6, field: 'person', zh: '员工人数', type: 'number' },
-  { index: 7, field: 'register', zh: '注册资本' },
-  { index: 8, field: 'create_time', type: 'date', zh: '成立时间' },
-  { index: 9, field: 'pattern', type: 'dict', code: 'pattern', zh: '企业类型' },
-  { index: 10, field: 'scale', type: 'dict', code: 'scale', zh: '企业规模' },
-  { index: 11, field: 'type', type: 'dict', code: 'type', zh: '所属行业' },
-  { index: 12, field: 'area', type: 'area', zh: '地区' },
-  { index: 13, field: 'phone', zh: '联系电话' },
-  { index: 14, field: 'address', zh: '地址' },
-  { index: 15, field: 'products', zh: '产品' },
-  { index: 16, field: 'brief', zh: '简介' },
+  { index: 7, field: 'graduate_num', zh: '硕士研究生人数', type: 'number' },
+  { index: 8, field: 'doctor_num', zh: '博士人数', type: 'number' },
+  { index: 9, field: 'returnee_num', zh: '海归人数', type: 'number' },
+  { index: 10, field: 'person', zh: '知识产权数', type: 'number' },
+  { index: 11, field: 'knowledge', zh: '发明专利数', type: 'number' },
+  { index: 12, field: 'utility', zh: '实用新型数', type: 'number' },
+  { index: 13, field: 'copyright', zh: '软件著作权数', type: 'number' },
+  { index: 14, field: 'is_tech', zh: '是否为高新技术企业', type: 'dict', code: 'isUse' },
+  { index: 15, field: 'is_new', zh: '是否为专精特新企业', type: 'dict', code: 'isUse' },
+  { index: 16, field: 'register', zh: '注册资本' },
+  { index: 17, field: 'create_time', type: 'date', zh: '成立时间' },
+  { index: 18, field: 'pattern', type: 'dict', code: 'pattern', zh: '企业类型' },
+  { index: 19, field: 'scale', type: 'dict', code: 'scale', zh: '企业规模' },
+  { index: 20, field: 'type', type: 'dict', code: 'type', zh: '所属行业' },
+  { index: 21, field: 'area', type: 'area', zh: '地区' },
+  { index: 22, field: 'phone', zh: '联系电话' },
+  { index: 23, field: 'address', zh: '地址' },
+  { index: 24, field: 'products', zh: '产品' },
+  { index: 25, field: 'brief', zh: '简介' },
 ];
 
 export { achievement, project, demand, supply, company };

+ 6 - 1
src/service/util.service.ts

@@ -16,6 +16,7 @@ import * as mappings from '../public/importMapping';
 import * as Excel from 'exceljs';
 import * as Path from 'path';
 import * as fs from 'fs';
+import { User } from '../entity/system/user.entity';
 /**
  * 工具类服务,为其他地方提供一些通用的函数
  */
@@ -26,6 +27,8 @@ export class UtilService {
   @Inject()
   userService: UserService;
 
+  @InjectEntityModel(User)
+  userModel: Repository<User>;
   @InjectEntityModel(Achievement)
   achievementModel: Repository<Achievement>;
   @InjectEntityModel(Project)
@@ -274,7 +277,9 @@ export class UtilService {
         }
       } else {
         try {
-          await this.companyModel.insert({ ...i, user: user_id, status: '0' });
+          const userInfo = await this.userModel.insert({ account: name, nick_name: name, password: '123456', gender: '0', role: ['User', 'Company'], status: '1' });
+          const id = get(userInfo, 'identifiers.0.id');
+          await this.companyModel.insert({ ...i, user: id, status: '0' });
         } catch (error) {
           const namek = Object.keys(error.errors)[0];
           const mapping = mappingList.find(i => i.field === namek);