소스 정리

main
mjkhan21 8 months ago
parent 99c2cb579d
commit 10c2241099

@ -11,21 +11,19 @@ import java.io.OutputStream;
import java.nio.file.Files; import java.nio.file.Files;
import java.nio.file.StandardCopyOption; import java.nio.file.StandardCopyOption;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.Arrays;
import java.util.Date; import java.util.Date;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.egovframe.rte.fdl.string.EgovStringUtil;
import cokr.xit.applib.Hangul; import cokr.xit.applib.Hangul;
import cokr.xit.base.file.ZIP; import cokr.xit.base.file.ZIP;
import cokr.xit.foundation.Downloadable; import cokr.xit.foundation.Downloadable;
import cokr.xit.foundation.component.AbstractBean;
import cokr.xit.foundation.data.DataFormat; import cokr.xit.foundation.data.DataFormat;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;
public class OutsourcingFileMaker { public class OutsourcingFileMaker extends AbstractBean {
protected String printKorName; protected String printKorName;
protected FimsPrintOption printOption; protected FimsPrintOption printOption;
protected List<DataObject> data; protected List<DataObject> data;
@ -33,8 +31,7 @@ public class OutsourcingFileMaker {
protected String resultZipFilePath; protected String resultZipFilePath;
public OutsourcingFileMaker(String printKorName, FimsPrintOption printOption, List<DataObject> printStngItems, public OutsourcingFileMaker(String printKorName, FimsPrintOption printOption, List<DataObject> printStngItems, List<DataObject> data){
List<DataObject> data){
this.printKorName = printKorName; this.printKorName = printKorName;
this.printOption = printOption; this.printOption = printOption;
this.data = data; this.data = data;
@ -45,36 +42,26 @@ public class OutsourcingFileMaker {
* . * .
*/ */
public List<PredefinedSet> filterUsedArtcls() { public List<PredefinedSet> filterUsedArtcls() {
List<String> otptArtclNmList = this.printStngItems.stream().map((item) -> { return item.string("ARTCL_NM"); }).toList(); List<String> otptArtclNmList = printStngItems.stream()
.map((item) -> item.string("ARTCL_NM"))
List<PredefinedSet> result = OutsourcingFileMaker.predifinedSetForOutsourcing().stream() .toList();
.filter((item) -> {
return otptArtclNmList.contains(item.getArtclNm());
}).toList();
return result; return OutsourcingFileMaker.predifinedSetForOutsourcing().stream()
.filter((item) -> otptArtclNmList.contains(item.getArtclNm()))
.toList();
} }
/** /**
* . * .
*/ */
public List<String> filterDownloadDataNames() { public List<String> filterDownloadDataNames() {
return filterUsedArtcls().stream()
List<String> result = this.filterUsedArtcls().stream() .filter((item) -> item.isDownloadData())
.filter((item) -> { .map(PredefinedSet::getArtclDscrp)
return item.isDownloadData(); .toList();
})
.map(PredefinedSet::getArtclDscrp).toList();
return result;
} }
public Map<String, Object> makeFile() { public Map<String, Object> makeFile() {
Map<String, Object> result = new HashMap<>();
Hangul hangul = new Hangul(2);
SimpleDateFormat ymdhmsFormat = new SimpleDateFormat("yyyyMMddHHmmss"); SimpleDateFormat ymdhmsFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String currentTime = ymdhmsFormat.format(new Date()); String currentTime = ymdhmsFormat.format(new Date());
String year = currentTime.substring(0, 4); String year = currentTime.substring(0, 4);
@ -85,57 +72,39 @@ public class OutsourcingFileMaker {
String outsourcingResultPath = "files"+File.separator+"temp"+File.separator+"outsourcing" String outsourcingResultPath = "files"+File.separator+"temp"+File.separator+"outsourcing"
+ File.separator + year + File.separator + month + File.separator + day + File.separator + year + File.separator + month + File.separator + day
+ File.separator + currentTime; + File.separator + currentTime;
ensureDir(outsourcingResultPath);
File folder = new File(outsourcingResultPath);
if(!folder.exists()) {
folder.mkdirs();
}
try { try {
String imagesFolderName = yyyymmdd + printKorName; String imagesFolderName = yyyymmdd + printKorName;
String metaFileName = yyyymmdd + printKorName + "(외주파일).txt"; String metaFileName = yyyymmdd + printKorName + "(외주파일).txt";
String imagesFolderPath = outsourcingResultPath + File.separator + imagesFolderName; String imagesFolderPath = outsourcingResultPath + File.separator + imagesFolderName;
String metaFilePath = outsourcingResultPath + File.separator + metaFileName; String metaFilePath = outsourcingResultPath + File.separator + metaFileName;
File imagesFolderPathFile = new File(imagesFolderPath); File imagesFolderPathFile = ensureDir(imagesFolderPath);
if (!imagesFolderPathFile.exists()) {
imagesFolderPathFile.mkdirs();
}
for(int i=0; i < data.size(); i++) {
DataObject dataObject = data.get(i);
for(DataObject dataObject: data) {
CmmnUtil.setOcrInfo(dataObject); CmmnUtil.setOcrInfo(dataObject);
CmmnUtil.setBarcode(dataObject); CmmnUtil.setBarcode(dataObject);
String sndngDtlId = dataObject.string("SNDNG_DTL_ID"); String sndngDtlId = dataObject.string("SNDNG_DTL_ID");
int crdnPhotoCnt = toInt(dataObject.get("CRDN_PHOTO_CNT"));
int crdnPhotoCnt = dataObject.number("CRDN_PHOTO_CNT").intValue();
for(int j=0; j < crdnPhotoCnt; j++){ for(int j=0; j < crdnPhotoCnt; j++){
String orgnFilePath = dataObject.string("CRDN_PHOTO"+(j+1)); String orgnFilePath = dataObject.string("CRDN_PHOTO"+(j+1));
String fileKey = dataObject.string("CRDN_PHOTO"+(j+1)+"KEY"); String fileKey = dataObject.string("CRDN_PHOTO"+(j+1)+"KEY");
if(isEmpty(orgnFilePath)) continue;
if(EgovStringUtil.null2void(orgnFilePath).equals("")) {
continue;
}
if(!orgnFilePath.startsWith("files")) { if(!orgnFilePath.startsWith("files")) {
orgnFilePath = CmmnUtil.copyStaticResource(orgnFilePath, false); orgnFilePath = CmmnUtil.copyStaticResource(orgnFilePath, false);
} }
File orgnFile = new File(orgnFilePath); File orgnFile = new File(orgnFilePath);
if(!orgnFile.exists() || !orgnFile.canRead()) { if(!orgnFile.exists() || !orgnFile.canRead()) continue;
continue;
}
InputStream orgnFileInputStream = new FileInputStream(orgnFile); InputStream orgnFileInputStream = new FileInputStream(orgnFile);
String modifiedFileName = "P"+sndngDtlId+CmmnUtil.indexToAlphabet(j, true, true)+"."+"JPG"; String modifiedFileName = "P"+sndngDtlId+CmmnUtil.indexToAlphabet(j, true, true)+"."+"JPG";
String modifiedFilePath = imagesFolderPath + File.separator + modifiedFileName; String modifiedFilePath = imagesFolderPath + File.separator + modifiedFileName;
File modifiedFile = new File(modifiedFilePath); File modifiedFile = new File(modifiedFilePath);
if(dataObject.get("MOS"+fileKey) != null) { if(dataObject.get("MOS"+fileKey) != null) {
@ -150,48 +119,28 @@ public class OutsourcingFileMaker {
File metaFile = new File(metaFilePath); File metaFile = new File(metaFilePath);
if (!metaFile.exists()) { if (!metaFile.exists()) {
if(!metaFile.createNewFile()) { if(!metaFile.createNewFile())
throw new RuntimeException("외주파일생성 중 오류가 발생하였습니다."); throw new RuntimeException("외주파일생성 중 오류가 발생하였습니다.");
};
} }
FileWriter fw = new FileWriter(metaFile); FileWriter fw = new FileWriter(metaFile);
BufferedWriter writer = new BufferedWriter(fw); BufferedWriter writer = new BufferedWriter(fw);
Hangul hangul = new Hangul(2);
for(int i=0; i < data.size(); i++) { for(int i=0; i < data.size(); i++) {
DataObject dataObject = data.get(i); DataObject dataObject = data.get(i);
if(i != 0)
if(i != 0) {
writer.write("\n"); writer.write("\n");
}
String line = ""; String line = "";
for(DataObject printStngItem : printStngItems){ for(DataObject printStngItem : printStngItems){
String artclNm = printStngItem.string("ARTCL_NM"); String artclNm = printStngItem.string("ARTCL_NM");
int byteCnt = printStngItem.number("ARTCL_SZ").intValue(); String artclValue = switch (artclNm) {
String artclValue = ""; case "OTPT_YMD" -> yyyymmdd;
case "OTPT_YEAR" -> year;
//조회한 데이터와 관련없는 항목(출력일시 등) case "OTPT_MONTH" -> month;
if(artclNm.equals("OTPT_YMD") || artclNm.equals("OTPT_YEAR") case "OTPT_DAY" -> day;
|| artclNm.equals("OTPT_MONTH") || artclNm.equals("OTPT_DAY")) { default -> dataObject.string(artclNm);
switch(artclNm) { };
case "OTPT_YMD" :
artclValue = yyyymmdd;
break;
case "OTPT_YEAR" :
artclValue = year;
break;
case "OTPT_MONTH" :
artclValue = month;
break;
case "OTPT_DAY" :
artclValue = day;
break;
}
} else {
artclValue = dataObject.string(artclNm);
}
//포매팅 //포매팅
if(!printStngItem.string("FORMATTING").equals("")) { if(!printStngItem.string("FORMATTING").equals("")) {
@ -227,6 +176,7 @@ public class OutsourcingFileMaker {
} }
//공백 패딩 방향 //공백 패딩 방향
int byteCnt = toInt(printStngItem.get("ARTCL_SZ"));
if(printStngItem.string("PADDING_DIRECTION").equals("left")) { if(printStngItem.string("PADDING_DIRECTION").equals("left")) {
line += hangul.lpadByte(artclValue, byteCnt, " "); line += hangul.lpadByte(artclValue, byteCnt, " ");
} else { } else {
@ -242,8 +192,7 @@ public class OutsourcingFileMaker {
String zipFileName = yyyymmdd + printKorName + ".zip"; String zipFileName = yyyymmdd + printKorName + ".zip";
String zipFilePath = outsourcingResultPath + File.separator + zipFileName; String zipFilePath = outsourcingResultPath + File.separator + zipFileName;
ZIP zip = new ZIP(); new ZIP().compress(zipFilePath, metaFilePath, imagesFolderPath);
zip.compress(zipFilePath, metaFilePath, imagesFolderPath);
metaFile.delete(); metaFile.delete();
File[] images = imagesFolderPathFile.listFiles(); File[] images = imagesFolderPathFile.listFiles();
@ -253,27 +202,25 @@ public class OutsourcingFileMaker {
imagesFolderPathFile.delete(); imagesFolderPathFile.delete();
resultZipFilePath = zipFilePath; resultZipFilePath = zipFilePath;
result.put("download", this.getDownloadable().setFilename(zipFileName)); return Map.of(
result.put("downloadData", data); "download", getDownloadable().setFilename(zipFileName),
result.put("dataNames", this.filterDownloadDataNames()); "downloadData", data,
"dataNames", this.filterDownloadDataNames()
);
} catch(FileNotFoundException e) { } catch(FileNotFoundException e) {
throw new RuntimeException("파일을 찾을 수 없습니다."); throw new RuntimeException("파일을 찾을 수 없습니다.");
} catch (IOException e) { } catch (IOException e) {
throw new RuntimeException("외주파일생성 중 오류가 발생하였습니다."); throw new RuntimeException("외주파일생성 중 오류가 발생하였습니다.");
} }
return result;
} }
public void write(OutputStream out) { public void write(OutputStream out) {
try { try (FileInputStream fis = new FileInputStream(resultZipFilePath);) {
FileInputStream fis = new FileInputStream(resultZipFilePath);
fis.transferTo(out); fis.transferTo(out);
fis.close();
new File(resultZipFilePath).delete(); new File(resultZipFilePath).delete();
} catch (Exception e) { } catch (Exception e) {
throw new RuntimeException(e); throw runtimeException(e);
} }
} }
@ -284,35 +231,35 @@ public class OutsourcingFileMaker {
} }
public static List<PredefinedSet> predifinedSetForOutsourcing() { public static List<PredefinedSet> predifinedSetForOutsourcing() {
List<PredefinedSet> predefinedSetList = new ArrayList<>(); return Arrays.asList(
predefinedSetList.add(new PredefinedSet("SNDNG_DTL_ID", "발송상세아이디").offLog()); new PredefinedSet("SNDNG_DTL_ID", "발송상세아이디").offLog(),
predefinedSetList.add(new PredefinedSet("VLTN_LAW_NM", "위반법명")); new PredefinedSet("VLTN_LAW_NM", "위반법명"),
predefinedSetList.add(new PredefinedSet("BARCODE", "바코드").offLog()); new PredefinedSet("BARCODE", "바코드").offLog(),
predefinedSetList.add(new PredefinedSet("CRDN_DT", "단속일시")); new PredefinedSet("CRDN_DT", "단속일시"),
predefinedSetList.add(new PredefinedSet("DUDT_YMD", "납부기한")); new PredefinedSet("DUDT_YMD", "납부기한"),
predefinedSetList.add(new PredefinedSet("VHRNO", "차량번호")); new PredefinedSet("VHRNO", "차량번호"),
predefinedSetList.add(new PredefinedSet("FFNLG_CARMDL_NM", "과태료차종명")); new PredefinedSet("FFNLG_CARMDL_NM", "과태료차종명"),
predefinedSetList.add(new PredefinedSet("VHCL_NM", "차량명")); new PredefinedSet("VHCL_NM", "차량명"),
predefinedSetList.add(new PredefinedSet("CRDN_PLC", "단속장소")); new PredefinedSet("CRDN_PLC", "단속장소"),
predefinedSetList.add(new PredefinedSet("RTPYR_ADDR", "납부자기본주소")); new PredefinedSet("RTPYR_ADDR", "납부자기본주소"),
predefinedSetList.add(new PredefinedSet("RTPYR_DTL_ADDR", "납부자상세주소")); new PredefinedSet("RTPYR_DTL_ADDR", "납부자상세주소"),
predefinedSetList.add(new PredefinedSet("RTPYR_ZIP", "납부자우편번호")); new PredefinedSet("RTPYR_ZIP", "납부자우편번호"),
predefinedSetList.add(new PredefinedSet("RTPYR_NM", "납부자명")); new PredefinedSet("RTPYR_NM", "납부자명"),
predefinedSetList.add(new PredefinedSet("OPNN_RANGE", "의견진술기간")); new PredefinedSet("OPNN_RANGE", "의견진술기간"),
predefinedSetList.add(new PredefinedSet("CRDN_SE_NM", "단속구분명")); new PredefinedSet("CRDN_SE_NM", "단속구분명"),
predefinedSetList.add(new PredefinedSet("ATCH_FILE_CNT", "첨부파일갯수")); new PredefinedSet("ATCH_FILE_CNT", "첨부파일갯수"),
predefinedSetList.add(new PredefinedSet("FFNLG_CRDN_AMT", "과태료단속금액")); new PredefinedSet("FFNLG_CRDN_AMT", "과태료단속금액"),
predefinedSetList.add(new PredefinedSet("LAST_AMT", "최종금액")); new PredefinedSet("LAST_AMT", "최종금액"),
predefinedSetList.add(new PredefinedSet("RG_NO", "등기번호")); new PredefinedSet("RG_NO", "등기번호"),
predefinedSetList.add(new PredefinedSet("OCR0", "OCR0").offLog()); new PredefinedSet("OCR0", "OCR0").offLog(),
predefinedSetList.add(new PredefinedSet("OCR0_1", "OCR0_1").offLog()); new PredefinedSet("OCR0_1", "OCR0_1").offLog(),
predefinedSetList.add(new PredefinedSet("OCR0_2", "OCR0_2").offLog()); new PredefinedSet("OCR0_2", "OCR0_2").offLog(),
predefinedSetList.add(new PredefinedSet("OCR_BAND1", "OCR_BAND1").offLog()); new PredefinedSet("OCR_BAND1", "OCR_BAND1").offLog(),
predefinedSetList.add(new PredefinedSet("OCR_BAND2", "OCR_BAND2").offLog()); new PredefinedSet("OCR_BAND2", "OCR_BAND2").offLog(),
predefinedSetList.add(new PredefinedSet("BANK_NM", "가상계좌은행명")); new PredefinedSet("BANK_NM", "가상계좌은행명"),
predefinedSetList.add(new PredefinedSet("VR_ACTNO", "가상계좌")); new PredefinedSet("VR_ACTNO", "가상계좌"),
predefinedSetList.add(new PredefinedSet("EPAYNO", "전자납부번호")); new PredefinedSet("EPAYNO", "전자납부번호"),
predefinedSetList.add(new PredefinedSet("EMPTY", "공백").offLog()); new PredefinedSet("EMPTY", "공백").offLog()
return predefinedSetList; );
} }
} }

@ -21,7 +21,6 @@ import cokr.xit.foundation.data.DataObject;
@Component("extrStngBean") @Component("extrStngBean")
public class ExtrStngBean extends AbstractBean { public class ExtrStngBean extends AbstractBean {
@Resource(name = "extrStngMapper") @Resource(name = "extrStngMapper")
private ExtrStngMapper extrStngMapper; private ExtrStngMapper extrStngMapper;
@ -33,23 +32,14 @@ public class ExtrStngBean extends AbstractBean {
return extrStngMapper.selectExtrBscStng(extrStngQuery); return extrStngMapper.selectExtrBscStng(extrStngQuery);
} }
/** . /** .
* @param query * @param query
* @return * @return
*/ */
public Map<String, Object> getExtrArtclStngMap(ExtrStngQuery query){ public Map<String, Object> getExtrArtclStngMap(ExtrStngQuery query){
Map<String,Object> extrStngMap = new HashMap<String,Object>(); List<DataObject> extrArtclStngList = ifEmpty(extrStngMapper.selectExtrArtclStngList(query), ArrayList::new);
PDFExtractFormat pdfFormat = new ElectronicNotice();
PDFExtractFormat pdfFormat = null;
pdfFormat = new ElectronicNotice();
List<DataObject> extrArtclStngList = extrStngMapper.selectExtrArtclStngList(query);
if(extrArtclStngList == null) {
extrArtclStngList = new ArrayList<DataObject>();
}
pdfFormat.appendPredefinedYn(extrArtclStngList); pdfFormat.appendPredefinedYn(extrArtclStngList);
List<PredefinedSet> predefinedSetList = pdfFormat.getPredefinedSetList(); List<PredefinedSet> predefinedSetList = pdfFormat.getPredefinedSetList();
List<DataObject> predefinedDataList = extrArtclStngList.stream().filter(item -> item.string("PREDEFINED_YN").equals("Y")).toList(); List<DataObject> predefinedDataList = extrArtclStngList.stream().filter(item -> item.string("PREDEFINED_YN").equals("Y")).toList();
@ -61,43 +51,37 @@ public class ExtrStngBean extends AbstractBean {
Map<String, Object> custom = new HashMap<String,Object>(); Map<String, Object> custom = new HashMap<String,Object>();
custom.put("dataList", customDataList); custom.put("dataList", customDataList);
extrStngMap.put("predefinedSetList", predefinedSetList); return Map.of(
extrStngMap.put("predefined", predefined); "predefinedSetList", predefinedSetList,
extrStngMap.put("custom", custom); "predefined", predefined,
return extrStngMap; "custom", custom
);
} }
public boolean saveExtrBscStng(ExtrForm extrForm) { public boolean saveExtrBscStng(ExtrForm extrForm) {
boolean result = false;
String userId = currentUser().getId(); String userId = currentUser().getId();
if(ifEmpty(extrForm.getExtrBscId(), ()-> "").equals("")) { if(isEmpty(extrForm.getExtrBscId())) {
extrForm.setCreatedBy(userId); extrForm.setCreatedBy(userId);
result = extrStngMapper.insertBscStng(extrForm) == 1; return extrStngMapper.insertBscStng(extrForm) == 1;
} else { } else {
extrForm.setModifiedBy(userId); extrForm.setModifiedBy(userId);
result = extrStngMapper.updateBscStng(extrForm) == 1; return extrStngMapper.updateBscStng(extrForm) == 1;
} }
return result;
} }
public boolean saveExtrArtclStng(ExtrForm extrForm) { public boolean saveExtrArtclStng(ExtrForm extrForm) {
try { try {
String userId = currentUser().getId(); String userId = currentUser().getId();
List<ExtrArtclStng> extrArtclStngList = extrForm.getExtrArtclStngList();
List<String> updateKeyList = new ArrayList<String>(); List<String> updateKeyList = new ArrayList<String>();
List<ExtrArtclStng> insertList = new ArrayList<ExtrArtclStng>(); List<ExtrArtclStng> insertList = new ArrayList<ExtrArtclStng>();
if(extrArtclStngList != null && !extrArtclStngList.isEmpty()) { List<ExtrArtclStng> extrArtclStngList = extrForm.getExtrArtclStngList();
if(!isEmpty(extrArtclStngList)) {
List<ExtrArtclStng> updateList = extrArtclStngList.stream().filter(item -> !ifEmpty(item.getExtrFormId(), () -> "").equals("")).toList(); List<ExtrArtclStng> updateList = extrArtclStngList.stream()
.filter(item -> !isEmpty(item.getExtrFormId()))
.toList();
if(!updateList.isEmpty()) { if(!updateList.isEmpty()) {
for(ExtrArtclStng update : updateList) { for(ExtrArtclStng update : updateList) {
update.setModifiedBy(userId); update.setModifiedBy(userId);
@ -111,6 +95,7 @@ public class ExtrStngBean extends AbstractBean {
if(!updateKeyList.isEmpty()) { if(!updateKeyList.isEmpty()) {
extrForm.setExtrFormIDs(updateKeyList.toArray(new String[updateKeyList.size()])); extrForm.setExtrFormIDs(updateKeyList.toArray(new String[updateKeyList.size()]));
} }
extrForm.setModifiedBy(userId); extrForm.setModifiedBy(userId);
extrStngMapper.deleteArtclStng(extrForm); extrStngMapper.deleteArtclStng(extrForm);
@ -126,4 +111,4 @@ public class ExtrStngBean extends AbstractBean {
return true; return true;
} }
} }

@ -434,7 +434,7 @@ public class Crdn06Controller extends ApplicationController {
@RequestMapping(name= "단속 사진 목록", value = "/fileList.do") @RequestMapping(name= "단속 사진 목록", value = "/fileList.do")
public ModelAndView getFileList(FileQuery req) { public ModelAndView getFileList(FileQuery req) {
String infoType = ifEmpty(req.getInfoType(), () -> ""); String infoType = ifEmpty(req.getInfoType(), () -> "");
boolean singleKey = (req.getInfoKeys() != null && req.getInfoKeys().length == 1); boolean singleKey = (req.getInfoKeys() != null && req.getInfoKeys().size() == 1);
//파일 목록 //파일 목록
List<DataObject> fileInfoList = fileService.getFileList(req); List<DataObject> fileInfoList = fileService.getFileList(req);
@ -460,7 +460,7 @@ public class Crdn06Controller extends ApplicationController {
//민원 동영상파일 첨부 여부 //민원 동영상파일 첨부 여부
String cvlcptVideoExistYn = "N"; String cvlcptVideoExistYn = "N";
if(infoType.equals(Crdn.INF_TYPE) && singleKey) { if(infoType.equals(Crdn.INF_TYPE) && singleKey) {
DataObject dataObject = crdnInfoMapper.selectCrdnInfo(req.getInfoKeys()[0]); DataObject dataObject = crdnInfoMapper.selectCrdnInfo(req.getInfoKeys().get(0));
String linkTblNm = dataObject.string("LINK_TBL_NM"); String linkTblNm = dataObject.string("LINK_TBL_NM");
if(!linkTblNm.equals("")) { //민원연계자료 if(!linkTblNm.equals("")) { //민원연계자료

@ -1945,21 +1945,16 @@ public class Sndb01Controller extends ApplicationController {
@RequestMapping(name="사전통지서 외주 파일 생성", value=METHOD_URL.makeAdvanceNoticeOutsourcing) @RequestMapping(name="사전통지서 외주 파일 생성", value=METHOD_URL.makeAdvanceNoticeOutsourcing)
public ModelAndView makeAdvanceNoticeOutsourcing(SndbQuery req, FimsPrintOption printOption) { public ModelAndView makeAdvanceNoticeOutsourcing(SndbQuery req, FimsPrintOption printOption) {
List<DataObject> list = sndngDtlService.getSndngTrgtDtlIds(req); List<DataObject> list = sndngDtlService.getSndngTrgtDtlIds(req);
String[] crdnIds = list.stream().map(row -> row.string("CRDN_ID")).toList().toArray(new String[list.size()]);
String[] crdnIds = new String[list.size()]; SprtQuery sprtQuery = new SprtQuery()
for (int iLoop = 0; iLoop < list.size(); iLoop++) { .setCrdnIds(crdnIds);
crdnIds[iLoop] = list.get(iLoop).string("CRDN_ID");
}
SprtQuery sprtQuery = new SprtQuery();
sprtQuery.setCrdnIds(crdnIds);
List<DataObject> dataObjectList = integrationSearchMapper.selectIntegrationDataList(sprtQuery); List<DataObject> dataObjectList = integrationSearchMapper.selectIntegrationDataList(sprtQuery);
for (int i=0; i < dataObjectList.size(); i++) { for (DataObject row: dataObjectList) {
DataObject sndngDtl = integrationSearchMapper.selectLatestSndngDtlInfo(dataObjectList.get(i).string("CRDN_ID")); DataObject sndngDtl = integrationSearchMapper.selectLatestSndngDtlInfo(row.string("CRDN_ID"));
dataObjectList.get(i).set("SNDNG_DTL_ID",sndngDtl.string("SNDNG_DTL_ID")); row.set("SNDNG_DTL_ID", sndngDtl.string("SNDNG_DTL_ID"));
dataObjectList.get(i).set("SNDNG_YMD",sndngDtl.string("SNDNG_YMD")); row.set("SNDNG_YMD", sndngDtl.string("SNDNG_YMD"));
dataObjectList.get(i).set("OPNN_RANGE", row.set("OPNN_RANGE", row.string("SNDNG_YMD")+"~"+row.string("DUDT_YMD"));
dataObjectList.get(i).string("SNDNG_YMD")+"~"+dataObjectList.get(i).string("DUDT_YMD")); row.set("RG_NO",sndngDtl.string("RG_NO"));
dataObjectList.get(i).set("RG_NO",sndngDtl.string("RG_NO"));
} }
String taskSeCd = ""; String taskSeCd = "";
@ -1969,30 +1964,26 @@ public class Sndb01Controller extends ApplicationController {
if (taskSeCd.isEmpty()) if (taskSeCd.isEmpty())
taskSeCd = dataObject.string("TASK_SE_CD"); taskSeCd = dataObject.string("TASK_SE_CD");
FileQuery fileQuery = new FileQuery(); FileQuery fileQuery = new FileQuery()
fileQuery.setInfoType(Crdn.INF_TYPE); .setInfoType(Crdn.INF_TYPE)
fileQuery.setInfoKeys(dataObject.string("CRDN_ID")); .setInfoKeys(dataObject.string("CRDN_ID"));
List<DataObject> fileInfoList = fileBean.getFileList(fileQuery); List<DataObject> fileInfoList = fileBean.getFileList(fileQuery);
int crdnPhotoCnt = fileInfoList.size();
if (fileInfoList != null) {
int crdnPhotoCnt = fileInfoList.size(); for (int j=0; j < fileInfoList.size(); j++) {
for (int j=0; j < fileInfoList.size(); j++) { DataObject fileInfo = fileInfoList.get(j);
DataObject fileInfo = fileInfoList.get(j);
dataObject
dataObject .set("CRDN_PHOTO"+(j+1), fileInfo.string("FILE_PATH"))
.set("CRDN_PHOTO"+(j+1), fileInfo.string("FILE_PATH")) .set("CRDN_PHOTO"+(j+1)+"KEY", fileInfo.string("FILE_ID"));
.set("CRDN_PHOTO"+(j+1)+"KEY", fileInfo.string("FILE_ID")); List<DataObject> mosSet = mediaBean.getMosaicList(fileInfo.string("FILE_ID"));
List<DataObject> mosSet = mediaBean.getMosaicList(fileInfo.string("FILE_ID")); if (mosSet != null) {
if (mosSet != null) { for (int k=0; k < mosSet.size(); k++) {
for (int k=0; k < mosSet.size(); k++) { dataObject.set("MOS"+fileInfo.string("FILE_ID"), mosSet);
dataObject.set("MOS"+fileInfo.string("FILE_ID"), mosSet);
}
} }
} }
dataObject.set("CRDN_PHOTO_CNT", crdnPhotoCnt);
} else {
dataObject.set("CRDN_PHOTO_CNT", 0);
} }
dataObject.set("CRDN_PHOTO_CNT", crdnPhotoCnt);
} }
@ -2002,10 +1993,7 @@ public class Sndb01Controller extends ApplicationController {
.setTaskSeCd(taskSeCd); .setTaskSeCd(taskSeCd);
List<DataObject> printStngItems = outsourcingStngBean.getArtclStngList(stngQuery); List<DataObject> printStngItems = outsourcingStngBean.getArtclStngList(stngQuery);
OutsourcingFileMaker osMaker = new OutsourcingFileMaker("사전통지", printOption, printStngItems, dataObjectList); Map<String, Object> result = new OutsourcingFileMaker("사전통지", printOption, printStngItems, dataObjectList).makeFile();
Map<String, Object> result = osMaker.makeFile();
return new ModelAndView("downloadView") return new ModelAndView("downloadView")
.addAllObjects(result); .addAllObjects(result);
} }
@ -2018,40 +2006,31 @@ public class Sndb01Controller extends ApplicationController {
public ModelAndView makeNoticeSheetPdf(SndbQuery req, FimsPrintOption printOption) { public ModelAndView makeNoticeSheetPdf(SndbQuery req, FimsPrintOption printOption) {
// 고지서 출력 대상 자료 조회 // 고지서 출력 대상 자료 조회
List<DataObject> list = sndngDtlService.getSndngTrgtDtlIds(req); List<DataObject> list = sndngDtlService.getSndngTrgtDtlIds(req);
String[] crdnIds = list.stream().map(row -> row.string("CRDN_ID")).toList().toArray(new String[list.size()]);
String[] crdnIds = new String[list.size()];
for (int iLoop = 0; iLoop < list.size(); iLoop++) {
crdnIds[iLoop] = list.get(iLoop).string("CRDN_ID");
}
UserInfo userInfo = currentUser(); UserInfo userInfo = currentUser();
ogdpBean.initUserInfo(userInfo); ogdpBean.initUserInfo(userInfo);
// 단속 대장 조회 // 단속 대장 조회
SprtQuery sprtQuery = new SprtQuery(); SprtQuery sprtQuery = new SprtQuery()
sprtQuery.setCrdnIds(crdnIds); .setCrdnIds(crdnIds);
List<DataObject>dataObjectList = integrationSearchMapper.selectIntegrationDataList(sprtQuery); List<DataObject>dataObjectList = integrationSearchMapper.selectIntegrationDataList(sprtQuery);
for (int i=0; i < dataObjectList.size(); i++) { for (DataObject dataObject: dataObjectList) {
DataObject dataObject = dataObjectList.get(i);
String crdnId = dataObject.string("CRDN_ID"); String crdnId = dataObject.string("CRDN_ID");
FileQuery fileQuery = new FileQuery(); FileQuery fileQuery = new FileQuery()
fileQuery.setInfoType(Crdn.INF_TYPE); .setInfoType(Crdn.INF_TYPE)
fileQuery.setInfoKeys(crdnId); .setInfoKeys(crdnId);
List<DataObject> fileInfoList = fileBean.getFileList(fileQuery); List<DataObject> fileInfoList = fileBean.getFileList(fileQuery);
if (fileInfoList != null && fileInfoList.size() > 0) { for (int j=0; j<fileInfoList.size(); j++) {
for (int j=0; j<fileInfoList.size(); j++) { DataObject fileInfo = fileInfoList.get(j);
dataObject.set("CRDN_PHOTO"+(j+1), fileInfoList.get(j).string("URL")); dataObject.set("CRDN_PHOTO"+(j+1), fileInfo.string("URL"));
dataObject.set("CRDN_PHOTO"+(j+1)+"KEY", fileInfoList.get(j).string("FILE_ID")); String fileID = fileInfo.string("FILE_ID");
dataObject.set("CRDN_PHOTO"+(j+1)+"KEY", fileID);
List<DataObject> mosSet = mediaBean.getMosaicList(fileInfoList.get(j).string("FILE_ID"));
if (mosSet != null && !mosSet.isEmpty()) { List<DataObject> mosSet = mediaBean.getMosaicList(fileID);
dataObject.set("MOS"+fileInfoList.get(j).string("FILE_ID"), mosSet); if (!isEmpty(mosSet))
} dataObject.set("MOS"+fileID, mosSet);
}
} }
} }
@ -2059,27 +2038,21 @@ public class Sndb01Controller extends ApplicationController {
print.setPrintRequestUserInfo(userInfo); print.setPrintRequestUserInfo(userInfo);
//출력물 기본 설정 //출력물 기본 설정
OtptStngQuery otptStngQuery = new OtptStngQuery();
String paperSeCd = printOption.getPaperSeCd(); String paperSeCd = printOption.getPaperSeCd();
String taskSeCd = printOption.getTaskSeCd(); String taskSeCd = printOption.getTaskSeCd();
otptStngQuery.setSggCd((String)userInfo.getInfo().get("sggCd")); OtptStngQuery otptStngQuery = new OtptStngQuery()
otptStngQuery.setTaskSeCd(taskSeCd); .setSndngSeCd("03")
otptStngQuery.setSndngSeCd("03"); .setPaperSeCd(paperSeCd)
otptStngQuery.setPaperSeCd(paperSeCd); .setSggCd((String)userInfo.getInfo().get("sggCd"))
DataObject otptBscStng = otptStngMapper.selectOtptBscStng(otptStngQuery); .setTaskSeCd(taskSeCd);
if (otptBscStng == null) { DataObject otptBscStng = ifEmpty(otptStngMapper.selectOtptBscStng(otptStngQuery), DataObject::new);
otptBscStng = new DataObject();
}
//출력 요소별 설정 //출력 요소별 설정
List<DataObject> otptArtclStngList = otptStngMapper.selectOtptArtclStngList(otptStngQuery); List<DataObject> otptArtclStngList = otptStngMapper.selectOtptArtclStngList(otptStngQuery);
DataObject sggStngInfo = stngBean.getStng("sgg"); DataObject sggStngInfo = stngBean.getStng("sgg");
DataObject deptStngInfo = stngBean.getStng("dept"); DataObject deptStngInfo = stngBean.getStng("dept");
// //
Map<String, String> globalVariable = printOption.getGlobalVariable(); Map<String, String> globalVariable = ifEmpty(printOption.getGlobalVariable(), HashMap::new);
if (globalVariable == null) {
globalVariable = new HashMap<String, String>();
}
globalVariable.put("offcsFilePath", sggStngInfo.string("OFFCS_FILE_PATH")); globalVariable.put("offcsFilePath", sggStngInfo.string("OFFCS_FILE_PATH"));
globalVariable.put("logoFilePath", sggStngInfo.string("LOGO_FILE_PATH")); globalVariable.put("logoFilePath", sggStngInfo.string("LOGO_FILE_PATH"));
globalVariable.put("instAddr", sggStngInfo.string("INST_ADDR")); globalVariable.put("instAddr", sggStngInfo.string("INST_ADDR"));
@ -2087,14 +2060,11 @@ public class Sndb01Controller extends ApplicationController {
globalVariable.put("instZip", sggStngInfo.string("INST_ZIP")); globalVariable.put("instZip", sggStngInfo.string("INST_ZIP"));
globalVariable.put("deptTelno", deptStngInfo.string("DEPT_TELNO")); globalVariable.put("deptTelno", deptStngInfo.string("DEPT_TELNO"));
globalVariable.put("deptFxno", deptStngInfo.string("DEPT_FXNO")); globalVariable.put("deptFxno", deptStngInfo.string("DEPT_FXNO"));
if (!otptBscStng.string("BCRN_IMG_PATH").equals("")) { if (!isEmpty(otptBscStng.string("BCRN_IMG_PATH"))) {
globalVariable.put("bcrnImgPath", otptBscStng.string("BCRN_IMG_PATH")); globalVariable.put("bcrnImgPath", otptBscStng.string("BCRN_IMG_PATH"));
} }
printOption.setGlobalVariable(globalVariable); printOption.setGlobalVariable(globalVariable);
Map<String, Object> result = new Nht(print,printOption,otptBscStng,otptArtclStngList,paperSeCd,dataObjectList).makeFile();
Nht pdfFormat = new Nht(print,printOption,otptBscStng,otptArtclStngList,paperSeCd,dataObjectList);
Map<String, Object> result = pdfFormat.makeFile();
return new ModelAndView("downloadView") return new ModelAndView("downloadView")
.addAllObjects(result); .addAllObjects(result);
@ -2108,54 +2078,41 @@ public class Sndb01Controller extends ApplicationController {
public ModelAndView makeNoticeSheetOutsourcing(SndbQuery req, FimsPrintOption printOption) { public ModelAndView makeNoticeSheetOutsourcing(SndbQuery req, FimsPrintOption printOption) {
// 고지서 출력 대상 자료 조회 // 고지서 출력 대상 자료 조회
List<DataObject> list = sndngDtlService.getSndngTrgtDtlIds(req); List<DataObject> list = sndngDtlService.getSndngTrgtDtlIds(req);
String[] crdnIds = list.stream().map(row -> row.string("CRDN_ID")).toList().toArray(new String[list.size()]);
String[] crdnIds = new String[list.size()];
for (int i = 0; i < list.size(); i++) {
crdnIds[i] = list.get(i).string("CRDN_ID");
}
UserInfo userInfo = currentUser(); UserInfo userInfo = currentUser();
ogdpBean.initUserInfo(userInfo); ogdpBean.initUserInfo(userInfo);
String taskSeCd = req.getTaskSeCd(); String taskSeCd = req.getTaskSeCd();
// 단속 대장 조회 // 단속 대장 조회
SprtQuery sprtQuery = new SprtQuery(); SprtQuery sprtQuery = new SprtQuery()
sprtQuery.setCrdnIds(crdnIds); .setCrdnIds(crdnIds);
List<DataObject> dataObjectList = integrationSearchMapper.selectIntegrationDataList(sprtQuery); List<DataObject> dataObjectList = integrationSearchMapper.selectIntegrationDataList(sprtQuery);
for (int i=0; i < dataObjectList.size(); i++) { for (DataObject dataObject: dataObjectList) {
DataObject dataObject = dataObjectList.get(i);
if (taskSeCd.isEmpty()) { if (taskSeCd.isEmpty()) {
taskSeCd = dataObject.string("TASK_SE_CD"); taskSeCd = dataObject.string("TASK_SE_CD");
} }
FileQuery fileQuery = new FileQuery(); FileQuery fileQuery = new FileQuery()
fileQuery.setInfoType(Crdn.INF_TYPE); .setInfoType(Crdn.INF_TYPE)
fileQuery.setInfoKeys(dataObject.string("CRDN_ID")); .setInfoKeys(dataObject.string("CRDN_ID"));
List<DataObject> fileInfoList = fileBean.getFileList(fileQuery); List<DataObject> fileInfoList = fileBean.getFileList(fileQuery);
int crdnPhotoCnt = fileInfoList.size();
if (fileInfoList != null) {
int crdnPhotoCnt = fileInfoList.size(); for (int j = 0; j < crdnPhotoCnt; j++) {
for (int j = 0; j < fileInfoList.size(); j++) { DataObject fileInfo = fileInfoList.get(j);
DataObject fileInfo = fileInfoList.get(j); dataObject.set("CRDN_PHOTO"+(j + 1), fileInfo.string("FILE_PATH"));
dataObject.set("CRDN_PHOTO"+(j + 1), fileInfo.string("FILE_PATH")); String fileID = fileInfo.string("FILE_ID");
String fileID = fileInfo.string("FILE_ID"); dataObject.set("CRDN_PHOTO"+(j + 1)+"KEY", fileID);
dataObject.set("CRDN_PHOTO"+(j + 1)+"KEY", fileID);
List<DataObject> mosSet = mediaBean.getMosaicList(fileID);
List<DataObject> mosSet = mediaBean.getMosaicList(fileID); if (mosSet != null) {
if (mosSet != null) { for (int k=0; k < mosSet.size(); k++) {
for (int k=0; k < mosSet.size(); k++) { dataObject.set("MOS"+fileID, mosSet);
dataObject.set("MOS"+fileID, mosSet);
}
} }
} }
dataObject.set("CRDN_PHOTO_CNT", crdnPhotoCnt);
} else {
dataObject.set("CRDN_PHOTO_CNT", 0);
} }
dataObject.set("CRDN_PHOTO_CNT", crdnPhotoCnt);
} }
OutsourcingStngQuery stngQuery = new OutsourcingStngQuery() OutsourcingStngQuery stngQuery = new OutsourcingStngQuery()

Loading…
Cancel
Save