|
@@ -67,13 +67,19 @@ export class UtilService {
|
|
|
}
|
|
|
|
|
|
@InjectEntityModel(Demand)
|
|
|
- model: Repository<Demand>;
|
|
|
+ demandModel: Repository<Demand>;
|
|
|
+ @InjectEntityModel(Achievement)
|
|
|
+ achievementModel: Repository<Achievement>;
|
|
|
+ @InjectEntityModel(Expert)
|
|
|
+ expertModel: Repository<Expert>;
|
|
|
async initData() {
|
|
|
console.log('in initData');
|
|
|
- return this.importRequirementFromExcel();
|
|
|
+ await this.importRequirementFromExcel();
|
|
|
+ // await this.importAchieveFromExcel();
|
|
|
+ // await this.importExpertFromExcel();
|
|
|
}
|
|
|
async importRequirementFromExcel() {
|
|
|
- const path = 'E:/workspace/产学研用/项目数据资料/项目数据资料/需求库.xlsx';
|
|
|
+ const path = 'C:/document/需求库.xlsx';
|
|
|
const wb = new Excel.Workbook();
|
|
|
await wb.xlsx.readFile(path);
|
|
|
const sheet = wb.getWorksheet(1);
|
|
@@ -205,7 +211,7 @@ export class UtilService {
|
|
|
allData.push(obj);
|
|
|
}
|
|
|
});
|
|
|
- const res = await this.model.insert(allData);
|
|
|
+ const res = await this.demandModel.insert(allData);
|
|
|
return res;
|
|
|
}
|
|
|
|
|
@@ -221,7 +227,7 @@ export class UtilService {
|
|
|
}
|
|
|
|
|
|
async importAchieveFromExcel() {
|
|
|
- const path = 'E:/workspace/产学研用/项目数据资料/项目数据资料/成果库.xlsx';
|
|
|
+ const path = 'C:/document/成果库.xlsx';
|
|
|
const wb = new Excel.Workbook();
|
|
|
await wb.xlsx.readFile(path);
|
|
|
const sheet = wb.getWorksheet(1);
|
|
@@ -240,7 +246,7 @@ export class UtilService {
|
|
|
allData.push(obj);
|
|
|
}
|
|
|
});
|
|
|
- return await this.model.insert(allData);
|
|
|
+ return await this.achievementModel.insert(allData);
|
|
|
}
|
|
|
achieveMeta() {
|
|
|
return {
|
|
@@ -253,8 +259,8 @@ export class UtilService {
|
|
|
};
|
|
|
}
|
|
|
|
|
|
- async importExportFromExcel() {
|
|
|
- const path = 'E:/workspace/产学研用/项目数据资料/项目数据资料/专家库docx.xlsx';
|
|
|
+ async importExpertFromExcel() {
|
|
|
+ const path = 'C:/document/专家库.xlsx';
|
|
|
const wb = new Excel.Workbook();
|
|
|
await wb.xlsx.readFile(path);
|
|
|
const sheet = wb.getWorksheet(1);
|
|
@@ -274,7 +280,7 @@ export class UtilService {
|
|
|
});
|
|
|
allData.push(obj);
|
|
|
}
|
|
|
- const res = await this.model.insert(allData);
|
|
|
+ const res = await this.expertModel.insert(allData);
|
|
|
return res;
|
|
|
}
|
|
|
|