- API 선택 상태를 페이지 이동 시에도 유지하도록 로직 변경 - 영향 API를 JSON 단일 필드로 처리해 WAS 파트 제한 문제 해결
This commit is contained in:
+23
-4
@@ -38,7 +38,7 @@ public class PortalNoticeManController extends BaseAnnotationController {
|
||||
private final ComboService comboService;
|
||||
|
||||
/** 영향 API 목록(JSON) 파싱 전용 - 화면에서 넘어온 값만 읽는다 */
|
||||
private final ObjectMapper draftTemplateMapper = new ObjectMapper()
|
||||
private final ObjectMapper affectedApisMapper = new ObjectMapper()
|
||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
|
||||
@GetMapping(value = "/onl/apim/portalnotice/portalNoticeMan.view")
|
||||
@@ -74,18 +74,37 @@ public class PortalNoticeManController extends BaseAnnotationController {
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/apim/portalnotice/portalNoticeMan.json", params = "cmd=INSERT")
|
||||
public ResponseEntity<String> insert(PortalNoticeUI portalNoticeUI, HttpServletRequest request) throws IOException {
|
||||
public ResponseEntity<String> insert(PortalNoticeUI portalNoticeUI, String affectedApisJson,
|
||||
HttpServletRequest request) throws IOException {
|
||||
applyAffectedApis(portalNoticeUI, affectedApisJson);
|
||||
portalNoticeUI.setInquirerName(SessionManager.getUserName(request));
|
||||
portalNoticeManService.insert(portalNoticeUI);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/apim/portalnotice/portalNoticeMan.json", params = "cmd=UPDATE")
|
||||
public ResponseEntity<String> update(PortalNoticeUI portalNoticeUI) throws IOException {
|
||||
public ResponseEntity<String> update(PortalNoticeUI portalNoticeUI, String affectedApisJson) throws IOException {
|
||||
applyAffectedApis(portalNoticeUI, affectedApisJson);
|
||||
portalNoticeManService.update(portalNoticeUI);
|
||||
return ResponseEntity.ok().build();
|
||||
}
|
||||
|
||||
/**
|
||||
* 영향 API 목록을 JSON 한 필드로 받아 채운다.
|
||||
* affectedApis[i].apiId 형태로 받으면 API 1건당 multipart 파트가 2개씩 늘어
|
||||
* WAS 의 파트 개수 제한(Tomcat maxPartCount 기본 50)에 걸리므로 묶어서 받는다.
|
||||
* 저장 값이므로 파싱 실패는 그대로 오류로 돌려준다.
|
||||
*/
|
||||
private void applyAffectedApis(PortalNoticeUI portalNoticeUI, String affectedApisJson) throws IOException {
|
||||
if (affectedApisJson == null) {
|
||||
return;
|
||||
}
|
||||
List<IncidentAffectedApiUI> affectedApis = StringUtils.isBlank(affectedApisJson)
|
||||
? Collections.emptyList()
|
||||
: affectedApisMapper.readValue(affectedApisJson, new TypeReference<List<IncidentAffectedApiUI>>() {});
|
||||
portalNoticeUI.setAffectedApis(affectedApis);
|
||||
}
|
||||
|
||||
@PostMapping(value = "/onl/apim/portalnotice/portalNoticeMan.json", params = "cmd=DELETE")
|
||||
public ResponseEntity<Void> delete(String id) {
|
||||
portalNoticeManService.delete(id);
|
||||
@@ -109,7 +128,7 @@ public class PortalNoticeManController extends BaseAnnotationController {
|
||||
List<IncidentAffectedApiUI> affectedApis = Collections.emptyList();
|
||||
if (StringUtils.isNotBlank(apisJson)) {
|
||||
try {
|
||||
affectedApis = draftTemplateMapper.readValue(apisJson,
|
||||
affectedApis = affectedApisMapper.readValue(apisJson,
|
||||
new TypeReference<List<IncidentAffectedApiUI>>() {});
|
||||
} catch (IOException e) {
|
||||
// 양식 채우기는 보조 기능이므로 파싱 실패 시 영향 API 없이 양식만 돌려준다
|
||||
|
||||
Reference in New Issue
Block a user