Leeyh1121 6 months ago
commit d53f16ea96

@ -32,15 +32,13 @@ public class DocController extends AbstractController {
@Resource(name="fileService") @Resource(name="fileService")
FileService fileService; FileService fileService;
private String sggNm = "용인시";
@RequestMapping(value="/makeDisposeResultReportHwp.do") @RequestMapping(value="/makeDisposeResultReportHwp.do")
public ModelAndView makeDisposeResultReportHwp(String dscMngId) { public ModelAndView makeDisposeResultReportHwp(String dscdmngId) {
ModelAndView mav = new ModelAndView(); ModelAndView mav = new ModelAndView();
mav.setViewName("jsonView"); mav.setViewName("jsonView");
if(dscMngId == null || dscMngId.equals("")) { if(dscdmngId == null || dscdmngId.equals("")) {
return mav; return mav;
} }
@ -53,14 +51,11 @@ public class DocController extends AbstractController {
//개인정보표시여부,기관장 등 //개인정보표시여부,기관장 등
PrintOption printOption = new PrintOption(); PrintOption printOption = new PrintOption();
Map<String,String> globalVariable = new HashMap<String,String>(); Map<String,String> globalVariable = new HashMap<String,String>();
String gigwanjang = sggNm+"장";
gigwanjang = spreadBySpace(gigwanjang,4);
globalVariable.put("gigwanjang", gigwanjang);
printOption.setGlobalVariable(globalVariable); printOption.setGlobalVariable(globalVariable);
//상품 사진 갯수 체크 //상품 사진 갯수 체크
List<DataObject> totalProduct = fileService.getFileList( List<DataObject> totalProduct = fileService.getFileList(
new FileQuery().setInfoKeys(dscMngId).setInfoType("100") new FileQuery().setInfoKeys(dscdmngId).setInfoType("100")
); );
int totalProductCnt = 0; int totalProductCnt = 0;
if(totalProduct != null && !totalProduct.isEmpty()) { if(totalProduct != null && !totalProduct.isEmpty()) {
@ -68,11 +63,11 @@ public class DocController extends AbstractController {
} }
//샘플 데이터 생성 //샘플 데이터 생성
List<DataObject> dataobjectList = this.makeSample(dscMngId,totalProductCnt); List<DataObject> dataobjectList = this.makeSample(dscdmngId,totalProductCnt);
for(DataObject data : dataobjectList) { for(DataObject data : dataobjectList) {
String infKey = data.string("dscMngId"); String infKey = data.string("dscdmngId");
String subType = data.string("dscMngSn"); String subType = data.string("dscdmngSn");
List<DataObject> fileinfo = fileService.getFileList( List<DataObject> fileinfo = fileService.getFileList(
new FileQuery().setInfoKeys(infKey).setInfoType("100").setBy("SUB_TYPE").setTerm(subType) new FileQuery().setInfoKeys(infKey).setInfoType("100").setBy("SUB_TYPE").setTerm(subType)
@ -89,7 +84,7 @@ public class DocController extends AbstractController {
String resultFilePath = form.makeFile().andGetPath(); String resultFilePath = form.makeFile().andGetPath();
File file = new File(resultFilePath); File file = new File(resultFilePath);
Relation rel = new Relation().setInfoType("200").setSubType("01").setInfoKey(dscMngId); Relation rel = new Relation().setInfoType("200").setSubType("01").setInfoKey(dscdmngId);
FileInfo fileInfo = new FileInfo.Factory().create(rel, file); FileInfo fileInfo = new FileInfo.Factory().create(rel, file);
fileInfo.setName(print.getFormatKorName()+".hwp"); fileInfo.setName(print.getFormatKorName()+".hwp");
int effected= fileService.create(fileInfo); int effected= fileService.create(fileInfo);
@ -100,30 +95,15 @@ public class DocController extends AbstractController {
return mav; return mav;
} }
private String spreadBySpace(String str, int spaceCnt) {
String result = "";
String spaces = "";
for(int i=1; i<=spaceCnt; i++) {
spaces += " ";
}
char[] charArr = str.toCharArray();
result += Character.toString(charArr[0]);
for(int i=1; i<charArr.length; i++) {
result += spaces + Character.toString(charArr[i]);
}
return result;
}
@RequestMapping(value="/makeDisposeProcessDetailsHwp.do") @RequestMapping(value="/makeDisposeProcessDetailsHwp.do")
public ModelAndView makeDisposeProcessDetailsHwp(String dscMngId) { public ModelAndView makeDisposeProcessDetailsHwp(String dscdmngId) {
ModelAndView mav = new ModelAndView(); ModelAndView mav = new ModelAndView();
mav.setViewName("jsonView"); mav.setViewName("jsonView");
if(dscMngId == null || dscMngId.equals("")) { if(dscdmngId == null || dscdmngId.equals("")) {
return mav; return mav;
} }
@ -135,14 +115,11 @@ public class DocController extends AbstractController {
//개인정보표시여부,기관장 등 //개인정보표시여부,기관장 등
PrintOption printOption = new PrintOption(); PrintOption printOption = new PrintOption();
Map<String,String> globalVariable = new HashMap<String,String>(); Map<String,String> globalVariable = new HashMap<String,String>();
String gigwanjang = sggNm+"장";
gigwanjang = spreadBySpace(gigwanjang,4);
globalVariable.put("gigwanjang", gigwanjang);
printOption.setGlobalVariable(globalVariable); printOption.setGlobalVariable(globalVariable);
//폐기증거사진 //폐기증거사진
List<DataObject> dsuseimgs = fileService.getFileList( List<DataObject> dsuseimgs = fileService.getFileList(
new FileQuery().setInfoType("110").setInfoKeys(dscMngId) new FileQuery().setInfoType("110").setInfoKeys(dscdmngId)
); );
List<String> dataobjectList2 = new ArrayList<>(); List<String> dataobjectList2 = new ArrayList<>();
for(DataObject dsuseimg : dsuseimgs) { for(DataObject dsuseimg : dsuseimgs) {
@ -151,7 +128,7 @@ public class DocController extends AbstractController {
//상품사진갯수 체크 //상품사진갯수 체크
List<DataObject> totalProduct = fileService.getFileList( List<DataObject> totalProduct = fileService.getFileList(
new FileQuery().setInfoKeys(dscMngId).setInfoType("100").setOrderBy("SUB_TYPE") new FileQuery().setInfoKeys(dscdmngId).setInfoType("100").setOrderBy("SUB_TYPE")
); );
int totalProductCnt = 0; int totalProductCnt = 0;
if(totalProduct != null && !totalProduct.isEmpty()) { if(totalProduct != null && !totalProduct.isEmpty()) {
@ -159,11 +136,11 @@ public class DocController extends AbstractController {
} }
//샘플 데이터 생성 //샘플 데이터 생성
List<DataObject> dataobjectList = this.makeSample(dscMngId,totalProductCnt); List<DataObject> dataobjectList = this.makeSample(dscdmngId,totalProductCnt);
for(DataObject data : dataobjectList) { for(DataObject data : dataobjectList) {
String infKey = data.string("dscMngId"); String infKey = data.string("dscdmngId");
String subType = data.string("dscMngSn"); String subType = data.string("dscdmngSn");
List<DataObject> fileinfo = fileService.getFileList( List<DataObject> fileinfo = fileService.getFileList(
new FileQuery().setInfoKeys(infKey).setInfoType("100").setBy("SUB_TYPE").setTerm(subType) new FileQuery().setInfoKeys(infKey).setInfoType("100").setBy("SUB_TYPE").setTerm(subType)
@ -180,7 +157,7 @@ public class DocController extends AbstractController {
String resultFilePath = form.makeFile().andGetPath(); String resultFilePath = form.makeFile().andGetPath();
File file = new File(resultFilePath); File file = new File(resultFilePath);
Relation rel = new Relation().setInfoType("200").setSubType("02").setInfoKey(dscMngId); Relation rel = new Relation().setInfoType("200").setSubType("02").setInfoKey(dscdmngId);
FileInfo fileInfo = new FileInfo.Factory().create(rel, file); FileInfo fileInfo = new FileInfo.Factory().create(rel, file);
fileInfo.setName(print.getFormatKorName()+".hwp"); fileInfo.setName(print.getFormatKorName()+".hwp");
int effected= fileService.create(fileInfo); int effected= fileService.create(fileInfo);
@ -192,14 +169,14 @@ public class DocController extends AbstractController {
} }
public List<DataObject> makeSample(String dscMngId, int totalProductCnt){ public List<DataObject> makeSample(String dscdmngId, int totalProductCnt){
List<DataObject> dataobjectList = new ArrayList<DataObject>(); List<DataObject> dataobjectList = new ArrayList<DataObject>();
for(int i=0; i<totalProductCnt; i++) { for(int i=0; i<totalProductCnt; i++) {
DataObject newObj = this.getRandomObj(); DataObject newObj = this.getRandomObj();
newObj.set("dscMngId", dscMngId); newObj.set("dscdmngId", dscdmngId);
newObj.set("dscMngSn", EgovStringUtil.lPad(""+(i+1), 3, '0')); newObj.set("dscdmngSn", EgovStringUtil.lPad(""+(i+1), 3, '0'));
dataobjectList.add(newObj); dataobjectList.add(newObj);
} }

@ -19,11 +19,12 @@ public class DisposeProcessDetails extends HWPFormat {
public DisposeProcessDetails(Print print, PrintOption printOption, List<DataObject> dataObjectList, List<String> afterPhotoPaths) { public DisposeProcessDetails(Print print, PrintOption printOption, List<DataObject> dataObjectList, List<String> afterPhotoPaths) {
super(print, printOption, dataObjectList); super(print, printOption, dataObjectList);
this.maxRunCount = 1;
this.formatFilePath = "template/hwp/dispose_status.hwp";
this.print.setFormatKorName("폐기처리내역"); this.print.setFormatKorName("폐기처리내역");
this.print.setFormatName("disposeProcessDetails"); this.print.setFormatName("disposeProcessDetails");
this.maxRunCount = 1;
this.formatFilePath = "template/hwp/dispose_status.hwp";
this.data2 = new ArrayList<DataObject>(); this.data2 = new ArrayList<DataObject>();
DataObject page = null; DataObject page = null;
@ -102,8 +103,6 @@ public class DisposeProcessDetails extends HWPFormat {
while(currentRunCount != maxRunCount) { while(currentRunCount != maxRunCount) {
System.out.println(currentRunCount);
System.out.println(maxRunCount);
HWPFile hwpFile_i = HWPWriter.classpath(this.formatFilePath); HWPFile hwpFile_i = HWPWriter.classpath(this.formatFilePath);
this.writer = new HWPWriter(hwpFile_i); this.writer = new HWPWriter(hwpFile_i);
runAsWriter(); runAsWriter();
@ -123,10 +122,16 @@ public class DisposeProcessDetails extends HWPFormat {
protected void runAsWriter() { protected void runAsWriter() {
if(this.formatFilePath.equals("template/hwp/dispose_status.hwp")) { if(this.formatFilePath.equals("template/hwp/dispose_status.hwp")) {
String dsuseDe = data.get(0).string("dsuseDe");
String year = dsuseDe.substring(0, 4);
String month = dsuseDe.substring(4, 6);
String day = dsuseDe.substring(6, 8);
dsuseDe = year + ". " + month + ". " + day + ".";
writer.setValue("폐기일자", dsuseDe);
List<DataObject> list = IntStream.rangeClosed(1, data.size()).boxed().map(i -> { List<DataObject> list = IntStream.rangeClosed(1, data.size()).boxed().map(i -> {
DataObject one = data.get(i-1); DataObject one = data.get(i-1);
return (DataObject) new DataObject() return (DataObject) new DataObject()
.set("폐기일자", DataFormat.yyyy_mm_dd(one.string("dsuseDe")))
.set("번호", i) .set("번호", i)
.set("업소명", one.string("bsshNm")) .set("업소명", one.string("bsshNm"))
.set("폐기사유", one.string("dsusePrvCdNm")) .set("폐기사유", one.string("dsusePrvCdNm"))

@ -14,10 +14,12 @@ public class DisposeResultReport extends HWPFormat {
public DisposeResultReport(Print print, PrintOption printOption, List<DataObject> dataObjectList) { public DisposeResultReport(Print print, PrintOption printOption, List<DataObject> dataObjectList) {
super(print, printOption, dataObjectList); super(print, printOption, dataObjectList);
this.maxRunCount = 1;
this.formatFilePath = "template/hwp/dispose_result_report.hwp";
this.print.setFormatKorName("폐기결과보고서"); this.print.setFormatKorName("폐기결과보고서");
this.print.setFormatName("disposeResultReport"); this.print.setFormatName("disposeResultReport");
this.maxRunCount = 1;
this.formatFilePath = "template/hwp/dispose_result_report.hwp";
} }
@Override @Override
@ -46,15 +48,6 @@ public class DisposeResultReport extends HWPFormat {
}).toList(); }).toList();
writer.table(0, 3, 1).setValues(list); writer.table(0, 3, 1).setValues(list);
String currentTime = print.getPrintRequestDt();
String year = currentTime.substring(0, 4);
String month = currentTime.substring(4, 6);
String day = currentTime.substring(6, 8);
String yyyymmdd = year+month+day;
writer.setValue("연월일", DataFormat.yyyy_mm_dd(yyyymmdd));
String gigwanjang = printOption.getGlobalVariable().get("gigwanjang");
writer.setValue("기관장", gigwanjang);
} }
@Override @Override

@ -12,6 +12,14 @@ server:
key-store-password: 5811807 key-store-password: 5811807
spring: spring:
datasource:
hikari:
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
jdbc-url: jdbc:log4jdbc:mariadb://211.119.124.9:4407/adds?useUnicode=true&characterEncoding=utf8&serverTimezone=Asia/Seoul&useSSL=false
username: addsweb
password: addsweb1234
auto-commit: false
application: application:
name: adds-fo name: adds-fo

@ -11,16 +11,17 @@
alt="Login image" alt="Login image"
/> />
</a> </a>
<div class="d-flex" style="min-width:600px;">
<div class="row">
<div class="col-12">
<input type="text" class="form-control-sm" placeholder="폐기관리아이디" />
<button type="button" class="btn-sm btn-primary" onclick="fnCreateDoc(true);">폐기결과보고서 생성</button>
<button type="button" class="btn-sm btn-primary" onclick="fnCreateDoc(false);">폐기처리내역문서 생성</button>
</div>
</div>
</div>
</div> </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="navbar-nav navbar-dropdown dropdown-user dropdown">
<div class="avatar d-flex flex-row" data-bs-toggle="dropdown"> <div class="avatar d-flex flex-row" data-bs-toggle="dropdown">
@ -59,7 +60,38 @@
</div> </div>
</nav> </nav>
<%--/ Navbar --%> <%--/ Navbar --%>
<c:set var="functions" scope="request">${functions} <c:set var="functions" scope="request">
${functions}
function setPageTitle(pageTitle) { function setPageTitle(pageTitle) {
$("#pageTitle").html(pageTitle); $("#pageTitle").html(pageTitle);
}</c:set> }
function fnCreateDoc(flag){
var url = "";
if(flag){
url = wctx.url("/doc/makeDisposeResultReportHwp.do");
} else {
url = wctx.url("/doc/makeDisposeProcessDetailsHwp.do");
}
var textBox = $("#layout-navbar").find("input[type='text']");
var value = textBox.val();
if(value == ""){
textBox.focus();
return;
}
ajax.get({
url: url,
data:{dscdmngId : value},
success:resp => {
console.log("파일아이디:"+resp.fileId);
}
});
}
</c:set>

Loading…
Cancel
Save