|
|
|
|
@ -20,7 +20,6 @@ import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
import java.io.BufferedReader;
|
|
|
|
|
import java.io.InputStreamReader;
|
|
|
|
|
import java.time.LocalDate;
|
|
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.time.format.DateTimeFormatter;
|
|
|
|
|
import java.time.format.DateTimeParseException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
@ -285,29 +284,32 @@ public class CarFfnlgTrgtIncmpServiceImpl extends EgovAbstractServiceImpl implem
|
|
|
|
|
|
|
|
|
|
// 1번째 줄: 제목 (가운데 정렬)
|
|
|
|
|
String title = "자동차 검사 경과 안내서 대상차량 대장";
|
|
|
|
|
sb.append(padLeftBytes(title, 159, encoding)).append("\r\n");
|
|
|
|
|
sb.append(padLeftBytes(title, 106, encoding)).append("\r\n");
|
|
|
|
|
|
|
|
|
|
// 2번째 줄: 구분선 (가운데 정렬)
|
|
|
|
|
String titleLine = "---------------------------------------";
|
|
|
|
|
sb.append(padLeftBytes(titleLine, 159, encoding)).append("\r\n");
|
|
|
|
|
sb.append(padLeftBytes(titleLine, 107, encoding)).append("\r\n");
|
|
|
|
|
|
|
|
|
|
// 3번째 줄: 프로그램 ID
|
|
|
|
|
String prgrmId = vo.getPrgrmId() != null ? vo.getPrgrmId() : "VGD01B";
|
|
|
|
|
sb.append(" 프로그램 ID : ").append(prgrmId);
|
|
|
|
|
sb.append(padRightBytes("", 159 - (" 프로그램 ID : " + prgrmId).getBytes(encoding).length, encoding));
|
|
|
|
|
sb.append(padRightBytes("", 114 - (" 프로그램 ID : " + prgrmId).getBytes(encoding).length, encoding));
|
|
|
|
|
sb.append("\r\n");
|
|
|
|
|
|
|
|
|
|
// 4번째 줄: 처리일자 및 출력일시
|
|
|
|
|
String today = LocalDate.now().format(DATE_FORMATTER);
|
|
|
|
|
String todayFormatted = String.format("%s년%s월%s일", today.substring(0, 4), today.substring(4, 6), today.substring(6, 8));
|
|
|
|
|
String now = LocalDateTime.now().format(DateTimeFormatter.ofPattern("yyyy년MM월dd일HH시mm분"));
|
|
|
|
|
// 4번째 줄: 처리일자 및 출력일시 (DB 값 그대로 사용)
|
|
|
|
|
String prcsYmd = "";
|
|
|
|
|
String otptDt = "";
|
|
|
|
|
if (!list.isEmpty()) {
|
|
|
|
|
prcsYmd = nvl(list.get(0).getPrcsYmd());
|
|
|
|
|
otptDt = nvl(list.get(0).getOtptDt());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
String line4 = String.format(" 처 리 일 자 : %s~%s", todayFormatted, todayFormatted);
|
|
|
|
|
String line4Right = String.format("출 력 일 시 : %s", now);
|
|
|
|
|
String line4 = String.format(" 처 리 일 자 : %s", prcsYmd);
|
|
|
|
|
String line4Right = String.format("출 력 일 시 : %s", otptDt);
|
|
|
|
|
|
|
|
|
|
int line4LeftBytes = line4.getBytes(encoding).length;
|
|
|
|
|
int line4RightBytes = line4Right.getBytes(encoding).length;
|
|
|
|
|
int paddingBytes = 159 - line4LeftBytes - line4RightBytes;
|
|
|
|
|
int paddingBytes = 151 - line4LeftBytes - line4RightBytes;
|
|
|
|
|
|
|
|
|
|
sb.append(line4);
|
|
|
|
|
sb.append(padRightBytes("", paddingBytes, encoding));
|
|
|
|
|
@ -354,7 +356,7 @@ public class CarFfnlgTrgtIncmpServiceImpl extends EgovAbstractServiceImpl implem
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 왼쪽 패딩 (가운데 정렬 효과)
|
|
|
|
|
* 왼쪽 패딩 (문자열을 오른쪽에 배치)
|
|
|
|
|
*/
|
|
|
|
|
private static String padLeftBytes(String s, int totalByteLen, String encoding) throws Exception {
|
|
|
|
|
if (totalByteLen <= 0) return nvl(s);
|
|
|
|
|
@ -365,7 +367,7 @@ public class CarFfnlgTrgtIncmpServiceImpl extends EgovAbstractServiceImpl implem
|
|
|
|
|
return truncateToBytes(v, totalByteLen, encoding);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int paddingBytes = (totalByteLen - b.length) / 2;
|
|
|
|
|
int paddingBytes = totalByteLen - b.length;
|
|
|
|
|
StringBuilder sb = new StringBuilder();
|
|
|
|
|
|
|
|
|
|
// 왼쪽 패딩
|
|
|
|
|
@ -374,11 +376,6 @@ public class CarFfnlgTrgtIncmpServiceImpl extends EgovAbstractServiceImpl implem
|
|
|
|
|
}
|
|
|
|
|
sb.append(v);
|
|
|
|
|
|
|
|
|
|
// 오른쪽 패딩 (남은 공간 채우기)
|
|
|
|
|
while (sb.toString().getBytes(encoding).length < totalByteLen) {
|
|
|
|
|
sb.append(' ');
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return sb.toString();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|