diff --git a/samplefiles/black.png b/samplefiles/black.png new file mode 100644 index 00000000..610ca73c Binary files /dev/null and b/samplefiles/black.png differ diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/PstnAndSize.java b/src/main/java/cokr/xit/fims/cmmn/pdf/PstnAndSize.java index 0f231f55..34858ee5 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/PstnAndSize.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/PstnAndSize.java @@ -58,4 +58,18 @@ public class PstnAndSize { this.height = this.height * 2.0f; return this; } + + public PstnAndSize transXY(float transX, float transY) { + this.left = this.left * transX; + this.top = this.top * transY; + this.width = this.width * transX; + this.height = this.height * transY; + return this; + } + + public PstnAndSize addPstn(Pstn pstn) { + this.left = this.left + pstn.getLeft(); + this.top = this.top + pstn.getTop(); + return this; + } } diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/format/Advntce.java b/src/main/java/cokr/xit/fims/cmmn/pdf/format/Advntce.java index 631107fe..a1e65a41 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/format/Advntce.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/format/Advntce.java @@ -107,6 +107,9 @@ public class Advntce extends PDFFormat { case "rprsCrdnPhoto" -> { //대표사진 result = dataObject.string("CRDN_PHOTO1"); } + case "rprsCrdnPhotoKey" -> { //대표사진 + result = dataObject.string("CRDN_PHOTO1"+"KEY"); + } case "rtpyrNm" -> { result = dataObject.string("RTPYR_NM"); } @@ -294,6 +297,13 @@ public class Advntce extends PDFFormat { i++; } } + case "crdnPhotoKey" -> { + int i = 1; + while(!dataObject.string("CRDN_PHOTO"+i+"KEY").equals("")) { + result.add(dataObject.string("CRDN_PHOTO"+i+"KEY")); + i++; + } + } } return result; diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/format/Nht.java b/src/main/java/cokr/xit/fims/cmmn/pdf/format/Nht.java index b9eb2a77..e8f9a14d 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/format/Nht.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/format/Nht.java @@ -114,6 +114,9 @@ public class Nht extends PDFFormat { case "rprsCrdnPhoto" -> { //대표사진 result = dataObject.string("CRDN_PHOTO1"); } + case "rprsCrdnPhotoKey" -> { //대표사진 + result = dataObject.string("CRDN_PHOTO1"+"KEY"); + } case "rtpyrNm" -> { result = dataObject.string("RTPYR_NM"); } diff --git a/src/main/java/cokr/xit/fims/cmmn/service/bean/MosaicBean.java b/src/main/java/cokr/xit/fims/cmmn/service/bean/MosaicBean.java index 20e17a4a..a7f3f821 100644 --- a/src/main/java/cokr/xit/fims/cmmn/service/bean/MosaicBean.java +++ b/src/main/java/cokr/xit/fims/cmmn/service/bean/MosaicBean.java @@ -1,12 +1,17 @@ package cokr.xit.fims.cmmn.service.bean; +import java.awt.image.BufferedImage; +import java.io.File; +import java.util.ArrayList; import java.util.List; import javax.annotation.Resource; +import javax.imageio.ImageIO; import org.springframework.stereotype.Component; import cokr.xit.fims.cmmn.dao.MosaicMapper; +import cokr.xit.fims.cmmn.pdf.PstnAndSize; import cokr.xit.foundation.AbstractComponent; import cokr.xit.foundation.data.DataObject; @@ -23,4 +28,40 @@ public class MosaicBean extends AbstractComponent { public List getMosaicList(String fileId){ return mosaicMapper.selectMosaicList(fileId); } + + public List getTransformedMosaic(String imageKey, String imagePath, PstnAndSize pstnAndSize_in_print) { + List result = new ArrayList<>(); + + try { + + BufferedImage image = ImageIO.read(new File(imagePath)); + float originalWidth = image.getWidth(null); + float originalHeight = image.getHeight(null); + float transX = pstnAndSize_in_print.getWidth() / originalWidth; + float transY = pstnAndSize_in_print.getHeight() / originalHeight; + + List mosaicInfos = this.getMosaicList(imageKey); + + if(mosaicInfos != null) { + for(int k=0; k < mosaicInfos.size(); k++) { + DataObject mosaicInfo = mosaicInfos.get(k); + float x = mosaicInfo.number("X_AXS").floatValue(); + float y = mosaicInfo.number("Y_AXS").floatValue(); + float w = mosaicInfo.number("MOSC_LT").floatValue(); + float h = mosaicInfo.number("MOSC_HG").floatValue(); + + PstnAndSize mosaic = new PstnAndSize(x, y, w, h); + mosaic.transXY(transX, transY); + mosaic.addPstn(pstnAndSize_in_print.getPstn()); + + result.add(mosaic); + } + } + + } catch (Exception e) { + throw new RuntimeException("이미지 모자이크 처리 오류"); + } + + return result; + } } diff --git a/src/main/java/cokr/xit/fims/sprt/service/bean/Sprt01ServiceBean.java b/src/main/java/cokr/xit/fims/sprt/service/bean/Sprt01ServiceBean.java index c9137869..32d1816d 100644 --- a/src/main/java/cokr/xit/fims/sprt/service/bean/Sprt01ServiceBean.java +++ b/src/main/java/cokr/xit/fims/sprt/service/bean/Sprt01ServiceBean.java @@ -338,6 +338,7 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv for(int j=0; j transformedMosaicInfos = mosaicBean.getTransformedMosaic( + imageKey, imagePath, new PstnAndSize(pstn[0],pstn[1], size[0], size[1]) + ); + + for(int k=0; k < transformedMosaicInfos.size(); k++) { + PstnAndSize mosaicInfo = transformedMosaicInfos.get(k); + + pdfPrintUtil.insertImage(doc, contentStream, blackImage, + mosaicInfo.getPstn().to2Float(), mosaicInfo.getSize().to2Float()); + } + + } } else if(prototypeStng.getComponentType().equals("images")) { List imagePaths = pdfFormat.getMappingValues(otptArtclNm,defaultValue,forPost,dataObject,printOption,pdfPrintUtil); + List imageKeys = new ArrayList(); + if(otptArtclNm.equals("crdnPhoto")) { + imageKeys = pdfFormat.getMappingValues(otptArtclNm+"Key",defaultValue,forPost,dataObject,printOption,pdfPrintUtil); + if(rprsCrdnPhotoYn && imagePaths.size() > 0) { + imageKeys.remove(0); + } + } if(otptArtclNm.equals("crdnPhoto")) { if(rprsCrdnPhotoYn && imagePaths.size() > 0) { @@ -492,6 +518,23 @@ public class Sprt01ServiceBean extends AbstractServiceBean implements Sprt01Serv pdfPrintUtil.insertImage(doc, contentStream, imagePaths.get(i), devideInfo.getPstn().to2Float(), devideInfo.getSize().to2Float()); + + if(otptArtclNm.equals("crdnPhoto") && !imageKeys.isEmpty()) { + String blackImage = "samplefiles/black.png"; + + List transformedMosaicInfos = mosaicBean.getTransformedMosaic( + imageKeys.get(i), imagePaths.get(i), devideInfo + ); + + for(int k=0; k < transformedMosaicInfos.size(); k++) { + PstnAndSize mosaicInfo = transformedMosaicInfos.get(k); + + pdfPrintUtil.insertImage(doc, contentStream, blackImage, + mosaicInfo.getPstn().to2Float(), mosaicInfo.getSize().to2Float()); + } + + } + } } diff --git a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn02010-main.jsp b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn02010-main.jsp index ee27de49..10418aa5 100644 --- a/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn02010-main.jsp +++ b/src/main/webapp/WEB-INF/jsp/fims/crdn/crdn02010-main.jsp @@ -247,7 +247,7 @@ 선택자료
+ style="width: 100%;height: 180px;overflow-x: scroll;background-color:#D9DEE3;display:flex;">
@@ -255,7 +255,7 @@ 비교자료(선택자료의 다음 자료가 보여집니다.)
+ style="width: 100%;height: 180px;overflow-x: scroll;background-color:#D9DEE3;display:flex;">
diff --git a/src/main/webapp/resources/js/fims/crdn/inspection.js b/src/main/webapp/resources/js/fims/crdn/inspection.js index 97d6a32d..b122149d 100644 --- a/src/main/webapp/resources/js/fims/crdn/inspection.js +++ b/src/main/webapp/resources/js/fims/crdn/inspection.js @@ -8,10 +8,12 @@ export class InspectionControl { export function fnMakeImgTag(url, title, crdnPhotoId, mosaic) { - return `
+ return `
+
${title} +
`; } \ No newline at end of file