견적요청등록화면 수정
This commit is contained in:
@@ -665,7 +665,57 @@ public class ContractMgmtController {
|
||||
@RequestMapping("/contractMgmt/saveContractMgmtInfo.do")
|
||||
public String saveContractMgmtInfo(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
||||
try {
|
||||
request.setAttribute("RESULT", CommonUtils.getJsonMap(contractMgmtService.saveContractMgmtInfo(request, paramMap)) );
|
||||
// 기본 견적 정보 저장
|
||||
Map<String, Object> result = contractMgmtService.saveContractMgmtInfo(request, paramMap);
|
||||
|
||||
// 품목 데이터 처리
|
||||
if(result.get("result") != null && (Boolean)result.get("result")) {
|
||||
// 수정 시에는 paramMap의 objId 사용, 신규 시에는 result의 objId 사용
|
||||
String contractObjId = (String) result.get("objId");
|
||||
if(contractObjId == null || contractObjId.isEmpty()) {
|
||||
contractObjId = (String) paramMap.get("objId");
|
||||
}
|
||||
String itemsJsonStr = (String) paramMap.get("items_json");
|
||||
|
||||
System.out.println("=== Controller: 품목 저장 시작 ===");
|
||||
System.out.println("contractObjId: " + contractObjId);
|
||||
System.out.println("itemsJsonStr: " + (itemsJsonStr != null ? itemsJsonStr.substring(0, Math.min(100, itemsJsonStr.length())) : "null"));
|
||||
|
||||
if(contractObjId != null && itemsJsonStr != null && !itemsJsonStr.isEmpty()) {
|
||||
// JSON 파싱
|
||||
try {
|
||||
com.google.gson.Gson gson = new com.google.gson.Gson();
|
||||
java.lang.reflect.Type listType = new com.google.gson.reflect.TypeToken<List<Map<String, Object>>>(){}.getType();
|
||||
List<Map<String, Object>> itemList = gson.fromJson(itemsJsonStr, listType);
|
||||
|
||||
System.out.println("JSON 파싱 완료. itemList size: " + (itemList != null ? itemList.size() : 0));
|
||||
|
||||
// 사용자 ID 가져오기
|
||||
HttpSession session = request.getSession();
|
||||
PersonBean person = (PersonBean) session.getAttribute(Constants.PERSON_BEAN);
|
||||
String userId = person.getUserId();
|
||||
|
||||
System.out.println("userId: " + userId);
|
||||
|
||||
// 품목 저장
|
||||
Map<String, Object> itemResult = contractMgmtService.saveContractItems(contractObjId, itemList, userId);
|
||||
|
||||
System.out.println("품목 저장 결과: " + itemResult);
|
||||
|
||||
if(itemResult.get("result") == null || !(Boolean)itemResult.get("result")) {
|
||||
result.put("msg", result.get("msg") + " (단, 품목 저장 실패: " + itemResult.get("msg") + ")");
|
||||
}
|
||||
} catch(Exception je) {
|
||||
je.printStackTrace();
|
||||
System.out.println("품목 저장 중 예외 발생: " + je.getMessage());
|
||||
result.put("msg", result.get("msg") + " (단, 품목 저장 중 오류 발생: " + je.getMessage() + ")");
|
||||
}
|
||||
} else {
|
||||
System.out.println("품목 저장 건너뜀 - contractObjId: " + contractObjId + ", itemsJsonStr isEmpty: " + (itemsJsonStr == null || itemsJsonStr.isEmpty()));
|
||||
}
|
||||
}
|
||||
|
||||
request.setAttribute("RESULT", CommonUtils.getJsonMap(result));
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@@ -1649,7 +1699,9 @@ public class ContractMgmtController {
|
||||
String mechanical_type ="";//기계형식
|
||||
String overhaul_order ="";//오버홀차수
|
||||
|
||||
Map info = null;
|
||||
Map info = null;
|
||||
List<Map<String, Object>> itemList = new ArrayList<Map<String, Object>>();
|
||||
|
||||
if(paramMap.get("objId")!=null){
|
||||
paramMap.put("objId",objId);
|
||||
info = CommonUtils.keyChangeUpperMap(contractMgmtService.getContractMgmtInfo(paramMap));
|
||||
@@ -1675,6 +1727,9 @@ public class ContractMgmtController {
|
||||
target_project_no = CommonUtils.nullToEmpty((String)info.get("TARGET_PROJECT_NO"));
|
||||
mechanical_type = CommonUtils.nullToEmpty((String)info.get("MECHANICAL_TYPE"));
|
||||
overhaul_order = CommonUtils.nullToEmpty((String)info.get("OVERHAUL_ORDER"));
|
||||
|
||||
// 품목 목록 조회
|
||||
itemList = contractMgmtService.getContractItemList(objId);
|
||||
}
|
||||
|
||||
if("".equals(objId)) objId = CommonUtils.createObjId();
|
||||
@@ -1741,10 +1796,13 @@ public class ContractMgmtController {
|
||||
code_map.put("mechanical_type", commonService.bizMakeOptionList("", mechanical_type,"common.getMechanicalTypeList"));
|
||||
|
||||
|
||||
// 품번 목록은 AJAX로 검색하므로 제거
|
||||
|
||||
request.setAttribute("code_map",code_map);
|
||||
request.setAttribute("info", info);
|
||||
request.setAttribute("objId", objId);
|
||||
request.setAttribute("actionType", actionType);
|
||||
request.setAttribute("itemList", itemList); // 품목 목록 추가
|
||||
|
||||
}catch(Exception e){
|
||||
e.printStackTrace();
|
||||
@@ -1753,6 +1811,27 @@ public class ContractMgmtController {
|
||||
return "/contractMgmt/estimateRegistFormPopup";
|
||||
}
|
||||
|
||||
/**
|
||||
* 품번 검색 (AJAX용)
|
||||
*/
|
||||
@RequestMapping(value = "/contractMgmt/searchPartList.do", produces = "application/json; charset=UTF-8")
|
||||
@ResponseBody
|
||||
public List<Map<String, Object>> searchPartList(@RequestParam Map<String, Object> paramMap) {
|
||||
List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
|
||||
|
||||
try {
|
||||
resultList = contractMgmtService.searchPartList(paramMap);
|
||||
System.out.println("품번 검색 결과 개수: " + resultList.size());
|
||||
if(resultList.size() > 0) {
|
||||
System.out.println("첫번째 결과: " + resultList.get(0));
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@RequestMapping("/contractMgmt/saveEstimateInfo.do")
|
||||
public String saveEstimateInfo(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
||||
try {
|
||||
|
||||
Reference in New Issue
Block a user