diff --git a/src/main/java/cokr/xit/adds/DocController.java b/src/main/java/cokr/xit/adds/DocController.java index b8bba60..acb65e3 100644 --- a/src/main/java/cokr/xit/adds/DocController.java +++ b/src/main/java/cokr/xit/adds/DocController.java @@ -5,9 +5,11 @@ import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Random; import javax.annotation.Resource; +import org.egovframe.rte.fdl.string.EgovStringUtil; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; @@ -18,6 +20,7 @@ import cokr.xit.applib.Print; import cokr.xit.applib.PrintOption; import cokr.xit.base.file.FileInfo; import cokr.xit.base.file.FileInfo.Relation; +import cokr.xit.base.file.service.FileQuery; import cokr.xit.base.file.service.FileService; import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.web.AbstractController; @@ -55,8 +58,32 @@ public class DocController extends AbstractController { globalVariable.put("gigwanjang", gigwanjang); printOption.setGlobalVariable(globalVariable); - //샘플 데이터 - List dataobjectList = this.makeSample(); + //상품 사진 갯수 체크 + List totalProduct = fileService.getFileList( + new FileQuery().setInfoKeys(dscMngId).setInfoType("100") + ); + int totalProductCnt = 0; + if(totalProduct != null && !totalProduct.isEmpty()) { + totalProductCnt = totalProduct.size(); + } + + //샘플 데이터 생성 + List dataobjectList = this.makeSample(dscMngId,totalProductCnt); + + for(DataObject data : dataobjectList) { + String infKey = data.string("dscMngId"); + String subType = data.string("dscMngSn"); + + List fileinfo = fileService.getFileList( + new FileQuery().setInfoKeys(infKey).setInfoType("100").setBy("SUB_TYPE").setTerm(subType) + ); + if(fileinfo == null || fileinfo.isEmpty()) { + data.put("filePath", ""); + } else { + data.put("filePath", fileinfo.get(0).string("URL")); + } + + } DisposeResultNotice disposeResultNotice = new DisposeResultNotice(print, printOption, dataobjectList); String resultFilePath = disposeResultNotice.makeFile().andGetPath(); @@ -113,17 +140,41 @@ public class DocController extends AbstractController { globalVariable.put("gigwanjang", gigwanjang); printOption.setGlobalVariable(globalVariable); - //샘플 데이터 - List dataobjectList = this.makeSample(); - List dataobjectList2 = List.of( - "files/attachment/dsuse/2024/05/25/001.jpg", - "files/attachment/dsuse/2024/05/25/002.jpg", - "files/attachment/dsuse/2024/05/25/003.jpg", - "files/attachment/dsuse/2024/05/25/004.jpg", - "files/attachment/dsuse/2024/05/25/005.jpg", - "files/attachment/dsuse/2024/05/25/006.jpg", - "files/attachment/dsuse/2024/05/25/007.jpg" + //폐기증거사진 + List dsuseimgs = fileService.getFileList( + new FileQuery().setInfoType("110").setInfoKeys(dscMngId) ); + List dataobjectList2 = new ArrayList<>(); + for(DataObject dsuseimg : dsuseimgs) { + dataobjectList2.add(dsuseimg.string("URL")); + } + + //상품사진갯수 체크 + List totalProduct = fileService.getFileList( + new FileQuery().setInfoKeys(dscMngId).setInfoType("100").setOrderBy("SUB_TYPE") + ); + int totalProductCnt = 0; + if(totalProduct != null && !totalProduct.isEmpty()) { + totalProductCnt = totalProduct.size(); + } + + //샘플 데이터 생성 + List dataobjectList = this.makeSample(dscMngId,totalProductCnt); + + for(DataObject data : dataobjectList) { + String infKey = data.string("dscMngId"); + String subType = data.string("dscMngSn"); + + List fileinfo = fileService.getFileList( + new FileQuery().setInfoKeys(infKey).setInfoType("100").setBy("SUB_TYPE").setTerm(subType) + ); + if(fileinfo == null || fileinfo.isEmpty()) { + data.put("filePath", ""); + } else { + data.put("filePath", fileinfo.get(0).string("URL")); + } + + } DisposeResultReport disposeResultReport = new DisposeResultReport(print, printOption, dataobjectList, dataobjectList2); String resultFilePath = disposeResultReport.makeFile().andGetPath(); @@ -141,9 +192,24 @@ public class DocController extends AbstractController { } - public List makeSample(){ + public List makeSample(String dscMngId, int totalProductCnt){ List dataobjectList = new ArrayList(); - dataobjectList.add(new DataObject() + + for(int i=0; i AND A.INF_TYPE = #{infoType} AND INF_KEY IN (#{infoKey}) + +AND ${by} = #{term} + AND USE_YN = 'Y' diff --git a/src/main/webapp/WEB-INF/jsp/include/top.jsp b/src/main/webapp/WEB-INF/jsp/include/top.jsp index 30b8f91..62f28eb 100644 --- a/src/main/webapp/WEB-INF/jsp/include/top.jsp +++ b/src/main/webapp/WEB-INF/jsp/include/top.jsp @@ -12,6 +12,16 @@ /> + +
+
+ +
+
+ +
+
+