Merge pull request 'develop' (#1) from develop into master
Reviewed-on: #1
This commit is contained in:
@@ -145,6 +145,7 @@
|
||||
|
||||
- Derived create/update/delete and single/all recalculate routes are under /project/{projectType}/{pkey}/derived. Preserve saved QUESTIONJSON/DERIVEDJSON and original single/multi/ELSE/open-num response keys; parse legacy conditions through shared service/statistics/LegacyFilterService and compute with StatisticsFilterService. Unsupported SQL grammar is explicit failure, not SQL execution. Quota retains QUOTA_FILTER_INVALID at its boundary.
|
||||
- Use KON/KONKIWI-specific TransactionTemplate with project locking for definition/data writes and order changes. Preserve other JSON groups with bound JSON_MODIFY paths and original GETDATE timestamp behavior. actor/team come from RequestUserContext, logs through LogService. Return IDs/boolean/counts; frontend owns messages. Shared DB execution and ordinary role authorization are separate.
|
||||
- Per user decision (2026-10-23), derived values take precedence over raw DATA keys with the same derived ID: derived calculation ignores raw DATA keys of every stored derived ID. Statistics/Export SQL is unchanged (approach C2: keep such keys out of DATA instead of rewriting read queries). An update whose variable ID equals originId (case-insensitive) skips the duplicate check; renames and creates keep the full check.
|
||||
- Aggregate Excel POST routes are /project/{projectType}/{pkey}/export/excel/table and /quota/{projectType}/{pkey}/export/excel. Accept typed ordered tables/turn and legacy cell display/span strings, retaining frontend N/% presentation choice; do not requery raw data. Keep original workbook layout, multiple quota sheets and complete/target output. Link scopes must allow only their matching aggregate paths.
|
||||
- Use KriCommon ExcelMapper then format with current POI, without new dependencies. Wordcloud input is validated PNG Base64 from frontend, preserving original 1000x512 position; no SVG or external URL loading. Use static measured Malgun Gothic glyph advances to avoid platform autoSize changes. Compare original EPPlus workbooks: cells/styles/merged ranges/row sizes exact, column rounding within one 1/256-character unit and image anchor rounding within one pixel. Actual production files, shaping/emoji, frontend PNG/render/download and live SQL checks remain separate.
|
||||
|
||||
@@ -157,8 +158,8 @@
|
||||
## Upload migration
|
||||
|
||||
- Implement POST /project/{projectType}/{pkey}/import/title, /question and /data as multipart file uploads. Return processedRows/affectedRows/removedRows/archivedRows; no presentation messages. Common JWT is required; the existing External allowlist denies all imports. Ordinary role/team restrictions stay deferred.
|
||||
- Title upload resets eligible explain values, then updates only explain by pkey/QID; variable/title are ignored, unknown IDs no-op and duplicate IDs are sequential. Question upload resets QUESTION/QOPTION/QUOTASET/QUOTA(original QSORDER condition) and STRUCTURE before sequential Q1/Qorder creation; retain existing dataset/option quirks and JSON strings in QINFO/LINFO, never introduce JSON_QUERY around those string parameters.
|
||||
- Data upload deletes UPLOAD responses, moves actual completed responses to DEL_+PKEY, and inserts UPLOAD rows; do not mutate TEST/incomplete/other projects/DERIVED_DATA. Preserve two header rows, six distinct fixed-group skip, multi pull-up keys including duplicates, INDEX and midpoint/final timestamps, empty defaults and original text normalization.
|
||||
- Title upload resets eligible explain values, then updates only explain by pkey/QID; variable/title are ignored, unknown IDs no-op and duplicate IDs are sequential. Question upload resets QUESTION/QOPTION/QUOTASET/QUOTA(original QSORDER condition) and STRUCTURE before sequential Q1/Qorder creation; retain existing dataset/option quirks and JSON strings in QINFO/LINFO, never introduce JSON_QUERY around those string parameters. Per user decision (2026-10-22), O/N questions with no input rows (none, attribute-only or blank titles) get one open input {label:"", option all/num, must 1} instead of failing; other types still require choices.
|
||||
- Data upload deletes UPLOAD responses, moves actual completed responses to DEL_+PKEY, and inserts UPLOAD rows; do not mutate TEST/incomplete/other projects. Per user decision (2026-10-23), columns equal to a stored derived ID or starting with "{ID}_" (case-insensitive) are not uploaded, and after all rows are inserted every derived variable is recalculated in the same KON/KONKIWI transaction (no role check or extra SiteLog; failure rolls back the upload). Preserve two header rows, six distinct fixed-group skip, multi pull-up keys including duplicates, INDEX and midpoint/final timestamps, empty defaults and original text normalization.
|
||||
- Parse/convert the entire file before destructive SQL; all changes use the selected KON/KONKIWI transaction with a project lock and rollback. SQL values/JSON paths are bound. No shared DB execution or schema changes are authorized.
|
||||
- Preserve xlsx first-sheet/positional columns/blank rows/cached formulas and csv/txt simple delimiter plus EUC-KR/BOM behavior. Use Common ExcelUtil; its map reader drops rows and changes positional/formula rules, so a domain-specific POI reader is necessary. Existing 20MB limit applies.
|
||||
- Keep original file archives under kri.kart.upload.directory (./upload_data, Git ignored) and Upload File logging through LogService with authenticated context. Archives and best-effort audit attempts may remain after database rollback; do not expose stored paths or raw content on parse errors.
|
||||
@@ -180,7 +181,7 @@
|
||||
|
||||
- User approved: userRole 1001 has no authenticated-team/assignment limit in project list/summary. This intentionally unifies legacy admin 0 and DCO 1. Existing business search/exclusion filters still apply.
|
||||
- Controller RequestUserContext is authoritative for role/team/id for JWT and API Key. No permission enums/grants or user-submitted authorization claims. Missing project identity metadata fails instead of broadening visibility.
|
||||
- Preserve current frontend v2 KON/KIWI list branching for other roles: team != M101 excludes GKEY M101; R-prefixed teams additionally require own GKEY; team M101 list has no extra team filter. Summary preserves its different legacy if/else-if: M101 team only own GKEY, all other teams exclude M101, including R teams without an added own-team condition.
|
||||
- Preserve current frontend v2 KON/KIWI list branching for other roles: team != M101 excludes GKEY M101; R-prefixed teams additionally require own GKEY; team M101 list has no extra team filter. Summary: M101 team only own GKEY, all other teams exclude M101, and (user decision 2026-10-22, replacing the legacy else-if) R-prefixed teams additionally require own GKEY, matching the list. Per the same user decision, summary candidates also apply the list's title NOT LIKE '%사례비%' and status IN (2, 3) before TOP 50; the list's date/surveyclass/must-view window is intentionally not added.
|
||||
- Role 9001 additionally intersects REPORT_ASSIGN by exact member_mail=verified userId. Query the kart session (Report DB) once per request for both survey sources, do not add is_use (not used by original), do not append email domains, and empty assignments return no rows. REPORT_MEMBER emits exact member_mail as userId; other authentication also uses verified userId verbatim.
|
||||
- Apply team/assignment before candidate TOP 50 and ordering, never after Java merge/TOP 6. Must-view does not override authorization. Linked list retains its business query team and adds separately named authenticated-team/role/assignment constraints.
|
||||
- Derived management list: role 1001 sees all project definitions; others see matching GKEY only. Keep normal questions/report metadata unfiltered by this management rule.
|
||||
|
||||
@@ -55,7 +55,7 @@ configurations.configureEach {
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation 'com.kri.common:starter:beta.1.6.9'
|
||||
implementation 'com.kri.common:starter:beta.1.7.0'
|
||||
implementation 'org.apache.poi:poi-ooxml:5.5.1'
|
||||
implementation "kr.pe.bab2min:kiwi-java:${kiwiVersion}:${kiwiPlatform}@jar"
|
||||
|
||||
|
||||
@@ -104,7 +104,7 @@ public class ExportController {
|
||||
|
||||
private ResponseEntity<byte[]> download(ExportFileDto file) {
|
||||
String fileName =
|
||||
FileUtil.extractFileNameFromPath(file.getFileName())
|
||||
FileUtil.extractFileNameFromPath(file.fileName())
|
||||
.replaceAll("[\\p{Cntrl}\\\\/:*?\"<>|]", "_");
|
||||
String disposition =
|
||||
ContentDisposition.attachment()
|
||||
@@ -115,6 +115,6 @@ public class ExportController {
|
||||
.contentType(MediaType.APPLICATION_OCTET_STREAM)
|
||||
.header(HttpHeaders.CONTENT_DISPOSITION, disposition)
|
||||
.header(HttpHeaders.CACHE_CONTROL, "no-store")
|
||||
.body(file.getContent());
|
||||
.body(file.content());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,12 +32,12 @@ public class LogController {
|
||||
ShareLinkDto link =
|
||||
(ShareLinkDto) servletRequest.getAttribute(KartConstant.REQUEST_LINK_ATTRIBUTE);
|
||||
if (link != null
|
||||
&& (link.getProjectType() != request.getProjectType()
|
||||
|| !link.getPkey().equals(request.getPkey()))) {
|
||||
&& (link.projectType() != request.projectType()
|
||||
|| !link.pkey().equals(request.pkey()))) {
|
||||
throw BusinessException.forbidden("EXTERNAL_SCOPE_DENIED", "공유 프로젝트의 방문 로그만 기록할 수 있습니다.");
|
||||
}
|
||||
logService.writeVisitLog(
|
||||
request.getProjectType(), request.getPkey(), request.getLogContent(), ctx);
|
||||
request.projectType(), request.pkey(), request.logContent(), ctx);
|
||||
return "PASS";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ public class StatisticsController {
|
||||
ShareLinkDto link =
|
||||
(ShareLinkDto) servletRequest.getAttribute(KartConstant.REQUEST_LINK_ATTRIBUTE);
|
||||
return link != null
|
||||
&& link.isPageOnly()
|
||||
&& URI.create(link.getRealUrl()).getPath().equals(KartConstant.CROSSTAB_PAGE);
|
||||
&& link.pageOnly()
|
||||
&& URI.create(link.realUrl()).getPath().equals(KartConstant.CROSSTAB_PAGE);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,16 +2,11 @@ package com.kri.kart.server.dto.auth;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "로그인 요청")
|
||||
public class LoginRequestDto {
|
||||
@NotBlank private String userId;
|
||||
public record LoginRequestDto(
|
||||
@NotBlank String userId,
|
||||
|
||||
@NotBlank
|
||||
@Schema(accessMode = Schema.AccessMode.WRITE_ONLY)
|
||||
private String userPw;
|
||||
}
|
||||
String userPw) {}
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
package com.kri.kart.server.dto.auth;
|
||||
|
||||
import com.kri.common.feature.auth.dto.JwtUserClaimsDto;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public class LoginResponseDto {
|
||||
private final String accessToken;
|
||||
private final JwtUserClaimsDto user;
|
||||
private final String memberRedirect;
|
||||
}
|
||||
public record LoginResponseDto(
|
||||
String accessToken,
|
||||
JwtUserClaimsDto user,
|
||||
String memberRedirect) {}
|
||||
|
||||
@@ -5,30 +5,25 @@ import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class BookmarkSaveRequestDto {
|
||||
public interface Create {}
|
||||
|
||||
public record BookmarkSaveRequestDto(
|
||||
@Schema(description = "생성 시 필수. 수정 시 페이지는 변경하지 않음")
|
||||
@NotNull(groups = Create.class)
|
||||
@Pattern(regexp = "TABULATION|CROSSTAB")
|
||||
private String bookmarkPage;
|
||||
String bookmarkPage,
|
||||
|
||||
@NotNull
|
||||
private String bookmarkTitle;
|
||||
String bookmarkTitle,
|
||||
@NotNull
|
||||
private String bookmarkInfo;
|
||||
String bookmarkInfo,
|
||||
|
||||
@Schema(description = "기존 북마크 설정 JSON 문자열. 저장 시 원문 유지")
|
||||
@NotNull
|
||||
private String bookmarkJson;
|
||||
String bookmarkJson,
|
||||
|
||||
@NotNull
|
||||
@Min(0)
|
||||
@Max(1)
|
||||
private Integer isOpen;
|
||||
Integer isOpen) {
|
||||
public interface Create {}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,6 @@
|
||||
package com.kri.kart.server.dto.derived;
|
||||
|
||||
import lombok.Value;
|
||||
|
||||
@Value
|
||||
public class DerivedCalculationDto {
|
||||
int variableCount;
|
||||
int matchedRespondents;
|
||||
}
|
||||
public record DerivedCalculationDto(
|
||||
int variableCount,
|
||||
int matchedRespondents) {}
|
||||
|
||||
@@ -5,24 +5,19 @@ import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DerivedSaveRequestDto {
|
||||
public record DerivedSaveRequestDto(
|
||||
@NotBlank
|
||||
@Size(max = 128)
|
||||
@Pattern(regexp = "[A-Za-z][A-Za-z0-9_]*")
|
||||
private String variableId;
|
||||
String variableId,
|
||||
|
||||
@NotBlank
|
||||
@Size(max = 4000)
|
||||
private String variableTitle;
|
||||
String variableTitle,
|
||||
|
||||
@NotNull
|
||||
@Pattern(regexp = "single|multi|scale|num")
|
||||
private String variableType;
|
||||
String variableType,
|
||||
|
||||
@NotNull private JsonNode variableInfo;
|
||||
}
|
||||
@NotNull JsonNode variableInfo) {}
|
||||
|
||||
@@ -5,16 +5,11 @@ import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class AggregateExcelRequestDto {
|
||||
public record AggregateExcelRequestDto(
|
||||
@Valid
|
||||
@NotEmpty
|
||||
@Size(max = 1000)
|
||||
private List<@NotNull AggregateExcelTableDto> tables;
|
||||
List<@NotNull AggregateExcelTableDto> tables,
|
||||
|
||||
private boolean turn;
|
||||
}
|
||||
boolean turn) {}
|
||||
|
||||
@@ -1,11 +1,6 @@
|
||||
package com.kri.kart.server.dto.export;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
@Getter
|
||||
@RequiredArgsConstructor
|
||||
public class ExportFileDto {
|
||||
private final String fileName;
|
||||
private final byte[] content;
|
||||
}
|
||||
public record ExportFileDto(
|
||||
String fileName,
|
||||
byte[] content) {}
|
||||
|
||||
@@ -1,24 +1,19 @@
|
||||
package com.kri.kart.server.dto.export;
|
||||
|
||||
import com.kri.common.feature.excel.ExcelColumn;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public class ExportGuideDto {
|
||||
public record ExportGuideDto(
|
||||
@ExcelColumn(header = "문항 타입", order = 0)
|
||||
private String questionType;
|
||||
String questionType,
|
||||
|
||||
@ExcelColumn(header = "문항 / 보기번호", order = 1)
|
||||
private String variable;
|
||||
String variable,
|
||||
|
||||
@ExcelColumn(header = "내용", order = 2)
|
||||
private String content;
|
||||
String content,
|
||||
|
||||
@ExcelColumn(header = "VALUE LABEL", order = 3)
|
||||
private String valueLabel;
|
||||
String valueLabel,
|
||||
|
||||
@ExcelColumn(header = "VARIABLE LABEL", order = 4)
|
||||
private String variableLabel;
|
||||
}
|
||||
String variableLabel) {}
|
||||
|
||||
@@ -5,20 +5,15 @@ import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
@Schema(description = "화면 방문 로그. 프로젝트 정보는 둘 다 생략하거나 함께 지정한다.")
|
||||
public class VisitLogRequestDto {
|
||||
private ProjectType projectType;
|
||||
public record VisitLogRequestDto(
|
||||
ProjectType projectType,
|
||||
|
||||
@Size(max = 20)
|
||||
@Pattern(regexp = "^[^|]*$")
|
||||
private String pkey;
|
||||
String pkey,
|
||||
|
||||
@NotBlank
|
||||
@Schema(description = "방문한 화면 URL 또는 페이지 정보")
|
||||
private String logContent;
|
||||
}
|
||||
String logContent) {}
|
||||
|
||||
@@ -2,19 +2,14 @@ package com.kri.kart.server.dto.project;
|
||||
|
||||
import com.kri.common.feature.web.BusinessException;
|
||||
import java.time.LocalDate;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class ProgressSearchDto {
|
||||
public record ProgressSearchDto(
|
||||
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
|
||||
private LocalDate startDate;
|
||||
LocalDate startDate,
|
||||
|
||||
@DateTimeFormat(iso = DateTimeFormat.ISO.DATE)
|
||||
private LocalDate endDate;
|
||||
|
||||
LocalDate endDate) {
|
||||
public void validateRange() {
|
||||
if ((startDate == null) != (endDate == null)
|
||||
|| (startDate != null && startDate.isAfter(endDate))) {
|
||||
|
||||
@@ -3,21 +3,16 @@ package com.kri.kart.server.dto.project;
|
||||
import com.kri.kart.server.common.enums.ProjectType;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class ProjectLinkSearchDto {
|
||||
private ProjectType projectType;
|
||||
public record ProjectLinkSearchDto(
|
||||
ProjectType projectType,
|
||||
|
||||
@Size(max = 128)
|
||||
@Schema(description = "서비스 연동 조회용 인트라넷 프로젝트 코드. 첫 _ 앞 부분으로 검색")
|
||||
private String intranetCode;
|
||||
String intranetCode,
|
||||
|
||||
@Size(max = 32)
|
||||
private String userTeam;
|
||||
String userTeam,
|
||||
|
||||
@Size(max = 512)
|
||||
private String keyword;
|
||||
}
|
||||
String keyword) {}
|
||||
|
||||
@@ -3,26 +3,19 @@ package com.kri.kart.server.dto.project;
|
||||
import com.kri.kart.server.common.enums.ProjectType;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.util.Objects;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@EqualsAndHashCode
|
||||
@Schema(description = "프로젝트 유형과 프로젝트 키")
|
||||
public final class ProjectRefDto {
|
||||
public record ProjectRefDto(
|
||||
@Schema(description = "프로젝트 유형: 0=KON, 1=KIWI")
|
||||
private final ProjectType projectType;
|
||||
ProjectType projectType,
|
||||
|
||||
@Schema(description = "프로젝트 키", maxLength = 20)
|
||||
private final String pkey;
|
||||
|
||||
public ProjectRefDto(ProjectType projectType, String pkey) {
|
||||
String pkey) {
|
||||
public ProjectRefDto {
|
||||
Objects.requireNonNull(projectType, "Project type is required");
|
||||
if (pkey == null || pkey.isBlank() || pkey.length() > 20 || pkey.contains("|")) {
|
||||
throw new IllegalArgumentException(
|
||||
"Project key must be nonblank, at most 20 UTF-16 units, without legacy markers");
|
||||
}
|
||||
this.projectType = projectType;
|
||||
this.pkey = pkey;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,20 +1,17 @@
|
||||
package com.kri.kart.server.dto.quota;
|
||||
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
public class QuotaCellDto {
|
||||
private int columnIndex;
|
||||
private String kind;
|
||||
private String textValue;
|
||||
private Long complete;
|
||||
private Long target;
|
||||
private Double achievementPercent;
|
||||
private String achievementState;
|
||||
private String achievementDisplayText;
|
||||
private String displayText;
|
||||
private String isUsed;
|
||||
private Long quotaId;
|
||||
}
|
||||
public record QuotaCellDto(
|
||||
int columnIndex,
|
||||
String kind,
|
||||
String textValue,
|
||||
Long complete,
|
||||
Long target,
|
||||
Double achievementPercent,
|
||||
String achievementState,
|
||||
String achievementDisplayText,
|
||||
String displayText,
|
||||
String isUsed,
|
||||
Long quotaId) {}
|
||||
|
||||
@@ -4,17 +4,14 @@ import com.kri.kart.server.dto.statistics.StatisticsColumnDto;
|
||||
import com.kri.kart.server.dto.statistics.StatisticsRowDto;
|
||||
import java.util.List;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
public class QuotaResultDto {
|
||||
private Long quotaSetId;
|
||||
private Integer quotaOrder;
|
||||
private String title;
|
||||
private String index;
|
||||
private List<List<String>> banners;
|
||||
private List<StatisticsColumnDto> columns;
|
||||
private List<StatisticsRowDto> headerRows;
|
||||
private List<QuotaRowDto> rows;
|
||||
}
|
||||
public record QuotaResultDto(
|
||||
Long quotaSetId,
|
||||
Integer quotaOrder,
|
||||
String title,
|
||||
String index,
|
||||
List<List<String>> banners,
|
||||
List<StatisticsColumnDto> columns,
|
||||
List<StatisticsRowDto> headerRows,
|
||||
List<QuotaRowDto> rows) {}
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
package com.kri.kart.server.dto.quota;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public class QuotaRowDto {
|
||||
private int rowIndex;
|
||||
private String rowId;
|
||||
private String kind;
|
||||
private List<QuotaCellDto> cells;
|
||||
}
|
||||
public record QuotaRowDto(
|
||||
int rowIndex,
|
||||
String rowId,
|
||||
String kind,
|
||||
List<QuotaCellDto> cells) {}
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
package com.kri.kart.server.dto.share;
|
||||
|
||||
import com.kri.common.feature.auth.dto.JwtUserClaimsDto;
|
||||
import lombok.Value;
|
||||
|
||||
@Value
|
||||
public class ExternalLoginResponseDto {
|
||||
String accessToken;
|
||||
JwtUserClaimsDto user;
|
||||
ShareLinkDto link;
|
||||
}
|
||||
public record ExternalLoginResponseDto(
|
||||
String accessToken,
|
||||
JwtUserClaimsDto user,
|
||||
ShareLinkDto link) {}
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
package com.kri.kart.server.dto.share;
|
||||
|
||||
import com.kri.kart.server.common.enums.ProjectType;
|
||||
import lombok.Value;
|
||||
|
||||
@Value
|
||||
public class ShareLinkDto {
|
||||
String urlKey;
|
||||
String url;
|
||||
String realUrl;
|
||||
ProjectType projectType;
|
||||
String pkey;
|
||||
String projectTitle;
|
||||
boolean pageOnly;
|
||||
}
|
||||
public record ShareLinkDto(
|
||||
String urlKey,
|
||||
String url,
|
||||
String realUrl,
|
||||
ProjectType projectType,
|
||||
String pkey,
|
||||
String projectTitle,
|
||||
boolean pageOnly) {}
|
||||
|
||||
@@ -3,17 +3,12 @@ package com.kri.kart.server.dto.share;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.Pattern;
|
||||
import jakarta.validation.constraints.Size;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class ShareLinkRequestDto {
|
||||
public record ShareLinkRequestDto(
|
||||
@NotBlank
|
||||
@Size(max = 4096)
|
||||
private String realUrl;
|
||||
String realUrl,
|
||||
|
||||
@NotBlank
|
||||
@Pattern(regexp = "P|U")
|
||||
private String mode;
|
||||
}
|
||||
String mode) {}
|
||||
|
||||
@@ -1,13 +1,8 @@
|
||||
package com.kri.kart.server.dto.statistics;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public class StatisticsColumnDto {
|
||||
private final String columnId;
|
||||
private final String kind;
|
||||
private final List<String> labels;
|
||||
}
|
||||
public record StatisticsColumnDto(
|
||||
String columnId,
|
||||
String kind,
|
||||
List<String> labels) {}
|
||||
|
||||
@@ -2,17 +2,14 @@ package com.kri.kart.server.dto.statistics;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
public class StatisticsResponseDto {
|
||||
private String type;
|
||||
private String questionId;
|
||||
private String title;
|
||||
private List<StatisticsColumnDto> columns;
|
||||
private List<StatisticsRowDto> headerRows;
|
||||
private List<StatisticsRowDto> rows;
|
||||
private List<StatisticsWordDto> words;
|
||||
private StatisticsRequestDto appliedOptions;
|
||||
}
|
||||
public record StatisticsResponseDto(
|
||||
String type,
|
||||
String questionId,
|
||||
String title,
|
||||
List<StatisticsColumnDto> columns,
|
||||
List<StatisticsRowDto> headerRows,
|
||||
List<StatisticsRowDto> rows,
|
||||
List<StatisticsWordDto> words,
|
||||
StatisticsRequestDto appliedOptions) {}
|
||||
|
||||
@@ -1,14 +1,9 @@
|
||||
package com.kri.kart.server.dto.statistics;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public class StatisticsRowDto {
|
||||
private final int rowIndex;
|
||||
private final String rowId;
|
||||
private final String kind;
|
||||
private final List<StatisticsCellDto> cells;
|
||||
}
|
||||
public record StatisticsRowDto(
|
||||
int rowIndex,
|
||||
String rowId,
|
||||
String kind,
|
||||
List<StatisticsCellDto> cells) {}
|
||||
|
||||
@@ -3,21 +3,18 @@ package com.kri.kart.server.dto.statistics;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Builder;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@Builder
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@Schema(description = "NDJSON 한 줄 이벤트. result/error는 문항별, complete는 스트림 완료")
|
||||
public class StatisticsStreamEventDto {
|
||||
private String type;
|
||||
private Integer position;
|
||||
private String index;
|
||||
private StatisticsResponseDto result;
|
||||
private Integer status;
|
||||
private String code;
|
||||
private String message;
|
||||
private Integer total;
|
||||
private Integer succeeded;
|
||||
private Integer failed;
|
||||
}
|
||||
public record StatisticsStreamEventDto(
|
||||
String type,
|
||||
Integer position,
|
||||
String index,
|
||||
StatisticsResponseDto result,
|
||||
Integer status,
|
||||
String code,
|
||||
String message,
|
||||
Integer total,
|
||||
Integer succeeded,
|
||||
Integer failed) {}
|
||||
|
||||
@@ -3,13 +3,8 @@ package com.kri.kart.server.dto.statistics;
|
||||
import jakarta.validation.constraints.NotBlank;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class StatisticsValueGroupDto {
|
||||
@NotBlank private String label;
|
||||
public record StatisticsValueGroupDto(
|
||||
@NotBlank String label,
|
||||
|
||||
@NotEmpty private List<@NotBlank String> values;
|
||||
}
|
||||
@NotEmpty List<@NotBlank String> values) {}
|
||||
|
||||
@@ -1,12 +1,7 @@
|
||||
package com.kri.kart.server.dto.statistics;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public class StatisticsWordDto {
|
||||
private final String text;
|
||||
private final String tag;
|
||||
private final long count;
|
||||
}
|
||||
public record StatisticsWordDto(
|
||||
String text,
|
||||
String tag,
|
||||
long count) {}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package com.kri.kart.server.dto.upload;
|
||||
|
||||
import lombok.Value;
|
||||
|
||||
@Value
|
||||
public class ImportQuestionDto {
|
||||
String qid;
|
||||
int qOrder;
|
||||
String questionJson;
|
||||
String qinfo;
|
||||
String linfo;
|
||||
}
|
||||
public record ImportQuestionDto(
|
||||
String qid,
|
||||
int qOrder,
|
||||
String questionJson,
|
||||
String qinfo,
|
||||
String linfo) {}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package com.kri.kart.server.dto.upload;
|
||||
|
||||
import lombok.Value;
|
||||
|
||||
@Value
|
||||
public class ImportResponseDto {
|
||||
String idkey;
|
||||
String status;
|
||||
String pageName;
|
||||
String datjson;
|
||||
String surveyDate;
|
||||
}
|
||||
public record ImportResponseDto(
|
||||
String idkey,
|
||||
String status,
|
||||
String pageName,
|
||||
String datjson,
|
||||
String surveyDate) {}
|
||||
|
||||
@@ -1,11 +1,8 @@
|
||||
package com.kri.kart.server.dto.upload;
|
||||
|
||||
import lombok.Value;
|
||||
|
||||
@Value
|
||||
public class ImportResultDto {
|
||||
int processedRows;
|
||||
int affectedRows;
|
||||
int removedRows;
|
||||
int archivedRows;
|
||||
}
|
||||
public record ImportResultDto(
|
||||
int processedRows,
|
||||
int affectedRows,
|
||||
int removedRows,
|
||||
int archivedRows) {}
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
package com.kri.kart.server.dto.upload;
|
||||
|
||||
import java.util.List;
|
||||
import lombok.Value;
|
||||
|
||||
@Value
|
||||
public class UploadTableDto {
|
||||
List<String> headers;
|
||||
List<List<String>> rows;
|
||||
}
|
||||
public record UploadTableDto(
|
||||
List<String> headers,
|
||||
List<List<String>> rows) {}
|
||||
|
||||
@@ -22,7 +22,7 @@ public class SurveySessionProvider {
|
||||
}
|
||||
|
||||
public <T> T mapper(ProjectRefDto project, Class<T> mapperType) {
|
||||
return mapper(project.getProjectType(), mapperType);
|
||||
return mapper(project.projectType(), mapperType);
|
||||
}
|
||||
|
||||
public <T> T mapper(ProjectType type, Class<T> mapperType) {
|
||||
|
||||
@@ -22,12 +22,12 @@ public class BookmarkRepository {
|
||||
|
||||
public List<BookmarkDto> list(ProjectRefDto project, String page, String userId) {
|
||||
return kartSqlSessionTemplate.getMapper(BookmarkMapper.class)
|
||||
.list(project.getPkey(), page, userId);
|
||||
.list(project.pkey(), page, userId);
|
||||
}
|
||||
|
||||
public BookmarkDto find(ProjectRefDto project, String bookmarkId) {
|
||||
return kartSqlSessionTemplate.getMapper(BookmarkMapper.class)
|
||||
.find(project.getPkey(), bookmarkId);
|
||||
.find(project.pkey(), bookmarkId);
|
||||
}
|
||||
|
||||
public int create(
|
||||
@@ -37,22 +37,22 @@ public class BookmarkRepository {
|
||||
String userTeam,
|
||||
String userId) {
|
||||
return kartSqlSessionTemplate.getMapper(BookmarkMapper.class)
|
||||
.create(project.getPkey(), bookmarkId, request, userTeam, userId);
|
||||
.create(project.pkey(), bookmarkId, request, userTeam, userId);
|
||||
}
|
||||
|
||||
public int update(
|
||||
ProjectRefDto project, String bookmarkId, BookmarkSaveRequestDto request, String userId) {
|
||||
return kartSqlSessionTemplate.getMapper(BookmarkMapper.class)
|
||||
.update(project.getPkey(), bookmarkId, request, userId);
|
||||
.update(project.pkey(), bookmarkId, request, userId);
|
||||
}
|
||||
|
||||
public int shiftOrderAfterDelete(ProjectRefDto project, String bookmarkId, String userId) {
|
||||
return kartSqlSessionTemplate.getMapper(BookmarkMapper.class)
|
||||
.shiftOrderAfterDelete(project.getPkey(), bookmarkId, userId);
|
||||
.shiftOrderAfterDelete(project.pkey(), bookmarkId, userId);
|
||||
}
|
||||
|
||||
public int delete(ProjectRefDto project, String bookmarkId, String userId) {
|
||||
return kartSqlSessionTemplate.getMapper(BookmarkMapper.class)
|
||||
.delete(project.getPkey(), bookmarkId, userId);
|
||||
.delete(project.pkey(), bookmarkId, userId);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -19,27 +19,27 @@ public class DerivedRepository {
|
||||
|
||||
public List<QuestionDto> list(ProjectRefDto project, Integer userRole, String userTeam) {
|
||||
return surveySessionProvider.mapper(project, DerivedMapper.class)
|
||||
.list(project.getPkey(), userRole, userTeam);
|
||||
.list(project.pkey(), userRole, userTeam);
|
||||
}
|
||||
|
||||
public String lockProject(ProjectRefDto project) {
|
||||
return surveySessionProvider.mapper(project, DerivedMapper.class)
|
||||
.lockProject(project.getPkey());
|
||||
.lockProject(project.pkey());
|
||||
}
|
||||
|
||||
public List<DerivedDefinitionDto> definitions(ProjectRefDto project) {
|
||||
return surveySessionProvider.mapper(project, DerivedMapper.class)
|
||||
.definitions(project.getPkey());
|
||||
.definitions(project.pkey());
|
||||
}
|
||||
|
||||
public DerivedDefinitionDto find(ProjectRefDto project, String qid) {
|
||||
return surveySessionProvider.mapper(project, DerivedMapper.class)
|
||||
.find(project.getPkey(), qid);
|
||||
.find(project.pkey(), qid);
|
||||
}
|
||||
|
||||
public boolean duplicate(ProjectRefDto project, String qid, String originId) {
|
||||
return surveySessionProvider.mapper(project, DerivedMapper.class)
|
||||
.duplicate(project.getPkey(), qid, originId == null ? "" : originId)
|
||||
.duplicate(project.pkey(), qid, originId == null ? "" : originId)
|
||||
> 0;
|
||||
}
|
||||
|
||||
@@ -52,14 +52,14 @@ public class DerivedRepository {
|
||||
var derivedMapper = surveySessionProvider.mapper(project, DerivedMapper.class);
|
||||
return originId == null
|
||||
? derivedMapper.create(
|
||||
project.getPkey(),
|
||||
project.pkey(),
|
||||
definition.getQid(),
|
||||
definition.getQuestionJson(),
|
||||
definition.getDerivedJson(),
|
||||
userTeam,
|
||||
userId)
|
||||
: derivedMapper.update(
|
||||
project.getPkey(),
|
||||
project.pkey(),
|
||||
definition.getQid(),
|
||||
definition.getQuestionJson(),
|
||||
definition.getDerivedJson(),
|
||||
@@ -70,41 +70,41 @@ public class DerivedRepository {
|
||||
|
||||
public void shiftOrder(ProjectRefDto project, String qid) {
|
||||
surveySessionProvider.mapper(project, DerivedMapper.class)
|
||||
.shiftOrder(project.getPkey(), qid);
|
||||
.shiftOrder(project.pkey(), qid);
|
||||
}
|
||||
|
||||
public int delete(ProjectRefDto project, String qid) {
|
||||
return surveySessionProvider.mapper(project, DerivedMapper.class)
|
||||
.delete(project.getPkey(), qid);
|
||||
.delete(project.pkey(), qid);
|
||||
}
|
||||
|
||||
public void clearData(ProjectRefDto project, String qid) {
|
||||
surveySessionProvider.mapper(project, DerivedMapper.class)
|
||||
.clearData(project.getPkey(), "$.\"" + qid + "\"");
|
||||
.clearData(project.pkey(), "$.\"" + qid + "\"");
|
||||
}
|
||||
|
||||
public List<DerivedDataDto> responses(ProjectRefDto project) {
|
||||
return surveySessionProvider.mapper(project, DerivedMapper.class)
|
||||
.responses(project.getPkey());
|
||||
.responses(project.pkey());
|
||||
}
|
||||
|
||||
public void ensureRespondent(ProjectRefDto project, String idkey) {
|
||||
surveySessionProvider.mapper(project, DerivedMapper.class)
|
||||
.ensureRespondent(project.getPkey(), idkey);
|
||||
.ensureRespondent(project.pkey(), idkey);
|
||||
}
|
||||
|
||||
public void clearRespondentData(ProjectRefDto project, String qid, String idkey) {
|
||||
surveySessionProvider.mapper(project, DerivedMapper.class)
|
||||
.clearRespondentData(project.getPkey(), "$.\"" + qid + "\"", idkey);
|
||||
.clearRespondentData(project.pkey(), "$.\"" + qid + "\"", idkey);
|
||||
}
|
||||
|
||||
public List<DerivedDataDto> respondentResponses(ProjectRefDto project, String idkey) {
|
||||
return surveySessionProvider.mapper(project, DerivedMapper.class)
|
||||
.respondentResponses(project.getPkey(), idkey);
|
||||
.respondentResponses(project.pkey(), idkey);
|
||||
}
|
||||
|
||||
public void saveData(ProjectRefDto project, String qid, String idkey, String groupJson) {
|
||||
surveySessionProvider.mapper(project, DerivedMapper.class)
|
||||
.saveData(project.getPkey(), "$.\"" + qid + "\"", idkey, groupJson);
|
||||
.saveData(project.pkey(), "$.\"" + qid + "\"", idkey, groupJson);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,32 +21,32 @@ public class ExportRepository {
|
||||
|
||||
public String additionalColumns(ProjectRefDto project) {
|
||||
return surveySessionProvider.mapper(project, ExportMapper.class)
|
||||
.additionalColumns(project.getPkey());
|
||||
.additionalColumns(project.pkey());
|
||||
}
|
||||
|
||||
public List<ExportDerivedHeaderDto> derivedHeaders(ProjectRefDto project) {
|
||||
return surveySessionProvider.mapper(project, ExportMapper.class)
|
||||
.derivedHeaders(project.getPkey());
|
||||
.derivedHeaders(project.pkey());
|
||||
}
|
||||
|
||||
public List<ExportHeaderDto> questionHeaders(ProjectRefDto project) {
|
||||
return surveySessionProvider.mapper(project, ExportMapper.class)
|
||||
.questionHeaders(project.getPkey());
|
||||
.questionHeaders(project.pkey());
|
||||
}
|
||||
|
||||
public List<ExportTitleDto> titles(ProjectRefDto project) {
|
||||
return surveySessionProvider.mapper(project, ExportMapper.class).titles(project.getPkey());
|
||||
return surveySessionProvider.mapper(project, ExportMapper.class).titles(project.pkey());
|
||||
}
|
||||
|
||||
public String surveyType(ProjectRefDto project) {
|
||||
return surveySessionProvider.mapper(project, ExportMapper.class).surveyType(project.getPkey());
|
||||
return surveySessionProvider.mapper(project, ExportMapper.class).surveyType(project.pkey());
|
||||
}
|
||||
|
||||
public List<ExportDataDto> data(
|
||||
ProjectRefDto project, RawDataExportRequestDto request, boolean includeInterviewer) {
|
||||
return surveySessionProvider.mapper(project, ExportMapper.class)
|
||||
.data(
|
||||
project.getPkey(),
|
||||
project.pkey(),
|
||||
request.getType(),
|
||||
request.getStartDate(),
|
||||
request.getEndDate() == null ? request.getStartDate() : request.getEndDate(),
|
||||
|
||||
@@ -16,65 +16,65 @@ public class ImportRepository {
|
||||
private final SurveySessionProvider surveySessionProvider;
|
||||
|
||||
public String lockProject(ProjectRefDto project) {
|
||||
return surveySessionProvider.mapper(project, ImportMapper.class).lockProject(project.getPkey());
|
||||
return surveySessionProvider.mapper(project, ImportMapper.class).lockProject(project.pkey());
|
||||
}
|
||||
|
||||
public int resetTitles(ProjectRefDto project) {
|
||||
return surveySessionProvider.mapper(project, ImportMapper.class).resetTitles(project.getPkey());
|
||||
return surveySessionProvider.mapper(project, ImportMapper.class).resetTitles(project.pkey());
|
||||
}
|
||||
|
||||
public int deleteQuestions(ProjectRefDto project) {
|
||||
return surveySessionProvider.mapper(project, ImportMapper.class)
|
||||
.deleteQuestions(project.getPkey());
|
||||
.deleteQuestions(project.pkey());
|
||||
}
|
||||
|
||||
public int deleteOptions(ProjectRefDto project) {
|
||||
return surveySessionProvider.mapper(project, ImportMapper.class)
|
||||
.deleteOptions(project.getPkey());
|
||||
.deleteOptions(project.pkey());
|
||||
}
|
||||
|
||||
public int deleteQuotaSets(ProjectRefDto project) {
|
||||
return surveySessionProvider.mapper(project, ImportMapper.class)
|
||||
.deleteQuotaSets(project.getPkey());
|
||||
.deleteQuotaSets(project.pkey());
|
||||
}
|
||||
|
||||
public int deleteQuotas(ProjectRefDto project) {
|
||||
return surveySessionProvider.mapper(project, ImportMapper.class)
|
||||
.deleteQuotas(project.getPkey());
|
||||
.deleteQuotas(project.pkey());
|
||||
}
|
||||
|
||||
public int resetStructure(ProjectRefDto project) {
|
||||
return surveySessionProvider.mapper(project, ImportMapper.class)
|
||||
.resetStructure(project.getPkey());
|
||||
.resetStructure(project.pkey());
|
||||
}
|
||||
|
||||
public int deleteUploaded(ProjectRefDto project) {
|
||||
return surveySessionProvider.mapper(project, ImportMapper.class)
|
||||
.deleteUploaded(project.getPkey());
|
||||
.deleteUploaded(project.pkey());
|
||||
}
|
||||
|
||||
public int archiveCompleted(ProjectRefDto project) {
|
||||
return surveySessionProvider.mapper(project, ImportMapper.class)
|
||||
.archiveCompleted(project.getPkey());
|
||||
.archiveCompleted(project.pkey());
|
||||
}
|
||||
|
||||
public int title(ProjectRefDto project, String qid, String explain) {
|
||||
return surveySessionProvider.mapper(project, ImportMapper.class)
|
||||
.title(project.getPkey(), qid, explain);
|
||||
.title(project.pkey(), qid, explain);
|
||||
}
|
||||
|
||||
public int question(ProjectRefDto project, ImportQuestionDto question) {
|
||||
return surveySessionProvider.mapper(project, ImportMapper.class)
|
||||
.question(project.getPkey(), question);
|
||||
.question(project.pkey(), question);
|
||||
}
|
||||
|
||||
public int structure(ProjectRefDto project, ImportQuestionDto question) {
|
||||
return surveySessionProvider.mapper(project, ImportMapper.class)
|
||||
.structure(project.getPkey(), question, "$." + question.getQid());
|
||||
.structure(project.pkey(), question, "$." + question.qid());
|
||||
}
|
||||
|
||||
public int response(ProjectRefDto project, ImportResponseDto response) {
|
||||
return surveySessionProvider.mapper(project, ImportMapper.class)
|
||||
.response(project.getPkey(), response);
|
||||
.response(project.pkey(), response);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -22,31 +22,31 @@ public class ProgressRepository {
|
||||
|
||||
public List<ProgressDayDto> daily(ProjectRefDto project) {
|
||||
return surveySessionProvider.mapper(project, ProgressMapper.class)
|
||||
.daily(project.getPkey());
|
||||
.daily(project.pkey());
|
||||
}
|
||||
|
||||
public List<ProgressTypeDto> type(ProjectRefDto project, ProgressSearchDto search) {
|
||||
return surveySessionProvider.mapper(project, ProgressMapper.class)
|
||||
.type(project.getPkey(), search.getStartDate(), search.getEndDate());
|
||||
.type(project.pkey(), search.startDate(), search.endDate());
|
||||
}
|
||||
|
||||
public List<LoiDto> loi(ProjectRefDto project, ProgressSearchDto search) {
|
||||
return surveySessionProvider.mapper(project, ProgressMapper.class)
|
||||
.loi(project.getPkey(), search.getStartDate(), search.getEndDate());
|
||||
.loi(project.pkey(), search.startDate(), search.endDate());
|
||||
}
|
||||
|
||||
public List<ProgressScreenDto> screen(ProjectRefDto project, ProgressSearchDto search) {
|
||||
return surveySessionProvider.mapper(project, ProgressMapper.class)
|
||||
.screen(project.getPkey(), search.getStartDate(), search.getEndDate());
|
||||
.screen(project.pkey(), search.startDate(), search.endDate());
|
||||
}
|
||||
|
||||
public List<CustomProgressDto> reportUrls(ProjectRefDto project) {
|
||||
return surveySessionProvider.mapper(project, ProgressMapper.class)
|
||||
.reportUrls(project.getPkey());
|
||||
.reportUrls(project.pkey());
|
||||
}
|
||||
|
||||
public List<CustomProgressDto> appendFiles(ProjectRefDto project) {
|
||||
return surveySessionProvider.mapper(project, ProgressMapper.class)
|
||||
.appendFiles(project.getPkey());
|
||||
.appendFiles(project.pkey());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,6 @@ public class QuestionRepository {
|
||||
|
||||
public List<QuestionDto> list(ProjectRefDto project, boolean includeProfiles) {
|
||||
return surveySessionProvider.mapper(project, QuestionMapper.class)
|
||||
.list(project.getPkey(), includeProfiles);
|
||||
.list(project.pkey(), includeProfiles);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -18,16 +18,16 @@ public class QuotaRepository {
|
||||
|
||||
public List<QuotaSetDto> quotaSets(ProjectRefDto project) {
|
||||
return surveySessionProvider.mapper(project, QuotaMapper.class)
|
||||
.quotaSets(project.getPkey());
|
||||
.quotaSets(project.pkey());
|
||||
}
|
||||
|
||||
public QuotaSetDto quotaSet(ProjectRefDto project, int quotaOrder) {
|
||||
return surveySessionProvider.mapper(project, QuotaMapper.class)
|
||||
.quotaSet(project.getPkey(), quotaOrder);
|
||||
.quotaSet(project.pkey(), quotaOrder);
|
||||
}
|
||||
|
||||
public List<QuotaEntryDto> quotaEntries(ProjectRefDto project, int quotaOrder) {
|
||||
return surveySessionProvider.mapper(project, QuotaMapper.class)
|
||||
.quotaEntries(project.getPkey(), quotaOrder);
|
||||
.quotaEntries(project.pkey(), quotaOrder);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ public class ShareLinkRepository {
|
||||
|
||||
public String projectTitle(ProjectRefDto project) {
|
||||
return surveySessionProvider.mapper(project, ShareLinkMapper.class)
|
||||
.projectTitle(project.getPkey());
|
||||
.projectTitle(project.pkey());
|
||||
}
|
||||
|
||||
public ShareLinkRecordDto reusable(ShareLinkRecordDto link) {
|
||||
|
||||
@@ -23,7 +23,7 @@ public class StatisticsRepository {
|
||||
List<String> selectedRoots) {
|
||||
return surveySessionProvider.mapper(project, StatisticsMapper.class)
|
||||
.data(
|
||||
project.getPkey(),
|
||||
project.pkey(),
|
||||
request.getDataScope(),
|
||||
request.getStartDate(),
|
||||
request.getEndDate() == null ? request.getStartDate() : request.getEndDate(),
|
||||
|
||||
@@ -58,12 +58,12 @@ public class AggregateExcelService {
|
||||
private ExportFileDto export(
|
||||
ProjectRefDto project, AggregateExcelRequestDto request, boolean quota) {
|
||||
validate(request);
|
||||
String firstSheet = quota ? clean(request.getTables().get(0).getHead()) : "목차";
|
||||
String firstSheet = quota ? clean(request.tables().get(0).getHead()) : "목차";
|
||||
try (Workbook workbook = ExcelMapper.writeFromMapList(List.of(), firstSheet);
|
||||
var output = new ByteArrayOutputStream()) {
|
||||
if (quota) {
|
||||
for (int i = 0; i < request.getTables().size(); i++) {
|
||||
var table = request.getTables().get(i);
|
||||
for (int i = 0; i < request.tables().size(); i++) {
|
||||
var table = request.tables().get(i);
|
||||
Sheet sheet =
|
||||
i == 0 ? workbook.getSheetAt(0) : workbook.createSheet(clean(table.getHead()));
|
||||
CellStyle base = baseStyle(workbook, 9, false);
|
||||
@@ -82,7 +82,7 @@ public class AggregateExcelService {
|
||||
initializeSheet(contents, contentsStyle);
|
||||
initializeSheet(tables, bodyStyle);
|
||||
var heading = titleStyle(workbook, contentsStyle, 25, true);
|
||||
for (int row = 0; row < request.getTables().size() + 4; row++) {
|
||||
for (int row = 0; row < request.tables().size() + 4; row++) {
|
||||
contents.createRow(row).setHeightInPoints(20);
|
||||
}
|
||||
rectangle(
|
||||
@@ -93,7 +93,7 @@ public class AggregateExcelService {
|
||||
cell.setCellValue("목차");
|
||||
});
|
||||
contents.addMergedRegion(new CellRangeAddress(0, 3, 0, 1));
|
||||
var area = new CellRangeAddress(4, request.getTables().size() + 3, 0, 1);
|
||||
var area = new CellRangeAddress(4, request.tables().size() + 3, 0, 1);
|
||||
rectangle(
|
||||
contents,
|
||||
area,
|
||||
@@ -113,8 +113,8 @@ public class AggregateExcelService {
|
||||
});
|
||||
border(contents, area, BorderStyle.THIN);
|
||||
int nextRow = 1;
|
||||
for (int i = 0; i < request.getTables().size(); i++) {
|
||||
var item = request.getTables().get(i);
|
||||
for (int i = 0; i < request.tables().size(); i++) {
|
||||
var item = request.tables().get(i);
|
||||
cell(contents, i + 5, 1).setCellValue(title(item));
|
||||
var link = cell(contents, i + 5, 2);
|
||||
link.setCellValue("Go");
|
||||
@@ -127,7 +127,7 @@ public class AggregateExcelService {
|
||||
font.setUnderline(org.apache.poi.ss.usermodel.Font.U_SINGLE);
|
||||
font.setColor(org.apache.poi.ss.usermodel.IndexedColors.BLUE.getIndex());
|
||||
CellUtil.setCellStyleProperty(link, CellUtil.FONT, font.getIndex());
|
||||
nextRow = table(tables, item, nextRow, request.isTurn(), false, bodyStyle) + 1;
|
||||
nextRow = table(tables, item, nextRow, request.turn(), false, bodyStyle) + 1;
|
||||
}
|
||||
legacyExcelWidthService.autoFit(contents, 0, 10);
|
||||
contents.createFreezePane(0, 4);
|
||||
@@ -137,7 +137,7 @@ public class AggregateExcelService {
|
||||
"["
|
||||
+ (quota ? "QUOTA" : "REPORT")
|
||||
+ "]"
|
||||
+ project.getPkey()
|
||||
+ project.pkey()
|
||||
+ "_"
|
||||
+ DateTimeUtil.nowKstLocalDateTime().format(TIMESTAMP)
|
||||
+ ".xlsx",
|
||||
@@ -445,7 +445,7 @@ public class AggregateExcelService {
|
||||
|
||||
private void validate(AggregateExcelRequestDto request) {
|
||||
long total = 0;
|
||||
for (var table : request.getTables()) {
|
||||
for (var table : request.tables()) {
|
||||
var keys = new ArrayList<>(table.getBody().get(0).keySet());
|
||||
if (keys.size() < 2 || keys.size() > 1024) {
|
||||
throw invalid();
|
||||
|
||||
@@ -37,13 +37,13 @@ public class BookmarkService {
|
||||
@Transactional(transactionManager = "kartTransactionManager")
|
||||
public String create(
|
||||
ProjectRefDto project, BookmarkSaveRequestDto request, RequestUserContext ctx) {
|
||||
if (!StringUtil.hasText(request.getBookmarkPage())) {
|
||||
if (!StringUtil.hasText(request.bookmarkPage())) {
|
||||
throw BusinessException.badRequest("생성할 북마크 페이지를 입력해 주세요.");
|
||||
}
|
||||
String bookmarkId =
|
||||
project.getPkey()
|
||||
project.pkey()
|
||||
+ "_"
|
||||
+ request.getBookmarkPage().charAt(0)
|
||||
+ request.bookmarkPage().charAt(0)
|
||||
+ "_"
|
||||
+ DateTimeUtil.nowKstLocalDateTime().format(ID_TIMESTAMP);
|
||||
bookmarkRepository.create(project, bookmarkId, request, ctx.getUserTeam(), ctx.getUserId());
|
||||
@@ -100,10 +100,10 @@ public class BookmarkService {
|
||||
private ObjectNode snapshot(String bookmarkId, BookmarkSaveRequestDto request) {
|
||||
return snapshot(
|
||||
bookmarkId,
|
||||
request.getBookmarkTitle(),
|
||||
request.getBookmarkInfo(),
|
||||
request.getBookmarkJson(),
|
||||
request.getIsOpen());
|
||||
request.bookmarkTitle(),
|
||||
request.bookmarkInfo(),
|
||||
request.bookmarkJson(),
|
||||
request.isOpen());
|
||||
}
|
||||
|
||||
private ObjectNode snapshot(BookmarkDto bookmark) {
|
||||
|
||||
@@ -55,7 +55,7 @@ public class DerivedManagementService {
|
||||
DerivedSaveRequestDto request,
|
||||
RequestUserContext ctx) {
|
||||
requireRole(ctx);
|
||||
validateId(request.getVariableId());
|
||||
validateId(request.variableId());
|
||||
if (originId != null) {
|
||||
validateId(originId);
|
||||
}
|
||||
@@ -68,7 +68,9 @@ public class DerivedManagementService {
|
||||
if (original != null) {
|
||||
requireTeam(original, ctx);
|
||||
}
|
||||
if (derivedRepository.duplicate(project, definition.getQid(), originId)) {
|
||||
// An update that keeps its ID cannot collide; raw DATA keys with that ID are ignored.
|
||||
boolean sameId = originId != null && originId.equalsIgnoreCase(definition.getQid());
|
||||
if (!sameId && derivedRepository.duplicate(project, definition.getQid(), originId)) {
|
||||
throw BusinessException.conflict("DERIVED_ID_DUPLICATE", "이미 사용 중인 변수 ID입니다.");
|
||||
}
|
||||
if (derivedRepository.save(
|
||||
@@ -79,7 +81,7 @@ public class DerivedManagementService {
|
||||
if (original != null && !original.getQid().equals(definition.getQid())) {
|
||||
derivedRepository.clearData(project, original.getQid());
|
||||
}
|
||||
calculate(project, definition);
|
||||
calculate(project, definition, null, derivedIds(derivedRepository.definitions(project)));
|
||||
var content = objectMapper.createObjectNode();
|
||||
content.set("NEW", objectMapper.valueToTree(definition));
|
||||
if (original != null) {
|
||||
@@ -129,9 +131,11 @@ public class DerivedManagementService {
|
||||
qid == null
|
||||
? derivedRepository.definitions(project)
|
||||
: List.of(requireDefinition(project, qid));
|
||||
var derivedIds =
|
||||
derivedIds(qid == null ? definitions : derivedRepository.definitions(project));
|
||||
int matched = 0;
|
||||
for (var definition : definitions) {
|
||||
matched += calculate(project, definition);
|
||||
matched += calculate(project, definition, null, derivedIds);
|
||||
}
|
||||
if (qid == null) {
|
||||
logService.writeSiteLog(
|
||||
@@ -156,19 +160,47 @@ public class DerivedManagementService {
|
||||
// response.
|
||||
derivedRepository.ensureRespondent(project, idkey);
|
||||
var definitions = derivedRepository.definitions(project);
|
||||
var derivedIds = derivedIds(definitions);
|
||||
int matched = 0;
|
||||
for (var definition : definitions) {
|
||||
matched += calculate(project, definition, idkey);
|
||||
matched += calculate(project, definition, idkey, derivedIds);
|
||||
}
|
||||
return new DerivedCalculationDto(definitions.size(), matched);
|
||||
});
|
||||
}
|
||||
|
||||
private int calculate(ProjectRefDto project, DerivedDefinitionDto definition) {
|
||||
return calculate(project, definition, null);
|
||||
/** Stored derived variable IDs; uploaded response columns with these IDs are not imported. */
|
||||
public List<String> derivedIds(ProjectRefDto project) {
|
||||
return derivedIds(derivedRepository.definitions(project));
|
||||
}
|
||||
|
||||
private int calculate(ProjectRefDto project, DerivedDefinitionDto definition, String idkey) {
|
||||
/**
|
||||
* Recalculates every definition after a data upload. It joins the caller's KON/KONKIWI
|
||||
* transaction, so a failure rolls back the upload; no role check or extra audit log applies.
|
||||
*/
|
||||
public DerivedCalculationDto recalculateAfterImport(ProjectRefDto project) {
|
||||
return transaction(
|
||||
project,
|
||||
() -> {
|
||||
var definitions = derivedRepository.definitions(project);
|
||||
var derivedIds = derivedIds(definitions);
|
||||
int matched = 0;
|
||||
for (var definition : definitions) {
|
||||
matched += calculate(project, definition, null, derivedIds);
|
||||
}
|
||||
return new DerivedCalculationDto(definitions.size(), matched);
|
||||
});
|
||||
}
|
||||
|
||||
private List<String> derivedIds(List<DerivedDefinitionDto> definitions) {
|
||||
return definitions.stream().map(DerivedDefinitionDto::getQid).toList();
|
||||
}
|
||||
|
||||
private int calculate(
|
||||
ProjectRefDto project,
|
||||
DerivedDefinitionDto definition,
|
||||
String idkey,
|
||||
List<String> derivedIds) {
|
||||
validateId(definition.getQid());
|
||||
if (idkey == null) {
|
||||
derivedRepository.clearData(project, definition.getQid());
|
||||
@@ -181,7 +213,7 @@ public class DerivedManagementService {
|
||||
: derivedRepository.respondentResponses(project, idkey);
|
||||
var results =
|
||||
derivedComputationService.calculate(
|
||||
definition, questionService.list(project, idkey == null ? 0 : 1001), data);
|
||||
definition, questionService.list(project, idkey == null ? 0 : 1001), data, derivedIds);
|
||||
int matched = 0;
|
||||
for (int i = 0; i < data.size(); i++) {
|
||||
var group = results.get(i);
|
||||
@@ -235,7 +267,7 @@ public class DerivedManagementService {
|
||||
private <T> T transaction(ProjectRefDto project, Supplier<T> action) {
|
||||
var transactionTemplate =
|
||||
new TransactionTemplate(
|
||||
project.getProjectType() == ProjectType.KON
|
||||
project.projectType() == ProjectType.KON
|
||||
? konTransactionManager
|
||||
: konkiwiTransactionManager);
|
||||
return Objects.requireNonNull(transactionTemplate.execute(status -> action.get()));
|
||||
|
||||
@@ -326,7 +326,7 @@ public class ExportService {
|
||||
"["
|
||||
+ prefix
|
||||
+ "]"
|
||||
+ project.getPkey()
|
||||
+ project.pkey()
|
||||
+ "_"
|
||||
+ DateTimeUtil.nowKstLocalDateTime().format(FILE_TIMESTAMP)
|
||||
+ ".xlsx";
|
||||
|
||||
@@ -33,6 +33,7 @@ public class ImportService {
|
||||
private final QuestionImportService questionImportService;
|
||||
private final ResponseImportService responseImportService;
|
||||
private final UploadArchiveService uploadArchiveService;
|
||||
private final DerivedManagementService derivedManagementService;
|
||||
private final LogService logService;
|
||||
private final ObjectMapper objectMapper;
|
||||
private final PlatformTransactionManager konTransactionManager;
|
||||
@@ -45,6 +46,7 @@ public class ImportService {
|
||||
QuestionImportService questionImportService,
|
||||
ResponseImportService responseImportService,
|
||||
UploadArchiveService uploadArchiveService,
|
||||
DerivedManagementService derivedManagementService,
|
||||
LogService logService,
|
||||
ObjectMapper objectMapper,
|
||||
@Qualifier("konTransactionManager") PlatformTransactionManager konTransactionManager,
|
||||
@@ -56,6 +58,7 @@ public class ImportService {
|
||||
this.questionImportService = questionImportService;
|
||||
this.responseImportService = responseImportService;
|
||||
this.uploadArchiveService = uploadArchiveService;
|
||||
this.derivedManagementService = derivedManagementService;
|
||||
this.logService = logService;
|
||||
this.objectMapper = objectMapper;
|
||||
this.konTransactionManager = konTransactionManager;
|
||||
@@ -72,10 +75,10 @@ public class ImportService {
|
||||
requireProject(project);
|
||||
importRepository.resetTitles(project);
|
||||
int affected = 0;
|
||||
for (var row : table.getRows()) {
|
||||
for (var row : table.rows()) {
|
||||
affected += importRepository.title(project, row.get(0), row.get(3));
|
||||
}
|
||||
return new ImportResultDto(table.getRows().size(), affected, 0, 0);
|
||||
return new ImportResultDto(table.rows().size(), affected, 0, 0);
|
||||
});
|
||||
}
|
||||
|
||||
@@ -118,12 +121,16 @@ public class ImportService {
|
||||
.filter(question -> "multi".equalsIgnoreCase(question.getQtype()))
|
||||
.map(question -> question.getQid().split("_", -1)[0])
|
||||
.collect(Collectors.toSet());
|
||||
var responses = responseImportService.prepare(table, multi);
|
||||
// Derived columns are not uploaded; derived values are regenerated from the new data.
|
||||
var responses =
|
||||
responseImportService.prepare(
|
||||
table, multi, derivedManagementService.derivedIds(project));
|
||||
int removed = importRepository.deleteUploaded(project);
|
||||
int archived = importRepository.archiveCompleted(project);
|
||||
for (var response : responses) {
|
||||
requireOne(importRepository.response(project, response));
|
||||
}
|
||||
derivedManagementService.recalculateAfterImport(project);
|
||||
return new ImportResultDto(responses.size(), responses.size(), removed, archived);
|
||||
});
|
||||
}
|
||||
@@ -155,7 +162,7 @@ public class ImportService {
|
||||
|
||||
private <T> T transaction(ProjectRefDto project, Supplier<T> action) {
|
||||
var manager =
|
||||
project.getProjectType() == ProjectType.KON
|
||||
project.projectType() == ProjectType.KON
|
||||
? konTransactionManager
|
||||
: konkiwiTransactionManager;
|
||||
return Objects.requireNonNull(new TransactionTemplate(manager).execute(status -> action.get()));
|
||||
|
||||
@@ -44,8 +44,8 @@ public class LogService {
|
||||
ProjectRefDto project, String title, JsonNode content, RequestUserContext ctx) {
|
||||
var pageInfo = objectMapper.createObjectNode();
|
||||
// The existing frontend calls the v2 endpoint, which stores projectCode rather than PKEY.
|
||||
pageInfo.put("projectCode", project.getPkey());
|
||||
pageInfo.put("projectType", project.getProjectType().getCode());
|
||||
pageInfo.put("projectCode", project.pkey());
|
||||
pageInfo.put("projectType", project.projectType().getCode());
|
||||
pageInfo.put("LOGTITLE", title);
|
||||
pageInfo.set("LOGCONTENT", normalizeContent(content));
|
||||
try {
|
||||
@@ -64,7 +64,7 @@ public class LogService {
|
||||
if (projectType == null || !hasKey) {
|
||||
throw BusinessException.badRequest("프로젝트 유형과 키는 함께 입력하거나 모두 생략해 주세요.");
|
||||
}
|
||||
return new ProjectRefDto(projectType, pkey).getPkey();
|
||||
return new ProjectRefDto(projectType, pkey).pkey();
|
||||
}
|
||||
|
||||
private JsonNode normalizeContent(JsonNode content) {
|
||||
|
||||
@@ -26,31 +26,31 @@ public class ProjectService {
|
||||
|
||||
public List<ProjectListDto> list(ProjectLinkSearchDto search, RequestUserContext ctx) {
|
||||
requireIdentity(ctx);
|
||||
boolean hasKeyword = search.getKeyword() != null && !search.getKeyword().isEmpty();
|
||||
if (search.getProjectType() == null
|
||||
&& search.getIntranetCode() == null
|
||||
&& search.getUserTeam() == null
|
||||
boolean hasKeyword = search.keyword() != null && !search.keyword().isEmpty();
|
||||
if (search.projectType() == null
|
||||
&& search.intranetCode() == null
|
||||
&& search.userTeam() == null
|
||||
&& !hasKeyword) {
|
||||
return list(ctx);
|
||||
}
|
||||
if (search.getProjectType() == null
|
||||
|| search.getIntranetCode() == null
|
||||
|| search.getUserTeam() == null) {
|
||||
if (search.projectType() == null
|
||||
|| search.intranetCode() == null
|
||||
|| search.userTeam() == null) {
|
||||
throw BusinessException.badRequest("연동 조회에는 projectType/intranetCode/userTeam을 함께 입력해 주세요.");
|
||||
}
|
||||
String intranetCode = search.getIntranetCode().split("_", -1)[0];
|
||||
String keyword = search.getKeyword() == null ? "" : search.getKeyword();
|
||||
String intranetCode = search.intranetCode().split("_", -1)[0];
|
||||
String keyword = search.keyword() == null ? "" : search.keyword();
|
||||
var rows =
|
||||
projectRepository.linkedList(
|
||||
search.getProjectType(),
|
||||
search.projectType(),
|
||||
intranetCode,
|
||||
search.getUserTeam(),
|
||||
search.userTeam(),
|
||||
keyword,
|
||||
ctx.getUserRole(),
|
||||
ctx.getUserTeam(),
|
||||
assignedPkeys(ctx));
|
||||
for (int index = 0; index < rows.size(); index++) {
|
||||
rows.get(index).setProjectType(search.getProjectType());
|
||||
rows.get(index).setProjectType(search.projectType());
|
||||
rows.get(index).setRowNumber(Integer.toString(index + 1));
|
||||
}
|
||||
return rows;
|
||||
|
||||
@@ -24,7 +24,7 @@ public class QuestionService {
|
||||
|
||||
public List<QuestionDto> list(ProjectRefDto project, Integer userRole) {
|
||||
boolean profiles =
|
||||
project.getProjectType() == ProjectType.KIWI && Integer.valueOf(1001).equals(userRole);
|
||||
project.projectType() == ProjectType.KIWI && Integer.valueOf(1001).equals(userRole);
|
||||
return organize(questionRepository.list(project, profiles));
|
||||
}
|
||||
|
||||
|
||||
@@ -40,13 +40,13 @@ public class ShareLinkService {
|
||||
@Transactional(transactionManager = "kartTransactionManager")
|
||||
public ShareLinkDto create(
|
||||
ProjectRefDto project, ShareLinkRequestDto request, RequestUserContext ctx) {
|
||||
String path = allowedUrl(request.getRealUrl());
|
||||
String path = allowedUrl(request.realUrl());
|
||||
String title = requireProject(project);
|
||||
ShareLinkRecordDto candidate = new ShareLinkRecordDto();
|
||||
candidate.setPkey(project.getPkey());
|
||||
candidate.setProjectType(project.getProjectType().getCode());
|
||||
candidate.setPkey(project.pkey());
|
||||
candidate.setProjectType(project.projectType().getCode());
|
||||
candidate.setRealUrl(path);
|
||||
candidate.setIsPageOnly("P".equals(request.getMode()) ? 1 : 0);
|
||||
candidate.setIsPageOnly("P".equals(request.mode()) ? 1 : 0);
|
||||
candidate.setSkey(legacyProjectKeyService.encode(project));
|
||||
candidate.setProjectTitle(title);
|
||||
// Ordinary legacy users share REPORT ownership, preserving existing URL reuse.
|
||||
@@ -76,8 +76,8 @@ public class ShareLinkService {
|
||||
}
|
||||
var content = objectMapper.createObjectNode();
|
||||
content.put("REAL_URI", path);
|
||||
content.put("MODE", request.getMode());
|
||||
content.put("COPY_URI", link.getUrl());
|
||||
content.put("MODE", request.mode());
|
||||
content.put("COPY_URI", link.url());
|
||||
logService.writeSiteLog(project, "URL Copy", content, ctx);
|
||||
return link;
|
||||
}
|
||||
@@ -90,7 +90,7 @@ public class ShareLinkService {
|
||||
public ExternalLoginResponseDto login(String urlKey, String clientIp) {
|
||||
ShareLinkRecordDto stored = record(urlKey);
|
||||
ShareLinkDto link = resolve(stored);
|
||||
String userId = KartConstant.EXTERNAL_USER_PREFIX + link.getUrlKey();
|
||||
String userId = KartConstant.EXTERNAL_USER_PREFIX + link.urlKey();
|
||||
JwtUserClaimsDto user =
|
||||
JwtUserClaimsDto.builder()
|
||||
.userId(userId)
|
||||
@@ -98,7 +98,7 @@ public class ShareLinkService {
|
||||
.userTeam(KartConstant.EXTERNAL_TEAM)
|
||||
.userCmpn("")
|
||||
.userRole(
|
||||
link.isPageOnly()
|
||||
link.pageOnly()
|
||||
? KartConstant.EXTERNAL_PAGE_COPY_ROLE
|
||||
: KartConstant.EXTERNAL_URL_COPY_ROLE)
|
||||
.build();
|
||||
@@ -177,8 +177,8 @@ public class ShareLinkService {
|
||||
stored.getUrlKey(),
|
||||
absolute,
|
||||
allowedUrl(stored.getRealUrl()),
|
||||
project.getProjectType(),
|
||||
project.getPkey(),
|
||||
project.projectType(),
|
||||
project.pkey(),
|
||||
stored.getProjectTitle(),
|
||||
stored.getIsPageOnly() == 1);
|
||||
}
|
||||
|
||||
@@ -158,7 +158,7 @@ public class StatisticsService {
|
||||
|
||||
private List<QuestionDto> loadQuestions(ProjectRefDto project, RequestUserContext ctx) {
|
||||
boolean includeProfileQuestions =
|
||||
project.getProjectType() == ProjectType.KIWI
|
||||
project.projectType() == ProjectType.KIWI
|
||||
&& Integer.valueOf(KartConstant.PROFILE_QUESTION_ROLE).equals(ctx.getUserRole());
|
||||
return questionService.organize(questionRepository.list(project, includeProfileQuestions));
|
||||
}
|
||||
@@ -200,7 +200,7 @@ public class StatisticsService {
|
||||
List<StatisticsRequestDto> requests,
|
||||
StatisticsRequestDto sharedRequest,
|
||||
List<QuestionDto> questions) {
|
||||
if (project.getProjectType() != ProjectType.KIWI) {
|
||||
if (project.projectType() != ProjectType.KIWI) {
|
||||
return false;
|
||||
}
|
||||
return requests.stream().anyMatch(request -> isProfileId(request.getIndex()))
|
||||
|
||||
@@ -13,6 +13,7 @@ import com.kri.kart.server.dto.statistics.SurveyResponseDto;
|
||||
import com.kri.kart.server.service.statistics.LegacyFilterService;
|
||||
import com.kri.kart.server.service.statistics.StatisticsFilterService;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
@@ -29,17 +30,17 @@ public class DerivedComputationService {
|
||||
private final StatisticsFilterService statisticsFilterService;
|
||||
|
||||
public DerivedDefinitionDto definition(DerivedSaveRequestDto request) {
|
||||
JsonNode info = request.getVariableInfo();
|
||||
JsonNode info = request.variableInfo();
|
||||
if (!info.isObject() || info.isEmpty() || info.size() > 1000) {
|
||||
throw invalid();
|
||||
}
|
||||
info.fields().forEachRemaining(entry -> validateRule(entry.getKey(), entry.getValue()));
|
||||
var question = objectMapper.createObjectNode();
|
||||
question.put("variable", request.getVariableId());
|
||||
question.put("variable", request.variableId());
|
||||
question.put("explain", "");
|
||||
question.put("title", request.getVariableTitle());
|
||||
question.put("title", request.variableTitle());
|
||||
var dataset = question.putObject("dataset");
|
||||
if (request.getVariableType().equals("num")) {
|
||||
if (request.variableType().equals("num")) {
|
||||
dataset.putObject("open").putObject("1").put("label", "").put("option", "num");
|
||||
question.put("qtype", "open");
|
||||
} else {
|
||||
@@ -52,18 +53,42 @@ public class DerivedComputationService {
|
||||
? Integer.toString(info.size())
|
||||
: entry.getKey(),
|
||||
entry.getValue().deepCopy()));
|
||||
dataset.set(request.getVariableType(), labels);
|
||||
question.put("qtype", request.getVariableType());
|
||||
dataset.set(request.variableType(), labels);
|
||||
question.put("qtype", request.variableType());
|
||||
}
|
||||
var definition = new DerivedDefinitionDto();
|
||||
definition.setQid(request.getVariableId());
|
||||
definition.setQid(request.variableId());
|
||||
definition.setDerivedJson(JsonUtil.toJson(objectMapper, info));
|
||||
definition.setQuestionJson(JsonUtil.toJson(objectMapper, question));
|
||||
return definition;
|
||||
}
|
||||
|
||||
/**
|
||||
* A response key belongs to a derived variable when it equals the variable ID or starts with
|
||||
* "{ID}_" (case-insensitive), matching the exported single/num/multi column names.
|
||||
*/
|
||||
public static boolean isDerivedKey(String key, Collection<String> derivedIds) {
|
||||
String upperKey = key.toUpperCase(Locale.ROOT);
|
||||
for (String derivedId : derivedIds) {
|
||||
String upperId = derivedId.toUpperCase(Locale.ROOT);
|
||||
if (upperKey.equals(upperId) || upperKey.startsWith(upperId + "_")) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public List<ObjectNode> calculate(
|
||||
DerivedDefinitionDto definition, List<QuestionDto> questions, List<DerivedDataDto> data) {
|
||||
return calculate(definition, questions, data, List.of(definition.getQid()));
|
||||
}
|
||||
|
||||
/** Raw DATA keys of any derived variable are ignored so derived values take precedence. */
|
||||
public List<ObjectNode> calculate(
|
||||
DerivedDefinitionDto definition,
|
||||
List<QuestionDto> questions,
|
||||
List<DerivedDataDto> data,
|
||||
Collection<String> derivedIds) {
|
||||
ObjectNode info = object(definition.getDerivedJson());
|
||||
String type = object(definition.getQuestionJson()).path("qtype").asText();
|
||||
String qid = definition.getQid();
|
||||
@@ -84,6 +109,7 @@ public class DerivedComputationService {
|
||||
for (DerivedDataDto row : data) {
|
||||
Map<String, String> flat = new LinkedHashMap<>();
|
||||
flatten(object(row.getDatjson()), flat);
|
||||
flat.keySet().removeIf(key -> isDerivedKey(key, derivedIds));
|
||||
if (row.getDerivedJson() != null) {
|
||||
ObjectNode derived = object(row.getDerivedJson());
|
||||
derived.remove(qid);
|
||||
|
||||
@@ -56,43 +56,43 @@ public class QuotaComputationService {
|
||||
})
|
||||
.toList();
|
||||
List<StatisticsColumnDto> columns = new ArrayList<>();
|
||||
columns.add(table.getColumns().get(0));
|
||||
table.getColumns().stream()
|
||||
.filter(column -> !List.of("LABEL", "TOTAL").contains(column.getKind()))
|
||||
columns.add(table.columns().get(0));
|
||||
table.columns().stream()
|
||||
.filter(column -> !List.of("LABEL", "TOTAL").contains(column.kind()))
|
||||
.forEach(
|
||||
column -> {
|
||||
// Legacy quota removes the question-title header rows and retains choice labels only.
|
||||
List<String> labels = new ArrayList<>();
|
||||
for (int depth = 1; depth < column.getLabels().size(); depth += 2) {
|
||||
labels.add(column.getLabels().get(depth));
|
||||
for (int depth = 1; depth < column.labels().size(); depth += 2) {
|
||||
labels.add(column.labels().get(depth));
|
||||
}
|
||||
columns.add(new StatisticsColumnDto(column.getColumnId(), column.getKind(), labels));
|
||||
columns.add(new StatisticsColumnDto(column.columnId(), column.kind(), labels));
|
||||
});
|
||||
columns.add(
|
||||
table.getColumns().stream()
|
||||
.filter(column -> "TOTAL".equals(column.getKind()))
|
||||
table.columns().stream()
|
||||
.filter(column -> "TOTAL".equals(column.kind()))
|
||||
.findFirst()
|
||||
.orElseThrow());
|
||||
List<StatisticsRowDto> headers =
|
||||
statisticsTableService.headers("", columns, "MERGED");
|
||||
List<QuotaRowDto> rows = new ArrayList<>();
|
||||
for (StatisticsRowDto row : table.getRows()) {
|
||||
for (StatisticsRowDto row : table.rows()) {
|
||||
List<QuotaCellDto> cells = new ArrayList<>();
|
||||
cells.add(
|
||||
QuotaCellDto.builder()
|
||||
.columnIndex(0)
|
||||
.kind("LABEL")
|
||||
.textValue(
|
||||
"TOTAL".equals(row.getKind()) ? "Total" : row.getCells().get(0).getTextValue())
|
||||
"TOTAL".equals(row.kind()) ? "Total" : row.cells().get(0).getTextValue())
|
||||
.build());
|
||||
long rowTargetSum = 0;
|
||||
for (int columnIndex = 1; columnIndex < columns.size(); columnIndex++) {
|
||||
String columnId = columns.get(columnIndex).getColumnId();
|
||||
String columnId = columns.get(columnIndex).columnId();
|
||||
int sourceColumn = 0;
|
||||
while (!table.getColumns().get(sourceColumn).getColumnId().equals(columnId)) {
|
||||
while (!table.columns().get(sourceColumn).columnId().equals(columnId)) {
|
||||
sourceColumn++;
|
||||
}
|
||||
Long complete = row.getCells().get(sourceColumn).getCount();
|
||||
Long complete = row.cells().get(sourceColumn).getCount();
|
||||
if (complete == null) {
|
||||
throw BusinessException.validationError(
|
||||
"QUOTA_STATISTIC_UNSUPPORTED", "통계량 문항은 기존 쿼터 집계에서 지원하지 않습니다.");
|
||||
@@ -104,31 +104,31 @@ public class QuotaComputationService {
|
||||
cells.add(cell(columnIndex, complete, target));
|
||||
}
|
||||
if (rowTargetSum != 0) {
|
||||
rows.add(new QuotaRowDto(0, row.getRowId(), row.getKind(), cells));
|
||||
rows.add(new QuotaRowDto(0, row.rowId(), row.kind(), cells));
|
||||
}
|
||||
}
|
||||
QuotaRowDto total =
|
||||
rows.stream().filter(row -> "TOTAL".equals(row.getKind())).findFirst().orElse(null);
|
||||
rows.stream().filter(row -> "TOTAL".equals(row.kind())).findFirst().orElse(null);
|
||||
if (total != null) {
|
||||
List<QuotaCellDto> cells = new ArrayList<>();
|
||||
cells.add(total.getCells().get(0));
|
||||
cells.add(total.cells().get(0));
|
||||
for (int columnIndex = 1; columnIndex < columns.size(); columnIndex++) {
|
||||
long complete = 0;
|
||||
for (QuotaRowDto row : rows) {
|
||||
if (!"TOTAL".equals(row.getKind())) {
|
||||
complete += row.getCells().get(columnIndex).getComplete();
|
||||
if (!"TOTAL".equals(row.kind())) {
|
||||
complete += row.cells().get(columnIndex).complete();
|
||||
}
|
||||
}
|
||||
QuotaCellDto original = total.getCells().get(columnIndex);
|
||||
QuotaCellDto original = total.cells().get(columnIndex);
|
||||
cells.add(
|
||||
cell(
|
||||
columnIndex,
|
||||
complete,
|
||||
new Target(original.getTarget(), original.getIsUsed(), original.getQuotaId())));
|
||||
new Target(original.target(), original.isUsed(), original.quotaId())));
|
||||
}
|
||||
rows.remove(total);
|
||||
if (!index.isEmpty()) {
|
||||
rows.add(new QuotaRowDto(0, total.getRowId(), "TOTAL", cells));
|
||||
rows.add(new QuotaRowDto(0, total.rowId(), "TOTAL", cells));
|
||||
}
|
||||
}
|
||||
List<QuotaRowDto> positionedRows = new ArrayList<>();
|
||||
@@ -136,7 +136,7 @@ public class QuotaComputationService {
|
||||
QuotaRowDto row = rows.get(rowIndex);
|
||||
positionedRows.add(
|
||||
new QuotaRowDto(
|
||||
headers.size() + rowIndex, row.getRowId(), row.getKind(), row.getCells()));
|
||||
headers.size() + rowIndex, row.rowId(), row.kind(), row.cells()));
|
||||
}
|
||||
return QuotaResultDto.builder()
|
||||
.quotaSetId(quotaSet.getId())
|
||||
@@ -154,11 +154,11 @@ public class QuotaComputationService {
|
||||
List<Entry> entries, StatisticsRowDto row, String index, String columnId, List<String> banners) {
|
||||
List<Entry> matching = entries;
|
||||
if (!index.isEmpty()
|
||||
&& StatisticsArithmetic.number(row.getRowId()) != null
|
||||
&& !"TOTAL".equals(row.getKind())) {
|
||||
&& StatisticsArithmetic.number(row.rowId()) != null
|
||||
&& !"TOTAL".equals(row.kind())) {
|
||||
matching =
|
||||
matching.stream()
|
||||
.filter(entry -> value(entry.values(), index).equals(row.getRowId()))
|
||||
.filter(entry -> value(entry.values(), index).equals(row.rowId()))
|
||||
.toList();
|
||||
}
|
||||
if (!"i".equals(columnId)) {
|
||||
|
||||
@@ -52,11 +52,11 @@ public class ExternalAccessInterceptor implements HandlerInterceptor {
|
||||
String urlKey = userId.substring(KartConstant.EXTERNAL_USER_PREFIX.length());
|
||||
ShareLinkDto link =
|
||||
(ShareLinkDto) request.getAttribute(KartConstant.REQUEST_LINK_ATTRIBUTE);
|
||||
if (link == null || !urlKey.equals(link.getUrlKey())) {
|
||||
if (link == null || !urlKey.equals(link.urlKey())) {
|
||||
link = shareLinkService.lookup(urlKey);
|
||||
}
|
||||
int expectedRole =
|
||||
link.isPageOnly()
|
||||
link.pageOnly()
|
||||
? KartConstant.EXTERNAL_PAGE_COPY_ROLE
|
||||
: KartConstant.EXTERNAL_URL_COPY_ROLE;
|
||||
if (!Integer.valueOf(expectedRole).equals(claims.getUserRole())) {
|
||||
@@ -66,14 +66,14 @@ public class ExternalAccessInterceptor implements HandlerInterceptor {
|
||||
Map<String, String> variables =
|
||||
(Map<String, String>) request.getAttribute(HandlerMapping.URI_TEMPLATE_VARIABLES_ATTRIBUTE);
|
||||
if (variables == null
|
||||
|| !link.getProjectType().getCode().toString().equals(variables.get("projectType"))
|
||||
|| !link.getPkey().equals(variables.get("pkey"))) {
|
||||
|| !link.projectType().getCode().toString().equals(variables.get("projectType"))
|
||||
|| !link.pkey().equals(variables.get("pkey"))) {
|
||||
// Visit body scope is checked in LogController after JSON binding.
|
||||
if (!"/api/v1/log/visit".equals(pattern) || !"POST".equals(request.getMethod())) {
|
||||
throw denied();
|
||||
}
|
||||
}
|
||||
String page = URI.create(link.getRealUrl()).getPath();
|
||||
String page = URI.create(link.realUrl()).getPath();
|
||||
boolean allowed = "/api/v1/log/visit".equals(pattern);
|
||||
if ("GET".equals(request.getMethod())) {
|
||||
allowed |=
|
||||
@@ -82,7 +82,7 @@ public class ExternalAccessInterceptor implements HandlerInterceptor {
|
||||
"/api/v1/project/{projectType}/{pkey}/question/{qid}")
|
||||
.contains(pattern);
|
||||
allowed |=
|
||||
(!link.isPageOnly() || page.equals("/Report/Current"))
|
||||
(!link.pageOnly() || page.equals("/Report/Current"))
|
||||
&& Set.of(
|
||||
"/api/v1/project/{projectType}/{pkey}/progress/day",
|
||||
"/api/v1/project/{projectType}/{pkey}/progress/type",
|
||||
@@ -90,28 +90,28 @@ public class ExternalAccessInterceptor implements HandlerInterceptor {
|
||||
"/api/v1/project/{projectType}/{pkey}/progress/screen")
|
||||
.contains(pattern);
|
||||
allowed |=
|
||||
(!link.isPageOnly() || page.equals("/Report/Quota"))
|
||||
(!link.pageOnly() || page.equals("/Report/Quota"))
|
||||
&& pattern.equals("/api/v1/quota/{projectType}/{pkey}/list");
|
||||
if (pattern.equals("/api/v1/project/{projectType}/{pkey}/bookmark/list")) {
|
||||
String bookmarkPage = request.getParameter("page");
|
||||
allowed |=
|
||||
Set.of("TABULATION", "CROSSTAB").contains(bookmarkPage == null ? "" : bookmarkPage)
|
||||
&& (!link.isPageOnly()
|
||||
&& (!link.pageOnly()
|
||||
|| (page.equals("/Report/Tabulation") && "TABULATION".equals(bookmarkPage))
|
||||
|| (page.equals("/Report/Crosstab") && "CROSSTAB".equals(bookmarkPage)));
|
||||
}
|
||||
} else if ("POST".equals(request.getMethod())) {
|
||||
allowed |=
|
||||
(!link.isPageOnly() || Set.of("/Report/Tabulation", "/Report/Crosstab").contains(page))
|
||||
(!link.pageOnly() || Set.of("/Report/Tabulation", "/Report/Crosstab").contains(page))
|
||||
&& pattern.equals("/api/v1/project/{projectType}/{pkey}/export/excel/table");
|
||||
allowed |=
|
||||
(!link.isPageOnly() || page.equals("/Report/Quota"))
|
||||
(!link.pageOnly() || page.equals("/Report/Quota"))
|
||||
&& pattern.equals("/api/v1/quota/{projectType}/{pkey}/export/excel");
|
||||
allowed |=
|
||||
(!link.isPageOnly() || Set.of("/Report/Tabulation", "/Report/Crosstab").contains(page))
|
||||
(!link.pageOnly() || Set.of("/Report/Tabulation", "/Report/Crosstab").contains(page))
|
||||
&& pattern.equals("/api/v1/project/{projectType}/{pkey}/statistics/result");
|
||||
allowed |=
|
||||
(!link.isPageOnly() || page.equals("/Report/Quota"))
|
||||
(!link.pageOnly() || page.equals("/Report/Quota"))
|
||||
&& pattern.equals("/api/v1/quota/{projectType}/{pkey}/{quotaOrder}/result");
|
||||
}
|
||||
if (!allowed) {
|
||||
|
||||
@@ -25,7 +25,7 @@ public class LegacyProjectKeyService {
|
||||
|
||||
public String encode(ProjectRefDto project) {
|
||||
String plain =
|
||||
(project.getProjectType() == ProjectType.KIWI ? "|K|W|" : "") + project.getPkey();
|
||||
(project.projectType() == ProjectType.KIWI ? "|K|W|" : "") + project.pkey();
|
||||
byte[] cipher = transform(Cipher.ENCRYPT_MODE, plain.getBytes(StandardCharsets.UTF_8));
|
||||
return URLEncoder.encode(Base64.getEncoder().encodeToString(cipher), StandardCharsets.UTF_8);
|
||||
}
|
||||
|
||||
@@ -235,7 +235,7 @@ public class StatisticsAggregationService {
|
||||
addScaleGroups(rows, columns, index, request);
|
||||
}
|
||||
for (StatisticsValueGroupDto group : request.getValueGroups()) {
|
||||
addGroup(rows, columns, index, group.getLabel(), group.getValues(), request);
|
||||
addGroup(rows, columns, index, group.label(), group.values(), request);
|
||||
}
|
||||
if ("scale".equals(type) && !isNps(index)) {
|
||||
addStatistic(rows, columns, index, KartConstant.MEAN, request);
|
||||
@@ -526,8 +526,8 @@ public class StatisticsAggregationService {
|
||||
List<StatisticsCellDto> cells = new ArrayList<>();
|
||||
cells.add(StatisticsTableService.text(0, "NPS"));
|
||||
for (int column = 1; column <= columns.size(); column++) {
|
||||
StatisticsCellDto promoters = rows.get(promotersRow).getCells().get(column);
|
||||
StatisticsCellDto detractors = rows.get(detractorsRow).getCells().get(column);
|
||||
StatisticsCellDto promoters = rows.get(promotersRow).cells().get(column);
|
||||
StatisticsCellDto detractors = rows.get(detractorsRow).cells().get(column);
|
||||
Double percent =
|
||||
promoters.getPercent() == null || detractors.getPercent() == null
|
||||
? null
|
||||
|
||||
@@ -57,14 +57,14 @@ public class StatisticsTableService {
|
||||
flat
|
||||
? 1
|
||||
: Math.max(
|
||||
1, columns.stream().mapToInt(column -> column.getLabels().size()).max().orElse(1));
|
||||
1, columns.stream().mapToInt(column -> column.labels().size()).max().orElse(1));
|
||||
List<List<StatisticsCellDto>> cells = new ArrayList<>();
|
||||
for (int row = 0; row < height; row++) {
|
||||
cells.add(new ArrayList<>());
|
||||
}
|
||||
cells.get(0).add(text(0, title).toBuilder().rowSpan(height).build());
|
||||
for (int column = 1; column < columns.size(); column++) {
|
||||
List<String> labels = columns.get(column).getLabels();
|
||||
List<String> labels = columns.get(column).labels();
|
||||
if (flat) {
|
||||
cells.get(0).add(text(column, String.join(" - ", labels)));
|
||||
continue;
|
||||
@@ -105,8 +105,8 @@ public class StatisticsTableService {
|
||||
if (previous == null || column <= 1) {
|
||||
return false;
|
||||
}
|
||||
List<String> labels = columns.get(column).getLabels();
|
||||
List<String> previousLabels = columns.get(column - 1).getLabels();
|
||||
List<String> labels = columns.get(column).labels();
|
||||
List<String> previousLabels = columns.get(column - 1).labels();
|
||||
boolean stretches = row == Math.max(1, labels.size()) - 1 && height - row > 1;
|
||||
return previous.getRowSpan() == 1
|
||||
&& !stretches
|
||||
@@ -122,7 +122,7 @@ public class StatisticsTableService {
|
||||
StatisticsRowDto row = body.get(rowIndex);
|
||||
rows.add(
|
||||
new StatisticsRowDto(
|
||||
rowIndex + headerCount, row.getRowId(), row.getKind(), row.getCells()));
|
||||
rowIndex + headerCount, row.rowId(), row.kind(), row.cells()));
|
||||
}
|
||||
return rows;
|
||||
}
|
||||
@@ -136,11 +136,11 @@ public class StatisticsTableService {
|
||||
for (int rowIndex = 0; rowIndex < columns.size(); rowIndex++) {
|
||||
List<StatisticsCellDto> cells = new ArrayList<>();
|
||||
for (StatisticsRowDto row : source) {
|
||||
for (StatisticsCellDto cell : row.getCells()) {
|
||||
for (StatisticsCellDto cell : row.cells()) {
|
||||
if (cell.getColumnIndex() == rowIndex) {
|
||||
cells.add(
|
||||
cell.toBuilder()
|
||||
.columnIndex(row.getRowIndex())
|
||||
.columnIndex(row.rowIndex())
|
||||
.rowSpan(cell.getColSpan())
|
||||
.colSpan(cell.getRowSpan())
|
||||
.build());
|
||||
@@ -151,15 +151,15 @@ public class StatisticsTableService {
|
||||
transposed.add(
|
||||
new StatisticsRowDto(
|
||||
rowIndex,
|
||||
columns.get(rowIndex).getColumnId(),
|
||||
rowIndex == 0 ? "HEADER" : columns.get(rowIndex).getKind(),
|
||||
columns.get(rowIndex).columnId(),
|
||||
rowIndex == 0 ? "HEADER" : columns.get(rowIndex).kind(),
|
||||
cells));
|
||||
}
|
||||
List<StatisticsColumnDto> transposedColumns =
|
||||
source.stream()
|
||||
.map(
|
||||
row ->
|
||||
new StatisticsColumnDto(row.getRowId(), row.getKind(), List.of(row.getRowId())))
|
||||
new StatisticsColumnDto(row.rowId(), row.kind(), List.of(row.rowId())))
|
||||
.toList();
|
||||
List<StatisticsRowDto> headers = transposed.isEmpty() ? List.of() : List.of(transposed.get(0));
|
||||
List<StatisticsRowDto> rows =
|
||||
|
||||
@@ -30,9 +30,9 @@ public class StatisticsTextService {
|
||||
public List<StatisticsWordDto> analyze(
|
||||
ProjectRefDto project, String qid, List<SurveyResponseDto> responses) {
|
||||
List<String> texts = answerTexts(qid, responses);
|
||||
Set<String> selectedTags = new LinkedHashSet<>(nlpRepository.tags(project.getPkey(), qid));
|
||||
Set<String> selectedTags = new LinkedHashSet<>(nlpRepository.tags(project.pkey(), qid));
|
||||
List<NlpTokenDto> tokens =
|
||||
kiwiNlpService.tokenize(texts, nlpRepository.words(project.getPkey(), qid));
|
||||
kiwiNlpService.tokenize(texts, nlpRepository.words(project.pkey(), qid));
|
||||
// The same word with a different tag is counted separately, in first-appearance order.
|
||||
LinkedHashMap<NlpTokenDto, Long> counts = new LinkedHashMap<>();
|
||||
for (NlpTokenDto token : tokens) {
|
||||
|
||||
@@ -19,7 +19,7 @@ public class QuestionImportService {
|
||||
|
||||
public List<ImportQuestionDto> prepare(UploadTableDto table) {
|
||||
List<ImportQuestionDto> result = new ArrayList<>();
|
||||
List<List<String>> rows = table.getRows();
|
||||
List<List<String>> rows = table.rows();
|
||||
int first = 0;
|
||||
while (first < rows.size() && !rows.get(first).get(0).matches("[A-Za-z][A-Za-z0-9]*")) {
|
||||
first++;
|
||||
@@ -86,6 +86,17 @@ public class QuestionImportService {
|
||||
labels.set(Integer.toString(labels.size() + 1), label);
|
||||
}
|
||||
}
|
||||
// User decision: O/N without input rows (none, attribute-only or blank titles) get one
|
||||
// input with an empty label instead of failing.
|
||||
if (itemType.equals("open") && labels.isEmpty()) {
|
||||
labels.set(
|
||||
"1",
|
||||
objectMapper
|
||||
.createObjectNode()
|
||||
.put("label", "")
|
||||
.put("option", type.equals("n") ? "num" : "all")
|
||||
.put("must", "1"));
|
||||
}
|
||||
ObjectNode dataset = objectMapper.createObjectNode();
|
||||
if (!labels.isEmpty()) {
|
||||
dataset.set(itemType, labels);
|
||||
|
||||
@@ -6,10 +6,12 @@ import com.kri.common.feature.json.JsonUtil;
|
||||
import com.kri.common.feature.web.BusinessException;
|
||||
import com.kri.kart.server.dto.upload.ImportResponseDto;
|
||||
import com.kri.kart.server.dto.upload.UploadTableDto;
|
||||
import com.kri.kart.server.service.derived.DerivedComputationService;
|
||||
import java.time.Duration;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
@@ -24,13 +26,21 @@ public class ResponseImportService {
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
public List<ImportResponseDto> prepare(UploadTableDto table, Set<String> multiQuestions) {
|
||||
List<String> headers = table.getHeaders();
|
||||
return prepare(table, multiQuestions, List.of());
|
||||
}
|
||||
|
||||
/**
|
||||
* Columns of stored derived variables are skipped; their values are regenerated after the upload.
|
||||
*/
|
||||
public List<ImportResponseDto> prepare(
|
||||
UploadTableDto table, Set<String> multiQuestions, Collection<String> derivedIds) {
|
||||
List<String> headers = table.headers();
|
||||
for (String required : List.of("IDKEY", "Status", "start_date", "end_date")) {
|
||||
if (headers.stream().noneMatch(header -> header.equalsIgnoreCase(required))) {
|
||||
throw BusinessException.badRequest("응답 파일의 고정 헤더를 확인해 주세요.");
|
||||
}
|
||||
}
|
||||
if (table.getRows().size() < 2) {
|
||||
if (table.rows().size() < 2) {
|
||||
throw BusinessException.badRequest("별칭 행 다음에 업로드할 응답이 필요합니다.");
|
||||
}
|
||||
List<String> roots =
|
||||
@@ -41,8 +51,8 @@ public class ResponseImportService {
|
||||
.toList();
|
||||
List<ImportResponseDto> result = new ArrayList<>();
|
||||
String now = DateTimeUtil.nowKstLocalDateTime().format(TIMESTAMP);
|
||||
for (int rowIndex = 1; rowIndex < table.getRows().size(); rowIndex++) {
|
||||
var row = table.getRows().get(rowIndex);
|
||||
for (int rowIndex = 1; rowIndex < table.rows().size(); rowIndex++) {
|
||||
var row = table.rows().get(rowIndex);
|
||||
String idkey = value(headers, row, "IDKEY");
|
||||
String status = value(headers, row, "Status");
|
||||
String start = value(headers, row, "start_date");
|
||||
@@ -74,6 +84,9 @@ public class ResponseImportService {
|
||||
|| key.startsWith("T" + root + "_"))) {
|
||||
continue;
|
||||
}
|
||||
if (DerivedComputationService.isDerivedKey(key, derivedIds)) {
|
||||
continue;
|
||||
}
|
||||
String cell = row.get(col).trim().replace(".00", "");
|
||||
if (cell.isEmpty()) {
|
||||
continue;
|
||||
|
||||
@@ -22,7 +22,7 @@ public class UploadArchiveService {
|
||||
}
|
||||
|
||||
public String store(ProjectRefDto project, String type, String extension, MultipartFile file) {
|
||||
String pkey = project.getPkey().replaceAll("[^A-Za-z0-9_-]", "_");
|
||||
String pkey = project.pkey().replaceAll("[^A-Za-z0-9_-]", "_");
|
||||
String name =
|
||||
type
|
||||
+ "_"
|
||||
|
||||
@@ -6,4 +6,12 @@ kri:
|
||||
url: jdbc:mysql://db-md87m.vpc-cdb.ntruss.com:3306/kri_common?characterEncoding=UTF-8
|
||||
username: kriit
|
||||
password: it#51304
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
|
||||
kart:
|
||||
database:
|
||||
konkiwi:
|
||||
url: 'jdbc:sqlserver://mssql-7sq2n.vpc-cdb.ntruss.com;databaseName={konkiwi};encrypt=false'
|
||||
username: 'kadmin'
|
||||
password: 'it#51304'
|
||||
maximum-pool-size: 5
|
||||
@@ -6,4 +6,12 @@ kri:
|
||||
url: jdbc:mysql://db-md87m.vpc-cdb.ntruss.com:3306/kri_common?characterEncoding=UTF-8
|
||||
username: kriit
|
||||
password: it#51304
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
|
||||
kart:
|
||||
database:
|
||||
konkiwi:
|
||||
url: 'jdbc:sqlserver://mssql-7sq2n.vpc-cdb.ntruss.com;databaseName={konkiwi};encrypt=false'
|
||||
username: 'kadmin'
|
||||
password: 'it#51304'
|
||||
maximum-pool-size: 5
|
||||
@@ -33,6 +33,9 @@
|
||||
<when test='authenticatedUserTeam == "M101"'>AND GKEY = #{authenticatedUserTeam}</when>
|
||||
<otherwise><![CDATA[AND GKEY <> 'M101']]></otherwise>
|
||||
</choose>
|
||||
<if test='authenticatedUserTeam != null and authenticatedUserTeam.startsWith("R")'>
|
||||
AND GKEY = #{authenticatedUserTeam}
|
||||
</if>
|
||||
</if>
|
||||
<include refid="assignmentVisibility"/>
|
||||
</sql>
|
||||
@@ -79,6 +82,8 @@
|
||||
SELECT TOP(50) * FROM PROJECT WITH(NOLOCK)
|
||||
WHERE JSON_VALUE(JSON_QUERY(PROJECTJSON, '$.must'), '$.status') != 1
|
||||
AND JSON_VALUE(PROJECTJSON, '$.must.companytype') NOT IN ('4', '5')
|
||||
AND JSON_VALUE(PROJECTJSON, '$.must.title_inner') NOT LIKE '%사례비%'
|
||||
AND JSON_VALUE(PROJECTJSON, '$.must.status') IN (2, 3)
|
||||
<include refid="dinOwnerExclusion"/>
|
||||
<include refid="summaryVisibility"/>
|
||||
ORDER BY create_date DESC
|
||||
|
||||
Reference in New Issue
Block a user