|
|
@ -1,17 +1,32 @@
|
|
|
|
package cokr.xit.fims.excl.service.bean;
|
|
|
|
package cokr.xit.fims.excl.service.bean;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
|
|
|
|
import cokr.xit.base.file.FileInfo;
|
|
|
|
import cokr.xit.base.file.FileInfo;
|
|
|
|
|
|
|
|
import cokr.xit.base.file.service.FileQuery;
|
|
|
|
import cokr.xit.fims.excl.OpnnSbmsn;
|
|
|
|
import cokr.xit.fims.excl.OpnnSbmsn;
|
|
|
|
|
|
|
|
import cokr.xit.fims.cmmn.hwp.AddUtil;
|
|
|
|
|
|
|
|
import cokr.xit.fims.cmmn.hwp.HWPPrintUtil;
|
|
|
|
|
|
|
|
import cokr.xit.fims.cmmn.service.bean.FactionBean;
|
|
|
|
|
|
|
|
import cokr.xit.fims.crdn.Crdn;
|
|
|
|
|
|
|
|
import cokr.xit.fims.crdn.CrdnQuery;
|
|
|
|
import cokr.xit.fims.excl.LevyExclQuery;
|
|
|
|
import cokr.xit.fims.excl.LevyExclQuery;
|
|
|
|
import cokr.xit.fims.excl.service.OpnnSbmsnService;
|
|
|
|
import cokr.xit.fims.excl.service.OpnnSbmsnService;
|
|
|
|
|
|
|
|
import cokr.xit.fims.sprt.PrintOption;
|
|
|
|
|
|
|
|
import cokr.xit.fims.sprt.SprtQuery;
|
|
|
|
|
|
|
|
import cokr.xit.foundation.UserInfo;
|
|
|
|
import cokr.xit.foundation.component.AbstractServiceBean;
|
|
|
|
import cokr.xit.foundation.component.AbstractServiceBean;
|
|
|
|
import cokr.xit.foundation.data.DataObject;
|
|
|
|
import cokr.xit.foundation.data.DataObject;
|
|
|
|
|
|
|
|
import kr.dogfoot.hwplib.object.HWPFile;
|
|
|
|
|
|
|
|
import kr.dogfoot.hwplib.reader.HWPReader;
|
|
|
|
|
|
|
|
import kr.dogfoot.hwplib.writer.HWPWriter;
|
|
|
|
|
|
|
|
|
|
|
|
/**의견제출 대장 서비스 구현체.
|
|
|
|
/**의견제출 대장 서비스 구현체.
|
|
|
|
*
|
|
|
|
*
|
|
|
@ -30,6 +45,10 @@ public class OpnnSbmsnServiceBean extends AbstractServiceBean implements OpnnSbm
|
|
|
|
@Resource(name = "opnnSbmsnBean")
|
|
|
|
@Resource(name = "opnnSbmsnBean")
|
|
|
|
protected OpnnSbmsnBean opnnSbmsnBean;
|
|
|
|
protected OpnnSbmsnBean opnnSbmsnBean;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/* Bean */
|
|
|
|
|
|
|
|
@Resource(name="factionBean")
|
|
|
|
|
|
|
|
protected FactionBean factionBean;
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public List<DataObject> getOpnnSbmsnList(LevyExclQuery req) {
|
|
|
|
public List<DataObject> getOpnnSbmsnList(LevyExclQuery req) {
|
|
|
|
return opnnSbmsnBean.getOpnnSbmsnList(req);
|
|
|
|
return opnnSbmsnBean.getOpnnSbmsnList(req);
|
|
|
@ -98,4 +117,82 @@ public class OpnnSbmsnServiceBean extends AbstractServiceBean implements OpnnSbm
|
|
|
|
return retMessage;
|
|
|
|
return retMessage;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
|
|
|
|
public Map<String, String> makeDlbrDecsnFileFromHwpFormat(String formatType, String formatName, PrintOption printOption, String... opnnIDs) {
|
|
|
|
|
|
|
|
Map<String, String> result = new HashMap<>();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HWPPrintUtil printUtil = new HWPPrintUtil();
|
|
|
|
|
|
|
|
printUtil.setting(formatType, formatName);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UserInfo userInfo = currentUser();
|
|
|
|
|
|
|
|
factionBean.initUserInfo(userInfo);
|
|
|
|
|
|
|
|
printUtil.setPrintRequestUserInfo(userInfo);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
List<DataObject> dataObjectList = null;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
dataObjectList = opnnSbmsnBean.getOpnnSbmsnDlbrDecsns(new LevyExclQuery().setOpnnIDs(opnnIDs));
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
int totalDataCount = dataObjectList.size();
|
|
|
|
|
|
|
|
List<String> partFileList = new ArrayList<>();
|
|
|
|
|
|
|
|
printUtil.calcTotalPartFileCount(totalDataCount);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
int dataIndex = 0;
|
|
|
|
|
|
|
|
for(int partFileIndex = 0; partFileIndex < printUtil.getTotalPartFileCount(); partFileIndex++) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 새 파일 생성
|
|
|
|
|
|
|
|
String resultHwpPath = printUtil.newFileFromFormatFile();
|
|
|
|
|
|
|
|
HWPFile resultFile = HWPReader.fromFile(resultHwpPath);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 공통사항 세팅
|
|
|
|
|
|
|
|
printUtil.setGlobalInfo(printOption, dataObjectList, resultFile);
|
|
|
|
|
|
|
|
HWPWriter.toFile(resultFile, resultHwpPath);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 데이터 건별 처리
|
|
|
|
|
|
|
|
for (int recordIndex = 0; recordIndex < printUtil.getRecordPerPartFile(); recordIndex++) {
|
|
|
|
|
|
|
|
if (dataIndex < dataObjectList.size()) {
|
|
|
|
|
|
|
|
DataObject dataObject = dataObjectList.get(dataIndex);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
printUtil.setBySingleData(printOption, dataObject, resultFile);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (formatType.equals("list")) {
|
|
|
|
|
|
|
|
dataIndex++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if (!formatType.equals("list")) {
|
|
|
|
|
|
|
|
dataIndex++;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HWPWriter.toFile(resultFile, resultHwpPath);
|
|
|
|
|
|
|
|
partFileList.add(resultHwpPath);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 결과 파일 병합
|
|
|
|
|
|
|
|
if (partFileList.size() >= 2) {
|
|
|
|
|
|
|
|
String basePath = partFileList.get(0);
|
|
|
|
|
|
|
|
HWPFile baseFile = HWPReader.fromFile(basePath);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
for (int iLoop = 2; iLoop <= partFileList.size(); iLoop++) {
|
|
|
|
|
|
|
|
String attachPath = partFileList.get(iLoop - 1);
|
|
|
|
|
|
|
|
HWPFile attachFile = HWPReader.fromFile(attachPath);
|
|
|
|
|
|
|
|
AddUtil.appendToLast(attachFile, baseFile);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HWPWriter.toFile(baseFile, basePath);
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String downlaodFileName = printUtil.getFormatKorName() + "_" + printUtil.getPrintRequestDt() + ".hwp";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
result.put("fileName", downlaodFileName);
|
|
|
|
|
|
|
|
result.put("filePath", partFileList.get(0));
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
|
|
|
throw new RuntimeException("한글 파일 출력 중 오류가 발생하였습니다.");
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return result;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|