260508_02_ENH: Comment조회 및 수정 시 IDKEY에 SUFFIX 적용

This commit is contained in:
2026-05-08 10:21:42 +09:00
parent ad9d2ae9f6
commit 727097f6bd
7 changed files with 30 additions and 3 deletions

View File

@@ -10,6 +10,7 @@ import com.kri.kfpa.dash.mapper.DataMapper;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
@@ -24,15 +25,24 @@ public class AdminService {
private final DataMapper dataMapper; private final DataMapper dataMapper;
@Value("${kri.kfpa-comment-idkey-suffix:}")
private String kfpaCommentIdkeySuffix;
public boolean updateDivComment(RequestWriteDivCommentDto request) { public boolean updateDivComment(RequestWriteDivCommentDto request) {
String idkey = IDKEY_MAP.get(request.getDivId().toString()); String idkey = IDKEY_MAP.get(request.getDivId().toString());
if (idkey == null) { if (idkey == null) {
throw BusinessException.badRequest("INVALID_DIV_ID", "지역본부 ID가 잘못됐습니다."); throw BusinessException.badRequest("INVALID_DIV_ID", "지역본부 ID가 잘못됐습니다.");
} }
String suffixedIdkey = idkey + kfpaCommentIdkeySuffix;
validateCommentValues(request.getCommentValues()); validateCommentValues(request.getCommentValues());
return dataMapper.updateDivComment(KFPA_COMMENT_PKEY, idkey, request.getCommentValues()); return dataMapper.updateDivComment(
KFPA_COMMENT_PKEY,
suffixedIdkey,
request.getCommentValues()
);
} }
private void validateCommentValues(Map<String, CommentValueDto> commentValues) { private void validateCommentValues(Map<String, CommentValueDto> commentValues) {

View File

@@ -19,6 +19,7 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
@Service @Service
@@ -27,6 +28,9 @@ public class StatisticsService {
private final DataMapper dataMapper; private final DataMapper dataMapper;
@Value("${kri.kfpa-comment-idkey-suffix:}")
private String kfpaCommentIdkeySuffix;
public Map<String, List<CsiDataDto>> getCsiData() { public Map<String, List<CsiDataDto>> getCsiData() {
List<CsiDataEntity> csiDataList = dataMapper.selectDivCsiData(KFPA_DASH_PKEY); List<CsiDataEntity> csiDataList = dataMapper.selectDivCsiData(KFPA_DASH_PKEY);
@@ -54,6 +58,8 @@ public class StatisticsService {
).with("div", div); ).with("div", div);
} }
String suffixedIdkey = idkey + kfpaCommentIdkeySuffix;
List<ObjectTypeCsiRankEntity> objectTypeCsiRankList = List<ObjectTypeCsiRankEntity> objectTypeCsiRankList =
dataMapper.selectDivObjectTypeCsiRank(KFPA_DASH_PKEY).stream() dataMapper.selectDivObjectTypeCsiRank(KFPA_DASH_PKEY).stream()
.filter(entity -> entity.getDiv().equals(div)) .filter(entity -> entity.getDiv().equals(div))
@@ -66,7 +72,8 @@ public class StatisticsService {
DivCommentEntity divCommentEntity = divCommentCache.computeIfAbsent( DivCommentEntity divCommentEntity = divCommentCache.computeIfAbsent(
div, div,
key -> { key -> {
DivCommentEntity selectedComment = dataMapper.selectDivComment(KFPA_COMMENT_PKEY, idkey); DivCommentEntity selectedComment =
dataMapper.selectDivComment(KFPA_COMMENT_PKEY, suffixedIdkey);
return selectedComment == null ? DivCommentEntity.empty() : selectedComment; return selectedComment == null ? DivCommentEntity.empty() : selectedComment;
} }
); );

View File

@@ -0,0 +1,2 @@
kri:
kfpa-comment-idkey-suffix: "_TEST"

View File

@@ -0,0 +1,2 @@
kri:
kfpa-comment-idkey-suffix: "_TEST"

View File

@@ -0,0 +1,2 @@
kri:
kfpa-comment-idkey-suffix: ""

View File

@@ -10,6 +10,9 @@ spring:
url: jdbc:sqlserver://1.235.195.8:20022;databaseName=KON;encrypt=false url: jdbc:sqlserver://1.235.195.8:20022;databaseName=KON;encrypt=false
username: kon username: kon
password: kon#51304 password: kon#51304
profiles:
# 아무 설정 없을 때 기본으로 쓸 프로파일
default: local
logging: logging:
file: file:

View File

@@ -162,7 +162,8 @@
, #{commentValues.performance26.capability} AS [Q1_3_3] , #{commentValues.performance26.capability} AS [Q1_3_3]
FOR JSON PATH, WITHOUT_ARRAY_WRAPPER FOR JSON PATH, WITHOUT_ARRAY_WRAPPER
)) ))
) ),
survey_date = JSON_MODIFY(survey_date, '$.Q1', CONVERT(varchar(19), GETDATE(), 120))
FROM Kon.dbo.DATA A FROM Kon.dbo.DATA A
WHERE PKEY = #{pkey} WHERE PKEY = #{pkey}
AND IDKEY = #{idkey} AND IDKEY = #{idkey}