민원답변 대상자료 사진포함 엑셀다운 추가

main
이범준 9 months ago
parent 513c73ecee
commit e7d250a125

@ -1,6 +1,5 @@
package cokr.xit.fims.cvlc.web;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@ -11,17 +10,20 @@ import javax.servlet.http.HttpServletRequest;
import org.apache.poi.ss.usermodel.CellStyle;
import org.springframework.web.servlet.ModelAndView;
import com.fasterxml.jackson.core.type.TypeReference;
import cokr.xit.base.code.CommonCode;
import cokr.xit.base.file.service.FileQuery;
import cokr.xit.base.file.service.bean.FileBean;
import cokr.xit.base.file.xls.XLSWriter;
import cokr.xit.base.file.xls.XLSWriter.CellDef;
import cokr.xit.base.file.xls.XLSWriter.CommentSupport;
import cokr.xit.base.file.xls.XLSWriter.Styler;
import cokr.xit.base.user.ManagedUser;
import cokr.xit.base.user.dao.UserMapper;
import cokr.xit.base.web.ApplicationController;
import cokr.xit.fims.cmmn.CellDecorator;
import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.service.bean.StngBean;
import cokr.xit.fims.crdn.Crdn;
import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.crdn.dao.GlobalStngMapper;
import cokr.xit.fims.crdn.service.CrdnService;
@ -63,6 +65,9 @@ public class Cvlc02Controller extends ApplicationController {
@Resource(name = "stngBean")
private StngBean stngBean;
@Resource(name = "fileBean")
private FileBean fileBean;
/** .
* @return fims/cvlc/cvlc02010-main
*/
@ -95,7 +100,12 @@ public class Cvlc02Controller extends ApplicationController {
query.setSggCd(sggCd);
if("xls".equals(query.getDownload())) {
ArrayList<CellDef> cellDefs = fromJson(query.getCellDefs(), new TypeReference<ArrayList<CellDef>>() {});
List<CellDef> cellDefs = fromJson(query.getCellDefs(), CellDef.listType());
if(ifEmpty(query.getIncludePhoto(), () -> "").equals("Y")) {
cellDefs.add((new CellDef()).setLabel("사진1").setWidth(18).setField("CRDN_PHOTO_PATH1"));
cellDefs.add((new CellDef()).setLabel("사진2").setWidth(18).setField("CRDN_PHOTO_PATH2"));
}
XLSWriter xlsx = new XLSWriter()
.setFilename("민원답변대상자료 목록.xlsx")
@ -107,6 +117,21 @@ public class Cvlc02Controller extends ApplicationController {
CellStyle dateDT = xlsx.yyyy_mm_dd_hh_mm_ss();
List<DataObject> list = crdnCvlcptService.getCivilComplaintList(query.setFetchSize(0));
if(ifEmpty(query.getIncludePhoto(), () -> "").equals("Y")) {
for(DataObject crdn : list) {
String crdnId = crdn.string("CRDN_ID");
FileQuery fileQuery = new FileQuery();
fileQuery.setInfoType(Crdn.INF_TYPE);
fileQuery.setInfoKeys(crdnId);
List<DataObject> fileInfoList = fileBean.getFileList(fileQuery);
if(fileInfoList != null && fileInfoList.size() > 0) {
for(int j=0; (j < fileInfoList.size()) && (j < 2); j++) {
crdn.set("CRDN_PHOTO_PATH"+(j+1), fileInfoList.get(j).string("FILE_PATH"));
}
}
}
}
Map<String, Object> valueMap = new HashMap<String, Object>();
valueMap.put("접수번호", xlsx.style("CVLCPT_RCPT_NO", center));
@ -127,6 +152,17 @@ public class Cvlc02Controller extends ApplicationController {
valueMap.put("차량번호", "VHRNO");
valueMap.put("서손/계고사유", xlsx.style("LEVY_EXCL_RSN_NM", center));
valueMap.put("특기사항", "ETC_CN");
if(ifEmpty(query.getIncludePhoto(), () -> "").equals("Y")) {
CommentSupport commentSupport = new CommentSupport(xlsx);
CellDecorator col1 = CmmnUtil.photoCellForApproval(commentSupport, "CRDN_PHOTO_PATH1");
CellDecorator col2 = CmmnUtil.photoCellForApproval(commentSupport, "CRDN_PHOTO_PATH2");
valueMap.put("사진1", xlsx.format(col1.value()).onCell(col1.memo()));
valueMap.put("사진2", xlsx.format(col2.value()).onCell(col2.memo()));
}
CellDef.setValues(cellDefs, valueMap);
xlsx.cell(0, 0)

@ -16,6 +16,9 @@
<button type="button" id="btnExcel--${pageName}" class="btn btn-excel w-px-120" title="엑셀 저장">
엑셀
</button>
<button type="button" id="btnExcelForApproval--${pageName}" class="btn btn-excel w-px-120" title="엑셀 저장">
엑셀(사진 포함)
</button>
</span>
</div>
@ -396,6 +399,28 @@ $(document).ready(function(){
$P.crdnControl.load($P.crdnControl.query.pageNum + 1);
}
$P.fnExcelDown = (forApproval) => {
if($P.crdnControl.dataset.empty){
alert("조회된 자료가 없습니다.");
return;
}
var cellDefs = getCellDefs($("#crdnThead--${pageName} th").not(".dummy-th").not(":eq(0)").not(":eq(0)"),
$($("#crdnRow--${pageName}")[0].content).find("td").not(".dummy-td").not(":eq(0)").not(":eq(0)"));
$P.crdnControl.query.cellDefs = cellDefs;
if(forApproval){
$P.crdnControl.query.includePhoto = "Y";
} else {
$P.crdnControl.query.includePhoto = "N";
}
$P.crdnControl.download();
$P.crdnControl.query.includePhoto = null;
};
$P.clickCrdnList = (dataKey, auto) => {
if(dataKey == ""){
return;
@ -675,19 +700,9 @@ $(document).ready(function(){
**************************************************************************/
$('#btnReset--${pageName}').on('click', () => $P.fnReset());
$('#btnSearch--${pageName}').on('click', () => $P.searchCrdnList());
$('#btnExcel--${pageName}').on('click', function(){
$('#btnExcel--${pageName}').on('click', () => $P.fnExcelDown(false));
$('#btnExcelForApproval--${pageName}').on('click', () => $P.fnExcelDown(true));
if($P.crdnControl.dataset.empty){
alert("조회된 자료가 없습니다.");
return;
}
var cellDefs = getCellDefs($("#crdnThead--${pageName} th").not(".dummy-th").not(":eq(0)").not(":eq(0)"),
$($("#crdnRow--${pageName}")[0].content).find("td").not(".dummy-td").not(":eq(0)").not(":eq(0)"));
$P.crdnControl.query.cellDefs = cellDefs;
$P.crdnControl.download();
});
$("#btnOpenCvlcptOrgnl--${pageName}").on("click", () => $P.fnOpenCvlcptOrgnl());
$("#btnOpenAnswerPreview--${pageName}").on("click", () => $P.fnOpenAnswerPreview());
$("#btnExecuteAnswer--${pageName}").on("click", () => $P.fnExecuteAnswer());

Loading…
Cancel
Save