2301 lines
93 KiB
Java
2301 lines
93 KiB
Java
/*
|
|
* ContractMgmtController
|
|
*
|
|
* 1.0
|
|
*
|
|
* 2021.10.01
|
|
*
|
|
* Copyright ions
|
|
*/
|
|
package com.pms.salesmgmt.controller;
|
|
|
|
import java.text.SimpleDateFormat;
|
|
import java.util.ArrayList;
|
|
import java.util.Calendar;
|
|
import java.util.Date;
|
|
import java.util.HashMap;
|
|
import java.util.Iterator;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpSession;
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
import com.pms.common.bean.PersonBean;
|
|
import com.pms.common.utils.CommonUtils;
|
|
import com.pms.common.utils.Constants;
|
|
import com.pms.salesmgmt.service.ContractMgmtService;
|
|
import com.pms.salesmgmt.service.SalesMgmtCommonService;
|
|
import com.pms.service.CommonService;
|
|
|
|
/**
|
|
* <pre>
|
|
* 계약관리 Controller
|
|
* </pre>
|
|
* @since 2021.10.01
|
|
* @author kim
|
|
* @version 1.0
|
|
*
|
|
* <pre>
|
|
* << 개정 이력 >>
|
|
*
|
|
* 수정일 수정자 수정내용
|
|
* ---------------- --------------------- --------------------------------------------------------
|
|
* 2021.10.01 김효일 최초작성
|
|
*
|
|
* </pre>
|
|
*
|
|
*/
|
|
@Controller
|
|
public class ContractMgmtController {
|
|
|
|
/** 계약관리 Service */
|
|
@Autowired
|
|
private ContractMgmtService contractMgmtService;
|
|
|
|
/** 영업관리 Service */
|
|
@Autowired
|
|
private SalesMgmtCommonService salesMgmtCommonService;
|
|
|
|
@Autowired
|
|
CommonService commonService;
|
|
/**
|
|
* <pre>
|
|
* 계약관리 목록 조회
|
|
* </pre>
|
|
* @param request
|
|
* @param paramMap - 계약관리 검색 정보
|
|
* @return String
|
|
*
|
|
* <pre>
|
|
* << 개정 이력 >>
|
|
*
|
|
* 수정일 수정자 수정내용
|
|
* ---------------- --------------------- ----------------------------------------------------------
|
|
* 2021.10.01 김효일 최초작성
|
|
*
|
|
* </pre>
|
|
*/
|
|
@RequestMapping(value = "/contractMgmt/contractMgmt.do", method = RequestMethod.GET)
|
|
public String getContractMgmtAll(HttpServletRequest request
|
|
, @RequestParam Map<String, Object> paramMap) {
|
|
String orderNo = request.getParameter("orderNo");
|
|
|
|
try {
|
|
List<Map<String,Object>> list = contractMgmtService.getContractMgmtAll(request, paramMap);
|
|
|
|
if (StringUtils.isBlank(orderNo) && list != null && !list.isEmpty()) {
|
|
Map<String,Object> dataMap = list.get(0);
|
|
orderNo = (String) dataMap.get("ORDERNO");
|
|
}
|
|
|
|
request.setAttribute("LIST", list);
|
|
request.setAttribute("orderNo", orderNo);
|
|
} catch(Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
|
|
return "/salesmgmt/contractMgmt/contractMgmtList";
|
|
}
|
|
|
|
/**
|
|
* <pre>
|
|
* 계약관리 상세 조회
|
|
* </pre>
|
|
* @param session
|
|
* @param request
|
|
* @param paramMap - 계약관리 검색 정보
|
|
* @return String
|
|
*
|
|
* <pre>
|
|
* << 개정 이력 >>
|
|
*
|
|
* 수정일 수정자 수정내용
|
|
* ---------------- --------------------- ----------------------------------------------------------
|
|
* 2021.10.01 김효일 최초작성
|
|
*
|
|
* </pre>
|
|
*/
|
|
@RequestMapping("/contractMgmt/contractMgmtFormPopup.do")
|
|
public String contractMgmtFormPopup(HttpSession session
|
|
, HttpServletRequest request
|
|
, @RequestParam Map<String, Object> paramMap) {
|
|
String orderNo = CommonUtils.checkNull(paramMap.get("orderNo"));
|
|
Map<String, Object> info = null;
|
|
|
|
try {
|
|
if(StringUtils.isNotBlank(orderNo)) {
|
|
// 계약관리 조회
|
|
info = contractMgmtService.getContractMgmt(paramMap);
|
|
} else {
|
|
info = new HashMap<String, Object>();
|
|
}
|
|
|
|
Map<String, Object> codeMap = new HashMap<String, Object>();
|
|
|
|
// 고객
|
|
codeMap.put("customerList",
|
|
salesMgmtCommonService.bizMakeOptionList("", (String) info.get("CUSTCD"), "salesMgmtCommon.getCustomerList"));
|
|
// 관리부서
|
|
codeMap.put("bDeptList",
|
|
salesMgmtCommonService.bizMakeOptionList("", (String) info.get("BDEPTCD"), "salesMgmtCommon.getBDeptList"));
|
|
// 제품코드
|
|
codeMap.put("goodsList",
|
|
salesMgmtCommonService.bizMakeOptionList("", (String) info.get("GOODSCD"), "salesMgmtCommon.getGoodsList"));
|
|
// 시장구분
|
|
codeMap.put("orderUnitList",
|
|
salesMgmtCommonService.bizMakeOptionList("SE", (String) info.get("ORDERUNIT"), "salesMgmtCommon.getCodeList"));
|
|
// 판매유형
|
|
codeMap.put("saleTypeList",
|
|
salesMgmtCommonService.bizMakeOptionList("GE", (String) info.get("SALETYPE"), "salesMgmtCommon.getCodeList"));
|
|
// 관리담당자
|
|
codeMap.put("bEmpList",
|
|
salesMgmtCommonService.bizMakeBEmpOptionList((String) info.get("BDEPTCD"), (String) info.get("BEMPNO")));
|
|
|
|
request.setAttribute("info", info);
|
|
request.setAttribute("codeMap", codeMap);
|
|
} catch(Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
|
|
return "/salesmgmt/contractMgmt/contractMgmtFormPopup";
|
|
}
|
|
|
|
/**
|
|
* 계약관리 저장
|
|
* @param request
|
|
* @param paramMap - 계악관리 정보
|
|
* @return
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping("/contractMgmt/saveContractMgmt.do")
|
|
public Map<String, Object> saveContractMgmt(HttpServletRequest request
|
|
, @RequestParam Map<String, Object> paramMap) {
|
|
Map<String, Object> resultMap = new HashMap<String, Object>();
|
|
|
|
try {
|
|
resultMap.put("RESULT", contractMgmtService.saveContractMgmt(request, paramMap));
|
|
} catch(Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
|
|
return resultMap;
|
|
}
|
|
|
|
/**
|
|
* 계약관리 삭제
|
|
* @param request
|
|
* @param paramMap - 계악관리 정보
|
|
* @return
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping("/contractMgmt/deleteContractMgmt.do")
|
|
public Map<String, Object> deleteContractMgmt(HttpServletRequest request
|
|
, @RequestParam Map<String, Object> paramMap) {
|
|
Map<String, Object> resultMap = new HashMap<String, Object>();
|
|
|
|
try {
|
|
resultMap.put("RESULT", contractMgmtService.deleteContractMgmt(request, paramMap));
|
|
} catch(Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
|
|
return resultMap;
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* 계약관리 리스트
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@RequestMapping("/contractMgmt/contractList.do")
|
|
public String contractList(HttpServletRequest request, @RequestParam Map paramMap){
|
|
List list = contractMgmtService.getcontractList(request,paramMap);
|
|
String actionType = CommonUtils.checkNull(paramMap.get("actionType"));
|
|
Map code_map = new HashMap();
|
|
String returnUrl ="/contractMgmt/contractList";
|
|
|
|
try{
|
|
|
|
if("excel".equals(actionType)){
|
|
returnUrl = "/contractMgmt/contractListExcel";
|
|
}
|
|
|
|
//구분
|
|
code_map.put("category_cd" , commonService.bizMakeOptionList("0000167", CommonUtils.nullToEmpty((String)paramMap.get("category_cd")) , "common.getCodeselect"));
|
|
|
|
//고객사
|
|
code_map.put("customer_cd",commonService.bizMakeOptionList("", CommonUtils.nullToEmpty((String)paramMap.get("customer_objid")),"common.getsupplyselect"));
|
|
|
|
//제품구분
|
|
code_map.put("product_cd", commonService.bizMakeOptionList("0000001", CommonUtils.nullToEmpty((String)paramMap.get("product")),"common.getCodeselect")); //공장
|
|
|
|
//진행상황
|
|
code_map.put("status_cd" , commonService.bizMakeOptionList("0000932", CommonUtils.nullToEmpty((String)paramMap.get("status_cd")) , "common.getCodeselect"));
|
|
|
|
//결과
|
|
code_map.put("result_cd", commonService.bizMakeOptionList("0000963", CommonUtils.nullToEmpty((String)paramMap.get("result_cd")), "common.getCodeselect"));
|
|
|
|
//PM
|
|
code_map.put("pm_user_id", commonService.bizMakeOptionList("", CommonUtils.nullToEmpty((String)paramMap.get("pm_user_id")), "common.getUserselect")); //구매 PM
|
|
|
|
request.setAttribute("code_map",code_map);
|
|
request.setAttribute("actionType",actionType);
|
|
request.setAttribute("LIST", list);
|
|
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}
|
|
return returnUrl;
|
|
}
|
|
|
|
/**
|
|
* 계약관리 - 계약관리 목록 페이징
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping("/contractMgmt/contractGridList.do")
|
|
public Map getProductKindSpecListPaging(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
commonService.selectListPagingNew("contractMgmt.contractGridList", request, paramMap);
|
|
return paramMap;
|
|
}
|
|
|
|
/**
|
|
* 계약관리 리스트 (페이징 처리)
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping("/contractMgmt/getPagingContractList.do")
|
|
public Map getPagingContractList(HttpServletRequest request, @RequestParam Map paramMap){
|
|
List list = new ArrayList();
|
|
|
|
Map pageMap = new HashMap();
|
|
|
|
String actionType = CommonUtils.checkNull(paramMap.get("actionType"));
|
|
Map code_map = new HashMap();
|
|
|
|
String returnUrl ="/contractMgmt/contractList";
|
|
|
|
try{
|
|
if("excel".equals(actionType)){
|
|
returnUrl = "/contractMgmt/contractListExcel";
|
|
}
|
|
String countPerPage = CommonUtils.checkNull(request.getParameter("COUNT_PER_PAGE"), ""+Constants.COUNT_PER_PAGE+"");
|
|
|
|
pageMap = contractMgmtService.getContractListCnt(request, paramMap);
|
|
pageMap = (HashMap)CommonUtils.setPagingInfo(request, pageMap, countPerPage);
|
|
|
|
paramMap.put("PAGE_END", CommonUtils.checkNull(pageMap.get("PAGE_END")));
|
|
paramMap.put("PAGE_START", CommonUtils.checkNull(pageMap.get("PAGE_START")));
|
|
|
|
//구분
|
|
code_map.put("category_cd" , commonService.bizMakeOptionList("0000167", CommonUtils.nullToEmpty((String)paramMap.get("category_cd")) , "common.getCodeselect"));
|
|
|
|
//고객사
|
|
code_map.put("customer_cd",commonService.bizMakeOptionList("", CommonUtils.nullToEmpty((String)paramMap.get("customer_objid")),"common.getsupplyselect"));
|
|
|
|
//제품구분
|
|
code_map.put("product_cd", commonService.bizMakeOptionList("0000001", CommonUtils.nullToEmpty((String)paramMap.get("product")),"common.getCodeselect")); //공장
|
|
|
|
//진행상황
|
|
code_map.put("status_cd" , commonService.bizMakeOptionList("0000932", CommonUtils.nullToEmpty((String)paramMap.get("status_cd")) , "common.getCodeselect"));
|
|
|
|
//결과
|
|
code_map.put("result_cd", commonService.bizMakeOptionList("0000963", CommonUtils.nullToEmpty((String)paramMap.get("result_cd")), "common.getCodeselect"));
|
|
|
|
//PM
|
|
code_map.put("pm_user_id", commonService.bizMakeOptionList("", CommonUtils.nullToEmpty((String)paramMap.get("pm_user_id")), "common.getUserselect")); //구매 PM
|
|
|
|
list = contractMgmtService.getcontractList(request,paramMap);
|
|
request.setAttribute("code_map",code_map);
|
|
|
|
pageMap.put("resultList", list);
|
|
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}
|
|
return pageMap;
|
|
}
|
|
|
|
/*public String ordermgmtUpdateFormPopup(HttpSession session, HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
|
|
String objId = CommonUtils.checkNull(paramMap.get("objId"));
|
|
String actionType = CommonUtils.checkNull(paramMap.get("actionType"));
|
|
Map code_map = new HashMap();
|
|
try{
|
|
// 영업활동 조회
|
|
Map info = null;
|
|
|
|
if(paramMap.get("objId")!=null){
|
|
paramMap.put("objId",Integer.parseInt(objId));
|
|
info = CommonUtils.keyChangeUpperMap(contractMgmtService.getContractMgmtInfo(paramMap));
|
|
|
|
//제품군1
|
|
code_map.put("product_group",commonService.bizMakeOptionList("0000001", (String)info.get("PRODUCT_GROUP"),"common.getCodeselect")); //
|
|
|
|
//제품군2
|
|
code_map.put("product_group1",commonService.bizMakeOptionList("0000001", (String)info.get("PRODUCT_GROUP1"),"common.getCodeselect")); //
|
|
|
|
//제품군3
|
|
code_map.put("product_group2",commonService.bizMakeOptionList("0000001", (String)info.get("PRODUCT_GROUP2"),"common.getCodeselect")); //
|
|
|
|
|
|
//차량1
|
|
code_map.put("vechile_cd",commonService.bizMakeOptionList("0000035", (String)info.get("VECHILE_CD"),"common.getCodeselect")); //
|
|
|
|
//차량2
|
|
code_map.put("vechile_cd1",commonService.bizMakeOptionList("0000035", (String)info.get("VECHILE_CD1"),"common.getCodeselect")); //
|
|
|
|
//차량3
|
|
code_map.put("vechile_cd2",commonService.bizMakeOptionList("0000035", (String)info.get("VECHILE_CD2"),"common.getCodeselect")); //
|
|
|
|
|
|
|
|
|
|
//프로젝트 구분
|
|
code_map.put("project_division",commonService.bizMakeOptionList("PND10000", CommonUtils.nullToEmpty((String)info.get("PROJECT_DIVISION")),"common.getCodeselect")); //고객사
|
|
//제품군
|
|
code_map.put("plant_cd",commonService.bizMakeOptionList("PLA10000", CommonUtils.nullToEmpty((String)info.get("PLANT_CD")),"common.getCodeselect")); //공장
|
|
|
|
code_map.put("region_cd",commonService.bizMakeOptionList(Constants.REGION_H_CD, CommonUtils.nullToEmpty((String)info.get("REGION_CD")),"common.getCodeselect")); //지역
|
|
|
|
//PM
|
|
code_map.put("manager_pm", commonService.bizMakeOptionList("", CommonUtils.nullToEmpty((String)info.get("MANAGER_PM")),"common.getUserselect"));
|
|
|
|
//설계 PM
|
|
code_map.put("design_pm", commonService.bizMakeOptionList("", CommonUtils.nullToEmpty((String)info.get("DESIGN_PM")),"common.getUserselect"));
|
|
|
|
//구매 PM
|
|
code_map.put("se_pm", commonService.bizMakeOptionList("", CommonUtils.nullToEmpty((String)info.get("SE_PM")),"common.getUserselect"));
|
|
|
|
//생산 PM
|
|
code_map.put("production_pm", commonService.bizMakeOptionList("", CommonUtils.nullToEmpty((String)info.get("PRODUCTION_PM")),"common.getUserselect"));
|
|
//수주결과
|
|
code_map.put("result_cd",commonService.bizMakeOptionList(Constants.RESULT_CD, CommonUtils.nullToEmpty((String)info.get("RESULT_CD")),"common.getCodeselect")); //수주결과
|
|
|
|
code_map.put("project_derivation_no",commonService.bizMakeOptionList("", (String)info.get("PROJECT_DERIVATION_NO"),"common.getProjectNoselect"));
|
|
|
|
}else{
|
|
//구분
|
|
code_map.put("order_cd",commonService.bizMakeOptionList(Constants.REGION_H_CD, "","common.getCodeselect")); //지역
|
|
//거래처
|
|
code_map.put("customer_cd",commonService.bizMakeOptionList(Constants.CUSTOMER_CD, "","common.getCodeselect")); //고객사
|
|
|
|
//프로젝트 구분
|
|
code_map.put("project_division",commonService.bizMakeOptionList("PND10000", "","common.getCodeselect")); //고객사
|
|
//제품군
|
|
code_map.put("plant_cd",commonService.bizMakeOptionList("PLA10000", "","common.getCodeselect")); //공장
|
|
|
|
code_map.put("region_cd",commonService.bizMakeOptionList(Constants.REGION_H_CD, "","common.getCodeselect")); //지역
|
|
|
|
//PM
|
|
code_map.put("manager_pm", commonService.bizMakeOptionList("", "","common.getUserselect"));
|
|
|
|
//설계 PM
|
|
code_map.put("design_pm", commonService.bizMakeOptionList("", "","common.getUserselect"));
|
|
|
|
//구매 PM
|
|
code_map.put("se_pm", commonService.bizMakeOptionList("", "","common.getUserselect"));
|
|
|
|
//생산 PM
|
|
code_map.put("production_pm", commonService.bizMakeOptionList("", "","common.getUserselect"));
|
|
//수주결과
|
|
code_map.put("result_cd",commonService.bizMakeOptionList(Constants.RESULT_CD, "","common.getCodeselect")); //수주결과
|
|
|
|
code_map.put("project_derivation_no",commonService.bizMakeOptionList("", "","common.getProjectNoselect"));
|
|
|
|
}
|
|
//차종별 프로젝트 수주활동 object id
|
|
if("".equals(objId)) objId = CommonUtils.createObjId();
|
|
|
|
request.setAttribute("code_map",code_map);
|
|
request.setAttribute("info", info);
|
|
request.setAttribute("objId", objId);
|
|
request.setAttribute("actionType", actionType);
|
|
|
|
|
|
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
|
|
String writer = CommonUtils.checkNull(person.getUserId());
|
|
request.setAttribute("writer", writer);
|
|
|
|
//프로젝트에서 팝업을 열었을 때는 PM만 수정가능하도록 해야함
|
|
//권한을 위한 파라미터 값
|
|
if(paramMap.get("managerPm")!= null){
|
|
Map projectPmMap = new HashMap();
|
|
projectPmMap.put("managerPm", paramMap.get("managerPm"));
|
|
request.setAttribute("projectPmId", projectPmMap);
|
|
}
|
|
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}
|
|
|
|
return "/contractMgmt/contracMgmtFormPopup";
|
|
}*/
|
|
/**
|
|
* 수주활동 수정 Form
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
|
@RequestMapping("/contractMgmt/contracMgmtFormPopup.do")
|
|
public String ordermgmtUpdateFormPopup(HttpSession session, HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
String objId = CommonUtils.checkNull(paramMap.get("objId"));
|
|
String actionType = CommonUtils.checkNull(paramMap.get("actionType"));
|
|
Map code_map = new HashMap();
|
|
ArrayList list = new ArrayList();
|
|
|
|
try{
|
|
String category_cd = ""; //구분
|
|
String customer_cd = ""; //고객사
|
|
String product_cd = ""; //제품구분
|
|
String status_cd = ""; //진행상황
|
|
String facility = ""; //설비방향
|
|
String bus_cal_cd = ""; //영업구분
|
|
String category1_cd = ""; //구분1
|
|
String result_cd = ""; //수주결과
|
|
String pm_user_id =""; //PM
|
|
String chg_user_id ="";//담당자
|
|
String contract_result ="";//검토결과
|
|
String contract_company ="";//수주회사
|
|
String manufacture_plant ="";//제작공장
|
|
String spec_user_id ="";//사양담당자
|
|
String spec_result_cd ="";//사양결과
|
|
String est_user_id ="";//제작공장
|
|
String est_result_cd ="";//제작공장
|
|
String area_cd ="";//제작공장
|
|
String contract_currency ="";//통화
|
|
String target_project_no ="";//대상프로젝트번호
|
|
String mechanical_type ="";//기계형식
|
|
String overhaul_order ="";//오버홀차수
|
|
|
|
Map info = null;
|
|
if(paramMap.get("objId")!=null){
|
|
paramMap.put("objId",objId);
|
|
info = CommonUtils.keyChangeUpperMap(contractMgmtService.getContractMgmtInfo(paramMap));
|
|
category_cd = CommonUtils.nullToEmpty((String)info.get("CATEGORY_CD"));
|
|
customer_cd = CommonUtils.nullToEmpty((String)info.get("CUSTOMER_OBJID"));
|
|
product_cd = CommonUtils.nullToEmpty((String)info.get("PRODUCT"));
|
|
status_cd = CommonUtils.nullToEmpty((String)info.get("STATUS_CD"));
|
|
facility = CommonUtils.nullToEmpty((String)info.get("FACILITY"));
|
|
bus_cal_cd = CommonUtils.nullToEmpty((String)info.get("BUS_CAL_CD"));
|
|
category1_cd = CommonUtils.nullToEmpty((String)info.get("CATEGORY1_CD"));
|
|
result_cd = CommonUtils.nullToEmpty((String)info.get("RESULT_CD"));
|
|
pm_user_id= CommonUtils.nullToEmpty((String)info.get("PM_USER_ID"));
|
|
chg_user_id= CommonUtils.nullToEmpty((String)info.get("CHG_USER_ID"));
|
|
contract_result = CommonUtils.nullToEmpty((String)info.get("CONTRACT_RESULT"));
|
|
contract_company = CommonUtils.nullToEmpty((String)info.get("CONTRACT_COMPANY"));
|
|
manufacture_plant = CommonUtils.nullToEmpty((String)info.get("MANUFACTURE_PLANT"));
|
|
spec_result_cd = CommonUtils.nullToEmpty((String)info.get("SPEC_RESULT_CD"));
|
|
spec_user_id = CommonUtils.nullToEmpty((String)info.get("SPEC_USER_ID"));
|
|
est_user_id = CommonUtils.nullToEmpty((String)info.get("EST_USER_ID"));
|
|
est_result_cd = CommonUtils.nullToEmpty((String)info.get("EST_RESULT_CD"));
|
|
area_cd = CommonUtils.nullToEmpty((String)info.get("AREA_CD"));
|
|
contract_currency = CommonUtils.nullToEmpty((String)info.get("CONTRACT_CURRENCY"));
|
|
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"));
|
|
}
|
|
|
|
if("".equals(objId)) objId = CommonUtils.createObjId();
|
|
|
|
|
|
//구분
|
|
code_map.put("category_cd" , commonService.bizMakeOptionList("0000167", category_cd , "common.getCodeselect"));
|
|
|
|
//고객사
|
|
code_map.put("customer_cd",commonService.bizMakeOptionList("", customer_cd,"common.getsupplyselect"));
|
|
|
|
//제품구분
|
|
code_map.put("product_cd", commonService.bizMakeOptionList("0000001", product_cd,"common.getCodeselect")); //공장
|
|
|
|
//진행상황
|
|
code_map.put("status_cd" , commonService.bizMakeOptionList("0000932", status_cd , "common.getCodeselect"));
|
|
|
|
//설비방향
|
|
code_map.put("facility" , commonService.bizMakeOptionList("0000959", facility , "common.getCodeselect"));
|
|
|
|
//영업구분
|
|
code_map.put("bus_cal_cd" , commonService.bizMakeOptionList("0000967", bus_cal_cd , "common.getCodeselect"));
|
|
|
|
//구분1
|
|
//code_map.put("category1_cd", commonService.bizMakeOptionList("0000942", category1_cd, "common.getCodeselect"));
|
|
|
|
//검토결과
|
|
code_map.put("result_cd", commonService.bizMakeOptionList("0001107", result_cd, "common.getCodeselect"));
|
|
|
|
//검토결과
|
|
code_map.put("spec_result_cd", commonService.bizMakeOptionList("0001107", spec_result_cd, "common.getCodeselect"));
|
|
|
|
//검토결과
|
|
code_map.put("est_result_cd", commonService.bizMakeOptionList("0001107", est_result_cd, "common.getCodeselect"));
|
|
|
|
//계약담당자
|
|
code_map.put("chg_user_id", commonService.bizMakeOptionList("", chg_user_id, "common.getUserselect")); //구매 PM
|
|
|
|
//계약담당자
|
|
code_map.put("spec_user_id", commonService.bizMakeOptionList("", spec_user_id, "common.getUserselect")); //구매 PM
|
|
|
|
//계약담당자
|
|
code_map.put("est_user_id", commonService.bizMakeOptionList("", est_user_id, "common.getUserselect")); //구매 PM
|
|
|
|
//PM
|
|
code_map.put("pm_user_id", commonService.bizMakeOptionList("", pm_user_id, "common.getUserselect")); //구매 PM
|
|
|
|
//수주결과
|
|
code_map.put("contract_result", commonService.bizMakeOptionList("0000963", contract_result, "common.getCodeselect"));
|
|
|
|
//수주회사
|
|
code_map.put("contract_company", commonService.bizMakeOptionList("0001098", contract_company, "common.getCodeselect"));
|
|
|
|
//제작공장
|
|
code_map.put("manufacture_plant", commonService.bizMakeOptionList("0001101", manufacture_plant, "common.getCodeselect"));
|
|
|
|
//해외.국내
|
|
code_map.put("area_cd", commonService.bizMakeOptionList("0001219", area_cd, "common.getCodeselect"));
|
|
//통화
|
|
code_map.put("contract_currency", commonService.bizMakeOptionList("0001533", contract_currency, "common.getCodeselect"));
|
|
//당사프로젟트번호
|
|
code_map.put("project_no",commonService.bizMakeOptionList("", target_project_no,"common.getCusProjectNoList"));
|
|
//기계형식
|
|
code_map.put("mechanical_type", commonService.bizMakeOptionList("", mechanical_type,"common.getMechanicalTypeList"));
|
|
|
|
|
|
request.setAttribute("code_map",code_map);
|
|
request.setAttribute("info", info);
|
|
request.setAttribute("objId", objId);
|
|
request.setAttribute("actionType", actionType);
|
|
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}
|
|
|
|
return "/contractMgmt/contracMgmtFormPopup";
|
|
}
|
|
/**
|
|
* 검토내용 수정 Form
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
|
@RequestMapping("/contractMgmt/contracMgmtReviewFormPopup.do")
|
|
public String contracMgmtReviewFormPopup(HttpSession session, HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
String objId = CommonUtils.checkNull(paramMap.get("objId"));
|
|
String actionType = CommonUtils.checkNull(paramMap.get("actionType"));
|
|
Map code_map = new HashMap();
|
|
ArrayList list = new ArrayList();
|
|
|
|
try{
|
|
String pm_user_id =""; //PM
|
|
String chg_user_id ="";//담당자
|
|
String spec_user_id ="";//사양담당자
|
|
String spec_result_cd ="";//사양결과
|
|
String est_user_id ="";//제작공장
|
|
String est_result_cd ="";//제작공장
|
|
String contract_result ="";//검토결과
|
|
String result_cd = ""; //수주결과
|
|
|
|
Map info = null;
|
|
if(paramMap.get("objId")!=null){
|
|
paramMap.put("objId",objId);
|
|
info = CommonUtils.keyChangeUpperMap(contractMgmtService.getContractMgmtInfo(paramMap));
|
|
|
|
est_user_id = CommonUtils.nullToEmpty((String)info.get("EST_USER_ID"));
|
|
pm_user_id= CommonUtils.nullToEmpty((String)info.get("PM_USER_ID"));
|
|
chg_user_id= CommonUtils.nullToEmpty((String)info.get("CHG_USER_ID"));
|
|
spec_user_id = CommonUtils.nullToEmpty((String)info.get("SPEC_USER_ID"));
|
|
result_cd = CommonUtils.nullToEmpty((String)info.get("RESULT_CD"));
|
|
est_result_cd = CommonUtils.nullToEmpty((String)info.get("EST_RESULT_CD"));
|
|
spec_result_cd = CommonUtils.nullToEmpty((String)info.get("SPEC_RESULT_CD"));
|
|
contract_result = CommonUtils.nullToEmpty((String)info.get("CONTRACT_RESULT"));
|
|
}
|
|
|
|
if("".equals(objId)) objId = CommonUtils.createObjId();
|
|
|
|
//계약담당자
|
|
code_map.put("chg_user_id", commonService.bizMakeOptionList("", chg_user_id, "common.getUserselect")); //구매 PM
|
|
|
|
//계약담당자
|
|
code_map.put("spec_user_id", commonService.bizMakeOptionList("", spec_user_id, "common.getUserselect")); //구매 PM
|
|
|
|
//계약담당자
|
|
code_map.put("est_user_id", commonService.bizMakeOptionList("", est_user_id, "common.getUserselect")); //구매 PM
|
|
|
|
//PM
|
|
code_map.put("pm_user_id", commonService.bizMakeOptionList("", pm_user_id, "common.getUserselect")); //구매 PM
|
|
|
|
//수주결과
|
|
code_map.put("contract_result", commonService.bizMakeOptionList("0000963", contract_result, "common.getCodeselect"));
|
|
//검토결과
|
|
code_map.put("est_result_cd", commonService.bizMakeOptionList("0001107", est_result_cd, "common.getCodeselect"));
|
|
//검토결과
|
|
code_map.put("spec_result_cd", commonService.bizMakeOptionList("0001107", spec_result_cd, "common.getCodeselect"));
|
|
//검토결과
|
|
code_map.put("result_cd", commonService.bizMakeOptionList("0001107", result_cd, "common.getCodeselect"));
|
|
|
|
request.setAttribute("code_map",code_map);
|
|
request.setAttribute("info", info);
|
|
request.setAttribute("objId", objId);
|
|
request.setAttribute("actionType", actionType);
|
|
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}
|
|
|
|
return "/contractMgmt/contracMgmtReviewFormPopup";
|
|
}
|
|
|
|
@RequestMapping("/contractMgmt/saveContractMgmtInfo.do")
|
|
public String saveContractMgmtInfo(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
try {
|
|
// 기본 견적 정보 저장
|
|
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();
|
|
}
|
|
return "/ajax/ajaxResult";
|
|
}
|
|
|
|
/**
|
|
* 차수 중복확인
|
|
*/
|
|
@RequestMapping("/contractMgmt/overlapOrder.do")
|
|
public String overlapPartMngCheck(HttpSession session, HttpServletRequest request, @RequestParam Map paramMap){
|
|
List list = contractMgmtService.overlapOrder(request, paramMap);
|
|
request.setAttribute("RESULT", CommonUtils.getJsonArray(list));
|
|
return "/ajax/ajaxResult";
|
|
}
|
|
|
|
@RequestMapping("/contractMgmt/saveContractMgmtReviewInfo.do")
|
|
public String saveContractMgmtReviewInfo(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
try {
|
|
request.setAttribute("RESULT", CommonUtils.getJsonMap(contractMgmtService.saveContractMgmtReviewInfo(request, paramMap)) );
|
|
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
return "/ajax/ajaxResult";
|
|
}
|
|
|
|
/**
|
|
* 고객사 목록을 가져온다.
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@RequestMapping("/contractMgmt/supplyMngPagingList.do")
|
|
public String getSUPPLYInfoListPaging(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
ArrayList<HashMap<String, Object>> supplyInfoList = new ArrayList();
|
|
Map code_map = new HashMap();
|
|
ArrayList list = new ArrayList();
|
|
ArrayList<HashMap<String, Object>> newList = new ArrayList();
|
|
String Html="";
|
|
|
|
StringBuffer chart1SC = new StringBuffer();
|
|
StringBuffer chart2SC = new StringBuffer();
|
|
String actionType = CommonUtils.checkNull(paramMap.get("actionType"));
|
|
try{
|
|
|
|
//구분
|
|
code_map.put("supply_code",commonService.bizMakeOptionList("0001093", CommonUtils.checkNull(paramMap.get("supply_code")),"common.getCodeselect"));
|
|
//지역명
|
|
code_map.put("area_cd",commonService.bizMakeOptionList("0000172",CommonUtils.checkNull( paramMap.get("area_cd")),"common.getCodeselect"));
|
|
|
|
|
|
supplyInfoList = (ArrayList)contractMgmtService.getSUPPLYInfoListPaging(request, paramMap);
|
|
|
|
|
|
StringBuilder htmlBuilder = new StringBuilder();
|
|
htmlBuilder.append("<table>");
|
|
for (HashMap<String, Object> map : supplyInfoList) {
|
|
Iterator<String> it = map.keySet().iterator();
|
|
Map<String, String> newMap = new HashMap<>();
|
|
htmlBuilder.append("<tr>");
|
|
while (it.hasNext()) {
|
|
String key = CommonUtils.checkNull((String) it.next());
|
|
htmlBuilder.append("<td>");
|
|
htmlBuilder.append(map.get(key));
|
|
htmlBuilder.append("</td>");
|
|
}
|
|
htmlBuilder.append("</tr>");
|
|
}
|
|
htmlBuilder.append("</table>");
|
|
|
|
|
|
Html+="<table border='2'>";
|
|
Html+="<tr>";
|
|
Html+="<td>";
|
|
Html+="고객번호";
|
|
Html+="</td>";
|
|
Html+="<td>";
|
|
Html+="고객구분";
|
|
Html+="</td>";
|
|
Html+="<td>";
|
|
Html+="지역";
|
|
Html+="</td>";
|
|
Html+="<td>";
|
|
Html+="고객사";
|
|
Html+="</td>";
|
|
Html+="<td>";
|
|
Html+="대표자명";
|
|
Html+="</td>";
|
|
Html+="</tr>";
|
|
|
|
if(supplyInfoList.size() > 0 ){
|
|
|
|
for(int i=0;i<supplyInfoList.size();i++){
|
|
|
|
HashMap supplyMap = (HashMap)supplyInfoList.get(i);
|
|
Html+="<tr>";
|
|
Html+="<td>";
|
|
Html+=supplyMap.get("CUS_NO");
|
|
Html+="</td>";
|
|
Html+="<td>";
|
|
Html+=supplyMap.get("SUPPLY_CODE_NAME");
|
|
Html+="</td>";
|
|
Html+="<td>";
|
|
Html+=supplyMap.get("AREA_CD_NAME");
|
|
Html+="</td>";
|
|
Html+="<td>";
|
|
Html+=supplyMap.get("SUPPLY_NAME");
|
|
Html+="</td>";
|
|
Html+="<td>";
|
|
Html+=supplyMap.get("REG_ID");
|
|
Html+="</td>";
|
|
Html+="</tr>";
|
|
}
|
|
|
|
Html +="</table>";
|
|
}
|
|
|
|
for (Map<String, Object> map : supplyInfoList) {
|
|
Iterator<String> it = map.keySet().iterator();
|
|
HashMap<String, Object> newMap = new HashMap<>();
|
|
while (it.hasNext()) {
|
|
String key = CommonUtils.checkNull((String) it.next());
|
|
if("SUPPLY_TEL_NO".equals(key)){
|
|
if("CHART".equals(map.get(key))){
|
|
newMap.put(key, Html);
|
|
}else{
|
|
newMap.put(key, map.get(key));
|
|
}
|
|
}else{
|
|
newMap.put(key, map.get(key));
|
|
}
|
|
}
|
|
newList.add(newMap);
|
|
}
|
|
|
|
String title="차트제목 차트제목";
|
|
//==========================================================
|
|
chart1SC.append("<script type=\"text/javascript\"> ");
|
|
chart1SC.append("rMateChartH5.create(\"chart1\", \"chart1Holder\", \"\", \"100%\", \"100%\"); ");
|
|
chart1SC.append("var layoutStr = ");
|
|
chart1SC.append("'<rMateChart backgroundColor=\"#FFFFFF\" borderStyle=\"none\">' ");
|
|
chart1SC.append("+'<Options>' ");
|
|
chart1SC.append(" +'<Caption text=\""+title+"\" fontSize=\"20\"/>' ");
|
|
chart1SC.append(" +'<SubCaption text=\""+title+"\" textAlign=\"center\"/>' ");
|
|
chart1SC.append(" +'<Legend/>' ");
|
|
chart1SC.append("+'</Options>' ");
|
|
chart1SC.append("+'<SeriesInterpolate id=\"ss\"/>' ");
|
|
chart1SC.append("+'<Column2DChart showDataTips=\"true\" selectionMode=\"multiple\" columnWidthRatio=\"0.48\" >'");
|
|
chart1SC.append(" +'<horizontalAxis>' ");
|
|
chart1SC.append(" +'<CategoryAxis categoryField=\"COUNTRY\"/>' ");
|
|
chart1SC.append(" +'</horizontalAxis>' ");
|
|
chart1SC.append(" +'<verticalAxis>' ");
|
|
chart1SC.append(" +'<LinearAxis maximum=\"100\" interval=\"10\" />' ");
|
|
chart1SC.append(" +'</verticalAxis>' ");
|
|
chart1SC.append(" +'<series>' ");
|
|
chart1SC.append(" +'<Column2DSeries labelPosition=\"outside\" yField=\"GDP\" displayName=\"GDP Growth (In %)\" showDataEffect=\"{ss}\" showValueLabels=\"[4]\" strokeJsFunction=\"strokeFunction\" />' ");
|
|
chart1SC.append(" +'</series>' ");
|
|
chart1SC.append("+'</Column2DChart>' ");
|
|
chart1SC.append("+'</rMateChart>'; ");
|
|
chart1SC.append("var chartData = "+commonService.getJsonSqlInfoList("contractMgmt.batbat_barChart", paramMap)+";");
|
|
chart1SC.append("function strokeFunction(id, index, data, values){ ");
|
|
chart1SC.append(" if(values[0] == \"Paraguay\") ");
|
|
chart1SC.append(" return { ");
|
|
chart1SC.append(" color : \"#000\", ");
|
|
chart1SC.append(" weight : 2 ");
|
|
chart1SC.append(" }; ");
|
|
chart1SC.append("} ");
|
|
chart1SC.append("rMateChartH5.calls(\"chart1\", { ");
|
|
chart1SC.append("\"setLayout\" : layoutStr, ");
|
|
chart1SC.append("\"setData\" : chartData ");
|
|
chart1SC.append("}); ");
|
|
chart1SC.append("rMateChartH5.registerTheme(rMateChartH5.themes); ");
|
|
chart1SC.append("function rMateChartH5ChangeTheme(theme){ ");
|
|
chart1SC.append(" document.getElementById(\"chart1\").setTheme(theme); ");
|
|
chart1SC.append("} ");
|
|
chart1SC.append("</script> ");
|
|
|
|
|
|
//==========================================================
|
|
chart2SC.append("<script type=\"text/javascript\"> ");
|
|
chart2SC.append("rMateChartH5.create(\"chart2\", \"chart2Holder\", \"\", \"100%\", \"100%\"); ");
|
|
chart2SC.append("var layoutStr2 = ");
|
|
chart2SC.append("'<rMateChart backgroundColor=\"#FFFFFF\" borderStyle=\"none\">' ");
|
|
chart2SC.append("+'<Options>' ");
|
|
chart2SC.append(" +'<Caption text=\""+title+"\" fontSize=\"20\"/>' ");
|
|
chart2SC.append(" +'<SubCaption text=\""+title+"\" textAlign=\"center\"/>' ");
|
|
chart2SC.append(" +'<Legend/>' ");
|
|
chart2SC.append("+'</Options>' ");
|
|
chart2SC.append("+'<NumberFormatter id=\"nft\" precision=\"2\"/>' ");
|
|
chart2SC.append("+'<Line2DChart showDataTips=\"true\" dataTipFormatter=\"{nft}\">' ");
|
|
chart2SC.append(" +'<horizontalAxis>' ");
|
|
chart2SC.append(" +'<CategoryAxis id=\"hAxis\" categoryField=\"YEAR\"/>' ");
|
|
chart2SC.append(" +'</horizontalAxis>' ");
|
|
chart2SC.append(" +'<verticalAxis>' ");
|
|
chart2SC.append(" +'<LinearAxis id=\"vAxis\" title=\"Temperature Anomaly (℃)\"/>' ");
|
|
chart2SC.append(" +'</verticalAxis>' ");
|
|
chart2SC.append(" +'<series>' ");
|
|
chart2SC.append(" +'<Line2DSeries yField=\"ANNUAL\" displayName=\"Annual Mean\">' ");
|
|
chart2SC.append(" +'<showDataEffect>' ");
|
|
chart2SC.append(" +'<SeriesClip duration=\"1000\"/>' ");
|
|
chart2SC.append(" +'</showDataEffect>' ");
|
|
chart2SC.append(" +'</Line2DSeries>' ");
|
|
chart2SC.append(" +'<Line2DSeries yField=\"FIVE\" displayName=\"5 Year Mean\">' ");
|
|
chart2SC.append(" +'<showDataEffect>' ");
|
|
chart2SC.append(" +'<SeriesClip duration=\"1000\"/>' ");
|
|
chart2SC.append(" +'</showDataEffect>' ");
|
|
chart2SC.append(" +'</Line2DSeries>' ");
|
|
chart2SC.append(" +'</series>' ");
|
|
chart2SC.append("+'</Line2DChart>' ");
|
|
chart2SC.append("+'</rMateChart>'; ");
|
|
chart2SC.append("var chartData2 = "+commonService.getJsonSqlInfoList("contractMgmt.batbat_lineChart", paramMap)+";");
|
|
chart2SC.append("function strokeFunction(id, index, data, values){ ");
|
|
chart2SC.append(" if(values[0] == \"Paraguay\") ");
|
|
chart2SC.append(" return { ");
|
|
chart2SC.append(" color : \"#000\", ");
|
|
chart2SC.append(" weight : 2 ");
|
|
chart2SC.append(" }; ");
|
|
chart2SC.append("} ");
|
|
chart2SC.append("rMateChartH5.calls(\"chart2\", { ");
|
|
chart2SC.append("\"setLayout\" : layoutStr2, ");
|
|
chart2SC.append("\"setData\" : chartData2 ");
|
|
chart2SC.append("}); ");
|
|
chart2SC.append("rMateChartH5.registerTheme(rMateChartH5.themes); ");
|
|
chart2SC.append("function rMateChartH5ChangeTheme(theme){ ");
|
|
chart2SC.append(" document.getElementById(\"chart2\").setTheme(theme); ");
|
|
chart2SC.append("} ");
|
|
chart2SC.append("</script> ");
|
|
if("excel".equals(actionType)){
|
|
list = commonService.selectList("contractMgmt.supplyMngGridPagingList", request, paramMap);
|
|
request.setAttribute("LIST", list);
|
|
|
|
}
|
|
|
|
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}
|
|
|
|
|
|
request.setAttribute("supplyInfoList", newList);
|
|
request.setAttribute("supplyHtml", Html);
|
|
request.setAttribute("chart1SC", chart1SC.toString());
|
|
request.setAttribute("chart2SC", chart2SC.toString());
|
|
request.setAttribute("code_map",code_map);
|
|
return "/contractMgmt/supplyMngList"+("excel".equals(actionType) ? "Excel" : "");
|
|
}
|
|
|
|
/**
|
|
* 고객관리 - 고객관리 목록 페이징
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping("/contractMgmt/supplyMngGridPagingList.do")
|
|
public Map getSupplyMngGridPagingList(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
commonService.selectListPagingNew("contractMgmt.supplyMngGridPagingList", request, paramMap);
|
|
return paramMap;
|
|
}
|
|
|
|
/**
|
|
* 공급업체
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@RequestMapping("/contractMgmt/supplyRegistPopUp.do")
|
|
public String supplyRegistPopUp(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
HashMap oemInfo = new HashMap();
|
|
Map code_map = new HashMap();
|
|
try{
|
|
|
|
|
|
oemInfo = (HashMap)contractMgmtService.getSupMngInfo(request, paramMap);
|
|
|
|
if(oemInfo.isEmpty()){
|
|
oemInfo.put("OBJID", CommonUtils.createObjId());
|
|
request.setAttribute("Action", "regist");
|
|
|
|
//구분
|
|
code_map.put("supply_code",commonService.bizMakeOptionList("0001093", "","common.getCodeselect"));
|
|
//지역명
|
|
code_map.put("area_cd",commonService.bizMakeOptionList("0000172", "","common.getCodeselect"));
|
|
|
|
}else{
|
|
|
|
//구분
|
|
code_map.put("supply_code",commonService.bizMakeOptionList("0001093", CommonUtils.nullToEmpty((String)oemInfo.get("SUPPLY_CODE")),"common.getCodeselect"));
|
|
//지역명
|
|
code_map.put("area_cd",commonService.bizMakeOptionList("0000172", CommonUtils.nullToEmpty((String)oemInfo.get("AREA_CD")),"common.getCodeselect"));
|
|
|
|
}
|
|
|
|
|
|
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}
|
|
request.setAttribute("code_map",code_map);
|
|
request.setAttribute("Info", oemInfo);
|
|
|
|
return "/contractMgmt/supplyRegistPopUp";
|
|
}
|
|
|
|
//황의돈=================================================================================================
|
|
/**
|
|
* 계약현황
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
//@RequestMapping("/contractMgmt/contractDashBoard.do")
|
|
//public String contractDashBoard(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
// List list = new ArrayList();
|
|
// Map code_map = new HashMap();
|
|
//
|
|
// try {
|
|
// //계약구분
|
|
// code_map.put("type_cd",commonService.bizMakeOptionList("0000167", CommonUtils.nullToEmpty((String)paramMap.get("type_cd")),"common.getCodeselect"));
|
|
//
|
|
// //고객명
|
|
// code_map.put("customer_cd",commonService.bizMakeOptionList("", (String)paramMap.get("customer_cd"),"common.getsupplyselect"));
|
|
//
|
|
// //지역명
|
|
// code_map.put("area_cd",commonService.bizMakeOptionList("0000172", CommonUtils.nullToEmpty((String)paramMap.get("area_cd")),"common.getCodeselect"));
|
|
//
|
|
// //제품구분
|
|
// code_map.put("product_cd",commonService.bizMakeOptionList("0000001", (String)paramMap.get("product_cd"),"common.getCodeselect")); //
|
|
//
|
|
// //상태
|
|
// code_map.put("status_cd",commonService.bizMakeOptionList("0000202", (String)paramMap.get("status_cd"),"common.getCodeselect")); //수주 ITEM
|
|
//
|
|
// //code_map.put("status_cd",commonService.bizMakeOptionList("", CommonUtils.nullToEmpty((String)paramMap.get("team_cd")),"common.getDeptselect"));
|
|
//
|
|
// //작성자
|
|
// //code_map.put("reg_id", commonService.bizMakeOptionList("", (String)paramMap.get("reg_id"),"common.getUserselect"));
|
|
//
|
|
// String searchYear = CommonUtils.checkNull(paramMap.get("Year"));
|
|
//
|
|
// if("".equals(searchYear)){
|
|
// SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
|
|
//
|
|
// Calendar c1 = Calendar.getInstance();
|
|
//
|
|
// String currentYear = sdf.format(c1.getTime());
|
|
//
|
|
// paramMap.put("Year", currentYear);
|
|
// }
|
|
//
|
|
// contractMgmtService.setMonthColumn(request, paramMap);
|
|
// list = contractMgmtService.getContractDashBoard(request,paramMap);
|
|
// } catch (Exception e) {
|
|
// e.printStackTrace();
|
|
// }
|
|
//
|
|
// request.setAttribute("code_map",code_map);
|
|
// request.setAttribute("LIST", list);
|
|
//
|
|
// return "/contractMgmt/contractDashboard";
|
|
//}
|
|
|
|
|
|
|
|
@RequestMapping("/contractMgmt/deleteContractMngInfo.do")
|
|
public String deletecontractMngInfo(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
try {
|
|
request.setAttribute("RESULT", CommonUtils.getJsonMap(contractMgmtService.deleteContractMngInfo(request, paramMap)) );
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
return "/ajax/ajaxResult";
|
|
}
|
|
|
|
|
|
@RequestMapping("/contractMgmt/deletesupplyMngInfo.do")
|
|
public String deletesupplyMngInfo(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
try {
|
|
request.setAttribute("RESULT", CommonUtils.getJsonMap(contractMgmtService.deletesupplyMngInfo(request, paramMap)) );
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
return "/ajax/ajaxResult";
|
|
}
|
|
|
|
|
|
/**
|
|
* 공급업체 저장
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@SuppressWarnings("unchecked")
|
|
@ResponseBody
|
|
@RequestMapping("/contractMgmt/saveSupMgmtInfo.do")
|
|
public Map<String, Object> saveSupMgmtInfo(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
Map result_map = new HashMap();
|
|
try {
|
|
result_map.put("RESULT", contractMgmtService.saveSupMgmtInfo(request, paramMap));
|
|
} catch (Exception e) {
|
|
// TODO Auto-generated catch block
|
|
e.printStackTrace();
|
|
}
|
|
return result_map;
|
|
}
|
|
|
|
/**
|
|
* 상담내역 리스트
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@RequestMapping("/contractMgmt/counselingList.do")
|
|
public String counselingList(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
ArrayList LIST = new ArrayList();
|
|
String actionType = CommonUtils.checkNull(paramMap.get("actionType"));
|
|
Map code_map = new HashMap();
|
|
String returnUrl ="/contractMgmt/counselingList";
|
|
try{
|
|
|
|
if("excel".equals(actionType)){
|
|
returnUrl = "/contractMgmt/counselingListExcel";
|
|
}
|
|
|
|
LIST = (ArrayList)contractMgmtService.counselingList(request, paramMap);
|
|
//업종
|
|
code_map.put("industry", commonService.bizMakeOptionList("0000830", (String)paramMap.get("industry"),"common.getCodeselect")); //공장
|
|
//상담지역
|
|
code_map.put("counseling_area1", commonService.bizMakeOptionList("0000561", (String)paramMap.get("counseling_area1"),"common.getCodeselect")); //공장
|
|
//등급
|
|
code_map.put("grade", commonService.bizMakeOptionList("0000808", (String)paramMap.get("grade"),"common.getCodeselect")); //공장
|
|
//계약담당자
|
|
code_map.put("counsel_user_id", commonService.bizMakeOptionList("",(String)paramMap.get("counsel_user_id"), "common.getUserselect")); //구매 PM
|
|
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}
|
|
request.setAttribute("code_map",code_map);
|
|
request.setAttribute("LIST", LIST);
|
|
return returnUrl;
|
|
}
|
|
|
|
|
|
/**
|
|
* 수주활동 수정 Form
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
|
@RequestMapping("/contractMgmt/counselingFormPopup.do")
|
|
public String counselingFormPopup(HttpSession session, HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
String OBJID = CommonUtils.checkNull(paramMap.get("OBJID"));
|
|
String actionType = CommonUtils.checkNull(paramMap.get("actionType"));
|
|
Map code_map = new HashMap();
|
|
ArrayList list = new ArrayList();
|
|
|
|
try{
|
|
String trans_type = ""; //거래유형
|
|
String counseling_category = ""; //상담구분
|
|
String counseling_type = ""; //상담유형
|
|
String counseling_area1 = ""; //상담지역1
|
|
String grade = ""; //등급
|
|
String industry = ""; //업종
|
|
String equipment_yn = ""; //장비보유여부
|
|
String qty = ""; //장비보유대수
|
|
String rep_model = "";//대표모델
|
|
Map info = null;
|
|
if(paramMap.get("OBJID")!=null){
|
|
info = CommonUtils.keyChangeUpperMap(contractMgmtService.getcounselingMgmtInfo(paramMap));
|
|
|
|
trans_type = CommonUtils.nullToEmpty((String)info.get("TRANS_TYPE"));
|
|
counseling_category = CommonUtils.nullToEmpty((String)info.get("COUNSELING_CATEGORY" ));
|
|
counseling_type = CommonUtils.nullToEmpty((String)info.get("COUNSELING_TYPE" ));
|
|
counseling_area1 = CommonUtils.nullToEmpty((String)info.get("COUNSELING_AREA1" ));
|
|
grade = CommonUtils.nullToEmpty((String)info.get("GRADE" ));
|
|
industry = CommonUtils.nullToEmpty((String)info.get("INDUSTRY" ));
|
|
equipment_yn = CommonUtils.nullToEmpty((String)info.get("EQUIPMENT_YN" ));
|
|
qty = CommonUtils.nullToEmpty((String)info.get("QTY" ));
|
|
rep_model = CommonUtils.nullToEmpty((String)info.get("REP_MODEL" ));
|
|
}
|
|
|
|
if("".equals(OBJID)) OBJID = CommonUtils.createObjId();
|
|
//거래유형
|
|
code_map.put("trans_type" , commonService.bizMakeOptionList("0000816", trans_type , "common.getCodeselect"));
|
|
|
|
//상담구분
|
|
code_map.put("counseling_category", commonService.bizMakeOptionList("0000819", counseling_category, "common.getCodeselect"));
|
|
|
|
//상담유형
|
|
code_map.put("counseling_type", commonService.bizMakeOptionList("0000826", counseling_type,"common.getCodeselect")); //공장
|
|
|
|
//상담지역
|
|
code_map.put("counseling_area1", commonService.bizMakeOptionList("0000561", counseling_area1,"common.getCodeselect")); //공장
|
|
|
|
//등급
|
|
code_map.put("grade", commonService.bizMakeOptionList("0000808", grade,"common.getCodeselect")); //공장
|
|
|
|
|
|
//업종
|
|
code_map.put("industry", commonService.bizMakeOptionList("0000830", industry,"common.getCodeselect")); //공장
|
|
|
|
//장비보유여부
|
|
code_map.put("equipment_yn", commonService.bizMakeOptionList("0000838", equipment_yn,"common.getCodeselect")); //공장
|
|
|
|
//장비보유대수
|
|
code_map.put("qty", commonService.bizMakeOptionList("0000841", qty,"common.getCodeselect")); //공장
|
|
|
|
//대표장비
|
|
code_map.put("rep_model", commonService.bizMakeOptionList("", rep_model,"common.getProductCodeselect")); //공장
|
|
|
|
request.setAttribute("code_map",code_map);
|
|
request.setAttribute("info", info);
|
|
request.setAttribute("OBJID", OBJID);
|
|
request.setAttribute("actionType", actionType);
|
|
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}
|
|
|
|
return "/contractMgmt/counselingFormPopup";
|
|
}
|
|
|
|
|
|
/**
|
|
* 공급업체 저장
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@SuppressWarnings("unchecked")
|
|
@ResponseBody
|
|
@RequestMapping("/contractMgmt/savecounselingInfo.do")
|
|
public Map<String, Object> savecounselingInfo(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
Map result_map = new HashMap();
|
|
try {
|
|
result_map.put("RESULT", contractMgmtService.savecounselingInfo(request, paramMap));
|
|
} catch (Exception e) {
|
|
// TODO Auto-generated catch block
|
|
e.printStackTrace();
|
|
}
|
|
return result_map;
|
|
}
|
|
|
|
|
|
/**
|
|
* 견적관리 리스트
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@RequestMapping("/contractMgmt/estimateList.do")
|
|
public String estimateList(HttpServletRequest request, @RequestParam Map paramMap){
|
|
List list = contractMgmtService.getestimateList(request,paramMap);
|
|
String actionType = CommonUtils.checkNull(paramMap.get("actionType"));
|
|
Map code_map = new HashMap();
|
|
|
|
try{
|
|
|
|
|
|
//계약구분
|
|
code_map.put("type_cd",commonService.bizMakeOptionList("0000167", CommonUtils.nullToEmpty((String)paramMap.get("type_cd")),"common.getCodeselect"));
|
|
|
|
//고객명
|
|
code_map.put("customer_cd",commonService.bizMakeOptionList("", (String)paramMap.get("customer_cd"),"common.getsupplyselect"));
|
|
|
|
//지역명
|
|
code_map.put("area_cd",commonService.bizMakeOptionList("0000172", CommonUtils.nullToEmpty((String)paramMap.get("area_cd")),"common.getCodeselect"));
|
|
|
|
//제품구분
|
|
code_map.put("product_cd",commonService.bizMakeOptionList("0000182", (String)paramMap.get("product_cd"),"common.getCodeselect")); //
|
|
|
|
//상태
|
|
code_map.put("status_cd",commonService.bizMakeOptionList("0000921", (String)paramMap.get("status_cd"),"common.getCodeselect")); //수주 ITEM
|
|
|
|
code_map.put("product_code",commonService.bizMakeOptionList("", (String)paramMap.get("product_code"),"common.getProductCodeselect"));
|
|
|
|
//code_map.put("status_cd",commonService.bizMakeOptionList("", CommonUtils.nullToEmpty((String)paramMap.get("team_cd")),"common.getDeptselect"));
|
|
|
|
//작성자
|
|
//code_map.put("reg_id", commonService.bizMakeOptionList("", (String)paramMap.get("reg_id"),"common.getUserselect"));
|
|
|
|
request.setAttribute("code_map",code_map);
|
|
|
|
request.setAttribute("cu01_file", Constants.CUSTOMER_CODE01);
|
|
request.setAttribute("cu02_file", Constants.CUSTOMER_CODE02);
|
|
request.setAttribute("LIST", list);
|
|
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}
|
|
return "/contractMgmt/estimateList";
|
|
}
|
|
|
|
/**
|
|
* 견적 등록/수정 Form
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
|
@RequestMapping("/contractMgmt/estimateFormPopup.do")
|
|
public String estimateUpdateFormPopup(HttpSession session, HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
String objId = CommonUtils.checkNull(paramMap.get("objId"));
|
|
String actionType = CommonUtils.checkNull(paramMap.get("actionType"));
|
|
Map code_map = new HashMap();
|
|
ArrayList list = new ArrayList();
|
|
|
|
try{
|
|
String v_mng_type = ""; //구분
|
|
String v_region_cd = ""; //지역
|
|
String v_category_cd = ""; //제품구분
|
|
String v_category_cd1 = ""; //제품구분
|
|
String v_category_cd2 = ""; //제품구분
|
|
String v_product_group = ""; //제품군1
|
|
String v_product_group1 = ""; //제품군2
|
|
String v_product_group2 = ""; //제품군3
|
|
String v_product = ""; //제품1
|
|
String v_product1 = ""; //제품2
|
|
String v_product2 = ""; //제품3
|
|
String v_vechile_cd = ""; //차량1
|
|
String v_vechile_cd1 = ""; //차량2
|
|
String v_vechile_cd2 = ""; //차량3
|
|
String v_load_box_cd = ""; //적재함확장1
|
|
String v_load_box_cd1 = ""; //적재함확장2
|
|
String v_load_box_cd2 = ""; //적재함확장3
|
|
String v_contract_user_id= ""; //계약담당자
|
|
String v_customer_cd = ""; //고객명
|
|
String v_contract_type = ""; //생산구분
|
|
String [] option_code = null;
|
|
Map info = null;
|
|
if(paramMap.get("objId")!=null){
|
|
paramMap.put("objId",Integer.parseInt(objId));
|
|
info = CommonUtils.keyChangeUpperMap(contractMgmtService.getEstimateMgmtInfo(paramMap));
|
|
|
|
v_customer_cd = CommonUtils.nullToEmpty((String)info.get("CUSTOMER_OBJID"));
|
|
v_mng_type = CommonUtils.nullToEmpty((String)info.get("MNG_TYPE" ));
|
|
v_region_cd = CommonUtils.nullToEmpty((String)info.get("REGION_CD" ));
|
|
v_category_cd = CommonUtils.nullToEmpty((String)info.get("CATEGORY_CD" ));
|
|
v_category_cd1 = CommonUtils.nullToEmpty((String)info.get("CATEGORY_CD1" ));
|
|
v_category_cd2 = CommonUtils.nullToEmpty((String)info.get("CATEGORY_CD2" ));
|
|
v_product_group = CommonUtils.nullToEmpty((String)info.get("PRODUCT_GROUP" ));
|
|
v_product_group1 = CommonUtils.nullToEmpty((String)info.get("PRODUCT_GROUP1" ));
|
|
v_product_group2 = CommonUtils.nullToEmpty((String)info.get("PRODUCT_GROUP2" ));
|
|
v_product = CommonUtils.nullToEmpty((String)info.get("PRODUCT" ));
|
|
v_product1 = CommonUtils.nullToEmpty((String)info.get("PRODUCT2" ));
|
|
v_product2 = CommonUtils.nullToEmpty((String)info.get("PRODUCT3" ));
|
|
v_vechile_cd = CommonUtils.nullToEmpty((String)info.get("VEHICLE_CD" ));
|
|
v_vechile_cd1 = CommonUtils.nullToEmpty((String)info.get("VEHICLE_CD1" ));
|
|
v_vechile_cd2 = CommonUtils.nullToEmpty((String)info.get("VEHICLE_CD2" ));
|
|
v_load_box_cd = CommonUtils.nullToEmpty((String)info.get("LOAD_BOX_CD" ));
|
|
v_load_box_cd1 = CommonUtils.nullToEmpty((String)info.get("LOAD_BOX_CD1" ));
|
|
v_load_box_cd2 = CommonUtils.nullToEmpty((String)info.get("LOAD_BOX_CD2" ));
|
|
v_contract_user_id= CommonUtils.nullToEmpty((String)info.get("CONTRACT_USER_ID"));
|
|
v_contract_type = CommonUtils.nullToEmpty((String)info.get("CONTRACT_TYPE"));
|
|
}
|
|
|
|
if("".equals(objId)) objId = CommonUtils.createObjId();
|
|
|
|
//옵션코드
|
|
code_map.put("option_type",commonService.bizMakeCheckBoxMultiList("","option_type",option_code,"common.getoptionList"));
|
|
|
|
//고객명
|
|
code_map.put("customer_cd",commonService.bizMakeOptionList("", v_customer_cd,"common.getsupplyselect"));
|
|
|
|
//구분
|
|
code_map.put("mng_type" , commonService.bizMakeOptionList(Constants.REGION_H_CD, v_mng_type , "common.getCodeselect"));
|
|
//지역
|
|
code_map.put("region_cd", commonService.bizMakeOptionList(Constants.REGION_H_CD, v_region_cd, "common.getCodeselect"));
|
|
|
|
//제품구분
|
|
code_map.put("category_cd", commonService.bizMakeOptionList("0000917", v_category_cd,"common.getCodeselect")); //공장
|
|
|
|
//계약담당자
|
|
code_map.put("contract_user_id", commonService.bizMakeOptionList("", v_contract_user_id, "common.getUserselect")); //구매 PM
|
|
|
|
//생산구분
|
|
code_map.put("contract_type", commonService.bizMakeOptionList("0000235", v_contract_type, "common.getCodeselect")); //구매 PM
|
|
|
|
|
|
Map param = new HashMap();
|
|
|
|
param.put("parentCodeId", "high");
|
|
code_map.put("gridhighCd", commonService.getJqGridSelectBoxJsonData("common.getOptionGridCodeList", param, "선택")); //구분
|
|
|
|
param.put("parentCodeId", "mid");
|
|
code_map.put("gridmidCd", commonService.getJqGridSelectBoxJsonData("common.getOptionGridCodeList", param, "선택")); //계정과목
|
|
|
|
param.put("parentCodeId", "low");
|
|
code_map.put("gridlowCd", commonService.getJqGridSelectBoxJsonData("common.getOptionGridCodeList",param, "선택")); //적요
|
|
|
|
|
|
request.setAttribute("code_map",code_map);
|
|
request.setAttribute("info", info);
|
|
request.setAttribute("objId", objId);
|
|
request.setAttribute("actionType", actionType);
|
|
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}
|
|
|
|
return "/contractMgmt/estimateFormPopup";
|
|
}
|
|
|
|
|
|
@RequestMapping("/contractMgmt/saveEstimateMgmtInfo.do")
|
|
public String saveEstimateMgmtInfo(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
try {
|
|
request.setAttribute("RESULT", CommonUtils.getJsonMap(contractMgmtService.saveEstimateMgmtInfo(request, paramMap)) );
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
return "/ajax/ajaxResult";
|
|
}
|
|
//견적삭제
|
|
@RequestMapping("/contractMgmt/deleteEstimateMgmtInfo.do")
|
|
public String deleteEstimateMgmtInfo(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
try {
|
|
request.setAttribute("RESULT", CommonUtils.getJsonMap(contractMgmtService.deleteEstimateMgmtInfo(request, paramMap)) );
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
return "/ajax/ajaxResult";
|
|
}
|
|
//견적 -> 계약등록 후 견적 상태 변경
|
|
@RequestMapping("/contractMgmt/createEstimateMgmtInfo.do")
|
|
public String createEstimateMgmtInfo(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
try {
|
|
request.setAttribute("RESULT", CommonUtils.getJsonMap(contractMgmtService.createEstimateMgmtInfo(request, paramMap)) );
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
return "/ajax/ajaxResult";
|
|
}
|
|
|
|
|
|
|
|
@RequestMapping("/contractMgmt/contractDashBoard.do")
|
|
public String contractDashBoard_new(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
List list = new ArrayList();
|
|
List list_supply = new ArrayList();
|
|
Map code_map = new HashMap();
|
|
Map yearGoalInfoMap = new HashMap();
|
|
Map yearGoalInfoMap1 = new HashMap();
|
|
Map yearGoalInfoMap2 = new HashMap();
|
|
try {
|
|
//구분
|
|
code_map.put("category_cd" , commonService.bizMakeOptionList("0000167", CommonUtils.nullToEmpty((String)paramMap.get("category_cd")) , "common.getCodeselect"));
|
|
//고객사
|
|
code_map.put("customer_cd",commonService.bizMakeOptionList("", CommonUtils.nullToEmpty((String)paramMap.get("customer_objid")),"common.getsupplyselect"));
|
|
//제품구분
|
|
code_map.put("product_cd", commonService.bizMakeOptionList("0000001", CommonUtils.nullToEmpty((String)paramMap.get("product")),"common.getCodeselect")); //공장
|
|
|
|
//계약구분
|
|
code_map.put("type_cd",commonService.bizMakeOptionList("0000167", CommonUtils.nullToEmpty((String)paramMap.get("type_cd")),"common.getCodeselect"));
|
|
//지역명
|
|
code_map.put("area_cd",commonService.bizMakeOptionList("0000172", CommonUtils.nullToEmpty((String)paramMap.get("area_cd")),"common.getCodeselect"));
|
|
|
|
//제품구분
|
|
ArrayList<HashMap<String,Object>> moldKindCdList = commonService.getCodeList("0000001", "common.getCodeselect");
|
|
paramMap.put("moldKindCdList", moldKindCdList);
|
|
request.setAttribute("moldKindCdList", moldKindCdList);
|
|
|
|
/*String searchYear = CommonUtils.checkNull(paramMap.get("Year"));
|
|
if("".equals(searchYear)){
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy");
|
|
Calendar c1 = Calendar.getInstance();
|
|
String currentYear = sdf.format(c1.getTime());
|
|
paramMap.put("Year", currentYear);
|
|
}else{
|
|
paramMap.put("Year", searchYear);
|
|
}*/
|
|
SimpleDateFormat sdf1 = new SimpleDateFormat("yyyy"); //-MM-dd HH:mm:ss
|
|
Date now = new Date();
|
|
String nowTime1 = sdf1.format(now);
|
|
String year = CommonUtils.checkNull(paramMap.get("Year"), nowTime1);
|
|
paramMap.put("Year", year);
|
|
|
|
System.out.println("moldKindCdList::"+moldKindCdList);
|
|
contractMgmtService.setMonthColumn(request, paramMap);
|
|
//list = commonService.selectList("contractMgmt.getContractDashBoard_new", request, paramMap);
|
|
list = contractMgmtService.getContractDashBoard(request,paramMap);
|
|
list_supply = commonService.selectList("contractMgmt.getContractCNTBySupply", request, paramMap);
|
|
request.setAttribute("param", paramMap);
|
|
yearGoalInfoMap = contractMgmtService.getYearGoalInfo(request,paramMap);
|
|
|
|
paramMap.put("Year", Integer.parseInt(year)-1+"");
|
|
//paramMap.put("YearM1", Integer.parseInt(searchYear)-1+"");
|
|
yearGoalInfoMap1 = contractMgmtService.getYearGoalInfo(request,paramMap);
|
|
paramMap.put("Year", Integer.parseInt(year)-2+"");
|
|
//paramMap.put("YearM2", Integer.parseInt(searchYear)-2+"");
|
|
yearGoalInfoMap2 = contractMgmtService.getYearGoalInfo(request,paramMap);
|
|
paramMap.put("Year", year); //원래 param 원복
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
|
|
request.setAttribute("code_map",code_map);
|
|
request.setAttribute("LIST", list);
|
|
request.setAttribute("LISTSUPPLY", list_supply);
|
|
request.setAttribute("yearGoalInfoMap", yearGoalInfoMap);
|
|
request.setAttribute("yearGoalInfoMap1", yearGoalInfoMap1);
|
|
request.setAttribute("yearGoalInfoMap2", yearGoalInfoMap2);
|
|
|
|
return "/contractMgmt/contractDashboard_new";
|
|
}
|
|
|
|
/**
|
|
* 영업목표 Form PopUp
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@RequestMapping("/contractMgmt/yearGoalFormPopUp.do")
|
|
public String yearGoalFormPopUp(HttpServletRequest request, @RequestParam Map paramMap){
|
|
Map resultMap = new HashMap();
|
|
Map code_map = new HashMap();
|
|
// ArrayList list = new ArrayList();
|
|
try{
|
|
|
|
resultMap = contractMgmtService.getYearGoalInfo(request,paramMap);
|
|
// request.setAttribute("LIST", list);
|
|
request.setAttribute("resultMap", resultMap);
|
|
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}
|
|
request.setAttribute("code_map", code_map);
|
|
return "/contractMgmt/yearGoalFormPopUp";
|
|
}
|
|
/**
|
|
* 영업목표 Detail PopUp
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@RequestMapping("/contractMgmt/yearGoalDetailPopUp.do")
|
|
public String yearGoalDetailPopUp(HttpServletRequest request, @RequestParam Map paramMap){
|
|
Map resultMap = new HashMap();
|
|
// ArrayList list = new ArrayList();
|
|
try{
|
|
resultMap = contractMgmtService.getYearGoalInfo(request,paramMap);
|
|
// request.setAttribute("LIST", list);
|
|
request.setAttribute("resultMap", resultMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}
|
|
return "/contractMgmt/yearGoalFormPopUp";
|
|
}
|
|
/**
|
|
* 영업목표 저장
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping("/contractMgmt/saveYearGoalInfo.do")
|
|
public Map saveYearGoalInfo(HttpServletRequest request, @RequestParam Map paramMap){
|
|
Map resultMap = new HashMap();
|
|
try{
|
|
resultMap = contractMgmtService.saveYearGoalInfo(request,paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}
|
|
return resultMap;
|
|
}
|
|
/**
|
|
* 영업목표 삭제
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping("/contractMgmt/deleteYearGoalInfo.do")
|
|
public Map deleteYearGoalInfo(HttpServletRequest request, @RequestParam Map paramMap){
|
|
Map resultMap = new HashMap();
|
|
try{
|
|
resultMap = contractMgmtService.deleteYearGoalInfo(request,paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}
|
|
return resultMap;
|
|
}
|
|
|
|
/**
|
|
* 견적관리 리스트
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@RequestMapping("/contractMgmt/estimateList_new.do")
|
|
public String estimateList_new(HttpServletRequest request, @RequestParam Map paramMap){
|
|
//List list = contractMgmtService.getcontractList(request,paramMap);
|
|
String actionType = CommonUtils.checkNull(paramMap.get("actionType"));
|
|
Map code_map = new HashMap();
|
|
String returnUrl ="/contractMgmt/estimateList_new";
|
|
|
|
try{
|
|
|
|
if("excel".equals(actionType)){
|
|
returnUrl = "/contractMgmt/contractListExcel";
|
|
}
|
|
|
|
//구분
|
|
code_map.put("category_cd" , commonService.bizMakeOptionList("0000167", CommonUtils.nullToEmpty((String)paramMap.get("category_cd")) , "common.getCodeselect"));
|
|
|
|
//고객사
|
|
code_map.put("customer_cd",commonService.bizMakeOptionList("", CommonUtils.nullToEmpty((String)paramMap.get("customer_objid")),"common.getsupplyselect"));
|
|
|
|
//제품구분
|
|
code_map.put("product_cd", commonService.bizMakeOptionList("0000001", CommonUtils.nullToEmpty((String)paramMap.get("product")),"common.getCodeselect")); //공장
|
|
|
|
//진행상황
|
|
code_map.put("status_cd" , commonService.bizMakeOptionList("0000932", CommonUtils.nullToEmpty((String)paramMap.get("status_cd")) , "common.getCodeselect"));
|
|
|
|
//결과
|
|
code_map.put("result_cd", commonService.bizMakeOptionList("0000963", CommonUtils.nullToEmpty((String)paramMap.get("result_cd")), "common.getCodeselect"));
|
|
|
|
//PM
|
|
code_map.put("pm_user_id", commonService.bizMakeOptionList("", CommonUtils.nullToEmpty((String)paramMap.get("pm_user_id")), "common.getUserselect")); //구매 PM
|
|
|
|
request.setAttribute("code_map",code_map);
|
|
request.setAttribute("actionType",actionType);
|
|
//request.setAttribute("LIST", list);
|
|
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}
|
|
return returnUrl;
|
|
}
|
|
|
|
/**
|
|
* 견적관리 - 견적관리 목록 페이징
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping("/contractMgmt/estimateGridList.do")
|
|
public Map getestimateListPaging(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
commonService.selectListPagingNew("contractMgmt.estimateGridList", request, paramMap);
|
|
return paramMap;
|
|
}
|
|
|
|
/**
|
|
* 견적요청등록 Form
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@SuppressWarnings({ "rawtypes", "unchecked" })
|
|
@RequestMapping("/contractMgmt/estimateRegistFormPopup.do")
|
|
public String estimateRegistFormPopup(HttpSession session, HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
String objId = CommonUtils.checkNull(paramMap.get("objId"));
|
|
String actionType = CommonUtils.checkNull(paramMap.get("actionType"));
|
|
Map code_map = new HashMap();
|
|
ArrayList list = new ArrayList();
|
|
|
|
try{
|
|
String category_cd = ""; //구분
|
|
String customer_cd = ""; //고객사
|
|
String product_cd = ""; //제품구분
|
|
String status_cd = ""; //진행상황
|
|
String facility = ""; //설비방향
|
|
String bus_cal_cd = ""; //영업구분
|
|
String category1_cd = ""; //구분1
|
|
String result_cd = ""; //수주결과
|
|
String pm_user_id =""; //PM
|
|
String chg_user_id ="";//담당자
|
|
String contract_result ="";//검토결과
|
|
String contract_company ="";//수주회사
|
|
String manufacture_plant ="";//제작공장
|
|
String spec_user_id ="";//사양담당자
|
|
String spec_result_cd ="";//사양결과
|
|
String est_user_id ="";//제작공장
|
|
String est_result_cd ="";//제작공장
|
|
String area_cd ="";//제작공장
|
|
String contract_currency ="";//통화
|
|
String target_project_no ="";//대상프로젝트번호
|
|
String mechanical_type ="";//기계형식
|
|
String overhaul_order ="";//오버홀차수
|
|
String return_reason_cd ="";//반납사유
|
|
|
|
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));
|
|
category_cd = CommonUtils.nullToEmpty((String)info.get("CATEGORY_CD"));
|
|
customer_cd = CommonUtils.nullToEmpty((String)info.get("CUSTOMER_OBJID"));
|
|
product_cd = CommonUtils.nullToEmpty((String)info.get("PRODUCT"));
|
|
status_cd = CommonUtils.nullToEmpty((String)info.get("STATUS_CD"));
|
|
facility = CommonUtils.nullToEmpty((String)info.get("FACILITY"));
|
|
bus_cal_cd = CommonUtils.nullToEmpty((String)info.get("BUS_CAL_CD"));
|
|
category1_cd = CommonUtils.nullToEmpty((String)info.get("CATEGORY1_CD"));
|
|
result_cd = CommonUtils.nullToEmpty((String)info.get("RESULT_CD"));
|
|
pm_user_id= CommonUtils.nullToEmpty((String)info.get("PM_USER_ID"));
|
|
chg_user_id= CommonUtils.nullToEmpty((String)info.get("CHG_USER_ID"));
|
|
contract_result = CommonUtils.nullToEmpty((String)info.get("CONTRACT_RESULT"));
|
|
contract_company = CommonUtils.nullToEmpty((String)info.get("CONTRACT_COMPANY"));
|
|
manufacture_plant = CommonUtils.nullToEmpty((String)info.get("MANUFACTURE_PLANT"));
|
|
spec_result_cd = CommonUtils.nullToEmpty((String)info.get("SPEC_RESULT_CD"));
|
|
spec_user_id = CommonUtils.nullToEmpty((String)info.get("SPEC_USER_ID"));
|
|
est_user_id = CommonUtils.nullToEmpty((String)info.get("EST_USER_ID"));
|
|
est_result_cd = CommonUtils.nullToEmpty((String)info.get("EST_RESULT_CD"));
|
|
area_cd = CommonUtils.nullToEmpty((String)info.get("AREA_CD"));
|
|
contract_currency = CommonUtils.nullToEmpty((String)info.get("CONTRACT_CURRENCY"));
|
|
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"));
|
|
return_reason_cd = CommonUtils.nullToEmpty((String)info.get("RETURN_REASON_CD"));
|
|
// 품목 목록 조회
|
|
itemList = contractMgmtService.getContractItemList(objId);
|
|
}
|
|
|
|
if("".equals(objId)) objId = CommonUtils.createObjId();
|
|
|
|
|
|
//구분
|
|
code_map.put("category_cd" , commonService.bizMakeOptionList("0000167", category_cd , "common.getCodeselect"));
|
|
|
|
//고객사
|
|
code_map.put("customer_cd",commonService.bizMakeOptionList("", customer_cd,"common.getsupplyselect"));
|
|
|
|
//제품구분
|
|
code_map.put("product_cd", commonService.bizMakeOptionList("0000001", product_cd,"common.getCodeselect")); //공장
|
|
|
|
//진행상황
|
|
code_map.put("status_cd" , commonService.bizMakeOptionList("0000932", status_cd , "common.getCodeselect"));
|
|
|
|
//설비방향
|
|
code_map.put("facility" , commonService.bizMakeOptionList("0000959", facility , "common.getCodeselect"));
|
|
|
|
//영업구분
|
|
code_map.put("bus_cal_cd" , commonService.bizMakeOptionList("0000967", bus_cal_cd , "common.getCodeselect"));
|
|
|
|
//구분1
|
|
//code_map.put("category1_cd", commonService.bizMakeOptionList("0000942", category1_cd, "common.getCodeselect"));
|
|
|
|
//검토결과
|
|
code_map.put("result_cd", commonService.bizMakeOptionList("0001107", result_cd, "common.getCodeselect"));
|
|
|
|
//검토결과
|
|
code_map.put("spec_result_cd", commonService.bizMakeOptionList("0001107", spec_result_cd, "common.getCodeselect"));
|
|
|
|
//검토결과
|
|
code_map.put("est_result_cd", commonService.bizMakeOptionList("0001107", est_result_cd, "common.getCodeselect"));
|
|
|
|
//계약담당자
|
|
code_map.put("chg_user_id", commonService.bizMakeOptionList("", chg_user_id, "common.getUserselect")); //구매 PM
|
|
|
|
//계약담당자
|
|
code_map.put("spec_user_id", commonService.bizMakeOptionList("", spec_user_id, "common.getUserselect")); //구매 PM
|
|
|
|
//계약담당자
|
|
code_map.put("est_user_id", commonService.bizMakeOptionList("", est_user_id, "common.getUserselect")); //구매 PM
|
|
|
|
//PM
|
|
code_map.put("pm_user_id", commonService.bizMakeOptionList("", pm_user_id, "common.getUserselect")); //구매 PM
|
|
|
|
//수주결과
|
|
code_map.put("contract_result", commonService.bizMakeOptionList("0000963", contract_result, "common.getCodeselect"));
|
|
|
|
//수주회사
|
|
code_map.put("contract_company", commonService.bizMakeOptionList("0001098", contract_company, "common.getCodeselect"));
|
|
|
|
//제작공장
|
|
code_map.put("manufacture_plant", commonService.bizMakeOptionList("0001101", manufacture_plant, "common.getCodeselect"));
|
|
|
|
//해외.국내
|
|
code_map.put("area_cd", commonService.bizMakeOptionList("0001219", area_cd, "common.getCodeselect"));
|
|
//통화
|
|
code_map.put("contract_currency", commonService.bizMakeOptionList("0001533", contract_currency, "common.getCodeselect"));
|
|
//당사프로젟트번호
|
|
code_map.put("project_no",commonService.bizMakeOptionList("", target_project_no,"common.getCusProjectNoList"));
|
|
//기계형식
|
|
code_map.put("mechanical_type", commonService.bizMakeOptionList("", mechanical_type,"common.getMechanicalTypeList"));
|
|
//반납사유
|
|
code_map.put("return_reason_cd", commonService.bizMakeOptionList("0001810", return_reason_cd, "common.getCodeselect"));
|
|
|
|
// 품번 목록은 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();
|
|
}
|
|
|
|
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 {
|
|
request.setAttribute("RESULT", CommonUtils.getJsonMap(contractMgmtService.saveContractMgmtInfo(request, paramMap)) );
|
|
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
return "/ajax/ajaxResult";
|
|
}
|
|
|
|
/**
|
|
* 견적서 양식1 (일반 견적서) 팝업
|
|
* @param session
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@RequestMapping("/contractMgmt/estimateTemplate1.do")
|
|
public String estimateTemplate1(HttpSession session, HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
String objId = CommonUtils.checkNull(paramMap.get("objId"));
|
|
String templateObjId = CommonUtils.checkNull(paramMap.get("templateObjId"));
|
|
|
|
try{
|
|
Map estimate = null;
|
|
List<Map> items = new ArrayList<Map>();
|
|
Map<String, String> code_map = new HashMap<String, String>();
|
|
|
|
// templateObjId가 있으면 기존 견적서 조회 (견적현황에서 클릭한 경우)
|
|
if(!"".equals(templateObjId) && !"-1".equals(templateObjId)){
|
|
paramMap.put("templateObjId", templateObjId);
|
|
estimate = contractMgmtService.getEstimateTemplateByObjId(paramMap);
|
|
items = contractMgmtService.getEstimateTemplateItemsByTemplateObjId(paramMap);
|
|
}
|
|
// objId만 있으면 CONTRACT 정보로 견적서 신규 작성
|
|
else if(!"".equals(objId) && !"-1".equals(objId)){
|
|
estimate = contractMgmtService.getEstimateTemplateInfo(paramMap);
|
|
// items = contractMgmtService.getEstimateTemplateItems(paramMap); // 주석처리: 새로 작성 시 빈 템플릿 사용
|
|
}
|
|
|
|
// 고객사 코드맵 추가
|
|
String customer_cd = "";
|
|
if(estimate != null && estimate.get("CUSTOMER_OBJID") != null) {
|
|
customer_cd = CommonUtils.nullToEmpty((String)estimate.get("CUSTOMER_OBJID"));
|
|
}
|
|
code_map.put("customer_cd", commonService.bizMakeOptionList("", customer_cd, "common.getsupplyselect"));
|
|
|
|
request.setAttribute("estimate", estimate);
|
|
request.setAttribute("items", items);
|
|
request.setAttribute("code_map", code_map);
|
|
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
|
|
return "/contractMgmt/estimateTemplate1";
|
|
}
|
|
|
|
/**
|
|
* 고객사 담당자 정보 조회 (AJAX)
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping(value="/contractMgmt/getCustomerContactInfo.do", method=RequestMethod.POST)
|
|
public Map getCustomerContactInfo(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
Map resultMap = new HashMap();
|
|
|
|
try {
|
|
String customerObjId = CommonUtils.checkNull(paramMap.get("customerObjId"));
|
|
|
|
if(!"".equals(customerObjId)) {
|
|
// 고객사 담당자 정보 조회
|
|
Map customerInfo = contractMgmtService.getCustomerContactInfo(paramMap);
|
|
|
|
if(customerInfo != null) {
|
|
// 소문자 우선 시도 (MyBatis가 소문자로 변환)
|
|
String contactPerson = CommonUtils.checkNull(customerInfo.get("contact_person"));
|
|
if("".equals(contactPerson)) {
|
|
contactPerson = CommonUtils.checkNull(customerInfo.get("CONTACT_PERSON"));
|
|
}
|
|
|
|
if(!"".equals(contactPerson)) {
|
|
resultMap.put("contactPerson", contactPerson);
|
|
resultMap.put("result", "success");
|
|
} else {
|
|
resultMap.put("result", "no_contact");
|
|
}
|
|
} else {
|
|
resultMap.put("result", "no_data");
|
|
}
|
|
} else {
|
|
resultMap.put("result", "no_customer");
|
|
}
|
|
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
resultMap.put("result", "error");
|
|
}
|
|
|
|
return resultMap;
|
|
}
|
|
|
|
/**
|
|
* 견적서 양식2 (장비 견적서) 팝업
|
|
* @param session
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@RequestMapping("/contractMgmt/estimateTemplate2.do")
|
|
public String estimateTemplate2(HttpSession session, HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
String objId = CommonUtils.checkNull(paramMap.get("objId"));
|
|
String templateObjId = CommonUtils.checkNull(paramMap.get("templateObjId"));
|
|
|
|
try{
|
|
Map estimate = null;
|
|
List<Map> items = new ArrayList<Map>();
|
|
|
|
// templateObjId가 있으면 기존 견적서 조회 (견적현황에서 클릭한 경우)
|
|
if(!"".equals(templateObjId) && !"-1".equals(templateObjId)){
|
|
paramMap.put("templateObjId", templateObjId);
|
|
estimate = contractMgmtService.getEstimateTemplateByObjId(paramMap);
|
|
items = contractMgmtService.getEstimateTemplateItemsByTemplateObjId(paramMap);
|
|
}
|
|
// objId만 있으면 CONTRACT 정보로 견적서 신규 작성
|
|
else if(!"".equals(objId) && !"-1".equals(objId)){
|
|
// 기존 견적서 데이터 조회
|
|
estimate = contractMgmtService.getEstimateTemplateInfo(paramMap);
|
|
items = contractMgmtService.getEstimateTemplateItems(paramMap);
|
|
}
|
|
|
|
request.setAttribute("estimate", estimate);
|
|
request.setAttribute("items", items);
|
|
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
|
|
return "/contractMgmt/estimateTemplate2";
|
|
}
|
|
|
|
/**
|
|
* 견적서 상세 정보 조회 (AJAX)
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping(value="/contractMgmt/getEstimateDetail.do", method=RequestMethod.POST)
|
|
public Map getEstimateDetail(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
Map resultMap = new HashMap();
|
|
|
|
try {
|
|
Map estimate = contractMgmtService.getEstimateTemplateInfo(paramMap);
|
|
List<Map> items = contractMgmtService.getEstimateTemplateItems(paramMap);
|
|
|
|
resultMap.put("estimate", estimate);
|
|
resultMap.put("items", items);
|
|
resultMap.put("result", "success");
|
|
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
resultMap.put("result", "error");
|
|
resultMap.put("message", e.getMessage());
|
|
}
|
|
|
|
return resultMap;
|
|
}
|
|
|
|
/**
|
|
* 견적서 목록 조회 (AJAX)
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping(value="/contractMgmt/getEstimateTemplateList.do", method=RequestMethod.POST)
|
|
public Map getEstimateTemplateList(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
return contractMgmtService.getEstimateTemplateList(request, paramMap);
|
|
}
|
|
|
|
/**
|
|
* 견적서 템플릿 데이터 조회 (OBJID로) (AJAX)
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping(value="/contractMgmt/getEstimateTemplateDataByObjId.do", method=RequestMethod.POST)
|
|
public Map getEstimateTemplateDataByObjId(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
Map resultMap = new HashMap();
|
|
|
|
try {
|
|
// 템플릿 기본 정보 조회
|
|
Map template = contractMgmtService.getEstimateTemplateByObjId(paramMap);
|
|
|
|
// 템플릿 품목 조회
|
|
List<Map> items = contractMgmtService.getEstimateTemplateItemsByTemplateObjId(paramMap);
|
|
|
|
resultMap.put("result", "success");
|
|
resultMap.put("template", template);
|
|
resultMap.put("items", items);
|
|
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
resultMap.put("result", "error");
|
|
resultMap.put("message", e.getMessage());
|
|
}
|
|
|
|
return resultMap;
|
|
}
|
|
|
|
/**
|
|
* 견적서 저장 (AJAX)
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping(value="/contractMgmt/saveEstimate.do", method=RequestMethod.POST)
|
|
public Map saveEstimate(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
Map resultMap = new HashMap();
|
|
|
|
try {
|
|
PersonBean person = (PersonBean)request.getSession().getAttribute(Constants.PERSON_BEAN);
|
|
paramMap.put("userId", person.getUserId());
|
|
|
|
// 합계 정보 로그 (디버깅용)
|
|
System.out.println("견적서 저장 - 합계: " + paramMap.get("total_amount") + ", 원화환산: " + paramMap.get("total_amount_krw"));
|
|
|
|
contractMgmtService.saveEstimateTemplate(request, paramMap);
|
|
|
|
resultMap.put("result", "success");
|
|
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
resultMap.put("result", "error");
|
|
resultMap.put("message", e.getMessage());
|
|
}
|
|
|
|
return resultMap;
|
|
}
|
|
|
|
/**
|
|
* PDF 청크 업로드 (AJAX)
|
|
* @param request
|
|
* @param paramMap - sessionId, chunkIndex, totalChunks, chunk
|
|
* @return
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping(value="/contractMgmt/uploadPdfChunk.do", method=RequestMethod.POST)
|
|
public Map uploadPdfChunk(HttpServletRequest request,
|
|
@RequestParam Map<String, Object> paramMap){
|
|
Map resultMap = new HashMap();
|
|
|
|
try {
|
|
resultMap = contractMgmtService.uploadPdfChunk(request, paramMap);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
resultMap.put("result", "error");
|
|
resultMap.put("message", "청크 업로드 중 오류가 발생했습니다: " + e.getMessage());
|
|
}
|
|
|
|
return resultMap;
|
|
}
|
|
|
|
/**
|
|
* 견적서 메일 발송 (AJAX) - PDF 세션 ID 방식
|
|
* @param request
|
|
* @param paramMap - objId (CONTRACT_OBJID), pdfSessionId (업로드된 PDF 세션 ID)
|
|
* @return
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping(value="/contractMgmt/sendEstimateMail.do", method=RequestMethod.POST)
|
|
public Map sendEstimateMail(HttpServletRequest request,
|
|
@RequestParam Map<String, Object> paramMap){
|
|
Map resultMap = new HashMap();
|
|
|
|
try {
|
|
String objId = CommonUtils.checkNull(paramMap.get("objId"));
|
|
|
|
if("".equals(objId) || "-1".equals(objId)){
|
|
resultMap.put("result", "error");
|
|
resultMap.put("message", "잘못된 요청입니다.");
|
|
return resultMap;
|
|
}
|
|
|
|
// 메일 발송 서비스 호출
|
|
resultMap = contractMgmtService.sendEstimateMail(request, paramMap);
|
|
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
resultMap.put("result", "error");
|
|
resultMap.put("message", "메일 발송 중 오류가 발생했습니다: " + e.getMessage());
|
|
}
|
|
|
|
return resultMap;
|
|
}
|
|
|
|
/**
|
|
* 주문서관리 리스트
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@RequestMapping("/contractMgmt/orderMgmtList.do")
|
|
public String orderMgmtList(HttpServletRequest request, @RequestParam Map paramMap){
|
|
//List list = contractMgmtService.getcontractList(request,paramMap);
|
|
String actionType = CommonUtils.checkNull(paramMap.get("actionType"));
|
|
Map code_map = new HashMap();
|
|
String returnUrl ="/contractMgmt/orderMgmtList";
|
|
|
|
try{
|
|
|
|
if("excel".equals(actionType)){
|
|
//returnUrl = "/contractMgmt/contractListExcel";
|
|
}
|
|
|
|
//구분
|
|
code_map.put("category_cd" , commonService.bizMakeOptionList("0000167", CommonUtils.nullToEmpty((String)paramMap.get("category_cd")) , "common.getCodeselect"));
|
|
|
|
//고객사
|
|
code_map.put("customer_cd",commonService.bizMakeOptionList("", CommonUtils.nullToEmpty((String)paramMap.get("customer_objid")),"common.getsupplyselect"));
|
|
|
|
//제품구분
|
|
code_map.put("product_cd", commonService.bizMakeOptionList("0000001", CommonUtils.nullToEmpty((String)paramMap.get("product")),"common.getCodeselect")); //공장
|
|
|
|
//진행상황
|
|
code_map.put("status_cd" , commonService.bizMakeOptionList("0000932", CommonUtils.nullToEmpty((String)paramMap.get("status_cd")) , "common.getCodeselect"));
|
|
|
|
//결과
|
|
code_map.put("result_cd", commonService.bizMakeOptionList("0000963", CommonUtils.nullToEmpty((String)paramMap.get("result_cd")), "common.getCodeselect"));
|
|
|
|
//PM
|
|
code_map.put("pm_user_id", commonService.bizMakeOptionList("", CommonUtils.nullToEmpty((String)paramMap.get("pm_user_id")), "common.getUserselect")); //구매 PM
|
|
|
|
request.setAttribute("code_map",code_map);
|
|
request.setAttribute("actionType",actionType);
|
|
//request.setAttribute("LIST", list);
|
|
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}
|
|
return returnUrl;
|
|
}
|
|
|
|
/**
|
|
* 주문서관리 - 주문서관리 목록 페이징
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping("/contractMgmt/orderMgmtGrodList.do")
|
|
public Map getOrderMgmtListPaging(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
commonService.selectListPagingNew("contractMgmt.orderMgmtGrodList", request, paramMap);
|
|
return paramMap;
|
|
}
|
|
|
|
/**
|
|
* 수주등록 팝업 페이지
|
|
* @param session
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@RequestMapping("/contractMgmt/orderRegistFormPopup.do")
|
|
public String orderRegistFormPopup(HttpSession session, HttpServletRequest request, @RequestParam Map<String, Object> paramMap) {
|
|
String objId = CommonUtils.checkNull(paramMap.get("contractObjId"));
|
|
//String contractObjId = CommonUtils.checkNull(paramMap.get("contractObjId"));
|
|
String actionType = CommonUtils.checkNull(paramMap.get("actionType"));
|
|
|
|
Map<String, Object> code_map = new HashMap<String, Object>();
|
|
Map<String, Object> info = new HashMap<String, Object>();
|
|
Map<String, Object> contractInfo = new HashMap<String, Object>();
|
|
|
|
try {
|
|
// 영업정보(견적정보) 조회
|
|
if(StringUtils.isNotBlank(objId)) {
|
|
paramMap.put("objId", objId);
|
|
contractInfo = CommonUtils.keyChangeUpperMap(contractMgmtService.getContractMgmtInfo(paramMap));
|
|
// contractInfo가 곧 수주정보이기도 함 (같은 테이블)
|
|
info = contractInfo;
|
|
}
|
|
|
|
// 수주상태 코드 (CONTRACT_RESULT 코드 사용)
|
|
code_map.put("contract_result", commonService.bizMakeOptionList("0000963", CommonUtils.nullToEmpty((String)info.get("CONTRACT_RESULT")), "common.getCodeselect"));
|
|
|
|
// 환종 코드
|
|
code_map.put("contract_currency", commonService.bizMakeOptionList("0001533", CommonUtils.nullToEmpty((String)info.get("CONTRACT_CURRENCY")), "common.getCodeselect"));
|
|
|
|
// 결재상태 확인 (결재완료 시 견적서 템플릿 사용)
|
|
String apprStatus = CommonUtils.nullToEmpty((String)info.get("APPR_STATUS"));
|
|
boolean useEstimateTemplate = "결재완료".equals(apprStatus);
|
|
|
|
request.setAttribute("code_map", code_map);
|
|
request.setAttribute("info", info);
|
|
request.setAttribute("contractInfo", contractInfo);
|
|
request.setAttribute("contractObjId", objId);
|
|
request.setAttribute("objId", objId);
|
|
request.setAttribute("actionType", actionType);
|
|
request.setAttribute("useEstimateTemplate", useEstimateTemplate ? "Y" : "N");
|
|
|
|
} catch(Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
|
|
return "/contractMgmt/orderRegistFormPopup";
|
|
}
|
|
|
|
/**
|
|
* 수주정보 저장
|
|
* @param session
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
@RequestMapping("/contractMgmt/saveOrderInfo.do")
|
|
public String saveOrderInfo(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
try {
|
|
request.setAttribute("RESULT", CommonUtils.getJsonMap(contractMgmtService.saveOrderInfo(request, paramMap)) );
|
|
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
}
|
|
return "/ajax/ajaxResult";
|
|
}
|
|
|
|
/**
|
|
* 계약 품목 조회 (AJAX)
|
|
* @param request
|
|
* @param paramMap - contractObjId
|
|
* @return
|
|
*/
|
|
@ResponseBody
|
|
@RequestMapping(value="/contractMgmt/getContractItems.do", method=RequestMethod.POST)
|
|
public Map getContractItems(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
Map resultMap = new HashMap();
|
|
|
|
try {
|
|
// 결재완료 상태인 경우 최종 견적서 템플릿에서 품목 조회
|
|
String useEstimateTemplate = CommonUtils.checkNull(paramMap.get("useEstimateTemplate"));
|
|
List<Map> items = null;
|
|
|
|
if("Y".equals(useEstimateTemplate)) {
|
|
// 최종 견적서 템플릿의 품목 조회
|
|
items = contractMgmtService.getEstimateTemplateItemsForOrder(paramMap);
|
|
} else {
|
|
// 기존 방식: CONTRACT_ITEM에서 조회
|
|
items = contractMgmtService.getContractItems(paramMap);
|
|
}
|
|
|
|
resultMap.put("result", "success");
|
|
resultMap.put("items", items);
|
|
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
resultMap.put("result", "error");
|
|
resultMap.put("message", e.getMessage());
|
|
}
|
|
|
|
return resultMap;
|
|
}
|
|
|
|
@RequestMapping("/contractMgmt/FileRegistPopup.do")
|
|
public String FileRegistPopup(HttpServletRequest request, @RequestParam Map<String, Object> paramMap){
|
|
request.setAttribute("docType", CommonUtils.checkNull(paramMap.get("docType")));
|
|
request.setAttribute("docTypeName", CommonUtils.checkNull(paramMap.get("docTypeName")));
|
|
return "/contractMgmt/FileRegistPopup";
|
|
}
|
|
}
|