품번, 품명 선택박스 select2로 변경완료
This commit is contained in:
@@ -2955,7 +2955,6 @@ public class PurchaseOrderService {
|
||||
|
||||
try {
|
||||
String targetObjId = CommonUtils.checkNull(paramMap.get("objId"));
|
||||
String pdfSessionId = CommonUtils.checkNull(paramMap.get("pdfSessionId")); // PDF 세션 ID 추가
|
||||
String toEmails = CommonUtils.checkNull(paramMap.get("toEmails"));
|
||||
String ccEmails = CommonUtils.checkNull(paramMap.get("ccEmails"));
|
||||
String subject = CommonUtils.checkNull(paramMap.get("subject"));
|
||||
@@ -2988,7 +2987,9 @@ public class PurchaseOrderService {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
String todayKor = frm.format(cal.getTime());
|
||||
String poNo = CommonUtils.checkNull((String)masterInfo.get("PURCHASE_ORDER_NO"));
|
||||
String excelName = "발주서_" + poNo + "_" + todayKor + ".xls";
|
||||
String zipName = "도면_" + poNo + "_" + todayKor + ".zip";
|
||||
masterInfo.put("EXCELFILE_NAME", excelName);
|
||||
masterInfo.put("APPR_COMPLETE_DATE", frm2.format(cal.getTime()));
|
||||
|
||||
// 발주서 테이블 내용 생성
|
||||
@@ -3028,30 +3029,11 @@ public class PurchaseOrderService {
|
||||
// 첨부파일 목록 생성
|
||||
ArrayList<HashMap> attachFileList = new ArrayList<HashMap>();
|
||||
|
||||
// 1. 발주서 PDF 파일 첨부
|
||||
if(!"".equals(pdfSessionId)) {
|
||||
File pdfFile = getPdfFromSession(pdfSessionId, poNo);
|
||||
if(pdfFile != null && pdfFile.exists()) {
|
||||
HashMap<String, String> pdfFileMap = new HashMap<String, String>();
|
||||
pdfFileMap.put(Constants.Db.COL_FILE_REAL_NAME, pdfFile.getName());
|
||||
pdfFileMap.put(Constants.Db.COL_FILE_SAVED_NAME, pdfFile.getName());
|
||||
pdfFileMap.put(Constants.Db.COL_FILE_PATH, pdfFile.getParent());
|
||||
attachFileList.add(pdfFileMap);
|
||||
System.out.println("발주서 PDF 파일 첨부 완료: " + pdfFile.getAbsolutePath());
|
||||
} else {
|
||||
System.out.println("발주서 PDF 파일을 찾을 수 없습니다: " + pdfSessionId);
|
||||
}
|
||||
}
|
||||
|
||||
/* 엑셀 첨부 주석처리 - PDF로 대체
|
||||
// 1. 발주서 엑셀 파일 첨부
|
||||
String excelName = "발주서_" + poNo + "_" + todayKor + ".xls";
|
||||
masterInfo.put("EXCELFILE_NAME", excelName);
|
||||
HashMap excelFile = this.makeMailAttachFileOrderSheet(masterInfo, contents_table);
|
||||
if(excelFile != null) {
|
||||
attachFileList.add(excelFile);
|
||||
}
|
||||
*/
|
||||
|
||||
// 2. 도면 파일 압축 첨부
|
||||
if(partFileList != null && partFileList.size() > 0) {
|
||||
@@ -3061,7 +3043,7 @@ public class PurchaseOrderService {
|
||||
hm.put(Constants.Db.COL_FILE_REAL_NAME, zf.getName());
|
||||
hm.put(Constants.Db.COL_FILE_SAVED_NAME, zf.getName());
|
||||
// 파일 경로에서 파일명을 제거하고 디렉토리 경로만 추출 (OS 독립적)
|
||||
hm.put(Constants.Db.COL_FILE_PATH, zf.getParent());
|
||||
hm.put(Constants.Db.COL_FILE_PATH, zf.getParent());
|
||||
attachFileList.add(hm);
|
||||
}
|
||||
}
|
||||
@@ -3076,8 +3058,7 @@ public class PurchaseOrderService {
|
||||
fromUser = CommonUtils.checkNull((String)masterInfo.get("WRITER"));
|
||||
}
|
||||
|
||||
// 구매팀 계정(PURCHASE) 사용
|
||||
boolean sendResult = MailUtil.sendMailWithAttachFile(fromUser, fromEmail, toUserIdList, toEmailList, ccEmailList, null, null, subject, mailContents, attachFileList, "PURCHASE_ORDER", Constants.Mail.ACCOUNT_TYPE_PURCHASE);
|
||||
boolean sendResult = MailUtil.sendMailWithAttachFile(fromUser, fromEmail, toUserIdList, toEmailList, ccEmailList, null, null, subject, mailContents, attachFileList, "PURCHASE_ORDER");
|
||||
|
||||
if(sendResult) {
|
||||
// 메일 발송 성공 시 DB 업데이트
|
||||
@@ -3138,7 +3119,6 @@ public class PurchaseOrderService {
|
||||
sb.append(userContents.replace("\n", "<br>"));
|
||||
sb.append("</div>");
|
||||
|
||||
/* 발주서 테이블 본문 표시 주석처리 - PDF 첨부로 대체
|
||||
// 구분선
|
||||
sb.append("<hr style='border: 1px solid #ddd; margin: 20px 0;'>");
|
||||
|
||||
@@ -3147,7 +3127,6 @@ public class PurchaseOrderService {
|
||||
sb.append("<h3 style='margin-bottom: 10px;'>[ 발주서 상세 ]</h3>");
|
||||
sb.append(poContentsTable);
|
||||
sb.append("</div>");
|
||||
*/
|
||||
|
||||
sb.append("<div style='margin-top: 20px; color: #666;'>※발신전용 메일입니다.</div>");
|
||||
sb.append("</body>");
|
||||
@@ -3198,45 +3177,4 @@ public class PurchaseOrderService {
|
||||
}
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
/**
|
||||
* 세션 ID로 저장된 PDF 파일 가져오기
|
||||
* @param sessionId PDF 세션 ID
|
||||
* @param poNo 발주번호 (파일명에 사용)
|
||||
* @return PDF 파일
|
||||
*/
|
||||
private File getPdfFromSession(String sessionId, String poNo) {
|
||||
try {
|
||||
String tempDir = System.getProperty("java.io.tmpdir");
|
||||
File pdfFile = new File(tempDir + File.separator + sessionId + ".pdf");
|
||||
|
||||
if(pdfFile.exists()) {
|
||||
// 발주번호로 파일명 변경
|
||||
if("".equals(poNo)) poNo = "발주서";
|
||||
|
||||
java.text.SimpleDateFormat sdf = new java.text.SimpleDateFormat("yyyyMMddHHmmss");
|
||||
String timestamp = sdf.format(new java.util.Date());
|
||||
String newFileName = "발주서_" + poNo + "_" + timestamp + ".pdf";
|
||||
File renamedFile = new File(tempDir + File.separator + newFileName);
|
||||
|
||||
// 파일 복사
|
||||
java.nio.file.Files.copy(pdfFile.toPath(), renamedFile.toPath(),
|
||||
java.nio.file.StandardCopyOption.REPLACE_EXISTING);
|
||||
|
||||
renamedFile.deleteOnExit();
|
||||
|
||||
// 원본 파일 삭제
|
||||
pdfFile.delete();
|
||||
|
||||
return renamedFile;
|
||||
}
|
||||
|
||||
return null;
|
||||
|
||||
} catch(Exception e) {
|
||||
System.out.println("PDF 파일 가져오기 중 오류: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user