260723_01_ENH: 설문 URL 치환시 모든 헤더 정보에 대해서 치환 가능하게 수정

This commit is contained in:
2026-07-23 16:03:33 +09:00
parent 2dd5b88c6f
commit a7af497542
16 changed files with 36 additions and 200 deletions

1
.gitignore vendored
View File

@@ -23,6 +23,7 @@
# misc # misc
.DS_Store .DS_Store
*.pem *.pem
/.idea/
# debug # debug
npm-debug.log* npm-debug.log*

8
.idea/.gitignore generated vendored
View File

@@ -1,8 +0,0 @@
# 디폴트 무시된 파일
/shelf/
/workspace.xml
# 에디터 기반 HTTP 클라이언트 요청
/httpRequests/
# Datasource local storage ignored files
/dataSources/
/dataSources.local.xml

87
.idea/IntelliLang.xml generated
View File

@@ -1,87 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="LanguageInjectionConfiguration">
<injection language="SpEL" injector-id="java">
<display-name>Spring @Cacheable and @CacheEvict</display-name>
<single-file value="true" />
<place><![CDATA[psiMethod().withName("condition").withParameters().definedInClass("org.springframework.cache.annotation.CacheEvict")]]></place>
<place><![CDATA[psiMethod().withName("condition").withParameters().definedInClass("org.springframework.cache.annotation.CachePut")]]></place>
<place><![CDATA[psiMethod().withName("condition").withParameters().definedInClass("org.springframework.cache.annotation.Cacheable")]]></place>
<place><![CDATA[psiMethod().withName("key").withParameters().definedInClass("org.springframework.cache.annotation.CacheEvict")]]></place>
<place><![CDATA[psiMethod().withName("key").withParameters().definedInClass("org.springframework.cache.annotation.CachePut")]]></place>
<place><![CDATA[psiMethod().withName("key").withParameters().definedInClass("org.springframework.cache.annotation.Cacheable")]]></place>
<place><![CDATA[psiMethod().withName("unless").withParameters().definedInClass("org.springframework.cache.annotation.CachePut")]]></place>
<place><![CDATA[psiMethod().withName("unless").withParameters().definedInClass("org.springframework.cache.annotation.Cacheable")]]></place>
</injection>
<injection language="http-header-reference" injector-id="java">
<display-name>Spring HttpHeaders (org.springframework.http)</display-name>
<single-file value="true" />
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("header").definedInClass("org.springframework.http.ResponseEntity.HeadersBuilder"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("header").definedInClass("org.springframework.web.servlet.function.ServerResponse.HeadersBuilder"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("set", "add", "addAll", "getFirst", "containsKey", "get", "put", "getFirstDate", "setDate", "setInstant", "setZonedDateTime").definedInClass("org.springframework.http.HttpHeaders"))]]></place>
</injection>
<injection language="SpEL" injector-id="java">
<display-name>Spring Integration/Messaging</display-name>
<single-file value="true" />
<place><![CDATA[psiMethod().withName("expression").withParameters().definedInClass("org.springframework.messaging.handler.annotation.Payload")]]></place>
<place><![CDATA[psiMethod().withName("value").withParameters().definedInClass("org.springframework.integration.annotation.Payload")]]></place>
<place><![CDATA[psiMethod().withName("value").withParameters().definedInClass("org.springframework.messaging.handler.annotation.Payload")]]></place>
</injection>
<injection language="SQL" injector-id="java">
<display-name>Spring JDBC (org.springframework.jdbc.core.JdbcOperations)</display-name>
<single-file value="true" />
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("batchUpdate").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("execute").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("query").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForInt").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForList").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForLong").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForMap").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForObject").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForRowSet").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("queryForStream").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("sql").definedInClass("org.springframework.jdbc.core.simple.JdbcClient"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("update").definedInClass("org.springframework.jdbc.core.JdbcOperations"))]]></place>
</injection>
<injection language="SQL" injector-id="java">
<display-name>Spring JDBC (org.springframework.jdbc.core.PreparedStatementCreatorFactory)</display-name>
<single-file value="true" />
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("PreparedStatementCreatorFactory").withParameters("java.lang.String").definedInClass("org.springframework.jdbc.core.PreparedStatementCreatorFactory"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("PreparedStatementCreatorFactory").withParameters("java.lang.String", "int[]").definedInClass("org.springframework.jdbc.core.PreparedStatementCreatorFactory"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("PreparedStatementCreatorFactory").withParameters("java.lang.String", "java.util.List").definedInClass("org.springframework.jdbc.core.PreparedStatementCreatorFactory"))]]></place>
</injection>
<injection language="SQL" injector-id="java">
<display-name>Spring JDBC (org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator)</display-name>
<single-file value="true" />
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("createCustomException").withParameters("java.lang.String", "java.lang.String", "java.sql.SQLException", "java.lang.Class").definedInClass("org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("customTranslate").withParameters("java.lang.String", "java.lang.String", "java.sql.SQLException").definedInClass("org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("doTranslate").withParameters("java.lang.String", "java.lang.String", "java.sql.SQLException").definedInClass("org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("logTranslation").withParameters("java.lang.String", "java.lang.String", "java.sql.SQLException", "boolean").definedInClass("org.springframework.jdbc.support.SQLErrorCodeSQLExceptionTranslator"))]]></place>
</injection>
<injection language="SpEL" injector-id="java">
<display-name>Spring Security @PostAuthorize/@PostFilter/@PreAuthorize/@PreFilter/@AuthenticationPrincipal</display-name>
<single-file value="true" />
<place><![CDATA[psiMethod().withName("expression").withParameters().definedInClass("org.springframework.security.core.annotation.AuthenticationPrincipal")]]></place>
<place><![CDATA[psiMethod().withName("expression").withParameters().definedInClass("org.springframework.security.core.annotation.CurrentSecurityContext")]]></place>
<place><![CDATA[psiMethod().withName("value").withParameters().definedInClass("org.springframework.security.access.prepost.PostAuthorize")]]></place>
<place><![CDATA[psiMethod().withName("value").withParameters().definedInClass("org.springframework.security.access.prepost.PostFilter")]]></place>
<place><![CDATA[psiMethod().withName("value").withParameters().definedInClass("org.springframework.security.access.prepost.PreAuthorize")]]></place>
<place><![CDATA[psiMethod().withName("value").withParameters().definedInClass("org.springframework.security.access.prepost.PreFilter")]]></place>
</injection>
<injection language="SpEL" injector-id="java">
<display-name>Spring State Machine</display-name>
<single-file value="true" />
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("event").withParameters("java.lang.String").definedInClass("org.springframework.statemachine.config.configurers.SecurityConfigurer"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("guardExpression").withParameters("java.lang.String").definedInClass("org.springframework.statemachine.config.configurers.TransitionConfigurer"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("secured").withParameters("java.lang.String").definedInClass("org.springframework.statemachine.config.configurers.TransitionConfigurer"))]]></place>
<place><![CDATA[psiParameter().ofMethod(0, psiMethod().withName("transition").withParameters("java.lang.String").definedInClass("org.springframework.statemachine.config.configurers.SecurityConfigurer"))]]></place>
</injection>
<injection language="SpEL" injector-id="xml">
<display-name>SpEL for Spring Cache</display-name>
<single-file value="true" />
<place><![CDATA[xmlAttribute().withLocalName("condition").withParent(xmlTag().withNamespace(string().equalTo("http://www.springframework.org/schema/cache")))]]></place>
<place><![CDATA[xmlAttribute().withLocalName("key").withParent(xmlTag().withNamespace(string().equalTo("http://www.springframework.org/schema/cache")))]]></place>
<place><![CDATA[xmlAttribute().withLocalName("unless").withParent(xmlTag().withNamespace(string().equalTo("http://www.springframework.org/schema/cache")))]]></place>
</injection>
</component>
</project>

View File

@@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ClaudeCodeEditorTabs">
<option name="activeSessionId" value="d8691301-ce06-449d-9b1c-6360a510507b" />
<option name="openSessionIds">
<list>
<option value="d8691301-ce06-449d-9b1c-6360a510507b" />
</list>
</option>
<option name="sessionPaths">
<map>
<entry key="d8691301-ce06-449d-9b1c-6360a510507b" value="/sessions/4861f13b-20e7-4229-9754-1933b83c9805" />
</map>
</option>
<option name="sessionTitles">
<map>
<entry key="d8691301-ce06-449d-9b1c-6360a510507b" value="api가 호출될 때 자동으로 loading을 띄우는데 호출 api가 여러개인경우 제일 빠른" />
</map>
</option>
</component>
</project>

View File

@@ -1,5 +0,0 @@
<component name="ProjectCodeStyleConfiguration">
<state>
<option name="PREFERRED_PROJECT_CODE_STYLE" value="Default" />
</state>
</component>

View File

@@ -1,8 +0,0 @@
<component name="ProjectDictionaryState">
<dictionary name="project">
<words>
<w>Hder</w>
<w>prjct</w>
</words>
</dictionary>
</component>

View File

@@ -1,15 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GitToolBoxProjectSettings">
<option name="commitMessageIssueKeyValidationOverride">
<BoolValueOverride>
<option name="enabled" value="true" />
</BoolValueOverride>
</option>
<option name="commitMessageValidationEnabledOverride">
<BoolValueOverride>
<option name="enabled" value="true" />
</BoolValueOverride>
</option>
</component>
</project>

View File

@@ -1,9 +0,0 @@
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option name="myName" value="Project Default" />
<inspection_tool class="CssUnresolvedCustomProperty" enabled="false" level="ERROR" enabled_by_default="false" />
<inspection_tool class="Eslint" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="JavaCollectionWithNullableTypeArgument" enabled="true" level="WARNING" enabled_by_default="true" />
<inspection_tool class="UsePropertyAccessSyntax" enabled="true" level="WEAK WARNING" enabled_by_default="true" />
</profile>
</component>

View File

@@ -1,12 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="MaterialThemeProjectNewConfig">
<option name="metadata">
<MTProjectMetadataState>
<option name="migrated" value="true" />
<option name="pristineConfig" value="false" />
<option name="userId" value="4859b8f9:19a516124ff:-7ffa" />
</MTProjectMetadataState>
</option>
</component>
</project>

5
.idea/misc.xml generated
View File

@@ -1,5 +0,0 @@
<project version="4">
<component name="ProjectRootManager">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

8
.idea/modules.xml generated
View File

@@ -1,8 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ProjectModuleManager">
<modules>
<module fileurl="file://$PROJECT_DIR$/contact-front.iml" filepath="$PROJECT_DIR$/contact-front.iml" />
</modules>
</component>
</project>

6
.idea/vcs.xml generated
View File

@@ -1,6 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="VcsDirectoryMappings">
<mapping directory="$PROJECT_DIR$" vcs="Git" />
</component>
</project>

View File

@@ -9,11 +9,12 @@ import { KriSingleSelect } from '@/components/common/KriAutoComplete'
import { useDialog } from '@/hooks/useDialog' import { useDialog } from '@/hooks/useDialog'
import { useDownloadListItemFileByHeaderMutation, useUploadListItemFileMutation } from '@/query/list' import { useDownloadListItemFileByHeaderMutation, useUploadListItemFileMutation } from '@/query/list'
import { ListHeaderConst } from '@/const/listConst' import { ListHeaderConst } from '@/const/listConst'
import { LIST_IS_USE_LABEL } from '@/components/table-column/ListTableColumn'
import type { listHeader, ListSearchWithFullResult } from '@/types/list' import type { listHeader, ListSearchWithFullResult } from '@/types/list'
import type { MessageSendChannel } from '@/types/message' import type { MessageSendChannel } from '@/types/message'
import { type ProjectSurvey, type ResultCode, ResultCodeType } from '@/types/project' import { type ProjectSurvey, type ResultCode, ResultCodeType } from '@/types/project'
import { formatKst } from '@kri/common' import { formatKst } from '@kri/common'
import { isListFieldEditableForContact, isListFieldVisibleForContact } from '@/utils/listAccess' import { isAssignHeaderType, isListFieldEditableForContact, isListFieldVisibleForContact } from '@/utils/listAccess'
import { substituteSurveyUrl } from '@/lib/surveyUrl' import { substituteSurveyUrl } from '@/lib/surveyUrl'
import { formatKoreanPhoneNumber } from '@/utils/phone' import { formatKoreanPhoneNumber } from '@/utils/phone'
import SurveyQrDialog from '@/components/dialog/SurveyQrDialog' import SurveyQrDialog from '@/components/dialog/SurveyQrDialog'
@@ -41,17 +42,24 @@ export type ListContactInfoPanelProps = {
onSaved?: () => void onSaved?: () => void
} }
const resolveHeaderValue = (header: listHeader, detail?: ListSearchWithFullResult): string => {
if (header.listHderTy === ListHeaderConst.MEMO) return detail?.memo ?? ''
if (header.listHderTy === ListHeaderConst.IS_USE) {
return detail?.use != null ? (LIST_IS_USE_LABEL[detail.use] ?? '') : ''
}
if (isAssignHeaderType(header.listHderTy)) {
return detail?.assignList?.[header.listHderTy] ?? ''
}
return detail?.itemList?.[header.listHderId] ?? ''
}
export const buildInitialValues = (listHeaders: listHeader[], detail?: ListSearchWithFullResult) => { export const buildInitialValues = (listHeaders: listHeader[], detail?: ListSearchWithFullResult) => {
const values: Record<number, string> = {} const values: Record<number, string> = {}
for (const header of listHeaders) { for (const header of listHeaders) {
if (header.listHderTy === ListHeaderConst.SID) continue if (header.listHderTy === ListHeaderConst.SID) continue
if (!isListFieldVisibleForContact(header)) continue if (!isListFieldVisibleForContact(header)) continue
if (header.listHderTy === ListHeaderConst.MEMO) { values[header.listHderId] = resolveHeaderValue(header, detail)
values[header.listHderId] = detail?.memo ?? ''
continue
}
values[header.listHderId] = detail?.itemList?.[header.listHderId] ?? ''
} }
return values return values
@@ -115,14 +123,22 @@ const ListContactInfoPanel = ({
const surveyResultByIdx = new Map((detail?.surveyResults ?? []).map((result) => [result.prjctSurveyIdx, result])) const surveyResultByIdx = new Map((detail?.surveyResults ?? []).map((result) => [result.prjctSurveyIdx, result]))
// 설문 URL 치환은 화면 노출(면접원 노출) 여부와 무관하게 전체 헤더 값을 대상으로 한다.
const surveyUrlValues: Record<string, string> = {}
for (const header of listHeaders) {
if (header.listHderTy === ListHeaderConst.SID) continue
surveyUrlValues[header.listHderNm] = resolveHeaderValue(header, detail)
}
surveyUrlValues.SID = sid // 예약 토큰: 헤더명이 'SID'인 커스텀 헤더가 있어도 항상 실제 sid로 치환한다.
const handleStartSurvey = (survey: ProjectSurvey) => { const handleStartSurvey = (survey: ProjectSurvey) => {
if (!survey.surveyUrl) return if (!survey.surveyUrl) return
window.open(substituteSurveyUrl(survey.surveyUrl, sid), '_blank', 'noopener,noreferrer') window.open(substituteSurveyUrl(survey.surveyUrl, surveyUrlValues), '_blank', 'noopener,noreferrer')
} }
const handleShowQr = (survey: ProjectSurvey) => { const handleShowQr = (survey: ProjectSurvey) => {
if (!survey.surveyUrl) return if (!survey.surveyUrl) return
setQrTargetUrl(substituteSurveyUrl(survey.surveyUrl, sid)) setQrTargetUrl(substituteSurveyUrl(survey.surveyUrl, surveyUrlValues))
showDialog('surveyQrDialog') showDialog('surveyQrDialog')
} }

View File

@@ -36,6 +36,7 @@ import { type ProjectSurvey, type ResultCode, ResultCodeType } from '@/types/pro
import { import {
applyListAccessFilter, applyListAccessFilter,
getLockedListFilterHeaderTypes, getLockedListFilterHeaderTypes,
isAssignHeaderType,
isListFilterVisibleByAccess, isListFilterVisibleByAccess,
isListHeaderVisibleByAccess, isListHeaderVisibleByAccess,
} from '@/utils/listAccess' } from '@/utils/listAccess'
@@ -127,11 +128,6 @@ const toFilterCondition = (row: FilterRow, usesListValue: boolean): Omit<ListOth
return { operator: ListFilterOperator.NEGATIVE, matchType: ListFilterMatchType.CONTAINS, values } return { operator: ListFilterOperator.NEGATIVE, matchType: ListFilterMatchType.CONTAINS, values }
} }
const isAssignHeaderType = (value: number): value is ListHeaderAssignType =>
value === ListHeaderAssignConst.OUTSOURCE ||
value === ListHeaderAssignConst.CONTACT_INTERVIEWER ||
value === ListHeaderAssignConst.FIELD_INTERVIEWER
const TEXT_LIKE_OPERATORS: FilterOperator[] = ['eq', 'neq', 'contains', 'notContains', 'empty', 'notEmpty'] const TEXT_LIKE_OPERATORS: FilterOperator[] = ['eq', 'neq', 'contains', 'notContains', 'empty', 'notEmpty']
const ASSIGN_LIKE_OPERATORS: FilterOperator[] = ['eq', 'neq', 'empty', 'notEmpty'] const ASSIGN_LIKE_OPERATORS: FilterOperator[] = ['eq', 'neq', 'empty', 'notEmpty']
const IS_USE_OPERATORS: FilterOperator[] = ['eq', 'neq'] const IS_USE_OPERATORS: FilterOperator[] = ['eq', 'neq']

View File

@@ -1,3 +1,5 @@
// project.surveyUrl에 들어있는 [$SID] 치환 토큰을 실제 sid로 바꾼다. // project.surveyUrl에 들어있는 [$SID], [$헤더명] 치환 토큰을 values에 있는 값으로 바꾼다.
// 값이 없는 토큰은 빈 문자열로 치환한다(URL에 인코딩되지 않은 대괄호가 남지 않도록).
// 참고: src/app/(pages)/(main)/project/info/page.tsx의 sidParam = 'sid=[$SID]'와 동일한 토큰. // 참고: src/app/(pages)/(main)/project/info/page.tsx의 sidParam = 'sid=[$SID]'와 동일한 토큰.
export const substituteSurveyUrl = (surveyUrl: string, sid: string) => surveyUrl.replaceAll("[$SID]", sid); export const substituteSurveyUrl = (surveyUrl: string, values: Record<string, string>) =>
surveyUrl.replace(/\[\$([^\]]+)\]/g, (_, key: string) => values[key] ?? "");

View File

@@ -1,8 +1,13 @@
import { ListHeaderAssignConst, ListHeaderConst } from "@/const/listConst"; import { ListHeaderAssignConst, ListHeaderConst } from "@/const/listConst";
import { CONTACT_INTERVIEWER_ROLE, FIELD_INTERVIEWER_ROLE } from "@/const/userConst"; import { CONTACT_INTERVIEWER_ROLE, FIELD_INTERVIEWER_ROLE } from "@/const/userConst";
import { ListIsUse, type ListFilter, type listHeader } from "@/types/list"; import { ListIsUse, type ListFilter, type listHeader, type ListHeaderAssignType } from "@/types/list";
import {isExternalManager, isFieldWorkUser, isInternalManager, isManager} from "@/utils/userRole"; import {isExternalManager, isFieldWorkUser, isInternalManager, isManager} from "@/utils/userRole";
export const isAssignHeaderType = (value: number): value is ListHeaderAssignType =>
value === ListHeaderAssignConst.OUTSOURCE ||
value === ListHeaderAssignConst.CONTACT_INTERVIEWER ||
value === ListHeaderAssignConst.FIELD_INTERVIEWER;
type ListAccessUser = { type ListAccessUser = {
userRole?: number | null; userRole?: number | null;
userId?: string | null; userId?: string | null;