|
|
@ -1,16 +1,27 @@
|
|
|
|
package cokr.xit.fims.crdn.service.bean;
|
|
|
|
package cokr.xit.fims.crdn.service.bean;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.File;
|
|
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
|
|
|
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
import javax.annotation.Resource;
|
|
|
|
|
|
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import cokr.xit.base.file.FileInfo;
|
|
|
|
|
|
|
|
import cokr.xit.fims.cmmn.CmmnUtil;
|
|
|
|
import cokr.xit.fims.crdn.CrdnQuery;
|
|
|
|
import cokr.xit.fims.crdn.CrdnQuery;
|
|
|
|
import cokr.xit.fims.crdn.dao.Crdn01Mapper;
|
|
|
|
import cokr.xit.fims.crdn.dao.Crdn01Mapper;
|
|
|
|
import cokr.xit.fims.crdn.service.CrdnService;
|
|
|
|
import cokr.xit.fims.crdn.service.CrdnService;
|
|
|
|
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.tool.objectfinder.FieldFinder;
|
|
|
|
|
|
|
|
import kr.dogfoot.hwplib.writer.HWPWriter;
|
|
|
|
|
|
|
|
|
|
|
|
/**민원 관리 서비스 인터페이스의 구현체
|
|
|
|
/**민원 관리 서비스 인터페이스의 구현체
|
|
|
|
* @author leebj
|
|
|
|
* @author leebj
|
|
|
@ -47,5 +58,70 @@ public class Crdn01ServiceBean extends AbstractServiceBean implements CrdnServic
|
|
|
|
return crdn01Bean.removeCivilComplaint(crdnIDs);
|
|
|
|
return crdn01Bean.removeCivilComplaint(crdnIDs);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
public ModelAndView makeFileFromHwpFormat(CrdnQuery crdnQuery) {
|
|
|
|
|
|
|
|
crdnQuery.setView("hwp");
|
|
|
|
|
|
|
|
DataObject dataObject = crdn01Bean.getCivilComplaintOriginalInfo(crdnQuery);
|
|
|
|
|
|
|
|
SimpleDateFormat ymdhmsFormat = new SimpleDateFormat("yyyyMMddHHmmss");
|
|
|
|
|
|
|
|
SimpleDateFormat ymdFormat = new SimpleDateFormat("yyyyMMdd");
|
|
|
|
|
|
|
|
SimpleDateFormat ymdHypenFormat = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String formatFilePath = "files" + File.separator + "format" + File.separator + "cvlcptOrgnl.hwp";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
HWPFile hwpFile;
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
|
|
|
hwpFile = HWPReader.fromFile(formatFilePath);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ArrayList<String> strings = new ArrayList<String>();
|
|
|
|
|
|
|
|
strings.add(dataObject.string("CVLCPT_APLCNT_NM"));
|
|
|
|
|
|
|
|
FieldFinder.setClickHereText(hwpFile, "신청자", strings);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strings = new ArrayList<String>();
|
|
|
|
|
|
|
|
String cvlcptRcptYmd = dataObject.string("CVLCPT_RCPT_YMD");
|
|
|
|
|
|
|
|
cvlcptRcptYmd = ymdHypenFormat.format(ymdFormat.parse(cvlcptRcptYmd));
|
|
|
|
|
|
|
|
strings.add(cvlcptRcptYmd);
|
|
|
|
|
|
|
|
FieldFinder.setClickHereText(hwpFile, "접수일자", strings);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strings = new ArrayList<String>();
|
|
|
|
|
|
|
|
String cvlcptRrcsPrnmntDt = dataObject.string("CVLCPT_PRCS_PRNMNT_DT");
|
|
|
|
|
|
|
|
cvlcptRrcsPrnmntDt = ymdHypenFormat.format(ymdFormat.parse(cvlcptRrcsPrnmntDt));
|
|
|
|
|
|
|
|
strings.add(cvlcptRrcsPrnmntDt);
|
|
|
|
|
|
|
|
FieldFinder.setClickHereText(hwpFile, "처리기한", strings);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strings = new ArrayList<String>();
|
|
|
|
|
|
|
|
strings.add(dataObject.string("CVLCPT_RCPT_NO"));
|
|
|
|
|
|
|
|
FieldFinder.setClickHereText(hwpFile, "접수번호", strings);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
strings = new ArrayList<String>();
|
|
|
|
|
|
|
|
String cvlcptAplyCn = dataObject.string("CVLCPT_APLY_CN");
|
|
|
|
|
|
|
|
cvlcptAplyCn = CmmnUtil.escapeHTMLEntity(cvlcptAplyCn);
|
|
|
|
|
|
|
|
strings.add(cvlcptAplyCn);
|
|
|
|
|
|
|
|
FieldFinder.setClickHereText(hwpFile, "민원내용", strings);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//TODO : 사진삽입
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String currentTime = ymdhmsFormat.format(new Date());
|
|
|
|
|
|
|
|
String resultPath = "files" + File.separator + "result" + File.separator + currentTime + ".hwp";
|
|
|
|
|
|
|
|
HWPWriter.toFile(hwpFile, resultPath);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
FileInfo fileInfo = new FileInfo();
|
|
|
|
|
|
|
|
fileInfo.setPath(resultPath);
|
|
|
|
|
|
|
|
fileInfo.setName(currentTime+".hwp");
|
|
|
|
|
|
|
|
fileInfo.setMimeType("application/vnd.hancom.hwpx");
|
|
|
|
|
|
|
|
fileInfo.setExtension("hwp");
|
|
|
|
|
|
|
|
fileInfo.setSize(new File(resultPath).length());
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
String downlaodFileName = "민원내역원본_" + currentTime + ".hwp";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ModelAndView mav = new ModelAndView("jsonView");
|
|
|
|
|
|
|
|
mav.addObject("filePath", resultPath);
|
|
|
|
|
|
|
|
mav.addObject("fileName", downlaodFileName);
|
|
|
|
|
|
|
|
return mav;
|
|
|
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return new ModelAndView("errorView");
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|