2748 lines
80 KiB
Java
2748 lines
80 KiB
Java
package com.pms.service;
|
|
|
|
import java.io.File;
|
|
import java.sql.ResultSet;
|
|
import java.sql.ResultSetMetaData;
|
|
import java.sql.SQLException;
|
|
import java.util.ArrayList;
|
|
import java.util.Collection;
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpSession;
|
|
|
|
import org.apache.ibatis.mapping.BoundSql;
|
|
import org.apache.ibatis.mapping.ParameterMapping;
|
|
import org.apache.ibatis.session.SqlSession;
|
|
import org.apache.log4j.Logger;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.util.StringUtils;
|
|
|
|
import com.oreilly.servlet.MultipartRequest;
|
|
import com.pms.common.JsonUtil;
|
|
import com.pms.common.SqlMapConfig;
|
|
import com.pms.common.bean.PersonBean;
|
|
import com.pms.common.service.BaseService;
|
|
import com.pms.common.utils.CommonUtils;
|
|
import com.pms.common.utils.Constants;
|
|
import com.pms.common.utils.MailUtil;
|
|
|
|
@Service
|
|
public class CommonService extends BaseService {
|
|
|
|
public Map setPartMngCommonCD(Map paramMap){
|
|
paramMap.put("PRODUCT_GROUP_CODE", Constants.PRODUCT_GROUP_CODE);
|
|
paramMap.put("MATERIAL_CODE", Constants.MATERIAL_CODE);
|
|
paramMap.put("SPEC_NO_CODE", Constants.SPEC_NO_CODE);
|
|
paramMap.put("DESIGN_APPLY_POINT_CODE", Constants.DESIGN_APPLY_POINT_CODE);
|
|
|
|
return paramMap;
|
|
}
|
|
|
|
/**
|
|
* upload된 파일에 대한 정보를 DB에 저장한다.
|
|
* @param session
|
|
* @param fileList
|
|
* @param multi
|
|
*/
|
|
public void insertUploadFileInfo(HttpSession session, List<Map> fileList, MultipartRequest multi){
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
|
|
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
|
|
String writer = CommonUtils.checkNull(person.getUserId());
|
|
|
|
System.out.println("DB에 저장될 정보.");
|
|
for(Map fileMap : fileList){
|
|
String objId = CommonUtils.createObjId();
|
|
String targetObjId = CommonUtils.checkNull(multi.getParameter("targetObjId"));
|
|
String parentTargetObjId = CommonUtils.checkNull(multi.getParameter("parentTargetObjId"));
|
|
String savedFileName = CommonUtils.checkNull(fileMap.get("savedFileName"));
|
|
String realFileName = CommonUtils.checkNull(fileMap.get("realFileName"));
|
|
String docType = CommonUtils.checkNull(multi.getParameter("docType"));
|
|
String docTypeName = CommonUtils.checkNull(multi.getParameter("docTypeName"));
|
|
String fileSize = "0";
|
|
|
|
File f = new File(CommonUtils.checkNull(fileMap.get("savedFullFileName")));
|
|
if(f.exists()){
|
|
fileSize = CommonUtils.checkNull(f.length());
|
|
}
|
|
String fileExt = CommonUtils.checkNull(fileMap.get("fileExt"));
|
|
String filePath = CommonUtils.checkNull(fileMap.get("filePath"));
|
|
|
|
Map paramMap = new HashMap();
|
|
paramMap.put("objId", objId);
|
|
paramMap.put("targetObjId", targetObjId);
|
|
paramMap.put("parentTargetObjId", parentTargetObjId);
|
|
paramMap.put("savedFileName", savedFileName);
|
|
paramMap.put("realFileName", realFileName);
|
|
paramMap.put("docType", docType);
|
|
paramMap.put("docTypeName", docTypeName);
|
|
paramMap.put("fileSize", fileSize);
|
|
paramMap.put("fileExt", fileExt);
|
|
paramMap.put("filePath", filePath);
|
|
paramMap.put("writer", writer);
|
|
|
|
System.out.println("--------------------------------------------------");
|
|
System.out.println("objId : "+objId);
|
|
System.out.println("targetObjId : "+targetObjId);
|
|
System.out.println("parentTargetObjId : "+parentTargetObjId);
|
|
System.out.println("savedFileName : "+savedFileName);
|
|
System.out.println("realFileName : "+realFileName);
|
|
System.out.println("docType : "+docType);
|
|
System.out.println("docTypeName : "+docTypeName);
|
|
System.out.println("fileSize : "+fileSize);
|
|
System.out.println("fileExt : "+fileExt);
|
|
System.out.println("filePath : "+filePath);
|
|
System.out.println("writer : "+writer);
|
|
System.out.println("--------------------------------------------------");
|
|
|
|
sqlSession.insert("common.insertUploadFileInfo", paramMap);
|
|
}
|
|
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
//FileRenameClass.clear();
|
|
}
|
|
}
|
|
|
|
/**
|
|
* targetObjId와 docType을 통해 File의 목록을 조회한다.<br>
|
|
* docType이 없다면 targetObjId를 통해서만 조회한다.
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public ArrayList<HashMap> getFileList(Map paramMap){
|
|
ArrayList resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = CommonUtils.keyChangeUpperArrayList((ArrayList)sqlSession.selectList("common.getFileList", paramMap));
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
|
|
/**
|
|
* targetObjId으로 결재 라인을 조회한다
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public ArrayList<HashMap> getApprovalLine(Map paramMap){
|
|
ArrayList resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = CommonUtils.keyChangeUpperArrayList((ArrayList)sqlSession.selectList("common.getApprovalLine", paramMap));
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* 파일을 논리적으로 삭제한다.
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public String deleteFileInfoLogical(Map paramMap){
|
|
String result = "";
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
int cnt = sqlSession.update("common.deleteFileInfo_logical", paramMap);
|
|
if(cnt > 0) result = "파일이 삭제되었습니다.";
|
|
else result = "삭제된 파일 데이터가 없습니다. <br>같은 문제가 발생 시, 관리자에게 문의바랍니다.";
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
/**
|
|
* 파일을 물리적으로 삭제한다.
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public String deleteFileInfoPhysical(Map paramMap){
|
|
String result = "";
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
int cnt = sqlSession.delete("common.deleteFileInfo_physical", paramMap);
|
|
if(cnt > 0) result = "파일이 물리적으로 삭제되었습니다.";
|
|
else result = "삭제된 파일 데이터가 없습니다. <br>같은 문제가 발생 시, 관리자에게 문의바랍니다.";
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return result;
|
|
}
|
|
|
|
|
|
/**
|
|
* code list
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public ArrayList<HashMap<String,Object>> getCodeList(Map paramMap){
|
|
ArrayList resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getCodeList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
public ArrayList<HashMap<String,Object>> getCodeList(String code_id, String sql_id) throws Exception {
|
|
ArrayList<HashMap<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
Map param = new HashMap();
|
|
param.put("codeId",code_id);
|
|
param.put("code",code_id); //230327추가
|
|
|
|
resultList = (ArrayList)sqlSession.selectList(sql_id, param);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* 해당하는 codeId 공급업체의 정보를 가져온다.
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public ArrayList<HashMap<String,Object>> getSupCdList(Map paramMap){
|
|
ArrayList<HashMap<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getSupCdList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* 해당하는 공급업체의 정보를 가져온다.
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public ArrayList<HashMap> getSupCdList2(Map paramMap){
|
|
ArrayList resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getsupplyselect", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* 해당하는 공급업체의 정보를 가져온다.
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public ArrayList<HashMap> getSupplyCode(Map paramMap){
|
|
ArrayList resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getAdminSupCdList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
public List<Map<String,Object>> getSupCdList3(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getsupplyselect", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
System.out.println("resultList:"+resultList);
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* 파일 단건정보 조회
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public Map getFileInfo(Map paramMap){
|
|
Map resultMap = new HashMap();
|
|
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultMap = CommonUtils.keyChangeUpperHashMap((HashMap)sqlSession.selectOne("common.getFileInfo", paramMap));
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultMap;
|
|
}
|
|
|
|
/**
|
|
* 파일 다운로드 로그 기록
|
|
* @param request
|
|
* @param fileMap
|
|
*/
|
|
public void setFileDownloadLog(HttpServletRequest request, Map fileMap){
|
|
HttpSession session = request.getSession();
|
|
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
|
|
|
|
String objId = CommonUtils.createObjId();
|
|
String systemName = Constants.SYSTEM_NAME;
|
|
String userId = CommonUtils.checkNull(person.getUserId());
|
|
String fileObjId = CommonUtils.checkNull(fileMap.get("OBJID"));
|
|
String remoteAddr = CommonUtils.checkNull(request.getRemoteAddr());
|
|
|
|
Map paramMap = new HashMap();
|
|
paramMap.put("objId", objId);
|
|
paramMap.put("systemName", systemName);
|
|
paramMap.put("userId", userId);
|
|
paramMap.put("fileObjId", fileObjId);
|
|
paramMap.put("remoteAddr", remoteAddr);
|
|
|
|
SqlSession sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
sqlSession.insert("common.insertFileDownloadLog", paramMap);
|
|
}
|
|
|
|
/**
|
|
* OEM정보 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getOEMList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getOEMList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* Part 정보조회(ajax, 콤보박스용)
|
|
* existPartNo : 해당 PartNo를 포함한 조회,
|
|
* notExistPart : 해당 PartNo를 제외한 조회,
|
|
* isLast : 조회된 Part의 최종여부(0: 배포전,1: 배포 후(최종))
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getPartMngList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
|
|
try{
|
|
|
|
setPartMngCommonCD(paramMap);
|
|
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getPartMngList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* 차종정보 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getCarTypeList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getCarTypeList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* 프로젝트 기준 차종정보 조회(ajax, 콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getProjectBaseCarTypeList(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getProjectBaseCarTypeList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* 차종그레이드 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getCarGradeList(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getCarGrade", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* 제품군정보 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getProductGroupList(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getProductGroupList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* 제품정보 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getProductList(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getProductList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* 지역사양정보 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getRegionList(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getRegionList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
|
|
/**
|
|
* 사원 목록 조회
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getUserList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getUserList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* 재질정보 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getMaterialList(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getMaterialList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* 자재유형정보 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getMaterialTypeList(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getMaterialTypeList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* 사양(option)정보 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getOptionSpecList(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getOptionSpecList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* SPEC정보 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getSPECList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getSPECList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* 적용지점정보 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getApplyPointList(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getApplyPointList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* 메뉴의 경로를 조회한다.
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public Map getMenuPath(Map paramMap){
|
|
Map resultMap = new HashMap();
|
|
SqlSession sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
try{
|
|
resultMap = (Map)sqlSession.selectOne("common.getMenuPath", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultMap;
|
|
}
|
|
|
|
/**
|
|
* milesone 목록을 조회한다.
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getMilestoneList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getMilestoneList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/*jmpark start*/
|
|
|
|
/**
|
|
* 검사명정보 조회
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getTestTypeList(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getTestTypeList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* Part 목록 조회(objId, partNo, partName)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getPartList(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
|
|
String partNo = CommonUtils.checkNull(paramMap.get("search_partNo"));
|
|
String partName = CommonUtils.checkNull(paramMap.get("search_partName"));
|
|
|
|
if(!"".equals(partNo) || !"".equals(partName)){
|
|
resultList = sqlSession.selectList("common.getPartList", paramMap);
|
|
}
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* 일지테크 사업장 목록 조회
|
|
* @return
|
|
*/
|
|
public List getLocationList(){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = sqlSession.selectList("common.getLocationList");
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* 가장 먼 SOP의 고객사object id, 차종 object id를 조회한다.
|
|
* @return
|
|
*/
|
|
public Map getCarInfoFarthestSOP(){
|
|
Map resultMap = new HashMap();
|
|
SqlSession sqlSession = null;
|
|
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultMap = (Map)sqlSession.selectOne("common.getCarInfoFarthestSOP");
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultMap;
|
|
}
|
|
|
|
/**
|
|
* 이름 순으로 가장 앞에 해당하는 제품군의 정보를 가져온다.
|
|
* @return
|
|
*/
|
|
public Map getProductGroupInfoOrderByName(){
|
|
Map resultMap = new HashMap();
|
|
SqlSession sqlSession = null;
|
|
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultMap = (Map)sqlSession.selectOne("common.getProductGroupInfoOrderByName");
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultMap;
|
|
}
|
|
|
|
/**
|
|
* 차종 object id를 통해 sop날짜를 구한다.
|
|
* @return
|
|
*/
|
|
public Map getSOPDate(Map paramMap){
|
|
Map resultMap = new HashMap();
|
|
SqlSession sqlSession = null;
|
|
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultMap = (Map)sqlSession.selectOne("common.getSOPDate_byCarObjId", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultMap;
|
|
}
|
|
|
|
/**
|
|
* OEM정보 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getOEMList_combo(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getOEMList_combo", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* 차종정보 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getCarTypeList_combo(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getCarTypeList_combo", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* 제품군정보 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getProductGroupList_combo(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
|
|
// resultList = (ArrayList)sqlSession.selectList("common.getProductGroupList_combo", paramMap);
|
|
|
|
paramMap.put("PRODUCT_GROUP_CODE",Constants.PRODUCT_GROUP_CODE);
|
|
|
|
resultList = (ArrayList)sqlSession.selectList("common.getProductGroupList_combo", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* 제품정보 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getProductList_combo(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getProductList_combo", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* 제품정보 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getOemList_combo(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getOEMList_combo", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* 재질정보 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getMaterialList_combo(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getMaterialList_combo", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* 자재유형정보 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getMaterialTypeList_combo(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getMaterialTypeList_combo", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* 사양(option)정보 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getOptionSpecList_combo(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getOptionSpecList_combo", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* 적용지점정보 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getApplyPointList_combo(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getApplyPointList_combo", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* SPEC정보 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getSPECList_combo(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getSPECList_combo", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* 지역사양정보 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getRegionList_combo(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getRegionList_combo", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
/*jmpark end*/
|
|
/*msryu start*/
|
|
|
|
/**
|
|
* 생산공장명 정보 조회
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getFactoryList(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getFactoryList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* 라인설치장소 정보 조회
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getLineAreaList(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getLineAreaList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* 설계체크리스트 대분류 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getDesignCheckListGroupList(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getDesignCheckListGroupList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* 설계체크리스트 중분류 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getDesignCheckListCategoryList(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getDesignCheckListCategoryList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* 설계체크리스트 소분류 조회(콤보박스용)
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getDesignCheckListAttributeList(Map paramMap){
|
|
List resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getDesignCheckListAttributeList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/*msryu end*/
|
|
|
|
/*edhwang start*/
|
|
|
|
/**
|
|
* 부서정보 조회
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getDeptList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = sqlSession.selectList("common.searchDeptList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
public HashMap<String,Object> getPageAuthInfo(HttpSession session,Map paramMap){
|
|
HashMap<String,Object> resultMap = new HashMap();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
|
|
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
|
|
String userId = CommonUtils.checkNull(person.getUserId());
|
|
|
|
paramMap.put("userId", userId);
|
|
resultMap = sqlSession.selectOne("common.selectUserViewMenuList",paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
return CommonUtils.toUpperCaseMapKey(resultMap);
|
|
}
|
|
|
|
|
|
/**
|
|
* <p> code 값을 바탕으로 option list 를 만들어주는 메서드</p>
|
|
* Precondition : param에 해당 파라메터가 들어 있어야한다
|
|
* 쿼리가 정의되어야한다
|
|
* Postcondition: 조회한 결과 map에 담아서 리턴
|
|
* @author 박창현
|
|
* @param param selvalue 없을경우 "" , element_id
|
|
*
|
|
* @return option select 값을 리턴한다
|
|
* @throws
|
|
*/
|
|
|
|
public String bizMakeLev1OptionList(String selValue) throws Exception {
|
|
StringBuffer sb = new StringBuffer();
|
|
SqlSession sqlSession = null;
|
|
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
Map param = new HashMap();
|
|
String code = "";
|
|
String name = "";
|
|
String sel = "";
|
|
String id = "";
|
|
String hide = "";
|
|
List rtn_list = new ArrayList();
|
|
rtn_list = (ArrayList)sqlSession.selectList("common.getlev1select", param);
|
|
Map temp = new HashMap();
|
|
selValue = CommonUtils.nullToEmpty(selValue);
|
|
for(int i=0; i<rtn_list.size(); i++){
|
|
temp = (Map)rtn_list.get(i);
|
|
code = (String)temp.get("CODE");
|
|
name = (String)temp.get("NAME");
|
|
|
|
sel = ( selValue.trim().equals(code.trim()) ) ? "selected" : "";
|
|
id = CommonUtils.nullToEmpty((String) temp.get("ID"));
|
|
hide =CommonUtils.checkNull((String) temp.get("val"),"");
|
|
|
|
if(!hide.equals("Y")){
|
|
/*sb.append("<option title='"+name+"' value='" + code + "' id='" + id + "'" + sel + ">" + name + "</option>");*/
|
|
sb.append("<option value='" + code + "' id='" + id + "'" + sel + ">" + name + "</option>");
|
|
}
|
|
}
|
|
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
return sb.toString();
|
|
}
|
|
|
|
/**
|
|
* <p> code 값을 바탕으로 option list 를 만들어주는 메서드</p>
|
|
* Precondition : param에 해당 파라메터가 들어 있어야한다
|
|
* 쿼리가 정의되어야한다
|
|
* Postcondition: 조회한 결과 map에 담아서 리턴
|
|
*
|
|
* @param param cod_id , selected value 선택값 없을경우 ""
|
|
* @author 박창현
|
|
* @return option select 값을 리턴한다
|
|
* @throws
|
|
*/
|
|
public String bizMakeOptionList(String code_id, String selValue, String sql_id) throws Exception {
|
|
return this.bizMakeOptionList(code_id, selValue, sql_id, false);
|
|
}
|
|
public String bizMakeOptionList(String code_id, String selValue, String sql_id, boolean showSelect) throws Exception {
|
|
return this.bizMakeOptionList(code_id, selValue, sql_id, "code", showSelect, "CODE", "NAME");
|
|
}
|
|
public String bizMakeOptionList(String code_id, String selValue, String sql_id, String [] data_id) throws Exception {
|
|
return this.bizMakeOptionList(code_id, selValue, sql_id, "code", false, "CODE", "NAME", data_id);
|
|
}
|
|
public String bizMakeOptionList(String code_id, String selValue, String sql_id, String param_id) throws Exception {
|
|
return this.bizMakeOptionList(code_id, selValue, sql_id, param_id, false, "CODE", "NAME");
|
|
}
|
|
public String bizMakeOptionList(String code_id, String selValue, String sql_id, String param_id, boolean showSelect) throws Exception {
|
|
return this.bizMakeOptionList(code_id, selValue, sql_id, param_id, showSelect, "CODE", "NAME");
|
|
}
|
|
public String bizMakeOptionList(String code_id, String selValue, String sql_id, boolean showSelect, String getCode, String getName) throws Exception {
|
|
return this.bizMakeOptionList(code_id, selValue, sql_id, "code", showSelect, getCode, getName);
|
|
}
|
|
public String bizMakeOptionList(String code_id, String selValue, String sql_id, String param_id, boolean showSelect, String getCode, String getName) throws Exception {
|
|
return this.bizMakeOptionList(code_id, selValue, sql_id, param_id, showSelect, getCode, getName, null);
|
|
}
|
|
public String bizMakeOptionList(String code_id, String selValue, String sql_id, String param_id, boolean showSelect, String getCode, String getName, String [] data_id) throws Exception {
|
|
StringBuffer sb = new StringBuffer();
|
|
SqlSession sqlSession = null;
|
|
//SqlSession sqlSessionMs = null;
|
|
try{
|
|
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
|
|
Map param = new HashMap();
|
|
param.put(CommonUtils.nvl(param_id,"code"),code_id);
|
|
String code = "";
|
|
String name = "";
|
|
String sel = "";
|
|
String id = "";
|
|
String dataText = "";
|
|
List rtn_list = new ArrayList();
|
|
rtn_list = sqlSession.selectList(sql_id, param);
|
|
|
|
Map temp = new HashMap();
|
|
selValue =CommonUtils.nullToEmpty(selValue);
|
|
|
|
if(showSelect){
|
|
sb.append("<option value=''>선택</option>");
|
|
}
|
|
|
|
for(int i=0; i<rtn_list.size(); i++){
|
|
temp = (Map)rtn_list.get(i);
|
|
//code = CommonUtils.checkNull((String)temp.get("code"), (String)temp.get("CODE"));
|
|
//name = CommonUtils.checkNull((String)temp.get("name"), (String)temp.get("NAME"));
|
|
code = CommonUtils.checkNull((String)temp.get("code"), CommonUtils.nullToEmpty((String)temp.get(CommonUtils.nvl(getCode,"CODE"))));
|
|
name = CommonUtils.checkNull((String)temp.get("name"), CommonUtils.nullToEmpty((String)temp.get(CommonUtils.nvl(getName,"NAME"))));
|
|
|
|
sel = ( selValue.trim().equals(code.trim()) ) ? "selected" : "";
|
|
id = CommonUtils.nullToEmpty(CommonUtils.checkNull((String)temp.get("id"), (String)temp.get("ID")));
|
|
/*sb.append("<option title='"+name+"' value='" + code + "' id='" + id + "'" + sel + ">" + name + "</option>");*/
|
|
|
|
if(CommonUtils.isNotEmpty(data_id)){
|
|
dataText = "";
|
|
for (int j=0; j<data_id.length; j++) {
|
|
dataText += " data-"+data_id[j]+"='"+temp.get(data_id[j])+"'";
|
|
}
|
|
}
|
|
|
|
//sb.append("<option value='" + code + "'" + sel + " id='"+id+"'>" + name + "</option>");
|
|
sb.append("<option value='" + code + "'" + sel + " id='"+id+"' "+(StringUtils.isEmpty(dataText) ? "" : dataText)+">" + name + "</option>");
|
|
}
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
return sb.toString();
|
|
}
|
|
/**
|
|
* <p> code 값을 바탕으로 option list 를 만들어주는 메서드</p>
|
|
* Precondition : param에 해당 파라메터가 들어 있어야한다
|
|
* 쿼리가 정의되어야한다
|
|
* Postcondition: 조회한 결과 map에 담아서 리턴
|
|
*
|
|
* @param param cod_id , selected value 선택값 없을경우 ""
|
|
* @author 허진
|
|
* @return option select 값을 리턴한다
|
|
* @throws
|
|
*/
|
|
public String bizMakeCodeIdOptionList(String code_id, String selValue, String sql_id) throws Exception {
|
|
StringBuffer sb = new StringBuffer();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
Map param = new HashMap();
|
|
param.put("code",code_id);
|
|
String code = "";
|
|
String name = "";
|
|
String sel = "";
|
|
String id = "";
|
|
List rtn_list = new ArrayList();
|
|
rtn_list = sqlSession.selectList(sql_id, param);
|
|
|
|
Map temp = new HashMap();
|
|
selValue =CommonUtils.nullToEmpty(selValue);
|
|
for(int i=0; i<rtn_list.size(); i++){
|
|
temp = (Map)rtn_list.get(i);
|
|
code = (String)temp.get("CODE");
|
|
name = (String)temp.get("NAME");
|
|
sel = ( selValue.trim().equals(code.trim()) ) ? "selected" : "";
|
|
id = CommonUtils.nullToEmpty((String) temp.get("ID"));
|
|
/*sb.append("<option title='"+name+"' value='" + code + "' id='" + id + "'" + sel + ">" + name + "</option>");*/
|
|
sb.append("<option value='" + code + "' id='" + id + "'" + sel + ">" + name + "</option>");
|
|
}
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
return sb.toString();
|
|
}
|
|
|
|
/**
|
|
* <p> code 값을 바탕으로 option list 를 만들어주는 메서드</p>
|
|
* Precondition : param에 해당 파라메터가 들어 있어야한다
|
|
* 쿼리가 정의되어야한다
|
|
* Postcondition: 조회한 결과 map에 담아서 리턴
|
|
*
|
|
* @param param cod_id , selected value 선택값 없을경우 ""
|
|
* @author 박창현
|
|
* @return option select 값을 리턴한다
|
|
* @throws
|
|
*/
|
|
public String bizMakeArrOptionList(ArrayList<String> code_id, String selValue, String sql_id) throws Exception {
|
|
StringBuffer sb = new StringBuffer();
|
|
SqlSession sqlSession = null;
|
|
Map param = new HashMap();
|
|
param.put("code",code_id);
|
|
String code = "";
|
|
String name = "";
|
|
String sel = "";
|
|
String id = "";
|
|
List rtn_list = new ArrayList();
|
|
rtn_list = sqlSession.selectList(sql_id, param);
|
|
|
|
Map temp = new HashMap();
|
|
selValue = CommonUtils.nullToEmpty(selValue);
|
|
for(int i=0; i<rtn_list.size(); i++){
|
|
temp = (Map)rtn_list.get(i);
|
|
code = (String)temp.get("CODE");
|
|
name = (String)temp.get("NAME");
|
|
sel = ( selValue.trim().equals(code.trim()) ) ? "selected" : "";
|
|
id = CommonUtils.nullToEmpty((String) temp.get("ID"));
|
|
/*sb.append("<option title='"+name+"' value='" + code + "' id='" + id + "'" + sel + ">" + name + "</option>");*/
|
|
sb.append("<option value='" + code + "' id='" + id + "'" + sel + ">" + name + "</option>");
|
|
}
|
|
return sb.toString();
|
|
}
|
|
|
|
|
|
/**
|
|
* <p> code 값을 바탕으로 option list 를 만들어주는 메서드</p>
|
|
* Precondition : param에 해당 파라메터가 들어 있어야한다
|
|
* 쿼리가 정의되어야한다
|
|
* Postcondition: 조회한 결과 map에 담아서 리턴
|
|
*
|
|
* @param param cod_id , selected value 선택값 없을경우 ""
|
|
* @author 박창현
|
|
* @return option select 값을 리턴한다
|
|
* @throws
|
|
*/
|
|
public String UpgMakeOptionList(String code_id, String selValue, String sql_id) throws Exception {
|
|
StringBuffer sb = new StringBuffer();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
Map param = new HashMap();
|
|
param.put("code",code_id);
|
|
String code = "";
|
|
String name = "";
|
|
String sel = "";
|
|
String id = "";
|
|
String productobjId = "";
|
|
List rtn_list = new ArrayList();
|
|
rtn_list = sqlSession.selectList(sql_id, param);
|
|
|
|
Map temp = new HashMap();
|
|
selValue =CommonUtils.nullToEmpty(selValue);
|
|
for(int i=0; i<rtn_list.size(); i++){
|
|
temp = (Map)rtn_list.get(i);
|
|
code = (String)temp.get("code");
|
|
name = (String)temp.get("name");
|
|
sel = ( selValue.trim().equals(code.trim()) ) ? "selected" : "";
|
|
id = CommonUtils.nullToEmpty((String) temp.get("id"));
|
|
productobjId = CommonUtils.nullToEmpty((String) temp.get("objid"));
|
|
sb.append("<option title='"+name+"' value='" + code + "' id='" + id + "'" + sel + "' objid='" + productobjId +"'>" + name + "</option>");
|
|
/*sb.append("<option value='" + code + "'" + sel + ">" + name + "</option>");*/
|
|
}
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
return sb.toString();
|
|
}
|
|
|
|
/**
|
|
* 쿼리 결과값에 Select option 단건 html 생성 추가
|
|
* @param List<Map>
|
|
* @param 조회코드값
|
|
* @param 선택코드값
|
|
*/
|
|
|
|
public List listAddeEement(List list,String inputString,String parent_code ,String select_Code,String Query){
|
|
Map<String ,String> listMap = new HashMap();
|
|
if(list.size()>0){
|
|
for(int i=0;i<list.size();i++){
|
|
listMap = (Map) list.get(i);
|
|
list.remove(i);
|
|
|
|
try {
|
|
listMap.put(inputString, bizMakeOptionList(parent_code, listMap.get(select_Code),Query));
|
|
} catch (Exception e) {
|
|
// TODO Auto-generated catch block
|
|
e.printStackTrace();
|
|
}
|
|
list.add(i, listMap);
|
|
}
|
|
|
|
}
|
|
return list;
|
|
}
|
|
|
|
/**
|
|
* 쿼리 결과값에 Select option 단건 html 생성 추가
|
|
* @param List<Map>
|
|
* @param 조회코드값
|
|
* @param 선택코드값
|
|
*/
|
|
|
|
public List listAddlistvaleeEement(List list,String inputString,String parent_code ,String select_Code,String Query){
|
|
Map<String ,String> listMap = new HashMap();
|
|
if(list.size()>0){
|
|
for(int i=0;i<list.size();i++){
|
|
listMap = (Map) list.get(i);
|
|
list.remove(i);
|
|
|
|
try {
|
|
listMap.put(inputString, bizMakeOptionList(listMap.get(parent_code), listMap.get(select_Code),Query));
|
|
} catch (Exception e) {
|
|
// TODO Auto-generated catch block
|
|
e.printStackTrace();
|
|
}
|
|
list.add(i, listMap);
|
|
}
|
|
|
|
}
|
|
return list;
|
|
}
|
|
|
|
|
|
/**
|
|
* 쿼리 결과값에 Select option 단건 html 생성 추가
|
|
* @param List<Map>
|
|
* @param 조회코드값
|
|
* @param 선택코드값
|
|
*/
|
|
|
|
public List listAddeEement2(List list,String inputString,String param_code ,String select_Code,String Query){
|
|
Map<String ,String> listMap = new HashMap();
|
|
if(list.size()>0){
|
|
for(int i=0;i<list.size();i++){
|
|
listMap = (Map) list.get(i);
|
|
list.remove(i);
|
|
|
|
try {
|
|
listMap.put(inputString, bizMakeOptionList(listMap.get(param_code), listMap.get(select_Code),Query));
|
|
} catch (Exception e) {
|
|
// TODO Auto-generated catch block
|
|
e.printStackTrace();
|
|
}
|
|
list.add(i, listMap);
|
|
}
|
|
|
|
}
|
|
return list;
|
|
}
|
|
/*edhwang end*/
|
|
|
|
/**
|
|
* jqGrid selectBox에서 사용될 코드정보
|
|
* return "{ID:NAME, ID:NAME, ID:NAME, ...}"
|
|
*/
|
|
public String getJqGridSelectBoxJsonData(String sqlId, Map param, String emptyOptText){
|
|
return getJqGridSelectBoxJsonData2(sqlId, param, emptyOptText, "CODE_ID", "CODE_NAME");
|
|
}
|
|
public String getJqGridSelectBoxJsonData2(String sqlId, Map param, String emptyOptText, String id_colName, String name_colName){
|
|
StringBuffer sbJson = new StringBuffer();
|
|
SqlSession sqlSession = null;
|
|
try {
|
|
if(emptyOptText != null){
|
|
sbJson.append("\"\":\""+emptyOptText+"\",");
|
|
}
|
|
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
List list = CommonUtils.keyChangeUpperArrayList((ArrayList)sqlSession.selectList(sqlId, param));
|
|
for(int i=0;i<list.size();i++){
|
|
Map data = (Map)list.get(i);
|
|
sbJson.append("\""+String.valueOf(data.get(id_colName))+"\":\""+(String)data.get(name_colName)+"\"");
|
|
if(i<list.size()-1){
|
|
sbJson.append(",");
|
|
}
|
|
}
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
} finally {
|
|
sqlSession.close();
|
|
}
|
|
|
|
return "{"+sbJson.toString()+"}";
|
|
}
|
|
|
|
/**
|
|
* 코드정보List를 Json으로 반환
|
|
* return "[{CODE_ID:"xxx", CODE_NAME:"xxx", PARENT_ID:"xxx", ...},{...},...]"
|
|
*/
|
|
public String getJsonSqlInfoList(String sqlId, Map param){
|
|
String strJson = "";
|
|
SqlSession sqlSession = null;
|
|
try {
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
strJson = JsonUtil.ListToJson(CommonUtils.keyChangeUpperArrayList((ArrayList)sqlSession.selectList(sqlId, param)));
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
} finally {
|
|
sqlSession.close();
|
|
}
|
|
|
|
return strJson;
|
|
}
|
|
/**
|
|
* 계층정보 List를 LEVEL 3 Json String으로 반환
|
|
* return "{ LEV1 : [{"col_1":"xxx", "col_2":"xxx", "col_3":"xxx", ...},{...},...]
|
|
* ,LEV2 : [{"col_1":"xxx", "col_2":"xxx", "col_3":"xxx", ...},{...},...]
|
|
* ,LEV3 : [{"col_1":"xxx", "col_2":"xxx", "col_3":"xxx", ...},{...},...]
|
|
* ,ETC : [{"col_1":"xxx", "col_2":"xxx", "col_3":"xxx", ...},{...},...]
|
|
* }"
|
|
*/
|
|
public String getJsonSqlInfoListLevel3(String sqlId, Map param){
|
|
String strJson = "";
|
|
SqlSession sqlSession = null;
|
|
try {
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
|
|
ArrayList<Map> allList = (ArrayList)sqlSession.selectList(sqlId, param);
|
|
Map _result = new HashMap();
|
|
ArrayList<Map> listLEV1 = new ArrayList();
|
|
ArrayList<Map> listLEV2 = new ArrayList();
|
|
ArrayList<Map> listLEV3 = new ArrayList();
|
|
ArrayList<Map> listETC = new ArrayList();
|
|
for(Map row:allList){
|
|
if( CommonUtils.checkNull(row.get("lev")).equals("1")){
|
|
listLEV1.add(CommonUtils.keyChangeUpperMap(row));
|
|
}else if(CommonUtils.checkNull(row.get("lev")).equals("2")){
|
|
listLEV2.add(CommonUtils.keyChangeUpperMap(row));
|
|
}else if(CommonUtils.checkNull(row.get("lev")).equals("3")){
|
|
listLEV3.add(CommonUtils.keyChangeUpperMap(row));
|
|
}else{
|
|
listETC.add(CommonUtils.keyChangeUpperMap(row));
|
|
}
|
|
}
|
|
|
|
strJson += "{";
|
|
strJson += " \"LEV1\" : "+JsonUtil.ListToJson(listLEV1);
|
|
strJson += " ,\"LEV2\" : "+JsonUtil.ListToJson(listLEV2);
|
|
strJson += " ,\"LEV3\" : "+JsonUtil.ListToJson(listLEV3);
|
|
strJson += " ,\"ETC\" : "+JsonUtil.ListToJson(listETC );
|
|
strJson += "}";
|
|
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
} finally {
|
|
sqlSession.close();
|
|
}
|
|
|
|
return strJson;
|
|
}
|
|
public ArrayList getArrayListBySqlId(String sqlId, Map param){
|
|
ArrayList list = new ArrayList<>();
|
|
SqlSession sqlSession = null;
|
|
try {
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
list = (ArrayList)sqlSession.selectList(sqlId, param);
|
|
} catch (Exception e) {
|
|
e.printStackTrace();
|
|
} finally {
|
|
sqlSession.close();
|
|
}
|
|
|
|
return list;
|
|
}
|
|
|
|
public List getProgressProjectNoList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getProgressProjectNoList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
public List getProjectNoList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getProjectNoList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
public Map createObjId(){
|
|
Map<String,Object> resultMap = new HashMap();
|
|
|
|
resultMap.put("OBJID", CommonUtils.createObjId());
|
|
|
|
return resultMap;
|
|
}
|
|
|
|
|
|
/**
|
|
* 해당하는 자재마스터 값으로 단가를 가져온다
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public ArrayList<HashMap<String,Object>> resourcePrice(Map paramMap){
|
|
ArrayList<HashMap<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.resourcePrice", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* 수주 진행상황 정보 조회(ajax, 콤보박스용)
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getConceptStatus(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getConceptStatus", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* PM 리스트 정보 조회(ajax, 콤보박스용)
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getPmList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getPmList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* 양산제품 목록
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getProductMgmtList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getProductCodeselect", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* UPG 목록
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getProductUPGList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getProductUPGselect", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
/**
|
|
* UPG 목록
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getProductUPGNEWList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getProductUPGNEWselect", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
|
|
/**
|
|
* UPG PART 목록
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getProductUPGPARTList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getProductUPGPARTselect", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* 양산제품에 해당하는 SPEC 정보 조회
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getProductSPECList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getProductSPECSelect", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
|
|
/**
|
|
* <p> code 값을 바탕으로 option list 를 만들어주는 메서드</p>
|
|
* Precondition : param에 해당 파라메터가 들어 있어야한다
|
|
* 쿼리가 정의되어야한다
|
|
* Postcondition: 조회한 결과 map에 담아서 리턴
|
|
*
|
|
* @param param cod_id , selected value 선택값 없을경우 ""
|
|
* @author 박창현
|
|
* @return option select 값을 리턴한다
|
|
* @throws
|
|
*/
|
|
public String bizMakeCheckBoxMultiList(String code_id,String selector_id ,String selValues[], String sql_id) throws Exception {
|
|
StringBuffer sb = new StringBuffer();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
Map param = new HashMap();
|
|
param.put("code",code_id);
|
|
String selValue ="";
|
|
String code = "";
|
|
String name = "";
|
|
String checked = "";
|
|
String id = "";
|
|
List rtn_list = new ArrayList();
|
|
rtn_list = sqlSession.selectList(sql_id, param);
|
|
|
|
Map temp = new HashMap();
|
|
for(int i=0; i<rtn_list.size(); i++){
|
|
boolean check = false;
|
|
temp = (Map)rtn_list.get(i);
|
|
code = (String)temp.get("code");
|
|
name = (String)temp.get("name");
|
|
if(null!=selValues){
|
|
for(int j=0; j<selValues.length; j++){
|
|
selValue =CommonUtils.nullToEmpty(selValues[j]);
|
|
if(selValue.trim().equals(code.trim())){
|
|
check = true;
|
|
}
|
|
//checked = ( selValue.trim().equals(code.trim()) ) ? "checked" : "";
|
|
}
|
|
}
|
|
|
|
checked = (check) ? "checked" : "";
|
|
|
|
id = CommonUtils.nullToEmpty((String) temp.get("id"));
|
|
/*sb.append("<option title='"+name+"' value='" + code + "' id='" + id + "'" + sel + ">" + name + "</option>");*/
|
|
sb.append("<input type='checkbox' id='"+selector_id+"' name='"+selector_id+"' value='"+code+"' " + checked + ">" + name+" ");
|
|
}
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
return sb.toString();
|
|
}
|
|
|
|
/**
|
|
* 템플릿 리스트 조회
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List gettemplate_code_detailList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.gettemplate_code_detailList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
|
|
/**
|
|
* AS 제품 리스트 조회
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getAsProductList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getAsProductList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* 고객 정보 조회
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getCustomerInfo(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getCustomerInfo", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
|
|
/**
|
|
* 계약 옵션 리스트 조회
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getContractOptionList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getContractOptionList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
|
|
/**
|
|
* 계약 제품 조회
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getContractcodeList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getContractcodeList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
/**
|
|
* 계약 제품 조회
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getContractProductList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getContractProductList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* 옵션 리스트 조회
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getOptionChildList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getOptionChildList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* 옵션 최신 금액 조회
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getOptionLastPrice(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getOptionLastPrice", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
|
|
/**
|
|
* 옵션 리스트 조회
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getOptionHighselect(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getOptionHighselect", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* AS 제품 년도 리스트 조회
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getAsContractYearList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getAsContractYearList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
|
|
/**
|
|
* 고객 정보 조회
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getPartInfo(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getPartInfo", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* 구조등록의 기종에 해당하는 스펙 목록을 가져온다.
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public ArrayList<HashMap<String,Object>> getSpecNameList(Map paramMap){
|
|
ArrayList resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getSpecNameList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return resultList;
|
|
}
|
|
|
|
/**
|
|
* 해당하는 codeId 공급업체의 정보를 가져온다.
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public ArrayList<HashMap<String,Object>> getAdminSupCdList(Map paramMap){
|
|
ArrayList<HashMap<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getAdminSupCdList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* 양산제품 목록
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getAjaxProductMgmtList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getAjaxProductMgmtList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* 해당하는 codeId 공급업체의 정보를 가져온다.
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public ArrayList<HashMap<String,Object>> getAdminSupplyCodeList(Map paramMap){
|
|
ArrayList<HashMap<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getAdminSupplyCodeList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* 상담지역2 조회
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getAddress2List(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getAddress2List", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
* 계약 제품 코드 조회
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getproductcode(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getproductcode", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* 프로젝트목록
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getProjectNameList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getProjectNameList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* UNIT 목록
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getUnitCodeList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getUnitCodeList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* UNIT 목록
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getProjectUnitCodeList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getProjectUnitCodeList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* Bom UNIT 목록
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getBomUnitCodeList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getBomUnitCodeList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* Bom PART 목록
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getBomPartList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getBomPartList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
public List getBomPartLastList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getBomPartLastList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
/**
|
|
* 해당하는 part_objid 발주 정보를 가져온다.
|
|
*/
|
|
public ArrayList<HashMap<String,Object>> getPurchaseOrderCdList(Map paramMap){
|
|
ArrayList<HashMap<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getPurchaseOrderCdList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
|
|
public ArrayList<Map> selectListPaging(String sqlId, HttpServletRequest request, Map paramMap) {
|
|
return selectListPagingAct(sqlId, request, paramMap, false);
|
|
}
|
|
public ArrayList<Map> selectListPagingNew(String sqlId, HttpServletRequest request, Map paramMap) {
|
|
return selectListPagingAct(sqlId, request, paramMap, true);
|
|
}
|
|
/**
|
|
* sqlId 하나로 페이징 정보 처리하고 List를 반환
|
|
* @author 밧밧이
|
|
*/
|
|
public ArrayList<Map> selectListPagingAct(String sqlId, HttpServletRequest request, Map paramMap, boolean isNew) {
|
|
ArrayList<Map> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
Logger log = Logger.getLogger(this.getClass());
|
|
StringBuffer qryCnt = new StringBuffer();
|
|
StringBuffer qryList = new StringBuffer();
|
|
|
|
try {
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
|
|
//#GET Query ///////////////////////////////////////////////////////
|
|
String query = getSqlByParams(sqlSession, sqlId, request, paramMap);
|
|
|
|
//#GET COUNT ///////////////////////////////////////////////////////
|
|
String countPerPage = CommonUtils.checkNull(request.getParameter("countPerPage"), Constants.ADMIN_COUNT_PER_PAGE+"");
|
|
qryCnt.append("SELECT CEIL(TOTAL_CNT/"+countPerPage+")::integer as MAX_PAGE_SIZE ");
|
|
qryCnt.append(" ,TOTAL_CNT::integer ");
|
|
qryCnt.append(" FROM ( ");
|
|
qryCnt.append(" SELECT COUNT(1)::float as TOTAL_CNT ");
|
|
qryCnt.append(" FROM ( ");
|
|
qryCnt.append( query);
|
|
qryCnt.append(" ) AS SQL_TABLE ");
|
|
qryCnt.append(" ) AS RESULT_TABLE ");
|
|
|
|
ResultSet rsCnt = sqlSession.getConnection().prepareStatement(qryCnt.toString()).executeQuery();
|
|
// log.debug("##selectListAndPaging["+sqlId+"]## COUNT Query :: \n"+qryCnt.toString());
|
|
ResultSetMetaData mdCnt = rsCnt.getMetaData();
|
|
int columnsCnt = mdCnt.getColumnCount();
|
|
rsCnt.next();
|
|
HashMap<String,Object> rowCnt = new HashMap<String, Object>(columnsCnt);
|
|
for(int i=1; i<=columnsCnt; ++i) {
|
|
rowCnt.put(mdCnt.getColumnName(i), rsCnt.getObject(i));
|
|
//rowCnt.put(mdCnt.getColumnName(i).toUpperCase(), rsCnt.getObject(i));
|
|
}
|
|
rowCnt.putAll(paramMap);
|
|
Map pageMap = CommonUtils.setPagingInfo(request, rowCnt);
|
|
String TOTAL_CNT = CommonUtils.checkNull(CommonUtils.checkNull(pageMap.get("TOTAL_CNT"), ""+pageMap.get("total_cnt")),"0");
|
|
int TOTAL_CNT_INT = Integer.parseInt(TOTAL_CNT);
|
|
paramMap.put("TOTAL_CNT", CommonUtils.checkNull(pageMap.get("TOTAL_CNT"),"0"));
|
|
paramMap.put("MAX_PAGE_SIZE", CommonUtils.checkNull(pageMap.get("MAX_PAGE_SIZE"),"1"));
|
|
paramMap.put("COUNT_PER_PAGE", CommonUtils.checkNull(pageMap.get("COUNT_PER_PAGE"),"0"));
|
|
|
|
//#GET Query ///////////////////////////////////////////////////////
|
|
query = getSqlByParams(sqlSession, sqlId, request, pageMap); //240913추가
|
|
|
|
//#GET LIST ///////////////////////////////////////////////////////
|
|
//qryList = new StringBuffer();
|
|
selectListPaging2(sqlSession, log, sqlId, request, pageMap, query, resultList);
|
|
|
|
//결과 없으면 재검색 1번(240723 추가)
|
|
if(TOTAL_CNT_INT > 0 && (resultList == null || resultList.isEmpty()) ) { //!isFirstRecursive &&
|
|
pageMap.put("page", "1"); //1페이지 검색
|
|
pageMap = CommonUtils.setPagingInfo(request, rowCnt); //reset
|
|
//return selectListPagingAct(sqlId, request, paramMap, isNew, true);
|
|
selectListPaging2(sqlSession, log, sqlId, request, pageMap, query, resultList);
|
|
}
|
|
|
|
//#SET PAGE_HTML ///////////////////////////////////////////////////////
|
|
String PAGE_HTML = "";
|
|
if(isNew){
|
|
PAGE_HTML = CommonUtils.getPageingHtml2(request, resultList, false, pageMap);
|
|
}else{
|
|
PAGE_HTML = CommonUtils.getPageingHtml(request, resultList, false);
|
|
}
|
|
paramMap.put("PAGE_HTML", PAGE_HTML);
|
|
request.setAttribute("PAGE_HTML" , PAGE_HTML);
|
|
} catch (SQLException e) {
|
|
// TODO Auto-generated catch block
|
|
log.error("selectListAndPaging##[ "+sqlId+" ]## LIST Query :: \n"+qryCnt.toString());
|
|
log.error("selectListAndPaging##[ "+sqlId+" ]## LIST Query :: \n"+qryList.toString());
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
paramMap.put("RESULTLIST", resultList);
|
|
return resultList;
|
|
}
|
|
|
|
public String getSqlByParams(SqlSession sqlSession, String sqlId, HttpServletRequest request, Map paramMap) {
|
|
//#GET Query ///////////////////////////////////////////////////////
|
|
BoundSql boundSql = sqlSession.getConfiguration().getMappedStatement(sqlId).getBoundSql(paramMap);
|
|
String query = boundSql.getSql();
|
|
Object pObj = boundSql.getParameterObject();
|
|
//System.out.println("query:"+query);
|
|
//System.out.println("pObj:"+pObj);
|
|
if(pObj != null) {
|
|
List<ParameterMapping> parameterMapping = boundSql.getParameterMappings();
|
|
// String parameter = "";
|
|
// Object object;
|
|
for (ParameterMapping p : parameterMapping) {
|
|
|
|
String propertyName = p.getProperty();
|
|
//System.out.println("propertyName:"+propertyName); //__frch_item_0 __frch_item_1...
|
|
Object parameterObject = paramMap.get(propertyName);
|
|
//System.out.println("parameterObject1:"+parameterObject);
|
|
|
|
if (boundSql.hasAdditionalParameter(propertyName)) {
|
|
parameterObject = boundSql.getAdditionalParameter(propertyName);
|
|
} else if (paramMap.containsKey(propertyName)) {
|
|
parameterObject = paramMap.get(propertyName);
|
|
}
|
|
//System.out.println("parameterObject2:"+parameterObject);
|
|
|
|
if (parameterObject == null) {
|
|
query = query.replaceFirst("\\?", "NULL");
|
|
}else {
|
|
if (propertyName.startsWith("__frch_") && parameterObject instanceof Collection<?>) { //__frch_item_0 __frch_item_1...
|
|
Collection<?> parameterCollection = (Collection<?>) parameterObject;
|
|
StringBuilder placeholders = new StringBuilder();
|
|
for (Object parameter : parameterCollection) {
|
|
//System.out.println("array param:"+parameter);
|
|
//if (parameter instanceof String) {
|
|
//placeholders.append("'").append(parameter).append("', ");
|
|
query = query.replaceFirst("\\?", "'" + parameter + "'");
|
|
//}
|
|
}
|
|
} else if (parameterObject instanceof String) {
|
|
String parameter = (String) parameterObject;
|
|
if(CommonUtils.isNotBlank(parameter))
|
|
query = query.replaceFirst("\\?", "'" + parameter + "'");
|
|
} else if (parameterObject instanceof String[]) {
|
|
String[] parameterArray = (String[]) parameterObject;
|
|
StringBuilder placeholders = new StringBuilder();
|
|
for (String parameter : parameterArray) {
|
|
placeholders.append("'").append(parameter).append("', ");
|
|
// query = query.replaceFirst("\\?", "'" + parameter + "'");
|
|
}
|
|
query = query.replaceFirst("\\?", placeholders.substring(0, placeholders.length() - 2)); // 마지막 쉼표 제거
|
|
} else {
|
|
String parameter = ((Object)parameterObject).toString();
|
|
if(CommonUtils.isNotBlank(parameter))
|
|
query = query.replaceFirst("\\?", "'" + parameter + "'");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
return query;
|
|
}
|
|
|
|
public ArrayList<Map> selectListPaging2(SqlSession sqlSession, Logger log, String sqlId, HttpServletRequest request, Map paramMap, String query, ArrayList<Map> resultList) {
|
|
|
|
StringBuffer qryList = new StringBuffer();
|
|
qryList.append("SELECT RESULT_TABLE.* ");
|
|
qryList.append("\n FROM ( ");
|
|
qryList.append("\n SELECT ");
|
|
if(query.indexOf("RNUM") == -1)
|
|
qryList.append("\n ROW_NUMBER() OVER() AS RNUM, ");
|
|
qryList.append("\n SQL_TABLE.* ");
|
|
qryList.append("\n FROM ( ");
|
|
qryList.append("\n"+ query);
|
|
qryList.append("\n ) AS SQL_TABLE ");
|
|
qryList.append("\n ) AS RESULT_TABLE ");
|
|
qryList.append("\n WHERE 1=1 ");
|
|
qryList.append(" AND RNUM >= "+paramMap.get("PAGE_START"));
|
|
qryList.append(" AND RNUM <= "+paramMap.get("PAGE_END" ));
|
|
|
|
try {
|
|
ResultSet rs = sqlSession.getConnection().prepareStatement(qryList.toString()).executeQuery();
|
|
log.debug("selectListAndPaging##["+sqlId+"]## LIST Query :: \n"+qryList.toString());
|
|
ResultSetMetaData md = rs.getMetaData();
|
|
int columns = md.getColumnCount();
|
|
|
|
while(rs.next()){
|
|
HashMap<String,Object> row = new HashMap<String, Object>(columns);
|
|
for(int i=1; i<=columns; ++i) {
|
|
row.put(md.getColumnName(i).toUpperCase(), rs.getObject(i)); //컬럼명 대문자처리
|
|
}
|
|
resultList.add(row);
|
|
}
|
|
} catch (SQLException e) {
|
|
// TODO Auto-generated catch block
|
|
log.error("selectListAndPaging##[ "+sqlId+" ]## LIST Query :: \n"+qryList.toString());
|
|
e.printStackTrace();
|
|
}finally{
|
|
}
|
|
return resultList;
|
|
}
|
|
/**
|
|
* row 조회 공통
|
|
* @author 밧밧이
|
|
*/
|
|
public HashMap selectOne(String sqlId, HttpServletRequest request, Map paramMap){
|
|
HashMap resultMap = new HashMap();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultMap = sqlSession.selectOne(sqlId, paramMap);
|
|
}catch(Exception e){
|
|
throw e;
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
return CommonUtils.keyChangeUpperHashMap(resultMap); //컬럼명 대문자처리
|
|
}
|
|
/**
|
|
* list 조회 공통
|
|
* @author 밧밧이
|
|
*/
|
|
public ArrayList selectList(String sqlId, HttpServletRequest request, Map paramMap){
|
|
ArrayList resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList(sqlId, paramMap);
|
|
}catch(Exception e){
|
|
throw e;
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
return CommonUtils.keyChangeUpperArrayList(resultList); //컬럼명 대문자처리
|
|
}
|
|
|
|
|
|
/**
|
|
* user map
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public Map<String,Object> getUserMap(Map paramMap){
|
|
Map resultMap = new HashMap();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultMap = (Map)sqlSession.selectOne("common.getUserInfo", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.keyChangeUpperHashMap(resultMap);
|
|
}
|
|
|
|
/**
|
|
* Bom UNIT 목록
|
|
* @param request
|
|
* @param paramMap
|
|
* @return
|
|
*/
|
|
public List getUnitTitleCodeList(Map paramMap){
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
SqlSession sqlSession = null;
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
resultList = (ArrayList)sqlSession.selectList("common.getUnitTitleCodeList", paramMap);
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
|
|
return CommonUtils.toUpperCaseMapKey(resultList);
|
|
}
|
|
|
|
|
|
/**
|
|
* 업무 진행중 메일 발송
|
|
* @param Map paramMap
|
|
* @param String mailType 업무별 유니크한 값
|
|
* @param String 메일 받을사람 1명지정 (ex 프 로젝트 PM)
|
|
*/
|
|
public void SendMail(Map<String, Object> paramMap,String mailType,String sendUser) {
|
|
SqlSession sqlSession = null;
|
|
List<Map<String,Object>> resultList = new ArrayList();
|
|
|
|
Map userMap = new HashMap();
|
|
//메일 발송
|
|
try{
|
|
sqlSession = SqlMapConfig.getInstance().getSqlSession();
|
|
|
|
//제목
|
|
String subject = "";
|
|
String contents = "";
|
|
|
|
paramMap.put("MAILTYPE",mailType);
|
|
|
|
|
|
if("CONTRACT_REG".equals(mailType)){
|
|
subject ="["+CommonUtils.checkNull(paramMap.get("project_name"))+"] 신규 계약건이 등록되었습니다";
|
|
contents = "영업관리_계약관리 등록에서 업무 진행 바랍니다.";
|
|
resultList = (ArrayList)sqlSession.selectList("common.getworkmailList", paramMap);
|
|
|
|
}else if("CONTRACT_COMP".equals(mailType)){
|
|
subject = "["+CommonUtils.checkNull(paramMap.get("project_name"))+"] PM으로 지정되었습니다 프로젝트 등록 바랍니다";
|
|
contents ="프로젝트관리_진행관리 탭에서 프로젝트 등록 바랍니다.";
|
|
|
|
}else if("PROJECT_REG".equals(mailType)){
|
|
subject = "["+CommonUtils.checkNull(paramMap.get("project_name"))+"] 프로젝트가 등록되었습니다.";
|
|
contents ="유닛 등록(설계), 담당자 지정 바랍니다.";
|
|
resultList = (ArrayList)sqlSession.selectList("common.getworkmailList", paramMap);
|
|
|
|
}else if("TASK_SAVE".equals(mailType)){
|
|
|
|
subject = "["+CommonUtils.checkNull(paramMap.get("project_name"))+"] 담당자로 지정되었습니다";
|
|
contents ="계획 일정 및 실적 입력 바랍니다.";
|
|
|
|
}else if("INSTRUCTION_MNG_ASSIGN".equals(mailType)){ //지시사항 이행관리 dashboardservice에서 발송
|
|
|
|
}
|
|
|
|
|
|
if(!"".equals(CommonUtils.checkNull(sendUser))){
|
|
//유저 메일 가져오기
|
|
paramMap.put("email_user", sendUser);
|
|
userMap = (Map)sqlSession.selectOne("admin.selectUserInfo", paramMap);
|
|
|
|
MailUtil.sendMailNew(CommonUtils.checkNull(userMap.get("email")), subject, contents);
|
|
}
|
|
|
|
for(Map resultMap:resultList){
|
|
String email = CommonUtils.checkNull(resultMap.get("email"));
|
|
MailUtil.sendMailNew(email, subject, contents);
|
|
}
|
|
|
|
//to user
|
|
//ArrayList<String> toUserIdList = new ArrayList<String>();
|
|
//to email
|
|
//ArrayList<String> toEmailList = new ArrayList<String>();
|
|
}catch(Exception e){
|
|
e.printStackTrace();
|
|
}finally{
|
|
sqlSession.close();
|
|
}
|
|
}
|
|
|
|
|
|
}
|