행정정보공동이용시스템 차적 조회 컨트롤러 추가

main
이범준 2 months ago
parent c51d6a2d39
commit a299a79891

@ -1,23 +1,119 @@
package externalsystem.piss.web; package externalsystem.piss.web;
import java.util.ArrayList;
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.HttpServletRequest;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import cokr.xit.foundation.data.DataObject;
import cokr.xit.foundation.web.AbstractController; import cokr.xit.foundation.web.AbstractController;
import externalsystem.car.dao.CarMapper;
import externalsystem.testpool.dao.TestPoolMapper;
import testserver.wsdlserver.lvisserver.CarRegBasicInfoImpl;
@RequestMapping(name="행정정보공동이용시스템 연계", value="/piss/api") @Controller
@RequestMapping(name="행정정보공동이용시스템 연계", value="/piss/api", method = RequestMethod.POST)
public class PissController extends AbstractController { public class PissController extends AbstractController {
@RequestMapping(name="차적", value="molit/SignguCarBassMatterInqireService") @Resource(name = "carMapper")
public ModelAndView signguCarBassMatterInqireService(HttpServletRequest req) { private CarMapper carMapper;
ModelAndView mav = new ModelAndView("jsonView");
@Resource(name = "testPoolMapper")
private TestPoolMapper testPoolMapper;
@PostMapping(name="차적", value="molit/SignguCarBassMatterInqireService")
@ResponseBody
public String signguCarBassMatterInqireService(HttpServletRequest hreq, @RequestBody HashMap<String, Object> map) {
//A01
//
Map<String,Object> carRes = new HashMap<String,Object>();
carRes.put("CNTC_RESULT_CODE", "00");
carRes.put("CNTC_RESULT_DLTS", "");
carRes.put("ERROR", null);
Map<String, String> data = ((List<Map<String,String>>)map.get("data")).get(0);
String vhrno = data.get("VHRNO");
DataObject carInfo = carMapper.selectCar(vhrno);
if(carInfo == null && !vhrno.equals("")) {
if(CarRegBasicInfoImpl.isValidCarNumber(vhrno)) {
DataObject randMber = testPoolMapper.selectRandomMber();
DataObject randAddr= testPoolMapper.selectRandomAddr();
DataObject randCarBasic = testPoolMapper.selectRandomCarBasic();
Map<String, Object> params = new HashMap<String, Object>();
params.put("vhrno", vhrno);
params.put("mberSeCode", randMber.string("MBER_SE_CODE"));
params.put("mberNm", randMber.string("MBER_NM"));
params.put("mberSeNo", randMber.string("MBER_SE_NO"));
params.put("useStrnghldRoadNmCode", randAddr.string("ROAD_NM_CODE"));
params.put("useStrnghldBuldSeCode", randAddr.string("BULD_SE_CODE"));
params.put("useStrnghldBuldMainNo", randAddr.string("BULD_MAIN_NO"));
params.put("useStrnghldBuldSubNo", randAddr.string("BULD_SUB_NO"));
params.put("useStrnghldAdresNm", randAddr.string("ADRES_NM"));
params.put("cnm", randCarBasic.string("CNM"));
params.put("colorNm", randCarBasic.string("COLOR_NM"));
params.put("vhctyAsortCode", randCarBasic.string("VHCTY_ASORT_CODE"));
params.put("mxmmLdg", randCarBasic.string("MXMM_LDG"));
params.put("vin", randCarBasic.string("VIN"));
params.put("ersrRegistDe", randCarBasic.string("ERSR_REGIST_DE"));
int effected = carMapper.insertCar(params);
if(effected == 1) {
carInfo = carMapper.selectCar(vhrno);
}
}
}
List<Map<String,String>> extInfo_list = new ArrayList<>();
Map<String,String> extInfo = new HashMap<String,String>();
if(carInfo != null) {
extInfo.put("VHRNO",carInfo.string("VHRNO"));
extInfo.put("MBER_SE_CODE",carInfo.string("MBER_SE_CODE"));
extInfo.put("MBER_NM",carInfo.string("MBER_NM"));
extInfo.put("MBER_SE_NO",carInfo.string("MBER_SE_NO"));
extInfo.put("USE_STRNGHLD_ROAD_NM_CODE",carInfo.string("USE_STRNGHLD_ROAD_NM_CODE"));
extInfo.put("USE_STRNGHLD_BULD_MAIN_NO",carInfo.string("USE_STRNGHLD_BULD_MAIN_NO"));
extInfo.put("USE_STRNGHLD_BULD_SUB_NO",carInfo.string("USE_STRNGHLD_BULD_SUB_NO"));
extInfo.put("USE_STRNGHLD_ADRES_NM",carInfo.string("USE_STRNGHLD_ADRES_NM"));
extInfo.put("USGSRHLD_UNDGRND_BULD_SE_CODE",carInfo.string("USGSRHLD_UNDGRND_BULD_SE_CODE"));
extInfo.put("CNM",carInfo.string("CNM"));
extInfo.put("COLOR_NM",carInfo.string("COLOR_NM"));
extInfo.put("VHCTY_ASORT_CODE",carInfo.string("VHCTY_ASORT_CODE"));
extInfo.put("MXMM_LDG",carInfo.string("MXMM_LDG"));
extInfo.put("VIN",carInfo.string("VIN"));
extInfo.put("ERSR_REGIST_DE",carInfo.string("ERSR_REGIST_DE"));
extInfo_list.add(extInfo);
carRes.put("record", extInfo_list);
} else {
carRes.put("record", null);
}
String str = toJson(carRes);
//req. System.out.println(str);
return mav; String a = "{\"data\":[";
String b = "]}";
str = a + str + b;
return str;
} }
} }

Loading…
Cancel
Save