Files
wace_plm/src/com/pms/service/OrderMngService.java
chpark da06c4684c Initial commit: WACE PLM with database initialization features
- Add Docker Compose configurations for dev, prod, and standalone environments
- Add database initialization scripts (init-db.sh, init-db-docker.sh)
- Add enhanced start-docker-linux.sh with DB init support
- Add comprehensive database initialization guide
- Support for automatic dbexport.pgsql import on first run
- Include safety checks for production environment
2025-08-29 15:46:08 +09:00

2108 lines
59 KiB
Java

package com.pms.service;
import java.io.File;
import java.io.FileInputStream;
import java.sql.Clob;
import java.util.ArrayList;
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.ibatis.session.SqlSession;
import org.apache.poi.ss.usermodel.CellValue;
import org.apache.poi.ss.usermodel.DataFormatter;
import org.apache.poi.ss.usermodel.FormulaEvaluator;
import org.apache.poi.xssf.usermodel.XSSFCell;
import org.apache.poi.xssf.usermodel.XSSFRow;
import org.apache.poi.xssf.usermodel.XSSFSheet;
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.pms.common.JsonUtil;
import com.pms.common.Message;
import com.pms.common.SqlMapConfig;
import com.pms.common.bean.PersonBean;
import com.pms.common.utils.CommonUtils;
import com.pms.common.utils.Constants;
import com.pms.common.utils.MailUtil;
@Service
public class OrderMngService {
CommonService commonService = null;
@Autowired
ProjectService projectService;
@Autowired
ProductionMngService productionMngService;
@Autowired
InventoryMngService inventoryMngService;
@Autowired
public void setCommonService(CommonService commonService){
this.commonService = commonService;
}
public boolean saveProjectConceptBasicInfo(Map paramMap){
boolean result = false;
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession();
int cnt = sqlSession.update("common.getMilestoneList", paramMap);
if(cnt > 0) result = true;
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return result;
}
/*************************************************************************************************************************/
/*jmpark start*/
/**
* 부서정보 조회
* @param paramMap
* @return
*/
public List searchDeptList(Map paramMap){
List resultList = new ArrayList();
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession();
resultList = sqlSession.selectList("projectConcept.searchDeptList", paramMap);
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultList;
}
/**
* 수주활동 제품별 협조부서 등록
* @param paramMap
* @param checkedDeptList
*/
public int saveProjectConceptProductDeptInfo(Map paramMap, List<String> checkedDeptList){
int resultCnt = 0;
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession();
if(checkedDeptList != null){
for(String deptCode : checkedDeptList){
String objId = CommonUtils.createObjId();
//set parameter
paramMap.put("deptCode", deptCode);
paramMap.put("objId", objId);
resultCnt += (int)sqlSession.update("projectConcept.mergeProjectConceptProductDeptInfo", paramMap);
}
}
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultCnt;
}
public void orderApplySave(HttpServletRequest request,Map paramMap){
SqlSession sqlSession = null;
try{
List<Map<String, Object>> gridDataList = JsonUtil.JsonToList(CommonUtils.checkNull(paramMap.get("jqGrid")));
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
byte[] buf = new byte[1024];
//작성중 데이터 모두삭제
sqlSession.delete("orderMgmt.deleteAllOrderMgmtEx", paramMap);
for(int i=0; i<gridDataList.size(); i++){
Map insertMap = gridDataList.get(i);
String OBJID = CommonUtils.createObjId();
insertMap.put("OBJID", OBJID);
insertMap.put("ORDER_MGMT_OBJID", (String)paramMap.get("orderobjId"));
//part 저장
sqlSession.insert("orderMgmt.insertOrderMgmtEx", insertMap);
}
sqlSession.commit();
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
}
/**
* 수주활동 제품별 협조부서 목록 조회
* @param paramMap
* @return
*/
public List getProjectConceptProductDeptList(Map paramMap){
List resultList = new ArrayList();
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession();
resultList = sqlSession.selectList("projectConcept.getProjectConceptProductDeptList", paramMap);
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultList;
}
/**
* 주주현황 담당자 분기별 실적
* @param paramMap
* @return
*/
public ArrayList<HashMap> makeGoalList(Map paramMap){
ArrayList resultList = new ArrayList();
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession();
resultList = (ArrayList)sqlSession.selectList("projectConcept.getmakeGoalList", paramMap);
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultList;
}
/**
* 수주활동 제품 정보 저장
* @param paramMap
* @return
*/
public Map saveProjectConceptProductInfo(HttpServletRequest request, Map paramMap){
Map resultMap = new HashMap();
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
HttpSession session = request.getSession();
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
Map info = person.getLoginInfo();
System.out.println("paramMap : "+paramMap);
//접속자
String userId = CommonUtils.checkNull(info.get("userId"));
paramMap.put("userId", userId);
int cnt = sqlSession.update("projectConcept.mergeProjectConceptProductInfo", paramMap);
//수주활동 제품별 협조부서별 자료회신요청일 수정.
Iterator it = paramMap.keySet().iterator();
while(it.hasNext()){
String key = (String)it.next();
if(key.startsWith("replyReqDate")){
if(key.contains("_")){
String deptCode = key.substring(key.indexOf("_")+1);
String replyReqDate = CommonUtils.checkNull(paramMap.get(key));
Map deptInfoParamMap = new HashMap();
deptInfoParamMap.put("targetObjId", CommonUtils.checkNull(paramMap.get("objId")));
deptInfoParamMap.put("deptCode", deptCode);
deptInfoParamMap.put("replyReqDate", replyReqDate);
System.out.println("deptInfoParamMap : "+deptInfoParamMap);
sqlSession.update("projectConcept.updateProjectConceptProductDeptReplyReqDate", deptInfoParamMap);
}
}
}
if(cnt > 0){
resultMap.put("result", true);
resultMap.put("msg", Message.SAVE_SUCCESS);
}
sqlSession.commit();
}catch(Exception e){
sqlSession.rollback();
resultMap.put("result", false);
resultMap.put("msg", Message.SAVE_FAILED);
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultMap;
}
/**
* 수주활동별 입찰품목 목록 조회(수주활동 상세팝업 內)
* @param paramMap
* @return
*/
public List getProjectConceptProductList_forProjectConcept(Map paramMap){
List resultList = new ArrayList();
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession();
resultList = sqlSession.selectList("projectConcept.getProjectConceptProductList_forProjectConcept", paramMap);
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultList;
}
/**
* 수주활동 정보 저장
* @param request
* @param paramMap
* @return
*/
public Map saveProjectConceptInfo(HttpServletRequest request, Map paramMap){
Map resultMap = new HashMap();
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
PersonBean person = (PersonBean)request.getSession().getAttribute(Constants.PERSON_BEAN);
paramMap.put("userId", person.getUserId());
System.out.println("paramMap : "+paramMap);
int cnt = sqlSession.update("projectConcept.mergeProjectConceptInfo", paramMap);
//기존에 등록된 milestone 정보 삭제
sqlSession.delete("projectConcept.deleteProjectConceptMilestoneInfo", paramMap);
//수주활동 Milestone별 날짜 저장
Iterator it = paramMap.keySet().iterator();
while(it.hasNext()){
String key = (String)it.next();
if(key.startsWith("milestoneDate")){
if(key.contains("_")){
String milestoneObjId = key.substring(key.indexOf("_")+1);
String milestoneDate = CommonUtils.checkNull(paramMap.get(key));
Map milestoneParamMap = new HashMap();
milestoneParamMap.put("objId", CommonUtils.createObjId());
milestoneParamMap.put("targetObjId", CommonUtils.checkNull(paramMap.get("objId")));
milestoneParamMap.put("oemObjId", CommonUtils.checkNull(paramMap.get("oemObjId")));
milestoneParamMap.put("milestoneObjId", milestoneObjId);
milestoneParamMap.put("milestoneDate", milestoneDate);
System.out.println("milestoneParamMap : "+milestoneParamMap);
//milestone 정보 저장
sqlSession.update("projectConcept.mergeProjectConceptMilestoneInfo", milestoneParamMap);
}
}
}
if(cnt > 0){
resultMap.put("result", true);
resultMap.put("msg", Message.SAVE_SUCCESS);
}
sqlSession.commit();
}catch(Exception e){
sqlSession.rollback();
resultMap.put("result", false);
resultMap.put("msg", Message.SAVE_FAILED);
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultMap;
}
/** 영업활동등록
* @param request
* @param paramMap
* @return
*/
public Map saveOrderMgmtInfo(HttpServletRequest request, Map paramMap){
Map resultMap = new HashMap();
SqlSession sqlSession = null;
Map resultList = null;
Map resultList1 = null;
Map sqlMap = new HashMap();
Map specMap = new HashMap();
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
PersonBean person = (PersonBean)request.getSession().getAttribute(Constants.PERSON_BEAN);
paramMap.put("userId", person.getUserId());
System.out.println("paramMap : "+paramMap);
String objId = CommonUtils.checkNull(paramMap.get("objId"));
if("".equals(objId)){
objId = CommonUtils.createObjId();
}
paramMap.put("objId", Integer.parseInt(objId));
/*String region_cd = CommonUtils.checkNull(paramMap.get("region_cd"));
String customer_cd= CommonUtils.checkNull(paramMap.get("customer_cd"));
String order_cd = CommonUtils.checkNull(paramMap.get("order_cd"));
String order_title= CommonUtils.checkNull(paramMap.get("order_title"));
String del_date= CommonUtils.checkNull(paramMap.get("del_date"));
String plant_cd= CommonUtils.checkNull(paramMap.get("plant_cd"));
String manager_pm= CommonUtils.checkNull(paramMap.get("manager_pm")); */
String result_cd= CommonUtils.checkNull(paramMap.get("result_cd"));
int cnt = sqlSession.update("orderMgmt.mergeOrderMgmtInfo", paramMap);
String ProjectObjId = "";
String assemblyPlanObjid="";
if("RES00300".equals(result_cd)){
resultList = sqlSession.selectOne("project.getProjectMgmt", paramMap);
if(resultList==null){
ProjectObjId = CommonUtils.createObjId();
assemblyPlanObjid = CommonUtils.createObjId();
paramMap.put("project_mgmt_objid", Integer.parseInt(ProjectObjId)); //프로젝트OBJID
paramMap.put("assembly_plan_objid", Integer.parseInt(assemblyPlanObjid)); //설비조립계획 OBJID
sqlMap.put("objId", ProjectObjId);
//각 sub_pm을 WBS담당자에게 매핑시켜준다
sqlMap.put("design_pm", paramMap.get("design_pm"));
sqlMap.put("production_pm", paramMap.get("production_pm"));
sqlMap.put("electro_pm", paramMap.get("electro_pm"));
sqlMap.put("se_pm", paramMap.get("se_pm"));
sqlMap.put("purchase_pm", paramMap.get("purchase_pm"));
sqlMap.put("manager_pm", paramMap.get("manager_pm"));
String filepath = Constants.FILE_STORAGE+"\\PART_DATA\\"+(String)paramMap.get("project_no");
projectService.createProjectWBSTask(sqlSession, request, sqlMap);
//폴더생성
File storage = new File(filepath);
if(!storage.exists()) storage.mkdirs();
//프로젝트 등록
cnt = sqlSession.update("project.mergeProjectMgmtInfo", paramMap);
//생산계획 등록
cnt = sqlSession.update("Production.mergeProductionData", paramMap);
//생산계획 공정관리 등록
cnt = sqlSession.insert("Production.createProductionTask", paramMap);
}else{
resultList = CommonUtils.keyChangeUpperMap(resultList);
if("".equals(CommonUtils.checkNull(resultList.get("ASSEMBLY_PLAN_OBJID")))){
assemblyPlanObjid = CommonUtils.createObjId();
paramMap.put("assembly_plan_objid",Integer.parseInt(assemblyPlanObjid));
}else{
paramMap.put("assembly_plan_objid",Integer.parseInt((String)resultList.get("ASSEMBLY_PLAN_OBJID")));
}
paramMap.put("project_mgmt_objid", Integer.parseInt((String)resultList.get("PROJECT_MGMT_OBJID"))); //프로젝트OBJID
//TASK 담당자 업데이트
sqlMap.put("objId", Integer.parseInt((String) resultList.get("PROJECT_MGMT_OBJID")));
sqlMap.put("userId", paramMap.get("design_pm"));
sqlMap.put("taskStep", "1");
sqlSession.update("project.updateProjectMgmtTask", sqlMap);
sqlMap.put("userId", paramMap.get("design_pm"));
sqlMap.put("taskStep", "2");
sqlSession.update("project.updateProjectMgmtTask", sqlMap);
sqlMap.put("userId", paramMap.get("purchase_pm"));
sqlMap.put("taskStep", "3");
sqlSession.update("project.updateProjectMgmtTask", sqlMap);
sqlMap.put("userId", paramMap.get("production_pm"));
sqlMap.put("taskStep", "4");
sqlSession.update("project.updateProjectMgmtTask", sqlMap);
sqlMap.put("userId", paramMap.get("production_pm"));
sqlMap.put("taskStep", "5");
sqlSession.update("project.updateProjectMgmtTask", sqlMap);
sqlMap.put("userId", paramMap.get("production_pm"));
sqlMap.put("taskStep", "6");
sqlSession.update("project.updateProjectMgmtTask", sqlMap);
sqlMap.put("userId", paramMap.get("production_pm"));
sqlMap.put("taskStep", "7");
sqlSession.update("project.updateProjectMgmtTask", sqlMap);
sqlMap.put("userId", paramMap.get("manager_pm"));
sqlMap.put("taskStep", "8");
sqlSession.update("project.updateProjectMgmtTask", sqlMap);
}
}
if(cnt > 0){
resultMap.put("result", true);
resultMap.put("msg", Message.SAVE_SUCCESS);
}
sqlSession.commit();
}catch(Exception e){
sqlSession.rollback();
resultMap.put("result", false);
resultMap.put("msg", Message.SAVE_FAILED);
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultMap;
}
/** 목표등록
* @param request
* @param paramMap
* @return
*/
public Map savegoalMgmtInfo(HttpServletRequest request, Map paramMap){
Map resultMap = new HashMap();
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
int cnt = 0;
PersonBean person = (PersonBean)request.getSession().getAttribute(Constants.PERSON_BEAN);
String Year = request.getParameter("Year");
String[] objId = request.getParameterValues("objId");
String[] user_id = request.getParameterValues("user_id");
String[] month1 = request.getParameterValues("month1");
String[] month2 = request.getParameterValues("month2");
String[] month3 = request.getParameterValues("month3");
String[] month4 = request.getParameterValues("month4");
String[] month5 = request.getParameterValues("month5");
String[] month6 = request.getParameterValues("month6");
String[] month7 = request.getParameterValues("month7");
String[] month8 = request.getParameterValues("month8");
String[] month9 = request.getParameterValues("month9");
String[] month10 = request.getParameterValues("month10");
String[] month11 = request.getParameterValues("month11");
String[] month12 = request.getParameterValues("month12");
String[] total = request.getParameterValues("total");
if(null != objId && 0 < objId.length){
for(int i=0;i<objId.length;i++){
HashMap sqlParamMap = new HashMap();
String objid = CommonUtils.checkNull(objId[i]);
if("".equals(objid)){
objid = CommonUtils.createObjId();
}
sqlParamMap.put("Year", Year);
sqlParamMap.put("objId", objid);
sqlParamMap.put("user_id", user_id[i]);
sqlParamMap.put("month1", month1[i].replaceAll(",", ""));
sqlParamMap.put("month2", month2[i].replaceAll(",", ""));
sqlParamMap.put("month3", month3[i].replaceAll(",", ""));
sqlParamMap.put("month4", month4[i].replaceAll(",", ""));
sqlParamMap.put("month5", month5[i].replaceAll(",", ""));
sqlParamMap.put("month6", month6[i].replaceAll(",", ""));
sqlParamMap.put("month7", month7[i].replaceAll(",", ""));
sqlParamMap.put("month8", month8[i].replaceAll(",", ""));
sqlParamMap.put("month9", month9[i].replaceAll(",", ""));
sqlParamMap.put("month10", month10[i].replaceAll(",", ""));
sqlParamMap.put("month11", month11[i].replaceAll(",", ""));
sqlParamMap.put("month12", month12[i].replaceAll(",", ""));
sqlParamMap.put("writer", person.getUserId());
cnt = sqlSession.update("projectConcept.mergegoalMgmtInfo", sqlParamMap);
}
}
if(cnt > 0){
resultMap.put("result", true);
resultMap.put("msg", Message.SAVE_SUCCESS);
}
sqlSession.commit();
}catch(Exception e){
sqlSession.rollback();
resultMap.put("result", false);
resultMap.put("msg", Message.SAVE_FAILED);
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultMap;
}
/** 영업활동등록
* @param request
* @param paramMap
* @return
*/
public Map mergeOrderMgmtSubInfo(HttpServletRequest request, Map paramMap){
Map resultMap = new HashMap();
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
int cnt = 0;
String[] parentObjId = request.getParameterValues("parentObjId");
String[] objId = request.getParameterValues("objId");
String[] model_name = request.getParameterValues("model_name");
String[] spec_cd = request.getParameterValues("spec_cd");
String[] contract_amount = request.getParameterValues("contract_amount");
String[] delivery_date = request.getParameterValues("delivery_date");
String[] sch_date = request.getParameterValues("sch_date");
String[] count = request.getParameterValues("count");
if(null != parentObjId && 0 < parentObjId.length){
for(int i=0;i<parentObjId.length;i++){
HashMap sqlParamMap = new HashMap();
String objid = CommonUtils.checkNull(objId[i]);
if("".equals(objid)){
objid = CommonUtils.createObjId();
}
sqlParamMap.put("objId", objid);
sqlParamMap.put("parentObjId", CommonUtils.checkNull(parentObjId[i]));
sqlParamMap.put("model_name", CommonUtils.checkNull(model_name[i]));
sqlParamMap.put("spec_cd", CommonUtils.checkNull(spec_cd[i]));
sqlParamMap.put("count", CommonUtils.checkNull(count[i]));
sqlParamMap.put("contract_amount", CommonUtils.checkNull(contract_amount[i]));
sqlParamMap.put("delivery_date", CommonUtils.checkNull(delivery_date[i]));
sqlParamMap.put("delivery_date", CommonUtils.checkNull(delivery_date[i]));
sqlParamMap.put("sch_date", CommonUtils.checkNull(sch_date[i]));
//선택된 기변항목의 목록을 가져와 파트와 연결한다.
cnt = sqlSession.update("projectConcept.mergeOrderMgmtSubInfo", sqlParamMap);
}
}
if(cnt > 0){
resultMap.put("result", true);
resultMap.put("msg", Message.SAVE_SUCCESS);
}
sqlSession.commit();
}catch(Exception e){
sqlSession.rollback();
resultMap.put("result", false);
resultMap.put("msg", Message.SAVE_FAILED);
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultMap;
}
/** 영업품목 상세 삭제
* @param request
* @param paramMap
* @return
*/
public Map delOrderMgmttSubInfo(HttpServletRequest request, Map paramMap){
Map resultMap = new HashMap();
SqlSession sqlSession = null;
Map sqlMap = new HashMap();
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
PersonBean person = (PersonBean)request.getSession().getAttribute(Constants.PERSON_BEAN);
paramMap.put("userId", person.getUserId());
System.out.println("paramMap : "+paramMap);
String Key = (String) paramMap.get("delKey");
String [] delKey = Key.split(",");
sqlMap.put("delObjKeyarr", delKey);
int cnt = sqlSession.delete("projectConcept.deleteordermgmttsubinfo", sqlMap);
if(cnt > 0){
resultMap.put("result", true);
resultMap.put("msg", Message.DELETE_SUCCESS);
}
sqlSession.commit();
}catch(Exception e){
sqlSession.rollback();
resultMap.put("result", false);
resultMap.put("msg", Message.DELETE_FAILED);
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultMap;
}
/**
* 수주활동에 연결된 제품갯수 반환
* @param paramMap
* @return
*/
public int getProjectConceptProductCnt(Map paramMap){
int result = 0;
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession();
Map map = sqlSession.selectOne("projectConcept.getProjectConceptProductCnt", paramMap);
if(map != null){
result = Integer.parseInt(CommonUtils.checkNull(map.get("CNT"), "0"));
}
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return result;
}
/**
* 수주활동별 제품 삭제
* @param paramMap
* @return
*/
public Map deleteProjectConceptProductInfo(Map paramMap){
Map resultMap = new HashMap();
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
//1. 수주활동 제품별 협력부서정보 삭제
int cnt1 = sqlSession.delete("projectConcept.deleteProjectConceptProductDeptInfo", paramMap);
//2. 수주활동별 제품정보 삭제
int cnt2 = sqlSession.delete("projectConcept.deleteProjectConceptProductInfo", paramMap);
if((cnt1+cnt2) > 0){
resultMap.put("result", true);
resultMap.put("msg", Message.DELETE_SUCCESS);
}
sqlSession.commit();
}catch(Exception e){
resultMap.put("result", false);
resultMap.put("msg", Message.DELETE_FAILED);
sqlSession.rollback();
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultMap;
}
/**
* 수주활동 제품별 협조부서 삭제
* @param paramMap
* @return
*/
public Map deleteProjectConceptProductDeptInfo_byEach(Map paramMap){
Map resultMap = new HashMap();
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
//수주활동 제품별 협력부서정보 삭제
int cnt = sqlSession.delete("projectConcept.deleteProjectConceptProductDeptInfo_byEach", paramMap);
if(cnt > 0){
resultMap.put("result", true);
resultMap.put("msg", Message.DELETE_SUCCESS);
}
sqlSession.commit();
}catch(Exception e){
resultMap.put("result", false);
resultMap.put("msg", Message.DELETE_FAILED);
sqlSession.rollback();
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultMap;
}
/**
* 수주활동 목록조회(제품별로 Row 구성)
* @param paramMap
* @return
*/
public List getProjectConceptProductList(HttpServletRequest request,Map paramMap){
List<Map> resultList = new ArrayList();
SqlSession sqlSession = null;
System.out.println("getProjectConceptProductList"+paramMap);
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession();
String countPerPage = CommonUtils.checkNull(request.getParameter("countPerPage"), Constants.ADMIN_COUNT_PER_PAGE+"");
paramMap.put("COUNT_PER_PAGE", Integer.parseInt(countPerPage));
Map pageMap = (HashMap)sqlSession.selectOne("projectConcept.getProjectConceptProductListCnt", paramMap);
pageMap = (HashMap)CommonUtils.setPagingInfo(request, pageMap);
paramMap.put("PAGE_END", CommonUtils.checkNull(pageMap.get("PAGE_END")));
paramMap.put("PAGE_START", CommonUtils.checkNull(pageMap.get("PAGE_START")));
resultList = (ArrayList)sqlSession.selectList("projectConcept.getProjectConceptProductList", paramMap);
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultList;
}
//황의돈 시작**********************************************************************************
/**
* 발주목록
* @param paramMap
* @return
*/
public List getOrderMngList(HttpServletRequest request,Map paramMap){
List<Map<String,Object>> resultList = new ArrayList();
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession();
resultList = (ArrayList)sqlSession.selectList("purchaseOrder.purchaseOrderMasterList", paramMap);
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return CommonUtils.toUpperCaseMapKey(resultList);
}
/**
* 구매의뢰 Master의 정보를 가져온다.
* @param request
* @param paramMap
* @return
*/
public Map getPurchaseOrderMasterInfo(HttpServletRequest request,Map paramMap){
Map<String,Object> resultMap = new HashMap();
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession();
resultMap = sqlSession.selectOne("purchaseOrder.getSalesRequestMasterInfo", paramMap);
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return CommonUtils.toUpperCaseMapKey(resultMap);
}
//황의돈 종료**********************************************************************************
/**
* 영업정보 물리적 삭제
* @param request
* @param paramMap
* @return
*/
public Map delOrderMgmt(HttpServletRequest request,Map paramMap){
Map resultMap = new HashMap();
SqlSession sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
try{
String partCheckBoxList[] = request.getParameter("materOrdObjId").split(",");
if(null != partCheckBoxList && 0 < partCheckBoxList.length){
for(int i=0;i<partCheckBoxList.length;i++){
String Objid = CommonUtils.checkNull(partCheckBoxList[i]);
HashMap sqlParamMap = new HashMap();
sqlParamMap.put("objId", Objid);
//프로젝트 TASK 삭제
sqlSession.delete("project.deleteProjectTaskmgmt",sqlParamMap);
//프로젝트 삭제
sqlSession.delete("project.deleteProjectmgmt",sqlParamMap);
//영업삭제
sqlSession.delete("orderMgmt.deleteOrdermgmt",sqlParamMap);
//생산관리 삭제
sqlSession.delete("Production.deleteProduction",sqlParamMap);
}
sqlSession.commit();
resultMap.put("result", true);
resultMap.put("msg", Message.DELETE_SUCCESS);
}
}catch(Exception e){
resultMap.put("result", false);
resultMap.put("msg", Message.DELETE_FAILED);
sqlSession.rollback();
throw e;
}finally{
sqlSession.close();
}
return resultMap;
}
/**
* 수주활동 상세 조회
* @param paramMap
* @return
*/
public Map getProjectConceptInfo(Map paramMap){
Map resultMap = new HashMap();
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession();
resultMap = sqlSession.selectOne("orderMgmt.getOrderMgmtInfo", paramMap);
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultMap;
}
/**
* 등록된 예가 내역서를 불러온다.
* @param request
* @param paramMap
* @return
*/
public List getOrderexample(HttpServletRequest request,Map paramMap){
List<Map> resultList = new ArrayList();
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession();
inventoryMngService.setInventoryMngCommonCD(request, paramMap);
System.out.println("getOrderexample(paramMap):"+paramMap);
resultList = (ArrayList)sqlSession.selectList("orderMgmt.getOrderexample", paramMap);
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultList;
}
/**
* 업로드된 Excel File을 통해 데이터를 Parsing 한다.
* @param request
* @param paramMap
* @return
*/
public ArrayList parsingExcelFile(HttpServletRequest request,Map paramMap)throws Exception{
ArrayList resultList = new ArrayList();
ArrayList fileList = commonService.getFileList(paramMap);
if(null != fileList && 1 == fileList.size()){
HashMap fileMap = (HashMap)fileList.get(0);
String path = CommonUtils.checkNull(fileMap.get("FILE_PATH"));
String fileName = CommonUtils.checkNull(fileMap.get("SAVED_FILE_NAME"));
FileInputStream fis = new FileInputStream(path+"\\"+fileName);
XSSFWorkbook workBook = new XSSFWorkbook(fis);
FormulaEvaluator formulaEval = workBook.getCreationHelper().createFormulaEvaluator();
XSSFSheet sheet = workBook.getSheetAt(0);
// 데이터 포멧터
DataFormatter formatter = new DataFormatter();
int rows = sheet.getPhysicalNumberOfRows();
for(int rowIndex= 4 ; rowIndex < rows ; rowIndex++){
XSSFRow row = sheet.getRow(rowIndex);
if(null != row){
HashMap partMap = new HashMap();
for(int columnIndex = 0 ; columnIndex < 10 ; columnIndex++){
XSSFCell cell = row.getCell(columnIndex);
//데이버 유형별 get date
String cellValue = "";
if(null == cell){
cellValue = "";
}else{
switch(cell.getCellType()){
case XSSFCell.CELL_TYPE_FORMULA:
CellValue evaluate = formulaEval.evaluate(cell);
if(2 == columnIndex||6 == columnIndex || 7 == columnIndex){
//cellValue = Float.toString((float)cell.getNumericCellValue());
cell.setCellType(XSSFCell.CELL_TYPE_STRING);
//System.out.println("cellValue1:"+cellValue);
cellValue = cell.getStringCellValue();
System.out.println("cellValue1:"+cellValue);
}
/* else{
cellValue = evaluate.formatAsString();
if(!"#N/A".equals(cellValue)){
cellValue = cell.getStringCellValue();
}
}*/
System.out.println(columnIndex+":"+"XSSFCell.CELL_TYPE_FORMULA_____:"+cellValue);
break;
case XSSFCell.CELL_TYPE_NUMERIC:
cell.setCellType(XSSFCell.CELL_TYPE_STRING);
cellValue = formatter.formatCellValue(cell);
System.out.println(columnIndex+":"+"XSSFCell.CELL_TYPE_NUMERIC:"+cellValue);
break;
case XSSFCell.CELL_TYPE_STRING:
cellValue = cell.getStringCellValue()+"";
System.out.println(columnIndex+":"+"XSSFCell.CELL_TYPE_STRING:"+cellValue);
break;
case XSSFCell.CELL_TYPE_BLANK:
cellValue = cell.getBooleanCellValue()+"";
System.out.println(columnIndex+":"+"XSSFCell.CELL_TYPE_BLANK:"+cellValue);
break;
case XSSFCell.CELL_TYPE_ERROR:
cellValue = cell.getErrorCellValue()+"";
System.out.println(columnIndex+":"+"XSSFCell.CELL_TYPE_ERROR:"+cellValue);
break;
}
}
if("false".equals(cellValue)){
cellValue = "";
}
Boolean check =false;
//0구분
/* if(0 == columnIndex){
if("".equals(cellValue)){
//break;
check = true;
}
partMap.put("SORT", cellValue);
}*/
//1명칭
/*if(1 == columnIndex){
partMap.put("NAME", cellValue);
partMap.put("RESOURCE_NAME", cellValue);
if("".equals(cellValue)){
//break;
check = true;
}
}*/
//2품명
if(1 == columnIndex){
partMap.put("PRODUCT_NAME", cellValue);
if("".equals(cellValue)){
//break;
check = true;
}
}
//3규격
if(2 == columnIndex){
partMap.put("STANDARD", cellValue);
if("".equals(cellValue)){
//break;
check = true;
}
}
//3길이
if(3 == columnIndex){
partMap.put("LENGTH", cellValue);
if("".equals(cellValue)){
//break;
check = true;
}
}
//4단위
if(4 == columnIndex){
partMap.put("UNIT", cellValue);
if("".equals(cellValue)){
//break;
check = true;
}
}
//5필요수량
if(5 == columnIndex){
partMap.put("QTY", cellValue);
if("".equals(cellValue)){
//break;
check = true;
}
}
//6단가
if(6 == columnIndex){
partMap.put("UNIT_PRICE", cellValue);
if("".equals(cellValue)){
//break;
check = true;
}
}
//7금액
if(7 == columnIndex){
partMap.put("PRICE", cellValue);
if("".equals(cellValue)){
//break;
check = true;
}
}
//8원단가
if(8 == columnIndex){
partMap.put("ORI_PRICE", cellValue);
String resourceName = CommonUtils.checkNull(partMap.get("NAME"));
String productName = CommonUtils.checkNull(partMap.get("PRODUCT_NAME"));
String standard = CommonUtils.checkNull(partMap.get("STANDARD"));
String qty = CommonUtils.checkNull(partMap.get("QTY"),"0");
if(!"".equals(resourceName) && !"".equals(productName) && !"".equals(standard)){
Map resultMap = inventoryMngService.getInventoryMngInfoForOrder(request, partMap);
int inventoryQty = 0;
String order_yn="";
if(null != resultMap){
String inventoryQtyStr = CommonUtils.checkNull(resultMap.get("INVENTORY_QTY"));
order_yn = CommonUtils.checkNull(resultMap.get("ORDER_YN"));
System.out.println("inventoryQtyStr:"+inventoryQtyStr);
if(!"".equals(inventoryQtyStr)){
inventoryQty = Integer.parseInt(inventoryQtyStr);
}
}
System.out.println("inventoryQty:"+inventoryQty);
//현재고
partMap.put("INVENTORY_QTY", inventoryQty);
int excelQty = Integer.parseInt(String.valueOf(Math.round(Double.parseDouble(qty))));
partMap.put("FORECAST_QTY", (inventoryQty-excelQty));
partMap.put("ORDER_YN", order_yn);
if("".equals(cellValue)){
//break;
check = true;
}
}
if(check){
break;
}
resultList.add(partMap);
System.out.println("partMap:"+partMap);
break;
}
}
}
}
}
return resultList;
}
/**
*영업정보 엑셀저장
* @param request
* @param paramMap
* @throws Exception
*/
public void UploadOrderMgmt(HttpServletRequest request,Map paramMap) throws Exception{
SqlSession sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
try{
ArrayList fileList = commonService.getFileList(paramMap);
if(null != fileList && 1 == fileList.size()){
HashMap fileMap = (HashMap)fileList.get(0);
String path = CommonUtils.checkNull(fileMap.get("FILE_PATH"));
String fileName = CommonUtils.checkNull(fileMap.get("SAVED_FILE_NAME"));
FileInputStream fis = new FileInputStream(path+"\\"+fileName);
XSSFWorkbook workBook = new XSSFWorkbook(fis);
XSSFSheet sheet = workBook.getSheetAt(0);
HashMap partMap = new HashMap();
int rows = sheet.getPhysicalNumberOfRows();
System.out.println("*****************************" +rows);
System.out.println("*****************************" +rows);
System.out.println("*****************************" +rows);
System.out.println("*****************************" +rows);
for(int rowIndex= 1 ; rowIndex < rows ; rowIndex++){
String column ="false";
XSSFRow row = sheet.getRow(rowIndex);
if(null != row && rowIndex <= 15){
for(int columnIndex = 0 ; columnIndex < 47 ; columnIndex++){
XSSFCell cell = row.getCell(columnIndex);
//데이버 유형별 get date
String cellValue = "";
if(null == cell){
cellValue = "";
}else{
switch(cell.getCellType()){
case XSSFCell.CELL_TYPE_FORMULA:
cellValue = cell.getCellFormula();
System.out.println(columnIndex+":"+"XSSFCell.CELL_TYPE_FORMULA:"+cellValue);
break;
case XSSFCell.CELL_TYPE_NUMERIC:
cellValue = cell.getNumericCellValue()+"";
//cellValue = String.format("%.2f", Double.parseDouble(cellValue));
cellValue = String.format("%.0f", Double.parseDouble(cellValue));
System.out.println("cellValue1:"+cellValue);
System.out.println(columnIndex+":"+"XSSFCell.CELL_TYPE_NUMERIC:"+cellValue);
break;
case XSSFCell.CELL_TYPE_STRING:
cellValue = cell.getStringCellValue()+"";
System.out.println(columnIndex+":"+"XSSFCell.CELL_TYPE_STRING:"+cellValue);
break;
case XSSFCell.CELL_TYPE_BLANK:
cellValue = cell.getBooleanCellValue()+"";
System.out.println(columnIndex+":"+"XSSFCell.CELL_TYPE_BLANK:"+cellValue);
break;
case XSSFCell.CELL_TYPE_ERROR:
cellValue = cell.getErrorCellValue()+"";
System.out.println(columnIndex+":"+"XSSFCell.CELL_TYPE_ERROR:"+cellValue);
break;
}
}
if("false".equals(cellValue)){
cellValue = "";
}
//obj생성
String ObjId = CommonUtils.createObjId();
//수주번호
if(0 == columnIndex){
if("".equals(cellValue)){
column ="false";
}else{
column ="true";
partMap.put("obtain_no", cellValue);
}
}
//OBJID
partMap.put("ObjId", ObjId);
//프로젝트 넘버
if(1 == columnIndex){
partMap.put("project_no", cellValue);
}
//구분코드
if(2 == columnIndex){
partMap.put("region_high_cd",cellValue);
}
//국가코드
if(4 == columnIndex){
partMap.put("region_mid_cd",cellValue);
}
//지역코드
if(6 == columnIndex){
partMap.put("region_low_cd",cellValue);
}
//거래처코드
if(8 == columnIndex){
partMap.put("customer_cd",cellValue);
}
//사업자 등록번호
if(10 == columnIndex){
partMap.put("bus_lic_num",cellValue);
}
//담당자
if(11 == columnIndex){
partMap.put("customer_person",cellValue);
}
//연락처
if(12 == columnIndex){
partMap.put("customer_phone",cellValue);
}
//e-mail
if(13 == columnIndex){
partMap.put("customer_email",cellValue);
}
//부서(학과)
if(14 == columnIndex){
partMap.put("customer_div",cellValue);
}
//주소
if(15 == columnIndex){
partMap.put("customer_addr",cellValue);
}
//계약유형
if(16 == columnIndex){
partMap.put("c_type_cd",cellValue);
}
//계약기관
if(18 == columnIndex){
partMap.put("c_agency_cd",cellValue);
}
//계약구분
if(20 == columnIndex){
partMap.put("c_class_cd",cellValue);
}
//계약구분
if(22 == columnIndex){
partMap.put("spec_cd",cellValue);
}
//수주명
if(24 == columnIndex){
partMap.put("order_title",cellValue);
}
//담당자ID
if(25 == columnIndex){
partMap.put("writer",cellValue);
}
//접수일
if(26 == columnIndex){
partMap.put("regdate",cellValue);
}
//진행상황
if(27 == columnIndex){
partMap.put("status_cd",cellValue);
}
//계약결과
if(29 == columnIndex){
partMap.put("result_cd",cellValue);
}
//이탈원인
if(31 == columnIndex){
partMap.put("reason",cellValue);
}
//비고
if(32 == columnIndex){
partMap.put("content",cellValue);
}
//매출일자(매출예정)
if(33 == columnIndex){
partMap.put("sales_p_date",cellValue);
}
/* //소계(매출예정)
if(34 == columnIndex){
partMap.put("sub_p_sum",cellValue);
} */
//제품(매출예정)
if(34 == columnIndex){
partMap.put("dev_p_product",cellValue);
}
//상품(매출예정)
if(35 == columnIndex){
partMap.put("sale_p_product",cellValue);
}
//출고예정일
if(36 == columnIndex){
partMap.put("sch_date",cellValue);
}
/* //소계(제조원가)
if(38 == columnIndex){
partMap.put("sub_ps_sum",cellValue);
}*/
//제품(제조원가)
if(37 == columnIndex){
partMap.put("dev_ps_product",cellValue);
}
//상품(제조원가)
if(38 == columnIndex){
partMap.put("sale_ps_product",cellValue);
}
//매출일(매출실적)
if(39 == columnIndex){
partMap.put("sales_r_date",cellValue);
}
/*//소계(매출실적)
if(42 == columnIndex){
partMap.put("sub_r_sum",cellValue);
}*/
//제품(매출실적)
if(40 == columnIndex){
partMap.put("dev_r_product",cellValue);
}
//상품(매출실적)
if(41 == columnIndex){
partMap.put("sale_r_product",cellValue);
}
//수금일
if(42 == columnIndex){
partMap.put("recv_date",cellValue);
}
//달성율
if(43 == columnIndex){
partMap.put("achievement_rate",cellValue);
}
}
}
System.out.println("***********************"+column);
System.out.println("***********************"+column);
System.out.println("***********************"+column);
if("true".equals(column)){
sqlSession.insert("projectConcept.orderExcelupload", partMap);
}
}
}
sqlSession.commit();
}catch(Exception e){
sqlSession.rollback();
throw e;
}finally{
sqlSession.close();
}
}
/**
* 수주활동 main 조회
* @param paramMap
* @return
*/
public List obtainmainStatusList(HttpServletRequest request,Map paramMap){
List<Map> resultList = new ArrayList();
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession();
resultList = (ArrayList)sqlSession.selectList("projectConcept.obtainmainStatusList", paramMap);
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultList;
}
/**
* 계약현황 main 조회
* @param paramMap
* @return
*/
public List orderCntList(HttpServletRequest request,Map paramMap){
List<Map> resultList = new ArrayList();
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession();
resultList = (ArrayList)sqlSession.selectList("projectConcept.orderCntList", paramMap);
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultList;
}
/**
* 프로젝트 목록을 가져온다.
* @param request
* @param paramMap
* @return
*/
public List getGoalList(HttpServletRequest request, Map paramMap){
SqlSession sqlSession = SqlMapConfig.getInstance().getSqlSession();
List resultList = new ArrayList();
try{
resultList = (ArrayList)sqlSession.selectList("projectConcept.getmainchartList",paramMap);
}catch(Exception e){
throw e;
}finally{
sqlSession.close();
}
return resultList;
}
/**
* 목표등록 조회
* @param paramMap
* @return
*/
public List getgoalMgmtList(HttpServletRequest request,Map paramMap){
List<Map> resultList = new ArrayList();
SqlSession sqlSession = null;
try{
HttpSession session = request.getSession();
sqlSession = SqlMapConfig.getInstance().getSqlSession();
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
Map info = person.getLoginInfo();
//접속자
String userId = CommonUtils.checkNull(info.get("userId"));
paramMap.put("writer", userId);
resultList = (ArrayList)sqlSession.selectList("projectConcept.getgoalMgmtList", paramMap);
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultList;
}
/**
* 목표등록 조회
* @param paramMap
* @return
*/
public List getgoalMgmtTeamList(HttpServletRequest request,Map paramMap){
List<Map> resultList = new ArrayList();
SqlSession sqlSession = null;
try{
HttpSession session = request.getSession();
sqlSession = SqlMapConfig.getInstance().getSqlSession();
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
Map info = person.getLoginInfo();
//접속자
String userId = CommonUtils.checkNull(info.get("userId"));
paramMap.put("writer", userId);
resultList = (ArrayList)sqlSession.selectList("projectConcept.getgoalMgmtTeamList", paramMap);
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultList;
}
/** 목표등록 삭제
* @param request
* @param paramMap
* @return
*/
public Map delgoalEnroll(HttpServletRequest request, Map paramMap){
Map resultMap = new HashMap();
SqlSession sqlSession = null;
Map sqlMap = new HashMap();
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
String Key = (String) paramMap.get("delKey");
String [] delKey = Key.split(",");
sqlMap.put("delObjKeyarr", delKey);
int cnt = sqlSession.delete("projectConcept.delgoalEnroll", sqlMap);
if(cnt > 0){
resultMap.put("result", true);
resultMap.put("msg", Message.DELETE_SUCCESS);
}
sqlSession.commit();
}catch(Exception e){
sqlSession.rollback();
resultMap.put("result", false);
resultMap.put("msg", Message.DELETE_FAILED);
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultMap;
}
/**
* 목표등록 합계
* @param paramMap
* @return
*/
public List getgoalMgmtAverage(HttpServletRequest request,Map paramMap){
List<Map> resultList = new ArrayList();
SqlSession sqlSession = null;
try{
HttpSession session = request.getSession();
sqlSession = SqlMapConfig.getInstance().getSqlSession();
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
Map info = person.getLoginInfo();
//접속자
String userId = CommonUtils.checkNull(info.get("userId"));
paramMap.put("writer", userId);
resultList = (ArrayList)sqlSession.selectList("projectConcept.getgoalMgmtAverage", paramMap);
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultList;
}
/**
* 목표등록 합계
* @param paramMap
* @return
*/
public List getgoalMgmtTeamAverage(HttpServletRequest request,Map paramMap){
List<Map> resultList = new ArrayList();
SqlSession sqlSession = null;
try{
HttpSession session = request.getSession();
sqlSession = SqlMapConfig.getInstance().getSqlSession();
PersonBean person = (PersonBean)session.getAttribute(Constants.PERSON_BEAN);
Map info = person.getLoginInfo();
resultList = (ArrayList)sqlSession.selectList("projectConcept.getgoalMgmtTeamAverage", paramMap);
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultList;
}
/**
* 영업현황 조회
* @param paramMap
* @return
*/
/**
* 수주관리 목록조회
* @param paramMap
* @return
*/
public List getOrderMgntSubList(HttpServletRequest request,Map paramMap){
List<Map> resultList = new ArrayList();
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession();
resultList = (ArrayList)sqlSession.selectList("projectConcept.getorderMgmtSubList", paramMap);
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultList;
}
/**
* 수주활동의 Milestone 목록 조회
* @param paramMap
* @return
*/
public List getProjectConceptMilestoneList(Map paramMap){
List resultList = new ArrayList();
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession();
if("edit".equals(CommonUtils.checkNull(paramMap.get("mode")))){
resultList = sqlSession.selectList("projectConcept.getProjectConceptMilestoneList", paramMap);
}else{
resultList = sqlSession.selectList("projectConcept.getProjectConceptMilestoneList2", paramMap);
}
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultList;
}
/**
* 수주활동 제품별 정보 조회
* @param paramMap
* @return
*/
public Map getProjectConceptProductInfo(Map paramMap){
Map resultMap = new HashMap();
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession();
resultMap = sqlSession.selectOne("projectConcept.getProjectConceptProductInfo", paramMap);
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultMap;
}
/**
* 수주활동 제품별 수주결과 수정
* @param paramMap
*/
public void updateProjectConceptProdBiddingResult(Map paramMap){
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
sqlSession.update("projectConcept.updateProjectConceptProdBiddingResult", paramMap);
//입찰결과 등록시 해당 값 완료로 변경
String biddingResult = CommonUtils.checkNull(paramMap.get("biddingResult"));
if(!"".equals(biddingResult)) paramMap.put("changeStatus", "complete");
else paramMap.put("changeStatus", "create");
sqlSession.update("projectConcept.updateProjectConceptStatusComplete", paramMap);
sqlSession.commit();
}catch(Exception e){
sqlSession.rollback();
e.printStackTrace();
}finally{
sqlSession.close();
}
}
/**
* 수주활동 메일 발송.
* 지정된 인원에게 메일을 발송한다.
* @param request
* @param paramMap
*/
public void sendMailProjectConceptInfo(HttpServletRequest request, Map paramMap){
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession();
String[] receivers = request.getParameterValues("chk");
System.out.println("paramMap : "+paramMap);
System.out.println("receivers.length : "+receivers.length);
PersonBean person = (PersonBean)request.getSession().getAttribute(Constants.PERSON_BEAN);
Map userInfo = person.getLoginInfo();
//1. project concept의 입찰제품 정보 조회
Map info = sqlSession.selectOne("projectConcept.getProjectConceptInfo", paramMap);
//2. 해당 내용을 담은 htmlBody 생성
// String bodyContents = MailUtil.getHTMLContents("", info);
//mail body contents 구성
Map mailParamMap = new HashMap();
//제품정보조회
Map productInfo = sqlSession.selectOne("mail.getProjectConceptProductInfo", paramMap);
mailParamMap.putAll(productInfo);
//제품별 협조부서 목록조회
List<Map> productRelDeptList = sqlSession.selectList("mail.getProjectConceptProductRelDeptList", paramMap);
String subject = "["+CommonUtils.checkNull(productInfo.get("CAR_CODE"))+" ("+CommonUtils.checkNull(productInfo.get("CAR_NAME"))+")] "+Message.MAIL_SUBJECT_PROJECT_CONCEPT_REQ_FILE;
mailParamMap.put("SUBJECT", subject);
String deptList = "";
deptList += "<table border='1' class='table' style='width:450px;'>";
deptList += "<colgroup>";
deptList += "<col width='30%'>";
deptList += "<col width='*%'>";
deptList += "</colgroup>";
for(Map map : productRelDeptList){
String deptCode = CommonUtils.checkNull(map.get("DEPT_CODE"));
String deptName = CommonUtils.checkNull(map.get("DEPT_NAME"));
String replyReqDate = CommonUtils.checkNull(map.get("REPLY_REQ_DATE"));
deptList += "<tr>";
deptList += "<td>"+deptName+"</td>";
deptList += "<td>"+replyReqDate+"</td>";
deptList += "</tr>";
}
deptList += "</table>";
mailParamMap.put("DEPT_LIST", deptList);
String bodyContents = MailUtil.getHTMLContents("projectConceptMailTemplate", mailParamMap);
//3. 메일 발송 대상 조회
for(String receiver : receivers){
if(receiver.contains(":")){
String[] receiverSplit = receiver.split(":");
String receiverId = CommonUtils.checkNull(receiverSplit[0]);
String receiverEmail = CommonUtils.checkNull(receiverSplit[1]);
//4. 메일 발송
MailUtil.sendMail(CommonUtils.checkNull(productInfo.get("WRITER")), CommonUtils.checkNull(productInfo.get("WRITER_EMAIL")), receiverId, receiverEmail, null, subject, bodyContents, Constants.MAIL_TYPE_PROJECT_CONCEPT);
}
}
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
}
/**
* 수주활동 QNA 메일 발송.
* 지정된 인원에게 메일을 발송한다.
* @param request
* @param paramMap
*/
public void sendMailProjectConceptQNAInfo(HttpServletRequest request, Map paramMap){
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession();
String[] receivers = request.getParameterValues("chk");
System.out.println("paramMap : "+paramMap);
System.out.println("receivers.length : "+receivers.length);
PersonBean person = (PersonBean)request.getSession().getAttribute(Constants.PERSON_BEAN);
Map userInfo = person.getLoginInfo();
//1. project concept QNA 정보조회
Map info = sqlSession.selectOne("mail.getProjectConceptQNAInfo", paramMap);
//2. 해당 내용을 담은 htmlBody 생성
// String bodyContents = MailUtil.getHTMLContents("", info);
//mail body contents 구성
Map mailParamMap = new HashMap();
String subject = "["+CommonUtils.checkNull(info.get("CAR_CODE"))+" ("+CommonUtils.checkNull(info.get("CAR_NAME"))+")] "+Message.MAIL_SUBJECT_PROJECT_CONCEPT_QNA;
mailParamMap.put("SUBJECT", subject);
mailParamMap.putAll(info);
String bodyContents = MailUtil.getHTMLContents("projectConceptQNAMailTemplate", mailParamMap);
//3. 메일 발송 대상 조회
for(String receiver : receivers){
if(receiver.contains(":")){
String[] receiverSplit = receiver.split(":");
String receiverId = CommonUtils.checkNull(receiverSplit[0]);
String receiverEmail = CommonUtils.checkNull(receiverSplit[1]);
//4. 메일 발송
MailUtil.sendMail(CommonUtils.checkNull(info.get("WRITER")), CommonUtils.checkNull(info.get("WRITER_EMAIL")), receiverId, receiverEmail, null, subject, bodyContents, Constants.MAIL_TYPE_PROJECT_CONCEPT);
}
}
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
}
/**
* 수주활동 제품별 확정.
* 모든 제품이 확정되었을경우 수주활동을 종료시킨다.
* @param request
* @param paramMap
*/
public void completeProjectConceptProductInfo(HttpServletRequest request, Map paramMap){
SqlSession sqlSession = null;
try{
System.out.println("paramMap : "+paramMap);
sqlSession = SqlMapConfig.getInstance().getSqlSession(false);
//입찰품목 상태 complete으로 변경
sqlSession.update("projectConcept.completeProjectConceptProductInfo", paramMap);
//입찰품목의 상태가 create인 CNT 조회
Map cntMap = sqlSession.selectOne("projectConcept.getProjectConceptProductCreateCnt", paramMap);
System.out.println("cntMap : "+cntMap);
int cnt = Integer.parseInt(CommonUtils.checkNull(cntMap.get("CNT"), "0"));
System.out.println("cnt : "+cnt);
if(cnt == 0){
//수주활동 상태 complete으로 변경.
sqlSession.update("projectConcept.completeProjectConceptInfo", paramMap);
}
sqlSession.commit();
}catch(Exception e){
sqlSession.rollback();
e.printStackTrace();
}finally{
sqlSession.close();
}
}
/**
* 수주활동 중복 등록체크 (false : 중복있음, true : 중복없음)
* @param paramMap
* @return
*/
public Map getProjectConceptDuplicateCnt(Map paramMap){
Map resultMap = new HashMap();
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession();
Map map = sqlSession.selectOne("projectConcept.getProjectConceptDuplicateCnt", paramMap);
if(map != null){
int cnt = Integer.parseInt(CommonUtils.checkNull(map.get("CNT"), "0"));
if(cnt > 0){
resultMap.put("result", false);
}else{
resultMap.put("result", true);
}
}
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultMap;
}
/*jmpark end*/
/*************************************************************************************************************************/
/*************************************************************************************************************************/
/*edhwang start*/
/*edhwang end*/
/*************************************************************************************************************************/
/*************************************************************************************************************************/
/*dhchoi start*/
/**
* 수주활동 저장
* @param paramMap
*/
public void saveQnAProjectConcept(Map paramMap){
SqlSession sqlSession =null;
sqlSession = SqlMapConfig.getInstance().getSqlSession();
System.out.println(paramMap);
sqlSession.update("projectConcept.saveQnaProjectConceptInfo", paramMap);
}
/**
* QnaListPage 목록
* @param paramMap
* @return
*/
public List qnaListPage(HttpServletRequest request,Map paramMap){
List resultList = new ArrayList();
SqlSession sqlSession = null;
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession();
String countPerPage = CommonUtils.checkNull(request.getParameter("countPerPage"), Constants.ADMIN_COUNT_PER_PAGE+"");
paramMap.put("COUNT_PER_PAGE", Integer.parseInt(countPerPage));
Map pageMap = (HashMap)sqlSession.selectOne("projectConcept.getQnaListCnt", paramMap);
pageMap = (HashMap)CommonUtils.setPagingInfo(request, pageMap);
paramMap.put("PAGE_END", CommonUtils.checkNull(pageMap.get("PAGE_END")));
paramMap.put("PAGE_START", CommonUtils.checkNull(pageMap.get("PAGE_START")));
resultList = (ArrayList)sqlSession.selectList("projectConcept.getQnaListPage", paramMap);
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultList;
}
/**
* Qna 수정페이지
* @param paramMap
* @return
*/
public Map getQnADetailInfo(Map paramMap){
HashMap resultMap = new HashMap();
SqlSession sqlSession = null;
System.out.println("getQnADetailInfo"+paramMap);
try{
sqlSession = SqlMapConfig.getInstance().getSqlSession();
resultMap = (HashMap)sqlSession.selectOne("projectConcept.getQnaInfo", paramMap);
if(null != resultMap){
resultMap.put("CONTENTS", CommonUtils.getClobToString((Clob)resultMap.get("CONTENTS")));
}
}catch(Exception e){
e.printStackTrace();
}finally{
sqlSession.close();
}
return resultMap;
}
/*dhchoi end*/
/*************************************************************************************************************************/
}