우편모아 등록 파일 생성 추가

main
mjkhan21 5 months ago
parent f1f8497b4b
commit 84c8f0856d

@ -10,9 +10,7 @@ import java.io.InputStream;
import java.io.OutputStream;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
import java.text.SimpleDateFormat;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
@ -62,8 +60,7 @@ public class OutsourcingFileMaker extends AbstractBean {
}
public Map<String, Object> makeFile() {
SimpleDateFormat ymdhmsFormat = new SimpleDateFormat("yyyyMMddHHmmss");
String currentTime = ymdhmsFormat.format(new Date());
String currentTime = dateFormats.now();
String year = currentTime.substring(0, 4);
String month = currentTime.substring(4, 6);
String day = currentTime.substring(6, 8);
@ -76,7 +73,7 @@ public class OutsourcingFileMaker extends AbstractBean {
try {
String imagesFolderName = yyyymmdd + printKorName;
String metaFileName = yyyymmdd + printKorName + "(외주파일).txt";
String metaFileName = imagesFolderName + "(외주파일).txt";
String imagesFolderPath = outsourcingResultPath + File.separator + imagesFolderName;
String metaFilePath = outsourcingResultPath + File.separator + metaFileName;
@ -143,7 +140,7 @@ public class OutsourcingFileMaker extends AbstractBean {
};
//포매팅
if(!printStngItem.string("FORMATTING").equals("")) {
if (!isEmpty(printStngItem.string("FORMATTING"))) {
String formatting = printStngItem.string("FORMATTING");
switch (formatting) {
case "zip(hypen)": {
@ -226,7 +223,7 @@ public class OutsourcingFileMaker extends AbstractBean {
public Downloadable getDownloadable() {
return new Downloadable()
.setContentType("application/zip")
.setContentType(ZIP.MIME_TYPE)
.setWriter(this::write);
}
@ -250,6 +247,7 @@ public class OutsourcingFileMaker extends AbstractBean {
new PredefinedSet("ATCH_FILE_CNT", "첨부파일갯수"),
new PredefinedSet("FFNLG_CRDN_AMT", "과태료단속금액"),
new PredefinedSet("LAST_AMT", "최종금액"),
new PredefinedSet("MINUS_AMT", "감경금액"),
new PredefinedSet("RG_NO", "등기번호"),
new PredefinedSet("OCR0", "OCR0").offLog(),
new PredefinedSet("OCR0_1", "OCR0_1").offLog(),

@ -174,7 +174,7 @@ public class SnisBean extends AbstractBean {
});
// 발송대상 ID별 사전통지 생성
String now = dateFormats.format("yyyyMMddHHmmss", System.currentTimeMillis());
String now = dateFormats.now();
UserInfo currentUser = currentUser();
DataObject userInfo = userBean.getUserInfo(currentUser.getId());
return targets.stream().collect(Collectors.toMap(

@ -1,5 +1,6 @@
package cokr.xit.fims.sndb.web;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@ -10,6 +11,7 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.apache.poi.ss.usermodel.CellStyle;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;
@ -260,7 +262,7 @@ public class Sndb01Controller extends ApplicationController {
}
private String now() {
return dateFormats.format("yyyyMMddHHmmss", System.currentTimeMillis());
return dateFormats.format("yyyyMMdd_HHmmss", System.currentTimeMillis());
}
/** (sndb/sndb01/020-info) .
@ -434,6 +436,9 @@ public class Sndb01Controller extends ApplicationController {
List<?> result = sndngDtlService.getSndngDtlList(setFetchSize(req));
return setPagingInfo(new ModelAndView("jsonView"), result, "");
} else {
List<DataObject> list = sndngDtlService.getSndngDtlList(req.setFetchSize(0));
String template = req.getType();
if (isEmpty(template)) {
List<CellDef> cellDefs = fromJson(req.getCellDefs(), CellDef.listType());
XLSWriter xlsx = new XLSWriter().worksheet(0);
@ -443,8 +448,6 @@ public class Sndb01Controller extends ApplicationController {
CellStyle dateYMD = format.yyyy_mm_dd();
CellStyle dateDT = format.yyyy_mm_dd_hh_mm_ss();
List<DataObject> list = sndngDtlService.getSndngDtlList(req.setFetchSize(0));
Map<String,Object> valueMap = new HashMap<String,Object>();
valueMap.put("발송상태", format.of("SNDNG_DTL_STTS_NM").style(center));
valueMap.put("등기번호", format.of("RG_NO").style(center));
@ -477,6 +480,33 @@ public class Sndb01Controller extends ApplicationController {
return new ModelAndView("downloadView")
.addObject("download", xlsx.getDownloadable().setFilename("계고장 발송상세" + "_목록_" + now() + ".xlsx"));
} else {
try (InputStream input = new ClassPathResource("template/" + template).getInputStream()) {
int rowIndex = 1;
XLSWriter xlsx = new XLSWriter().template(input).worksheet(0);
for (DataObject row: list) {
xlsx.cell(rowIndex, 0)
.rowValues(List.of("보통", "환부", "규격", 25))
.cell(rowIndex, 4)
.rowValues(List.of(
row.get("RCPN_NM"),
row.get("RCPN_ZIP"),
row.get("RCPN_ADDR"),
row.get("RCPN_DTL_ADDR"),
ifEmpty(row.get("RTPYR_MBL_TELNO"), () -> row.get("RTPYR_TELNO")),
row.get("SNDNG_DTL_ID"),
row.get("TTL_NM"),
row.get("ETC_CN")
));
++rowIndex;
}
return new ModelAndView("downloadView")
.addObject("download", xlsx.getDownloadable().setFilename("우편등록_" + now() + ".xls"));
} catch (Exception e) {
throw runtimeException(e);
}
}
}
}

@ -213,6 +213,8 @@
, (SELECT USER_NM FROM TB_USER X WHERE X.USER_ID = SD.MDFR) AS MDFR_NM <!-- 수정자 명 -->
, C.CRDN_STTS_CD <!-- 단속 상태 코드 -->
, C.CRDN_STTS_CHG_DT <!-- 단속 상태 변경 일시 -->
, P.RTPYR_TELNO <!-- 전화번호 -->
, P.RTPYR_MBL_TELNO <!-- 휴대전화번호 -->
, S.SGG_CD <!-- 시군구 코드 -->
, S.DEPT_CD <!-- 부서 코드 -->
, S.TASK_SE_CD <!-- 업무 구분 코드 -->
@ -231,6 +233,7 @@
, S.RSND_YN <!-- 재발송 여부 -->
FROM TB_SNDNG_DTL SD
INNER JOIN TB_CRDN C ON (SD.CRDN_ID = C.CRDN_ID)
INNER JOIN TB_PAYER P ON (C.RTPYR_ID = P.RTPYR_ID)
LEFT OUTER JOIN TB_SNDNG S ON (SD.SNDNG_ID = S.SNDNG_ID)
</sql>

Loading…
Cancel
Save