260818_01_ENH: 1차 완성
This commit is contained in:
@@ -42,6 +42,7 @@ public final class ExcelTemplateRows {
|
||||
@ExcelColumn(header = "survey_order", order = 2) private String surveyOrder;
|
||||
@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;
|
||||
}
|
||||
|
||||
@Getter
|
||||
@@ -89,8 +90,7 @@ public final class ExcelTemplateRows {
|
||||
@ExcelColumn(header = "survey_cd", order = 3) private String surveyCd;
|
||||
@ExcelColumn(header = "part_item_sub_cd", order = 4) private String partItemSubCd;
|
||||
@ExcelColumn(header = "base_count", order = 5) private String baseCount;
|
||||
@ExcelColumn(header = "base_pre_text", order = 6) private String basePreText;
|
||||
@ExcelColumn(header = "base_post_text", order = 7) private String basePostText;
|
||||
@ExcelColumn(header = "base_text", order = 6) private String baseText;
|
||||
}
|
||||
|
||||
@Getter
|
||||
|
||||
@@ -38,7 +38,8 @@ public record ExcelData(
|
||||
Short surveyCd,
|
||||
Short surveyOrder,
|
||||
String surveyTitle,
|
||||
String surveyAlias
|
||||
String surveyAlias,
|
||||
String surveyColor
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -86,8 +87,7 @@ public record ExcelData(
|
||||
Short surveyCd,
|
||||
Short partItemSubCd,
|
||||
Integer baseCount,
|
||||
String basePreText,
|
||||
String basePostText
|
||||
String baseText
|
||||
) {
|
||||
}
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ public record PartDetailResponse(
|
||||
public record Series(
|
||||
Short surveyCd,
|
||||
String label,
|
||||
String color,
|
||||
Integer baseCount,
|
||||
String baseText,
|
||||
List<BigDecimal> values
|
||||
|
||||
@@ -17,6 +17,7 @@ public record WaveDetailResponse(
|
||||
Short surveyCd,
|
||||
String title,
|
||||
String alias,
|
||||
String color,
|
||||
List<SurveyItem> items
|
||||
) {
|
||||
}
|
||||
|
||||
@@ -46,12 +46,8 @@ public class TPartItemBaseEntity {
|
||||
private Integer baseCount;
|
||||
|
||||
@Size(max = 128)
|
||||
@Column(name = "base_pre_text", length = 128)
|
||||
private String basePreText;
|
||||
|
||||
@Size(max = 128)
|
||||
@Column(name = "base_post_text", length = 128)
|
||||
private String basePostText;
|
||||
@Column(name = "base_text", length = 128)
|
||||
private String baseText;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -33,5 +33,10 @@ public class TSurveyEntity {
|
||||
@Column(name = "survey_alias", nullable = false, length = 32)
|
||||
private String surveyAlias;
|
||||
|
||||
@Size(max = 8)
|
||||
@NotNull
|
||||
@Column(name = "survey_color", nullable = false, length = 8)
|
||||
private String surveyColor;
|
||||
|
||||
|
||||
}
|
||||
@@ -106,6 +106,7 @@ public class ExcelImportService {
|
||||
entity.setSurveyOrder(row.surveyOrder());
|
||||
entity.setSurveyTitle(row.surveyTitle());
|
||||
entity.setSurveyAlias(row.surveyAlias());
|
||||
entity.setSurveyColor(row.surveyColor());
|
||||
return entity;
|
||||
}).toList());
|
||||
|
||||
@@ -157,8 +158,7 @@ public class ExcelImportService {
|
||||
entity.setSurveyCd(row.surveyCd());
|
||||
entity.setPartItemSubCd(row.partItemSubCd());
|
||||
entity.setBaseCount(row.baseCount());
|
||||
entity.setBasePreText(row.basePreText());
|
||||
entity.setBasePostText(row.basePostText());
|
||||
entity.setBaseText(row.baseText());
|
||||
return entity;
|
||||
}).toList());
|
||||
|
||||
|
||||
@@ -60,7 +60,8 @@ 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()), this::toSurveyRow),
|
||||
row.getSurveyTitle(), row.getSurveyAlias(), row.getSurveyColor()),
|
||||
this::toSurveyRow),
|
||||
readRows(workbook, ExcelTemplateRows.SURVEY_ITEM_SHEET,
|
||||
ExcelTemplateRows.SurveyItem.class,
|
||||
row -> allBlank(row.getWaveCd(), row.getSurveyCd(), row.getSurveyItemOrder(),
|
||||
@@ -80,7 +81,7 @@ public class ExcelImportValidator {
|
||||
ExcelTemplateRows.PartItemBase.class,
|
||||
row -> allBlank(row.getWaveCd(), row.getPartCd(), row.getPartItemCd(),
|
||||
row.getSurveyCd(), row.getPartItemSubCd(), row.getBaseCount(),
|
||||
row.getBasePreText(), row.getBasePostText()), this::toPartItemBaseRow),
|
||||
row.getBaseText()), this::toPartItemBaseRow),
|
||||
readRows(workbook, ExcelTemplateRows.PART_ITEM_DATA_SHEET,
|
||||
ExcelTemplateRows.PartItemData.class,
|
||||
row -> allBlank(row.getWaveCd(), row.getPartCd(), row.getPartItemCd(),
|
||||
@@ -188,7 +189,8 @@ public class ExcelImportValidator {
|
||||
requiredShort(row.getSurveyCd(), "survey_cd", context),
|
||||
requiredShort(row.getSurveyOrder(), "survey_order", context),
|
||||
requiredString(row.getSurveyTitle(), "survey_title", 128, context),
|
||||
requiredString(row.getSurveyAlias(), "survey_alias", 32, context)
|
||||
requiredString(row.getSurveyAlias(), "survey_alias", 32, context),
|
||||
requiredString(row.getSurveyColor(), "survey_color", 8, context)
|
||||
);
|
||||
}
|
||||
|
||||
@@ -251,8 +253,7 @@ public class ExcelImportValidator {
|
||||
requiredShort(row.getSurveyCd(), "survey_cd", context),
|
||||
optionalShort(row.getPartItemSubCd(), "part_item_sub_cd", context),
|
||||
requiredInteger(row.getBaseCount(), "base_count", context),
|
||||
optionalString(row.getBasePreText(), "base_pre_text", 128, context),
|
||||
optionalString(row.getBasePostText(), "base_post_text", 128, context)
|
||||
optionalString(row.getBaseText(), "base_text", 128, context)
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -32,13 +32,11 @@ 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.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Comparator;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.function.Function;
|
||||
@@ -95,6 +93,7 @@ public class WaveQueryService {
|
||||
survey.getId().getSurveyCd(),
|
||||
survey.getSurveyTitle(),
|
||||
survey.getSurveyAlias(),
|
||||
survey.getSurveyColor(),
|
||||
surveyItems.getOrDefault(survey.getId().getSurveyCd(), List.of()).stream()
|
||||
.map(item -> new WaveDetailResponse.SurveyItem(
|
||||
item.getSurveyItemTitle(), item.getSurveyItemContent()))
|
||||
@@ -222,8 +221,9 @@ public class WaveQueryService {
|
||||
return new Series(
|
||||
surveyCd,
|
||||
survey.getSurveyAlias(),
|
||||
survey.getSurveyColor(),
|
||||
base == null ? null : base.getBaseCount(),
|
||||
base == null ? null : formatBase(base),
|
||||
base == null ? null : base.getBaseText(),
|
||||
dataBySurvey.get(surveyCd).stream()
|
||||
.sorted(Comparator.comparing(TPartItemDataEntity::getPartItemDataOrder))
|
||||
.map(TPartItemDataEntity::getPartItemDataValue)
|
||||
@@ -251,13 +251,6 @@ public class WaveQueryService {
|
||||
return new Audience("SURVEY", label);
|
||||
}
|
||||
|
||||
private String formatBase(TPartItemBaseEntity base) {
|
||||
String prefix = base.getBasePreText() == null ? "" : base.getBasePreText();
|
||||
String suffix = base.getBasePostText() == null ? "" : base.getBasePostText();
|
||||
String count = NumberFormat.getIntegerInstance(Locale.KOREA).format(base.getBaseCount());
|
||||
return prefix + count + suffix;
|
||||
}
|
||||
|
||||
private WaveDetailResponse.FileDownload toFileDownload(Short waveCd, TFileEntity file) {
|
||||
String encodedFilename = UriUtils.encodePathSegment(file.getFileName(), java.nio.charset.StandardCharsets.UTF_8);
|
||||
String resourcePath = fileStorageProperties.getResourcePattern().replace("/**", "");
|
||||
|
||||
Reference in New Issue
Block a user