견적서 기본 템플릿 수정

This commit is contained in:
2025-11-10 12:03:11 +09:00
parent c89266ec0f
commit 9aafeb3def
5 changed files with 444 additions and 69 deletions

View File

@@ -2297,4 +2297,113 @@ public class ContractMgmtController {
request.setAttribute("docTypeName", CommonUtils.checkNull(paramMap.get("docTypeName")));
return "/contractMgmt/FileRegistPopup";
}
/**
* 영업정보의 품목 목록 조회 (견적서 작성 시 사용)
*/
@RequestMapping(value="/contractMgmt/getContractItemList.do", method=RequestMethod.POST)
@ResponseBody
public Map<String, Object> getContractItemList(@RequestParam Map<String, Object> paramMap) {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
String contractObjId = CommonUtils.checkNull((String)paramMap.get("contractObjId"));
if(CommonUtils.isEmpty(contractObjId)) {
resultMap.put("result", "error");
resultMap.put("message", "영업정보 OBJID가 없습니다.");
return resultMap;
}
// 영업정보 조회 (고객사 정보 포함)
Map<String, Object> contractInfo = contractMgmtService.getContractInfo(contractObjId);
// 품목 목록 조회
List<Map<String, Object>> items = contractMgmtService.getContractItemList(contractObjId);
// 대문자로 키 변환
List<Map<String, Object>> upperItems = new ArrayList<Map<String, Object>>();
for(Map<String, Object> item : items) {
upperItems.add(CommonUtils.toUpperCaseMapKey(item));
}
resultMap.put("result", "success");
resultMap.put("items", upperItems);
// 고객사 정보 및 환율 정보 추가
if(contractInfo != null) {
Map<String, Object> upperContractInfo = CommonUtils.toUpperCaseMapKey(contractInfo);
resultMap.put("customerObjId", upperContractInfo.get("CUSTOMER_OBJID"));
resultMap.put("exchangeRate", upperContractInfo.get("EXCHANGE_RATE"));
resultMap.put("currencyName", upperContractInfo.get("CONTRACT_CURRENCY_NAME"));
}
} catch(Exception e) {
e.printStackTrace();
resultMap.put("result", "error");
resultMap.put("message", e.getMessage());
}
return resultMap;
}
/**
* 고객사 담당자 목록 조회
*/
@RequestMapping(value="/contractMgmt/getCustomerManagerList.do", method=RequestMethod.POST)
@ResponseBody
public Map<String, Object> getCustomerManagerList(@RequestParam Map<String, Object> paramMap) {
Map<String, Object> resultMap = new HashMap<String, Object>();
try {
String customerObjId = CommonUtils.checkNull((String)paramMap.get("customerObjId"));
if(CommonUtils.isEmpty(customerObjId)) {
resultMap.put("result", "error");
resultMap.put("message", "고객사 OBJID가 없습니다.");
return resultMap;
}
// 고객사 정보 조회
Map<String, Object> customerInfo = contractMgmtService.getCustomerInfo(customerObjId);
System.out.println("=== 고객사 정보 조회 결과 ===");
System.out.println("customerInfo: " + customerInfo);
if(customerInfo != null) {
List<Map<String, Object>> managers = new ArrayList<Map<String, Object>>();
// manager1 ~ manager5 추출 (소문자 키로 접근)
for(int i = 1; i <= 5; i++) {
String managerName = CommonUtils.checkNull((String)customerInfo.get("manager" + i + "_name"));
String managerEmail = CommonUtils.checkNull((String)customerInfo.get("manager" + i + "_email"));
System.out.println("manager" + i + "_name: " + managerName);
System.out.println("manager" + i + "_email: " + managerEmail);
if(!CommonUtils.isEmpty(managerName)) {
Map<String, Object> manager = new HashMap<String, Object>();
manager.put("name", managerName);
manager.put("email", managerEmail);
managers.add(manager);
}
}
System.out.println("최종 managers 개수: " + managers.size());
resultMap.put("result", "success");
resultMap.put("managers", managers);
} else {
resultMap.put("result", "success");
resultMap.put("managers", new ArrayList<Map<String, Object>>());
}
} catch(Exception e) {
e.printStackTrace();
resultMap.put("result", "error");
resultMap.put("message", e.getMessage());
}
return resultMap;
}
}