UNPKG

evmtools-node

Version:

このライブラリは、プライムブレインズ社で利用している「進捗管理ツール(Excel)」ファイルを読み込み、 プロジェクトの進捗状況や要員別の作業量を可視化するためのライブラリです。

128 lines 5.23 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.ProjectRepositoryImpl = void 0; const excel_csv_read_write_1 = require("excel-csv-read-write"); const common_1 = require("../common"); const styles_1 = require("../common/styles"); const logger_1 = require("../logger"); class ProjectRepositoryImpl { constructor() { this.logger = (0, logger_1.getLogger)('infrastructure/ProjectRepositoryImpl'); } async save(project) { const projectData = project.printAndGetRawData(20); const baseDate = project.baseDate; const projectName = project.name; const statisticsByProject = project.statisticsByProject; const statisticsByName = project.statisticsByName; const pvByProject = project.pvByProject; const pvsByProject = project.pvsByProject; const pvByProjectLong = project.pvByProjectLong; const pvsByProjectLong = project.pvsByProjectLong; const pvByName = project.pvByName; const pvsByName = project.pvsByName; const pvByNameLong = project.pvByNameLong; const pvsByNameLong = project.pvsByNameLong; const path = `${projectName}-summary.xlsx`; const workbook = await (0, excel_csv_read_write_1.createWorkbook)(); const dateStrHyphen = (0, common_1.dateStr)(baseDate).replace(/\//g, '-'); if (statisticsByProject) { this.logger.info('プロジェクト情報'); console.table(statisticsByProject); (0, excel_csv_read_write_1.json2workbook)({ instances: statisticsByProject, workbook, sheetName: `プロジェクト情報`, applyStyles: (0, styles_1.createStyles)(), }); } if (statisticsByName) { this.logger.info('要員ごと統計'); console.table(statisticsByName); (0, excel_csv_read_write_1.json2workbook)({ instances: statisticsByName, workbook, sheetName: '要員ごと統計', applyStyles: (0, styles_1.createStyles)(), }); } if (pvByProjectLong) { (0, excel_csv_read_write_1.json2workbook)({ instances: pvByProjectLong, workbook, sheetName: `プロジェクト日ごとPVLong`, applyStyles: (0, styles_1.createStyles)(), }); } if (pvByProject) { (0, excel_csv_read_write_1.json2workbook)({ instances: pvByProject, workbook, sheetName: `プロジェクト日ごとPV`, applyStyles: (0, styles_1.createStyles)(), }); } if (pvsByProjectLong) { (0, excel_csv_read_write_1.json2workbook)({ instances: pvsByProjectLong, workbook, sheetName: `プロジェクト日ごと累積PVLong`, applyStyles: (0, styles_1.createStyles)(), }); } if (pvsByProject) { (0, excel_csv_read_write_1.json2workbook)({ instances: pvsByProject, workbook, sheetName: `プロジェクト日ごと累積PV`, applyStyles: (0, styles_1.createStyles)(), }); } // 要員でごちゃ混ぜなので、これでいいか要検討。 if (pvByNameLong) { (0, excel_csv_read_write_1.json2workbook)({ instances: pvByNameLong, workbook, sheetName: `要員ごと・日ごとPVLong`, applyStyles: (0, styles_1.createStyles)(), }); } if (pvByName) { (0, excel_csv_read_write_1.json2workbook)({ instances: pvByName, workbook, sheetName: `要員ごと・日ごとPV`, applyStyles: (0, styles_1.createStyles)(), }); } // 要員でごちゃ混ぜなので、これでいいか要検討。 if (pvsByNameLong) { (0, excel_csv_read_write_1.json2workbook)({ instances: pvsByNameLong, workbook, sheetName: `要員ごと・日ごと累積PVLong`, applyStyles: (0, styles_1.createStyles)(), }); } if (pvsByName) { (0, excel_csv_read_write_1.json2workbook)({ instances: pvsByName, workbook, sheetName: `要員ごと・日ごと累積PV`, applyStyles: (0, styles_1.createStyles)(), }); } if (projectData) { (0, excel_csv_read_write_1.json2workbook)({ instances: projectData, workbook, sheetName: `素データ_${dateStrHyphen}`, applyStyles: (0, styles_1.createStyles)(), }); } workbook.deleteSheet('Sheet1'); await (0, excel_csv_read_write_1.toFileAsync)(workbook, path); } } exports.ProjectRepositoryImpl = ProjectRepositoryImpl; //# sourceMappingURL=ProjectRepositoryImpl.js.map