test: 발주기관 건설현장 등록에 따른 기업사용자 프로젝트 생성 의사코드 추가

main
thkim 2026-01-20 16:40:29 +09:00
parent 53839ddb2b
commit e1bbf5f666
3 changed files with 114 additions and 6 deletions

View File

@ -46,6 +46,7 @@ import egovframework.rte.psl.dataaccess.util.EgovMap;
import geoinfo.com.WebConfirm; import geoinfo.com.WebConfirm;
import geoinfo.drilling.input.service.DrillingInputService; import geoinfo.drilling.input.service.DrillingInputService;
import geoinfo.map.mapControl.service.MapControlService; import geoinfo.map.mapControl.service.MapControlService;
import geoinfo.regi.projectList.ProjectListController;
import geoinfo.regi.selectClassInfo.service.SelectClassService; import geoinfo.regi.selectClassInfo.service.SelectClassService;
import geoinfo.regi.status.service.RegiPageService; import geoinfo.regi.status.service.RegiPageService;
import geoinfo.regi.util.exportGeotechnicalPointShp2; import geoinfo.regi.util.exportGeotechnicalPointShp2;
@ -69,6 +70,7 @@ public class DrillingInputController {
DrillingInputService drillingInputService; DrillingInputService drillingInputService;
@RequestMapping(value = "/drilling/input.do") @RequestMapping(value = "/drilling/input.do")
public String memberRegi(@RequestParam HashMap<String, Object> params, ModelMap model, HttpServletRequest request, HttpServletResponse response) throws Exception { public String memberRegi(@RequestParam HashMap<String, Object> params, ModelMap model, HttpServletRequest request, HttpServletResponse response) throws Exception {
@ -349,4 +351,5 @@ public class DrillingInputController {
return jSONOResponse; return jSONOResponse;
} }
} }

View File

@ -3,17 +3,18 @@ package geoinfo.drilling.input.service;
import java.util.HashMap; import java.util.HashMap;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.simple.JSONObject; import org.json.simple.JSONObject;
public interface DrillingInputService { public interface DrillingInputService {
HashMap<String, Object> getOrganizationUserGlGmGsGfCodes(String userId) throws Exception; HashMap<String, Object> getOrganizationUserGlGmGsGfCodes(String userId) throws Exception;
HashMap<String, Object> drillingInputAdd(HttpServletRequest request, HashMap<String, Object> params) throws Exception; HashMap<String, Object> drillingInputAdd(HttpServletRequest request, HttpServletResponse response, HashMap<String, Object> params) throws Exception;
void getDepartments(HttpServletRequest request, HashMap<String, Object> params, JSONObject jsonResponse) throws Exception; void getDepartments(HttpServletRequest request, HashMap<String, Object> params, JSONObject jsonResponse) throws Exception;
HashMap<String, Object> updateProjectCodeAndProjectStateCodeByCid(HttpServletRequest request, HashMap<String, Object> params) throws Exception; HashMap<String, Object> updateProjectCodeAndProjectStateCodeByCid(HttpServletRequest request, HashMap<String, Object> params) throws Exception;
HashMap<String, Object> updateProjectCodeAndProjectStateCodeByProjectCode(HttpServletRequest request, HashMap<String, Object> params) throws Exception; HashMap<String, Object> updateProjectCodeAndProjectStateCodeByProjectCode(HttpServletRequest request, HashMap<String, Object> params) throws Exception;
HashMap<String, Object> drillingInputModify(HttpServletRequest request, HashMap<String, Object> params) throws Exception; HashMap<String, Object> drillingInputModify(HttpServletRequest request, HttpServletResponse response, HashMap<String, Object> params) throws Exception;
} }

View File

@ -4,6 +4,8 @@ import geoinfo.drilling.input.service.DrillingInputMapper;
import geoinfo.drilling.input.service.DrillingInputService; import geoinfo.drilling.input.service.DrillingInputService;
import geoinfo.drilling.inquiry.service.DrillingInquiryService; import geoinfo.drilling.inquiry.service.DrillingInquiryService;
import geoinfo.main.login.service.LoginMapper; import geoinfo.main.login.service.LoginMapper;
import geoinfo.regi.common.service.CommonService;
import geoinfo.regi.projectList.ProjectListController;
import geoinfo.util.MyUtil; import geoinfo.util.MyUtil;
import java.sql.SQLException; import java.sql.SQLException;
@ -13,12 +15,16 @@ import java.util.List;
import javax.annotation.Resource; import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.json.simple.JSONArray; import org.json.simple.JSONArray;
import org.json.simple.JSONObject; import org.json.simple.JSONObject;
import org.json.simple.parser.JSONParser; import org.json.simple.parser.JSONParser;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.servlet.ModelAndView;
import egovframework.rte.psl.dataaccess.util.EgovMap; import egovframework.rte.psl.dataaccess.util.EgovMap;
@ -34,6 +40,14 @@ public class DrillingInputServiceImpl implements DrillingInputService {
@Autowired @Autowired
DrillingInquiryService drillingInquiryService; DrillingInquiryService drillingInquiryService;
@Resource(name ="commonService")
private CommonService commonService;
@Autowired
private ProjectListController projectListController;
/** /**
* Gl Gm Gs Gf Codes * Gl Gm Gs Gf Codes
*/ */
@ -62,13 +76,12 @@ public class DrillingInputServiceImpl implements DrillingInputService {
@Override @Override
public HashMap<String, Object> drillingInputAdd(HttpServletRequest request, HashMap<String, Object> params) throws Exception { public HashMap<String, Object> drillingInputAdd(HttpServletRequest request, HttpServletResponse response, HashMap<String, Object> params) throws Exception {
String userId = (String)request.getSession().getAttribute("USERID"); String userId = (String)request.getSession().getAttribute("USERID");
HashMap<String, Object> spGetMasterCompanyDistrictParams = getOrganizationUserGlGmGsGfCodes(userId); HashMap<String, Object> spGetMasterCompanyDistrictParams = getOrganizationUserGlGmGsGfCodes(userId);
params.put("userId", userId); params.put("userId", userId);
params.put("masterCompanyOCode", MyUtil.getStringFromObject( spGetMasterCompanyDistrictParams.get("v_gl") )); params.put("masterCompanyOCode", MyUtil.getStringFromObject( spGetMasterCompanyDistrictParams.get("v_gl") ));
@ -82,6 +95,12 @@ public class DrillingInputServiceImpl implements DrillingInputService {
Long constCompanyCode = drillingInputMapper.findConstCompanyCodeByConstCompanyName(params); Long constCompanyCode = drillingInputMapper.findConstCompanyCodeByConstCompanyName(params);
params.put("constCompanyCode", constCompanyCode); params.put("constCompanyCode", constCompanyCode);
drillingInputMapper.spAddTblCsi(params); drillingInputMapper.spAddTblCsi(params);
// if( 기업사용자를 지정했다면 ) {
// String constUserId = "복호화된 기업 사용자 아이디";
// params.put("constUserId", constUserId);
// params.put("CID", params.get("cid")); //drillingInputMapper.spAddTblCsi(params); 호출 후 생성된 cid 값
// saveAndInsertMeta(params, request, response);
// }
return params; return params;
} catch (SQLException e) { } catch (SQLException e) {
throw new Exception( e.getMessage() ); throw new Exception( e.getMessage() );
@ -230,7 +249,7 @@ public class DrillingInputServiceImpl implements DrillingInputService {
@Override @Override
public HashMap<String, Object> drillingInputModify(HttpServletRequest request, HashMap<String, Object> params) public HashMap<String, Object> drillingInputModify(HttpServletRequest request, HttpServletResponse response, HashMap<String, Object> params)
throws Exception { throws Exception {
// TODO Auto-generated method stub // TODO Auto-generated method stub
String userId = (String)request.getSession().getAttribute("USERID"); String userId = (String)request.getSession().getAttribute("USERID");
@ -270,6 +289,30 @@ public class DrillingInputServiceImpl implements DrillingInputService {
spUdtTblCsiParams.put("modUserid", userId); spUdtTblCsiParams.put("modUserid", userId);
spUdtTblCsiParams.put("userId", userId); spUdtTblCsiParams.put("userId", userId);
drillingInputMapper.spUdtTblCsi(spUdtTblCsiParams); drillingInputMapper.spUdtTblCsi(spUdtTblCsiParams);
// 건설현장 입력 시, 기업사용자를 지정했다면 해당 건설현장을 해당 기업사용자의 프로젝트목록에 추가한다. 로직이 복잡해질까봐 필요한 큰 로직만 넣었습니다.
// if( 기업사용자를 지정했다면 ) {
// String constUserId = "복호화된 기업 사용자 아이디";
// params.put("constUserId", constUserId);
// String constProjectCode = 수정할 건설현장에 해당하는 TEMP_CONITRUCT_SITE_INFO.PROJECT_CODE 값을 가져온다(); 'TEMP_CONITRUCT_SITE_INFO.PROJECT_CODE 값을 가져오는 쿼리' 참고
// if( constProjectCode 값이 존재한다면 ) {
// params.put("constProjectCode", constProjectCode);
// String tmiUserId = 'TEMP_META_INFO.USERID 값을 가져오는 쿼리 수행();
// if( tmiUserId != null && constUserId != tmiUserId )
//boolean isGroundInfoInputStarted = 입력 기업 사용자 입력 진행 여부 판단 쿼리 수행() == null ? true : false; '기업사용자 지반정보 입력 여부 확인' 쿼리 참고. tpi.PROJECT_CODE 값이 조회되면 삭제해도 됨. 조회 안 되면 삭제 X
// if( isGroundInfoInputStarted ) {
// params.put("constUserId", tmiUserId); // 해당 건설현장(프로젝트)의 입력자를 변경하지 않는다.
// spUdtTblCsiParams.put("message", '기업사용자 수정 불가. 이전 기업사용자가 이미 입력을 시작한 프로젝트입니다'); // 발주기관 사용자에게 해당 메시지 보여주기
// } else {
// deleteProject(params, request, response);
// }
// }
// } else {
// params.put("constProjectCode", "");
// }
//
// saveAndInsertMeta(params, request, response);
//}
return spUdtTblCsiParams; return spUdtTblCsiParams;
} catch (SQLException e) { } catch (SQLException e) {
throw new Exception( e.getMessage() ); throw new Exception( e.getMessage() );
@ -294,4 +337,65 @@ public class DrillingInputServiceImpl implements DrillingInputService {
} }
/**
* , () ,
*/
public ModelAndView saveAndInsertMeta(@RequestParam HashMap<String, Object> params, HttpServletRequest request, HttpServletResponse response) throws Exception {
HashMap<String,Object> getProviderInfoParams = new HashMap<String, Object>();
getProviderInfoParams.put("userid", params.get("constUserId"));
EgovMap constUserInfo = commonService.getProviderInfo(getProviderInfoParams); // 기업사용자 회원정보
// 1. 전달받은 파라미터 설정
HashMap<String, Object> metaParams = new HashMap<String, Object>();
metaParams.put("REPORT_TYPE", "CH");
metaParams.put("PROJECT_CODE", params.get("constProjectCode")); // 프로젝트코드
metaParams.put("TEMP_CONSTRUCT_SITE_INFO-CID", params.get("CID"));
metaParams.put("INPUT_COMPANY", params.get("constCompanyName")); // 입력기관.
metaParams.put("DEPT", constUserInfo.get("partName")); // 부서명. 해당 기업 사용자의 부서명 조회해서 넣기.
metaParams.put("ADMIN_NAME", params.get("constCompanyAdmin")); // 담당자 명
metaParams.put("EMAIL", constUserInfo.get("email")); // Email. 해당 기업 사용자 정보 조회해서 넣기.
metaParams.put("TEL", params.get("constCompanyTel")); // 전화번호 <- 건설현장 입력 시 사용된 전화번호를 넣는다.
metaParams.put("PHONE", params.get("constCompanyTel")); // 핸드폰 <- 건설현장 입력 시 사용된 전화번호를 넣는다.
metaParams.put("SEARCHDATE", null); // 시추 날짜
metaParams.put("PROJECT_NAME", params.get("constName")); // 사업명
metaParams.put("HOLE_NUMBER", null); // 총 시추공수
metaParams.put("HOLE_ADMIN_NAME", null); // 시추담당자
metaParams.put("HOLE_COMPANY", null); // 시추업체
metaParams.put("HOLE_SPOT_SD", null); // 시추지역 - 시도
metaParams.put("HOLE_SPOT_SGG", null); // 시추지역 - 시군구
metaParams.put("HOLE_SPOT", null); // 시추지역 - 지역명
metaParams.put("REMARK", null); // 비고
metaParams.put("rUrl", "");
// 2. ProjectListController의 insertMeta 호출
ModelAndView model = new ModelAndView();
model = projectListController.insertMeta(metaParams, model, request, response); // insertMeta 호출 시 발생되는 오류는 조치하기.
return model;
}
/**
* ,
*/
public ModelAndView deleteProject(@RequestParam HashMap<String, Object> params, HttpServletRequest request, HttpServletResponse response) throws Exception {
// 1. 전달받은 파라미터 설정
HashMap<String, Object> deleteParams = new HashMap<String, Object>();
deleteParams.put("REPORT_TYPE", "CH");
deleteParams.put("PROJECT_CODE", params.get("constProjectCode")); // 프로젝트코드
// 2. ProjectListController의 deleteAll 호출
ModelAndView model = new ModelAndView();
model = projectListController.deleteAll(deleteParams, model, request, response); // deleteAll 호출 시 발생되는 오류는 조치하기.
return model;
}
} }