feat: 우편번호관리 feat
parent
af71d8a8b8
commit
70d3a56666
@ -0,0 +1,30 @@
|
||||
package kr.xit.framework.biz.mng.code.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ibatis.session.RowBounds;
|
||||
|
||||
import egovframework.rte.psl.dataaccess.mapper.Mapper;
|
||||
import kr.xit.framework.biz.mng.code.model.XitZipCodeMngVO;
|
||||
|
||||
/**
|
||||
*
|
||||
* @업무그룹명: 우편번호관리 Mapper
|
||||
* @설명:
|
||||
* @최초작성일: 2020. 4. 16. 오전 9:38:07
|
||||
* @최초작성자: 박민규
|
||||
* @author (주)엑스아이티 개발팀
|
||||
* @since 2002. 2. 2.
|
||||
* @version 1.0 Copyright(c) XIT All rights reserved.
|
||||
*/
|
||||
@SuppressWarnings("MybatisXMapperMethodInspection")
|
||||
@Mapper
|
||||
public interface IZipCodeMgtMapper {
|
||||
|
||||
List<XitZipCodeMngVO> selectZips(Map<String, Object> paraMap, RowBounds rowBounds);
|
||||
<T> XitZipCodeMngVO selectZip(T t);
|
||||
int insertZip(final XitZipCodeMngVO vo);
|
||||
int updateZip(final XitZipCodeMngVO vo);
|
||||
int deleteZip(final XitZipCodeMngVO vo);
|
||||
}
|
@ -0,0 +1,87 @@
|
||||
package kr.xit.framework.biz.mng.code.service;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.ibatis.session.RowBounds;
|
||||
|
||||
import kr.xit.framework.biz.mng.code.model.XitZipCodeMngVO;
|
||||
|
||||
/**
|
||||
*
|
||||
* @업무그룹명: 우편번호관리 Service
|
||||
* @설명:
|
||||
* @최초작성일: 2020. 4. 16. 오전 9:38:56
|
||||
* @최초작성자: 박민규
|
||||
* @author (주)엑스아이티 개발팀
|
||||
* @since 2002. 2. 2.
|
||||
* @version 1.0 Copyright(c) XIT All rights reserved.
|
||||
*/
|
||||
public interface IZipCodeMgtService {
|
||||
|
||||
List<XitZipCodeMngVO> findZipCodes(final Map<String, Object> paraMap, final RowBounds rowBounds);
|
||||
<T> XitZipCodeMngVO findZipCode(T t);
|
||||
void addZipCode(final XitZipCodeMngVO vo);
|
||||
void modifyZipCode(final XitZipCodeMngVO vo);
|
||||
void removeZipcode(final XitZipCodeMngVO vo);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <pre>메소드 설명: 우편번호관리 등록</pre>
|
||||
* @param vo void 요청처리 후 응답객체
|
||||
* @author: 박민규
|
||||
* @date: 2020. 4. 16.
|
||||
*/
|
||||
public void addProc(XitZipCodeMngVO vo);
|
||||
|
||||
/**
|
||||
* <pre>메소드 설명: 우편번호관리 일괄 등록</pre>
|
||||
* @param vo void 요청처리 후 응답객체
|
||||
* @author: 박민규
|
||||
* @date: 2020. 4. 16.
|
||||
*/
|
||||
public void addsProc(InputStream fis) throws Exception;
|
||||
|
||||
/**
|
||||
* <pre>메소드 설명: 우편번호관리 수정</pre>
|
||||
* @param vo void 요청처리 후 응답객체
|
||||
* @author: 박민규
|
||||
* @date: 2020. 4. 16.
|
||||
*/
|
||||
public void modifyProc(XitZipCodeMngVO vo);
|
||||
|
||||
/**
|
||||
* <pre>메소드 설명: 우편번호관리 삭제</pre>
|
||||
* @param vo void 요청처리 후 응답객체
|
||||
* @author: 박민규
|
||||
* @date: 2020. 4. 16.
|
||||
*/
|
||||
public void removeProc(XitZipCodeMngVO vo);
|
||||
|
||||
/**
|
||||
* <pre>메소드 설명: 우편번호관리 다건 삭제</pre>
|
||||
* @param zips
|
||||
* @param sns
|
||||
* @return void 요청처리 후 응답객체
|
||||
* @author: 박민규
|
||||
* @date: 2020. 4. 16.
|
||||
*/
|
||||
public void removesProc(String zips, String sns);
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,151 @@
|
||||
package kr.xit.framework.biz.mng.code.service;
|
||||
|
||||
import java.io.InputStream;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import org.apache.ibatis.session.RowBounds;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import egovframework.rte.fdl.excel.EgovExcelService;
|
||||
import egovframework.rte.fdl.idgnr.EgovIdGnrService;
|
||||
import kr.xit.framework.biz.cmm.model.XitZipVO;
|
||||
import kr.xit.framework.biz.cmm.service.XitFrameCrudService;
|
||||
import kr.xit.framework.biz.mng.code.mapper.IZipCodeMgtMapper;
|
||||
import kr.xit.framework.biz.mng.code.model.XitZipCodeMngVO;
|
||||
import kr.xit.framework.core.message.XitMessageSource;
|
||||
|
||||
@Service
|
||||
public class ZipCodeMgtService implements IZipCodeMgtService {
|
||||
|
||||
@Resource
|
||||
private IZipCodeMgtMapper mapper;
|
||||
@Resource
|
||||
private XitFrameCrudService xitFrameCrudService;
|
||||
@Resource(name="groupIdGnrService")
|
||||
private EgovIdGnrService idgenService;
|
||||
@Resource
|
||||
private XitMessageSource xitMessageSource;
|
||||
@Resource(name = "egovExcelService")
|
||||
private EgovExcelService excelZipService;
|
||||
|
||||
@Override
|
||||
public List<XitZipCodeMngVO> findZipCodes(final Map<String, Object> paraMap, final RowBounds rowBounds) {
|
||||
return mapper.selectZips(paraMap, rowBounds);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <T> XitZipCodeMngVO findZipCode(T t) {
|
||||
return mapper.selectZip(t);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addZipCode(final XitZipCodeMngVO vo) {
|
||||
mapper.insertZip(vo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modifyZipCode(final XitZipCodeMngVO vo) {
|
||||
mapper.updateZip(vo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeZipcode(final XitZipCodeMngVO vo) {
|
||||
mapper.deleteZip(vo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public void addProc(XitZipCodeMngVO vo) {
|
||||
/**
|
||||
* 필수값 설정
|
||||
*/
|
||||
XitZipVO zipVO = convertToCrudVO(vo);
|
||||
zipVO.setFrst_register_id(vo.getFrstRegisterId());
|
||||
|
||||
|
||||
/**
|
||||
* 처리
|
||||
*/
|
||||
xitFrameCrudService.addXitZip(zipVO);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addsProc(InputStream fis) throws Exception {
|
||||
/**
|
||||
* 처리
|
||||
*/
|
||||
xitFrameCrudService.removesXitZip(new XitZipVO());
|
||||
excelZipService.uploadExcel("kr.xit.framework.biz.cmm.dao.XitFrameCrudMapper.addXitZip", fis, 2, 5000);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void modifyProc(XitZipCodeMngVO vo) {
|
||||
/**
|
||||
* 필수값 설정
|
||||
*/
|
||||
XitZipVO zipVO = convertToCrudVO(vo);
|
||||
zipVO.setLast_updusr_id(vo.getLastUpdusrId());
|
||||
|
||||
|
||||
/**
|
||||
* 처리
|
||||
*/
|
||||
xitFrameCrudService.modifyXitZip(zipVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removeProc(XitZipCodeMngVO vo) {
|
||||
/**
|
||||
* 필수값 설정
|
||||
*/
|
||||
XitZipVO zipVO = convertToCrudVO(vo);
|
||||
|
||||
|
||||
/**
|
||||
* 처리
|
||||
*/
|
||||
xitFrameCrudService.removeXitZip(zipVO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void removesProc(String zips, String sns) {
|
||||
/**
|
||||
* 처리
|
||||
*/
|
||||
String [] arrZip = zips.split(";");
|
||||
String [] arrSn = sns.split(";");
|
||||
for(int i=0; i<arrZip.length;i++) {
|
||||
XitZipCodeMngVO vo = new XitZipCodeMngVO();
|
||||
vo.setZip(arrZip[i]);
|
||||
vo.setSn(Integer.valueOf(arrSn[i]));
|
||||
this.removeProc(vo);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* <pre>
|
||||
* 메소드 설명: 메뉴VO를 CRUD Service의 VO로 변환 한다.
|
||||
* </pre>
|
||||
*
|
||||
* @return XitZipVO 요청처리 후 응답객체
|
||||
* @author: 박민규
|
||||
* @date: 2020. 4. 16.
|
||||
*/
|
||||
private XitZipVO convertToCrudVO(XitZipCodeMngVO vo) {
|
||||
XitZipVO crudVO = new XitZipVO();
|
||||
crudVO.setZip (vo.getZip()); //우편번호
|
||||
crudVO.setSn (String.valueOf(vo.getSn())); //순번
|
||||
crudVO.setCtprvn_nm (vo.getCtprvnNm()); //시도 명
|
||||
crudVO.setSigngu_nm (vo.getSignguNm()); //시군구 명
|
||||
crudVO.setEmd_nm (vo.getEmdNm()); //읍면동 명
|
||||
crudVO.setLi_buld_nm (vo.getLiBuldNm()); //리 건물 명
|
||||
crudVO.setLnbr_dong_ho (vo.getLnbrDongHo()); //번지 동 호
|
||||
|
||||
return crudVO;
|
||||
}
|
||||
}
|
@ -0,0 +1,327 @@
|
||||
package kr.xit.framework.biz.mng.code.web;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.ServletException;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.Model;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.validation.BindingResult;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
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.support.SessionStatus;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
|
||||
import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper;
|
||||
import kr.xit.framework.biz.cmm.model.XitLoginVO;
|
||||
import kr.xit.framework.biz.mng.auth.model.XitAuthRuleMngVO;
|
||||
import kr.xit.framework.biz.mng.code.model.XitZipCodeMngSearchVO;
|
||||
import kr.xit.framework.biz.mng.code.model.XitZipCodeMngVO;
|
||||
import kr.xit.framework.biz.mng.code.service.IZipCodeMgtService;
|
||||
import kr.xit.framework.core.constants.FrameworkConstants;
|
||||
import kr.xit.framework.core.constants.FrameworkConstants.TILES_TYPE;
|
||||
import kr.xit.framework.core.message.XitMessageSource;
|
||||
import kr.xit.framework.core.model.ResultResponse;
|
||||
import kr.xit.framework.core.utils.XitCmmnUtil;
|
||||
import kr.xit.framework.core.utils.attachfile.XitAttachFileUtil;
|
||||
import kr.xit.framework.core.utils.attachfile.XitAttachFileVO;
|
||||
import kr.xit.framework.core.validation.XitBeanValidator;
|
||||
import kr.xit.framework.support.mybatis.MybatisUtils;
|
||||
import kr.xit.framework.support.util.AjaxMessageMapRenderer;
|
||||
import kr.xit.framework.support.util.AjaxUtils;
|
||||
import kr.xit.framework.support.util.Checks;
|
||||
import kr.xit.framework.support.util.ValidationError;
|
||||
import kr.xit.framework.support.util.constants.MessageKey;
|
||||
|
||||
@Controller
|
||||
@RequestMapping("/framework/biz/mng/code")
|
||||
public class ZipCodeMgtController {
|
||||
@Resource
|
||||
private IZipCodeMgtService service;
|
||||
@Autowired
|
||||
private XitBeanValidator beanValidator;
|
||||
@Resource(name = "xitMessageSource")
|
||||
XitMessageSource xitMessageSource;
|
||||
|
||||
|
||||
@RequestMapping(value = "/mngZipCodeMgtForm")
|
||||
public void mngZipCodeMgtForm() {
|
||||
}
|
||||
|
||||
@RequestMapping(value = "/mngZipCodeMgtPopup")
|
||||
public ModelAndView mngZipCodeMgtPopup(final XitZipCodeMngVO vo) {
|
||||
ModelAndView mav = new ModelAndView();
|
||||
|
||||
mav.addObject("zip", Checks.isEmpty(vo.getZip())? new XitAuthRuleMngVO(): service.findZipCode(vo));
|
||||
mav.addObject("pageTitle", "우편번호 등록 / 변경");
|
||||
mav.setViewName(FrameworkConstants.FRAMEWORK_JSP_BASE_PATH + "mng/code/mngZipCodeMgtPopup.popup");
|
||||
return mav;
|
||||
}
|
||||
|
||||
@GetMapping(value = "/findZipCodes")
|
||||
public ModelAndView findZipCodes(final Map<String, Object> paraMap){
|
||||
return ResultResponse.of(service.findZipCodes(paraMap, MybatisUtils.getPagingInfo(paraMap)));
|
||||
}
|
||||
|
||||
@GetMapping(value = "/findZipCode")
|
||||
public ModelAndView findZipCode(final XitZipCodeMngVO vo){
|
||||
return ResultResponse.of(service.findZipCode(vo));
|
||||
}
|
||||
|
||||
@PostMapping(value = "/addZipCode")
|
||||
public ModelAndView addZipCode(final XitZipCodeMngVO vo, final BindingResult bindingResult){
|
||||
ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW);
|
||||
|
||||
ValidationError.of("zip", vo, bindingResult);
|
||||
service.addZipCode(vo);
|
||||
AjaxMessageMapRenderer.success(mav, MessageKey.CMM_INSERT_SUCCESS);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/modifyZipCode")
|
||||
public ModelAndView modifyZipCode(final XitZipCodeMngVO vo, final BindingResult bindingResult){
|
||||
ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW);
|
||||
|
||||
ValidationError.of("zip", vo, bindingResult);
|
||||
service.modifyZipCode(vo);
|
||||
AjaxMessageMapRenderer.success(mav, MessageKey.CMM_UPDATE_SUCCESS);
|
||||
return mav;
|
||||
}
|
||||
|
||||
@PostMapping(value = "/removeZipCode")
|
||||
public ModelAndView removeZipCode(final XitZipCodeMngVO vo){
|
||||
ModelAndView mav = new ModelAndView(FrameworkConstants.JSON_VIEW);
|
||||
|
||||
service.removeZipcode(vo);
|
||||
AjaxMessageMapRenderer.success(mav, MessageKey.CMM_DELETE_SUCCESS);
|
||||
return mav;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@RequestMapping(value = "ZipCodeMng_{cmd}_popup", method={RequestMethod.GET, RequestMethod.POST})
|
||||
public String ZipCodeMng_page_popup(@PathVariable String cmd
|
||||
, @ModelAttribute("zip") XitZipCodeMngVO vo
|
||||
, @ModelAttribute XitZipCodeMngSearchVO searchVO
|
||||
, ModelMap model) {
|
||||
switch (cmd) {
|
||||
case "": //
|
||||
break;
|
||||
default:
|
||||
throw new RuntimeException("유효하지 않은 요청 입니다.");
|
||||
}
|
||||
|
||||
|
||||
return FrameworkConstants.FRAMEWORK_JSP_BASE_PATH +"mng/code/XitZipCodeMng_"+cmd+"_popup"+TILES_TYPE.POPUP.getVal();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* <pre>메소드 설명: 우편번호관리 CUD 처리</pre>
|
||||
* @return String 요청처리 후 응답객체
|
||||
* @author: 박민규
|
||||
* @date: 2020. 4. 16.
|
||||
*/
|
||||
@RequestMapping(value = "ZipCodeMng_{cmd}_proc", method=RequestMethod.POST)
|
||||
public void ZipCodeMng_cmd_proc(@PathVariable String cmd
|
||||
,@ModelAttribute("vo") XitZipCodeMngVO vo
|
||||
,@ModelAttribute("searchVO") XitZipCodeMngSearchVO searchVO
|
||||
,@RequestParam(value="zips", required=false, defaultValue="") String zips
|
||||
,@RequestParam(value="sns", required=false, defaultValue="") String sns
|
||||
,BindingResult bindingResult
|
||||
,SessionStatus status
|
||||
,Model model
|
||||
,HttpServletRequest request
|
||||
,HttpServletResponse response
|
||||
) throws ServletException, IOException {
|
||||
|
||||
/**
|
||||
* 처리 분기
|
||||
*/
|
||||
XitLoginVO loginVO = (XitLoginVO) EgovUserDetailsHelper.getAuthenticatedUser();
|
||||
String sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_list";
|
||||
String message = null;
|
||||
switch (cmd) {
|
||||
case "insert": //등록
|
||||
//유효성 확인
|
||||
//2020.11.24. 주석처리
|
||||
beanValidator.validate(vo, bindingResult);
|
||||
// beanValidator.validate("zip", vo, bindingResult);
|
||||
if (bindingResult.hasErrors()) {
|
||||
message = xitMessageSource.getMessage("fail.common.insert");
|
||||
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_input";
|
||||
break;
|
||||
}
|
||||
//처리
|
||||
try {
|
||||
vo.setFrstRegisterId(loginVO.getUniqId());
|
||||
service.addProc(vo);
|
||||
status.setComplete();
|
||||
message = xitMessageSource.getMessage("success.common.insert");
|
||||
} catch (RuntimeException e) {
|
||||
message = e.getMessage();
|
||||
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_input";
|
||||
} catch (Exception e) {
|
||||
message = xitMessageSource.getMessage("fail.common.insert");
|
||||
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_input";
|
||||
}
|
||||
break;
|
||||
|
||||
case "inserts": //다건 등록
|
||||
List<XitAttachFileVO> listAttchFile = null;
|
||||
try {
|
||||
listAttchFile = XitAttachFileUtil.fileUpload(request, XitCmmnUtil.setOsPath("/home/tempUpload"), true, 5);
|
||||
} catch (RuntimeException | IOException e1) {
|
||||
message = xitMessageSource.getMessage("fail.common.msg");
|
||||
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_inputs";
|
||||
}
|
||||
|
||||
if(XitCmmnUtil.isEmpty(listAttchFile)) {
|
||||
message = xitMessageSource.getMessage("fail.common.msg");
|
||||
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_inputs";
|
||||
}else {
|
||||
FileInputStream fis = null;
|
||||
try {
|
||||
XitAttachFileVO fileVO = listAttchFile.get(0);
|
||||
File file = new File(fileVO.getFileFullPath());
|
||||
fis = new FileInputStream(file);
|
||||
if (!"".equals(fileVO.getFileName())) {
|
||||
// 2011.10.07 업로드 파일에 대한 확장자를 체크
|
||||
if (fileVO.getFileName().toLowerCase().endsWith(".xls") || fileVO.getFileName().toLowerCase().endsWith(".xlsx")) {
|
||||
service.addsProc(fis);
|
||||
status.setComplete();
|
||||
message = xitMessageSource.getMessage("success.common.insert");
|
||||
} else {
|
||||
//log.info("xls, xlsx 파일 타입만 등록이 가능합니다.");
|
||||
message = xitMessageSource.getMessage("fail.common.msg");
|
||||
model.addAttribute("message", message);
|
||||
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_inputs";
|
||||
}
|
||||
|
||||
} else {
|
||||
message = xitMessageSource.getMessage("fail.common.msg");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
} finally {
|
||||
try {
|
||||
if (fis != null) {
|
||||
fis.close();
|
||||
}
|
||||
} catch (IOException ee) {
|
||||
}
|
||||
}
|
||||
}
|
||||
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_inputs";
|
||||
break;
|
||||
|
||||
case "update": //수정
|
||||
//유효성 확인
|
||||
//2020.11.24. 주석처리
|
||||
beanValidator.validate(vo, bindingResult);
|
||||
// beanValidator.validate("zip", vo, bindingResult);
|
||||
if (bindingResult.hasErrors()) {
|
||||
message = xitMessageSource.getMessage("fail.common.update");
|
||||
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_edit";
|
||||
break;
|
||||
}
|
||||
//처리
|
||||
try {
|
||||
vo.setLastUpdusrId(loginVO.getUniqId());
|
||||
service.modifyProc(vo);
|
||||
status.setComplete();
|
||||
message = xitMessageSource.getMessage("success.common.update");
|
||||
} catch (RuntimeException e) {
|
||||
message = e.getMessage();
|
||||
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_edit";
|
||||
} catch (Exception e) {
|
||||
message = xitMessageSource.getMessage("fail.common.update");
|
||||
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_edit";
|
||||
}
|
||||
break;
|
||||
|
||||
case "delete": //삭제
|
||||
//처리
|
||||
try {
|
||||
service.removeProc(vo);
|
||||
status.setComplete();
|
||||
message = xitMessageSource.getMessage("success.common.delete");
|
||||
break;
|
||||
} catch (RuntimeException e) {
|
||||
message = e.getMessage();
|
||||
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_edit";
|
||||
} catch (Exception e) {
|
||||
message = xitMessageSource.getMessage("fail.common.delete");
|
||||
sLocationUrl = "forward:/framework/biz/mng/code/ZipCodeMng_edit";
|
||||
}
|
||||
break;
|
||||
|
||||
case "deletes": //다건 삭제
|
||||
//처리
|
||||
try {
|
||||
service.removesProc(zips, sns);
|
||||
status.setComplete();
|
||||
message = xitMessageSource.getMessage("success.common.delete");
|
||||
} catch (RuntimeException e) {
|
||||
message = e.getMessage();
|
||||
} catch (Exception e) {
|
||||
message = xitMessageSource.getMessage("fail.common.delete");
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
new RuntimeException("유효하지 않은 요청 입니다.");
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 응답 설정
|
||||
*/
|
||||
/* ============================
|
||||
* 2020.09.10 박민규
|
||||
* 서버 호출 방식에 관계 없이 응답처리가 가능하도록 개선
|
||||
* -기존 호출방식도 유지하며 ajax로 서버호출 시 json 으로 응답처리가 가능하도록 개선
|
||||
* [AS-IS] 반환타입 String, return url에 "forward"구문으로 처리
|
||||
* [TO-BE] 반환타입 void, DispatchServlet으로 forward 처리, ajax 호출인 경우 json응답처리 서비스로 forward
|
||||
============================ */
|
||||
//2020.09.10 주석처리
|
||||
// model.addAttribute("message", message);
|
||||
// return sLocationUrl;
|
||||
model.addAttribute("message", message);
|
||||
if(AjaxUtils.isAjaxRequest(request)){ //ajax 요청시
|
||||
//반환 데이터 설정
|
||||
Map<String, Object> resultMap = new HashMap<String, Object>();
|
||||
resultMap.put("message", message);
|
||||
XitCmmnUtil.forwardForAjaxRequest(request, response, resultMap);
|
||||
}else { //submit 요청 시
|
||||
XitCmmnUtil.forwardForSubmitRequest(request, response, sLocationUrl, model.asMap());
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,187 @@
|
||||
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ include file="/WEB-INF/jsp/framework/taglibs.jsp" %>
|
||||
|
||||
<form name="listForm" id="listForm" method="post">
|
||||
<input type="hidden" id="searchAt" name="searchAt" value="Y">
|
||||
<input type="hidden" id="searchGubun" name="searchGubun" value="excel">
|
||||
<div class="search r2">
|
||||
|
||||
<table>
|
||||
<caption>검색조건</caption>
|
||||
<colgroup>
|
||||
<col style="width: 600px;"/>
|
||||
<col/>
|
||||
<col/>
|
||||
<col/>
|
||||
<col/>
|
||||
<col/>
|
||||
<col/>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<select id="searchCondition" name="searchCondition" title="조회조건">
|
||||
<option selected value=''>--선택하세요--</option>
|
||||
<option value='zip'>우편번호</option>
|
||||
<option value='ctprvnNm'>시도명</option>
|
||||
<option value='signguNm'>시군구명</option>
|
||||
<option value='emdNm'>읍면동명</option>
|
||||
<option value='liBuldNm'>리건물명</option>
|
||||
</select>
|
||||
<input name="searchKeyword" title="검색어" type="text" value="<c:out value="${userSearchVO.searchKeyword}"/>" />
|
||||
</td>
|
||||
<td colspan="6">
|
||||
<input type="button" id="btnSearch" class="btn_search" title="검색" value="검색" />
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</form>
|
||||
<!-- //검색 -->
|
||||
|
||||
<div class="page_btn">
|
||||
<span class="fll">
|
||||
<a href="#" class="btn darkgray" id="btnRegist" title="권한등록">등록</a>
|
||||
<a href="#" class="btn lightgray" id="excel_btn" title="권한취소">엑셀등록</a>
|
||||
</span>
|
||||
</div>
|
||||
<!-- //버튼 및 페이지정보 -->
|
||||
|
||||
<!-- 데이터 출력 -->
|
||||
<div id="grid"></div>
|
||||
|
||||
|
||||
<script type="text/javaScript">
|
||||
/**************************************************************************
|
||||
* Global Variable
|
||||
**************************************************************************/
|
||||
var callbackSearch = () => fnBiz.search(); // 데이터 조회 : popup에서 사용
|
||||
let GRID = null;
|
||||
|
||||
/* *******************************
|
||||
* Biz function
|
||||
******************************* */
|
||||
const fnBiz = {
|
||||
search: () => {
|
||||
GRID.reloadData();
|
||||
}
|
||||
,pagePopup: function(flag, params){
|
||||
let url = '<c:url value="/framework/biz/mng/code/mngZipCodeMgtPopup.do"/>';
|
||||
let popTitle;
|
||||
let popOption = {width: 950, height:550}
|
||||
switch (flag) {
|
||||
case "add": //등록
|
||||
popTitle = "우편번호 등록";
|
||||
break;
|
||||
case "detail": //상세
|
||||
popTitle = "우편번호 상세";
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
CmmPopup.open(url, params, popOption, popTitle);
|
||||
}
|
||||
,onClickGrid: function(props){
|
||||
const rowData = props.grid.getRow(props.rowKey);
|
||||
fnBiz.pagePopup('detail', rowData);
|
||||
}
|
||||
,onClickZipBtn: function(props){
|
||||
const rowData = props.grid.getRow(props.rowKey);
|
||||
fnBiz.pagePopup('detail', {zip: rowData.zip, sn: rowData.sn});
|
||||
}
|
||||
}
|
||||
|
||||
/**************************************************************************
|
||||
* event
|
||||
**************************************************************************/
|
||||
$(() => {
|
||||
$('#btnSearch').on('click', () => {
|
||||
fnBiz.search();
|
||||
});
|
||||
|
||||
$('#btnRegist').on('click', () => {
|
||||
fnBiz.pagePopup('add', null);
|
||||
});
|
||||
});
|
||||
|
||||
/* *******************************
|
||||
* Grid
|
||||
******************************* */
|
||||
const initGrid = () => {
|
||||
|
||||
/* ******************************
|
||||
* Grid start
|
||||
****************************** */
|
||||
const gridColumns = [ //Grid 컬럼 정보(명칭,매핑 field, 기타옵션 등)
|
||||
{
|
||||
header: '우편번호',
|
||||
name: 'zip',
|
||||
width: 120,
|
||||
sortable: true,
|
||||
sortingType: 'desc',
|
||||
align: 'center',
|
||||
renderer: {
|
||||
type: CustomButtonRenderer,
|
||||
options: {
|
||||
formatter: (props) => {
|
||||
const rowData = props.grid.getRow(props.rowKey);
|
||||
return {
|
||||
formatter: rowData.zip.substring(0,3)+ "-"+ rowData.zip.substring(3,6)
|
||||
,element: "text"
|
||||
}
|
||||
}
|
||||
,eventFunction: fnBiz.onClickZipBtn //function(){alert("1234")}
|
||||
,eventType : "click"
|
||||
}
|
||||
}
|
||||
},
|
||||
{
|
||||
header: '주소',
|
||||
name: 'address',
|
||||
minWidth: 300,
|
||||
sortable: false,
|
||||
//align: 'center',
|
||||
renderer: {
|
||||
type: CustomButtonRenderer,
|
||||
options: {
|
||||
formatter: (props) => {
|
||||
const rowData = props.grid.getRow(props.rowKey);
|
||||
return {
|
||||
formatter: rowData.ctprvnNm +' '+ rowData.signguNm +' '+ rowData.emdNm +' '+ rowData.liBuldNm +' '+ rowData.lnbrDongHo
|
||||
,element: "text"
|
||||
}
|
||||
}
|
||||
,eventFunction: fnBiz.onClickGrid //function(props){XitZipCodeMng_list.fnClickDetail(props)} //function(){alert("1234")}
|
||||
,eventType : "click"
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
];
|
||||
const gridDatasource = {
|
||||
initialRequest: true,
|
||||
api: {
|
||||
readData: {
|
||||
url: '<c:url value="/framework/biz/mng/code/findZipCodes.do"/>'
|
||||
,serializer: (params) => fnAddPageInfo(document.frmSearch, params)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const gridOptions = {
|
||||
el: 'grid',
|
||||
rowHeaders: ['rowNum'],
|
||||
columns: gridColumns,
|
||||
};
|
||||
GRID = TuiGrid.of(gridOptions, gridDatasource, (res) => {
|
||||
});
|
||||
};
|
||||
|
||||
/**************************************************************************
|
||||
* initialize
|
||||
**************************************************************************/
|
||||
$(document).ready(function(){
|
||||
initGrid();
|
||||
});
|
||||
</script>
|
@ -0,0 +1,156 @@
|
||||
<%@ page contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
|
||||
<%@ include file="/WEB-INF/jsp/framework/taglibs.jsp" %>
|
||||
<%@ taglib prefix="validator" uri="http://www.springmodules.org/tags/commons-validator" %>
|
||||
|
||||
<c:url var="ImgUrl" value="/resources/"/>
|
||||
|
||||
<c:set var="isUpdate" value="${!empty zip.zip}"/>
|
||||
<c:set var="bizName" value="우편번호"/>
|
||||
|
||||
<script type="text/javascript" src="<c:url value="/framework/util/validator.do"/>"></script>
|
||||
<validator:javascript formName="zip" staticJavascript="false" xhtml="true" cdata="false"/>
|
||||
|
||||
<div class="popup" style="min-width: 100%;">
|
||||
<div class="popup_inner" style="max-width: 600px;">
|
||||
<%@include file="/WEB-INF/jsp/framework/biz-popup-title.jsp"%>
|
||||
<%--@elvariable id="zip" type="validator"--%>
|
||||
<form:form commandName="zip" name="zip" method="post">
|
||||
<table class="tbl03">
|
||||
<caption><c:out value="${bizName}"/> 등록 / 변경</caption>
|
||||
<colgroup>
|
||||
<col style="width: 20%;"/>
|
||||
<col style="width: 80%;"/>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th class="required" scope="row" nowrap>
|
||||
<label for="zip">우편번호</label>
|
||||
</th>
|
||||
<td nowrap="nowrap">
|
||||
<input style="width: 30%" type="text" id="zip" name="zip" size="6" maxlength="6"/>
|
||||
<form:errors path="zip"/> * 우편번호의 '-'를 제외하고 입력하시오.
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="required" scope="row" nowrap >
|
||||
<label for="ctprvnNm">시도명</label>
|
||||
</th>
|
||||
<td nowrap="nowrap">
|
||||
<form:input path="ctprvnNm" size="20" maxlength="20" id="ctprvnNm"/>
|
||||
<form:errors path="ctprvnNm"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th height="23" class="required" scope="row" nowrap >
|
||||
<label for="signguNm">시군구명</label>
|
||||
</th>
|
||||
<td nowrap="nowrap">
|
||||
<form:input path="signguNm" size="20" maxlength="20" id="signguNm"/>
|
||||
<form:errors path="signguNm"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th height="23" class="required" scope="row" nowrap >
|
||||
<label for="emdNm">읍면동명</label>
|
||||
</th>
|
||||
<td nowrap="nowrap">
|
||||
<form:input path="emdNm" size="30" maxlength="30" id="emdNm"/>
|
||||
<form:errors path="emdNm"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th height="23" scope="row" nowrap >
|
||||
<label for="liBuldNm">리건물명</label>
|
||||
</th>
|
||||
<td nowrap="nowrap">
|
||||
<form:input path="liBuldNm" size="60" maxlength="60" id="liBuldNm"/>
|
||||
<form:errors path="liBuldNm"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th scope="row" nowrap >
|
||||
<label for="lnbrDongHo">번지동호</label>
|
||||
</th>
|
||||
<td nowrap="nowrap">
|
||||
<form:input path="lnbrDongHo" size="20" maxlength="20" id="lnbrDongHo"/>
|
||||
<form:errors path="lnbrDongHo"/>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</form:form>
|
||||
<%@include file="/WEB-INF/jsp/framework/biz-popup-btn.jsp" %>
|
||||
<!-- //등록버튼 -->
|
||||
</div>
|
||||
</div>
|
||||
<!-- //popup -->
|
||||
|
||||
<script type="text/javaScript">
|
||||
/**************************************************************************
|
||||
* Global Variable
|
||||
**************************************************************************/
|
||||
let orgData;
|
||||
|
||||
/* *******************************
|
||||
* Biz function
|
||||
******************************* */
|
||||
const fnBiz = {
|
||||
add: () => {
|
||||
if (!fnBiz.validate()) return;
|
||||
|
||||
cmmBizAjax('add', {
|
||||
url: '<c:url value="/framework/biz/mng/code/addZipCode.do"/>'
|
||||
, data: $("#zip").serialize()
|
||||
})
|
||||
}
|
||||
,modify: () => {
|
||||
if (!fnBiz.validate()) return;
|
||||
|
||||
cmmBizAjax('modify', {
|
||||
url: '<c:url value="/framework/biz/mng/code/modifyZipCode.do"/>'
|
||||
,data: $("#cmmnCode").serialize()
|
||||
});
|
||||
}
|
||||
,remove: () => {
|
||||
cmmBizAjax('remove', {
|
||||
url: '<c:url value="/framework/biz/mng/code/removeZipCode.do"/>'
|
||||
,data: $("#cmmnCode").serialize()
|
||||
});
|
||||
}
|
||||
,validate: () => {
|
||||
|
||||
if(orgData === $('form').serialize()){
|
||||
alert('변경된 내용이 없습니다.');
|
||||
return false;
|
||||
}
|
||||
if(!validateZip(document.getElementById("zip"))){
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
/**************************************************************************
|
||||
* event
|
||||
**************************************************************************/
|
||||
$(() => {
|
||||
$('#btnRegist').on('click', () => {
|
||||
fnBiz.add();
|
||||
});
|
||||
|
||||
$('#btnModify').on('click', () => {
|
||||
fnBiz.modify();
|
||||
});
|
||||
|
||||
$('#btnRemove').on('click', () => {
|
||||
fnBiz.remove();
|
||||
});
|
||||
});
|
||||
/**************************************************************************
|
||||
* initialize
|
||||
**************************************************************************/
|
||||
$(document).ready(function () {
|
||||
orgData = $('form').serialize();
|
||||
});
|
||||
|
||||
</script>
|
Loading…
Reference in New Issue