321 lines
12 KiB
Java
321 lines
12 KiB
Java
package sgis.app.web;
|
|
|
|
import java.util.HashMap;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.servlet.http.HttpServletRequest;
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
import org.json.simple.JSONObject;
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
import org.springframework.stereotype.Controller;
|
|
import org.springframework.ui.ModelMap;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RequestMethod;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
import org.springframework.web.bind.annotation.ResponseBody;
|
|
|
|
import egovframework.rte.psl.dataaccess.util.EgovMap;
|
|
import net.minidev.json.JSONArray;
|
|
import sgis.app.service.AppLineService;
|
|
import sgis.app.service.AppMainService;
|
|
import sgis.com.service.FileTransferService;
|
|
import sgis.com.util.JsonUtil;
|
|
import sgis.com.vo.ComFileVO;
|
|
import sgis.com.vo.SessionVO;
|
|
import sgis.com.web.BaseController;
|
|
|
|
/**
|
|
* @FileName : AppLineController.java
|
|
* @Date : 2022. 05. 10
|
|
* @Creator : ICTWAY KIM-YOON-SU
|
|
* @Discription : 입력시스템 지표물리탐사 컨트롤러
|
|
*/
|
|
@Controller
|
|
public class AppLineController extends BaseController {
|
|
|
|
//logger 설정
|
|
private final Logger logger = LoggerFactory.getLogger(AppLineController.class);
|
|
|
|
@Resource(name ="AppMainService")
|
|
private AppMainService AppMainService;
|
|
|
|
@Resource(name ="AppLineService")
|
|
private AppLineService AppLineService;
|
|
|
|
//파일 전송 서비스
|
|
@Resource(name="FileTransferService")
|
|
private FileTransferService fileTransferService;
|
|
|
|
@RequestMapping(value = "/app/line/cordinateMap.do")
|
|
public String cordinateMap(@RequestParam HashMap<String, Object> params, ModelMap model, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
|
|
setCode2Model("project_epsg_code", model); // 좌표계 코드
|
|
|
|
//proj4 data정보
|
|
List<?> coordiProj4 = AppMainService.selectCoordiPrjstring();
|
|
|
|
model.put("coordiProj4", coordiProj4);
|
|
model.put("params", params);
|
|
|
|
return "sgis/app/line/popup/cordinateMap";
|
|
}
|
|
|
|
@RequestMapping(value = "/app/line/preViewMap.do")
|
|
public String preViewMap(@RequestParam HashMap<String, Object> params, ModelMap model, HttpServletRequest request, HttpServletResponse response) throws Exception {
|
|
|
|
setCode2Model("project_epsg_code", model); // 좌표계 코드
|
|
|
|
//proj4 data정보
|
|
List<?> coordiProj4 = AppMainService.selectCoordiPrjstring();
|
|
|
|
if(params.get("businessCode") != null && params.get("lineNumber") != null) {
|
|
params.put("lineNumber", (String)params.get("lineNumber"));
|
|
|
|
if("resistivity".equals(params.get("type"))) {
|
|
EgovMap resistivityInfo = AppLineService.selectResistivityInfo(params);
|
|
model.put("resistivityInfo", resistivityInfo);
|
|
|
|
List<?> resistivitySubInfo = AppLineService.selectResistivitySubInfo(params);
|
|
model.put("resistivitySubInfo", resistivitySubInfo);
|
|
}else if("refraction".equals(params.get("type"))) {
|
|
EgovMap refractionInfo = AppLineService.selectRefractionInfo(params);
|
|
model.put("refractionInfo", refractionInfo);
|
|
|
|
List<?> refractionSubInfo = AppLineService.selectRefractionSubInfo(params);
|
|
model.put("refractionSubInfo", refractionSubInfo);
|
|
}
|
|
}
|
|
|
|
model.put("coordiProj4", coordiProj4);
|
|
model.put("params", params);
|
|
|
|
return "sgis/app/line/popup/preViewMap";
|
|
}
|
|
|
|
//지표물리탐사_전기비저항탐사
|
|
@RequestMapping(value="/app/line/selectResistivityInfo.do")
|
|
public String selectResistivityInfo(@RequestParam HashMap<String,Object> params, ModelMap model,HttpServletRequest request, HttpServletResponse response) throws Exception{
|
|
|
|
setLeftMenu(params, model, request);
|
|
|
|
setCode2Model("project_epsg_code", model); // 좌표계 코드
|
|
|
|
//data정보
|
|
if("".equals(params.get("lineNumber")) || params.get("lineNumber") == null) {
|
|
params.put("lineNumber", "1");
|
|
}else {
|
|
params.put("lineNumber", (String)params.get("lineNumber"));
|
|
}
|
|
EgovMap resistivityInfo = AppLineService.selectResistivityInfo(params);
|
|
model.put("resistivityInfo", resistivityInfo);
|
|
model.put("params", params);
|
|
|
|
//이미지 파일
|
|
ComFileVO comFileVO = new ComFileVO();
|
|
comFileVO.setRefProjectCode((String) params.get("projectCode"));
|
|
comFileVO.setRefBusinessCode((String) params.get("businessCode"));
|
|
comFileVO.setRefEtcCode(String.valueOf(params.get("lineNumber")));
|
|
comFileVO.setFileDesc("line\\resistivity");
|
|
|
|
ComFileVO fileInfo = fileTransferService.selectComFileInfo(comFileVO);
|
|
model.put("fileInfo", fileInfo);
|
|
|
|
return "sgis/app/line/resistivityInfo";
|
|
};
|
|
|
|
//지표물리탐사_전기비저항탐사 데이터 호출
|
|
@SuppressWarnings("unchecked")
|
|
@RequestMapping(value = "/app/line/resistivitySubInfo_jsondata.do", method = {RequestMethod.POST, RequestMethod.GET})
|
|
public void resistivityInfo_jsondata(@RequestParam HashMap<String,Object> params, ModelMap model,HttpServletRequest request, HttpServletResponse response) throws Exception{
|
|
request.setCharacterEncoding("UTF-8");
|
|
response.setContentType("text/html;charset=UTF-8");
|
|
|
|
params.put("lineNumber", (String)params.get("lineNumber"));
|
|
List<?> result = AppLineService.selectResistivitySubInfo(params);
|
|
|
|
HashMap<String, List<?>> resultMap = new HashMap<String, List<?>>();
|
|
resultMap.put("dataList1", result);
|
|
|
|
JSONObject json = new JSONObject();
|
|
json.putAll( resultMap );
|
|
response.getWriter().print(json);
|
|
};
|
|
|
|
//지표물리탐사_전기비저항탐사 저장
|
|
@RequestMapping(value="/app/line/insertResistivityInfo.do", method=RequestMethod.POST)
|
|
public @ResponseBody JSONObject insertResistivityInfo(@RequestParam HashMap<String,Object> params, ModelMap model,HttpServletRequest request, HttpServletResponse response) throws Exception{
|
|
|
|
String retStr = "";
|
|
|
|
try {
|
|
SessionVO sessionVO = getSessionInfo();
|
|
|
|
// data정보
|
|
params.put("refEtcCode", (String) params.get("lineNumber"));
|
|
params.put("lineNumber", (String) params.get("lineNumber"));
|
|
params.put("sysRegId", sessionVO.getsUserId());
|
|
|
|
//정보조회
|
|
EgovMap resistivityInfo = AppLineService.selectResistivityInfo(params);
|
|
|
|
if(resistivityInfo == null) {
|
|
//주정보 저장
|
|
AppLineService.insertResistivityInfo(params);
|
|
}else {
|
|
//주정보 수정
|
|
AppLineService.updateResistivityInfo(params);
|
|
}
|
|
|
|
int cnt = Integer.parseInt((String)params.get("itemCnt"));
|
|
|
|
if(cnt > 0) {
|
|
AppLineService.deleteResistivitySubInfo(params);
|
|
}
|
|
for(int i=0;i<cnt;i++){
|
|
HashMap<String, Object> insertMap = new HashMap<String, Object>();
|
|
|
|
//data정보
|
|
insertMap.put("businessCode", params.get("businessCode"));
|
|
insertMap.put("lineNumber", params.get("lineNumber"));
|
|
insertMap.put("testOrder", Integer.parseInt((String)params.get("testOrder_"+i)));
|
|
insertMap.put("resistivityX", params.get("resistivityX_"+ i));
|
|
insertMap.put("resistivityY", params.get("resistivityY_"+ i));
|
|
insertMap.put("apparentResistivity", Float.valueOf((String)params.get("apparentResistivity_"+i)));
|
|
insertMap.put("sysRegId", sessionVO.getsUserId());
|
|
|
|
//부정보 저장
|
|
AppLineService.insertResistivitySubInfo(insertMap);
|
|
}
|
|
|
|
// 파일업로드
|
|
String file = uploadBasicImgFile(params,request);
|
|
System.out.println(file);
|
|
|
|
retStr = "success";
|
|
|
|
}catch (Exception e) {
|
|
// TODO: handle exception
|
|
retStr = "fail";
|
|
}
|
|
|
|
JSONObject json = new JSONObject();
|
|
json.put("result", retStr);
|
|
return json;
|
|
};
|
|
|
|
//지표물리탐사_굴절법탄성파
|
|
@RequestMapping(value="/app/line/selectRefractionInfo.do")
|
|
public String selectRefractionInfo(@RequestParam HashMap<String,Object> params, ModelMap model,HttpServletRequest request, HttpServletResponse response) throws Exception{
|
|
|
|
setLeftMenu(params, model, request);
|
|
|
|
setCode2Model("project_epsg_code", model); // 좌표계 코드
|
|
|
|
//data정보
|
|
if("".equals(params.get("lineNumber")) || params.get("lineNumber") == null) {
|
|
params.put("lineNumber", "1");
|
|
}else {
|
|
params.put("lineNumber", (String)params.get("lineNumber"));
|
|
}
|
|
EgovMap refractionInfo = AppLineService.selectRefractionInfo(params);
|
|
model.put("refractionInfo", refractionInfo);
|
|
model.put("params", params);
|
|
|
|
//이미지 파일
|
|
ComFileVO comFileVO = new ComFileVO();
|
|
comFileVO.setRefProjectCode((String) params.get("projectCode"));
|
|
comFileVO.setRefBusinessCode((String) params.get("businessCode"));
|
|
comFileVO.setRefEtcCode(String.valueOf(params.get("lineNumber")));
|
|
comFileVO.setFileDesc("line\\refraction");
|
|
|
|
ComFileVO fileInfo = fileTransferService.selectComFileInfo(comFileVO);
|
|
model.put("fileInfo", fileInfo);
|
|
|
|
return "sgis/app/line/refractionInfo";
|
|
};
|
|
|
|
//지표물리탐사_굴절법탄성파 데이터 호출
|
|
@SuppressWarnings("unchecked")
|
|
@RequestMapping(value = "/app/line/refractionSubInfo_jsondata.do", method = {RequestMethod.POST, RequestMethod.GET})
|
|
public void refractionSubInfo_jsondata(@RequestParam HashMap<String,Object> params, ModelMap model,HttpServletRequest request, HttpServletResponse response) throws Exception{
|
|
request.setCharacterEncoding("UTF-8");
|
|
response.setContentType("text/html;charset=UTF-8");
|
|
|
|
params.put("lineNumber", (String)params.get("lineNumber"));
|
|
List<?> result = AppLineService.selectRefractionSubInfo(params);
|
|
|
|
HashMap<String, List<?>> resultMap = new HashMap<String, List<?>>();
|
|
resultMap.put("dataList1", result);
|
|
|
|
JSONObject json = new JSONObject();
|
|
json.putAll( resultMap );
|
|
response.getWriter().print(json);
|
|
};
|
|
|
|
//지표물리탐사_굴절법탄성파 저장
|
|
@RequestMapping(value="/app/line/insertRefractionInfo.do", method=RequestMethod.POST)
|
|
public @ResponseBody JSONObject insertRefractionInfo(@RequestParam HashMap<String,Object> params, ModelMap model,HttpServletRequest request, HttpServletResponse response) throws Exception{
|
|
|
|
String retStr = "";
|
|
|
|
try {
|
|
SessionVO sessionVO = getSessionInfo();
|
|
|
|
// data정보
|
|
params.put("refEtcCode", (String) params.get("lineNumber"));
|
|
params.put("lineNumber", (String)params.get("lineNumber"));
|
|
params.put("sysRegId", sessionVO.getsUserId());
|
|
|
|
//정보조회
|
|
EgovMap refractionInfo = AppLineService.selectRefractionInfo(params);
|
|
|
|
if(refractionInfo == null) {
|
|
//주정보 저장
|
|
AppLineService.insertRefractionInfo(params);
|
|
}else {
|
|
//주정보 수정
|
|
AppLineService.updateRefractionInfo(params);
|
|
}
|
|
|
|
int cnt = Integer.parseInt((String)params.get("itemCnt"));
|
|
|
|
if(cnt > 0) {
|
|
AppLineService.deleteRefractionSubInfo(params);
|
|
}
|
|
for(int i=0;i<cnt;i++){
|
|
HashMap<String, Object> insertMap = new HashMap<String, Object>();
|
|
|
|
//data정보
|
|
insertMap.put("businessCode", params.get("businessCode"));
|
|
insertMap.put("lineNumber", params.get("lineNumber"));
|
|
insertMap.put("testOrder", Integer.parseInt((String)params.get("testOrder_"+i)));
|
|
insertMap.put("refractionX", params.get("refractionX_"+ i));
|
|
insertMap.put("refractionY", params.get("refractionY_"+ i));
|
|
insertMap.put("refractionVelocity", Float.valueOf((String)params.get("refractionVelocity_"+i)));
|
|
insertMap.put("sysRegId", sessionVO.getsUserId());
|
|
|
|
//부정보 저장
|
|
AppLineService.insertRefractionSubInfo(insertMap);
|
|
}
|
|
|
|
// 파일업로드
|
|
String file = uploadBasicImgFile(params,request);
|
|
System.out.println(file);
|
|
|
|
retStr = "success";
|
|
|
|
}catch (Exception e) {
|
|
// TODO: handle exception
|
|
retStr = "fail";
|
|
}
|
|
|
|
JSONObject json = new JSONObject();
|
|
json.put("result", retStr);
|
|
return json;
|
|
};
|
|
}
|