260805_01_ENH: 외부 설문에서 리스트 단건 조회, 리스트 헤더조회, 리스트 단건 수정 기능 사용할수 있도록 기능 생성

This commit is contained in:
2026-08-05 12:19:11 +09:00
parent d087ec79b3
commit 62eebe8a00
13 changed files with 395 additions and 19 deletions

View File

@@ -159,8 +159,6 @@ public class ListController {
@Valid @RequestBody ListUpdateRequestDto request,
RequestUserContext ctx
) {
validateListUpdateRequest(request);
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
int updateCount = listUpdateService.updateList(prjctIdx, request, ctx.getUserRole(), ctx.getUserId(), now);
systemEventLogService.writeUpdateList(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx, request);
@@ -238,15 +236,6 @@ public class ListController {
return projectInfoDto;
}
private void validateListUpdateRequest(ListUpdateRequestDto request){
if(
CollectionUtil.isEmpty(request.getUpdateContents()) &&
CollectionUtil.isEmpty(request.getUpdateResultCodes())
){
throw BusinessException.badRequest("EMPTY_UPDATE_CONTENT","리스트 수정내용이 없습니다.");
}
}
private ResponseEntity<byte[]> buildZipResponse(String fileName, byte[] bytes) {
String contentDisposition = "attachment; filename*=UTF-8''" +
URLEncoder.encode(fileName, StandardCharsets.UTF_8).replace("+", "%20");

View File

@@ -0,0 +1,83 @@
package com.kri.contact.server.controller;
import com.kri.common.feature.datetime.DateTimeUtil;
import com.kri.common.feature.web.RequestUserContext;
import com.kri.contact.server.dto.list.ListSearchExternalDto;
import com.kri.contact.server.dto.list.ListUpdateRequestDto;
import com.kri.contact.server.service.ListHeaderService;
import com.kri.contact.server.service.ListSearchService;
import com.kri.contact.server.service.ListUpdateService;
import com.kri.contact.server.service.common.SystemEventLogService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PatchMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/api/v1/list-external")
@RequiredArgsConstructor
@Tag(name = "ListExternal", description = "외부 공개용 리스트 API")
public class ListExternalController {
private final ListHeaderService listHeaderService;
private final ListSearchService listSearchService;
private final ListUpdateService listUpdateService;
private final SystemEventLogService systemEventLogService;
@Operation(summary = "리스트 헤더 조회")
@GetMapping("/header/{prjctIdx}")
public List<String> searchListHeader(
@PathVariable Long prjctIdx,
RequestUserContext ctx
) {
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
List<String> headerNames = listHeaderService.getHeaderName(prjctIdx);
systemEventLogService.writeSearchListHeaderFromExternal(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx);
return headerNames;
}
@Operation(summary = "리스트 정보 조회")
@GetMapping("/search/{prjctIdx}/{sid}")
public ListSearchExternalDto searchListWithSid(
@PathVariable Long prjctIdx,
@PathVariable String sid,
RequestUserContext ctx
) {
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
ListSearchExternalDto listInfo = listSearchService.searchListWithSidFromExternal(prjctIdx, sid);
systemEventLogService.writeSearchListFromExternal(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx, sid);
return listInfo;
}
@Operation(summary = "리스트 수정 sid기반")
@PatchMapping("/update/{prjctIdx}/{sid}")
public int updateListWithSid(
@PathVariable Long prjctIdx,
@PathVariable String sid,
@RequestBody Map<String, String> updateContents,
RequestUserContext ctx
) {
Map<Integer, String> contentsByHeaderId = listHeaderService.convertHeaderNamesToIds(
prjctIdx,
updateContents
);
ListUpdateRequestDto request = ListUpdateRequestDto.from(contentsByHeaderId, sid);
LocalDateTime now = DateTimeUtil.nowKstLocalDateTime();
int updateCount = listUpdateService.updateList(prjctIdx, request, ctx.getUserRole(), ctx.getUserId(), now);
systemEventLogService.writeUpdateListFromExternal(ctx.getUserId(), now, ctx.getClientIp(), prjctIdx, updateContents);
return updateCount;
}
}

View File

@@ -31,7 +31,7 @@ public class ListHeaderController {
@Operation(summary = "리스트 헤더 조회")
@GetMapping("/{prjctIdx}")
public List<ListHeaderWithFilterContentDto> getListHeader (@PathVariable Long prjctIdx) {
return listHeaderService.getHeader(prjctIdx);
return listHeaderService.getHeaderWithFilterContent(prjctIdx);
}
@Operation(summary = "리스트 헤더 수정")