From 36618ca51ab6053cec55d8dcd5bb7bc620473ace Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Thu, 14 Mar 2024 13:51:43 +0900 Subject: [PATCH] =?UTF-8?q?=ED=86=B5=ED=95=A9=EC=A1=B0=ED=9A=8C=20?= =?UTF-8?q?=EB=A9=94=EB=89=B4=EC=97=90=EC=84=9C=20=EC=82=AC=EC=A0=84?= =?UTF-8?q?=ED=86=B5=EC=A7=80=EC=84=9C,=20=EA=B3=A0=EC=A7=80=EC=84=9C=20?= =?UTF-8?q?=EC=B6=9C=EB=A0=A5=EC=8B=9C=20=EB=B0=9C=EC=86=A1=ED=85=8C?= =?UTF-8?q?=EC=9D=B4=EB=B8=94=20=EB=B0=8F=20=EB=B0=9C=EC=86=A1=EC=83=81?= =?UTF-8?q?=EC=84=B8=ED=85=8C=EC=9D=B4=EB=B8=94=EC=97=90=20=EB=93=B1?= =?UTF-8?q?=EB=A1=9D=ED=95=98=EB=8A=94=20=ED=94=84=EB=A1=9C=EC=84=B8?= =?UTF-8?q?=EC=8A=A4=20=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cokr/xit/fims/cmmn/CmmnUtil.java | 4 + .../xit/fims/sprt/web/Sprt01Controller.java | 150 ++++++++++++++++-- .../cokr/xit/fims/task/web/CmnController.java | 17 +- .../WEB-INF/jsp/fims/sprt/sprt01140-info.jsp | 5 +- .../WEB-INF/jsp/fims/sprt/sprt01150-info.jsp | 5 +- 5 files changed, 153 insertions(+), 28 deletions(-) diff --git a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java index 7c0cacfa..b809a6ef 100644 --- a/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java +++ b/src/main/java/cokr/xit/fims/cmmn/CmmnUtil.java @@ -519,6 +519,10 @@ public class CmmnUtil { return "*"+rgSe1+sggCd+sndngDtlId+"*"; } + public static Long sumByKey(List dataObjectList, String key) { + return dataObjectList.stream().mapToLong(i -> i.number(key).longValue()).sum(); + } + public static void setBarcode(DataObject dataObject) { String recevDivCd = dataObject.string("RECEV_DIV_CD"); String sggCd = dataObject.string("SGG_CD"); diff --git a/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java b/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java index ea44cfc1..cceb7d57 100644 --- a/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java +++ b/src/main/java/cokr/xit/fims/sprt/web/Sprt01Controller.java @@ -1,6 +1,8 @@ package cokr.xit.fims.sprt.web; +import java.text.SimpleDateFormat; import java.util.ArrayList; +import java.util.Date; import java.util.Enumeration; import java.util.HashMap; import java.util.List; @@ -46,6 +48,9 @@ import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.dao.CrdnListMapper; import cokr.xit.fims.mngt.service.bean.FactionBean; import cokr.xit.fims.mngt.service.bean.TaskBean; +import cokr.xit.fims.sndb.SndbQuery; +import cokr.xit.fims.sndb.Sndng; +import cokr.xit.fims.sndb.service.bean.SndngBean; import cokr.xit.fims.sprt.Keyword; import cokr.xit.fims.sprt.SprtQuery; import cokr.xit.fims.sprt.dao.IntegrationSearchMapper; @@ -112,6 +117,9 @@ public class Sprt01Controller extends ApplicationController { @Resource(name = "fileBean") private FileBean fileBean; + @Resource(name = "sndngBean") + private SndngBean sndngBean; + @Resource(name = "taskBean") private TaskBean taskBean; @@ -673,16 +681,44 @@ public class Sprt01Controller extends ApplicationController { /** 사전통지서를 PDF 파일로 작성한다. * @return 사전통지서 PDF파일 */ - public ModelAndView makeAdvntcePdf(PrintOption printOption, String[] crdnIds) { + public ModelAndView makeAdvntcePdf(String[] crdnIds, Sndng sndng, PrintOption printOption) { ModelAndView mav = new ModelAndView("downloadView"); + SprtQuery sprtQuery = new SprtQuery(); + sprtQuery.setCrdnIds(crdnIds); List dataObjectList = new ArrayList(); if(crdnIds.length == 1 && crdnIds[0].equals("sample")) { DataObject sample = new Advntce().createSampleData(); dataObjectList.add(sample); } else { - SprtQuery sprtQuery = new SprtQuery(); - sprtQuery.setCrdnIds(crdnIds); + //발송 등록 + List dataObjectList0 = integrationSearchMapper.selectIntegrationDataList(sprtQuery); + SndbQuery sndbQuery = new SndbQuery(); + sndbQuery.setCrdnIDs(crdnIds); + sndng.setSndngSeCd("02"); + sndng.setTnocs(crdnIds.length); + sndng.setGramt(CmmnUtil.sumByKey(dataObjectList0, "FFNLG_AMT")); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + String today = sdf.format(new Date()); + sndng.setSndngYmd(today); + + sndbQuery.setSggCd(sndng.getSggCd()); + sndbQuery.setTaskSeCd(sndng.getTaskSeCd()); + DataObject advntceYmdInfo = taskBean.getAdvntceYmdInfo(sndbQuery); + String sndngEndYmd = CmmnUtil.addDay(today, advntceYmdInfo.number("ADVNTCE_DAY_CNT").intValue()); + sndng.setSndngEndYmd(sndngEndYmd); + + DataObject first = dataObjectList0.get(0); + sndng.setTtlNm(first.string("TASK_SE_NM")+" "+first.string("VLTN_ARTCL")+" "+"사전통지서"); + + sndng.setResndYN("N"); + String insertSndngResult = sndngBean.createAdvntceSndngList(sndbQuery, sndng); + if(insertSndngResult.contains("[F]")) { + throw new RuntimeException(insertSndngResult); + } + + //발송 등록 후 출력대상조회 dataObjectList = integrationSearchMapper.selectIntegrationDataList(sprtQuery); for(int i=0; i < dataObjectList.size(); i++) { @@ -768,15 +804,41 @@ public class Sprt01Controller extends ApplicationController { /** 사전통지 정보로 txt파일,이미지파일을 생성하고 압축파일로 반환한다. * @return 사전통지서 압축파일 */ - public ModelAndView makeAdvntceOutsourcing(PrintOption printOption, String[] crdnIds) { + public ModelAndView makeAdvntceOutsourcing(String[] crdnIds, Sndng sndng, PrintOption printOption) { ModelAndView mav = new ModelAndView("downloadView"); - - String taskSeCd = ""; - SprtQuery sprtQuery = new SprtQuery(); sprtQuery.setCrdnIds(crdnIds); - List dataObjectList = integrationSearchMapper.selectIntegrationDataList(sprtQuery); + //발송 등록 + List dataObjectList0 = integrationSearchMapper.selectIntegrationDataList(sprtQuery); + SndbQuery sndbQuery = new SndbQuery(); + sndbQuery.setCrdnIDs(crdnIds); + sndng.setSndngSeCd("02"); + sndng.setTnocs(crdnIds.length); + sndng.setGramt(CmmnUtil.sumByKey(dataObjectList0, "FFNLG_AMT")); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + String today = sdf.format(new Date()); + sndng.setSndngYmd(today); + + sndbQuery.setSggCd(sndng.getSggCd()); + sndbQuery.setTaskSeCd(sndng.getTaskSeCd()); + DataObject advntceYmdInfo = taskBean.getAdvntceYmdInfo(sndbQuery); + String sndngEndYmd = CmmnUtil.addDay(today, advntceYmdInfo.number("ADVNTCE_DAY_CNT").intValue()); + sndng.setSndngEndYmd(sndngEndYmd); + + DataObject first = dataObjectList0.get(0); + sndng.setTtlNm(first.string("TASK_SE_NM")+" "+first.string("VLTN_ARTCL")+" "+"사전통지서"); + + sndng.setResndYN("N"); + String insertSndngResult = sndngBean.createAdvntceSndngList(sndbQuery, sndng); + if(insertSndngResult.contains("[F]")) { + throw new RuntimeException(insertSndngResult); + } + + //발송 등록 후 출력대상조회 + List dataObjectList = integrationSearchMapper.selectIntegrationDataList(sprtQuery); + String taskSeCd = ""; for(int i=0; i < dataObjectList.size(); i++) { DataObject sndngDtl = integrationSearchMapper.selectLatestSndngDtlInfo(dataObjectList.get(i).string("CRDN_ID")); dataObjectList.get(i).set("RG_NO",sndngDtl.string("RG_NO")); @@ -848,16 +910,46 @@ public class Sprt01Controller extends ApplicationController { /** 고지서를 PDF 파일로 작성한다. * @return 고지서 PDF파일 */ - public ModelAndView makeNhtPdf(PrintOption printOption, String[] crdnIds) { + public ModelAndView makeNhtPdf(String[] crdnIds, Sndng sndng, PrintOption printOption) { ModelAndView mav = new ModelAndView("downloadView"); + SprtQuery sprtQuery = new SprtQuery(); + sprtQuery.setCrdnIds(crdnIds); + List dataObjectList = new ArrayList(); if(crdnIds.length == 1 && crdnIds[0].equals("sample")) { DataObject sample = new Advntce().createSampleData(); dataObjectList.add(sample); } else { - SprtQuery sprtQuery = new SprtQuery(); - sprtQuery.setCrdnIds(crdnIds); + + //발송 등록 + List dataObjectList0 = integrationSearchMapper.selectIntegrationDataList(sprtQuery); + SndbQuery sndbQuery = new SndbQuery(); + sndbQuery.setCrdnIDs(crdnIds); + sndng.setSndngSeCd("03"); + sndng.setTnocs(crdnIds.length); + sndng.setGramt(CmmnUtil.sumByKey(dataObjectList0, "FFNLG_AMT")); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + String today = sdf.format(new Date()); + sndng.setSndngYmd(today); + + sndbQuery.setSggCd(sndng.getSggCd()); + sndbQuery.setTaskSeCd(sndng.getTaskSeCd()); + DataObject advntceYmdInfo = taskBean.getAdvntceYmdInfo(sndbQuery); + String sndngEndYmd = CmmnUtil.addDay(today, advntceYmdInfo.number("ADVNTCE_DAY_CNT").intValue()); + sndng.setSndngEndYmd(sndngEndYmd); + + DataObject first = dataObjectList0.get(0); + sndng.setTtlNm(first.string("TASK_SE_NM")+" "+first.string("VLTN_ARTCL")+" "+"고지서"); + + sndng.setResndYN("N"); + String insertSndngResult = sndngBean.createAdvntceSndngList(sndbQuery, sndng); + if(insertSndngResult.contains("[F]")) { + throw new RuntimeException(insertSndngResult); + } + + //발송 등록 후 출력대상조회 dataObjectList = integrationSearchMapper.selectIntegrationDataList(sprtQuery); for(int i=0; i < dataObjectList.size(); i++) { @@ -943,15 +1035,41 @@ public class Sprt01Controller extends ApplicationController { /** 고지 정보로 txt파일,이미지파일을 생성하고 압축파일로 반환한다. * @return 고지서 압축파일 */ - public ModelAndView makeNhtOutsourcing(PrintOption printOption, String[] crdnIds) { + public ModelAndView makeNhtOutsourcing(String[] crdnIds, Sndng sndng, PrintOption printOption) { ModelAndView mav = new ModelAndView("downloadView"); - - String taskSeCd = ""; - SprtQuery sprtQuery = new SprtQuery(); sprtQuery.setCrdnIds(crdnIds); - List dataObjectList = integrationSearchMapper.selectIntegrationDataList(sprtQuery); + //발송 등록 + List dataObjectList0 = integrationSearchMapper.selectIntegrationDataList(sprtQuery); + SndbQuery sndbQuery = new SndbQuery(); + sndbQuery.setCrdnIDs(crdnIds); + sndng.setSndngSeCd("03"); + sndng.setTnocs(crdnIds.length); + sndng.setGramt(CmmnUtil.sumByKey(dataObjectList0, "FFNLG_AMT")); + + SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd"); + String today = sdf.format(new Date()); + sndng.setSndngYmd(today); + + sndbQuery.setSggCd(sndng.getSggCd()); + sndbQuery.setTaskSeCd(sndng.getTaskSeCd()); + DataObject advntceYmdInfo = taskBean.getAdvntceYmdInfo(sndbQuery); + String sndngEndYmd = CmmnUtil.addDay(today, advntceYmdInfo.number("ADVNTCE_DAY_CNT").intValue()); + sndng.setSndngEndYmd(sndngEndYmd); + + DataObject first = dataObjectList0.get(0); + sndng.setTtlNm(first.string("TASK_SE_NM")+" "+first.string("VLTN_ARTCL")+" "+"고지서"); + + sndng.setResndYN("N"); + String insertSndngResult = sndngBean.createAdvntceSndngList(sndbQuery, sndng); + if(insertSndngResult.contains("[F]")) { + throw new RuntimeException(insertSndngResult); + } + + //발송 등록 후 출력대상조회 + List dataObjectList = integrationSearchMapper.selectIntegrationDataList(sprtQuery); + String taskSeCd = ""; for(int i=0; i < dataObjectList.size(); i++) { DataObject sndngDtl = integrationSearchMapper.selectLatestSndngDtlInfo(dataObjectList.get(i).string("CRDN_ID")); dataObjectList.get(i).set("RG_NO",sndngDtl.string("RG_NO")); diff --git a/src/main/java/cokr/xit/fims/task/web/CmnController.java b/src/main/java/cokr/xit/fims/task/web/CmnController.java index b6abe87a..269fda27 100644 --- a/src/main/java/cokr/xit/fims/task/web/CmnController.java +++ b/src/main/java/cokr/xit/fims/task/web/CmnController.java @@ -22,6 +22,7 @@ import cokr.xit.fims.mngt.Schdl; import cokr.xit.fims.mngt.SchdlQuery; import cokr.xit.fims.mngt.Task; import cokr.xit.fims.mngt.VltnQuery; +import cokr.xit.fims.sndb.Sndng; import cokr.xit.fims.sprt.SprtQuery; import cokr.xit.fims.stat.StatQuery; @@ -449,14 +450,14 @@ public class CmnController { @Override @RequestMapping(name="사전통지서 pdf 파일 생성", value=METHOD_URL.makeAdvntcePdf) - public ModelAndView makeAdvntcePdf(PrintOption printOption, String... crdnIds) { - return super.makeAdvntcePdf(printOption, crdnIds); + public ModelAndView makeAdvntcePdf(String[] crdnIds, Sndng sndng, PrintOption printOption) { + return super.makeAdvntcePdf(crdnIds, sndng, printOption); } @Override @RequestMapping(name="사전통지서 외주 파일 생성", value=METHOD_URL.makeAdvntceOutsourcing) - public ModelAndView makeAdvntceOutsourcing(PrintOption printOption, String... crdnIds) { - return super.makeAdvntceOutsourcing(printOption, crdnIds); + public ModelAndView makeAdvntceOutsourcing(String[] crdnIds, Sndng sndng, PrintOption printOption) { + return super.makeAdvntceOutsourcing(crdnIds, sndng, printOption); } @Override @@ -467,14 +468,14 @@ public class CmnController { @Override @RequestMapping(name="고지서 pdf 파일 생성", value=METHOD_URL.makeNhtPdf) - public ModelAndView makeNhtPdf(PrintOption printOption, String... crdnIds) { - return super.makeNhtPdf(printOption, crdnIds); + public ModelAndView makeNhtPdf(String[] crdnIds, Sndng sndng, PrintOption printOption) { + return super.makeNhtPdf(crdnIds, sndng, printOption); } @Override @RequestMapping(name="고지서 외주 파일 생성", value=METHOD_URL.makeNhtOutsourcing) - public ModelAndView makeNhtOutsourcing(PrintOption printOption, String... crdnIds) { - return super.makeNhtOutsourcing(printOption, crdnIds); + public ModelAndView makeNhtOutsourcing(String[] crdnIds, Sndng sndng, PrintOption printOption) { + return super.makeNhtOutsourcing(crdnIds, sndng, printOption); } } diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01140-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01140-info.jsp index bb22434f..0557f372 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01140-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01140-info.jsp @@ -151,8 +151,9 @@ $(document).ready(function(){ var globalVariable = formFields.get(); var submitParam = { - crdnIds : checkedCrdnIds.join(","), - taskSeCd : taskSeCd + sggCd : MY_INFO.info.sggCd, + taskSeCd : taskSeCd, + crdnIds : checkedCrdnIds.join(",") }; var inBrowser = false; diff --git a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01150-info.jsp b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01150-info.jsp index 479789c8..f54a7922 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01150-info.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/sprt/sprt01150-info.jsp @@ -148,8 +148,9 @@ $(document).ready(function(){ var globalVariable = formFields.get(); var submitParam = { - crdnIds : checkedCrdnIds.join(","), - taskSeCd : taskSeCd + sggCd : MY_INFO.info.sggCd, + taskSeCd : taskSeCd, + crdnIds : checkedCrdnIds.join(",") }; var inBrowser = false;