From 58ca2011cfdf46530634f7d9eb67618aa6726e59 Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Tue, 18 Aug 2026 14:42:17 +0900 Subject: [PATCH 1/4] =?UTF-8?q?260818=5F04=5FENH:=20=EB=8D=B0=EC=9D=B4?= =?UTF-8?q?=ED=84=B0=20=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- upload-data/epolicy-data-w2601.xlsx | Bin 39174 -> 39169 bytes 1 file changed, 0 insertions(+), 0 deletions(-) diff --git a/upload-data/epolicy-data-w2601.xlsx b/upload-data/epolicy-data-w2601.xlsx index b6f2875d05db7c263e4262ed65e15c29ea9af4f9..d2393a388c1ac145ffa7c16cf96d4fa61167be5b 100644 GIT binary patch delta 19808 zcmXtfb9kOj(|2s!w%Mey(^z+G+i9Gfane|g8{4++q_J(=c+= z_YA28^RES~{)B>+n%Zc+k*JXK_oMt8javG^oxba)C%9963&PIRVGS_wQvvVC9=6*?YTOt7gm zTMfuIMGx2-vr!s0rxuce5R1A-5N zCrPNa@f9=z+Z1WbVa*;YBkb(^U|<&inp{-Uf)Vm|g1{!!y?OBd zS|I6e;9nHQvYl}F5ihc|j+=@9UcJ!MVs9aTVrCppInvSpE|v~}cSKPV&dpp2p-hi! zK-4?vi>Go}VUw-PJ9)?aqtJ{N2g`)c3P!eg#Xrw6o@Dq#ie!)kHOO2e)(1#}-P&fW zMBdj4?jUA2Xm*nBWTK^>*63yq!@S^jxo+m}Aybpiy!&se17UAJ&hp-=cUheRBe~Gn zB^I~c>vmQUc=vtmb8Fh{Y<;~?Z`0pc`?x+lU+vm_e|le^vbWd&bd_>Sn!b{Va6q*- zCeYJQ^5}Jdzz5U+_7ugHehdIC1fguUJbSjNt2^(8NTgyH3k(9NI{uHMmoRi5Aw`Pn z1`72yuc9;rR*;&*x)|*^p5Rl?T1jS4qS|#Ug(ZkuSTkCG!1vtE+$_@jl2H)c)?&An z`(;Ld9A#R83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A>x@%)9H_%CdnAi72VQ)bxkTTmYSM6MzO2z=5+f|>E6c`^*6=T5pFd5XX(JTA|e z;T@Dd0L7E?Iq|DPf0r>Wbb?gQS7Z=@oiro!c?3_g5U~IN5i$S(-+#9|srMvLK;3lE zNnQdS06-@Z_ Date: Tue, 25 Aug 2026 14:48:54 +0900 Subject: [PATCH 2/4] =?UTF-8?q?260825=5F01=5FENH:=20=EC=B0=A8=ED=8A=B8=20?= =?UTF-8?q?=EB=AC=B8=ED=95=AD=EB=B3=84=20=EC=83=89=EC=83=81=EC=A7=80?= =?UTF-8?q?=EC=A0=95=20=EB=B0=8F=20=EC=B0=A8=ED=8A=B8=20=ED=95=98=EC=9D=B4?= =?UTF-8?q?=EB=9D=BC=EC=9D=B4=ED=8A=B8=20=EB=AA=A8=EB=93=9C=20=EC=A0=81?= =?UTF-8?q?=EC=9A=A9,=20=EB=AC=B8=ED=95=AD=EB=B3=84=20=EC=A0=9C=EB=AA=A9?= =?UTF-8?q?=EA=B3=BC=20=EB=B2=94=EB=A1=80=20=EC=82=AC=EC=9D=B4=EC=97=90=20?= =?UTF-8?q?=EB=AC=B8=ED=95=AD=20=ED=85=8D=EC=8A=A4=ED=8A=B8=20=EC=82=BD?= =?UTF-8?q?=EC=9E=85,=20gap=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .agent/project.md | 17 +- AGENTS.md | 17 +- .../dash/back/common/enums/ChartGapMode.java | 19 ++ .../back/common/enums/ChartHighlightMode.java | 16 ++ .../dash/back/controller/ExcelController.java | 26 +++ .../back/dto/excel/ExcelTemplateRows.java | 59 +++++- .../back/dto/excel/ExcelWorkbookData.java | 24 +++ .../dash/back/dto/request/ExcelData.java | 31 ++- .../dto/response/ExcelImportResponse.java | 2 + .../back/dto/response/ExcelResetResponse.java | 17 ++ .../back/dto/response/PartDetailResponse.java | 12 +- .../entity/TPartItemChartEntity.java | 62 ++++++ .../entity/TPartItemChartHighlightEntity.java | 59 ++++++ .../persistence/entity/TPartItemEntity.java | 8 - .../entity/TPartItemSubEntity.java | 7 +- .../repository/PartItemBaseRepository.java | 7 + .../PartItemChartHighlightRepository.java | 21 ++ .../repository/PartItemChartRepository.java | 20 ++ .../repository/PartItemDataRepository.java | 7 + .../repository/PartItemRepository.java | 7 + .../repository/PartItemSubRepository.java | 9 + .../repository/PartRepository.java | 7 + .../repository/SurveyItemRepository.java | 7 + .../repository/SurveyRepository.java | 7 + .../repository/WaveInfoRepository.java | 7 + .../repository/WaveRepository.java | 7 + .../dash/back/service/ExcelExportService.java | 187 ++++++++++++++++++ .../dash/back/service/ExcelImportService.java | 101 ++++------ .../back/service/ExcelImportValidator.java | 146 +++++++++++++- .../dash/back/service/ExcelResetService.java | 70 +++++++ .../back/service/ExcelTemplateService.java | 41 ++-- .../dash/back/service/WaveQueryService.java | 59 +++++- 32 files changed, 970 insertions(+), 116 deletions(-) create mode 100644 src/main/java/com/kri/epolicy/dash/back/common/enums/ChartGapMode.java create mode 100644 src/main/java/com/kri/epolicy/dash/back/common/enums/ChartHighlightMode.java create mode 100644 src/main/java/com/kri/epolicy/dash/back/dto/excel/ExcelWorkbookData.java create mode 100644 src/main/java/com/kri/epolicy/dash/back/dto/response/ExcelResetResponse.java create mode 100644 src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemChartEntity.java create mode 100644 src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemChartHighlightEntity.java create mode 100644 src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemChartHighlightRepository.java create mode 100644 src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemChartRepository.java create mode 100644 src/main/java/com/kri/epolicy/dash/back/service/ExcelExportService.java create mode 100644 src/main/java/com/kri/epolicy/dash/back/service/ExcelResetService.java diff --git a/.agent/project.md b/.agent/project.md index 71fe693..a5f921f 100644 --- a/.agent/project.md +++ b/.agent/project.md @@ -13,12 +13,12 @@ - Do not implement a frontend administration page at this stage. Do not add create, update, or delete features for individual information records unless a future approved requirement explicitly expands the scope. - Supply and maintain the data required by this project through Excel-based bulk upload instead of individual administration features. - Keep user and file data outside the Excel bulk-import scope. Import the remaining project data from one Excel workbook containing multiple sheets. -- The Excel workbook contract uses nine required sheets named after their tables: `t_wave`, `t_wave_info`, `t_survey`, `t_survey_item`, `t_part`, `t_part_item`, `t_part_item_sub`, `t_part_item_base`, and `t_part_item_data`. Headers normally use database column names; append the complete allowed-value list in parentheses for constrained columns, such as `is_open (1, 0)`, `chart_type (bar)`, and `is_chart_visible (1, 0)`. The workbook must contain all logical parent rows referenced by its child rows. -- Treat every database column whose name ends with `_idx` as an auto-increment identity. Do not include these columns in Excel import or template sheets, and preserve an existing identity by matching the row's logical key during repeat imports. -- For identity-backed Excel tables, use these import logical keys: `(wave_cd, wave_info_order)` for `t_wave_info`, `(wave_cd, survey_cd, survey_item_order)` for `t_survey_item`, `(wave_cd, part_cd, part_item_cd, survey_cd, part_item_sub_cd)` for `t_part_item_base`, and that same result-series key plus `part_item_data_order` for `t_part_item_data`. +- The Excel workbook has eleven required table-named sheets: `t_wave`, `t_wave_info`, `t_survey`, `t_survey_item`, `t_part`, `t_part_item`, `t_part_item_sub`, `t_part_item_base`, `t_part_item_chart`, `t_part_item_chart_highlight`, and `t_part_item_data`. Headers use database names and constrained headers list every allowed value in parentheses. The workbook must contain all referenced logical parents. +- Omit every auto-increment `_idx` column from Excel. Replacement imports regenerate identities. +- Reject duplicate workbook logical keys: `(wave_cd, wave_info_order)` for Wave info; `(wave_cd, survey_cd, survey_item_order)` for survey items; `(wave_cd, part_cd, part_item_cd, survey_cd, part_item_sub_cd)` for base, chart, and highlight rows; and that result-series key plus `part_item_data_order` for data rows. - Define the Excel import/export schema once with KriCommon `ExcelColumn` DTOs. Use KriCommon `ExcelMapper` for workbook mapping and keep only project-specific type, value, and cross-sheet relationship rules in a consumer-local validator; do not duplicate a general-purpose Excel parser. -- Use `POST /api/v1/excel/import` for workbook import and `GET /api/v1/excel/template` for downloading an empty XLSX template. The exported template must contain the same nine required sheets in dependency order and the exact headers accepted by the importer. -- Apply a valid workbook atomically using upsert semantics: insert new primary/logical keys, update matching keys, and retain existing database rows that are absent from the workbook. Do not use a bulk import to delete omitted rows unless a future approved requirement explicitly changes this policy. +- Excel endpoints are `POST /api/v1/excel/import`, `GET /api/v1/excel/template`, `GET /api/v1/excel/waves/{waveCd}/export`, and `DELETE /api/v1/excel/waves/{waveCd}`. Downloads use the same eleven sheets, order, and headers; a missing Wave exports an empty workbook. +- Imports atomically replace every included Wave: validate first, delete all eleven managed tables, then insert. Failures restore prior data. Standalone reset uses the same child-to-root deletion and retains `t_file` metadata and physical files, allowing temporary orphans until that `wave_cd` is reimported. - A reference-file upload writes both the physical file and its `t_file` metadata. Accept `fileTitle` and `fileOrder` as multipart request fields, derive `file_type` from the lowercase filename extension, and keep the original filename as `file_name`. - For reference-file uploads, accept `waveCd` as a path variable and store the file under `{kri.file.base-dir}/References/{waveCd}` using the original filename. Treat `(wave_cd, file_name)` as the upload logical key: uploading the same filename again preserves `file_idx`, replaces the physical file, and updates `file_title`, `file_order`, and `file_type`. - Reject a reference-file upload when its `waveCd` does not exist. Coordinate the database transaction and filesystem replacement so a database rollback restores the previous file or removes a newly created file. @@ -30,6 +30,7 @@ - Do not add physical database foreign keys. The backend must validate all logical parent-child relationships during Excel import and any future data mutation. - Treat `(wave_cd, part_cd, part_item_cd)` as the logical item key. Add `survey_cd` to identify a survey-specific result set and add `part_item_sub_cd` when a sub-item exists. - `t_part_item_sub` has no physical primary key in the planned schema. Treat `(wave_cd, part_cd, part_item_cd, part_item_sub_cd)` as its logical identifier and lookup key. +- Store the nullable `t_part_item_sub.part_item_sub_comment` value and expose it as `partItemSubComment` in Part-detail sub-item responses. - A normal item has no `t_part_item_sub` rows, and both base and data rows must use `part_item_sub_cd = NULL`. Never use `0` as a substitute for this `NULL` value. - An item with sub-items has one or more `t_part_item_sub` rows. Every non-null `part_item_sub_cd` in its base and data rows must reference a sub-item belonging to the same `(wave_cd, part_cd, part_item_cd)`. - Every survey code used by `t_part_item_base` or `t_part_item_data` must belong to the same Wave. Survey items must likewise belong to an existing `(wave_cd, survey_cd)`. @@ -38,6 +39,9 @@ - Store an optional display string in `t_part_item_base.base_text` (`VARCHAR(128)`). Do not reconstruct it from `base_count`, and do not retain the removed `base_pre_text` or `base_post_text` fields in entities, Excel contracts, or query assembly. - Use the corresponding `*_order` column for API and screen ordering: `wave_info_order`, `survey_order`, `survey_item_order`, `file_order`, `part_order`, `part_item_order`, and `part_item_data_order`. Use `part_item_sub_cd` as the default sub-item order because the schema has no separate sub-item order column. - Use the same `t_part_item_data` rows for both chart and statistical-table views. `is_chart_visible` is a required Boolean column with database default `1`; statistical tables use every row, while charts omit categories and matching values whose flag is false. Do not introduce a separate table-data source that could diverge from chart values. +- Resolve `chart_type`, `chart_color`, and `chart_gap_mode` per `(wave_cd, part_cd, part_item_cd, survey_cd, part_item_sub_cd)` from `t_part_item_chart`, not `t_part_item`. Defaults are `BAR`, `t_survey.survey_color`, and `NONE`; normalize null or unknown gap modes to `NONE`. Allowed gap modes are `NONE`, `ALL`, and `LAST_VISIBLE`. +- Resolve `t_part_item_chart_highlight` independently from `t_part_item_chart`; a highlight may exist without a chart-setting row. Return `chart_highlight_mode`, `chart_highlight_value`, and `chart_highlight_color` to the frontend without calculating highlighted categories in the backend. Supported modes are `MAX_VALUE`, `LAST_VISIBLE`, and `SPECIFIED`; only `SPECIFIED` accepts a non-null, comma-separated integer value with no spaces. +- Treat null `part_item_sub_cd` values as equal when matching normal-item chart and highlight settings. Validate at Excel import that chart and highlight logical keys are unique, normal items use null sub codes, and colors use `#RRGGBB` format. - Avoid N+1 query patterns when assembling a Wave dashboard. Fetch the required Part, Item, Sub, Base, and Data ranges in batches and assemble the response hierarchy in the backend. ## Frontend API Contract @@ -49,7 +53,8 @@ - Return categories as objects containing `order`, `label`, and `chartVisible`, alongside complete survey value series. The frontend uses all category/value indexes for statistical tables and filters matching indexes only for chart rendering. Reject Excel imports when category labels, display orders, or chart-visibility flags differ between survey series in the same Item/Sub result group. - Expose each survey's stored color as `color` in both Wave-detail survey objects and Part-detail series objects so the frontend uses one server-managed color mapping. - Return the stored nullable `t_part_item_base.base_text` value unchanged as Part-detail `series[].baseText`; `baseCount` remains a separate numeric field. +- Return `series[].chartGapMode`; the frontend applies `NONE`, `ALL`, or `LAST_VISIBLE`, where the last mode uses the greatest visible `part_item_data_order`. - When importing `part_item_data_value`, round to scale 10 with `RoundingMode.HALF_UP` before validating and storing it as `DECIMAL(14,10)`. Reject only values that still exceed precision 14 after rounding. - When `part_item_comment` is blank in Excel, store an empty string rather than `NULL` because the database column is required. Preserve the existing `NULL` semantics of other optional Excel fields. -- Manage chart types as code enums. The initial supported type is `BAR`; Excel accepts its label `bar` case-insensitively, the database stores code `BAR`, and frontend responses return code `BAR`. Reject unsupported labels during Excel validation. +- Manage chart types as code enums in `t_part_item_chart`. The initial supported type is `BAR`; Excel accepts its label `bar` case-insensitively, the database stores code `BAR`, and Part-detail series responses return code `BAR`. Reject unsupported labels during Excel validation. - Build file download URLs in the backend from the configured file resource path and the stored file metadata. Do not require the frontend to construct filesystem paths. diff --git a/AGENTS.md b/AGENTS.md index fedd166..dafca61 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -275,12 +275,12 @@ When implementation is complete, report in Korean: - Do not implement a frontend administration page at this stage. Do not add create, update, or delete features for individual information records unless a future approved requirement explicitly expands the scope. - Supply and maintain the data required by this project through Excel-based bulk upload instead of individual administration features. - Keep user and file data outside the Excel bulk-import scope. Import the remaining project data from one Excel workbook containing multiple sheets. -- The Excel workbook contract uses nine required sheets named after their tables: `t_wave`, `t_wave_info`, `t_survey`, `t_survey_item`, `t_part`, `t_part_item`, `t_part_item_sub`, `t_part_item_base`, and `t_part_item_data`. Headers normally use database column names; append the complete allowed-value list in parentheses for constrained columns, such as `is_open (1, 0)`, `chart_type (bar)`, and `is_chart_visible (1, 0)`. The workbook must contain all logical parent rows referenced by its child rows. -- Treat every database column whose name ends with `_idx` as an auto-increment identity. Do not include these columns in Excel import or template sheets, and preserve an existing identity by matching the row's logical key during repeat imports. -- For identity-backed Excel tables, use these import logical keys: `(wave_cd, wave_info_order)` for `t_wave_info`, `(wave_cd, survey_cd, survey_item_order)` for `t_survey_item`, `(wave_cd, part_cd, part_item_cd, survey_cd, part_item_sub_cd)` for `t_part_item_base`, and that same result-series key plus `part_item_data_order` for `t_part_item_data`. +- The Excel workbook has eleven required table-named sheets: `t_wave`, `t_wave_info`, `t_survey`, `t_survey_item`, `t_part`, `t_part_item`, `t_part_item_sub`, `t_part_item_base`, `t_part_item_chart`, `t_part_item_chart_highlight`, and `t_part_item_data`. Headers use database names and constrained headers list every allowed value in parentheses. The workbook must contain all referenced logical parents. +- Omit every auto-increment `_idx` column from Excel. Replacement imports regenerate identities. +- Reject duplicate workbook logical keys: `(wave_cd, wave_info_order)` for Wave info; `(wave_cd, survey_cd, survey_item_order)` for survey items; `(wave_cd, part_cd, part_item_cd, survey_cd, part_item_sub_cd)` for base, chart, and highlight rows; and that result-series key plus `part_item_data_order` for data rows. - Define the Excel import/export schema once with KriCommon `ExcelColumn` DTOs. Use KriCommon `ExcelMapper` for workbook mapping and keep only project-specific type, value, and cross-sheet relationship rules in a consumer-local validator; do not duplicate a general-purpose Excel parser. -- Use `POST /api/v1/excel/import` for workbook import and `GET /api/v1/excel/template` for downloading an empty XLSX template. The exported template must contain the same nine required sheets in dependency order and the exact headers accepted by the importer. -- Apply a valid workbook atomically using upsert semantics: insert new primary/logical keys, update matching keys, and retain existing database rows that are absent from the workbook. Do not use a bulk import to delete omitted rows unless a future approved requirement explicitly changes this policy. +- Excel endpoints are `POST /api/v1/excel/import`, `GET /api/v1/excel/template`, `GET /api/v1/excel/waves/{waveCd}/export`, and `DELETE /api/v1/excel/waves/{waveCd}`. Downloads use the same eleven sheets, order, and headers; a missing Wave exports an empty workbook. +- Imports atomically replace every included Wave: validate first, delete all eleven managed tables, then insert. Failures restore prior data. Standalone reset uses the same child-to-root deletion and retains `t_file` metadata and physical files, allowing temporary orphans until that `wave_cd` is reimported. - A reference-file upload writes both the physical file and its `t_file` metadata. Accept `fileTitle` and `fileOrder` as multipart request fields, derive `file_type` from the lowercase filename extension, and keep the original filename as `file_name`. - For reference-file uploads, accept `waveCd` as a path variable and store the file under `{kri.file.base-dir}/References/{waveCd}` using the original filename. Treat `(wave_cd, file_name)` as the upload logical key: uploading the same filename again preserves `file_idx`, replaces the physical file, and updates `file_title`, `file_order`, and `file_type`. - Reject a reference-file upload when its `waveCd` does not exist. Coordinate the database transaction and filesystem replacement so a database rollback restores the previous file or removes a newly created file. @@ -292,6 +292,7 @@ When implementation is complete, report in Korean: - Do not add physical database foreign keys. The backend must validate all logical parent-child relationships during Excel import and any future data mutation. - Treat `(wave_cd, part_cd, part_item_cd)` as the logical item key. Add `survey_cd` to identify a survey-specific result set and add `part_item_sub_cd` when a sub-item exists. - `t_part_item_sub` has no physical primary key in the planned schema. Treat `(wave_cd, part_cd, part_item_cd, part_item_sub_cd)` as its logical identifier and lookup key. +- Store the nullable `t_part_item_sub.part_item_sub_comment` value and expose it as `partItemSubComment` in Part-detail sub-item responses. - A normal item has no `t_part_item_sub` rows, and both base and data rows must use `part_item_sub_cd = NULL`. Never use `0` as a substitute for this `NULL` value. - An item with sub-items has one or more `t_part_item_sub` rows. Every non-null `part_item_sub_cd` in its base and data rows must reference a sub-item belonging to the same `(wave_cd, part_cd, part_item_cd)`. - Every survey code used by `t_part_item_base` or `t_part_item_data` must belong to the same Wave. Survey items must likewise belong to an existing `(wave_cd, survey_cd)`. @@ -300,6 +301,9 @@ When implementation is complete, report in Korean: - Store an optional display string in `t_part_item_base.base_text` (`VARCHAR(128)`). Do not reconstruct it from `base_count`, and do not retain the removed `base_pre_text` or `base_post_text` fields in entities, Excel contracts, or query assembly. - Use the corresponding `*_order` column for API and screen ordering: `wave_info_order`, `survey_order`, `survey_item_order`, `file_order`, `part_order`, `part_item_order`, and `part_item_data_order`. Use `part_item_sub_cd` as the default sub-item order because the schema has no separate sub-item order column. - Use the same `t_part_item_data` rows for both chart and statistical-table views. `is_chart_visible` is a required Boolean column with database default `1`; statistical tables use every row, while charts omit categories and matching values whose flag is false. Do not introduce a separate table-data source that could diverge from chart values. +- Resolve `chart_type`, `chart_color`, and `chart_gap_mode` per `(wave_cd, part_cd, part_item_cd, survey_cd, part_item_sub_cd)` from `t_part_item_chart`, not `t_part_item`. Defaults are `BAR`, `t_survey.survey_color`, and `NONE`; normalize null or unknown gap modes to `NONE`. Allowed gap modes are `NONE`, `ALL`, and `LAST_VISIBLE`. +- Resolve `t_part_item_chart_highlight` independently from `t_part_item_chart`; a highlight may exist without a chart-setting row. Return `chart_highlight_mode`, `chart_highlight_value`, and `chart_highlight_color` to the frontend without calculating highlighted categories in the backend. Supported modes are `MAX_VALUE`, `LAST_VISIBLE`, and `SPECIFIED`; only `SPECIFIED` accepts a non-null, comma-separated integer value with no spaces. +- Treat null `part_item_sub_cd` values as equal when matching normal-item chart and highlight settings. Validate at Excel import that chart and highlight logical keys are unique, normal items use null sub codes, and colors use `#RRGGBB` format. - Avoid N+1 query patterns when assembling a Wave dashboard. Fetch the required Part, Item, Sub, Base, and Data ranges in batches and assemble the response hierarchy in the backend. ## Frontend API Contract @@ -311,7 +315,8 @@ When implementation is complete, report in Korean: - Return categories as objects containing `order`, `label`, and `chartVisible`, alongside complete survey value series. The frontend uses all category/value indexes for statistical tables and filters matching indexes only for chart rendering. Reject Excel imports when category labels, display orders, or chart-visibility flags differ between survey series in the same Item/Sub result group. - Expose each survey's stored color as `color` in both Wave-detail survey objects and Part-detail series objects so the frontend uses one server-managed color mapping. - Return the stored nullable `t_part_item_base.base_text` value unchanged as Part-detail `series[].baseText`; `baseCount` remains a separate numeric field. +- Return `series[].chartGapMode`; the frontend applies `NONE`, `ALL`, or `LAST_VISIBLE`, where the last mode uses the greatest visible `part_item_data_order`. - When importing `part_item_data_value`, round to scale 10 with `RoundingMode.HALF_UP` before validating and storing it as `DECIMAL(14,10)`. Reject only values that still exceed precision 14 after rounding. - When `part_item_comment` is blank in Excel, store an empty string rather than `NULL` because the database column is required. Preserve the existing `NULL` semantics of other optional Excel fields. -- Manage chart types as code enums. The initial supported type is `BAR`; Excel accepts its label `bar` case-insensitively, the database stores code `BAR`, and frontend responses return code `BAR`. Reject unsupported labels during Excel validation. +- Manage chart types as code enums in `t_part_item_chart`. The initial supported type is `BAR`; Excel accepts its label `bar` case-insensitively, the database stores code `BAR`, and Part-detail series responses return code `BAR`. Reject unsupported labels during Excel validation. - Build file download URLs in the backend from the configured file resource path and the stored file metadata. Do not require the frontend to construct filesystem paths. diff --git a/src/main/java/com/kri/epolicy/dash/back/common/enums/ChartGapMode.java b/src/main/java/com/kri/epolicy/dash/back/common/enums/ChartGapMode.java new file mode 100644 index 0000000..aeb7403 --- /dev/null +++ b/src/main/java/com/kri/epolicy/dash/back/common/enums/ChartGapMode.java @@ -0,0 +1,19 @@ +package com.kri.epolicy.dash.back.common.enums; + +import java.util.Arrays; + +public enum ChartGapMode { + NONE, + ALL, + LAST_VISIBLE; + + public static ChartGapMode fromCodeOrDefault(String code) { + if (code == null) { + return NONE; + } + return Arrays.stream(values()) + .filter(mode -> mode.name().equalsIgnoreCase(code.trim())) + .findFirst() + .orElse(NONE); + } +} diff --git a/src/main/java/com/kri/epolicy/dash/back/common/enums/ChartHighlightMode.java b/src/main/java/com/kri/epolicy/dash/back/common/enums/ChartHighlightMode.java new file mode 100644 index 0000000..4a716e4 --- /dev/null +++ b/src/main/java/com/kri/epolicy/dash/back/common/enums/ChartHighlightMode.java @@ -0,0 +1,16 @@ +package com.kri.epolicy.dash.back.common.enums; + +import java.util.Arrays; + +public enum ChartHighlightMode { + MAX_VALUE, + LAST_VISIBLE, + SPECIFIED; + + public static ChartHighlightMode fromCode(String code) { + return Arrays.stream(values()) + .filter(mode -> mode.name().equalsIgnoreCase(code)) + .findFirst() + .orElseThrow(() -> new IllegalArgumentException("지원하지 않는 차트 강조 모드입니다: " + code)); + } +} diff --git a/src/main/java/com/kri/epolicy/dash/back/controller/ExcelController.java b/src/main/java/com/kri/epolicy/dash/back/controller/ExcelController.java index 6ead28a..24e7c3d 100644 --- a/src/main/java/com/kri/epolicy/dash/back/controller/ExcelController.java +++ b/src/main/java/com/kri/epolicy/dash/back/controller/ExcelController.java @@ -1,7 +1,10 @@ package com.kri.epolicy.dash.back.controller; import com.kri.epolicy.dash.back.dto.response.ExcelImportResponse; +import com.kri.epolicy.dash.back.dto.response.ExcelResetResponse; +import com.kri.epolicy.dash.back.service.ExcelExportService; import com.kri.epolicy.dash.back.service.ExcelImportService; +import com.kri.epolicy.dash.back.service.ExcelResetService; import com.kri.epolicy.dash.back.service.ExcelTemplateService; import java.nio.charset.StandardCharsets; import lombok.RequiredArgsConstructor; @@ -10,6 +13,8 @@ import org.springframework.http.HttpHeaders; import org.springframework.http.MediaType; import org.springframework.http.ResponseEntity; import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.DeleteMapping; +import org.springframework.web.bind.annotation.PathVariable; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestPart; @@ -23,6 +28,8 @@ public class ExcelController { private final ExcelImportService excelImportService; private final ExcelTemplateService excelTemplateService; + private final ExcelExportService excelExportService; + private final ExcelResetService excelResetService; @PostMapping(value = "/import", consumes = MediaType.MULTIPART_FORM_DATA_VALUE) public ExcelImportResponse importExcel(@RequestPart("file") MultipartFile file) { @@ -39,4 +46,23 @@ public class ExcelController { .contentType(MediaType.parseMediaType(ExcelTemplateService.EXCEL_CONTENT_TYPE)) .body(excelTemplateService.createTemplate()); } + + @GetMapping( + value = "/waves/{waveCd}/export", + produces = ExcelTemplateService.EXCEL_CONTENT_TYPE + ) + public ResponseEntity exportWave(@PathVariable Short waveCd) { + ContentDisposition disposition = ContentDisposition.attachment() + .filename("epolicy-wave-" + waveCd + ".xlsx", StandardCharsets.UTF_8) + .build(); + return ResponseEntity.ok() + .header(HttpHeaders.CONTENT_DISPOSITION, disposition.toString()) + .contentType(MediaType.parseMediaType(ExcelTemplateService.EXCEL_CONTENT_TYPE)) + .body(excelExportService.exportWave(waveCd)); + } + + @DeleteMapping("/waves/{waveCd}") + public ExcelResetResponse resetWave(@PathVariable Short waveCd) { + return excelResetService.resetWave(waveCd); + } } diff --git a/src/main/java/com/kri/epolicy/dash/back/dto/excel/ExcelTemplateRows.java b/src/main/java/com/kri/epolicy/dash/back/dto/excel/ExcelTemplateRows.java index 2020a3a..4e21f8e 100644 --- a/src/main/java/com/kri/epolicy/dash/back/dto/excel/ExcelTemplateRows.java +++ b/src/main/java/com/kri/epolicy/dash/back/dto/excel/ExcelTemplateRows.java @@ -1,7 +1,9 @@ package com.kri.epolicy.dash.back.dto.excel; import com.kri.common.feature.excel.ExcelColumn; +import lombok.AllArgsConstructor; import lombok.Getter; +import lombok.NoArgsConstructor; public final class ExcelTemplateRows { @@ -13,12 +15,16 @@ public final class ExcelTemplateRows { public static final String PART_ITEM_SHEET = "t_part_item"; public static final String PART_ITEM_SUB_SHEET = "t_part_item_sub"; public static final String PART_ITEM_BASE_SHEET = "t_part_item_base"; + public static final String PART_ITEM_CHART_SHEET = "t_part_item_chart"; + public static final String PART_ITEM_CHART_HIGHLIGHT_SHEET = "t_part_item_chart_highlight"; public static final String PART_ITEM_DATA_SHEET = "t_part_item_data"; private ExcelTemplateRows() { } @Getter + @NoArgsConstructor + @AllArgsConstructor public static final class Wave { @ExcelColumn(header = "wave_cd", order = 0) private String waveCd; @ExcelColumn(header = "year", order = 1) private String year; @@ -28,6 +34,8 @@ public final class ExcelTemplateRows { } @Getter + @NoArgsConstructor + @AllArgsConstructor public static final class WaveInfo { @ExcelColumn(header = "wave_cd", order = 0) private String waveCd; @ExcelColumn(header = "wave_info_order", order = 1) private String waveInfoOrder; @@ -36,6 +44,8 @@ public final class ExcelTemplateRows { } @Getter + @NoArgsConstructor + @AllArgsConstructor public static final class Survey { @ExcelColumn(header = "wave_cd", order = 0) private String waveCd; @ExcelColumn(header = "survey_cd", order = 1) private String surveyCd; @@ -46,6 +56,8 @@ public final class ExcelTemplateRows { } @Getter + @NoArgsConstructor + @AllArgsConstructor public static final class SurveyItem { @ExcelColumn(header = "wave_cd", order = 0) private String waveCd; @ExcelColumn(header = "survey_cd", order = 1) private String surveyCd; @@ -55,6 +67,8 @@ public final class ExcelTemplateRows { } @Getter + @NoArgsConstructor + @AllArgsConstructor public static final class Part { @ExcelColumn(header = "wave_cd", order = 0) private String waveCd; @ExcelColumn(header = "part_cd", order = 1) private String partCd; @@ -63,26 +77,32 @@ public final class ExcelTemplateRows { } @Getter + @NoArgsConstructor + @AllArgsConstructor public static final class PartItem { @ExcelColumn(header = "wave_cd", order = 0) private String waveCd; @ExcelColumn(header = "part_cd", order = 1) private String partCd; @ExcelColumn(header = "part_item_cd", order = 2) private String partItemCd; @ExcelColumn(header = "part_item_order", order = 3) private String partItemOrder; @ExcelColumn(header = "part_item_title", order = 4) private String partItemTitle; - @ExcelColumn(header = "chart_type (bar)", order = 5) private String chartType; - @ExcelColumn(header = "part_item_comment", order = 6) private String partItemComment; + @ExcelColumn(header = "part_item_comment", order = 5) private String partItemComment; } @Getter + @NoArgsConstructor + @AllArgsConstructor public static final class PartItemSub { @ExcelColumn(header = "wave_cd", order = 0) private String waveCd; @ExcelColumn(header = "part_cd", order = 1) private String partCd; @ExcelColumn(header = "part_item_cd", order = 2) private String partItemCd; @ExcelColumn(header = "part_item_sub_cd", order = 3) private String partItemSubCd; @ExcelColumn(header = "part_item_sub_title", order = 4) private String partItemSubTitle; + @ExcelColumn(header = "part_item_sub_comment", order = 5) private String partItemSubComment; } @Getter + @NoArgsConstructor + @AllArgsConstructor public static final class PartItemBase { @ExcelColumn(header = "wave_cd", order = 0) private String waveCd; @ExcelColumn(header = "part_cd", order = 1) private String partCd; @@ -94,6 +114,8 @@ public final class ExcelTemplateRows { } @Getter + @NoArgsConstructor + @AllArgsConstructor public static final class PartItemData { @ExcelColumn(header = "wave_cd", order = 0) private String waveCd; @ExcelColumn(header = "part_cd", order = 1) private String partCd; @@ -105,4 +127,37 @@ public final class ExcelTemplateRows { @ExcelColumn(header = "part_item_data_value", order = 7) private String partItemDataValue; @ExcelColumn(header = "is_chart_visible (1, 0)", order = 8) private String isChartVisible; } + + @Getter + @NoArgsConstructor + @AllArgsConstructor + public static final class PartItemChart { + @ExcelColumn(header = "wave_cd", order = 0) private String waveCd; + @ExcelColumn(header = "part_cd", order = 1) private String partCd; + @ExcelColumn(header = "part_item_cd", order = 2) private String partItemCd; + @ExcelColumn(header = "survey_cd", order = 3) private String surveyCd; + @ExcelColumn(header = "part_item_sub_cd", order = 4) private String partItemSubCd; + @ExcelColumn(header = "chart_type (bar)", order = 5) private String chartType; + @ExcelColumn(header = "chart_color", order = 6) private String chartColor; + @ExcelColumn(header = "chart_gap_mode (NONE, ALL, LAST_VISIBLE)", order = 7) + private String chartGapMode; + } + + @Getter + @NoArgsConstructor + @AllArgsConstructor + public static final class PartItemChartHighlight { + @ExcelColumn(header = "wave_cd", order = 0) private String waveCd; + @ExcelColumn(header = "part_cd", order = 1) private String partCd; + @ExcelColumn(header = "part_item_cd", order = 2) private String partItemCd; + @ExcelColumn(header = "survey_cd", order = 3) private String surveyCd; + @ExcelColumn(header = "part_item_sub_cd", order = 4) private String partItemSubCd; + @ExcelColumn( + header = "chart_highlight_mode (MAX_VALUE, LAST_VISIBLE, SPECIFIED)", order = 5) + private String chartHighlightMode; + @ExcelColumn(header = "chart_highlight_value", order = 6) + private String chartHighlightValue; + @ExcelColumn(header = "chart_highlight_color", order = 7) + private String chartHighlightColor; + } } diff --git a/src/main/java/com/kri/epolicy/dash/back/dto/excel/ExcelWorkbookData.java b/src/main/java/com/kri/epolicy/dash/back/dto/excel/ExcelWorkbookData.java new file mode 100644 index 0000000..7dd7289 --- /dev/null +++ b/src/main/java/com/kri/epolicy/dash/back/dto/excel/ExcelWorkbookData.java @@ -0,0 +1,24 @@ +package com.kri.epolicy.dash.back.dto.excel; + +import java.util.List; + +public record ExcelWorkbookData( + List waves, + List waveInfos, + List surveys, + List surveyItems, + List parts, + List partItems, + List partItemSubs, + List partItemBases, + List partItemCharts, + List partItemChartHighlights, + List partItemData +) { + + public static ExcelWorkbookData empty() { + return new ExcelWorkbookData( + List.of(), List.of(), List.of(), List.of(), List.of(), List.of(), + List.of(), List.of(), List.of(), List.of(), List.of()); + } +} diff --git a/src/main/java/com/kri/epolicy/dash/back/dto/request/ExcelData.java b/src/main/java/com/kri/epolicy/dash/back/dto/request/ExcelData.java index e10e36e..2878de7 100644 --- a/src/main/java/com/kri/epolicy/dash/back/dto/request/ExcelData.java +++ b/src/main/java/com/kri/epolicy/dash/back/dto/request/ExcelData.java @@ -1,6 +1,7 @@ package com.kri.epolicy.dash.back.dto.request; import com.kri.epolicy.dash.back.common.enums.ChartType; +import com.kri.epolicy.dash.back.common.enums.ChartGapMode; import java.math.BigDecimal; import java.util.List; @@ -13,6 +14,8 @@ public record ExcelData( List partItems, List partItemSubs, List partItemBases, + List partItemCharts, + List partItemChartHighlights, List partItemData ) { @@ -66,7 +69,6 @@ public record ExcelData( Short partItemCd, Short partItemOrder, String partItemTitle, - ChartType chartType, String partItemComment ) { } @@ -76,7 +78,8 @@ public record ExcelData( Short partCd, Short partItemCd, Short partItemSubCd, - String partItemSubTitle + String partItemSubTitle, + String partItemSubComment ) { } @@ -103,4 +106,28 @@ public record ExcelData( Boolean isChartVisible ) { } + + public record PartItemChartRow( + Short waveCd, + Short partCd, + Short partItemCd, + Short surveyCd, + Short partItemSubCd, + ChartType chartType, + String chartColor, + ChartGapMode chartGapMode + ) { + } + + public record PartItemChartHighlightRow( + Short waveCd, + Short partCd, + Short partItemCd, + Short surveyCd, + Short partItemSubCd, + String chartHighlightMode, + String chartHighlightValue, + String chartHighlightColor + ) { + } } diff --git a/src/main/java/com/kri/epolicy/dash/back/dto/response/ExcelImportResponse.java b/src/main/java/com/kri/epolicy/dash/back/dto/response/ExcelImportResponse.java index c56e7c1..65cea0f 100644 --- a/src/main/java/com/kri/epolicy/dash/back/dto/response/ExcelImportResponse.java +++ b/src/main/java/com/kri/epolicy/dash/back/dto/response/ExcelImportResponse.java @@ -9,6 +9,8 @@ public record ExcelImportResponse( int partItemCount, int partItemSubCount, int partItemBaseCount, + int partItemChartCount, + int partItemChartHighlightCount, int partItemDataCount ) { } diff --git a/src/main/java/com/kri/epolicy/dash/back/dto/response/ExcelResetResponse.java b/src/main/java/com/kri/epolicy/dash/back/dto/response/ExcelResetResponse.java new file mode 100644 index 0000000..a4a7dc7 --- /dev/null +++ b/src/main/java/com/kri/epolicy/dash/back/dto/response/ExcelResetResponse.java @@ -0,0 +1,17 @@ +package com.kri.epolicy.dash.back.dto.response; + +public record ExcelResetResponse( + Short waveCd, + int waveCount, + int waveInfoCount, + int surveyCount, + int surveyItemCount, + int partCount, + int partItemCount, + int partItemSubCount, + int partItemBaseCount, + int partItemChartCount, + int partItemChartHighlightCount, + int partItemDataCount +) { +} diff --git a/src/main/java/com/kri/epolicy/dash/back/dto/response/PartDetailResponse.java b/src/main/java/com/kri/epolicy/dash/back/dto/response/PartDetailResponse.java index 2abb096..e7cc5a1 100644 --- a/src/main/java/com/kri/epolicy/dash/back/dto/response/PartDetailResponse.java +++ b/src/main/java/com/kri/epolicy/dash/back/dto/response/PartDetailResponse.java @@ -14,7 +14,6 @@ public record PartDetailResponse( Short partItemCd, Short order, String title, - String chartType, String comment, Audience audience, List resultGroups @@ -38,13 +37,22 @@ public record PartDetailResponse( ) { } - public record SubItem(Short partItemSubCd, String title) { + public record SubItem( + Short partItemSubCd, + String title, + String partItemSubComment + ) { } public record Series( Short surveyCd, String label, + String chartType, String color, + String chartGapMode, + String chartHighlightMode, + String chartHighlightValue, + String chartHighlightColor, Integer baseCount, String baseText, List values diff --git a/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemChartEntity.java b/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemChartEntity.java new file mode 100644 index 0000000..24f8698 --- /dev/null +++ b/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemChartEntity.java @@ -0,0 +1,62 @@ +package com.kri.epolicy.dash.back.persistence.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import lombok.Getter; +import lombok.Setter; +import org.hibernate.annotations.ColumnDefault; + +@Getter +@Setter +@Entity +@Table(name = "t_part_item_chart") +public class TPartItemChartEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "part_item_chart_idx", nullable = false) + private Integer id; + + @NotNull + @Column(name = "wave_cd", nullable = false) + private Short waveCd; + + @NotNull + @Column(name = "part_cd", nullable = false) + private Short partCd; + + @NotNull + @Column(name = "part_item_cd", nullable = false) + private Short partItemCd; + + @NotNull + @Column(name = "survey_cd", nullable = false) + private Short surveyCd; + + @Column(name = "part_item_sub_cd") + private Short partItemSubCd; + + @Size(max = 32) + @NotNull + @ColumnDefault("'BAR'") + @Column(name = "chart_type", nullable = false, length = 32) + private String chartType; + + @Size(max = 8) + @Column(name = "chart_color", length = 8) + private String chartColor; + + @Size(max = 32) + @NotNull + @ColumnDefault("'NONE'") + @Column(name = "chart_gap_mode", nullable = false, length = 32) + private String chartGapMode; + + +} diff --git a/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemChartHighlightEntity.java b/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemChartHighlightEntity.java new file mode 100644 index 0000000..4aa7336 --- /dev/null +++ b/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemChartHighlightEntity.java @@ -0,0 +1,59 @@ +package com.kri.epolicy.dash.back.persistence.entity; + +import jakarta.persistence.Column; +import jakarta.persistence.Entity; +import jakarta.persistence.GeneratedValue; +import jakarta.persistence.GenerationType; +import jakarta.persistence.Id; +import jakarta.persistence.Table; +import jakarta.validation.constraints.NotNull; +import jakarta.validation.constraints.Size; +import lombok.Getter; +import lombok.Setter; + +@Getter +@Setter +@Entity +@Table(name = "t_part_item_chart_highlight") +public class TPartItemChartHighlightEntity { + + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "chart_highlight_idx", nullable = false) + private Integer id; + + @NotNull + @Column(name = "wave_cd", nullable = false) + private Short waveCd; + + @NotNull + @Column(name = "part_cd", nullable = false) + private Short partCd; + + @NotNull + @Column(name = "part_item_cd", nullable = false) + private Short partItemCd; + + @NotNull + @Column(name = "survey_cd", nullable = false) + private Short surveyCd; + + @Column(name = "part_item_sub_cd") + private Short partItemSubCd; + + @Size(max = 32) + @NotNull + @Column(name = "chart_highlight_mode", nullable = false, length = 32) + private String chartHighlightMode; + + @Size(max = 32) + @Column(name = "chart_highlight_value", length = 32) + private String chartHighlightValue; + + @Size(max = 8) + @NotNull + @Column(name = "chart_highlight_color", nullable = false, length = 8) + private String chartHighlightColor; + + +} \ No newline at end of file diff --git a/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemEntity.java b/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemEntity.java index 84e82b9..9cb428a 100644 --- a/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemEntity.java +++ b/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemEntity.java @@ -1,12 +1,9 @@ package com.kri.epolicy.dash.back.persistence.entity; import com.kri.epolicy.dash.back.persistence.entity.id.TPartItemEntityId; -import com.kri.epolicy.dash.back.common.enums.ChartType; -import com.kri.epolicy.dash.back.persistence.converter.ChartTypeConverter; import jakarta.persistence.Column; import jakarta.persistence.EmbeddedId; import jakarta.persistence.Entity; -import jakarta.persistence.Convert; import jakarta.persistence.Lob; import jakarta.persistence.Table; import jakarta.validation.constraints.NotNull; @@ -32,11 +29,6 @@ public class TPartItemEntity { @Column(name = "part_item_title", nullable = false, length = 128) private String partItemTitle; - @NotNull - @Convert(converter = ChartTypeConverter.class) - @Column(name = "chart_type", nullable = false, length = 32) - private ChartType chartType; - @NotNull @Lob @Column(name = "part_item_comment", nullable = false) diff --git a/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemSubEntity.java b/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemSubEntity.java index c5a87dc..dd83a69 100644 --- a/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemSubEntity.java +++ b/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemSubEntity.java @@ -4,6 +4,7 @@ import com.kri.epolicy.dash.back.persistence.entity.id.TPartItemSubEntityId; import jakarta.persistence.Column; import jakarta.persistence.EmbeddedId; import jakarta.persistence.Entity; +import jakarta.persistence.Lob; import jakarta.persistence.Table; import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Size; @@ -24,5 +25,9 @@ public class TPartItemSubEntity { @Column(name = "part_item_sub_title", nullable = false, length = 128) private String partItemSubTitle; + @Lob + @Column(name = "part_item_sub_comment") + private String partItemSubComment; -} \ No newline at end of file + +} diff --git a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemBaseRepository.java b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemBaseRepository.java index 59ec459..de11b4f 100644 --- a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemBaseRepository.java +++ b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemBaseRepository.java @@ -4,10 +4,17 @@ import com.kri.epolicy.dash.back.persistence.entity.TPartItemBaseEntity; import java.util.Collection; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; public interface PartItemBaseRepository extends JpaRepository { List findByWaveCdAndPartCd(Short waveCd, Short partCd); List findByWaveCdIn(Collection waveCodes); + + @Modifying(clearAutomatically = true, flushAutomatically = true) + @Query("delete from TPartItemBaseEntity e where e.waveCd = :waveCd") + int deleteForResetByWaveCd(@Param("waveCd") Short waveCd); } diff --git a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemChartHighlightRepository.java b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemChartHighlightRepository.java new file mode 100644 index 0000000..74d4b07 --- /dev/null +++ b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemChartHighlightRepository.java @@ -0,0 +1,21 @@ +package com.kri.epolicy.dash.back.persistence.repository; + +import com.kri.epolicy.dash.back.persistence.entity.TPartItemChartHighlightEntity; +import java.util.Collection; +import java.util.List; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +public interface PartItemChartHighlightRepository + extends JpaRepository { + + List findByWaveCdAndPartCd(Short waveCd, Short partCd); + + List findByWaveCdIn(Collection waveCodes); + + @Modifying(clearAutomatically = true, flushAutomatically = true) + @Query("delete from TPartItemChartHighlightEntity e where e.waveCd = :waveCd") + int deleteForResetByWaveCd(@Param("waveCd") Short waveCd); +} diff --git a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemChartRepository.java b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemChartRepository.java new file mode 100644 index 0000000..cf25a47 --- /dev/null +++ b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemChartRepository.java @@ -0,0 +1,20 @@ +package com.kri.epolicy.dash.back.persistence.repository; + +import com.kri.epolicy.dash.back.persistence.entity.TPartItemChartEntity; +import java.util.Collection; +import java.util.List; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; + +public interface PartItemChartRepository extends JpaRepository { + + List findByWaveCdAndPartCd(Short waveCd, Short partCd); + + List findByWaveCdIn(Collection waveCodes); + + @Modifying(clearAutomatically = true, flushAutomatically = true) + @Query("delete from TPartItemChartEntity e where e.waveCd = :waveCd") + int deleteForResetByWaveCd(@Param("waveCd") Short waveCd); +} diff --git a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemDataRepository.java b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemDataRepository.java index 7f77fcc..e4e2af2 100644 --- a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemDataRepository.java +++ b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemDataRepository.java @@ -4,6 +4,9 @@ import com.kri.epolicy.dash.back.persistence.entity.TPartItemDataEntity; import java.util.Collection; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; public interface PartItemDataRepository extends JpaRepository { @@ -13,4 +16,8 @@ public interface PartItemDataRepository extends JpaRepository findByWaveCdIn(Collection waveCodes); + + @Modifying(clearAutomatically = true, flushAutomatically = true) + @Query("delete from TPartItemDataEntity e where e.waveCd = :waveCd") + int deleteForResetByWaveCd(@Param("waveCd") Short waveCd); } diff --git a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemRepository.java b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemRepository.java index 16a3817..e3aee3c 100644 --- a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemRepository.java +++ b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemRepository.java @@ -4,6 +4,9 @@ import com.kri.epolicy.dash.back.persistence.entity.TPartItemEntity; import com.kri.epolicy.dash.back.persistence.entity.id.TPartItemEntityId; import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; public interface PartItemRepository extends JpaRepository { @@ -14,4 +17,8 @@ public interface PartItemRepository Short waveCd, Short partCd ); + + @Modifying(clearAutomatically = true, flushAutomatically = true) + @Query("delete from TPartItemEntity e where e.id.waveCd = :waveCd") + int deleteForResetByWaveCd(@Param("waveCd") Short waveCd); } diff --git a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemSubRepository.java b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemSubRepository.java index ef9213e..f9ad519 100644 --- a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemSubRepository.java +++ b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartItemSubRepository.java @@ -4,12 +4,21 @@ import com.kri.epolicy.dash.back.persistence.entity.TPartItemSubEntity; import com.kri.epolicy.dash.back.persistence.entity.id.TPartItemSubEntityId; import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; public interface PartItemSubRepository extends JpaRepository { + List findByIdWaveCd(Short waveCd); + List findByIdWaveCdAndIdPartCdOrderByIdPartItemCdAscIdPartItemSubCdAsc( Short waveCd, Short partCd ); + + @Modifying(clearAutomatically = true, flushAutomatically = true) + @Query("delete from TPartItemSubEntity e where e.id.waveCd = :waveCd") + int deleteForResetByWaveCd(@Param("waveCd") Short waveCd); } diff --git a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartRepository.java b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartRepository.java index 7282fda..a689979 100644 --- a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartRepository.java +++ b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/PartRepository.java @@ -4,8 +4,15 @@ import com.kri.epolicy.dash.back.persistence.entity.TPartEntity; import com.kri.epolicy.dash.back.persistence.entity.id.TPartEntityId; import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; public interface PartRepository extends JpaRepository { List findByIdWaveCdOrderByPartOrderAsc(Short waveCd); + + @Modifying(clearAutomatically = true, flushAutomatically = true) + @Query("delete from TPartEntity e where e.id.waveCd = :waveCd") + int deleteForResetByWaveCd(@Param("waveCd") Short waveCd); } diff --git a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/SurveyItemRepository.java b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/SurveyItemRepository.java index 6187618..4d08772 100644 --- a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/SurveyItemRepository.java +++ b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/SurveyItemRepository.java @@ -4,6 +4,9 @@ import com.kri.epolicy.dash.back.persistence.entity.TSurveyItemEntity; import java.util.Collection; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; public interface SurveyItemRepository extends JpaRepository { @@ -11,4 +14,8 @@ public interface SurveyItemRepository List findByWaveCdOrderBySurveyItemOrderAsc(Short waveCd); List findByWaveCdIn(Collection waveCodes); + + @Modifying(clearAutomatically = true, flushAutomatically = true) + @Query("delete from TSurveyItemEntity e where e.waveCd = :waveCd") + int deleteForResetByWaveCd(@Param("waveCd") Short waveCd); } diff --git a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/SurveyRepository.java b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/SurveyRepository.java index 1ee3a54..7f39909 100644 --- a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/SurveyRepository.java +++ b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/SurveyRepository.java @@ -4,8 +4,15 @@ import com.kri.epolicy.dash.back.persistence.entity.TSurveyEntity; import com.kri.epolicy.dash.back.persistence.entity.id.TSurveyEntityId; import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; public interface SurveyRepository extends JpaRepository { List findByIdWaveCdOrderBySurveyOrderAsc(Short waveCd); + + @Modifying(clearAutomatically = true, flushAutomatically = true) + @Query("delete from TSurveyEntity e where e.id.waveCd = :waveCd") + int deleteForResetByWaveCd(@Param("waveCd") Short waveCd); } diff --git a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/WaveInfoRepository.java b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/WaveInfoRepository.java index 4304c15..4b5f616 100644 --- a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/WaveInfoRepository.java +++ b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/WaveInfoRepository.java @@ -4,10 +4,17 @@ import com.kri.epolicy.dash.back.persistence.entity.TWaveInfoEntity; import java.util.Collection; import java.util.List; import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; public interface WaveInfoRepository extends JpaRepository { List findByWaveCdOrderByWaveInfoOrderAsc(Short waveCd); List findByWaveCdIn(Collection waveCodes); + + @Modifying(clearAutomatically = true, flushAutomatically = true) + @Query("delete from TWaveInfoEntity e where e.waveCd = :waveCd") + int deleteForResetByWaveCd(@Param("waveCd") Short waveCd); } diff --git a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/WaveRepository.java b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/WaveRepository.java index 193ad34..6ac050a 100644 --- a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/WaveRepository.java +++ b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/WaveRepository.java @@ -3,8 +3,15 @@ package com.kri.epolicy.dash.back.persistence.repository; import com.kri.epolicy.dash.back.persistence.entity.TWaveEntity; import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.data.repository.query.Param; public interface WaveRepository extends JpaRepository { List findAllByOrderByYearDescWaveDesc(); + + @Modifying(clearAutomatically = true, flushAutomatically = true) + @Query("delete from TWaveEntity e where e.id = :waveCd") + int deleteForResetByWaveCd(@Param("waveCd") Short waveCd); } diff --git a/src/main/java/com/kri/epolicy/dash/back/service/ExcelExportService.java b/src/main/java/com/kri/epolicy/dash/back/service/ExcelExportService.java new file mode 100644 index 0000000..54e4536 --- /dev/null +++ b/src/main/java/com/kri/epolicy/dash/back/service/ExcelExportService.java @@ -0,0 +1,187 @@ +package com.kri.epolicy.dash.back.service; + +import com.kri.epolicy.dash.back.common.enums.ChartType; +import com.kri.epolicy.dash.back.common.enums.ChartGapMode; +import com.kri.epolicy.dash.back.dto.excel.ExcelTemplateRows; +import com.kri.epolicy.dash.back.dto.excel.ExcelWorkbookData; +import com.kri.epolicy.dash.back.persistence.entity.TPartItemBaseEntity; +import com.kri.epolicy.dash.back.persistence.entity.TPartItemChartEntity; +import com.kri.epolicy.dash.back.persistence.entity.TPartItemChartHighlightEntity; +import com.kri.epolicy.dash.back.persistence.entity.TPartItemDataEntity; +import com.kri.epolicy.dash.back.persistence.repository.PartItemBaseRepository; +import com.kri.epolicy.dash.back.persistence.repository.PartItemChartHighlightRepository; +import com.kri.epolicy.dash.back.persistence.repository.PartItemChartRepository; +import com.kri.epolicy.dash.back.persistence.repository.PartItemDataRepository; +import com.kri.epolicy.dash.back.persistence.repository.PartItemRepository; +import com.kri.epolicy.dash.back.persistence.repository.PartItemSubRepository; +import com.kri.epolicy.dash.back.persistence.repository.PartRepository; +import com.kri.epolicy.dash.back.persistence.repository.SurveyItemRepository; +import com.kri.epolicy.dash.back.persistence.repository.SurveyRepository; +import com.kri.epolicy.dash.back.persistence.repository.WaveInfoRepository; +import com.kri.epolicy.dash.back.persistence.repository.WaveRepository; +import java.util.Comparator; +import java.util.List; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@RequiredArgsConstructor +@Transactional(readOnly = true) +public class ExcelExportService { + + private static final Comparator NULLABLE_SHORT = + Comparator.nullsFirst(Comparator.naturalOrder()); + + private final ExcelTemplateService excelTemplateService; + private final WaveRepository waveRepository; + private final WaveInfoRepository waveInfoRepository; + private final SurveyRepository surveyRepository; + private final SurveyItemRepository surveyItemRepository; + private final PartRepository partRepository; + private final PartItemRepository partItemRepository; + private final PartItemSubRepository partItemSubRepository; + private final PartItemBaseRepository partItemBaseRepository; + private final PartItemChartRepository partItemChartRepository; + private final PartItemChartHighlightRepository partItemChartHighlightRepository; + private final PartItemDataRepository partItemDataRepository; + + public byte[] exportWave(Short waveCd) { + var wave = waveRepository.findById(waveCd); + if (wave.isEmpty()) { + return excelTemplateService.createTemplate(); + } + List waveCodes = List.of(waveCd); + List bases = partItemBaseRepository.findByWaveCdIn(waveCodes).stream() + .sorted(resultSeriesComparator()) + .toList(); + List charts = partItemChartRepository.findByWaveCdIn(waveCodes).stream() + .sorted(resultSeriesComparatorForChart()) + .toList(); + List highlights = partItemChartHighlightRepository + .findByWaveCdIn(waveCodes).stream() + .sorted(resultSeriesComparatorForHighlight()) + .toList(); + List itemData = partItemDataRepository.findByWaveCdIn(waveCodes).stream() + .sorted(resultDataComparator()) + .toList(); + + ExcelWorkbookData data = new ExcelWorkbookData( + wave.stream() + .map(entity -> new ExcelTemplateRows.Wave( + value(entity.getId()), value(entity.getYear()), value(entity.getWave()), + entity.getLabel(), booleanValue(entity.getIsOpen()))) + .toList(), + waveInfoRepository.findByWaveCdOrderByWaveInfoOrderAsc(waveCd).stream() + .map(info -> new ExcelTemplateRows.WaveInfo( + value(info.getWaveCd()), value(info.getWaveInfoOrder()), + info.getWaveInfoTitle(), info.getWaveInfoContent())) + .toList(), + surveyRepository.findByIdWaveCdOrderBySurveyOrderAsc(waveCd).stream() + .map(survey -> new ExcelTemplateRows.Survey( + value(survey.getId().getWaveCd()), value(survey.getId().getSurveyCd()), + value(survey.getSurveyOrder()), survey.getSurveyTitle(), survey.getSurveyAlias(), + survey.getSurveyColor())) + .toList(), + surveyItemRepository.findByWaveCdOrderBySurveyItemOrderAsc(waveCd).stream() + .sorted(Comparator.comparing( + com.kri.epolicy.dash.back.persistence.entity.TSurveyItemEntity::getSurveyCd) + .thenComparing( + com.kri.epolicy.dash.back.persistence.entity.TSurveyItemEntity + ::getSurveyItemOrder)) + .map(item -> new ExcelTemplateRows.SurveyItem( + value(item.getWaveCd()), value(item.getSurveyCd()), + value(item.getSurveyItemOrder()), item.getSurveyItemTitle(), + item.getSurveyItemContent())) + .toList(), + partRepository.findByIdWaveCdOrderByPartOrderAsc(waveCd).stream() + .map(part -> new ExcelTemplateRows.Part( + value(part.getId().getWaveCd()), value(part.getId().getPartCd()), + value(part.getPartOrder()), part.getPartTitle())) + .toList(), + partItemRepository.findByIdWaveCdOrderByPartItemOrderAsc(waveCd).stream() + .sorted(Comparator.comparing( + (com.kri.epolicy.dash.back.persistence.entity.TPartItemEntity item) -> + item.getId().getPartCd()) + .thenComparing(item -> item.getPartItemOrder())) + .map(item -> new ExcelTemplateRows.PartItem( + value(item.getId().getWaveCd()), value(item.getId().getPartCd()), + value(item.getId().getPartItemCd()), value(item.getPartItemOrder()), + item.getPartItemTitle(), item.getPartItemComment())) + .toList(), + partItemSubRepository.findByIdWaveCd(waveCd).stream() + .sorted(Comparator.comparing( + (com.kri.epolicy.dash.back.persistence.entity.TPartItemSubEntity sub) -> + sub.getId().getPartCd()) + .thenComparing(sub -> sub.getId().getPartItemCd()) + .thenComparing(sub -> sub.getId().getPartItemSubCd())) + .map(sub -> new ExcelTemplateRows.PartItemSub( + value(sub.getId().getWaveCd()), value(sub.getId().getPartCd()), + value(sub.getId().getPartItemCd()), value(sub.getId().getPartItemSubCd()), + sub.getPartItemSubTitle(), sub.getPartItemSubComment())) + .toList(), + bases.stream().map(base -> new ExcelTemplateRows.PartItemBase( + value(base.getWaveCd()), value(base.getPartCd()), value(base.getPartItemCd()), + value(base.getSurveyCd()), value(base.getPartItemSubCd()), + value(base.getBaseCount()), base.getBaseText())).toList(), + charts.stream().map(chart -> new ExcelTemplateRows.PartItemChart( + value(chart.getWaveCd()), value(chart.getPartCd()), value(chart.getPartItemCd()), + value(chart.getSurveyCd()), value(chart.getPartItemSubCd()), + chartTypeLabel(chart.getChartType()), chart.getChartColor(), + ChartGapMode.fromCodeOrDefault(chart.getChartGapMode()).name())).toList(), + highlights.stream().map(highlight -> new ExcelTemplateRows.PartItemChartHighlight( + value(highlight.getWaveCd()), value(highlight.getPartCd()), + value(highlight.getPartItemCd()), value(highlight.getSurveyCd()), + value(highlight.getPartItemSubCd()), highlight.getChartHighlightMode(), + highlight.getChartHighlightValue(), highlight.getChartHighlightColor())).toList(), + itemData.stream().map(item -> new ExcelTemplateRows.PartItemData( + value(item.getWaveCd()), value(item.getPartCd()), value(item.getPartItemCd()), + value(item.getSurveyCd()), value(item.getPartItemSubCd()), + value(item.getPartItemDataOrder()), item.getPartItemDataLabel(), + item.getPartItemDataValue().toPlainString(), booleanValue(item.getIsChartVisible()))) + .toList() + ); + return excelTemplateService.createWorkbook(data); + } + + private Comparator resultSeriesComparator() { + return Comparator.comparing(TPartItemBaseEntity::getPartCd) + .thenComparing(TPartItemBaseEntity::getPartItemCd) + .thenComparing(TPartItemBaseEntity::getSurveyCd) + .thenComparing(TPartItemBaseEntity::getPartItemSubCd, NULLABLE_SHORT); + } + + private Comparator resultSeriesComparatorForChart() { + return Comparator.comparing(TPartItemChartEntity::getPartCd) + .thenComparing(TPartItemChartEntity::getPartItemCd) + .thenComparing(TPartItemChartEntity::getSurveyCd) + .thenComparing(TPartItemChartEntity::getPartItemSubCd, NULLABLE_SHORT); + } + + private Comparator resultSeriesComparatorForHighlight() { + return Comparator.comparing(TPartItemChartHighlightEntity::getPartCd) + .thenComparing(TPartItemChartHighlightEntity::getPartItemCd) + .thenComparing(TPartItemChartHighlightEntity::getSurveyCd) + .thenComparing(TPartItemChartHighlightEntity::getPartItemSubCd, NULLABLE_SHORT); + } + + private Comparator resultDataComparator() { + return Comparator.comparing(TPartItemDataEntity::getPartCd) + .thenComparing(TPartItemDataEntity::getPartItemCd) + .thenComparing(TPartItemDataEntity::getSurveyCd) + .thenComparing(TPartItemDataEntity::getPartItemSubCd, NULLABLE_SHORT) + .thenComparing(TPartItemDataEntity::getPartItemDataOrder); + } + + private String chartTypeLabel(String code) { + return code == null ? ChartType.BAR.getLabel() : ChartType.fromCode(code).getLabel(); + } + + private String booleanValue(Boolean value) { + return Boolean.TRUE.equals(value) ? "1" : "0"; + } + + private String value(Object value) { + return value == null ? null : value.toString(); + } +} diff --git a/src/main/java/com/kri/epolicy/dash/back/service/ExcelImportService.java b/src/main/java/com/kri/epolicy/dash/back/service/ExcelImportService.java index 8fc0efe..8075e6f 100644 --- a/src/main/java/com/kri/epolicy/dash/back/service/ExcelImportService.java +++ b/src/main/java/com/kri/epolicy/dash/back/service/ExcelImportService.java @@ -4,6 +4,8 @@ import com.kri.epolicy.dash.back.dto.request.ExcelData; import com.kri.epolicy.dash.back.dto.response.ExcelImportResponse; import com.kri.epolicy.dash.back.persistence.entity.TPartEntity; import com.kri.epolicy.dash.back.persistence.entity.TPartItemBaseEntity; +import com.kri.epolicy.dash.back.persistence.entity.TPartItemChartEntity; +import com.kri.epolicy.dash.back.persistence.entity.TPartItemChartHighlightEntity; import com.kri.epolicy.dash.back.persistence.entity.TPartItemDataEntity; import com.kri.epolicy.dash.back.persistence.entity.TPartItemEntity; import com.kri.epolicy.dash.back.persistence.entity.TPartItemSubEntity; @@ -16,6 +18,8 @@ import com.kri.epolicy.dash.back.persistence.entity.id.TPartItemEntityId; import com.kri.epolicy.dash.back.persistence.entity.id.TPartItemSubEntityId; import com.kri.epolicy.dash.back.persistence.entity.id.TSurveyEntityId; import com.kri.epolicy.dash.back.persistence.repository.PartItemBaseRepository; +import com.kri.epolicy.dash.back.persistence.repository.PartItemChartHighlightRepository; +import com.kri.epolicy.dash.back.persistence.repository.PartItemChartRepository; import com.kri.epolicy.dash.back.persistence.repository.PartItemDataRepository; import com.kri.epolicy.dash.back.persistence.repository.PartItemRepository; import com.kri.epolicy.dash.back.persistence.repository.PartItemSubRepository; @@ -24,7 +28,6 @@ import com.kri.epolicy.dash.back.persistence.repository.SurveyItemRepository; import com.kri.epolicy.dash.back.persistence.repository.SurveyRepository; import com.kri.epolicy.dash.back.persistence.repository.WaveInfoRepository; import com.kri.epolicy.dash.back.persistence.repository.WaveRepository; -import java.util.Map; import java.util.Set; import java.util.stream.Collectors; import lombok.RequiredArgsConstructor; @@ -37,6 +40,7 @@ import org.springframework.web.multipart.MultipartFile; public class ExcelImportService { private final ExcelImportValidator excelImportValidator; + private final ExcelResetService excelResetService; private final WaveRepository waveRepository; private final WaveInfoRepository waveInfoRepository; private final SurveyRepository surveyRepository; @@ -45,6 +49,8 @@ public class ExcelImportService { private final PartItemRepository partItemRepository; private final PartItemSubRepository partItemSubRepository; private final PartItemBaseRepository partItemBaseRepository; + private final PartItemChartRepository partItemChartRepository; + private final PartItemChartHighlightRepository partItemChartHighlightRepository; private final PartItemDataRepository partItemDataRepository; @Transactional @@ -53,32 +59,7 @@ public class ExcelImportService { Set waveCodes = data.waves().stream() .map(ExcelData.WaveRow::waveCd) .collect(Collectors.toSet()); - Map waveInfoIds = waveInfoRepository.findByWaveCdIn(waveCodes) - .stream().collect(Collectors.toMap( - entity -> new WaveInfoKey(entity.getWaveCd(), entity.getWaveInfoOrder()), - TWaveInfoEntity::getId, - firstValue())); - Map surveyItemIds = surveyItemRepository - .findByWaveCdIn(waveCodes).stream().collect(Collectors.toMap( - entity -> new SurveyItemKey( - entity.getWaveCd(), entity.getSurveyCd(), entity.getSurveyItemOrder()), - TSurveyItemEntity::getId, - firstValue())); - Map partItemBaseIds = partItemBaseRepository - .findByWaveCdIn(waveCodes).stream().collect(Collectors.toMap( - entity -> new ResultSeriesKey( - entity.getWaveCd(), entity.getPartCd(), entity.getPartItemCd(), - entity.getSurveyCd(), entity.getPartItemSubCd()), - TPartItemBaseEntity::getId, - firstValue())); - Map partItemDataIds = partItemDataRepository - .findByWaveCdIn(waveCodes).stream().collect(Collectors.toMap( - entity -> new ResultCategoryKey( - entity.getWaveCd(), entity.getPartCd(), entity.getPartItemCd(), - entity.getSurveyCd(), entity.getPartItemSubCd(), - entity.getPartItemDataOrder()), - TPartItemDataEntity::getId, - firstValue())); + excelResetService.resetWaves(waveCodes); waveRepository.saveAll(data.waves().stream().map(row -> { TWaveEntity entity = new TWaveEntity(); @@ -92,7 +73,6 @@ public class ExcelImportService { waveInfoRepository.saveAll(data.waveInfos().stream().map(row -> { TWaveInfoEntity entity = new TWaveInfoEntity(); - entity.setId(waveInfoIds.get(new WaveInfoKey(row.waveCd(), row.waveInfoOrder()))); entity.setWaveCd(row.waveCd()); entity.setWaveInfoOrder(row.waveInfoOrder()); entity.setWaveInfoTitle(row.waveInfoTitle()); @@ -112,8 +92,6 @@ public class ExcelImportService { surveyItemRepository.saveAll(data.surveyItems().stream().map(row -> { TSurveyItemEntity entity = new TSurveyItemEntity(); - entity.setId(surveyItemIds.get( - new SurveyItemKey(row.waveCd(), row.surveyCd(), row.surveyItemOrder()))); entity.setWaveCd(row.waveCd()); entity.setSurveyCd(row.surveyCd()); entity.setSurveyItemOrder(row.surveyItemOrder()); @@ -135,7 +113,6 @@ public class ExcelImportService { entity.setId(partItemId(row.waveCd(), row.partCd(), row.partItemCd())); entity.setPartItemOrder(row.partItemOrder()); entity.setPartItemTitle(row.partItemTitle()); - entity.setChartType(row.chartType()); entity.setPartItemComment(row.partItemComment()); return entity; }).toList()); @@ -145,13 +122,12 @@ public class ExcelImportService { entity.setId(partItemSubId( row.waveCd(), row.partCd(), row.partItemCd(), row.partItemSubCd())); entity.setPartItemSubTitle(row.partItemSubTitle()); + entity.setPartItemSubComment(row.partItemSubComment()); return entity; }).toList()); partItemBaseRepository.saveAll(data.partItemBases().stream().map(row -> { TPartItemBaseEntity entity = new TPartItemBaseEntity(); - entity.setId(partItemBaseIds.get(new ResultSeriesKey( - row.waveCd(), row.partCd(), row.partItemCd(), row.surveyCd(), row.partItemSubCd()))); entity.setWaveCd(row.waveCd()); entity.setPartCd(row.partCd()); entity.setPartItemCd(row.partItemCd()); @@ -162,11 +138,34 @@ public class ExcelImportService { return entity; }).toList()); + partItemChartRepository.saveAll(data.partItemCharts().stream().map(row -> { + TPartItemChartEntity entity = new TPartItemChartEntity(); + entity.setWaveCd(row.waveCd()); + entity.setPartCd(row.partCd()); + entity.setPartItemCd(row.partItemCd()); + entity.setSurveyCd(row.surveyCd()); + entity.setPartItemSubCd(row.partItemSubCd()); + entity.setChartType(row.chartType().getCode()); + entity.setChartColor(row.chartColor()); + entity.setChartGapMode(row.chartGapMode().name()); + return entity; + }).toList()); + + partItemChartHighlightRepository.saveAll(data.partItemChartHighlights().stream().map(row -> { + TPartItemChartHighlightEntity entity = new TPartItemChartHighlightEntity(); + entity.setWaveCd(row.waveCd()); + entity.setPartCd(row.partCd()); + entity.setPartItemCd(row.partItemCd()); + entity.setSurveyCd(row.surveyCd()); + entity.setPartItemSubCd(row.partItemSubCd()); + entity.setChartHighlightMode(row.chartHighlightMode()); + entity.setChartHighlightValue(row.chartHighlightValue()); + entity.setChartHighlightColor(row.chartHighlightColor()); + return entity; + }).toList()); + partItemDataRepository.saveAll(data.partItemData().stream().map(row -> { TPartItemDataEntity entity = new TPartItemDataEntity(); - entity.setId(partItemDataIds.get(new ResultCategoryKey( - row.waveCd(), row.partCd(), row.partItemCd(), row.surveyCd(), row.partItemSubCd(), - row.partItemDataOrder()))); entity.setWaveCd(row.waveCd()); entity.setPartCd(row.partCd()); entity.setPartItemCd(row.partItemCd()); @@ -188,6 +187,8 @@ public class ExcelImportService { data.partItems().size(), data.partItemSubs().size(), data.partItemBases().size(), + data.partItemCharts().size(), + data.partItemChartHighlights().size(), data.partItemData().size() ); } @@ -228,32 +229,4 @@ public class ExcelImportService { return id; } - private java.util.function.BinaryOperator firstValue() { - return (first, ignored) -> first; - } - - private record WaveInfoKey(Short waveCd, Short order) { - } - - private record SurveyItemKey(Short waveCd, Short surveyCd, Short order) { - } - - private record ResultSeriesKey( - Short waveCd, - Short partCd, - Short partItemCd, - Short surveyCd, - Short partItemSubCd - ) { - } - - private record ResultCategoryKey( - Short waveCd, - Short partCd, - Short partItemCd, - Short surveyCd, - Short partItemSubCd, - Short order - ) { - } } diff --git a/src/main/java/com/kri/epolicy/dash/back/service/ExcelImportValidator.java b/src/main/java/com/kri/epolicy/dash/back/service/ExcelImportValidator.java index 1b29739..814ae90 100644 --- a/src/main/java/com/kri/epolicy/dash/back/service/ExcelImportValidator.java +++ b/src/main/java/com/kri/epolicy/dash/back/service/ExcelImportValidator.java @@ -4,9 +4,13 @@ import com.kri.common.feature.excel.ExcelColumn; import com.kri.common.feature.excel.ExcelMapper; import com.kri.common.feature.web.BusinessException; import com.kri.epolicy.dash.back.common.enums.ChartType; +import com.kri.epolicy.dash.back.common.enums.ChartHighlightMode; +import com.kri.epolicy.dash.back.common.enums.ChartGapMode; import com.kri.epolicy.dash.back.dto.excel.ExcelTemplateRows; import com.kri.epolicy.dash.back.dto.request.ExcelData; import com.kri.epolicy.dash.back.dto.request.ExcelData.PartItemBaseRow; +import com.kri.epolicy.dash.back.dto.request.ExcelData.PartItemChartHighlightRow; +import com.kri.epolicy.dash.back.dto.request.ExcelData.PartItemChartRow; import com.kri.epolicy.dash.back.dto.request.ExcelData.PartItemDataRow; import com.kri.epolicy.dash.back.dto.request.ExcelData.PartItemRow; import com.kri.epolicy.dash.back.dto.request.ExcelData.PartItemSubRow; @@ -34,6 +38,7 @@ import java.util.function.BiFunction; import java.util.function.Function; import java.util.function.Predicate; import java.util.stream.Collectors; +import java.util.regex.Pattern; import org.apache.poi.ss.usermodel.DataFormatter; import org.apache.poi.ss.usermodel.Row; import org.apache.poi.ss.usermodel.Sheet; @@ -46,6 +51,8 @@ import org.springframework.web.multipart.MultipartFile; public class ExcelImportValidator { private static final int HEADER_ROW_NUMBER = 1; + private static final Pattern COLOR_PATTERN = Pattern.compile("#[0-9A-Fa-f]{6}"); + private static final Pattern SPECIFIED_VALUE_PATTERN = Pattern.compile("\\d+(,\\d+)*"); public ExcelData validateAndConvert(MultipartFile file) { validateFile(file); @@ -71,17 +78,29 @@ public class ExcelImportValidator { row.getPartTitle()), this::toPartRow), readRows(workbook, ExcelTemplateRows.PART_ITEM_SHEET, ExcelTemplateRows.PartItem.class, row -> allBlank(row.getWaveCd(), row.getPartCd(), row.getPartItemCd(), - row.getPartItemOrder(), row.getPartItemTitle(), row.getChartType(), - row.getPartItemComment()), this::toPartItemRow), + row.getPartItemOrder(), row.getPartItemTitle(), row.getPartItemComment()), + this::toPartItemRow), readRows(workbook, ExcelTemplateRows.PART_ITEM_SUB_SHEET, ExcelTemplateRows.PartItemSub.class, row -> allBlank(row.getWaveCd(), row.getPartCd(), row.getPartItemCd(), - row.getPartItemSubCd(), row.getPartItemSubTitle()), this::toPartItemSubRow), + row.getPartItemSubCd(), row.getPartItemSubTitle(), + row.getPartItemSubComment()), this::toPartItemSubRow), readRows(workbook, ExcelTemplateRows.PART_ITEM_BASE_SHEET, ExcelTemplateRows.PartItemBase.class, row -> allBlank(row.getWaveCd(), row.getPartCd(), row.getPartItemCd(), row.getSurveyCd(), row.getPartItemSubCd(), row.getBaseCount(), - row.getBaseText()), this::toPartItemBaseRow), + row.getBaseText()), this::toPartItemBaseRow), + readRows(workbook, ExcelTemplateRows.PART_ITEM_CHART_SHEET, + ExcelTemplateRows.PartItemChart.class, + row -> allBlank(row.getWaveCd(), row.getPartCd(), row.getPartItemCd(), + row.getSurveyCd(), row.getPartItemSubCd(), row.getChartType(), + row.getChartColor(), row.getChartGapMode()), this::toPartItemChartRow), + readRows(workbook, ExcelTemplateRows.PART_ITEM_CHART_HIGHLIGHT_SHEET, + ExcelTemplateRows.PartItemChartHighlight.class, + row -> allBlank(row.getWaveCd(), row.getPartCd(), row.getPartItemCd(), + row.getSurveyCd(), row.getPartItemSubCd(), row.getChartHighlightMode(), + row.getChartHighlightValue(), row.getChartHighlightColor()), + this::toPartItemChartHighlightRow), readRows(workbook, ExcelTemplateRows.PART_ITEM_DATA_SHEET, ExcelTemplateRows.PartItemData.class, row -> allBlank(row.getWaveCd(), row.getPartCd(), row.getPartItemCd(), @@ -190,7 +209,7 @@ public class ExcelImportValidator { requiredShort(row.getSurveyOrder(), "survey_order", context), requiredString(row.getSurveyTitle(), "survey_title", 128, context), requiredString(row.getSurveyAlias(), "survey_alias", 32, context), - requiredString(row.getSurveyColor(), "survey_color", 8, context) + requiredColor(row.getSurveyColor(), "survey_color", context) ); } @@ -223,7 +242,6 @@ public class ExcelImportValidator { requiredShort(row.getPartItemCd(), "part_item_cd", context), requiredShort(row.getPartItemOrder(), "part_item_order", context), requiredString(row.getPartItemTitle(), "part_item_title", 128, context), - requiredChartType(row.getChartType(), "chart_type", context), Objects.requireNonNullElse( optionalString(row.getPartItemComment(), "part_item_comment", null, context), "") ); @@ -238,7 +256,8 @@ public class ExcelImportValidator { requiredShort(row.getPartCd(), "part_cd", context), requiredShort(row.getPartItemCd(), "part_item_cd", context), requiredShort(row.getPartItemSubCd(), "part_item_sub_cd", context), - requiredString(row.getPartItemSubTitle(), "part_item_sub_title", 128, context) + requiredString(row.getPartItemSubTitle(), "part_item_sub_title", 128, context), + optionalString(row.getPartItemSubComment(), "part_item_sub_comment", null, context) ); } @@ -274,6 +293,43 @@ public class ExcelImportValidator { ); } + private PartItemChartRow toPartItemChartRow( + ExcelTemplateRows.PartItemChart row, + RowContext context + ) { + return new PartItemChartRow( + requiredShort(row.getWaveCd(), "wave_cd", context), + requiredShort(row.getPartCd(), "part_cd", context), + requiredShort(row.getPartItemCd(), "part_item_cd", context), + requiredShort(row.getSurveyCd(), "survey_cd", context), + optionalShort(row.getPartItemSubCd(), "part_item_sub_cd", context), + requiredChartType(row.getChartType(), "chart_type", context), + optionalColor(row.getChartColor(), "chart_color", context), + ChartGapMode.fromCodeOrDefault(normalized(row.getChartGapMode())) + ); + } + + private PartItemChartHighlightRow toPartItemChartHighlightRow( + ExcelTemplateRows.PartItemChartHighlight row, + RowContext context + ) { + ChartHighlightMode mode = requiredChartHighlightMode( + row.getChartHighlightMode(), "chart_highlight_mode", context); + String value = optionalString( + row.getChartHighlightValue(), "chart_highlight_value", 32, context); + validateHighlightValue(mode, value, context); + return new PartItemChartHighlightRow( + requiredShort(row.getWaveCd(), "wave_cd", context), + requiredShort(row.getPartCd(), "part_cd", context), + requiredShort(row.getPartItemCd(), "part_item_cd", context), + requiredShort(row.getSurveyCd(), "survey_cd", context), + optionalShort(row.getPartItemSubCd(), "part_item_sub_cd", context), + mode.name(), + value, + requiredColor(row.getChartHighlightColor(), "chart_highlight_color", context) + ); + } + private void validateRelationships(ExcelData data) { Set waveKeys = uniqueKeys( data.waves(), WaveRow::waveCd, ExcelTemplateRows.WAVE_SHEET); @@ -293,6 +349,10 @@ public class ExcelImportValidator { Set subKeys = uniqueKeys(data.partItemSubs(), row -> new SubKey(row.waveCd(), row.partCd(), row.partItemCd(), row.partItemSubCd()), ExcelTemplateRows.PART_ITEM_SUB_SHEET); + uniqueKeys(data.partItemCharts(), this::resultSeriesKey, + ExcelTemplateRows.PART_ITEM_CHART_SHEET); + uniqueKeys(data.partItemChartHighlights(), this::resultSeriesKey, + ExcelTemplateRows.PART_ITEM_CHART_HIGHLIGHT_SHEET); requireParents(data.waveInfos(), WaveInfoRow::waveCd, waveKeys, ExcelTemplateRows.WAVE_INFO_SHEET, "wave_cd"); @@ -323,10 +383,30 @@ public class ExcelImportValidator { row.partItemSubCd(), itemKeys, surveyKeys, subKeys, itemsWithSubs, ExcelTemplateRows.PART_ITEM_DATA_SHEET); } + for (PartItemChartRow row : data.partItemCharts()) { + validateResultRelationship(row.waveCd(), row.partCd(), row.partItemCd(), row.surveyCd(), + row.partItemSubCd(), itemKeys, surveyKeys, subKeys, itemsWithSubs, + ExcelTemplateRows.PART_ITEM_CHART_SHEET); + } + for (PartItemChartHighlightRow row : data.partItemChartHighlights()) { + validateResultRelationship(row.waveCd(), row.partCd(), row.partItemCd(), row.surveyCd(), + row.partItemSubCd(), itemKeys, surveyKeys, subKeys, itemsWithSubs, + ExcelTemplateRows.PART_ITEM_CHART_HIGHLIGHT_SHEET); + } validateResultBases(data.partItemBases(), data.partItemData()); validateCategoryConsistency(data.partItemData()); } + private ResultSeriesKey resultSeriesKey(PartItemChartRow row) { + return new ResultSeriesKey( + row.waveCd(), row.partCd(), row.partItemCd(), row.surveyCd(), row.partItemSubCd()); + } + + private ResultSeriesKey resultSeriesKey(PartItemChartHighlightRow row) { + return new ResultSeriesKey( + row.waveCd(), row.partCd(), row.partItemCd(), row.surveyCd(), row.partItemSubCd()); + } + private void validateResultBases(List bases, List data) { Set baseKeys = uniqueKeys(bases, row -> new ResultSeriesKey( @@ -400,7 +480,7 @@ public class ExcelImportValidator { "Sub가 있는 문항의 part_item_sub_cd는 필수입니다: " + itemKey); } if (!subKeys.contains(new SubKey(waveCd, partCd, partItemCd, partItemSubCd))) { - throw relationshipError(sheetName, "존재하지 않는 Sub를 참조합니다: " + partItemSubCd); + throw relationshipError(sheetName, "존재하지 않는 Sub를 참조합니다: " + partItemCd + "/" + partItemSubCd); } } else if (partItemSubCd != null) { throw relationshipError(sheetName, @@ -551,6 +631,56 @@ public class ExcelImportValidator { } } + private ChartHighlightMode requiredChartHighlightMode( + String rawValue, + String column, + RowContext context + ) { + String code = requiredRaw(rawValue, column, context); + try { + return ChartHighlightMode.fromCode(code); + } catch (IllegalArgumentException exception) { + throw cellError(context, column, + "MAX_VALUE, LAST_VISIBLE 또는 SPECIFIED여야 합니다."); + } + } + + private String requiredColor(String rawValue, String column, RowContext context) { + String color = requiredString(rawValue, column, 8, context); + validateColor(color, column, context); + return color; + } + + private String optionalColor(String rawValue, String column, RowContext context) { + String color = optionalString(rawValue, column, 8, context); + if (color != null) { + validateColor(color, column, context); + } + return color; + } + + private void validateColor(String color, String column, RowContext context) { + if (!COLOR_PATTERN.matcher(color).matches()) { + throw cellError(context, column, "#RRGGBB 형식이어야 합니다."); + } + } + + private void validateHighlightValue( + ChartHighlightMode mode, + String value, + RowContext context + ) { + if (mode == ChartHighlightMode.SPECIFIED) { + if (value == null || !SPECIFIED_VALUE_PATTERN.matcher(value).matches()) { + throw cellError(context, "chart_highlight_value", + "SPECIFIED 모드는 공백 없는 정수 목록이어야 합니다. 예: 1,3,5"); + } + } else if (value != null) { + throw cellError(context, "chart_highlight_value", + mode.name() + " 모드에서는 NULL이어야 합니다."); + } + } + private String requiredRaw(String rawValue, String column, RowContext context) { String value = normalized(rawValue); if (value == null) { diff --git a/src/main/java/com/kri/epolicy/dash/back/service/ExcelResetService.java b/src/main/java/com/kri/epolicy/dash/back/service/ExcelResetService.java new file mode 100644 index 0000000..3133dc4 --- /dev/null +++ b/src/main/java/com/kri/epolicy/dash/back/service/ExcelResetService.java @@ -0,0 +1,70 @@ +package com.kri.epolicy.dash.back.service; + +import com.kri.epolicy.dash.back.dto.response.ExcelResetResponse; +import com.kri.epolicy.dash.back.persistence.repository.PartItemBaseRepository; +import com.kri.epolicy.dash.back.persistence.repository.PartItemChartHighlightRepository; +import com.kri.epolicy.dash.back.persistence.repository.PartItemChartRepository; +import com.kri.epolicy.dash.back.persistence.repository.PartItemDataRepository; +import com.kri.epolicy.dash.back.persistence.repository.PartItemRepository; +import com.kri.epolicy.dash.back.persistence.repository.PartItemSubRepository; +import com.kri.epolicy.dash.back.persistence.repository.PartRepository; +import com.kri.epolicy.dash.back.persistence.repository.SurveyItemRepository; +import com.kri.epolicy.dash.back.persistence.repository.SurveyRepository; +import com.kri.epolicy.dash.back.persistence.repository.WaveInfoRepository; +import com.kri.epolicy.dash.back.persistence.repository.WaveRepository; +import java.util.Collection; +import lombok.RequiredArgsConstructor; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +@Service +@RequiredArgsConstructor +public class ExcelResetService { + + private final WaveRepository waveRepository; + private final WaveInfoRepository waveInfoRepository; + private final SurveyRepository surveyRepository; + private final SurveyItemRepository surveyItemRepository; + private final PartRepository partRepository; + private final PartItemRepository partItemRepository; + private final PartItemSubRepository partItemSubRepository; + private final PartItemBaseRepository partItemBaseRepository; + private final PartItemChartRepository partItemChartRepository; + private final PartItemChartHighlightRepository partItemChartHighlightRepository; + private final PartItemDataRepository partItemDataRepository; + + @Transactional + public ExcelResetResponse resetWave(Short waveCd) { + int partItemDataCount = partItemDataRepository.deleteForResetByWaveCd(waveCd); + int partItemChartHighlightCount = + partItemChartHighlightRepository.deleteForResetByWaveCd(waveCd); + int partItemChartCount = partItemChartRepository.deleteForResetByWaveCd(waveCd); + int partItemBaseCount = partItemBaseRepository.deleteForResetByWaveCd(waveCd); + int partItemSubCount = partItemSubRepository.deleteForResetByWaveCd(waveCd); + int partItemCount = partItemRepository.deleteForResetByWaveCd(waveCd); + int partCount = partRepository.deleteForResetByWaveCd(waveCd); + int surveyItemCount = surveyItemRepository.deleteForResetByWaveCd(waveCd); + int surveyCount = surveyRepository.deleteForResetByWaveCd(waveCd); + int waveInfoCount = waveInfoRepository.deleteForResetByWaveCd(waveCd); + int waveCount = waveRepository.deleteForResetByWaveCd(waveCd); + return new ExcelResetResponse( + waveCd, + waveCount, + waveInfoCount, + surveyCount, + surveyItemCount, + partCount, + partItemCount, + partItemSubCount, + partItemBaseCount, + partItemChartCount, + partItemChartHighlightCount, + partItemDataCount + ); + } + + @Transactional + public void resetWaves(Collection waveCodes) { + waveCodes.forEach(this::resetWave); + } +} diff --git a/src/main/java/com/kri/epolicy/dash/back/service/ExcelTemplateService.java b/src/main/java/com/kri/epolicy/dash/back/service/ExcelTemplateService.java index b87d49d..509877a 100644 --- a/src/main/java/com/kri/epolicy/dash/back/service/ExcelTemplateService.java +++ b/src/main/java/com/kri/epolicy/dash/back/service/ExcelTemplateService.java @@ -3,7 +3,10 @@ package com.kri.epolicy.dash.back.service; import com.kri.common.feature.excel.ExcelMapper; import com.kri.common.feature.web.BusinessException; import com.kri.epolicy.dash.back.dto.excel.ExcelTemplateRows; +import com.kri.epolicy.dash.back.dto.excel.ExcelWorkbookData; import static com.kri.epolicy.dash.back.dto.excel.ExcelTemplateRows.PART_ITEM_BASE_SHEET; +import static com.kri.epolicy.dash.back.dto.excel.ExcelTemplateRows.PART_ITEM_CHART_HIGHLIGHT_SHEET; +import static com.kri.epolicy.dash.back.dto.excel.ExcelTemplateRows.PART_ITEM_CHART_SHEET; import static com.kri.epolicy.dash.back.dto.excel.ExcelTemplateRows.PART_ITEM_DATA_SHEET; import static com.kri.epolicy.dash.back.dto.excel.ExcelTemplateRows.PART_ITEM_SHEET; import static com.kri.epolicy.dash.back.dto.excel.ExcelTemplateRows.PART_ITEM_SUB_SHEET; @@ -26,17 +29,28 @@ public class ExcelTemplateService { public static final String TEMPLATE_FILENAME = "epolicy-data-template.xlsx"; public byte[] createTemplate() { + return createWorkbook(ExcelWorkbookData.empty()); + } + + public byte[] createWorkbook(ExcelWorkbookData data) { try (Workbook workbook = ExcelMapper.writeToWorkbook( - List.of(), ExcelTemplateRows.Wave.class, WAVE_SHEET); + data.waves(), ExcelTemplateRows.Wave.class, WAVE_SHEET); ByteArrayOutputStream outputStream = new ByteArrayOutputStream()) { - append(workbook, WAVE_INFO_SHEET, ExcelTemplateRows.WaveInfo.class); - append(workbook, SURVEY_SHEET, ExcelTemplateRows.Survey.class); - append(workbook, SURVEY_ITEM_SHEET, ExcelTemplateRows.SurveyItem.class); - append(workbook, PART_SHEET, ExcelTemplateRows.Part.class); - append(workbook, PART_ITEM_SHEET, ExcelTemplateRows.PartItem.class); - append(workbook, PART_ITEM_SUB_SHEET, ExcelTemplateRows.PartItemSub.class); - append(workbook, PART_ITEM_BASE_SHEET, ExcelTemplateRows.PartItemBase.class); - append(workbook, PART_ITEM_DATA_SHEET, ExcelTemplateRows.PartItemData.class); + append(workbook, WAVE_INFO_SHEET, data.waveInfos(), ExcelTemplateRows.WaveInfo.class); + append(workbook, SURVEY_SHEET, data.surveys(), ExcelTemplateRows.Survey.class); + append(workbook, SURVEY_ITEM_SHEET, data.surveyItems(), ExcelTemplateRows.SurveyItem.class); + append(workbook, PART_SHEET, data.parts(), ExcelTemplateRows.Part.class); + append(workbook, PART_ITEM_SHEET, data.partItems(), ExcelTemplateRows.PartItem.class); + append(workbook, PART_ITEM_SUB_SHEET, data.partItemSubs(), + ExcelTemplateRows.PartItemSub.class); + append(workbook, PART_ITEM_BASE_SHEET, data.partItemBases(), + ExcelTemplateRows.PartItemBase.class); + append(workbook, PART_ITEM_CHART_SHEET, data.partItemCharts(), + ExcelTemplateRows.PartItemChart.class); + append(workbook, PART_ITEM_CHART_HIGHLIGHT_SHEET, + data.partItemChartHighlights(), ExcelTemplateRows.PartItemChartHighlight.class); + append(workbook, PART_ITEM_DATA_SHEET, data.partItemData(), + ExcelTemplateRows.PartItemData.class); workbook.write(outputStream); return outputStream.toByteArray(); } catch (IOException | RuntimeException exception) { @@ -45,7 +59,12 @@ public class ExcelTemplateService { } } - private void append(Workbook workbook, String sheetName, Class rowType) { - ExcelMapper.appendSheetToWorkbook(workbook, List.of(), rowType, sheetName, 1); + private void append( + Workbook workbook, + String sheetName, + List rows, + Class rowType + ) { + ExcelMapper.appendSheetToWorkbook(workbook, rows, rowType, sheetName, 1); } } diff --git a/src/main/java/com/kri/epolicy/dash/back/service/WaveQueryService.java b/src/main/java/com/kri/epolicy/dash/back/service/WaveQueryService.java index 95835ae..65bfd40 100644 --- a/src/main/java/com/kri/epolicy/dash/back/service/WaveQueryService.java +++ b/src/main/java/com/kri/epolicy/dash/back/service/WaveQueryService.java @@ -2,6 +2,8 @@ package com.kri.epolicy.dash.back.service; import com.kri.common.feature.web.BusinessException; import com.kri.common.feature.web.RequestUserContext; +import com.kri.epolicy.dash.back.common.enums.ChartType; +import com.kri.epolicy.dash.back.common.enums.ChartGapMode; import com.kri.epolicy.dash.back.config.FileStorageProperties; import com.kri.epolicy.dash.back.dto.response.PartDetailResponse; import com.kri.epolicy.dash.back.dto.response.PartDetailResponse.Audience; @@ -15,6 +17,8 @@ import com.kri.epolicy.dash.back.dto.response.WaveSummaryResponse; import com.kri.epolicy.dash.back.persistence.entity.TFileEntity; import com.kri.epolicy.dash.back.persistence.entity.TPartEntity; import com.kri.epolicy.dash.back.persistence.entity.TPartItemBaseEntity; +import com.kri.epolicy.dash.back.persistence.entity.TPartItemChartEntity; +import com.kri.epolicy.dash.back.persistence.entity.TPartItemChartHighlightEntity; import com.kri.epolicy.dash.back.persistence.entity.TPartItemDataEntity; import com.kri.epolicy.dash.back.persistence.entity.TPartItemEntity; import com.kri.epolicy.dash.back.persistence.entity.TPartItemSubEntity; @@ -24,6 +28,8 @@ import com.kri.epolicy.dash.back.persistence.entity.TWaveEntity; import com.kri.epolicy.dash.back.persistence.entity.id.TPartEntityId; import com.kri.epolicy.dash.back.persistence.repository.FileRepository; import com.kri.epolicy.dash.back.persistence.repository.PartItemBaseRepository; +import com.kri.epolicy.dash.back.persistence.repository.PartItemChartHighlightRepository; +import com.kri.epolicy.dash.back.persistence.repository.PartItemChartRepository; import com.kri.epolicy.dash.back.persistence.repository.PartItemDataRepository; import com.kri.epolicy.dash.back.persistence.repository.PartItemRepository; import com.kri.epolicy.dash.back.persistence.repository.PartItemSubRepository; @@ -38,6 +44,7 @@ import java.util.LinkedHashMap; import java.util.LinkedHashSet; import java.util.List; import java.util.Map; +import java.util.Objects; import java.util.Set; import java.util.function.Function; import java.util.stream.Collectors; @@ -60,6 +67,8 @@ public class WaveQueryService { private final PartItemRepository partItemRepository; private final PartItemSubRepository partItemSubRepository; private final PartItemBaseRepository partItemBaseRepository; + private final PartItemChartRepository partItemChartRepository; + private final PartItemChartHighlightRepository partItemChartHighlightRepository; private final PartItemDataRepository partItemDataRepository; private final WaveAccessPolicy waveAccessPolicy; private final FileStorageProperties fileStorageProperties; @@ -134,6 +143,10 @@ public class WaveQueryService { List subs = partItemSubRepository .findByIdWaveCdAndIdPartCdOrderByIdPartItemCdAscIdPartItemSubCdAsc(waveCd, partCd); List bases = partItemBaseRepository.findByWaveCdAndPartCd(waveCd, partCd); + List charts = partItemChartRepository + .findByWaveCdAndPartCd(waveCd, partCd); + List highlights = partItemChartHighlightRepository + .findByWaveCdAndPartCd(waveCd, partCd); List data = partItemDataRepository .findByWaveCdAndPartCdOrderByPartItemDataOrderAsc(waveCd, partCd); @@ -144,7 +157,8 @@ public class WaveQueryService { waveCd, partCd, part.getPartTitle(), - items.stream().map(item -> toItem(item, surveys, surveyByCode, subsByItem, bases, data)) + items.stream().map(item -> toItem( + item, surveys, surveyByCode, subsByItem, bases, charts, highlights, data)) .toList() ); } @@ -155,6 +169,8 @@ public class WaveQueryService { Map surveyByCode, Map> subsByItem, List allBases, + List allCharts, + List allHighlights, List allData ) { Short itemCd = item.getId().getPartItemCd(); @@ -162,17 +178,30 @@ public class WaveQueryService { .filter(base -> base.getPartItemCd().equals(itemCd)).toList(); List data = allData.stream() .filter(value -> value.getPartItemCd().equals(itemCd)).toList(); + List charts = allCharts.stream() + .filter(chart -> chart.getPartItemCd().equals(itemCd)).toList(); + List highlights = allHighlights.stream() + .filter(highlight -> highlight.getPartItemCd().equals(itemCd)).toList(); List subs = subsByItem.getOrDefault(itemCd, List.of()); List groups = new ArrayList<>(); if (subs.isEmpty()) { - groups.add(toResultGroup(null, bases, data, surveyByCode)); + groups.add(toResultGroup( + null, + bases.stream().filter(base -> base.getPartItemSubCd() == null).toList(), + charts.stream().filter(chart -> chart.getPartItemSubCd() == null).toList(), + highlights.stream().filter(highlight -> highlight.getPartItemSubCd() == null).toList(), + data.stream().filter(value -> value.getPartItemSubCd() == null).toList(), + surveyByCode)); } else { for (TPartItemSubEntity sub : subs) { Short subCd = sub.getId().getPartItemSubCd(); groups.add(toResultGroup( - new SubItem(subCd, sub.getPartItemSubTitle()), + new SubItem(subCd, sub.getPartItemSubTitle(), sub.getPartItemSubComment()), bases.stream().filter(base -> subCd.equals(base.getPartItemSubCd())).toList(), + charts.stream().filter(chart -> subCd.equals(chart.getPartItemSubCd())).toList(), + highlights.stream() + .filter(highlight -> subCd.equals(highlight.getPartItemSubCd())).toList(), data.stream().filter(value -> subCd.equals(value.getPartItemSubCd())).toList(), surveyByCode)); } @@ -185,7 +214,6 @@ public class WaveQueryService { itemCd, item.getPartItemOrder(), item.getPartItemTitle(), - item.getChartType().getCode(), item.getPartItemComment(), toAudience(audienceCodes, surveys, surveyByCode), List.copyOf(groups) @@ -195,12 +223,21 @@ public class WaveQueryService { private ResultGroup toResultGroup( SubItem subItem, List bases, + List charts, + List highlights, List data, Map surveyByCode ) { Map baseBySurvey = bases.stream().collect(Collectors.toMap( TPartItemBaseEntity::getSurveyCd, Function.identity(), (left, right) -> left, LinkedHashMap::new)); + Map chartBySurvey = charts.stream().collect(Collectors.toMap( + TPartItemChartEntity::getSurveyCd, Function.identity(), (left, right) -> left, + LinkedHashMap::new)); + Map highlightBySurvey = highlights.stream() + .collect(Collectors.toMap( + TPartItemChartHighlightEntity::getSurveyCd, Function.identity(), + (left, right) -> left, LinkedHashMap::new)); Map> dataBySurvey = data.stream().collect( Collectors.groupingBy(TPartItemDataEntity::getSurveyCd, LinkedHashMap::new, Collectors.toList())); @@ -218,10 +255,20 @@ public class WaveQueryService { List series = surveyCodes.stream().map(surveyCd -> { TPartItemBaseEntity base = baseBySurvey.get(surveyCd); TSurveyEntity survey = surveyByCode.get(surveyCd); + TPartItemChartEntity chart = chartBySurvey.get(surveyCd); + TPartItemChartHighlightEntity highlight = highlightBySurvey.get(surveyCd); return new Series( surveyCd, survey.getSurveyAlias(), - survey.getSurveyColor(), + chart == null || chart.getChartType() == null + ? ChartType.BAR.getCode() : chart.getChartType(), + chart == null || chart.getChartColor() == null + ? survey.getSurveyColor() : chart.getChartColor(), + ChartGapMode.fromCodeOrDefault( + chart == null ? null : chart.getChartGapMode()).name(), + highlight == null ? null : highlight.getChartHighlightMode(), + highlight == null ? null : highlight.getChartHighlightValue(), + highlight == null ? null : highlight.getChartHighlightColor(), base == null ? null : base.getBaseCount(), base == null ? null : base.getBaseText(), dataBySurvey.get(surveyCd).stream() @@ -244,7 +291,7 @@ public class WaveQueryService { } String label = audienceCodes.stream() .map(surveyByCode::get) - .filter(java.util.Objects::nonNull) + .filter(Objects::nonNull) .sorted(Comparator.comparing(TSurveyEntity::getSurveyOrder)) .map(TSurveyEntity::getSurveyAlias) .collect(Collectors.joining(", ")); From fefdf171398b6823a6c14695f365735c3a244954 Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Tue, 25 Aug 2026 15:07:14 +0900 Subject: [PATCH 3/4] =?UTF-8?q?260825=5F02=5FENH:=20=ED=8C=8C=EC=9D=BC=20?= =?UTF-8?q?=EC=97=85=EB=A1=9C=EB=93=9C=20=EC=8B=9C=20=EC=9C=A0=EC=9D=BC?= =?UTF-8?q?=EC=84=B1=20=EC=A0=95=EB=B3=B4=EB=A5=BC=20waveCd,=20fileName?= =?UTF-8?q?=EC=97=90=EC=84=9C=20waveCd,=20fileOrder=EB=A1=9C=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .agent/project.md | 2 +- AGENTS.md | 2 +- .../repository/FileRepository.java | 2 + .../repository/WaveRepository.java | 7 ++ .../service/ReferenceFileStorageService.java | 90 ++++++++++++++++++- 5 files changed, 98 insertions(+), 5 deletions(-) diff --git a/.agent/project.md b/.agent/project.md index a5f921f..39b46c2 100644 --- a/.agent/project.md +++ b/.agent/project.md @@ -20,7 +20,7 @@ - Excel endpoints are `POST /api/v1/excel/import`, `GET /api/v1/excel/template`, `GET /api/v1/excel/waves/{waveCd}/export`, and `DELETE /api/v1/excel/waves/{waveCd}`. Downloads use the same eleven sheets, order, and headers; a missing Wave exports an empty workbook. - Imports atomically replace every included Wave: validate first, delete all eleven managed tables, then insert. Failures restore prior data. Standalone reset uses the same child-to-root deletion and retains `t_file` metadata and physical files, allowing temporary orphans until that `wave_cd` is reimported. - A reference-file upload writes both the physical file and its `t_file` metadata. Accept `fileTitle` and `fileOrder` as multipart request fields, derive `file_type` from the lowercase filename extension, and keep the original filename as `file_name`. -- For reference-file uploads, accept `waveCd` as a path variable and store the file under `{kri.file.base-dir}/References/{waveCd}` using the original filename. Treat `(wave_cd, file_name)` as the upload logical key: uploading the same filename again preserves `file_idx`, replaces the physical file, and updates `file_title`, `file_order`, and `file_type`. +- For reference-file uploads, accept `waveCd` as a path variable and store files under `{kri.file.base-dir}/References/{waveCd}` using their original names. Treat `(wave_cd, file_order)` as the upload logical key: repeat uploads preserve `file_idx`, replace metadata and the physical file, and remove the prior filename after commit. Reject a filename already used by another order in the same Wave. - Reject a reference-file upload when its `waveCd` does not exist. Coordinate the database transaction and filesystem replacement so a database rollback restores the previous file or removes a newly created file. ## Dashboard Data Model Contract diff --git a/AGENTS.md b/AGENTS.md index dafca61..493d852 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -282,7 +282,7 @@ When implementation is complete, report in Korean: - Excel endpoints are `POST /api/v1/excel/import`, `GET /api/v1/excel/template`, `GET /api/v1/excel/waves/{waveCd}/export`, and `DELETE /api/v1/excel/waves/{waveCd}`. Downloads use the same eleven sheets, order, and headers; a missing Wave exports an empty workbook. - Imports atomically replace every included Wave: validate first, delete all eleven managed tables, then insert. Failures restore prior data. Standalone reset uses the same child-to-root deletion and retains `t_file` metadata and physical files, allowing temporary orphans until that `wave_cd` is reimported. - A reference-file upload writes both the physical file and its `t_file` metadata. Accept `fileTitle` and `fileOrder` as multipart request fields, derive `file_type` from the lowercase filename extension, and keep the original filename as `file_name`. -- For reference-file uploads, accept `waveCd` as a path variable and store the file under `{kri.file.base-dir}/References/{waveCd}` using the original filename. Treat `(wave_cd, file_name)` as the upload logical key: uploading the same filename again preserves `file_idx`, replaces the physical file, and updates `file_title`, `file_order`, and `file_type`. +- For reference-file uploads, accept `waveCd` as a path variable and store files under `{kri.file.base-dir}/References/{waveCd}` using their original names. Treat `(wave_cd, file_order)` as the upload logical key: repeat uploads preserve `file_idx`, replace metadata and the physical file, and remove the prior filename after commit. Reject a filename already used by another order in the same Wave. - Reject a reference-file upload when its `waveCd` does not exist. Coordinate the database transaction and filesystem replacement so a database rollback restores the previous file or removes a newly created file. ## Dashboard Data Model Contract diff --git a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/FileRepository.java b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/FileRepository.java index af33e36..63c83b5 100644 --- a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/FileRepository.java +++ b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/FileRepository.java @@ -9,5 +9,7 @@ public interface FileRepository extends JpaRepository { List findByWaveCdOrderByFileOrderAsc(Short waveCd); + Optional findFirstByWaveCdAndFileOrder(Short waveCd, Short fileOrder); + Optional findFirstByWaveCdAndFileName(Short waveCd, String fileName); } diff --git a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/WaveRepository.java b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/WaveRepository.java index 6ac050a..d8e30d2 100644 --- a/src/main/java/com/kri/epolicy/dash/back/persistence/repository/WaveRepository.java +++ b/src/main/java/com/kri/epolicy/dash/back/persistence/repository/WaveRepository.java @@ -1,8 +1,11 @@ package com.kri.epolicy.dash.back.persistence.repository; import com.kri.epolicy.dash.back.persistence.entity.TWaveEntity; +import jakarta.persistence.LockModeType; import org.springframework.data.jpa.repository.JpaRepository; import java.util.List; +import java.util.Optional; +import org.springframework.data.jpa.repository.Lock; import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.data.repository.query.Param; @@ -11,6 +14,10 @@ public interface WaveRepository extends JpaRepository { List findAllByOrderByYearDescWaveDesc(); + @Lock(LockModeType.PESSIMISTIC_WRITE) + @Query("select e from TWaveEntity e where e.id = :waveCd") + Optional findForUpdateById(@Param("waveCd") Short waveCd); + @Modifying(clearAutomatically = true, flushAutomatically = true) @Query("delete from TWaveEntity e where e.id = :waveCd") int deleteForResetByWaveCd(@Param("waveCd") Short waveCd); diff --git a/src/main/java/com/kri/epolicy/dash/back/service/ReferenceFileStorageService.java b/src/main/java/com/kri/epolicy/dash/back/service/ReferenceFileStorageService.java index 4f5175b..1d6984c 100644 --- a/src/main/java/com/kri/epolicy/dash/back/service/ReferenceFileStorageService.java +++ b/src/main/java/com/kri/epolicy/dash/back/service/ReferenceFileStorageService.java @@ -43,7 +43,7 @@ public class ReferenceFileStorageService { MultipartFile file ) { validateRequest(waveCd, fileTitle, fileOrder, file); - if (!waveRepository.existsById(waveCd)) { + if (waveRepository.findForUpdateById(waveCd).isEmpty()) { throw BusinessException.validationError( "WAVE_NOT_FOUND", "존재하지 않는 waveCd입니다.").with("waveCd", waveCd); } @@ -61,10 +61,15 @@ public class ReferenceFileStorageService { throw invalidFilename("허용되지 않는 파일 경로입니다."); } + TFileEntity entity = fileRepository.findFirstByWaveCdAndFileOrder(waveCd, fileOrder) + .orElseGet(TFileEntity::new); + validateFilenameConflict(waveCd, originalFilename, entity.getId()); + String previousFilename = entity.getFileName(); + Path previousTarget = previousFilename == null + ? null : resolveStoredTarget(targetDirectory, previousFilename); + Path stagedFile = stageFile(targetDirectory, file); try { - TFileEntity entity = fileRepository.findFirstByWaveCdAndFileName(waveCd, originalFilename) - .orElseGet(TFileEntity::new); entity.setWaveCd(waveCd); entity.setFileOrder(fileOrder); entity.setFileTitle(normalizedTitle); @@ -74,6 +79,9 @@ public class ReferenceFileStorageService { replaceFileWithRollbackProtection(stagedFile, target); stagedFile = null; + if (previousTarget != null && !previousTarget.equals(target)) { + removeFileWithRollbackProtection(previousTarget); + } String relativePath = REFERENCES_DIRECTORY + "/" + waveCd + "/" + originalFilename; return new ReferenceFileUploadResponse( @@ -154,6 +162,30 @@ public class ReferenceFileStorageService { return fileType; } + private void validateFilenameConflict( + Short waveCd, + String originalFilename, + Integer currentFileId + ) { + fileRepository.findFirstByWaveCdAndFileName(waveCd, originalFilename) + .filter(existing -> !existing.getId().equals(currentFileId)) + .ifPresent(existing -> { + throw BusinessException.validationError( + "REFERENCE_FILENAME_CONFLICT", + "같은 Wave의 다른 파일 순서에서 이미 사용 중인 파일명입니다.") + .with("waveCd", waveCd) + .with("fileOrder", existing.getFileOrder()); + }); + } + + private Path resolveStoredTarget(Path targetDirectory, String filename) { + Path storedTarget = targetDirectory.resolve(filename).normalize(); + if (!storedTarget.startsWith(targetDirectory)) { + throw storageError(); + } + return storedTarget; + } + private Path stageFile(Path targetDirectory, MultipartFile file) { Path stagedFile = null; try { @@ -215,6 +247,58 @@ public class ReferenceFileStorageService { }); } + private void removeFileWithRollbackProtection(Path target) { + if (!Files.exists(target)) { + return; + } + Path backupFile = null; + boolean targetMoved = false; + try { + backupFile = Files.createTempFile(target.getParent(), ".backup-", ".tmp"); + moveReplacing(target, backupFile); + targetMoved = true; + registerRemovedFileSynchronization(target, backupFile); + } catch (IOException | RuntimeException exception) { + if (targetMoved) { + restoreRemovedFile(target, backupFile); + } else { + deleteQuietly(backupFile, "완성되지 않은 이전 파일 백업을 삭제하지 못했습니다."); + } + throw storageError(); + } + } + + private void registerRemovedFileSynchronization(Path target, Path backupFile) { + if (!TransactionSynchronizationManager.isSynchronizationActive()) { + restoreRemovedFile(target, backupFile); + throw BusinessException.internalError( + "REFERENCE_FILE_TRANSACTION_REQUIRED", "파일 저장 트랜잭션을 시작할 수 없습니다."); + } + TransactionSynchronizationManager.registerSynchronization(new TransactionSynchronization() { + @Override + public void afterCompletion(int status) { + if (status == STATUS_COMMITTED) { + deleteQuietly(backupFile, "교체된 이전 파일의 백업을 삭제하지 못했습니다."); + return; + } + restoreRemovedFile(target, backupFile); + } + }); + } + + private void restoreRemovedFile(Path target, Path backupFile) { + if (backupFile == null || !Files.exists(backupFile)) { + return; + } + try { + moveReplacing(backupFile, target); + } catch (IOException exception) { + log.error("트랜잭션 롤백 중 교체 전 파일을 복구하지 못했습니다: {}", target, exception); + } finally { + deleteQuietly(backupFile, "교체 전 파일의 백업을 삭제하지 못했습니다."); + } + } + private void restoreFile(Path target, Path backupFile, boolean targetExisted) { try { if (targetExisted && backupFile != null && Files.exists(backupFile)) { From d6520a97c558caf7c3d4d173f05714a6dc986482 Mon Sep 17 00:00:00 2001 From: kric_jspark Date: Tue, 25 Aug 2026 16:43:13 +0900 Subject: [PATCH 4/4] =?UTF-8?q?260825=5F03=5FENH:=20=EC=B0=A8=ED=8A=B8=20?= =?UTF-8?q?=EC=83=89=EC=83=81=EC=9D=84=20t=5Fsurvey=20=EC=A2=85=EC=86=8D?= =?UTF-8?q?=EC=A0=81=EC=9C=BC=EB=A1=9C=20=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20?= =?UTF-8?q?=ED=9B=84=EC=86=8D=EC=B2=98=EB=A6=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .agent/project.md | 13 +- AGENTS.md | 13 +- .../dash/back/common/enums/NegativeMode.java | 19 +++ .../back/dto/excel/ExcelTemplateRows.java | 30 +++-- .../dash/back/dto/request/ExcelData.java | 20 ++-- .../back/dto/response/PartDetailResponse.java | 10 +- .../back/dto/response/WaveDetailResponse.java | 3 + .../entity/TPartItemChartEntity.java | 8 -- .../entity/TPartItemChartHighlightEntity.java | 12 +- .../persistence/entity/TPartItemEntity.java | 10 ++ .../entity/TPartItemSubEntity.java | 10 ++ .../persistence/entity/TSurveyEntity.java | 13 +- .../dash/back/service/ExcelExportService.java | 20 ++-- .../dash/back/service/ExcelImportService.java | 11 +- .../back/service/ExcelImportValidator.java | 111 +++++++++++++----- .../dash/back/service/WaveQueryService.java | 94 ++++++++++++--- 16 files changed, 281 insertions(+), 116 deletions(-) create mode 100644 src/main/java/com/kri/epolicy/dash/back/common/enums/NegativeMode.java diff --git a/.agent/project.md b/.agent/project.md index 39b46c2..2dce8b8 100644 --- a/.agent/project.md +++ b/.agent/project.md @@ -15,7 +15,7 @@ - Keep user and file data outside the Excel bulk-import scope. Import the remaining project data from one Excel workbook containing multiple sheets. - The Excel workbook has eleven required table-named sheets: `t_wave`, `t_wave_info`, `t_survey`, `t_survey_item`, `t_part`, `t_part_item`, `t_part_item_sub`, `t_part_item_base`, `t_part_item_chart`, `t_part_item_chart_highlight`, and `t_part_item_data`. Headers use database names and constrained headers list every allowed value in parentheses. The workbook must contain all referenced logical parents. - Omit every auto-increment `_idx` column from Excel. Replacement imports regenerate identities. -- Reject duplicate workbook logical keys: `(wave_cd, wave_info_order)` for Wave info; `(wave_cd, survey_cd, survey_item_order)` for survey items; `(wave_cd, part_cd, part_item_cd, survey_cd, part_item_sub_cd)` for base, chart, and highlight rows; and that result-series key plus `part_item_data_order` for data rows. +- Reject duplicate Excel keys: Wave info `(wave_cd,wave_info_order)`; survey item `(wave_cd,survey_cd,survey_item_order)`; base `(wave_cd,part_cd,part_item_cd,survey_cd,part_item_sub_cd)`; chart/highlight omit `survey_cd`; data adds `part_item_data_order` to base. - Define the Excel import/export schema once with KriCommon `ExcelColumn` DTOs. Use KriCommon `ExcelMapper` for workbook mapping and keep only project-specific type, value, and cross-sheet relationship rules in a consumer-local validator; do not duplicate a general-purpose Excel parser. - Excel endpoints are `POST /api/v1/excel/import`, `GET /api/v1/excel/template`, `GET /api/v1/excel/waves/{waveCd}/export`, and `DELETE /api/v1/excel/waves/{waveCd}`. Downloads use the same eleven sheets, order, and headers; a missing Wave exports an empty workbook. - Imports atomically replace every included Wave: validate first, delete all eleven managed tables, then insert. Failures restore prior data. Standalone reset uses the same child-to-root deletion and retains `t_file` metadata and physical files, allowing temporary orphans until that `wave_cd` is reimported. @@ -34,14 +34,15 @@ - A normal item has no `t_part_item_sub` rows, and both base and data rows must use `part_item_sub_cd = NULL`. Never use `0` as a substitute for this `NULL` value. - An item with sub-items has one or more `t_part_item_sub` rows. Every non-null `part_item_sub_cd` in its base and data rows must reference a sub-item belonging to the same `(wave_cd, part_cd, part_item_cd)`. - Every survey code used by `t_part_item_base` or `t_part_item_data` must belong to the same Wave. Survey items must likewise belong to an existing `(wave_cd, survey_cd)`. -- Treat `t_survey.survey_color` as a required `VARCHAR(8)` value. Include it as the `survey_color` column in the Excel template/import contract and persist it with each survey. +- Store four `VARCHAR(8)` survey palette colors: required `survey_color` plus nullable highlight, negative, and negative-highlight colors. Include all in Excel/API; fall back to default, default, and negative/highlight/default respectively. - Use `t_part_item_base` as the preferred source for determining which survey audiences apply to an item. Display the single matching `survey_alias` when only one audience applies; display `공통` when all defined audiences apply. - Store an optional display string in `t_part_item_base.base_text` (`VARCHAR(128)`). Do not reconstruct it from `base_count`, and do not retain the removed `base_pre_text` or `base_post_text` fields in entities, Excel contracts, or query assembly. - Use the corresponding `*_order` column for API and screen ordering: `wave_info_order`, `survey_order`, `survey_item_order`, `file_order`, `part_order`, `part_item_order`, and `part_item_data_order`. Use `part_item_sub_cd` as the default sub-item order because the schema has no separate sub-item order column. - Use the same `t_part_item_data` rows for both chart and statistical-table views. `is_chart_visible` is a required Boolean column with database default `1`; statistical tables use every row, while charts omit categories and matching values whose flag is false. Do not introduce a separate table-data source that could diverge from chart values. -- Resolve `chart_type`, `chart_color`, and `chart_gap_mode` per `(wave_cd, part_cd, part_item_cd, survey_cd, part_item_sub_cd)` from `t_part_item_chart`, not `t_part_item`. Defaults are `BAR`, `t_survey.survey_color`, and `NONE`; normalize null or unknown gap modes to `NONE`. Allowed gap modes are `NONE`, `ALL`, and `LAST_VISIBLE`. -- Resolve `t_part_item_chart_highlight` independently from `t_part_item_chart`; a highlight may exist without a chart-setting row. Return `chart_highlight_mode`, `chart_highlight_value`, and `chart_highlight_color` to the frontend without calculating highlighted categories in the backend. Supported modes are `MAX_VALUE`, `LAST_VISIBLE`, and `SPECIFIED`; only `SPECIFIED` accepts a non-null, comma-separated integer value with no spaces. -- Treat null `part_item_sub_cd` values as equal when matching normal-item chart and highlight settings. Validate at Excel import that chart and highlight logical keys are unique, normal items use null sub codes, and colors use `#RRGGBB` format. +- Chart/highlight key is `(wave_cd,part_cd,part_item_cd,part_item_sub_cd)`; one config applies to all survey series in its group. Chart type/gap default to `BAR`/`NONE`; colors come from survey palettes. +- Resolve chart highlights independently and return mode/value without calculating highlighted categories. Supported modes are `MAX_VALUE`, `LAST_VISIBLE`, and `SPECIFIED`; only `SPECIFIED` accepts a non-null comma-separated integer list. Highlight colors come only from the survey palette. +- Store item and sub-item negative mode/order independently (`DEFAULT`, `NEGATIVE`, `SPECIFIED`); sub settings never inherit parent settings. Only `SPECIFIED` accepts an order list. Return these settings and survey palette colors so the frontend classifies rows and applies final colors. +- Treat null `part_item_sub_cd` values as equal when matching normal-item chart/highlight settings. Validate Excel logical-key uniqueness, null sub codes for normal items, negative/highlight order syntax, and palette colors as `#RRGGBB`. - Avoid N+1 query patterns when assembling a Wave dashboard. Fetch the required Part, Item, Sub, Base, and Data ranges in batches and assemble the response hierarchy in the backend. ## Frontend API Contract @@ -51,7 +52,7 @@ - Revalidate Wave access on both Wave-detail and Part-detail requests. Throw a KriCommon `BusinessException` with forbidden status when a restricted user requests a closed Wave; frontend visibility is not an authorization boundary. - Assemble normal and sub-item results through one `resultGroups` response shape. A normal item has one group with `subItem = null`; an item with sub-items has one group per Sub in `part_item_sub_cd` order. - Return categories as objects containing `order`, `label`, and `chartVisible`, alongside complete survey value series. The frontend uses all category/value indexes for statistical tables and filters matching indexes only for chart rendering. Reject Excel imports when category labels, display orders, or chart-visibility flags differ between survey series in the same Item/Sub result group. -- Expose each survey's stored color as `color` in both Wave-detail survey objects and Part-detail series objects so the frontend uses one server-managed color mapping. +- Expose effective `color`, `highlightColor`, `negativeColor`, and `negativeHighlightColor` in both Wave-detail surveys and Part-detail series. Return item/sub-item `negativeMode` and nullable `negativeOrder`; the frontend classifies and colors chart rows. - Return the stored nullable `t_part_item_base.base_text` value unchanged as Part-detail `series[].baseText`; `baseCount` remains a separate numeric field. - Return `series[].chartGapMode`; the frontend applies `NONE`, `ALL`, or `LAST_VISIBLE`, where the last mode uses the greatest visible `part_item_data_order`. - When importing `part_item_data_value`, round to scale 10 with `RoundingMode.HALF_UP` before validating and storing it as `DECIMAL(14,10)`. Reject only values that still exceed precision 14 after rounding. diff --git a/AGENTS.md b/AGENTS.md index 493d852..efbf59c 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -277,7 +277,7 @@ When implementation is complete, report in Korean: - Keep user and file data outside the Excel bulk-import scope. Import the remaining project data from one Excel workbook containing multiple sheets. - The Excel workbook has eleven required table-named sheets: `t_wave`, `t_wave_info`, `t_survey`, `t_survey_item`, `t_part`, `t_part_item`, `t_part_item_sub`, `t_part_item_base`, `t_part_item_chart`, `t_part_item_chart_highlight`, and `t_part_item_data`. Headers use database names and constrained headers list every allowed value in parentheses. The workbook must contain all referenced logical parents. - Omit every auto-increment `_idx` column from Excel. Replacement imports regenerate identities. -- Reject duplicate workbook logical keys: `(wave_cd, wave_info_order)` for Wave info; `(wave_cd, survey_cd, survey_item_order)` for survey items; `(wave_cd, part_cd, part_item_cd, survey_cd, part_item_sub_cd)` for base, chart, and highlight rows; and that result-series key plus `part_item_data_order` for data rows. +- Reject duplicate Excel keys: Wave info `(wave_cd,wave_info_order)`; survey item `(wave_cd,survey_cd,survey_item_order)`; base `(wave_cd,part_cd,part_item_cd,survey_cd,part_item_sub_cd)`; chart/highlight omit `survey_cd`; data adds `part_item_data_order` to base. - Define the Excel import/export schema once with KriCommon `ExcelColumn` DTOs. Use KriCommon `ExcelMapper` for workbook mapping and keep only project-specific type, value, and cross-sheet relationship rules in a consumer-local validator; do not duplicate a general-purpose Excel parser. - Excel endpoints are `POST /api/v1/excel/import`, `GET /api/v1/excel/template`, `GET /api/v1/excel/waves/{waveCd}/export`, and `DELETE /api/v1/excel/waves/{waveCd}`. Downloads use the same eleven sheets, order, and headers; a missing Wave exports an empty workbook. - Imports atomically replace every included Wave: validate first, delete all eleven managed tables, then insert. Failures restore prior data. Standalone reset uses the same child-to-root deletion and retains `t_file` metadata and physical files, allowing temporary orphans until that `wave_cd` is reimported. @@ -296,14 +296,15 @@ When implementation is complete, report in Korean: - A normal item has no `t_part_item_sub` rows, and both base and data rows must use `part_item_sub_cd = NULL`. Never use `0` as a substitute for this `NULL` value. - An item with sub-items has one or more `t_part_item_sub` rows. Every non-null `part_item_sub_cd` in its base and data rows must reference a sub-item belonging to the same `(wave_cd, part_cd, part_item_cd)`. - Every survey code used by `t_part_item_base` or `t_part_item_data` must belong to the same Wave. Survey items must likewise belong to an existing `(wave_cd, survey_cd)`. -- Treat `t_survey.survey_color` as a required `VARCHAR(8)` value. Include it as the `survey_color` column in the Excel template/import contract and persist it with each survey. +- Store four `VARCHAR(8)` survey palette colors: required `survey_color` plus nullable highlight, negative, and negative-highlight colors. Include all in Excel/API; fall back to default, default, and negative/highlight/default respectively. - Use `t_part_item_base` as the preferred source for determining which survey audiences apply to an item. Display the single matching `survey_alias` when only one audience applies; display `공통` when all defined audiences apply. - Store an optional display string in `t_part_item_base.base_text` (`VARCHAR(128)`). Do not reconstruct it from `base_count`, and do not retain the removed `base_pre_text` or `base_post_text` fields in entities, Excel contracts, or query assembly. - Use the corresponding `*_order` column for API and screen ordering: `wave_info_order`, `survey_order`, `survey_item_order`, `file_order`, `part_order`, `part_item_order`, and `part_item_data_order`. Use `part_item_sub_cd` as the default sub-item order because the schema has no separate sub-item order column. - Use the same `t_part_item_data` rows for both chart and statistical-table views. `is_chart_visible` is a required Boolean column with database default `1`; statistical tables use every row, while charts omit categories and matching values whose flag is false. Do not introduce a separate table-data source that could diverge from chart values. -- Resolve `chart_type`, `chart_color`, and `chart_gap_mode` per `(wave_cd, part_cd, part_item_cd, survey_cd, part_item_sub_cd)` from `t_part_item_chart`, not `t_part_item`. Defaults are `BAR`, `t_survey.survey_color`, and `NONE`; normalize null or unknown gap modes to `NONE`. Allowed gap modes are `NONE`, `ALL`, and `LAST_VISIBLE`. -- Resolve `t_part_item_chart_highlight` independently from `t_part_item_chart`; a highlight may exist without a chart-setting row. Return `chart_highlight_mode`, `chart_highlight_value`, and `chart_highlight_color` to the frontend without calculating highlighted categories in the backend. Supported modes are `MAX_VALUE`, `LAST_VISIBLE`, and `SPECIFIED`; only `SPECIFIED` accepts a non-null, comma-separated integer value with no spaces. -- Treat null `part_item_sub_cd` values as equal when matching normal-item chart and highlight settings. Validate at Excel import that chart and highlight logical keys are unique, normal items use null sub codes, and colors use `#RRGGBB` format. +- Chart/highlight key is `(wave_cd,part_cd,part_item_cd,part_item_sub_cd)`; one config applies to all survey series in its group. Chart type/gap default to `BAR`/`NONE`; colors come from survey palettes. +- Resolve chart highlights independently and return mode/value without calculating highlighted categories. Supported modes are `MAX_VALUE`, `LAST_VISIBLE`, and `SPECIFIED`; only `SPECIFIED` accepts a non-null comma-separated integer list. Highlight colors come only from the survey palette. +- Store item and sub-item negative mode/order independently (`DEFAULT`, `NEGATIVE`, `SPECIFIED`); sub settings never inherit parent settings. Only `SPECIFIED` accepts an order list. Return these settings and survey palette colors so the frontend classifies rows and applies final colors. +- Treat null `part_item_sub_cd` values as equal when matching normal-item chart/highlight settings. Validate Excel logical-key uniqueness, null sub codes for normal items, negative/highlight order syntax, and palette colors as `#RRGGBB`. - Avoid N+1 query patterns when assembling a Wave dashboard. Fetch the required Part, Item, Sub, Base, and Data ranges in batches and assemble the response hierarchy in the backend. ## Frontend API Contract @@ -313,7 +314,7 @@ When implementation is complete, report in Korean: - Revalidate Wave access on both Wave-detail and Part-detail requests. Throw a KriCommon `BusinessException` with forbidden status when a restricted user requests a closed Wave; frontend visibility is not an authorization boundary. - Assemble normal and sub-item results through one `resultGroups` response shape. A normal item has one group with `subItem = null`; an item with sub-items has one group per Sub in `part_item_sub_cd` order. - Return categories as objects containing `order`, `label`, and `chartVisible`, alongside complete survey value series. The frontend uses all category/value indexes for statistical tables and filters matching indexes only for chart rendering. Reject Excel imports when category labels, display orders, or chart-visibility flags differ between survey series in the same Item/Sub result group. -- Expose each survey's stored color as `color` in both Wave-detail survey objects and Part-detail series objects so the frontend uses one server-managed color mapping. +- Expose effective `color`, `highlightColor`, `negativeColor`, and `negativeHighlightColor` in both Wave-detail surveys and Part-detail series. Return item/sub-item `negativeMode` and nullable `negativeOrder`; the frontend classifies and colors chart rows. - Return the stored nullable `t_part_item_base.base_text` value unchanged as Part-detail `series[].baseText`; `baseCount` remains a separate numeric field. - Return `series[].chartGapMode`; the frontend applies `NONE`, `ALL`, or `LAST_VISIBLE`, where the last mode uses the greatest visible `part_item_data_order`. - When importing `part_item_data_value`, round to scale 10 with `RoundingMode.HALF_UP` before validating and storing it as `DECIMAL(14,10)`. Reject only values that still exceed precision 14 after rounding. diff --git a/src/main/java/com/kri/epolicy/dash/back/common/enums/NegativeMode.java b/src/main/java/com/kri/epolicy/dash/back/common/enums/NegativeMode.java new file mode 100644 index 0000000..20529aa --- /dev/null +++ b/src/main/java/com/kri/epolicy/dash/back/common/enums/NegativeMode.java @@ -0,0 +1,19 @@ +package com.kri.epolicy.dash.back.common.enums; + +import java.util.Arrays; + +public enum NegativeMode { + DEFAULT, + NEGATIVE, + SPECIFIED; + + public static NegativeMode fromCodeOrDefault(String code) { + if (code == null) { + return DEFAULT; + } + return Arrays.stream(values()) + .filter(mode -> mode.name().equalsIgnoreCase(code.trim())) + .findFirst() + .orElse(DEFAULT); + } +} diff --git a/src/main/java/com/kri/epolicy/dash/back/dto/excel/ExcelTemplateRows.java b/src/main/java/com/kri/epolicy/dash/back/dto/excel/ExcelTemplateRows.java index 4e21f8e..e7574bd 100644 --- a/src/main/java/com/kri/epolicy/dash/back/dto/excel/ExcelTemplateRows.java +++ b/src/main/java/com/kri/epolicy/dash/back/dto/excel/ExcelTemplateRows.java @@ -53,6 +53,10 @@ public final class ExcelTemplateRows { @ExcelColumn(header = "survey_title", order = 3) private String surveyTitle; @ExcelColumn(header = "survey_alias", order = 4) private String surveyAlias; @ExcelColumn(header = "survey_color", order = 5) private String surveyColor; + @ExcelColumn(header = "survey_highlight_color", order = 6) private String surveyHighlightColor; + @ExcelColumn(header = "survey_negative_color", order = 7) private String surveyNegativeColor; + @ExcelColumn(header = "survey_negative_highlight_color", order = 8) + private String surveyNegativeHighlightColor; } @Getter @@ -86,6 +90,10 @@ public final class ExcelTemplateRows { @ExcelColumn(header = "part_item_order", order = 3) private String partItemOrder; @ExcelColumn(header = "part_item_title", order = 4) private String partItemTitle; @ExcelColumn(header = "part_item_comment", order = 5) private String partItemComment; + @ExcelColumn(header = "part_item_negative_mode (DEFAULT, NEGATIVE, SPECIFIED)", order = 6) + private String partItemNegativeMode; + @ExcelColumn(header = "part_item_negative_order", order = 7) + private String partItemNegativeOrder; } @Getter @@ -98,6 +106,11 @@ public final class ExcelTemplateRows { @ExcelColumn(header = "part_item_sub_cd", order = 3) private String partItemSubCd; @ExcelColumn(header = "part_item_sub_title", order = 4) private String partItemSubTitle; @ExcelColumn(header = "part_item_sub_comment", order = 5) private String partItemSubComment; + @ExcelColumn( + header = "part_item_sub_negative_mode (DEFAULT, NEGATIVE, SPECIFIED)", order = 6) + private String partItemSubNegativeMode; + @ExcelColumn(header = "part_item_sub_negative_order", order = 7) + private String partItemSubNegativeOrder; } @Getter @@ -135,11 +148,9 @@ public final class ExcelTemplateRows { @ExcelColumn(header = "wave_cd", order = 0) private String waveCd; @ExcelColumn(header = "part_cd", order = 1) private String partCd; @ExcelColumn(header = "part_item_cd", order = 2) private String partItemCd; - @ExcelColumn(header = "survey_cd", order = 3) private String surveyCd; - @ExcelColumn(header = "part_item_sub_cd", order = 4) private String partItemSubCd; - @ExcelColumn(header = "chart_type (bar)", order = 5) private String chartType; - @ExcelColumn(header = "chart_color", order = 6) private String chartColor; - @ExcelColumn(header = "chart_gap_mode (NONE, ALL, LAST_VISIBLE)", order = 7) + @ExcelColumn(header = "part_item_sub_cd", order = 3) private String partItemSubCd; + @ExcelColumn(header = "chart_type (bar)", order = 4) private String chartType; + @ExcelColumn(header = "chart_gap_mode (NONE, ALL, LAST_VISIBLE)", order = 5) private String chartGapMode; } @@ -150,14 +161,11 @@ public final class ExcelTemplateRows { @ExcelColumn(header = "wave_cd", order = 0) private String waveCd; @ExcelColumn(header = "part_cd", order = 1) private String partCd; @ExcelColumn(header = "part_item_cd", order = 2) private String partItemCd; - @ExcelColumn(header = "survey_cd", order = 3) private String surveyCd; - @ExcelColumn(header = "part_item_sub_cd", order = 4) private String partItemSubCd; + @ExcelColumn(header = "part_item_sub_cd", order = 3) private String partItemSubCd; @ExcelColumn( - header = "chart_highlight_mode (MAX_VALUE, LAST_VISIBLE, SPECIFIED)", order = 5) + header = "chart_highlight_mode (MAX_VALUE, LAST_VISIBLE, SPECIFIED)", order = 4) private String chartHighlightMode; - @ExcelColumn(header = "chart_highlight_value", order = 6) + @ExcelColumn(header = "chart_highlight_value", order = 5) private String chartHighlightValue; - @ExcelColumn(header = "chart_highlight_color", order = 7) - private String chartHighlightColor; } } diff --git a/src/main/java/com/kri/epolicy/dash/back/dto/request/ExcelData.java b/src/main/java/com/kri/epolicy/dash/back/dto/request/ExcelData.java index 2878de7..9680634 100644 --- a/src/main/java/com/kri/epolicy/dash/back/dto/request/ExcelData.java +++ b/src/main/java/com/kri/epolicy/dash/back/dto/request/ExcelData.java @@ -2,6 +2,7 @@ package com.kri.epolicy.dash.back.dto.request; import com.kri.epolicy.dash.back.common.enums.ChartType; import com.kri.epolicy.dash.back.common.enums.ChartGapMode; +import com.kri.epolicy.dash.back.common.enums.NegativeMode; import java.math.BigDecimal; import java.util.List; @@ -42,7 +43,10 @@ public record ExcelData( Short surveyOrder, String surveyTitle, String surveyAlias, - String surveyColor + String surveyColor, + String surveyHighlightColor, + String surveyNegativeColor, + String surveyNegativeHighlightColor ) { } @@ -69,7 +73,9 @@ public record ExcelData( Short partItemCd, Short partItemOrder, String partItemTitle, - String partItemComment + String partItemComment, + NegativeMode partItemNegativeMode, + String partItemNegativeOrder ) { } @@ -79,7 +85,9 @@ public record ExcelData( Short partItemCd, Short partItemSubCd, String partItemSubTitle, - String partItemSubComment + String partItemSubComment, + NegativeMode partItemSubNegativeMode, + String partItemSubNegativeOrder ) { } @@ -111,10 +119,8 @@ public record ExcelData( Short waveCd, Short partCd, Short partItemCd, - Short surveyCd, Short partItemSubCd, ChartType chartType, - String chartColor, ChartGapMode chartGapMode ) { } @@ -123,11 +129,9 @@ public record ExcelData( Short waveCd, Short partCd, Short partItemCd, - Short surveyCd, Short partItemSubCd, String chartHighlightMode, - String chartHighlightValue, - String chartHighlightColor + String chartHighlightValue ) { } } diff --git a/src/main/java/com/kri/epolicy/dash/back/dto/response/PartDetailResponse.java b/src/main/java/com/kri/epolicy/dash/back/dto/response/PartDetailResponse.java index e7cc5a1..a0f4175 100644 --- a/src/main/java/com/kri/epolicy/dash/back/dto/response/PartDetailResponse.java +++ b/src/main/java/com/kri/epolicy/dash/back/dto/response/PartDetailResponse.java @@ -15,6 +15,8 @@ public record PartDetailResponse( Short order, String title, String comment, + String negativeMode, + String negativeOrder, Audience audience, List resultGroups ) { @@ -40,7 +42,9 @@ public record PartDetailResponse( public record SubItem( Short partItemSubCd, String title, - String partItemSubComment + String partItemSubComment, + String negativeMode, + String negativeOrder ) { } @@ -49,10 +53,12 @@ public record PartDetailResponse( String label, String chartType, String color, + String highlightColor, + String negativeColor, + String negativeHighlightColor, String chartGapMode, String chartHighlightMode, String chartHighlightValue, - String chartHighlightColor, Integer baseCount, String baseText, List values diff --git a/src/main/java/com/kri/epolicy/dash/back/dto/response/WaveDetailResponse.java b/src/main/java/com/kri/epolicy/dash/back/dto/response/WaveDetailResponse.java index adc127c..ec0597e 100644 --- a/src/main/java/com/kri/epolicy/dash/back/dto/response/WaveDetailResponse.java +++ b/src/main/java/com/kri/epolicy/dash/back/dto/response/WaveDetailResponse.java @@ -18,6 +18,9 @@ public record WaveDetailResponse( String title, String alias, String color, + String highlightColor, + String negativeColor, + String negativeHighlightColor, List items ) { } diff --git a/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemChartEntity.java b/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemChartEntity.java index 24f8698..7951b83 100644 --- a/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemChartEntity.java +++ b/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemChartEntity.java @@ -35,10 +35,6 @@ public class TPartItemChartEntity { @Column(name = "part_item_cd", nullable = false) private Short partItemCd; - @NotNull - @Column(name = "survey_cd", nullable = false) - private Short surveyCd; - @Column(name = "part_item_sub_cd") private Short partItemSubCd; @@ -48,10 +44,6 @@ public class TPartItemChartEntity { @Column(name = "chart_type", nullable = false, length = 32) private String chartType; - @Size(max = 8) - @Column(name = "chart_color", length = 8) - private String chartColor; - @Size(max = 32) @NotNull @ColumnDefault("'NONE'") diff --git a/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemChartHighlightEntity.java b/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemChartHighlightEntity.java index 4aa7336..c378982 100644 --- a/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemChartHighlightEntity.java +++ b/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemChartHighlightEntity.java @@ -34,10 +34,6 @@ public class TPartItemChartHighlightEntity { @Column(name = "part_item_cd", nullable = false) private Short partItemCd; - @NotNull - @Column(name = "survey_cd", nullable = false) - private Short surveyCd; - @Column(name = "part_item_sub_cd") private Short partItemSubCd; @@ -50,10 +46,4 @@ public class TPartItemChartHighlightEntity { @Column(name = "chart_highlight_value", length = 32) private String chartHighlightValue; - @Size(max = 8) - @NotNull - @Column(name = "chart_highlight_color", nullable = false, length = 8) - private String chartHighlightColor; - - -} \ No newline at end of file +} diff --git a/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemEntity.java b/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemEntity.java index 9cb428a..4a47a68 100644 --- a/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemEntity.java +++ b/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemEntity.java @@ -10,6 +10,7 @@ import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Size; import lombok.Getter; import lombok.Setter; +import org.hibernate.annotations.ColumnDefault; @Getter @Setter @@ -34,5 +35,14 @@ public class TPartItemEntity { @Column(name = "part_item_comment", nullable = false) private String partItemComment; + @Size(max = 32) + @NotNull + @ColumnDefault("'DEFAULT'") + @Column(name = "part_item_negative_mode", nullable = false, length = 32) + private String partItemNegativeMode; + + @Size(max = 32) + @Column(name = "part_item_negative_order", length = 32) + private String partItemNegativeOrder; } diff --git a/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemSubEntity.java b/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemSubEntity.java index dd83a69..3879ab2 100644 --- a/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemSubEntity.java +++ b/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TPartItemSubEntity.java @@ -10,6 +10,7 @@ import jakarta.validation.constraints.NotNull; import jakarta.validation.constraints.Size; import lombok.Getter; import lombok.Setter; +import org.hibernate.annotations.ColumnDefault; @Getter @Setter @@ -29,5 +30,14 @@ public class TPartItemSubEntity { @Column(name = "part_item_sub_comment") private String partItemSubComment; + @Size(max = 32) + @NotNull + @ColumnDefault("'DEFAULT'") + @Column(name = "part_item_sub_negative_mode", nullable = false, length = 32) + private String partItemSubNegativeMode; + + @Size(max = 32) + @Column(name = "part_item_sub_negative_order", length = 32) + private String partItemSubNegativeOrder; } diff --git a/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TSurveyEntity.java b/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TSurveyEntity.java index edc4b13..fe66f14 100644 --- a/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TSurveyEntity.java +++ b/src/main/java/com/kri/epolicy/dash/back/persistence/entity/TSurveyEntity.java @@ -38,5 +38,16 @@ public class TSurveyEntity { @Column(name = "survey_color", nullable = false, length = 8) private String surveyColor; + @Size(max = 8) + @Column(name = "survey_highlight_color", length = 8) + private String surveyHighlightColor; -} \ No newline at end of file + @Size(max = 8) + @Column(name = "survey_negative_color", length = 8) + private String surveyNegativeColor; + + @Size(max = 8) + @Column(name = "survey_negative_highlight_color", length = 8) + private String surveyNegativeHighlightColor; + +} diff --git a/src/main/java/com/kri/epolicy/dash/back/service/ExcelExportService.java b/src/main/java/com/kri/epolicy/dash/back/service/ExcelExportService.java index 54e4536..726e1af 100644 --- a/src/main/java/com/kri/epolicy/dash/back/service/ExcelExportService.java +++ b/src/main/java/com/kri/epolicy/dash/back/service/ExcelExportService.java @@ -81,7 +81,8 @@ public class ExcelExportService { .map(survey -> new ExcelTemplateRows.Survey( value(survey.getId().getWaveCd()), value(survey.getId().getSurveyCd()), value(survey.getSurveyOrder()), survey.getSurveyTitle(), survey.getSurveyAlias(), - survey.getSurveyColor())) + survey.getSurveyColor(), survey.getSurveyHighlightColor(), + survey.getSurveyNegativeColor(), survey.getSurveyNegativeHighlightColor())) .toList(), surveyItemRepository.findByWaveCdOrderBySurveyItemOrderAsc(waveCd).stream() .sorted(Comparator.comparing( @@ -107,7 +108,8 @@ public class ExcelExportService { .map(item -> new ExcelTemplateRows.PartItem( value(item.getId().getWaveCd()), value(item.getId().getPartCd()), value(item.getId().getPartItemCd()), value(item.getPartItemOrder()), - item.getPartItemTitle(), item.getPartItemComment())) + item.getPartItemTitle(), item.getPartItemComment(), + item.getPartItemNegativeMode(), item.getPartItemNegativeOrder())) .toList(), partItemSubRepository.findByIdWaveCd(waveCd).stream() .sorted(Comparator.comparing( @@ -118,7 +120,8 @@ public class ExcelExportService { .map(sub -> new ExcelTemplateRows.PartItemSub( value(sub.getId().getWaveCd()), value(sub.getId().getPartCd()), value(sub.getId().getPartItemCd()), value(sub.getId().getPartItemSubCd()), - sub.getPartItemSubTitle(), sub.getPartItemSubComment())) + sub.getPartItemSubTitle(), sub.getPartItemSubComment(), + sub.getPartItemSubNegativeMode(), sub.getPartItemSubNegativeOrder())) .toList(), bases.stream().map(base -> new ExcelTemplateRows.PartItemBase( value(base.getWaveCd()), value(base.getPartCd()), value(base.getPartItemCd()), @@ -126,14 +129,13 @@ public class ExcelExportService { value(base.getBaseCount()), base.getBaseText())).toList(), charts.stream().map(chart -> new ExcelTemplateRows.PartItemChart( value(chart.getWaveCd()), value(chart.getPartCd()), value(chart.getPartItemCd()), - value(chart.getSurveyCd()), value(chart.getPartItemSubCd()), - chartTypeLabel(chart.getChartType()), chart.getChartColor(), + value(chart.getPartItemSubCd()), chartTypeLabel(chart.getChartType()), ChartGapMode.fromCodeOrDefault(chart.getChartGapMode()).name())).toList(), highlights.stream().map(highlight -> new ExcelTemplateRows.PartItemChartHighlight( value(highlight.getWaveCd()), value(highlight.getPartCd()), - value(highlight.getPartItemCd()), value(highlight.getSurveyCd()), - value(highlight.getPartItemSubCd()), highlight.getChartHighlightMode(), - highlight.getChartHighlightValue(), highlight.getChartHighlightColor())).toList(), + value(highlight.getPartItemCd()), value(highlight.getPartItemSubCd()), + highlight.getChartHighlightMode(), + highlight.getChartHighlightValue())).toList(), itemData.stream().map(item -> new ExcelTemplateRows.PartItemData( value(item.getWaveCd()), value(item.getPartCd()), value(item.getPartItemCd()), value(item.getSurveyCd()), value(item.getPartItemSubCd()), @@ -154,14 +156,12 @@ public class ExcelExportService { private Comparator resultSeriesComparatorForChart() { return Comparator.comparing(TPartItemChartEntity::getPartCd) .thenComparing(TPartItemChartEntity::getPartItemCd) - .thenComparing(TPartItemChartEntity::getSurveyCd) .thenComparing(TPartItemChartEntity::getPartItemSubCd, NULLABLE_SHORT); } private Comparator resultSeriesComparatorForHighlight() { return Comparator.comparing(TPartItemChartHighlightEntity::getPartCd) .thenComparing(TPartItemChartHighlightEntity::getPartItemCd) - .thenComparing(TPartItemChartHighlightEntity::getSurveyCd) .thenComparing(TPartItemChartHighlightEntity::getPartItemSubCd, NULLABLE_SHORT); } diff --git a/src/main/java/com/kri/epolicy/dash/back/service/ExcelImportService.java b/src/main/java/com/kri/epolicy/dash/back/service/ExcelImportService.java index 8075e6f..aba2184 100644 --- a/src/main/java/com/kri/epolicy/dash/back/service/ExcelImportService.java +++ b/src/main/java/com/kri/epolicy/dash/back/service/ExcelImportService.java @@ -87,6 +87,9 @@ public class ExcelImportService { entity.setSurveyTitle(row.surveyTitle()); entity.setSurveyAlias(row.surveyAlias()); entity.setSurveyColor(row.surveyColor()); + entity.setSurveyHighlightColor(row.surveyHighlightColor()); + entity.setSurveyNegativeColor(row.surveyNegativeColor()); + entity.setSurveyNegativeHighlightColor(row.surveyNegativeHighlightColor()); return entity; }).toList()); @@ -114,6 +117,8 @@ public class ExcelImportService { entity.setPartItemOrder(row.partItemOrder()); entity.setPartItemTitle(row.partItemTitle()); entity.setPartItemComment(row.partItemComment()); + entity.setPartItemNegativeMode(row.partItemNegativeMode().name()); + entity.setPartItemNegativeOrder(row.partItemNegativeOrder()); return entity; }).toList()); @@ -123,6 +128,8 @@ public class ExcelImportService { row.waveCd(), row.partCd(), row.partItemCd(), row.partItemSubCd())); entity.setPartItemSubTitle(row.partItemSubTitle()); entity.setPartItemSubComment(row.partItemSubComment()); + entity.setPartItemSubNegativeMode(row.partItemSubNegativeMode().name()); + entity.setPartItemSubNegativeOrder(row.partItemSubNegativeOrder()); return entity; }).toList()); @@ -143,10 +150,8 @@ public class ExcelImportService { entity.setWaveCd(row.waveCd()); entity.setPartCd(row.partCd()); entity.setPartItemCd(row.partItemCd()); - entity.setSurveyCd(row.surveyCd()); entity.setPartItemSubCd(row.partItemSubCd()); entity.setChartType(row.chartType().getCode()); - entity.setChartColor(row.chartColor()); entity.setChartGapMode(row.chartGapMode().name()); return entity; }).toList()); @@ -156,11 +161,9 @@ public class ExcelImportService { entity.setWaveCd(row.waveCd()); entity.setPartCd(row.partCd()); entity.setPartItemCd(row.partItemCd()); - entity.setSurveyCd(row.surveyCd()); entity.setPartItemSubCd(row.partItemSubCd()); entity.setChartHighlightMode(row.chartHighlightMode()); entity.setChartHighlightValue(row.chartHighlightValue()); - entity.setChartHighlightColor(row.chartHighlightColor()); return entity; }).toList()); diff --git a/src/main/java/com/kri/epolicy/dash/back/service/ExcelImportValidator.java b/src/main/java/com/kri/epolicy/dash/back/service/ExcelImportValidator.java index 814ae90..ceec58a 100644 --- a/src/main/java/com/kri/epolicy/dash/back/service/ExcelImportValidator.java +++ b/src/main/java/com/kri/epolicy/dash/back/service/ExcelImportValidator.java @@ -6,6 +6,7 @@ import com.kri.common.feature.web.BusinessException; import com.kri.epolicy.dash.back.common.enums.ChartType; import com.kri.epolicy.dash.back.common.enums.ChartHighlightMode; import com.kri.epolicy.dash.back.common.enums.ChartGapMode; +import com.kri.epolicy.dash.back.common.enums.NegativeMode; import com.kri.epolicy.dash.back.dto.excel.ExcelTemplateRows; import com.kri.epolicy.dash.back.dto.request.ExcelData; import com.kri.epolicy.dash.back.dto.request.ExcelData.PartItemBaseRow; @@ -67,7 +68,9 @@ public class ExcelImportValidator { row.getWaveInfoContent()), this::toWaveInfoRow), readRows(workbook, ExcelTemplateRows.SURVEY_SHEET, ExcelTemplateRows.Survey.class, row -> allBlank(row.getWaveCd(), row.getSurveyCd(), row.getSurveyOrder(), - row.getSurveyTitle(), row.getSurveyAlias(), row.getSurveyColor()), + row.getSurveyTitle(), row.getSurveyAlias(), row.getSurveyColor(), + row.getSurveyHighlightColor(), row.getSurveyNegativeColor(), + row.getSurveyNegativeHighlightColor()), this::toSurveyRow), readRows(workbook, ExcelTemplateRows.SURVEY_ITEM_SHEET, ExcelTemplateRows.SurveyItem.class, @@ -78,13 +81,15 @@ public class ExcelImportValidator { row.getPartTitle()), this::toPartRow), readRows(workbook, ExcelTemplateRows.PART_ITEM_SHEET, ExcelTemplateRows.PartItem.class, row -> allBlank(row.getWaveCd(), row.getPartCd(), row.getPartItemCd(), - row.getPartItemOrder(), row.getPartItemTitle(), row.getPartItemComment()), + row.getPartItemOrder(), row.getPartItemTitle(), row.getPartItemComment(), + row.getPartItemNegativeMode(), row.getPartItemNegativeOrder()), this::toPartItemRow), readRows(workbook, ExcelTemplateRows.PART_ITEM_SUB_SHEET, ExcelTemplateRows.PartItemSub.class, row -> allBlank(row.getWaveCd(), row.getPartCd(), row.getPartItemCd(), row.getPartItemSubCd(), row.getPartItemSubTitle(), - row.getPartItemSubComment()), this::toPartItemSubRow), + row.getPartItemSubComment(), row.getPartItemSubNegativeMode(), + row.getPartItemSubNegativeOrder()), this::toPartItemSubRow), readRows(workbook, ExcelTemplateRows.PART_ITEM_BASE_SHEET, ExcelTemplateRows.PartItemBase.class, row -> allBlank(row.getWaveCd(), row.getPartCd(), row.getPartItemCd(), @@ -93,13 +98,13 @@ public class ExcelImportValidator { readRows(workbook, ExcelTemplateRows.PART_ITEM_CHART_SHEET, ExcelTemplateRows.PartItemChart.class, row -> allBlank(row.getWaveCd(), row.getPartCd(), row.getPartItemCd(), - row.getSurveyCd(), row.getPartItemSubCd(), row.getChartType(), - row.getChartColor(), row.getChartGapMode()), this::toPartItemChartRow), + row.getPartItemSubCd(), row.getChartType(), + row.getChartGapMode()), this::toPartItemChartRow), readRows(workbook, ExcelTemplateRows.PART_ITEM_CHART_HIGHLIGHT_SHEET, ExcelTemplateRows.PartItemChartHighlight.class, row -> allBlank(row.getWaveCd(), row.getPartCd(), row.getPartItemCd(), - row.getSurveyCd(), row.getPartItemSubCd(), row.getChartHighlightMode(), - row.getChartHighlightValue(), row.getChartHighlightColor()), + row.getPartItemSubCd(), row.getChartHighlightMode(), + row.getChartHighlightValue()), this::toPartItemChartHighlightRow), readRows(workbook, ExcelTemplateRows.PART_ITEM_DATA_SHEET, ExcelTemplateRows.PartItemData.class, @@ -209,7 +214,11 @@ public class ExcelImportValidator { requiredShort(row.getSurveyOrder(), "survey_order", context), requiredString(row.getSurveyTitle(), "survey_title", 128, context), requiredString(row.getSurveyAlias(), "survey_alias", 32, context), - requiredColor(row.getSurveyColor(), "survey_color", context) + requiredColor(row.getSurveyColor(), "survey_color", context), + optionalColor(row.getSurveyHighlightColor(), "survey_highlight_color", context), + optionalColor(row.getSurveyNegativeColor(), "survey_negative_color", context), + optionalColor( + row.getSurveyNegativeHighlightColor(), "survey_negative_highlight_color", context) ); } @@ -236,6 +245,10 @@ public class ExcelImportValidator { } private PartItemRow toPartItemRow(ExcelTemplateRows.PartItem row, RowContext context) { + NegativeMode mode = NegativeMode.fromCodeOrDefault(normalized(row.getPartItemNegativeMode())); + String order = optionalString( + row.getPartItemNegativeOrder(), "part_item_negative_order", 32, context); + validateNegativeValue(mode, order, "part_item_negative_order", context); return new PartItemRow( requiredShort(row.getWaveCd(), "wave_cd", context), requiredShort(row.getPartCd(), "part_cd", context), @@ -243,7 +256,9 @@ public class ExcelImportValidator { requiredShort(row.getPartItemOrder(), "part_item_order", context), requiredString(row.getPartItemTitle(), "part_item_title", 128, context), Objects.requireNonNullElse( - optionalString(row.getPartItemComment(), "part_item_comment", null, context), "") + optionalString(row.getPartItemComment(), "part_item_comment", null, context), ""), + mode, + order ); } @@ -251,13 +266,20 @@ public class ExcelImportValidator { ExcelTemplateRows.PartItemSub row, RowContext context ) { + NegativeMode mode = NegativeMode.fromCodeOrDefault( + normalized(row.getPartItemSubNegativeMode())); + String order = optionalString( + row.getPartItemSubNegativeOrder(), "part_item_sub_negative_order", 32, context); + validateNegativeValue(mode, order, "part_item_sub_negative_order", context); return new PartItemSubRow( requiredShort(row.getWaveCd(), "wave_cd", context), requiredShort(row.getPartCd(), "part_cd", context), requiredShort(row.getPartItemCd(), "part_item_cd", context), requiredShort(row.getPartItemSubCd(), "part_item_sub_cd", context), requiredString(row.getPartItemSubTitle(), "part_item_sub_title", 128, context), - optionalString(row.getPartItemSubComment(), "part_item_sub_comment", null, context) + optionalString(row.getPartItemSubComment(), "part_item_sub_comment", null, context), + mode, + order ); } @@ -301,10 +323,8 @@ public class ExcelImportValidator { requiredShort(row.getWaveCd(), "wave_cd", context), requiredShort(row.getPartCd(), "part_cd", context), requiredShort(row.getPartItemCd(), "part_item_cd", context), - requiredShort(row.getSurveyCd(), "survey_cd", context), optionalShort(row.getPartItemSubCd(), "part_item_sub_cd", context), requiredChartType(row.getChartType(), "chart_type", context), - optionalColor(row.getChartColor(), "chart_color", context), ChartGapMode.fromCodeOrDefault(normalized(row.getChartGapMode())) ); } @@ -322,11 +342,9 @@ public class ExcelImportValidator { requiredShort(row.getWaveCd(), "wave_cd", context), requiredShort(row.getPartCd(), "part_cd", context), requiredShort(row.getPartItemCd(), "part_item_cd", context), - requiredShort(row.getSurveyCd(), "survey_cd", context), optionalShort(row.getPartItemSubCd(), "part_item_sub_cd", context), mode.name(), - value, - requiredColor(row.getChartHighlightColor(), "chart_highlight_color", context) + value ); } @@ -349,9 +367,9 @@ public class ExcelImportValidator { Set subKeys = uniqueKeys(data.partItemSubs(), row -> new SubKey(row.waveCd(), row.partCd(), row.partItemCd(), row.partItemSubCd()), ExcelTemplateRows.PART_ITEM_SUB_SHEET); - uniqueKeys(data.partItemCharts(), this::resultSeriesKey, + uniqueKeys(data.partItemCharts(), this::chartConfigKey, ExcelTemplateRows.PART_ITEM_CHART_SHEET); - uniqueKeys(data.partItemChartHighlights(), this::resultSeriesKey, + uniqueKeys(data.partItemChartHighlights(), this::chartConfigKey, ExcelTemplateRows.PART_ITEM_CHART_HIGHLIGHT_SHEET); requireParents(data.waveInfos(), WaveInfoRow::waveCd, waveKeys, @@ -384,27 +402,27 @@ public class ExcelImportValidator { ExcelTemplateRows.PART_ITEM_DATA_SHEET); } for (PartItemChartRow row : data.partItemCharts()) { - validateResultRelationship(row.waveCd(), row.partCd(), row.partItemCd(), row.surveyCd(), - row.partItemSubCd(), itemKeys, surveyKeys, subKeys, itemsWithSubs, + validateItemSubRelationship(row.waveCd(), row.partCd(), row.partItemCd(), + row.partItemSubCd(), itemKeys, subKeys, itemsWithSubs, ExcelTemplateRows.PART_ITEM_CHART_SHEET); } for (PartItemChartHighlightRow row : data.partItemChartHighlights()) { - validateResultRelationship(row.waveCd(), row.partCd(), row.partItemCd(), row.surveyCd(), - row.partItemSubCd(), itemKeys, surveyKeys, subKeys, itemsWithSubs, + validateItemSubRelationship(row.waveCd(), row.partCd(), row.partItemCd(), + row.partItemSubCd(), itemKeys, subKeys, itemsWithSubs, ExcelTemplateRows.PART_ITEM_CHART_HIGHLIGHT_SHEET); } validateResultBases(data.partItemBases(), data.partItemData()); validateCategoryConsistency(data.partItemData()); } - private ResultSeriesKey resultSeriesKey(PartItemChartRow row) { - return new ResultSeriesKey( - row.waveCd(), row.partCd(), row.partItemCd(), row.surveyCd(), row.partItemSubCd()); + private ResultGroupKey chartConfigKey(PartItemChartRow row) { + return new ResultGroupKey( + row.waveCd(), row.partCd(), row.partItemCd(), row.partItemSubCd()); } - private ResultSeriesKey resultSeriesKey(PartItemChartHighlightRow row) { - return new ResultSeriesKey( - row.waveCd(), row.partCd(), row.partItemCd(), row.surveyCd(), row.partItemSubCd()); + private ResultGroupKey chartConfigKey(PartItemChartHighlightRow row) { + return new ResultGroupKey( + row.waveCd(), row.partCd(), row.partItemCd(), row.partItemSubCd()); } private void validateResultBases(List bases, List data) { @@ -466,14 +484,29 @@ public class ExcelImportValidator { Set itemsWithSubs, String sheetName ) { - ItemKey itemKey = new ItemKey(waveCd, partCd, partItemCd); - if (!itemKeys.contains(itemKey)) { - throw relationshipError(sheetName, "존재하지 않는 문항을 참조합니다: " + itemKey); - } + validateItemSubRelationship( + waveCd, partCd, partItemCd, partItemSubCd, + itemKeys, subKeys, itemsWithSubs, sheetName); if (!surveyKeys.contains(new SurveyKey(waveCd, surveyCd))) { throw relationshipError(sheetName, "동일 Wave에 존재하지 않는 조사대상을 참조합니다: " + surveyCd); } + } + + private void validateItemSubRelationship( + Short waveCd, + Short partCd, + Short partItemCd, + Short partItemSubCd, + Set itemKeys, + Set subKeys, + Set itemsWithSubs, + String sheetName + ) { + ItemKey itemKey = new ItemKey(waveCd, partCd, partItemCd); + if (!itemKeys.contains(itemKey)) { + throw relationshipError(sheetName, "존재하지 않는 문항을 참조합니다: " + itemKey); + } if (itemsWithSubs.contains(itemKey)) { if (partItemSubCd == null) { throw relationshipError(sheetName, @@ -681,6 +714,22 @@ public class ExcelImportValidator { } } + private void validateNegativeValue( + NegativeMode mode, + String value, + String column, + RowContext context + ) { + if (mode == NegativeMode.SPECIFIED) { + if (value == null || !SPECIFIED_VALUE_PATTERN.matcher(value).matches()) { + throw cellError(context, column, + "SPECIFIED 모드는 공백 없는 정수 목록이어야 합니다. 예: 1,3,5"); + } + } else if (value != null) { + throw cellError(context, column, mode.name() + " 모드에서는 NULL이어야 합니다."); + } + } + private String requiredRaw(String rawValue, String column, RowContext context) { String value = normalized(rawValue); if (value == null) { diff --git a/src/main/java/com/kri/epolicy/dash/back/service/WaveQueryService.java b/src/main/java/com/kri/epolicy/dash/back/service/WaveQueryService.java index 65bfd40..7bb1035 100644 --- a/src/main/java/com/kri/epolicy/dash/back/service/WaveQueryService.java +++ b/src/main/java/com/kri/epolicy/dash/back/service/WaveQueryService.java @@ -2,8 +2,10 @@ package com.kri.epolicy.dash.back.service; import com.kri.common.feature.web.BusinessException; import com.kri.common.feature.web.RequestUserContext; -import com.kri.epolicy.dash.back.common.enums.ChartType; import com.kri.epolicy.dash.back.common.enums.ChartGapMode; +import com.kri.epolicy.dash.back.common.enums.ChartHighlightMode; +import com.kri.epolicy.dash.back.common.enums.ChartType; +import com.kri.epolicy.dash.back.common.enums.NegativeMode; import com.kri.epolicy.dash.back.config.FileStorageProperties; import com.kri.epolicy.dash.back.dto.response.PartDetailResponse; import com.kri.epolicy.dash.back.dto.response.PartDetailResponse.Audience; @@ -103,6 +105,9 @@ public class WaveQueryService { survey.getSurveyTitle(), survey.getSurveyAlias(), survey.getSurveyColor(), + highlightColor(survey), + negativeColor(survey), + negativeHighlightColor(survey), surveyItems.getOrDefault(survey.getId().getSurveyCd(), List.of()).stream() .map(item -> new WaveDetailResponse.SurveyItem( item.getSurveyItemTitle(), item.getSurveyItemContent())) @@ -197,7 +202,13 @@ public class WaveQueryService { for (TPartItemSubEntity sub : subs) { Short subCd = sub.getId().getPartItemSubCd(); groups.add(toResultGroup( - new SubItem(subCd, sub.getPartItemSubTitle(), sub.getPartItemSubComment()), + new SubItem( + subCd, + sub.getPartItemSubTitle(), + sub.getPartItemSubComment(), + negativeMode(sub.getPartItemSubNegativeMode()), + negativeOrder( + sub.getPartItemSubNegativeMode(), sub.getPartItemSubNegativeOrder())), bases.stream().filter(base -> subCd.equals(base.getPartItemSubCd())).toList(), charts.stream().filter(chart -> subCd.equals(chart.getPartItemSubCd())).toList(), highlights.stream() @@ -215,6 +226,8 @@ public class WaveQueryService { item.getPartItemOrder(), item.getPartItemTitle(), item.getPartItemComment(), + negativeMode(item.getPartItemNegativeMode()), + negativeOrder(item.getPartItemNegativeMode(), item.getPartItemNegativeOrder()), toAudience(audienceCodes, surveys, surveyByCode), List.copyOf(groups) ); @@ -231,13 +244,8 @@ public class WaveQueryService { Map baseBySurvey = bases.stream().collect(Collectors.toMap( TPartItemBaseEntity::getSurveyCd, Function.identity(), (left, right) -> left, LinkedHashMap::new)); - Map chartBySurvey = charts.stream().collect(Collectors.toMap( - TPartItemChartEntity::getSurveyCd, Function.identity(), (left, right) -> left, - LinkedHashMap::new)); - Map highlightBySurvey = highlights.stream() - .collect(Collectors.toMap( - TPartItemChartHighlightEntity::getSurveyCd, Function.identity(), - (left, right) -> left, LinkedHashMap::new)); + TPartItemChartEntity chart = charts.stream().findFirst().orElse(null); + TPartItemChartHighlightEntity highlight = highlights.stream().findFirst().orElse(null); Map> dataBySurvey = data.stream().collect( Collectors.groupingBy(TPartItemDataEntity::getSurveyCd, LinkedHashMap::new, Collectors.toList())); @@ -255,20 +263,18 @@ public class WaveQueryService { List series = surveyCodes.stream().map(surveyCd -> { TPartItemBaseEntity base = baseBySurvey.get(surveyCd); TSurveyEntity survey = surveyByCode.get(surveyCd); - TPartItemChartEntity chart = chartBySurvey.get(surveyCd); - TPartItemChartHighlightEntity highlight = highlightBySurvey.get(surveyCd); return new Series( surveyCd, survey.getSurveyAlias(), - chart == null || chart.getChartType() == null - ? ChartType.BAR.getCode() : chart.getChartType(), - chart == null || chart.getChartColor() == null - ? survey.getSurveyColor() : chart.getChartColor(), + chartType(chart == null ? null : chart.getChartType()), + survey.getSurveyColor(), + highlightColor(survey), + negativeColor(survey), + negativeHighlightColor(survey), ChartGapMode.fromCodeOrDefault( chart == null ? null : chart.getChartGapMode()).name(), - highlight == null ? null : highlight.getChartHighlightMode(), - highlight == null ? null : highlight.getChartHighlightValue(), - highlight == null ? null : highlight.getChartHighlightColor(), + highlightMode(highlight == null ? null : highlight.getChartHighlightMode()), + highlightValue(highlight), base == null ? null : base.getBaseCount(), base == null ? null : base.getBaseText(), dataBySurvey.get(surveyCd).stream() @@ -280,6 +286,58 @@ public class WaveQueryService { return new ResultGroup(subItem, categories, series); } + private String highlightColor(TSurveyEntity survey) { + return survey.getSurveyHighlightColor() == null + ? survey.getSurveyColor() : survey.getSurveyHighlightColor(); + } + + private String negativeColor(TSurveyEntity survey) { + return survey.getSurveyNegativeColor() == null + ? survey.getSurveyColor() : survey.getSurveyNegativeColor(); + } + + private String negativeHighlightColor(TSurveyEntity survey) { + if (survey.getSurveyNegativeHighlightColor() != null) { + return survey.getSurveyNegativeHighlightColor(); + } + if (survey.getSurveyNegativeColor() != null) { + return survey.getSurveyNegativeColor(); + } + return highlightColor(survey); + } + + private String negativeMode(String code) { + return NegativeMode.fromCodeOrDefault(code).name(); + } + + private String negativeOrder(String modeCode, String order) { + return NegativeMode.fromCodeOrDefault(modeCode) == NegativeMode.SPECIFIED + ? order : null; + } + + private String chartType(String code) { + try { + return ChartType.fromCode(code).getCode(); + } catch (IllegalArgumentException exception) { + return ChartType.BAR.getCode(); + } + } + + private String highlightMode(String code) { + try { + return ChartHighlightMode.fromCode(code).name(); + } catch (IllegalArgumentException exception) { + return null; + } + } + + private String highlightValue(TPartItemChartHighlightEntity highlight) { + return highlight != null + && ChartHighlightMode.SPECIFIED.name() + .equals(highlightMode(highlight.getChartHighlightMode())) + ? highlight.getChartHighlightValue() : null; + } + private Audience toAudience( Set audienceCodes, List surveys,