|
@@ -83,7 +83,7 @@ export class IncubatorService extends BaseServiceV2 {
|
|
|
}
|
|
|
return info;
|
|
|
}
|
|
|
-
|
|
|
+ // 查询所有孵化器关联企业的营业收入
|
|
|
async allList(query) {
|
|
|
const { year, incubator, is_use, status } = query;
|
|
|
const builder = await this.cModel.createQueryBuilder('cirelation').select(['cirelation.company']).setFindOptions({ where: { incubator, status } });
|
|
@@ -104,6 +104,37 @@ export class IncubatorService extends BaseServiceV2 {
|
|
|
}
|
|
|
return { nameList, list: [list1, list2, list3] };
|
|
|
}
|
|
|
+
|
|
|
+ // 查询有关孵化企业的领域数量
|
|
|
+ async field(query) {
|
|
|
+ const { incubator, status } = query;
|
|
|
+ const builder = await this.cModel.createQueryBuilder('cirelation').select(['cirelation.company']).setFindOptions({ where: { incubator, status } });
|
|
|
+ const data = await builder.getMany();
|
|
|
+ let list = [];
|
|
|
+ const companyList = [];
|
|
|
+ const nameList = ['生物医药', '化工新材料', '先进装备制造', '高端服务', '光电子', '电子信息'];
|
|
|
+ for (const val of data) {
|
|
|
+ const company = await this.companyService.fetch({ id: get(val, 'company') });
|
|
|
+ if (get(company, 'industry')) {
|
|
|
+ const info = { value: 0, name: get(company, 'industry') };
|
|
|
+ for (const tags of nameList) {
|
|
|
+ if (get(company, 'industry') === tags) info.value = info.value + 1;
|
|
|
+ }
|
|
|
+ companyList.push(info);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ list = companyList.reduce((accumulator, currentItem) => {
|
|
|
+ const existingItem = accumulator.find(item => item.name === currentItem.name);
|
|
|
+ if (existingItem) {
|
|
|
+ existingItem.value += currentItem.value;
|
|
|
+ } else {
|
|
|
+ accumulator.push({ ...currentItem });
|
|
|
+ }
|
|
|
+ return accumulator;
|
|
|
+ }, []);
|
|
|
+ return { nameList, list };
|
|
|
+ }
|
|
|
+
|
|
|
// 孵化器专属企业查询
|
|
|
async list(query) {
|
|
|
const { skip = 0, limit = 0, is_tech, is_new, ...info } = query;
|