From 15de49ca58b72929f83676c799e42c18a4ae4ea1 Mon Sep 17 00:00:00 2001 From: leebeomjun Date: Wed, 2 Aug 2023 10:58:08 +0900 Subject: [PATCH] =?UTF-8?q?=EB=8B=A8=EC=86=8D=EB=8F=99=EC=98=81=EC=83=81?= =?UTF-8?q?=ED=8C=8C=EC=9D=BC=20inf=5Ftype,=20inf=5Fkey=20=EB=B3=80?= =?UTF-8?q?=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/cokr/xit/fims/crdn/CrdnQuery.java | 6 +- .../crdn/service/bean/Crdn01ServiceBean.java | 44 +++++++++--- src/main/java/cokr/xit/fims/sprt/Sprt.java | 4 ++ .../xit/fims/sprt/service/Sprt03Service.java | 18 +++++ .../sprt/service/bean/Sprt03ServiceBean.java | 67 +++++++++++++++++++ .../xit/fims/sprt/web/Sprt03Controller.java | 25 ++----- .../sql/mapper/fims/crdn/crdn01-mapper.xml | 2 + 7 files changed, 133 insertions(+), 33 deletions(-) create mode 100644 src/main/java/cokr/xit/fims/sprt/service/Sprt03Service.java create mode 100644 src/main/java/cokr/xit/fims/sprt/service/bean/Sprt03ServiceBean.java diff --git a/src/main/java/cokr/xit/fims/crdn/CrdnQuery.java b/src/main/java/cokr/xit/fims/crdn/CrdnQuery.java index a30198f3..4276d2f2 100644 --- a/src/main/java/cokr/xit/fims/crdn/CrdnQuery.java +++ b/src/main/java/cokr/xit/fims/crdn/CrdnQuery.java @@ -16,19 +16,17 @@ public class CrdnQuery extends CmmnQuery { private static final long serialVersionUID = 1L; - private String view; private String grid; + private String inspectionDataType; private String currentUserId; private String currentInstitute; - private String inspectionDataType; + private String crdnId; private String[] crdnIDs; - private String vhrno; - private String cvlcptPrcsPicNm; private String schCvlcptRcptYmdFrom; private String schCvlcptRcptYmdTo; diff --git a/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn01ServiceBean.java b/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn01ServiceBean.java index 5b736b2d..afb4b984 100644 --- a/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn01ServiceBean.java +++ b/src/main/java/cokr/xit/fims/crdn/service/bean/Crdn01ServiceBean.java @@ -5,9 +5,11 @@ import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; +import java.util.stream.Collectors; import javax.annotation.Resource; +import org.assertj.core.util.Arrays; import org.springframework.stereotype.Service; import org.springframework.util.ResourceUtils; import org.springframework.web.servlet.ModelAndView; @@ -23,6 +25,7 @@ import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.dao.Crdn01Mapper; import cokr.xit.fims.crdn.service.CrdnService; +import cokr.xit.fims.sprt.Sprt; import cokr.xit.foundation.component.AbstractServiceBean; import cokr.xit.foundation.data.DataObject; import kr.dogfoot.hwplib.object.HWPFile; @@ -146,6 +149,10 @@ public class Crdn01ServiceBean extends AbstractServiceBean implements CrdnServic List fileInfoList = fileService.getFileList(fileQuery); + fileInfoList = fileInfoList.stream() + .filter(fileInfo -> fileInfo.string("MIME_TYPE").startsWith("image")) + .collect(Collectors.toList()); + if(fileInfoList != null && fileInfoList.size() > 0) { int photoCnt = fileInfoList.size(); int PHOTO_COUNT_PER_PAGE = 4; @@ -185,24 +192,41 @@ public class Crdn01ServiceBean extends AbstractServiceBean implements CrdnServic } public DataObject getCivilComplaintReceiptInitialDataInfo(CrdnQuery req) { + + //민원조회 DataObject dataObject = crdn01Mapper.selectCivilComplaintReceiptInitialDataInfo(req); + //첨부파일 조회 FileQuery fileQuery = new FileQuery(); - fileQuery.setInfoKeys(dataObject.string("CRDN_ID")); - fileQuery.setInfoType("190"); + fileQuery.setInfoType(Crdn.INF_TYPE); List fileList = fileService.getFileList(fileQuery); if(fileList != null && !fileList.isEmpty()) { - dataObject.set("videoExist", "Y"); - } else { - dataObject.set("videoExist", "N"); + dataObject.set("fileList", fileList); } + //동영상 존재 여부 확인 + dataObject.set("videoExist", "N"); + String linkTblNm = dataObject.string("LINK_TBL_NM"); + if(!linkTblNm.equals("")) { + + if(linkTblNm.equals("TB_ESB_INTERFACE")) { + fileQuery.setInfoType("010"); + } else if(linkTblNm.equals("TB_SAEOL")) { + fileQuery.setInfoType("020"); + } else { + throw new RuntimeException("파일 조회 중 오류가 발생하였습니다."); + } - fileQuery.setInfoType(Crdn.INF_TYPE); - fileList = fileService.getFileList(fileQuery); - - if(fileList != null && !fileList.isEmpty()) { - dataObject.set("fileList", fileList); + fileQuery.setInfoKeys(dataObject.string("LINK_ID")); + List linkFileList = fileService.getFileList(fileQuery); + if(linkFileList != null && !linkFileList.isEmpty()) { + for(int i=0; i < linkFileList.size(); i++) { + String mimeType = linkFileList.get(i).string("MIME_TYPE"); + if(Arrays.asList(Sprt.VIDEO_MIME_TYPE).contains(mimeType)) { + dataObject.set("videoExist", "Y"); + } + } + } } return dataObject; diff --git a/src/main/java/cokr/xit/fims/sprt/Sprt.java b/src/main/java/cokr/xit/fims/sprt/Sprt.java index 851c9315..289a4665 100644 --- a/src/main/java/cokr/xit/fims/sprt/Sprt.java +++ b/src/main/java/cokr/xit/fims/sprt/Sprt.java @@ -11,4 +11,8 @@ import lombok.Setter; @Setter public class Sprt extends AbstractEntity { + public static String[] VIDEO_MIME_TYPE = { + "video/mp4", "video/webm", "video/ogg" + }; + } diff --git a/src/main/java/cokr/xit/fims/sprt/service/Sprt03Service.java b/src/main/java/cokr/xit/fims/sprt/service/Sprt03Service.java new file mode 100644 index 00000000..d870f173 --- /dev/null +++ b/src/main/java/cokr/xit/fims/sprt/service/Sprt03Service.java @@ -0,0 +1,18 @@ +package cokr.xit.fims.sprt.service; + +import cokr.xit.foundation.data.DataObject; + +/**미디어 업무지원 서비스를 제공한다. + *
  • {@link #getVideoInfo(SprtQuery) 동영상 정보 조회}
  • + *
+ * @author leebj + */ +public interface Sprt03Service { + + /**지정하는 단속아이디의 동영상 정보를 반환한다. + * @param crdnId 단속 아이디 + * @return 동영상 정보 + */ + DataObject getVideoInfo(String crdnId); + +} diff --git a/src/main/java/cokr/xit/fims/sprt/service/bean/Sprt03ServiceBean.java b/src/main/java/cokr/xit/fims/sprt/service/bean/Sprt03ServiceBean.java new file mode 100644 index 00000000..1fb08c41 --- /dev/null +++ b/src/main/java/cokr/xit/fims/sprt/service/bean/Sprt03ServiceBean.java @@ -0,0 +1,67 @@ +package cokr.xit.fims.sprt.service.bean; + +import java.util.List; + +import javax.annotation.Resource; + +import org.assertj.core.util.Arrays; +import org.springframework.stereotype.Service; + +import cokr.xit.base.file.service.FileQuery; +import cokr.xit.base.file.service.FileService; +import cokr.xit.fims.crdn.CrdnQuery; +import cokr.xit.fims.crdn.dao.Crdn01Mapper; +import cokr.xit.fims.sprt.Sprt; +import cokr.xit.fims.sprt.service.Sprt03Service; +import cokr.xit.foundation.component.AbstractServiceBean; +import cokr.xit.foundation.data.DataObject; + +/**미디어 업무지원 서비스 인터페이스의 구현체 + * @author leebj + */ +@Service("sprt03Service") +public class Sprt03ServiceBean extends AbstractServiceBean implements Sprt03Service { + + @Resource(name = "crdn01Mapper") + private Crdn01Mapper crdn01Mapper; + + @Resource(name="fileService") + FileService fileService; + + @Override + public DataObject getVideoInfo(String crdnId) { + DataObject fileInfo = new DataObject(); + + CrdnQuery crdnQuery = new CrdnQuery(); + crdnQuery.setCrdnId(crdnId); + DataObject cvlcptInfo = crdn01Mapper.selectCivilComplaintReceiptInitialDataInfo(crdnQuery); + String linkTblNm = cvlcptInfo.string("LINK_TBL_NM"); + if(!linkTblNm.equals("")) { + FileQuery fileQuery = new FileQuery(); + + if(linkTblNm.equals("TB_ESB_INTERFACE")) { + fileQuery.setInfoType("010"); + } else if(linkTblNm.equals("TB_SAEOL")) { + fileQuery.setInfoType("020"); + } else { + throw new RuntimeException("파일 조회 중 오류가 발생하였습니다."); + } + fileQuery.setInfoKeys(cvlcptInfo.string("LINK_ID")); + + List fileList = fileService.getFileList(fileQuery); + if(fileList != null && !fileList.isEmpty()) { + for(int i=0; i < fileList.size() ;i++) { + DataObject file = fileList.get(i); + String mimeType = file.string("MIME_TYPE"); + if(Arrays.asList(Sprt.VIDEO_MIME_TYPE).contains(mimeType)){ + fileInfo = file; + break; + } + } + } + } + + return fileInfo; + } + +} diff --git a/src/main/java/cokr/xit/fims/sprt/web/Sprt03Controller.java b/src/main/java/cokr/xit/fims/sprt/web/Sprt03Controller.java index dcf8e851..025cfc15 100644 --- a/src/main/java/cokr/xit/fims/sprt/web/Sprt03Controller.java +++ b/src/main/java/cokr/xit/fims/sprt/web/Sprt03Controller.java @@ -4,12 +4,12 @@ import java.util.List; import javax.annotation.Resource; -import org.assertj.core.util.Arrays; import org.springframework.web.servlet.ModelAndView; import cokr.xit.base.file.service.FileQuery; import cokr.xit.base.file.service.FileService; import cokr.xit.base.web.ApplicationController; +import cokr.xit.fims.sprt.service.Sprt03Service; import cokr.xit.foundation.data.DataObject; public class Sprt03Controller extends ApplicationController { @@ -17,10 +17,8 @@ public class Sprt03Controller extends ApplicationController { @Resource(name="fileService") FileService fileService; - public String VIDEO_INF_TYPE = "190"; - public String[] VIDEO_MIME_TYPE = { - "video/mp4", "video/webm", "video/ogg" - }; + @Resource(name="sprt03Service") + Sprt03Service sprt03Service; /** 동영상 재생 메인화면을 연다. * @return fims/sprt/sprt03010-main @@ -33,20 +31,9 @@ public class Sprt03Controller extends ApplicationController { if(crdnId != null && !crdnId.equals("")) { mav.addObject("crdnId", crdnId); - - FileQuery fileQuery = new FileQuery(); - fileQuery.setInfoKeys(crdnId); - fileQuery.setInfoType(VIDEO_INF_TYPE); - List fileList = fileService.getFileList(fileQuery); - if(fileList != null && !fileList.isEmpty()) { - for(int i=0; i < fileList.size() ;i++) { - DataObject file = fileList.get(i); - String mimeType = file.string("MIME_TYPE"); - if(Arrays.asList(VIDEO_MIME_TYPE).contains(mimeType)){ - mav.addObject("fileInfo", toJson(file)); - break; - } - } + DataObject file = sprt03Service.getVideoInfo(crdnId); + if(!file.isEmpty()) { + mav.addObject("fileInfo", toJson(file)); } } diff --git a/src/main/resources/sql/mapper/fims/crdn/crdn01-mapper.xml b/src/main/resources/sql/mapper/fims/crdn/crdn01-mapper.xml index 8926ddd2..b0d63895 100644 --- a/src/main/resources/sql/mapper/fims/crdn/crdn01-mapper.xml +++ b/src/main/resources/sql/mapper/fims/crdn/crdn01-mapper.xml @@ -350,6 +350,8 @@ SELECT C.CRDN_ID , C.VHCL_COLOR , C.USE_FUEL_CD , C.VIN + , C.LINK_TBL_NM + , C.LINK_ID FROM TB_CRDN C INNER JOIN TB_CRDN_CVLCPT CC ON (C.CRDN_ID = CC.CRDN_ID AND CC.DEL_YN = 'N') LEFT OUTER JOIN TB_PAYER P ON (C.RTPYR_ID = P.RTPYR_ID)