From f7f30c9feb74bf4eb027a9c903646c8f5b227918 Mon Sep 17 00:00:00 2001 From: mjkhan21 Date: Thu, 3 Aug 2023 11:07:33 +0900 Subject: [PATCH] callback api: String[] -> List --- .../xit/interfaces/smg/web/SmgController.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/main/java/cokr/xit/interfaces/smg/web/SmgController.java b/src/main/java/cokr/xit/interfaces/smg/web/SmgController.java index 949b6dc..702b92f 100644 --- a/src/main/java/cokr/xit/interfaces/smg/web/SmgController.java +++ b/src/main/java/cokr/xit/interfaces/smg/web/SmgController.java @@ -1,9 +1,13 @@ package cokr.xit.interfaces.smg.web; +import java.util.List; +import java.util.Map; + import javax.annotation.Resource; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @@ -28,11 +32,13 @@ public class SmgController extends AbstractController { * */ @PostMapping(value = "/petition/receive.do", name = "국민 신문고 민원 수신") - public ModelAndView receivePetitions(String[] interfaceSequences) { - log().debug("interfaceSequences received: {}", String.join(", ", interfaceSequences)); + public ModelAndView receivePetitions(@RequestBody Map result) { + List interfaceSequences = (List)result.get("interfaceSequences"); + boolean empty = isEmpty(interfaceSequences); + log().debug("interfaceSequences received: {}", empty ? "none" : String.join(", ", interfaceSequences)); return new ModelAndView("jsonView") - .addObject("received", !isEmpty(interfaceSequences)) + .addObject("received", !empty) .addObject("saved", true); } @@ -45,7 +51,10 @@ public class SmgController extends AbstractController { * */ @PostMapping(value = "/petition/reply.do", name = "국민 신문고 민원 답변/반송 생성") - public ModelAndView sendReplies(String[] success, String[] fail) { + public ModelAndView sendReplies(@RequestBody Map result) { + List + success = (List)result.get("success"), + fail = (List)result.get("fail"); log().debug("success: {}", String.join(", ", success)); log().debug("fail: {}", String.join(", ", fail));