폐기보고서,폐기통보서 출력시 사진파일 경로 정보를 DB에서 가져오도록 수정

dev
이범준 6 months ago
parent 4ec370e99c
commit 80232555ca

@ -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<DataObject> dataobjectList = this.makeSample();
//상품 사진 갯수 체크
List<DataObject> totalProduct = fileService.getFileList(
new FileQuery().setInfoKeys(dscMngId).setInfoType("100")
);
int totalProductCnt = 0;
if(totalProduct != null && !totalProduct.isEmpty()) {
totalProductCnt = totalProduct.size();
}
//샘플 데이터 생성
List<DataObject> dataobjectList = this.makeSample(dscMngId,totalProductCnt);
for(DataObject data : dataobjectList) {
String infKey = data.string("dscMngId");
String subType = data.string("dscMngSn");
List<DataObject> 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<DataObject> dataobjectList = this.makeSample();
List<String> 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<DataObject> dsuseimgs = fileService.getFileList(
new FileQuery().setInfoType("110").setInfoKeys(dscMngId)
);
List<String> dataobjectList2 = new ArrayList<>();
for(DataObject dsuseimg : dsuseimgs) {
dataobjectList2.add(dsuseimg.string("URL"));
}
//상품사진갯수 체크
List<DataObject> totalProduct = fileService.getFileList(
new FileQuery().setInfoKeys(dscMngId).setInfoType("100").setOrderBy("SUB_TYPE")
);
int totalProductCnt = 0;
if(totalProduct != null && !totalProduct.isEmpty()) {
totalProductCnt = totalProduct.size();
}
//샘플 데이터 생성
List<DataObject> dataobjectList = this.makeSample(dscMngId,totalProductCnt);
for(DataObject data : dataobjectList) {
String infKey = data.string("dscMngId");
String subType = data.string("dscMngSn");
List<DataObject> 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<DataObject> makeSample(){
public List<DataObject> makeSample(String dscMngId, int totalProductCnt){
List<DataObject> dataobjectList = new ArrayList<DataObject>();
dataobjectList.add(new DataObject()
for(int i=0; i<totalProductCnt; i++) {
DataObject newObj = this.getRandomObj();
newObj.set("dscMngId", dscMngId);
newObj.set("dscMngSn", EgovStringUtil.lPad(""+(i+1), 3, '0'));
dataobjectList.add(newObj);
}
return dataobjectList;
}
public DataObject getRandomObj() {
DataObject[] items = {
new DataObject()
.set("bsshNm", "메디칼약국")
.set("indutyNm", "마약류취급소매업자")
.set("bsshCd", "D04343033")
@ -160,190 +226,46 @@ public class DocController extends AbstractController {
.set("mnfNo", "FJ6892")
.set("prdValidDe", "20240323")
.set("pceQy", "2")
.set("pceCoUnitNm", "정")
.set("filePath", "files/attachment/dsusedtl/2024/05/24/001.jpg")
);
dataobjectList.add(new DataObject()
.set("bsshNm", "메디약국")
.set("indutyNm", "마약류취급소매업자")
.set("bsshCd", "D14343033")
.set("dsuseDe", "20240501")
.set("dsuseSeCdNm", "보건소폐기") //ADDS03
.set("dsusePrvCdNm", "유효기간경과") //ADDS04
.set("dsuseLoc", "수지구보건소 검사실")
.set("dsuseMthCdNm", "가수분해") //ADDS05
.set("nrcdSeNm", "항정")
.set("prductNm", "아쿠아폴주20밀리리터(프로포폴)(20ml)")
.set("prductCd", "08806489012648")
.set("minDistbQy", "31")
.set("stdPackngStleNm", "정")
.set("mnfNo", "FJ6892")
.set("prdValidDe", "20240323")
.set("pceQy", "3")
.set("pceCoUnitNm", "정")
.set("filePath", "files/attachment/dsusedtl/2024/05/24/002.jpg")
);
dataobjectList.add(new DataObject()
.set("bsshNm", "메디약국")
.set("pceCoUnitNm", "정"),
new DataObject()
.set("bsshNm", "메디칼약국")
.set("indutyNm", "마약류취급소매업자")
.set("bsshCd", "D14343033")
.set("bsshCd", "D04343033")
.set("dsuseDe", "20240501")
.set("dsuseSeCdNm", "보건소폐기") //ADDS03
.set("dsuseSeCdNm", "공무원임회") //ADDS03
.set("dsusePrvCdNm", "유효기간경과") //ADDS04
.set("dsuseLoc", "수지구보건소 검사실")
.set("dsuseMthCdNm", "가수분해") //ADDS05
.set("nrcdSeNm", "항정")
.set("prductNm", "자낙스정0.4mg")
.set("nrcdSeNm", "마약")
.set("prductNm", "아쿠아폴주")
.set("prductCd", "08806489012648")
.set("minDistbQy", "31")
.set("minDistbQy", "30")
.set("stdPackngStleNm", "정")
.set("mnfNo", "FJ6892")
.set("prdValidDe", "20240323")
.set("pceQy", "3")
.set("pceCoUnitNm", "정")
.set("filePath", "files/attachment/dsusedtl/2024/05/24/003.jpg")
);
dataobjectList.add(new DataObject()
.set("bsshNm", "메디약국")
.set("pceQy", "2")
.set("pceCoUnitNm", "정"),
new DataObject()
.set("bsshNm", "메디칼약국")
.set("indutyNm", "마약류취급소매업자")
.set("bsshCd", "D14343033")
.set("bsshCd", "D04343033")
.set("dsuseDe", "20240501")
.set("dsuseSeCdNm", "보건소폐기") //ADDS03
.set("dsuseSeCdNm", "공무원임회") //ADDS03
.set("dsusePrvCdNm", "유효기간경과") //ADDS04
.set("dsuseLoc", "수지구보건소 검사실")
.set("dsuseMthCdNm", "가수분해") //ADDS05
.set("nrcdSeNm", "항정")
.set("nrcdSeNm", "마약")
.set("prductNm", "베리콜시럽")
.set("prductCd", "08806489012648")
.set("minDistbQy", "31")
.set("stdPackngStleNm", "정")
.set("mnfNo", "FJ6892")
.set("prdValidDe", "20240323")
.set("pceQy", "3")
.set("pceCoUnitNm", "정")
.set("filePath", "files/attachment/dsusedtl/2024/05/24/004.jpg")
);
dataobjectList.add(new DataObject()
.set("bsshNm", "메디약국")
.set("indutyNm", "마약류취급소매업자")
.set("bsshCd", "D14343033")
.set("dsuseDe", "20240501")
.set("dsuseSeCdNm", "보건소폐기") //ADDS03
.set("dsusePrvCdNm", "유효기간경과") //ADDS04
.set("dsuseLoc", "수지구보건소 검사실")
.set("dsuseMthCdNm", "가수분해") //ADDS05
.set("nrcdSeNm", "항정")
.set("prductNm", "자낙스정0.3mg")
.set("prductCd", "08806489012648")
.set("minDistbQy", "31")
.set("stdPackngStleNm", "정")
.set("mnfNo", "FJ6892")
.set("prdValidDe", "20240323")
.set("pceQy", "3")
.set("pceCoUnitNm", "정")
.set("filePath", "files/attachment/dsusedtl/2024/05/24/005.jpg")
);
dataobjectList.add(new DataObject()
.set("bsshNm", "메디약국")
.set("indutyNm", "마약류취급소매업자")
.set("bsshCd", "D14343033")
.set("dsuseDe", "20240501")
.set("dsuseSeCdNm", "보건소폐기") //ADDS03
.set("dsusePrvCdNm", "유효기간경과") //ADDS04
.set("dsuseLoc", "수지구보건소 검사실")
.set("dsuseMthCdNm", "가수분해") //ADDS05
.set("nrcdSeNm", "항정")
.set("prductNm", "자낙스정0.2mg")
.set("prductCd", "08806489012648")
.set("minDistbQy", "31")
.set("stdPackngStleNm", "정")
.set("mnfNo", "FJ6892")
.set("prdValidDe", "20240323")
.set("pceQy", "3")
.set("pceCoUnitNm", "정")
.set("filePath", "files/attachment/dsusedtl/2024/05/24/006.jpg")
);
dataobjectList.add(new DataObject()
.set("bsshNm", "메디약국")
.set("indutyNm", "마약류취급소매업자")
.set("bsshCd", "D14343033")
.set("dsuseDe", "20240501")
.set("dsuseSeCdNm", "보건소폐기") //ADDS03
.set("dsusePrvCdNm", "유효기간경과") //ADDS04
.set("dsuseLoc", "수지구보건소 검사실")
.set("dsuseMthCdNm", "가수분해") //ADDS05
.set("nrcdSeNm", "항정")
.set("prductNm", "자낙스정0.1mg")
.set("prductCd", "08806489012648")
.set("minDistbQy", "31")
.set("stdPackngStleNm", "정")
.set("mnfNo", "FJ6892")
.set("prdValidDe", "20240323")
.set("pceQy", "3")
.set("pceCoUnitNm", "정")
.set("filePath", "files/attachment/dsusedtl/2024/05/24/007.jpg")
);
dataobjectList.add(new DataObject()
.set("bsshNm", "메디약국")
.set("indutyNm", "마약류취급소매업자")
.set("bsshCd", "D14343033")
.set("dsuseDe", "20240501")
.set("dsuseSeCdNm", "보건소폐기") //ADDS03
.set("dsusePrvCdNm", "유효기간경과") //ADDS04
.set("dsuseLoc", "수지구보건소 검사실")
.set("dsuseMthCdNm", "가수분해") //ADDS05
.set("nrcdSeNm", "항정")
.set("prductNm", "자낙스정0.6mg")
.set("prductCd", "08806489012648")
.set("minDistbQy", "31")
.set("stdPackngStleNm", "정")
.set("mnfNo", "FJ6892")
.set("prdValidDe", "20240323")
.set("pceQy", "3")
.set("pceCoUnitNm", "정")
.set("filePath", "files/attachment/dsusedtl/2024/05/24/008.jpg")
);
dataobjectList.add(new DataObject()
.set("bsshNm", "메디약국")
.set("indutyNm", "마약류취급소매업자")
.set("bsshCd", "D14343033")
.set("dsuseDe", "20240501")
.set("dsuseSeCdNm", "보건소폐기") //ADDS03
.set("dsusePrvCdNm", "유효기간경과") //ADDS04
.set("dsuseLoc", "수지구보건소 검사실")
.set("dsuseMthCdNm", "가수분해") //ADDS05
.set("nrcdSeNm", "항정")
.set("prductNm", "자낙스정0.7mg")
.set("prductCd", "08806489012648")
.set("minDistbQy", "31")
.set("stdPackngStleNm", "정")
.set("mnfNo", "FJ6892")
.set("prdValidDe", "20240323")
.set("pceQy", "3")
.set("pceCoUnitNm", "정")
.set("filePath", "files/attachment/dsusedtl/2024/05/24/009.jpg")
);
dataobjectList.add(new DataObject()
.set("bsshNm", "메디약국")
.set("indutyNm", "마약류취급소매업자")
.set("bsshCd", "D14343033")
.set("dsuseDe", "20240501")
.set("dsuseSeCdNm", "보건소폐기") //ADDS03
.set("dsusePrvCdNm", "유효기간경과") //ADDS04
.set("dsuseLoc", "수지구보건소 검사실")
.set("dsuseMthCdNm", "가수분해") //ADDS05
.set("nrcdSeNm", "항정")
.set("prductNm", "자낙스정0.8mg")
.set("prductCd", "08806489012648")
.set("minDistbQy", "31")
.set("minDistbQy", "30")
.set("stdPackngStleNm", "정")
.set("mnfNo", "FJ6892")
.set("prdValidDe", "20240323")
.set("pceQy", "3")
.set("pceQy", "2")
.set("pceCoUnitNm", "정")
.set("filePath", "files/attachment/dsusedtl/2024/05/24/010.jpg")
);
return dataobjectList;
};
Random rand = new Random();
return items[rand.nextInt(3)];
}
}

@ -43,6 +43,9 @@ SELECT A.*, FILE_PATH URL
<where>
<if test="infoType != null"> AND A.INF_TYPE = #{infoType}</if>
<if test="infoKeys != null"> AND INF_KEY IN (<foreach collection="infoKeys" item="infoKey" separator=",">#{infoKey}</foreach>)</if>
<if test="by != null and term != null">
AND ${by} = #{term}
</if>
AND USE_YN = 'Y'
</where>
<include refid="utility.orderBy" />

@ -12,6 +12,16 @@
/>
</a>
</div>
<div>
<form action="/adds/nims/v1/dsuseMgtReceiptForm.do">
<button type="submit">go to dsuseMgtReceipt-main.jsp</button>
</form>
<form action="/adds/nims/v1/dsuseMgtRsltForm.do">
<button type="submit">go to dsuseMgtRslt-main.jsp</button>
</form>
</div>
<div class="navbar-nav navbar-dropdown dropdown-user dropdown">
<div class="avatar d-flex flex-row" data-bs-toggle="dropdown">
<img src="<c:url value='/resources/img/avatars/99.svg' />" class="w-px-40 h-auto rounded-circle" style="border: 2px solid white;">

Loading…
Cancel
Save