diff --git a/src/main/java/kcg/faics/equip/web/EquipmentController.java b/src/main/java/kcg/faics/equip/web/EquipmentController.java index 35cf7a1..948c3bc 100644 --- a/src/main/java/kcg/faics/equip/web/EquipmentController.java +++ b/src/main/java/kcg/faics/equip/web/EquipmentController.java @@ -36,8 +36,8 @@ import kcg.faics.member.vo.MemberVO; import kcg.faics.sec.AuthType; import kcg.faics.sec.LoginUserVO; import kcg.faics.sec.UserUtil; -import kcg.faics.target.service.impl.DivMngServiceImpl; -import kcg.faics.target.vo.DivMngVO; +import kcg.faics.tg.service.impl.DivMngServiceImpl; +import kcg.faics.tg.vo.DivMngVO; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/main/java/kcg/faics/fa/web/EduController.java b/src/main/java/kcg/faics/fa/web/EduController.java index d9ddc06..f44db4e 100644 --- a/src/main/java/kcg/faics/fa/web/EduController.java +++ b/src/main/java/kcg/faics/fa/web/EduController.java @@ -17,8 +17,8 @@ import kcg.faics.fa.vo.EduSearchVO; import kcg.faics.fa.vo.EduVO; import kcg.faics.sec.LoginUserVO; import kcg.faics.sec.UserUtil; -import kcg.faics.target.vo.DivMngSearchVO; -import kcg.faics.target.vo.DivMngVO; +import kcg.faics.tg.vo.DivMngSearchVO; +import kcg.faics.tg.vo.DivMngVO; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; diff --git a/src/main/java/kcg/faics/tg/FerryRouteType.java b/src/main/java/kcg/faics/tg/FerryRouteType.java new file mode 100644 index 0000000..7e95d93 --- /dev/null +++ b/src/main/java/kcg/faics/tg/FerryRouteType.java @@ -0,0 +1,96 @@ +package kcg.faics.target; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.List; + +/** + * 항로 타입. + * + * @author kimnomin + * + */ +public enum FerryRouteType { + /** + * 한-중. + */ + KR_CH("A", "한-중"), + /** + * 한-러. + */ + KR_RU("B", "한-러"), + /** + * 한-일. + */ + KR_JP("C", "한-일"), + /** + * 북한. + */ + KP("D", "북한"); + + /** + * code. + */ + private final String code; + /** + * value. + */ + private final String value; + /** + * @return the code + */ + public final String getCode() { + return code; + } + /** + * @return the value + */ + public final String getValue() { + return value; + } + /** + * code에 해당하는 value를 반환한다. + * + * @param code code + * @return value + */ + public static final String getValue(final String code) { + String value = ""; + + for (FerryRouteType item: FerryRouteType.values()) { + if (item.getCode().equalsIgnoreCase(code)) { + value = item.getValue(); + break; + } + } + + return value; + } + + /** + * exclude를 제외한 List를 반환한다. + * + * @param exclude 제외할 타입 + * @return List + */ + public static final List values(final FerryRouteType... exclude) { + List list = new ArrayList(); + for (FerryRouteType item : values()) { + if (!Arrays.asList(exclude).contains(item)) { + list.add(item); + } + } + return list; + } + + /** + * 생성자. + * + * @param code 코드값 + * @param value 표출값 + */ + FerryRouteType(final String code, final String value) { + this.code = code; + this.value = value; + } +} diff --git a/src/main/java/kcg/faics/tg/FerryRunTermType.java b/src/main/java/kcg/faics/tg/FerryRunTermType.java new file mode 100644 index 0000000..4c6e646 --- /dev/null +++ b/src/main/java/kcg/faics/tg/FerryRunTermType.java @@ -0,0 +1,68 @@ +package kcg.faics.target; + +/** + * 국제여객선 운항횟수 타입. + * + * @author kimnomin + * + */ +public enum FerryRunTermType { + /** + * 주. + */ + WEEK("A", "주"), + /** + * 일. + */ + DAY("B", "일"); + + /** + * code. + */ + private final String code; + /** + * value. + */ + private final String value; + + /** + * @return the code + */ + public final String getCode() { + return code; + } + /** + * @return the value + */ + public final String getValue() { + return value; + } + /** + * code에 해당하는 value를 반환한다. + * + * @param code code + * @return value + */ + public static final String getValue(final String code) { + String value = ""; + + for (FerryRunTermType item: FerryRunTermType.values()) { + if (item.getCode().equalsIgnoreCase(code)) { + value = item.getValue(); + break; + } + } + + return value; + } + /** + * 생성자. + * + * @param code 코드값 + * @param value 표출값 + */ + FerryRunTermType(final String code, final String value) { + this.code = code; + this.value = value; + } +} diff --git a/src/main/java/kcg/faics/tg/package-info.java b/src/main/java/kcg/faics/tg/package-info.java new file mode 100644 index 0000000..054e9a9 --- /dev/null +++ b/src/main/java/kcg/faics/tg/package-info.java @@ -0,0 +1,8 @@ +/** + * 외사대상목표 패키지. + */ +/** + * @author kimnomin + * + */ +package kcg.faics.target; \ No newline at end of file diff --git a/src/main/java/kcg/faics/tg/service/CorpService.java b/src/main/java/kcg/faics/tg/service/CorpService.java new file mode 100644 index 0000000..4c16d6e --- /dev/null +++ b/src/main/java/kcg/faics/tg/service/CorpService.java @@ -0,0 +1,25 @@ +package kcg.faics.target.service; + +import java.util.HashMap; +import java.util.List; + +import kcg.faics.cmmn.bbs.BaseBbsService; +import kcg.faics.target.vo.CorpSearchVO; +import kcg.faics.target.vo.CorpVO; + +/** + * 치안대상 관련 인터페이스. + * + * @author kimnomin + * + */ +public interface CorpService extends BaseBbsService { + /** + * 치안대상 통계현황을 반환한다. + * + * @return 치안대상 통계현황 + * @throws Exception + * 기본 예외 처리 + */ + List> selectStats() throws Exception; +} diff --git a/src/main/java/kcg/faics/tg/service/WeakPlaceService.java b/src/main/java/kcg/faics/tg/service/WeakPlaceService.java new file mode 100644 index 0000000..e5a5c33 --- /dev/null +++ b/src/main/java/kcg/faics/tg/service/WeakPlaceService.java @@ -0,0 +1,37 @@ +package kcg.faics.target.service; + +import java.util.HashMap; +import java.util.List; + +import kcg.faics.cmmn.bbs.BaseBbsService; +import kcg.faics.target.vo.WeakPlaceSearchVO; +import kcg.faics.target.vo.WeakPlaceVO; + +/** + * 외사취약지 관련 인터페이스. + * + * @author kimnomin + * + */ +public interface WeakPlaceService extends + BaseBbsService { + /** + * 소속별 외사취약지 통계현황을 반환한다. + * + * @return 소속별 외사취약지 통계현황 + * @throws Exception + * 기본 예외 처리 + */ + List> selectStatsPerPlace() throws Exception; + + /** + * 해당 소속의 마지막 외사취약지 일련번호를 반환한다. + * + * @param place1 + * 소속 + * @return 마지막 외사취약지 일련번호 + * @throws Exception + * 기본 예외 처리 + */ + int selectMaxWpNo(String place1) throws Exception; +} diff --git a/src/main/java/kcg/faics/tg/service/impl/CorpMapper.java b/src/main/java/kcg/faics/tg/service/impl/CorpMapper.java new file mode 100644 index 0000000..8497c87 --- /dev/null +++ b/src/main/java/kcg/faics/tg/service/impl/CorpMapper.java @@ -0,0 +1,109 @@ +package kcg.faics.target.service.impl; + +import java.util.HashMap; +import java.util.List; + +import kcg.faics.target.vo.CorpSearchVO; +import kcg.faics.target.vo.CorpVO; + +import org.springframework.stereotype.Repository; + +import egovframework.rte.psl.dataaccess.EgovAbstractMapper; + +/** + * 치안대상 관련 Mapper 클래스. + * + * @author kimnomin + * + */ +@Repository("corpMapper") +public class CorpMapper extends EgovAbstractMapper { + + /** + * 치안대상 정보를 반환한다. + * + * @param corpVO + * 치안대상 VO + * @return 치안대상 정보 + * @throws Exception + * 기본 예외 처리 + */ + public CorpVO select(final CorpVO corpVO) throws Exception { + return selectOne("Corp.select", corpVO); + } + + /** + * 치안대상 목록을 반환한다. + * + * @param searchVO + * 검색조건 VO + * @return 치안대상 목록 + */ + public List selectList(final CorpSearchVO searchVO) { + return selectList("Corp.selectList", searchVO); + } + + /** + * 치안대상 통계현황을 반환한다. + * + * @param map + * 조건 Map 객체 + * @return 치안대상 통계현황 + * @throws Exception + * 기본 예외 처리 + */ + public List> selectStats(final HashMap map) + throws Exception { + return selectList("Corp.selectStats", map); + } + + /** + * 치안대상 정보를 입력한다. + * + * @param corpVO + * 입력할 치안대상 VO + * @return 1 성공, 0 실패 + */ + public int insert(final CorpVO corpVO) { + return insert("Corp.insert", corpVO); + } + + /** + * orgNo의 최대값을 반환한다. + * + * @param corpVO + * 치안대상 VO + * @return orgNo 최대값 + * @throws Exception + * 기본 예외 처리 + */ + public int selectMaxOrgNo(final CorpVO corpVO) throws Exception { + return selectOne("Corp.selectMaxOrgNo", corpVO); + } + + /** + * 치안대상 정보를 삭제한다. + * + * @param corpVO + * 치안대상 VO + * @return 1성공, 0실패 + * @throws Exception + * 기본 예외 처리 + */ + public int delete(final CorpVO corpVO) throws Exception { + return delete("Corp.delete", corpVO); + } + + /** + * 치안대상 정보를 수정한다. + * + * @param corpVO + * 치안대상 VO + * @return 1성공, 0실패 + * @throws Exception + * 기본 예외 처리 + */ + public int update(final CorpVO corpVO) throws Exception { + return update("Corp.update", corpVO); + } +} diff --git a/src/main/java/kcg/faics/tg/service/impl/CorpServiceImpl.java b/src/main/java/kcg/faics/tg/service/impl/CorpServiceImpl.java new file mode 100644 index 0000000..90b3104 --- /dev/null +++ b/src/main/java/kcg/faics/tg/service/impl/CorpServiceImpl.java @@ -0,0 +1,128 @@ +package kcg.faics.target.service.impl; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import kcg.faics.cmmn.egov.file.EgovFileMngUtil; +import kcg.faics.cmmn.service.CodeService; +import kcg.faics.target.service.CorpService; +import kcg.faics.target.vo.CorpSearchVO; +import kcg.faics.target.vo.CorpVO; + +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl; + +/** + * 치안대상 관련 비지니스로직. + * + * @author kimnomin + * + */ +@Service("corpService") +public class CorpServiceImpl extends EgovAbstractServiceImpl implements CorpService { + /** + * 전자정부프레임워크에서 제공되는 파일 업로드 처리 관련 Utility. + **/ + @Resource(name = "EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + /** + * 치안대상 Mapper 클래스. + */ + @Resource(name = "corpMapper") + private CorpMapper corpMapper; + + + /** + * orgNo의 최대값을 반환한다. + * + * @param corpVO + * 치안대상 VO + * @return orgNo 최대값 + * @throws Exception + * 기본 예외 처리 + */ + private int selectNextOrgNo(final CorpVO corpVO) throws Exception { + int result = 1; + try { + result = corpMapper.selectMaxOrgNo(corpVO) + 1; + } catch (Exception e) { + e.printStackTrace(); + } + return result; + } + + @Override + public CorpVO select(final CorpVO dataVO) throws Exception { + return corpMapper.select(dataVO); + } + + @Override + public List selectListAll(final CorpSearchVO searchVO) throws Exception { + // TODO Auto-generated method stub + return null; + } + + @Override + public List selectList(final CorpSearchVO searchVO) throws Exception { + if (CodeService.LIST_ALL_VAL.equalsIgnoreCase(searchVO.getPlace1())) { + searchVO.setPlace1(""); + } + return corpMapper.selectList(searchVO); + } + + @Override + public int selectListCnt(final CorpSearchVO searchVO) throws Exception { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int selectTotalCnt(final CorpSearchVO searchVO) throws Exception { + // TODO Auto-generated method stub + return 0; + } + + @Override + public HashMap insert(final CorpVO dataVO, + final Map fileMap) throws Exception { + int nextOrgNo = selectNextOrgNo(dataVO); + dataVO.setOrgNo(nextOrgNo); + + HashMap map = new HashMap(); + map.put("result", corpMapper.insert(dataVO)); + + return map; + } + + @Override + public HashMap update(final CorpVO dataVO, + final Map fileMap, final String[] deleteFiles) + throws Exception { + HashMap map = new HashMap(); + map.put("result", corpMapper.update(dataVO)); + + return map; + } + + @Override + public HashMap delete(final CorpVO dataVO) throws Exception { + HashMap map = new HashMap(); + map.put("result", corpMapper.delete(dataVO)); + + return map; + } + + @Override + public List> selectStats() throws Exception { + HashMap map = new HashMap(); + map.put("placeList", CodeService.POLICE_STATION_LIST); + + return corpMapper.selectStats(map); + } +} diff --git a/src/main/java/kcg/faics/tg/service/impl/DivMngMapper.java b/src/main/java/kcg/faics/tg/service/impl/DivMngMapper.java new file mode 100644 index 0000000..2428fca --- /dev/null +++ b/src/main/java/kcg/faics/tg/service/impl/DivMngMapper.java @@ -0,0 +1,94 @@ +package kcg.faics.target.service.impl; + +import java.util.List; + +import kcg.faics.target.vo.DivMngSearchVO; +import kcg.faics.target.vo.DivMngVO; + +import org.springframework.stereotype.Repository; + +import egovframework.rte.psl.dataaccess.EgovAbstractMapper; + +/** + * 외사분실운영현황 관련 Mapper 클래스. + * + * @author kimnomin + * + */ +@Repository("divMngMapper") +public class DivMngMapper extends EgovAbstractMapper { + + /** + * 외사분실운영현황 정보를 반환한다. + * + * @param vo + * 외사분실운영현황 VO + * @return 외사분실운영현황 정보 + * @throws Exception + * 기본 예외 처리 + */ + public DivMngVO select(final DivMngVO vo) throws Exception { + return selectOne("DivMng.select", vo); + } + + /** + * 외사분실운영현황 목록을 반환한다. + * + * @param searchVO + * 검색조건 VO + * @return 치안대상 목록 + */ + public List selectList(final DivMngSearchVO searchVO) { + return selectList("DivMng.selectList", searchVO); + } + + /** + * 외사분실운영현황 정보를 입력한다. + * + * @param vo + * 입력할 외사분실운영현황 VO + * @return 1 성공, 0 실패 + */ + public int insert(final DivMngVO vo) { + return insert("DivMng.insert", vo); + } + + /** + * 외사분실운영현황 정보를 삭제한다. + * + * @param vo + * 외사분실운영현황 VO + * @return 1성공, 0실패 + * @throws Exception + * 기본 예외 처리 + */ + public int delete(final DivMngVO vo) throws Exception { + return delete("DivMng.delete", vo); + } + + /** + * 외사분실운영현황 정보를 수정한다. + * + * @param vo + * 외사분실운영현황 VO + * @return 1성공, 0실패 + * @throws Exception + * 기본 예외 처리 + */ + public int update(final DivMngVO vo) throws Exception { + return update("DivMng.update", vo); + } + + /** + * Place별 DS_NO의 최대값을 반환한다. + * + * @param vo + * 외사분실운영현황 VO + * @return place별 최대 DS_NO 값 + * @throws Exception + * 기본 예외 처리 + */ + public int selectMaxNo(final DivMngVO vo) throws Exception { + return selectOne("DivMng.selectMaxNo", vo); + } +} diff --git a/src/main/java/kcg/faics/tg/service/impl/DivMngServiceImpl.java b/src/main/java/kcg/faics/tg/service/impl/DivMngServiceImpl.java new file mode 100644 index 0000000..c4f18f3 --- /dev/null +++ b/src/main/java/kcg/faics/tg/service/impl/DivMngServiceImpl.java @@ -0,0 +1,224 @@ +package kcg.faics.target.service.impl; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import kcg.faics.cmmn.bbs.BaseBbsService; +import kcg.faics.cmmn.egov.file.EgovFileMngUtil; +import kcg.faics.cmmn.egov.vo.FileVO; +import kcg.faics.cmmn.service.CodeService; +import kcg.faics.target.vo.DivMngSearchVO; +import kcg.faics.target.vo.DivMngVO; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl; + +/** + * 외사분실운영현황 관련 비지니스로직. + * + * @author kimnomin + * + */ +@Service("divMngService") +public class DivMngServiceImpl extends EgovAbstractServiceImpl implements + BaseBbsService { + + /** + * property 파일에서 읽은 저장 경로 키워드. + */ + public static final String FILE_PATH_KEYWORD = "Target.divmng.fileStorePath"; + + /** + * 전자정부프레임워크에서 제공되는 파일 업로드 처리 관련 Utility. + **/ + @Resource(name = "EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + /** + * 외사분실운영현황 Mapper 클래스. + */ + @Resource(name = "divMngMapper") + private DivMngMapper divMngMapper; + + /** + * Place별 다음에 사용할 DS_NO를 반환한다. + * + * @param divMngVO + * 외사분실운영현황 VO + * @return place별 최대 DS_NO+1 + * @throws Exception + * 기본 예외 처리 + */ + private int selectNextNo(final DivMngVO divMngVO) throws Exception { + int result = 1; + try { + result = divMngMapper.selectMaxNo(divMngVO) + 1; + } catch (Exception e) { + e.printStackTrace(); + } + return result; + } + + @Override + public DivMngVO select(final DivMngVO dataVO) throws Exception { + return divMngMapper.select(dataVO); + } + + @Override + public List selectListAll(final DivMngSearchVO searchVO) + throws Exception { + // TODO Auto-generated method stub + return null; + } + + @Override + public List selectList(final DivMngSearchVO searchVO) throws Exception { + if (CodeService.LIST_ALL_VAL.equalsIgnoreCase(searchVO.getPlace())) { + searchVO.setPlace(""); + } + return divMngMapper.selectList(searchVO); + } + + @Override + public int selectListCnt(final DivMngSearchVO searchVO) throws Exception { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int selectTotalCnt(final DivMngSearchVO searchVO) throws Exception { + // TODO Auto-generated method stub + return 0; + } + + @Override + public HashMap insert(final DivMngVO dataVO, + final Map fileMap) throws Exception { + HashMap map = new HashMap(); + int no = selectNextNo(dataVO); + if (no > 0) { + dataVO.setNo(no); + + List fileList = fileUtil.parseFileInf(fileMap, null, 0, "", FILE_PATH_KEYWORD); + for (FileVO fileVO : fileList) { + if ("fileImgObj".equalsIgnoreCase(fileVO.getFileSn())) { + dataVO.setFileImg(fileVO.getStreFileNm()); + } else if ("file1obj".equalsIgnoreCase(fileVO.getFileSn())) { + dataVO.setFile1(fileVO.getStreFileNm()); + } else if ("file2obj".equalsIgnoreCase(fileVO.getFileSn())) { + dataVO.setFile2(fileVO.getStreFileNm()); + } else if ("file3obj".equalsIgnoreCase(fileVO.getFileSn())) { + dataVO.setFile3(fileVO.getStreFileNm()); + } + } + + map.put("result", divMngMapper.insert(dataVO)); + } else { + map.put("result", 0); + } + + return map; + } + + /** + * Update시 파일삭제 대상을 판별한다. + * + * @param fileMap 파일 Map 객체 + * @param fileMapKey 파일 Map 객체에서 추출할 key + * @param deleteFileList 삭제대상 목록 + * @param deleteFileListKey 삭제대상 목록에서 추출할 문자열 + * @return 파일삭제여부 + */ + private boolean isRemoveTarget(final Map fileMap, + final String fileMapKey, final List deleteFileList, + final String deleteFileListKey) { + boolean isRemoveTarget = false; + + if (deleteFileList.contains(deleteFileListKey) + || (fileMap.containsKey(fileMapKey) && fileMap.get(fileMapKey).getSize() > 0)) { + isRemoveTarget = true; + } + + return isRemoveTarget; + } + + @Override + public HashMap update(final DivMngVO dataVO, + final Map fileMap, final String[] deleteFiles) + throws Exception { + DivMngVO vo = select(dataVO); + dataVO.setFileImg(vo.getFileImg()); + dataVO.setFile1(vo.getFile1()); + dataVO.setFile2(vo.getFile2()); + dataVO.setFile3(vo.getFile3()); + + List deleteFileList = new ArrayList(); + if (deleteFiles != null) { + deleteFileList = Arrays.asList(deleteFiles); + } + if (isRemoveTarget(fileMap, "fileImgObj", deleteFileList, "fileImg")) { + fileUtil.deleteFile(vo.getFileImg(), FILE_PATH_KEYWORD); + dataVO.setFileImg(""); + } + if (isRemoveTarget(fileMap, "file1obj", deleteFileList, "file1")) { + fileUtil.deleteFile(vo.getFile1(), FILE_PATH_KEYWORD); + dataVO.setFile1(""); + } + if (isRemoveTarget(fileMap, "file2obj", deleteFileList, "file2")) { + fileUtil.deleteFile(vo.getFile2(), FILE_PATH_KEYWORD); + dataVO.setFile2(""); + } + if (isRemoveTarget(fileMap, "file3obj", deleteFileList, "file3")) { + fileUtil.deleteFile(vo.getFile3(), FILE_PATH_KEYWORD); + dataVO.setFile3(""); + } + + List fileList = fileUtil.parseFileInf(fileMap, null, 0, "", FILE_PATH_KEYWORD); + for (FileVO fileVO : fileList) { + if ("fileImgObj".equalsIgnoreCase(fileVO.getFileSn())) { + dataVO.setFileImg(fileVO.getStreFileNm()); + } else if ("file1obj".equalsIgnoreCase(fileVO.getFileSn())) { + dataVO.setFile1(fileVO.getStreFileNm()); + } else if ("file2obj".equalsIgnoreCase(fileVO.getFileSn())) { + dataVO.setFile2(fileVO.getStreFileNm()); + } else if ("file3obj".equalsIgnoreCase(fileVO.getFileSn())) { + dataVO.setFile3(fileVO.getStreFileNm()); + } + } + + HashMap map = new HashMap(); + map.put("result", divMngMapper.update(dataVO)); + + return map; + } + + @Override + public HashMap delete(final DivMngVO dataVO) throws Exception { + DivMngVO vo = select(dataVO); + HashMap map = new HashMap(); + map.put("result", divMngMapper.delete(dataVO)); + + if (StringUtils.isNotBlank(vo.getFileImg())) { + fileUtil.deleteFile(vo.getFileImg(), FILE_PATH_KEYWORD); + } + if (StringUtils.isNotBlank(vo.getFile1())) { + fileUtil.deleteFile(vo.getFile1(), FILE_PATH_KEYWORD); + } + if (StringUtils.isNotBlank(vo.getFile2())) { + fileUtil.deleteFile(vo.getFile2(), FILE_PATH_KEYWORD); + } + if (StringUtils.isNotBlank(vo.getFile3())) { + fileUtil.deleteFile(vo.getFile3(), FILE_PATH_KEYWORD); + } + + return map; + } +} diff --git a/src/main/java/kcg/faics/tg/service/impl/FerryMapper.java b/src/main/java/kcg/faics/tg/service/impl/FerryMapper.java new file mode 100644 index 0000000..f12f340 --- /dev/null +++ b/src/main/java/kcg/faics/tg/service/impl/FerryMapper.java @@ -0,0 +1,94 @@ +package kcg.faics.target.service.impl; + +import java.util.List; + +import kcg.faics.target.vo.FerrySearchVO; +import kcg.faics.target.vo.FerryVO; + +import org.springframework.stereotype.Repository; + +import egovframework.rte.psl.dataaccess.EgovAbstractMapper; + +/** + * 국제여객선 관련 Mapper 클래스. + * + * @author kimnomin + * + */ +@Repository("ferryMapper") +public class FerryMapper extends EgovAbstractMapper { + + /** + * 국제여객선 정보를 반환한다. + * + * @param vo + * 국제여객선 VO + * @return 국제여객선 정보 + * @throws Exception + * 기본 예외 처리 + */ + public FerryVO select(final FerryVO vo) throws Exception { + return selectOne("Ferry.select", vo); + } + + /** + * 국제여객선 목록을 반환한다. + * + * @param searchVO + * 검색조건 VO + * @return 치안대상 목록 + */ + public List selectList(final FerrySearchVO searchVO) { + return selectList("Ferry.selectList", searchVO); + } + + /** + * 국제여객선 정보를 입력한다. + * + * @param vo + * 입력할 국제여객선 VO + * @return 1 성공, 0 실패 + */ + public int insert(final FerryVO vo) { + return insert("Ferry.insert", vo); + } + + /** + * 국제여객선 정보를 삭제한다. + * + * @param vo + * 국제여객선 VO + * @return 1성공, 0실패 + * @throws Exception + * 기본 예외 처리 + */ + public int delete(final FerryVO vo) throws Exception { + return delete("Ferry.delete", vo); + } + + /** + * 국제여객선 정보를 수정한다. + * + * @param vo + * 국제여객선 VO + * @return 1성공, 0실패 + * @throws Exception + * 기본 예외 처리 + */ + public int update(final FerryVO vo) throws Exception { + return update("Ferry.update", vo); + } + + /** + * SER_NO의 최대값을 반환한다. + * + * @param vo + * 국제여객선 VO + * @return SER_NO 최대 값 + * @throws Exception + * 기본 예외 처리 + */ + public int selectMaxSerNo(final FerryVO vo) throws Exception { + return selectOne("Ferry.selectMaxSerNo", vo); + } +} diff --git a/src/main/java/kcg/faics/tg/service/impl/FerryServiceImpl.java b/src/main/java/kcg/faics/tg/service/impl/FerryServiceImpl.java new file mode 100644 index 0000000..c320980 --- /dev/null +++ b/src/main/java/kcg/faics/tg/service/impl/FerryServiceImpl.java @@ -0,0 +1,184 @@ +package kcg.faics.target.service.impl; + +import java.util.ArrayList; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import kcg.faics.cmmn.bbs.BaseBbsService; +import kcg.faics.cmmn.egov.file.EgovFileMngUtil; +import kcg.faics.cmmn.egov.vo.FileVO; +import kcg.faics.target.vo.FerrySearchVO; +import kcg.faics.target.vo.FerryVO; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl; + +/** + * 국제여객선 관련 비지니스로직. + * + * @author kimnomin + * + */ +@Service("ferryService") +public class FerryServiceImpl extends EgovAbstractServiceImpl implements + BaseBbsService { + + /** + * property 파일에서 읽은 저장 경로 키워드. + */ + public static final String FILE_PATH_KEYWORD = "Target.ferry.fileStorePath"; + + /** + * 전자정부프레임워크에서 제공되는 파일 업로드 처리 관련 Utility. + **/ + @Resource(name = "EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + /** + * 국제여객선 Mapper 클래스. + */ + @Resource(name = "ferryMapper") + private FerryMapper ferryMapper; + + /** + * Place별 다음에 사용할 DS_NO를 반환한다. + * + * @param ferryVO + * 국제여객선 VO + * @return SER_NO 최대 값+1 + * @throws Exception + * 기본 예외 처리 + */ + private int selectNextSerNo(final FerryVO ferryVO) throws Exception { + int result = 1; + try { + result = ferryMapper.selectMaxSerNo(ferryVO) + 1; + } catch (Exception e) { + e.printStackTrace(); + } + return result; + } + + @Override + public FerryVO select(final FerryVO dataVO) throws Exception { + return ferryMapper.select(dataVO); + } + + @Override + public List selectListAll(final FerrySearchVO searchVO) + throws Exception { + // TODO Auto-generated method stub + return null; + } + + @Override + public List selectList(final FerrySearchVO searchVO) throws Exception { + return ferryMapper.selectList(searchVO); + } + + @Override + public int selectListCnt(final FerrySearchVO searchVO) throws Exception { + // TODO Auto-generated method stub + return 0; + } + + @Override + public int selectTotalCnt(final FerrySearchVO searchVO) throws Exception { + // TODO Auto-generated method stub + return 0; + } + + @Override + public HashMap insert(final FerryVO dataVO, + final Map fileMap) throws Exception { + HashMap map = new HashMap(); + int no = selectNextSerNo(dataVO); + if (no > 0) { + dataVO.setSerNo(no); + + List fileList = fileUtil.parseFileInf(fileMap, null, 0, "", FILE_PATH_KEYWORD); + for (FileVO fileVO : fileList) { + if ("imgFileObj".equalsIgnoreCase(fileVO.getFileSn())) { + dataVO.setImgFile(fileVO.getStreFileNm()); + } + } + + map.put("result", ferryMapper.insert(dataVO)); + } else { + map.put("result", 0); + } + + return map; + } + + /** + * Update시 파일삭제 대상을 판별한다. + * + * @param fileMap 파일 Map 객체 + * @param fileMapKey 파일 Map 객체에서 추출할 key + * @param deleteFileList 삭제대상 목록 + * @param deleteFileListKey 삭제대상 목록에서 추출할 문자열 + * @return 파일삭제여부 + */ + private boolean isRemoveTarget(final Map fileMap, + final String fileMapKey, final List deleteFileList, + final String deleteFileListKey) { + boolean isRemoveTarget = false; + + if (deleteFileList.contains(deleteFileListKey) + || (fileMap.containsKey(fileMapKey) && fileMap.get(fileMapKey).getSize() > 0)) { + isRemoveTarget = true; + } + + return isRemoveTarget; + } + + @Override + public HashMap update(final FerryVO dataVO, + final Map fileMap, final String[] deleteFiles) + throws Exception { + FerryVO vo = select(dataVO); + dataVO.setImgFile(vo.getImgFile()); + + List deleteFileList = new ArrayList(); + if (deleteFiles != null) { + deleteFileList = Arrays.asList(deleteFiles); + } + if (isRemoveTarget(fileMap, "imgFileObj", deleteFileList, "imgFile")) { + fileUtil.deleteFile(vo.getImgFile(), FILE_PATH_KEYWORD); + dataVO.setImgFile(""); + } + + List fileList = fileUtil.parseFileInf(fileMap, null, 0, "", FILE_PATH_KEYWORD); + for (FileVO fileVO : fileList) { + if ("imgFileObj".equalsIgnoreCase(fileVO.getFileSn())) { + dataVO.setImgFile(fileVO.getStreFileNm()); + } + } + + HashMap map = new HashMap(); + map.put("result", ferryMapper.update(dataVO)); + + return map; + } + + @Override + public HashMap delete(final FerryVO dataVO) throws Exception { + FerryVO vo = select(dataVO); + HashMap map = new HashMap(); + map.put("result", ferryMapper.delete(dataVO)); + + if (StringUtils.isNotBlank(vo.getImgFile())) { + fileUtil.deleteFile(vo.getImgFile(), FILE_PATH_KEYWORD); + } + + return map; + } +} diff --git a/src/main/java/kcg/faics/tg/service/impl/WeakPlaceMapper.java b/src/main/java/kcg/faics/tg/service/impl/WeakPlaceMapper.java new file mode 100644 index 0000000..a53c591 --- /dev/null +++ b/src/main/java/kcg/faics/tg/service/impl/WeakPlaceMapper.java @@ -0,0 +1,120 @@ +package kcg.faics.target.service.impl; + +import java.util.HashMap; +import java.util.List; + +import kcg.faics.target.vo.WeakPlaceSearchVO; +import kcg.faics.target.vo.WeakPlaceVO; + +import org.springframework.stereotype.Repository; + +import egovframework.rte.psl.dataaccess.EgovAbstractMapper; + +/** + * 외사취약지 관련 Mapper 클래스. + * + * @author kimnomin + * + */ +@Repository("weakPlaceMapper") +public class WeakPlaceMapper extends EgovAbstractMapper { + /** + * 외사취약지 정보를 반환한다. + * + * @param vo + * 검색정보 VO + * @return 외사취약지 VO + * @throws Exception + * 기본 예외 처리 + */ + public WeakPlaceVO select(final WeakPlaceVO vo) throws Exception { + return selectOne("WeakPlace.select", vo); + } + + /** + * 외사취약지 목록을 반환한다. + * + * @param vo + * 검색정보 VO + * @return 외사취약지 목록 + * @throws Exception + * 기본 예외 처리 + */ + public List selectList(final WeakPlaceSearchVO vo) + throws Exception { + return selectList("WeakPlace.selectList", vo); + } + + /** + * 해당 소속의 마지막 외사취약지 일련번호를 반환한다. + * + * @param place1 + * 소속 + * @return 마지막 외사취약지 일련번호 + * @throws Exception + * 기본 예외 처리 + */ + public int selectMaxWpNo(final String place1) throws Exception { + int wpNo = 0; + try { + wpNo = selectOne("WeakPlace.selectMaxWpNo", place1); + } catch (Exception e) { + wpNo = 0; + } + return wpNo; + } + + /** + * 소속별 외사취약지 통계현황을 반환한다. + * + * @param placeList + * 통계를 산출할 소속 코드 배열 + * @return 소속별 외사취약지 통계현황 + * @throws Exception + * 기본 예외 처리 + */ + public List> selectStatsPerPlace(final String[] placeList) throws Exception { + HashMap map = new HashMap(); + map.put("placeList", placeList); + return selectList("WeakPlace.selectStatsPerPlace", map); + } + + /** + * 외사취약지 정보를 입력한다. + * + * @param weakPlaceVO + * 입력할 외사취약지 VO + * @return 1-성공, 0-실패 + * @throws Exception + * 기본 예외 처리 + */ + public int insert(final WeakPlaceVO weakPlaceVO) throws Exception { + return insert("WeakPlace.insert", weakPlaceVO); + } + + /** + * 외사취약지 정보를 수정한다. + * + * @param weakPlaceVO + * 수정할 외사취약지 VO + * @return 1-성공, 0-실패 + * @throws Exception + * 기본 예외 처리 + */ + public int update(final WeakPlaceVO weakPlaceVO) throws Exception { + return update("WeakPlace.update", weakPlaceVO); + } + + /** + * 외사취약지 정보를 삭제한다. + * + * @param weakPlaceVO + * 삭제할 외사취약지 VO + * @return 1-성공, 0-실패 + * @throws Exception + * 기본 예외 처리 + */ + public int delete(final WeakPlaceVO weakPlaceVO) throws Exception { + return delete("WeakPlace.delete", weakPlaceVO); + } +} diff --git a/src/main/java/kcg/faics/tg/service/impl/WeakPlaceServiceImpl.java b/src/main/java/kcg/faics/tg/service/impl/WeakPlaceServiceImpl.java new file mode 100644 index 0000000..f205a38 --- /dev/null +++ b/src/main/java/kcg/faics/tg/service/impl/WeakPlaceServiceImpl.java @@ -0,0 +1,191 @@ +package kcg.faics.target.service.impl; + +import java.util.ArrayList; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.annotation.Resource; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import kcg.faics.cmmn.egov.file.EgovFileMngUtil; +import kcg.faics.cmmn.egov.vo.FileVO; +import kcg.faics.cmmn.service.CodeService; +import kcg.faics.target.service.WeakPlaceService; +import kcg.faics.target.vo.WeakPlaceSearchVO; +import kcg.faics.target.vo.WeakPlaceVO; +import egovframework.rte.fdl.cmmn.EgovAbstractServiceImpl; + +/** + * 외사취약지 관련 비지니스로직. + * + * @author kimnomin + * + */ +@Service("weakPlaceService") +public class WeakPlaceServiceImpl extends EgovAbstractServiceImpl implements WeakPlaceService { + /** + * property 파일에서 읽은 저장 경로 키워드. + */ + private String filePathKeyword = "Target.wp.fileStorePath"; + + /** + * 전자정부프레임워크에서 제공되는 파일 업로드 처리 관련 Utility. + **/ + @Resource(name = "EgovFileMngUtil") + private EgovFileMngUtil fileUtil; + + /** + * 외사취약지 Mapper 클래스. + */ + @Resource(name = "weakPlaceMapper") + private WeakPlaceMapper weakPlaceMapper; + + @Override + public WeakPlaceVO select(final WeakPlaceVO dataVO) throws Exception { + return weakPlaceMapper.select(dataVO); + } + + @Override + public List selectListAll(final WeakPlaceSearchVO searchVO) + throws Exception { + // 사용하지 않음 + return null; + } + + @Override + public List selectList(final WeakPlaceSearchVO searchVO) + throws Exception { + return weakPlaceMapper.selectList(searchVO); + } + + @Override + public List> selectStatsPerPlace() throws Exception { + List> statsList = new ArrayList>(); + try { + statsList = weakPlaceMapper.selectStatsPerPlace(CodeService.POLICE_STATION_LIST); + } catch (Exception e) { + e.printStackTrace(); + } + return statsList; + } + + @Override + public int selectListCnt(final WeakPlaceSearchVO searchVO) throws Exception { + // 사용하지 않음 + return 0; + } + + @Override + public int selectTotalCnt(final WeakPlaceSearchVO searchVO) throws Exception { + // 사용하지 않음 + return 0; + } + + @Override + public int selectMaxWpNo(final String place1) throws Exception { + return weakPlaceMapper.selectMaxWpNo(place1); + } + + @Override + public HashMap insert(final WeakPlaceVO dataVO, + final Map fileMap) throws Exception { + int result = 0; + + try { + // 파일저장 + if (fileMap != null) { + List uploadedFile = fileUtil.parseFileInf(fileMap, null, 0, "", filePathKeyword); + for (FileVO file : uploadedFile) { + if (file != null) { + String fileSn = file.getFileSn(); + if (!StringUtils.isBlank(fileSn)) { + fileSn = fileSn.trim(); + } + if ("file1".equalsIgnoreCase(fileSn)) { + dataVO.setFilename1(file.getStreFileNm()); + } else if ("file2".equalsIgnoreCase(fileSn)) { + dataVO.setFilename2(file.getStreFileNm()); + } + } + } + } + + // DB저장 + result = weakPlaceMapper.insert(dataVO); + } catch (Exception e) { + e.printStackTrace(); + } + HashMap map = new HashMap(); + map.put("result", result); + if (result == 1) { + map.put("place1", dataVO.getPlace1()); + map.put("wpNo", dataVO.getWpNo()); + } + + return map; + } + + @Override + public HashMap update(final WeakPlaceVO dataVO, + final Map fileMap, final String[] deleteFiles) + throws Exception { + int result = 0; + + try { + // 파일삭제 : 기존 PHP 소스에서 실제 물리적인 파일은 삭제하지 않는다. 이를 준용한다. + if (deleteFiles != null) { + for (String deleteTarget : deleteFiles) { + if ("1".equalsIgnoreCase(deleteTarget)) { + dataVO.setFilename1(""); + } else if ("2".equalsIgnoreCase(deleteTarget)) { + dataVO.setFilename2(""); + } + } + } + + // 파일저장 + if (fileMap != null) { + List uploadedFile = fileUtil.parseFileInf(fileMap, null, 0, "", filePathKeyword); + for (FileVO file : uploadedFile) { + if (file != null) { + String fileSn = file.getFileSn(); + if (!StringUtils.isBlank(fileSn)) { + fileSn = fileSn.trim(); + } + if ("file1".equalsIgnoreCase(fileSn)) { + dataVO.setFilename1(file.getStreFileNm()); + } else if ("file2".equalsIgnoreCase(fileSn)) { + dataVO.setFilename2(file.getStreFileNm()); + } + } + } + } + + // DB저장 + result = weakPlaceMapper.update(dataVO); + } catch (Exception e) { + e.printStackTrace(); + } + + HashMap map = new HashMap(); + map.put("result", result); + + return map; + } + + @Override + public HashMap delete(final WeakPlaceVO dataVO) throws Exception { + // 기존 PHP 소스에서 실제 물리적인 파일은 삭제하지 않는다. 이를 준용한다. + int result = weakPlaceMapper.delete(dataVO); + HashMap map = new HashMap(); + map.put("result", result); + + return map; + } + + +} diff --git a/src/main/java/kcg/faics/tg/service/impl/package-info.java b/src/main/java/kcg/faics/tg/service/impl/package-info.java new file mode 100644 index 0000000..ab2634a --- /dev/null +++ b/src/main/java/kcg/faics/tg/service/impl/package-info.java @@ -0,0 +1,8 @@ +/** + * 외사수사대상 관련 비지니스로직 패키지. + */ +/** + * @author kimnomin + * + */ +package kcg.faics.target.service.impl; \ No newline at end of file diff --git a/src/main/java/kcg/faics/tg/service/package-info.java b/src/main/java/kcg/faics/tg/service/package-info.java new file mode 100644 index 0000000..c9aa121 --- /dev/null +++ b/src/main/java/kcg/faics/tg/service/package-info.java @@ -0,0 +1,8 @@ +/** + * 외사수사대상 관련 인터페이스 패키지. + */ +/** + * @author kimnomin + * + */ +package kcg.faics.target.service; \ No newline at end of file diff --git a/src/main/java/kcg/faics/tg/vo/CorpSearchVO.java b/src/main/java/kcg/faics/tg/vo/CorpSearchVO.java new file mode 100644 index 0000000..c4e9c4f --- /dev/null +++ b/src/main/java/kcg/faics/tg/vo/CorpSearchVO.java @@ -0,0 +1,92 @@ +package kcg.faics.target.vo; + +import kcg.faics.cmmn.bbs.BaseSearchVO; + +/** + * 치안대상 검색 관련 Value Object. + * + * @author kimnomin + * + */ +public class CorpSearchVO extends BaseSearchVO { + /** + * 소속1. + */ + private String place1; + /** + * 구분(협조기관~외국인투자업체). + */ + private String orgId; + /** + * 화면구분. (01-업무협조기관, 02-해운항만관련협회, 03-외사관련없체, 04-외국인고용업체, 05-외국인투자업체) + */ + private String grpNo; + /** + * 기관/협회/업체명. + */ + private String name; + /** + * 업종(외국인 고용업체). + */ + private String jobType; + /** + * @return the place1 + */ + public final String getPlace1() { + return place1; + } + /** + * @param place1 the place1 to set + */ + public final void setPlace1(final String place1) { + this.place1 = place1; + } + /** + * @return the orgId + */ + public final String getOrgId() { + return orgId; + } + /** + * @param orgId the orgId to set + */ + public final void setOrgId(final String orgId) { + this.orgId = orgId; + } + /** + * @return the grpNo + */ + public final String getGrpNo() { + return grpNo; + } + /** + * @param grpNo the grpNo to set + */ + public final void setGrpNo(final String grpNo) { + this.grpNo = grpNo; + } + /** + * @return the name + */ + public final String getName() { + return name; + } + /** + * @param name the name to set + */ + public final void setName(final String name) { + this.name = name; + } + /** + * @return the jobType + */ + public final String getJobType() { + return jobType; + } + /** + * @param jobType the jobType to set + */ + public final void setJobType(final String jobType) { + this.jobType = jobType; + } +} diff --git a/src/main/java/kcg/faics/tg/vo/CorpVO.java b/src/main/java/kcg/faics/tg/vo/CorpVO.java new file mode 100644 index 0000000..c5be567 --- /dev/null +++ b/src/main/java/kcg/faics/tg/vo/CorpVO.java @@ -0,0 +1,346 @@ +package kcg.faics.target.vo; + +/** + * 치안대상 Value Ojbect. + * + * @author kimnomin + * + */ +public class CorpVO { + /** + * 소속1. + */ + private String place1; + /** + * 소속1 명칭. + */ + private String place1str; + /** + * 구분(협조기관~외국인투자업체). + */ + private String orgId; + /** + * 구분별 일련번호. + */ + private int orgNo; + /** + * 화면구분. (01-업무협조기관, 02-해운항만관련협회, 03-외사관련없체, 04-외국인고용업체, 05-외국인투자업체) + */ + private String grpNo; + /** + * 기관/협회/업체명. + */ + private String name; + /** + * 소재지. + */ + private String location; + /** + * 대표자명. + */ + private String ceo; + /** + * 업종(외국인 고용업체). + */ + private String jobType; + /** + * 전화번호. + */ + private String tel; + /** + * FAX. + */ + private String fax; + /** + * 비고. + */ + private String comments; + /** + * 대상국(외국인 투자업체). + */ + private String partner; + /** + * 선박(척). + */ + private int shipCnt; + /** + * 근무인원. + */ + private int memberCnt; + /** + * 설립년도. + */ + private String basicYear; + /** + * 자본금(만원). + */ + private int fund; + /** + * 등록자 소속서. + */ + private String writerPlace1; + /** + * 등록자. + */ + private String writer; + /** + * 생성일. + */ + private String credate; + /** + * 수정일. + */ + private String logdate; + /** + * @return the place1 + */ + public final String getPlace1() { + return place1; + } + /** + * @param place1 the place1 to set + */ + public final void setPlace1(final String place1) { + this.place1 = place1; + } + /** + * @return the place1str + */ + public final String getPlace1str() { + return place1str; + } + /** + * @param place1str the place1str to set + */ + public final void setPlace1str(final String place1str) { + this.place1str = place1str; + } + /** + * @return the orgId + */ + public final String getOrgId() { + return orgId; + } + /** + * @param orgId the orgId to set + */ + public final void setOrgId(final String orgId) { + this.orgId = orgId; + } + /** + * @return the orgNo + */ + public final int getOrgNo() { + return orgNo; + } + /** + * @param orgNo the orgNo to set + */ + public final void setOrgNo(final int orgNo) { + this.orgNo = orgNo; + } + /** + * @return the grpNo + */ + public final String getGrpNo() { + return grpNo; + } + /** + * @param grpNo the grpNo to set + */ + public final void setGrpNo(final String grpNo) { + this.grpNo = grpNo; + } + /** + * @return the name + */ + public final String getName() { + return name; + } + /** + * @param name the name to set + */ + public final void setName(final String name) { + this.name = name; + } + /** + * @return the location + */ + public final String getLocation() { + return location; + } + /** + * @param location the location to set + */ + public final void setLocation(final String location) { + this.location = location; + } + /** + * @return the ceo + */ + public final String getCeo() { + return ceo; + } + /** + * @param ceo the ceo to set + */ + public final void setCeo(final String ceo) { + this.ceo = ceo; + } + /** + * @return the jobType + */ + public final String getJobType() { + return jobType; + } + /** + * @param jobType the jobType to set + */ + public final void setJobType(final String jobType) { + this.jobType = jobType; + } + /** + * @return the tel + */ + public final String getTel() { + return tel; + } + /** + * @param tel the tel to set + */ + public final void setTel(final String tel) { + this.tel = tel; + } + /** + * @return the fax + */ + public final String getFax() { + return fax; + } + /** + * @param fax the fax to set + */ + public final void setFax(final String fax) { + this.fax = fax; + } + /** + * @return the comments + */ + public final String getComments() { + return comments; + } + /** + * @param comments the comments to set + */ + public final void setComments(final String comments) { + this.comments = comments; + } + /** + * @return the partner + */ + public final String getPartner() { + return partner; + } + /** + * @param partner the partner to set + */ + public final void setPartner(final String partner) { + this.partner = partner; + } + /** + * @return the shipCnt + */ + public final int getShipCnt() { + return shipCnt; + } + /** + * @param shipCnt the shipCnt to set + */ + public final void setShipCnt(final int shipCnt) { + this.shipCnt = shipCnt; + } + /** + * @return the memberCnt + */ + public final int getMemberCnt() { + return memberCnt; + } + /** + * @param memberCnt the memberCnt to set + */ + public final void setMemberCnt(final int memberCnt) { + this.memberCnt = memberCnt; + } + /** + * @return the basicYear + */ + public final String getBasicYear() { + return basicYear; + } + /** + * @param basicYear the basicYear to set + */ + public final void setBasicYear(final String basicYear) { + this.basicYear = basicYear; + } + /** + * @return the fund + */ + public final int getFund() { + return fund; + } + /** + * @param fund the fund to set + */ + public final void setFund(final int fund) { + this.fund = fund; + } + /** + * @return the writerPlace1 + */ + public final String getWriterPlace1() { + return writerPlace1; + } + /** + * @param writerPlace1 the writerPlace1 to set + */ + public final void setWriterPlace1(final String writerPlace1) { + this.writerPlace1 = writerPlace1; + } + /** + * @return the writer + */ + public final String getWriter() { + return writer; + } + /** + * @param writer the writer to set + */ + public final void setWriter(final String writer) { + this.writer = writer; + } + /** + * @return the credate + */ + public final String getCredate() { + return credate; + } + /** + * @param credate the credate to set + */ + public final void setCredate(final String credate) { + this.credate = credate; + } + /** + * @return the logdate + */ + public final String getLogdate() { + return logdate; + } + /** + * @param logdate the logdate to set + */ + public final void setLogdate(final String logdate) { + this.logdate = logdate; + } +} diff --git a/src/main/java/kcg/faics/tg/vo/DivMngSearchVO.java b/src/main/java/kcg/faics/tg/vo/DivMngSearchVO.java new file mode 100644 index 0000000..a203757 --- /dev/null +++ b/src/main/java/kcg/faics/tg/vo/DivMngSearchVO.java @@ -0,0 +1,31 @@ +package kcg.faics.target.vo; + +import kcg.faics.cmmn.bbs.BaseSearchVO; + +/** + * 외사분실운영현황 검색정보 Value Object. + * + * @author kimnomin + * + */ +public class DivMngSearchVO extends BaseSearchVO { + + /** + * 소속. + */ + private String place; + + /** + * @return the place + */ + public final String getPlace() { + return place; + } + + /** + * @param place the place to set + */ + public final void setPlace(final String place) { + this.place = place; + } +} diff --git a/src/main/java/kcg/faics/tg/vo/DivMngVO.java b/src/main/java/kcg/faics/tg/vo/DivMngVO.java new file mode 100644 index 0000000..a3daddf --- /dev/null +++ b/src/main/java/kcg/faics/tg/vo/DivMngVO.java @@ -0,0 +1,355 @@ +package kcg.faics.target.vo; + +import java.util.Date; + +import org.springframework.web.multipart.MultipartFile; + +/** + * 외사분신운영현황 Value Object. + * + * @author kimnomin + * + */ +public class DivMngVO { + /** + * 소속. + */ + private String place; + /** + * 소속명칭. + */ + private String placeStr; + /** + * 소속별 일련번호. + */ + private int no; + /** + * 설치장소. + */ + private String local; + /** + * 근무형태. 근무형태 i-상주, o-비상주 + */ + private String gubun = "i"; + /** + * 근무형태 표현 문자열. + */ + private String gubunStr = "비상주"; + /** + * 근무인원. + */ + private int staffNum; + /** + * 전화번호. + */ + private String tel; + /** + * 현황. + */ + private String condition; + /** + * 장비현황. + */ + private String equipStat; + /** + * 사진. + */ + private String fileImg; + /** + * 사진 객체. + */ + private MultipartFile fileImgObj; + /** + * 첨부파일1. + */ + private String file1; + /** + * 첨부파일2. + */ + private String file2; + /** + * 첨부파일3. + */ + private String file3; + /** + * 첨부파일1 객체. + */ + private MultipartFile file1obj; + /** + * 첨부파일 2 객체. + */ + private MultipartFile file2obj; + /** + * 첨부파일 3 객체. + */ + private MultipartFile file3obj; + /** + * 입력일. + */ + private Date creDate; + /** + * 수정일. + */ + private Date logDate; + /** + * 입력자. + */ + private String writer; + /** + * @return the place + */ + public final String getPlace() { + return place; + } + /** + * @param place the place to set + */ + public final void setPlace(final String place) { + this.place = place; + } + /** + * @return the placeStr + */ + public final String getPlaceStr() { + return placeStr; + } + /** + * @param placeStr the placeStr to set + */ + public final void setPlaceStr(final String placeStr) { + this.placeStr = placeStr; + } + /** + * @return the no + */ + public final int getNo() { + return no; + } + /** + * @param no the no to set + */ + public final void setNo(final int no) { + this.no = no; + } + /** + * @return the local + */ + public final String getLocal() { + return local; + } + /** + * @param local the local to set + */ + public final void setLocal(final String local) { + this.local = local; + } + /** + * @return the gubun + */ + public final String getGubun() { + return gubun; + } + /** + * @param gubun the gubun to set + */ + public final void setGubun(final String gubun) { + this.gubun = gubun; + if ("i".equalsIgnoreCase(this.gubun)) { + setGubunStr("상주"); + } else { + setGubunStr("비상주"); + } + } + /** + * @return the gubunStr + */ + public final String getGubunStr() { + return gubunStr; + } + /** + * @param gubunStr the gubunStr to set + */ + public final void setGubunStr(final String gubunStr) { + this.gubunStr = gubunStr; + } + /** + * @return the staffNum + */ + public final int getStaffNum() { + return staffNum; + } + /** + * @param staffNum the staffNum to set + */ + public final void setStaffNum(final int staffNum) { + this.staffNum = staffNum; + } + /** + * @return the tel + */ + public final String getTel() { + return tel; + } + /** + * @param tel the tel to set + */ + public final void setTel(final String tel) { + this.tel = tel; + } + /** + * @return the condition + */ + public final String getCondition() { + return condition; + } + /** + * @param condition the condition to set + */ + public final void setCondition(final String condition) { + this.condition = condition; + } + /** + * @return the equipStat + */ + public final String getEquipStat() { + return equipStat; + } + /** + * @param equipStat the equipStat to set + */ + public final void setEquipStat(final String equipStat) { + this.equipStat = equipStat; + } + /** + * @return the fileImgObj + */ + public final MultipartFile getFileImgObj() { + return fileImgObj; + } + /** + * @param fileImgObj the fileImgObj to set + */ + public final void setFileImgObj(final MultipartFile fileImgObj) { + this.fileImgObj = fileImgObj; + } + /** + * @return the fileImg + */ + public final String getFileImg() { + return fileImg; + } + /** + * @param fileImg the fileImg to set + */ + public final void setFileImg(final String fileImg) { + this.fileImg = fileImg; + } + /** + * @return the file1 + */ + public final String getFile1() { + return file1; + } + /** + * @param file1 the file1 to set + */ + public final void setFile1(final String file1) { + this.file1 = file1; + } + /** + * @return the file2 + */ + public final String getFile2() { + return file2; + } + /** + * @param file2 the file2 to set + */ + public final void setFile2(final String file2) { + this.file2 = file2; + } + /** + * @return the file3 + */ + public final String getFile3() { + return file3; + } + /** + * @param file3 the file3 to set + */ + public final void setFile3(final String file3) { + this.file3 = file3; + } + /** + * @return the file1obj + */ + public final MultipartFile getFile1obj() { + return file1obj; + } + /** + * @param file1obj the file1obj to set + */ + public final void setFile1obj(final MultipartFile file1obj) { + this.file1obj = file1obj; + } + /** + * @return the file2obj + */ + public final MultipartFile getFile2obj() { + return file2obj; + } + /** + * @param file2obj the file2obj to set + */ + public final void setFile2obj(final MultipartFile file2obj) { + this.file2obj = file2obj; + } + /** + * @return the file3obj + */ + public final MultipartFile getFile3obj() { + return file3obj; + } + /** + * @param file3obj the file3obj to set + */ + public final void setFile3obj(final MultipartFile file3obj) { + this.file3obj = file3obj; + } + /** + * @return the creDate + */ + public final Date getCreDate() { + return creDate; + } + /** + * @param creDate the creDate to set + */ + public final void setCreDate(final Date creDate) { + this.creDate = creDate; + } + /** + * @return the logDate + */ + public final Date getLogDate() { + return logDate; + } + /** + * @param logDate the logDate to set + */ + public final void setLogDate(final Date logDate) { + this.logDate = logDate; + } + /** + * @return the writer + */ + public final String getWriter() { + return writer; + } + /** + * @param writer the writer to set + */ + public final void setWriter(final String writer) { + this.writer = writer; + } +} diff --git a/src/main/java/kcg/faics/tg/vo/FerrySearchVO.java b/src/main/java/kcg/faics/tg/vo/FerrySearchVO.java new file mode 100644 index 0000000..9ce6245 --- /dev/null +++ b/src/main/java/kcg/faics/tg/vo/FerrySearchVO.java @@ -0,0 +1,51 @@ +package kcg.faics.target.vo; + +import kcg.faics.cmmn.bbs.BaseSearchVO; +import kcg.faics.target.FerryRouteType; + +/** + * 국제여객선 검색정보 Value Object. + * + * @author kimnomin + * + */ +public class FerrySearchVO extends BaseSearchVO { + /** + * 항로(한-중, 한-러, 한-일, 금강산). + */ + private String ferryRoute; + /** + * 항로 표현 문자열. + */ + private String ferryRouteStr; + + /** + * @return the ferryRoute + */ + public final String getFerryRoute() { + return ferryRoute; + } + + /** + * @param ferryRoute the ferryRoute to set + */ + public final void setFerryRoute(final String ferryRoute) { + this.ferryRoute = ferryRoute; + + setFerryRouteStr(FerryRouteType.getValue(ferryRoute)); + } + + /** + * @return the ferryRouteStr + */ + public final String getFerryRouteStr() { + return ferryRouteStr; + } + + /** + * @param ferryRouteStr the ferryRouteStr to set + */ + public final void setFerryRouteStr(final String ferryRouteStr) { + this.ferryRouteStr = ferryRouteStr; + } +} diff --git a/src/main/java/kcg/faics/tg/vo/FerryVO.java b/src/main/java/kcg/faics/tg/vo/FerryVO.java new file mode 100644 index 0000000..ed5b101 --- /dev/null +++ b/src/main/java/kcg/faics/tg/vo/FerryVO.java @@ -0,0 +1,559 @@ +package kcg.faics.target.vo; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.web.multipart.MultipartFile; + +import kcg.faics.target.FerryRouteType; +import kcg.faics.target.FerryRunTermType; + +/** + * 국제여객선 Value Object. + * + * @author kimnomin + * + */ +public class FerryVO { + /** + * ID. + */ + private int serNo; + /** + * 여객선사. + */ + private String ferryOffice; + /** + * 선명. + */ + private String ferryName; + /** + * 톤수. + */ + private String ferryTon; + /** + * 항로(한-중, 한-러, 한-일, 금강산). + */ + private String ferryRoute; + /** + * 항로 표현 문자열. + */ + private String ferryRouteStr; + /** + * 항해시간. + */ + private String ferryTime; + /** + * 최대속력. + */ + private String ferrySpeedMax; + /** + * 항해속력. + */ + private String ferrySpeedNor; + /** + * 여객정원. + */ + private int ferryGuestCnt; + /** + * 승무원정원. + */ + private int ferryClueCnt; + /** + * 운항주기. + */ + private String runTerm; + /** + * 운항주기 표현 문자열. + */ + private String runTermStr; + /** + * 운항횟수. + */ + private String runCnt; + /** + * 대표자. + */ + private String repreName; + /** + * 연락처. + */ + private String tel; + /** + * 선적. + */ + private String ferrySosok; + /** + * 항해거리. + */ + private String sailingDistance; + /** + * 취항일. + */ + private String sailingDate; + /** + * 합작국. + */ + private String cooperateNation; + /** + * 합작여부 표현 문자열. + */ + private String isCooperateStr = "-"; + /** + * 등록자. + */ + private String writer; + /** + * 생성일. + */ + private String creDate; + /** + * 수정일. + */ + private String logDate; + /** + * 첨부이미지. + */ + private String imgFile; + /** + * 첨부이미지 객체. + */ + private MultipartFile imgFileObj; + /** + * 비고. + */ + private String comments; + + /** + * @return the serNo + */ + public final int getSerNo() { + return serNo; + } + + /** + * @param serNo + * the serNo to set + */ + public final void setSerNo(final int serNo) { + this.serNo = serNo; + } + + /** + * @return the ferryOffice + */ + public final String getFerryOffice() { + return ferryOffice; + } + + /** + * @param ferryOffice + * the ferryOffice to set + */ + public final void setFerryOffice(final String ferryOffice) { + this.ferryOffice = ferryOffice; + } + + /** + * @return the ferryName + */ + public final String getFerryName() { + return ferryName; + } + + /** + * @param ferryName + * the ferryName to set + */ + public final void setFerryName(final String ferryName) { + this.ferryName = ferryName; + } + + /** + * @return the ferryTon + */ + public final String getFerryTon() { + return ferryTon; + } + + /** + * @param ferryTon + * the ferryTon to set + */ + public final void setFerryTon(final String ferryTon) { + this.ferryTon = ferryTon; + } + + /** + * @return the ferryRoute + */ + public final String getFerryRoute() { + return ferryRoute; + } + + /** + * @param ferryRoute + * the ferryRoute to set + */ + public final void setFerryRoute(final String ferryRoute) { + this.ferryRoute = ferryRoute; + + setFerryRouteStr(FerryRouteType.getValue(ferryRoute)); + } + + /** + * @return the ferryRouteStr + */ + public final String getFerryRouteStr() { + return ferryRouteStr; + } + + /** + * @param ferryRouteStr + * the ferryRouteStr to set + */ + public final void setFerryRouteStr(final String ferryRouteStr) { + this.ferryRouteStr = ferryRouteStr; + } + + /** + * @return the ferryTime + */ + public final String getFerryTime() { + return ferryTime; + } + + /** + * @param ferryTime + * the ferryTime to set + */ + public final void setFerryTime(final String ferryTime) { + this.ferryTime = ferryTime; + } + + /** + * @return the ferrySpeedMax + */ + public final String getFerrySpeedMax() { + return ferrySpeedMax; + } + + /** + * @param ferrySpeedMax + * the ferrySpeedMax to set + */ + public final void setFerrySpeedMax(final String ferrySpeedMax) { + this.ferrySpeedMax = ferrySpeedMax; + } + + /** + * @return the ferrySpeedNor + */ + public final String getFerrySpeedNor() { + return ferrySpeedNor; + } + + /** + * @param ferrySpeedNor + * the ferrySpeedNor to set + */ + public final void setFerrySpeedNor(final String ferrySpeedNor) { + this.ferrySpeedNor = ferrySpeedNor; + } + + /** + * @return the capacity + */ + public final int getCapacity() { + return getFerryGuestCnt() + getFerryClueCnt(); + } + + /** + * @return the ferryGuestCnt + */ + public final int getFerryGuestCnt() { + return ferryGuestCnt; + } + + /** + * @param ferryGuestCnt + * the ferryGuestCnt to set + */ + public final void setFerryGuestCnt(final int ferryGuestCnt) { + this.ferryGuestCnt = ferryGuestCnt; + } + + /** + * @return the ferryClueCnt + */ + public final int getFerryClueCnt() { + return ferryClueCnt; + } + + /** + * @param ferryClueCnt + * the ferryClueCnt to set + */ + public final void setFerryClueCnt(final int ferryClueCnt) { + this.ferryClueCnt = ferryClueCnt; + } + + /** + * @return the runTerm + */ + public final String getRunTerm() { + return runTerm; + } + + /** + * @param runTerm + * the runTerm to set + */ + public final void setRunTerm(final String runTerm) { + this.runTerm = runTerm; + + setRunTermStr(FerryRunTermType.getValue(runTerm)); + } + + /** + * @return the runTermStr + */ + public final String getRunTermStr() { + return runTermStr; + } + + /** + * @param runTermStr + * the runTermStr to set + */ + public final void setRunTermStr(final String runTermStr) { + this.runTermStr = runTermStr; + } + + /** + * @return the runCnt + */ + public final String getRunCnt() { + return runCnt; + } + + /** + * @param runCnt + * the runCnt to set + */ + public final void setRunCnt(final String runCnt) { + this.runCnt = runCnt; + } + + /** + * @return the runCntStr + */ + public final String getRunCntStr() { + String result = ""; + + if (StringUtils.isNotBlank(getRunCnt())) { + result = String.format("%s %s회", getRunTermStr(), getRunCnt()); + } + + return result; + } + + /** + * @return the repreName + */ + public final String getRepreName() { + return repreName; + } + + /** + * @param repreName + * the repreName to set + */ + public final void setRepreName(final String repreName) { + this.repreName = repreName; + } + + /** + * @return the tel + */ + public final String getTel() { + return tel; + } + + /** + * @param tel + * the tel to set + */ + public final void setTel(final String tel) { + this.tel = tel; + } + + /** + * @return the ferrySosok + */ + public final String getFerrySosok() { + return ferrySosok; + } + + /** + * @param ferrySosok + * the ferrySosok to set + */ + public final void setFerrySosok(final String ferrySosok) { + this.ferrySosok = ferrySosok; + } + + /** + * @return the sailingDistance + */ + public final String getSailingDistance() { + return sailingDistance; + } + + /** + * @param sailingDistance + * the sailingDistance to set + */ + public final void setSailingDistance(final String sailingDistance) { + this.sailingDistance = sailingDistance; + } + + /** + * @return the sailingDate + */ + public final String getSailingDate() { + return sailingDate; + } + + /** + * @param sailingDate + * the sailingDate to set + */ + public final void setSailingDate(final String sailingDate) { + this.sailingDate = sailingDate; + } + + /** + * @return the cooperateNation + */ + public final String getCooperateNation() { + return cooperateNation; + } + + /** + * @param cooperateNation + * the cooperateNation to set + */ + public final void setCooperateNation(final String cooperateNation) { + this.cooperateNation = cooperateNation; + + if (StringUtils.isNotBlank(cooperateNation)) { + setIsCooperateStr("합작"); + } else { + setIsCooperateStr("-"); + } + } + + /** + * @return the isCooperateStr + */ + public final String getIsCooperateStr() { + return isCooperateStr; + } + + /** + * @param isCooperateStr + * the isCooperateStr to set + */ + public final void setIsCooperateStr(final String isCooperateStr) { + this.isCooperateStr = isCooperateStr; + } + + /** + * @return the writer + */ + public final String getWriter() { + return writer; + } + + /** + * @param writer + * the writer to set + */ + public final void setWriter(final String writer) { + this.writer = writer; + } + + /** + * @return the creDate + */ + public final String getCreDate() { + return creDate; + } + + /** + * @param creDate + * the creDate to set + */ + public final void setCreDate(final String creDate) { + this.creDate = creDate; + } + + /** + * @return the logDate + */ + public final String getLogDate() { + return logDate; + } + + /** + * @param logDate + * the logDate to set + */ + public final void setLogDate(final String logDate) { + this.logDate = logDate; + } + + /** + * @return the imgFile + */ + public final String getImgFile() { + return imgFile; + } + + /** + * @param imgFile + * the imgFile to set + */ + public final void setImgFile(final String imgFile) { + this.imgFile = imgFile; + } + + /** + * @return the imgFileObj + */ + public final MultipartFile getImgFileObj() { + return imgFileObj; + } + + /** + * @param imgFileObj + * the imgFileObj to set + */ + public final void setImgFileObj(final MultipartFile imgFileObj) { + this.imgFileObj = imgFileObj; + } + + /** + * @return the comments + */ + public final String getComments() { + return comments; + } + + /** + * @param comments + * the comments to set + */ + public final void setComments(final String comments) { + this.comments = comments; + } +} diff --git a/src/main/java/kcg/faics/tg/vo/WeakPlaceSearchVO.java b/src/main/java/kcg/faics/tg/vo/WeakPlaceSearchVO.java new file mode 100644 index 0000000..4c517b4 --- /dev/null +++ b/src/main/java/kcg/faics/tg/vo/WeakPlaceSearchVO.java @@ -0,0 +1,35 @@ +package kcg.faics.target.vo; + +import kcg.faics.cmmn.bbs.BaseSearchVO; + +/** + * 외사취약지 검색 관련 Value Object. + * + * @author kimnomin + * + */ +public class WeakPlaceSearchVO extends BaseSearchVO { + /** + * 소속. + */ + private String place1; + + /** + * 소속을 반환한다. + * + * @return 소속 + */ + public final String getPlace1() { + return place1; + } + + /** + * 소속을 설정한다. + * + * @param place1 소속 + */ + public final void setPlace1(final String place1) { + this.place1 = place1; + } + +} diff --git a/src/main/java/kcg/faics/tg/vo/WeakPlaceVO.java b/src/main/java/kcg/faics/tg/vo/WeakPlaceVO.java new file mode 100644 index 0000000..5c47f20 --- /dev/null +++ b/src/main/java/kcg/faics/tg/vo/WeakPlaceVO.java @@ -0,0 +1,314 @@ +package kcg.faics.target.vo; + +import org.springframework.web.multipart.MultipartFile; + +/** + * 외사취약지 Value Object. + * + * @author kimnomin + * + */ +public class WeakPlaceVO { + /** + * 소속 코드. + */ + private String place1; + /** + * 소속명. + */ + private String place1str; + /** + * 일련번호. + */ + private int wpNo; + /** + * 취약지명. + */ + private String name; + /** + * 소재지. + */ + private String location; + /** + * 선정사유. + */ + private String comments; + /** + * 요도 첨부파일 객체. + */ + private MultipartFile file1; + /** + * 요도 첨부파일. + */ + private String filename1 = ""; + /** + * 화면에 출력할 요도 첨부파일 여부 텍스트. + * O : 있다, - : 없다. + */ + private String filename1viewStr = "-"; + /** + * 첨부파일 객체. + */ + private MultipartFile file2; + /** + * 첨부파일. + */ + private String filename2 = ""; + /** + * 등록자. + */ + private String writer; + /** + * 등록일. + */ + private String credate; + /** + * 수정일. + */ + private String logdate; + + + /** + * 소속 코드을 반환한다. + * + * @return 소속 코드 + */ + public final String getPlace1() { + return place1; + } + /** + * 소속 코드을 설정한다. + * + * @param place1 소속 코드 + */ + public final void setPlace1(final String place1) { + this.place1 = place1; + } + /** + * 소속명을 반환한다. + * + * @return 소속명 + */ + public final String getPlace1str() { + return place1str; + } + /** + * 소속명을 설정한다. + * + * @param place1str 소속명 + */ + public final void setPlace1str(final String place1str) { + this.place1str = place1str; + } + /** + * 일련번호를 반환한다. + * + * @return 일련번호 + */ + public final int getWpNo() { + return wpNo; + } + /** + * 일련번호를 설정한다. + * + * @param wpNo 일련번호 + */ + public final void setWpNo(final int wpNo) { + this.wpNo = wpNo; + } + /** + * 관리번호를 반환한다. + * + * @return 관리번호 + */ + public final String getWpNoStr() { + return String.format("%s - %s", this.place1str, this.wpNo); + } + /** + * 취약지명을 반환한다. + * + * @return 취약지명 + */ + public final String getName() { + return name; + } + /** + * 취약지명을 설정한다. + * + * @param name 취약지명 + */ + public final void setName(final String name) { + this.name = name; + } + /** + * 소재지를 반환한다. + * + * @return 소재지 + */ + public final String getLocation() { + return location; + } + /** + * 소재지를 설정한다. + * + * @param location 소재지 + */ + public final void setLocation(final String location) { + this.location = location; + } + /** + * 선정사유를 반환한다. + * + * @return 선정사유 + */ + public final String getComments() { + return comments; + } + /** + * 선정사유를 설정한다. + * + * @param comments 선정사유 + */ + public final void setComments(final String comments) { + this.comments = comments; + } + /** + * 요도 첨부파일 객체를 반환한다. + * + * @return 요도 첨부파일 객체 + */ + public final MultipartFile getFile1() { + return file1; + } + /** + * 요도 첨부파일 객체를 설정한다. + * + * @param file1 요도 첨부파일 객체 + */ + public final void setFile1(final MultipartFile file1) { + this.file1 = file1; + if (this.file1 != null) { + setFilename1(this.file1.getOriginalFilename()); + } + } + /** + * 요도 첨부파일을 반환한다. + * + * @return 요도 첨부파일 + */ + public final String getFilename1() { + return filename1; + } + /** + * 요도 첨부파일을 설정한다. + * + * @param filename1 요도 첨부파일 + */ + public final void setFilename1(final String filename1) { + this.filename1 = filename1; + if (this.filename1 != null && this.filename1.trim().length() > 0) { + setFilename1viewStr("O"); + } else { + setFilename1viewStr("-"); + } + } + /** + * 화면에 출력할 요도 첨부파일 여부 텍스트를 반환한다. + * + * @return 화면에 출력할 요도 첨부파일 여부 텍스트 + */ + public final String getFilename1viewStr() { + return filename1viewStr; + } + /** + * 화면에 출력할 요도 첨부파일 여부 텍스트를 설정한다. + * + * @param filename1viewStr 화면에 출력할 요도 첨부파일 여부 텍스트 + */ + public final void setFilename1viewStr(final String filename1viewStr) { + this.filename1viewStr = filename1viewStr; + } + /** + * 첨부파일 객체를 반환한다. + * + * @return 첨부파일 + */ + public final MultipartFile getFile2() { + return file2; + } + /** + * 첨부파일 객체를 설정한다. + * + * @param file2 첨부파일 + */ + public final void setFile2(final MultipartFile file2) { + this.file2 = file2; + if (this.file2 != null) { + setFilename2(this.file2.getOriginalFilename()); + } + } + /** + * 첨부파일를 반환한다. + * + * @return 첨부파일 + */ + public final String getFilename2() { + return filename2; + } + /** + * 첨부파일를 설정한다. + * + * @param filename2 첨부파일 + */ + public final void setFilename2(final String filename2) { + this.filename2 = filename2; + } + /** + * 등록자를 반환한다. + * + * @return 등록자 + */ + public final String getWriter() { + return writer; + } + /** + * 등록자를 설정한다. + * + * @param writer 등록자 + */ + public final void setWriter(final String writer) { + this.writer = writer; + } + /** + * 등록일을 반환한다. + * + * @return 등록일 + */ + public final String getCredate() { + return credate; + } + /** + * 등록일을 설정한다. + * + * @param credate 등록일 + */ + public final void setCredate(final String credate) { + this.credate = credate; + } + /** + * 수정일을 반환한다. + * + * @return 수정일 + */ + public final String getLogdate() { + return logdate; + } + /** + * 수정일을 설정한다. + * + * @param logdate 수정일 + */ + public final void setLogdate(final String logdate) { + this.logdate = logdate; + } +} diff --git a/src/main/java/kcg/faics/tg/vo/package-info.java b/src/main/java/kcg/faics/tg/vo/package-info.java new file mode 100644 index 0000000..ef024ac --- /dev/null +++ b/src/main/java/kcg/faics/tg/vo/package-info.java @@ -0,0 +1,8 @@ +/** + * 외사대상목표 관련 Value Object 패키지. + */ +/** + * @author kimnomin + * + */ +package kcg.faics.target.vo; \ No newline at end of file diff --git a/src/main/java/kcg/faics/tg/web/CorpController.java b/src/main/java/kcg/faics/tg/web/CorpController.java new file mode 100644 index 0000000..c871bde --- /dev/null +++ b/src/main/java/kcg/faics/tg/web/CorpController.java @@ -0,0 +1,532 @@ +package kcg.faics.target.web; + +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Locale; + +import javax.annotation.Resource; +import javax.validation.Valid; + +import kcg.faics.cmmn.bbs.PageType; +import kcg.faics.cmmn.excel.ExcelExporter; +import kcg.faics.cmmn.service.CodeService; +import kcg.faics.cmmn.vo.CodeVO; +import kcg.faics.sec.LoginUserVO; +import kcg.faics.sec.UserUtil; +import kcg.faics.target.service.CorpService; +import kcg.faics.target.vo.CorpSearchVO; +import kcg.faics.target.vo.CorpVO; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.MessageSource; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.support.SessionStatus; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.rte.fdl.property.EgovPropertyService; +import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper; + +/** + * 치안대상 컨트롤러. + * + * @author kimnomin + * + */ +@Controller +@RequestMapping("/target/corp") +public class CorpController { + /** + * properties값을 가져오는 인터페이스. + **/ + @Resource(name = "propertiesService") + private EgovPropertyService propertiesService; + + /** + * message.properties의 값을 가져오는 인터페이스. + */ + @Autowired + private MessageSource messageSource; + + /** + * Validator - 유효성 검사. + **/ + @Resource(name = "beanValidator") + private DefaultBeanValidator beanValidator; + + /** + * 코드관련 정보 인터페이스. + */ + @Resource(name = "codeService") + private CodeService codeService; + + /** + * 치안대상 비지니스 로직 클래스. + */ + @Resource(name = "corpService") + private CorpService corpService; + + /** + * grpNo에 따른 항목명을 반환한다. + * + * @param grpNo + * 화면구분 + * @param locale + * Locale 객체 + * @return 항목명 + */ + private LinkedHashMap getFieldName(final String grpNo, final Locale locale) { + LinkedHashMap map = new LinkedHashMap(); + map.put("place1str", messageSource.getMessage("target.corp.place1", null, locale)); + if ("01".equalsIgnoreCase(grpNo)) { + map.put("name", messageSource.getMessage("target.corp.name01", null, locale)); + map.put("location", messageSource.getMessage("target.corp.location", null, locale)); + } else if ("02".equalsIgnoreCase(grpNo)) { + map.put("name", messageSource.getMessage("target.corp.name02", null, locale)); + map.put("location", messageSource.getMessage("target.corp.location", null, locale)); + map.put("ceo", messageSource.getMessage("target.corp.ceo", null, locale)); + } else if ("03".equalsIgnoreCase(grpNo)) { + map.put("name", messageSource.getMessage("target.corp.name", null, locale)); + map.put("location", messageSource.getMessage("target.corp.location", null, locale)); + map.put("shipCnt", messageSource.getMessage("target.corp.shipcnt", null, locale)); + map.put("ceo", messageSource.getMessage("target.corp.ceo", null, locale)); + map.put("memberCnt", messageSource.getMessage("target.corp.membercnt", null, locale)); + map.put("basicYear", messageSource.getMessage("target.corp.basicyear", null, locale)); + map.put("fund", messageSource.getMessage("target.corp.fund", null, locale)); + } else if ("04".equalsIgnoreCase(grpNo)) { + map.put("name", messageSource.getMessage("target.corp.name", null, locale)); + map.put("location", messageSource.getMessage("target.corp.location", null, locale)); + map.put("ceo", messageSource.getMessage("target.corp.ceo", null, locale)); + map.put("jobType", messageSource.getMessage("target.corp.jobtype", null, locale)); + } else if ("05".equalsIgnoreCase(grpNo)) { + map.put("name", messageSource.getMessage("target.corp.name", null, locale)); + map.put("location", messageSource.getMessage("target.corp.location", null, locale)); + map.put("ceo", messageSource.getMessage("target.corp.ceo", null, locale)); + map.put("jobType", messageSource.getMessage("target.corp.jobtype", null, locale)); + map.put("partner", messageSource.getMessage("target.corp.partner", null, locale)); + } + map.put("tel", messageSource.getMessage("target.corp.tel", null, locale)); + map.put("fax", messageSource.getMessage("target.corp.fax", null, locale)); + map.put("comments", messageSource.getMessage("target.corp.comments", null, locale)); + + return map; + } + + /** + * Redirect URI를 조합하여 반환한다. + * + * @param pageType + * 화면구분 + * @param vo + * 치안대상 VO + * @return Redirect URI + */ + private String makeRedirectUri(final PageType pageType, final CorpVO vo) { + String uri = "redirect:/target/corp"; + + switch (pageType) { + case View: + uri = String.format("%s/view.do?place1=%s&orgId=%s&orgNo=%s", uri, + vo.getPlace1(), vo.getOrgId(), vo.getOrgNo()); + break; + case List: + uri = String.format("%s/list.do?place1=%s&orgId=%s&grpNo=%s", uri, + vo.getPlace1(), vo.getOrgId(), vo.getGrpNo()); + break; + case Stats: + default: + uri += "stats.do"; + break; + } + + return uri; + } + + /** + * 치안대상 통계화면을 반환한다. + * + * @param model + * Model 객체 + * @return 치안대상 통계화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/stats.do") + public String stats(final Model model) throws Exception { + List> stats = corpService.selectStats(); + model.addAttribute("stats", stats); + + return "/target/corpStats.tiles"; + } + + /** + * 치안대상 통계현황을 엑셀로 반환한다. + * + * @param model + * Model 객체 + * @return 치안대상 통계현황 엑셀 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/statstoexcel.do") + public String statsToExcel(final Model model) throws Exception { + String title = "치안대상"; + + // 엑셀 헤더 생성 + LinkedHashMap header = new LinkedHashMap(); + header.put("ORG_NM", "구분"); + header.put("TOT_CNT", "계"); + List policeStations = codeService.getPlace1List(CodeService.POLICE_STATION_LIST); + for (CodeVO placeCode : policeStations) { + header.put(placeCode.getCode2() + "_CNT", placeCode.getCodenmYak()); + } + + // 데이터 생성 + List> stats = corpService.selectStats(); + + // Export + model.addAttribute("excel", new ExcelExporter>(header, stats, title)); + model.addAttribute("filename", title); + + return "excelView"; + } + + /** + * 치안대상 목록화면을 반환한다. + * + * @param model + * Model 객체 + * @param searchVO + * 검색조건 VO + * @param locale + * Locale 객체 + * @return 치안대상 목록화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/list.do") + public String list(final Model model, + @ModelAttribute("searchVO") final CorpSearchVO searchVO, + final Locale locale) throws Exception { + LoginUserVO loginUserVO = UserUtil.getMemberInfo(); + model.addAttribute("loginUserVO", loginUserVO); + + List placeList = codeService.getPlace1List(CodeService.POLICE_STATION_LIST, true); + model.addAttribute("placeList", placeList); + + // place1 조건이 할당되지 않은 상태이고 로그인한 사용자의 소속이 검색조건에 적합하면 소속코드 할당 + if (StringUtils.isEmpty(searchVO.getPlace1())) { + for (CodeVO place: placeList) { + if (loginUserVO.getPlace1().equalsIgnoreCase(place.getCode2())) { + searchVO.setPlace1(loginUserVO.getPlace1()); + break; + } + } + } + + if ("03".equalsIgnoreCase(searchVO.getGrpNo())) { + List corpOrgList = codeService.getCorpOrgList(); + LinkedHashMap corpOrgMap = new LinkedHashMap(); + for (CodeVO vo : corpOrgList) { + String code2 = vo.getCode2(); + String stChar2 = code2.substring(0, 2); + String edChar2 = code2.substring(code2.length() - 2); + if ("03".equalsIgnoreCase(edChar2)) { + corpOrgMap.put(stChar2, vo.getCodenm()); + } + } + model.addAttribute("corpOrgList", corpOrgMap); + } + + List corpList = corpService.selectList(searchVO); + model.addAttribute("corpList", corpList); + + LinkedHashMap fieldNameMap = getFieldName(searchVO.getGrpNo(), locale); + model.addAttribute("fieldNameMap", fieldNameMap); + + return "/target/corpList.tiles"; + } + + /** + * 치안대상 목록을 엑셀로 반환한다. + * + * @param model + * Model 객체 + * @param searchVO + * 검색조건 VO + * @param locale + * Locale 객체 + * @return 치안대상 목록 엑셀 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/listtoexcel.do") + public String listToExcel(final Model model, + @ModelAttribute("searchVO") final CorpSearchVO searchVO, + final Locale locale) throws Exception { + String grpNo = searchVO.getGrpNo(); + String title = "치안대상"; + + // 엑셀 헤더 생성 + LinkedHashMap header = getFieldName(grpNo, locale); + + // 데이터 생성 + List corpList = corpService.selectList(searchVO); + + // Export + model.addAttribute("excel", new ExcelExporter(header, corpList, title)); + model.addAttribute("filename", title); + + return "excelView"; + } + + /** + * 치안대상 정보 조회화면을 반환한다. + * + * @param model + * Model 객체 + * @param locale + * Locale 객체 + * @param corpVO + * 치안대상 VO + * @return 치안대상 정보 조회화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/view.do") + public String view(final Model model, final Locale locale, + final CorpVO corpVO) throws Exception { + LoginUserVO loginUserVO = UserUtil.getMemberInfo(); + model.addAttribute("loginUserVO", loginUserVO); + + CorpVO vo = corpService.select(corpVO); + model.addAttribute("corpVO", vo); + + LinkedHashMap fieldNameMap = getFieldName(vo.getGrpNo(), locale); + model.addAttribute("fieldNameMap", fieldNameMap); + + return "/target/corpView.tiles"; + } + + /** + * 치안대상 입력화면을 반환한다. + * + * @param model + * Model 객체 + * @param corpVO + * 치안대상 VO + * @param locale + * Locale 객체 + * @return 치안대상 입력화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/add.do") + public String add(final Model model, + @ModelAttribute("corpVO") final CorpVO corpVO, final Locale locale) throws Exception { + // 사용자 인증 검사 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + // 등록은 isAdmin이 true인 사용자만 가능하다. + if (isAuthenticated && UserUtil.isAdmin()) { + List placeList = codeService.getPlace1List(CodeService.POLICE_STATION_LIST); + model.addAttribute("placeList", placeList); + + LoginUserVO loginUserVO = UserUtil.getMemberInfo(); + model.addAttribute("loginUserVO", loginUserVO); + + // 로그인한 사용자가 입력가능한 소속이면 해당 소속으로 할당하고, + // 그렇지 않으면 기본값인 파라미터의 소속코드를 사용한다. + for (CodeVO tempVO : placeList) { + if (tempVO.getCode2().equalsIgnoreCase(loginUserVO.getPlace1())) { + corpVO.setPlace1(loginUserVO.getPlace1()); + corpVO.setPlace1str(loginUserVO.getPlace1Str()); + break; + } + } + corpVO.setWriter(loginUserVO.getUserid()); + corpVO.setWriterPlace1(loginUserVO.getPlace1()); + + LinkedHashMap fieldNameMap = getFieldName(corpVO.getGrpNo(), locale); + model.addAttribute("fieldNameMap", fieldNameMap); + model.addAttribute("registerFlag", "create"); + } + return "/target/corpAdd.tiles"; + } + + /** + * 치안대상 정보를 입력한다. + * + *
+	 * php소스에는 파일 업로드 기능이 있으나, 
+	 * 파일 관련 필드가 DB에도 없고 표현기능도 없어서 제외함.
+	 * 
+ * + * @param corpVO + * 치안대상 VO + * @param bindingResult + * 유효성 검사결과 객체 + * @param model + * 모델 객체 + * @param status + * SessionStatus 객체 + * @param locale + * Locale 객체 + * @return 치안대상 목록화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/add.do", method = RequestMethod.POST) + public String add(@ModelAttribute("corpVO") final CorpVO corpVO, + final BindingResult bindingResult, final Model model, + final SessionStatus status, final Locale locale) throws Exception { + // 사용자 인증 검사 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + // 등록은 isAdmin이 true인 사용자만 가능하다. + if (isAuthenticated && UserUtil.isAdmin()) { + // 유효성 검사 + beanValidator.validate(corpVO, bindingResult); + if (bindingResult.hasErrors()) { + return add(model, corpVO, locale); + } + + HashMap map = corpService.insert(corpVO, null); + + status.setComplete(); + + if ((Integer) map.get("result") == 1) { + return makeRedirectUri(PageType.List, corpVO); + } + } + + return "error/bizError"; + } + + /** + * 치안대상 수정화면을 반환한다. + * + * @param model + * Model 객체 + * @param locale + * Locale 객체 + * @param corpVO + * 치안대상 VO + * @return 치안대상 수정화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/update.do") + public String update(final Model model, final Locale locale, final CorpVO corpVO) throws Exception { + LoginUserVO loginUserVO = UserUtil.getMemberInfo(); + model.addAttribute("loginUserVO", loginUserVO); + + // 등록은 관리자만 가능하지만, 수정/삭제는 관리자 + 해당 기관도 가능하다. + if (loginUserVO.getIsAdmin() + || loginUserVO.getPlace1().equalsIgnoreCase(corpVO.getPlace1())) { + CorpVO vo = corpService.select(corpVO); + model.addAttribute("corpVO", vo); + + LinkedHashMap fieldNameMap = getFieldName(vo.getGrpNo(), locale); + model.addAttribute("fieldNameMap", fieldNameMap); + model.addAttribute("registerFlag", "modify"); + + return "/target/corpAdd.tiles"; + } + + return makeRedirectUri(PageType.View, corpVO); + } + + /** + * 치안대상 정보를 수정한다. + * + *
+	 * php소스에는 파일 업로드 기능이 있으나, 
+	 * 파일 관련 필드가 DB에도 없고 표현기능도 없어서 제외함.
+	 * 
+ * + * @param corpVO + * 치안대상 VO + * @param bindingResult + * 유효성 검사결과 객체 + * @param model + * 모델 객체 + * @param status + * SessionStatus 객체 + * @param locale + * Locale 객체 + * @return 치안대상 목록화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/update.do", method = RequestMethod.POST) + public String update(@Valid @ModelAttribute("corpVO") final CorpVO corpVO, + final BindingResult bindingResult, final Model model, + final SessionStatus status, final Locale locale) throws Exception { + // 사용자 인증 검사 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (isAuthenticated) { + LoginUserVO loginUserVO = UserUtil.getMemberInfo(); + + // 등록은 관리자만 가능하지만, 수정/삭제는 관리자 + 해당 기관도 가능하다. + if (loginUserVO.getIsAdmin() + || loginUserVO.getPlace1().equalsIgnoreCase(corpVO.getPlace1())) { + // 유효성 검사 + beanValidator.validate(corpVO, bindingResult); + if (bindingResult.hasErrors()) { + return update(model, locale, corpVO); + } + + corpVO.setWriter(loginUserVO.getUserid()); + corpVO.setWriterPlace1(loginUserVO.getPlace1()); + + HashMap map = corpService.update(corpVO, null, + null); + + status.setComplete(); + + if ((Integer) map.get("result") == 1) { + return makeRedirectUri(PageType.View, corpVO); + } + } + } + + return "error/bizError"; + } + + /** + * 치안대상 정보를 삭제하고 목록화면을 반환한다. + * + * @param model + * Model 객체 + * @param locale + * Locale 객체 + * @param corpVO + * 치안대상 VO + * @return 치안대상 목록화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/delete.do", method = RequestMethod.POST) + public String delete(final Model model, final Locale locale, final CorpVO corpVO) throws Exception { + LoginUserVO loginUserVO = UserUtil.getMemberInfo(); + + // 등록은 관리자만 가능하지만, 수정/삭제는 관리자 + 해당 기관도 가능하다. + if (loginUserVO.getIsAdmin() + || loginUserVO.getPlace1().equalsIgnoreCase(corpVO.getPlace1())) { + CorpVO vo = corpService.select(corpVO); + + HashMap result = corpService.delete(corpVO); + if ((Integer) result.get("result") == 1) { + return makeRedirectUri(PageType.List, vo); + } + } + return makeRedirectUri(PageType.View, corpVO); + } +} diff --git a/src/main/java/kcg/faics/tg/web/DivMngController.java b/src/main/java/kcg/faics/tg/web/DivMngController.java new file mode 100644 index 0000000..cb798c8 --- /dev/null +++ b/src/main/java/kcg/faics/tg/web/DivMngController.java @@ -0,0 +1,435 @@ +package kcg.faics.target.web; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import kcg.faics.cmmn.bbs.BaseBbsService; +import kcg.faics.cmmn.bbs.PageType; +import kcg.faics.cmmn.excel.ExcelExporter; +import kcg.faics.cmmn.file.FileResponser; +import kcg.faics.cmmn.service.CodeService; +import kcg.faics.cmmn.vo.CodeVO; +import kcg.faics.sec.LoginUserVO; +import kcg.faics.sec.UserUtil; +import kcg.faics.target.service.impl.DivMngServiceImpl; +import kcg.faics.target.vo.DivMngSearchVO; +import kcg.faics.target.vo.DivMngVO; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.MessageSource; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.util.FileCopyUtils; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.support.SessionStatus; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.rte.fdl.property.EgovPropertyService; +import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper; + +/** + * 외사분실운영현황 컨트롤러. + * + * @author kimnomin + * + */ +@Controller +@RequestMapping("/target/divmng") +public class DivMngController { + /** + * properties값을 가져오는 인터페이스. + **/ + @Resource(name = "propertiesService") + private EgovPropertyService propertiesService; + + /** + * message.properties의 값을 가져오는 인터페이스. + */ + @Autowired + private MessageSource messageSource; + + /** + * Validator - 유효성 검사. + **/ + @Resource(name = "beanValidator") + private DefaultBeanValidator beanValidator; + + /** + * 코드관련 정보 인터페이스. + */ + @Resource(name = "codeService") + private CodeService codeService; + + /** + * 외사분실운영현황 비지니스 로직 클래스. + */ + @Resource(name = "divMngService") + private BaseBbsService divMngService; + + /** + * Redirect URI를 조합하여 반환한다. + * + * @param pageType + * 화면구분 + * @param vo + * 외사분실운영현황 VO + * @return Redirect URI + */ + private String makeRedirectUri(final PageType pageType, final DivMngVO vo) { + String uri = "redirect:/target/divmng"; + + switch (pageType) { + case View: + uri = String.format("%s/view.do?place=%s&no=%s", uri, vo.getPlace(), vo.getNo()); + break; + case List: + uri = String.format("%s/list.do?place=%s", uri, vo.getPlace()); + break; + default: + break; + } + + return uri; + } + + /** + * 외사분실운영현황 정보 조회화면을 반환한다. + * + * @param model + * Model 객체 + * @param divMngVO + * 외사분실운영현황 VO + * @return 외사분실운영현황 정보 조회화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/view.do") + public String view(final Model model, final DivMngVO divMngVO) throws Exception { + LoginUserVO loginUserVO = UserUtil.getMemberInfo(); + model.addAttribute("loginUserVO", loginUserVO); + + DivMngVO vo = divMngService.select(divMngVO); + model.addAttribute("divMngVO", vo); + + return "/target/divMngView.tiles"; + } + + /** + * 외사분실운영현황 목록화면을 반환한다. + * + * @param model + * Model 객체 + * @param locale + * Locale 객체 + * @param searchVO + * 검색조건 VO + * @return 외사분실운영현황 목록화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/list.do") + public String list(final Model model, final Locale locale, + @ModelAttribute("searchVO") final DivMngSearchVO searchVO) + throws Exception { + LoginUserVO loginUserVO = UserUtil.getMemberInfo(); + model.addAttribute("loginUserVO", loginUserVO); + + List placeList = codeService.getPlace1List(false, true); + model.addAttribute("placeList", placeList); + + List divMngList = divMngService.selectList(searchVO); + model.addAttribute("divMngList", divMngList); + + return "/target/divMngList.tiles"; + } + + /** + * 외사분실운영현황 목록을 엑셀로 반환한다. + * + * @param model + * Model 객체 + * @param locale + * Locale 객체 + * @param searchVO + * 검색조건 VO + * @return 외사분실운영현황 목록 엑셀 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/listtoexcel.do") + public String listToExcel(final Model model, final Locale locale, + @ModelAttribute("searchVO") final DivMngSearchVO searchVO) + throws Exception { + String title = messageSource.getMessage("target.divmng", null, locale); + + // 엑셀 헤더 생성 + LinkedHashMap header = new LinkedHashMap(); + header.put("placeStr", messageSource.getMessage("target.divmng.place", null, locale)); + header.put("local", messageSource.getMessage("target.divmng.local", null, locale)); + header.put("gubunStr", messageSource.getMessage("target.divmng.gubun", null, locale)); + header.put("staffNum", messageSource.getMessage("target.divmng.staffNum", null, locale)); + header.put("tel", messageSource.getMessage("target.divmng.tel", null, locale)); + + // 데이터 생성 + List divMngList = divMngService.selectList(searchVO); + + // Export + model.addAttribute("excel", new ExcelExporter(header, divMngList, title)); + model.addAttribute("filename", title); + + return "excelView"; + } + + /** + * 외사분실운영현황 입력화면을 반환한다. + * + * @param model + * Model 객체 + * @param divMngVO + * 외사분실운영현황 VO + * @return 외사분실운영현황 입력화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/add.do") + public String add(final Model model, final DivMngVO divMngVO) + throws Exception { + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if (isAuthenticated && UserUtil.isAdmin()) { + LoginUserVO loginUserVO = UserUtil.getMemberInfo(); + model.addAttribute("loginUserVO", loginUserVO); + model.addAttribute("registerFlag", "create"); + + List placeList = codeService.getPlace1List(false, false); + model.addAttribute("placeList", placeList); + + divMngVO.setWriter(loginUserVO.getUserid()); + divMngVO.setPlace(loginUserVO.getPlace1()); + divMngVO.setPlaceStr(loginUserVO.getPlace1Str()); + + return "/target/divMngAdd.tiles"; + } else { + return makeRedirectUri(PageType.List, divMngVO); + } + } + + /** + * 외사분실운영현황 정보를 입력한다. + * + * @param divMngVO + * 외사분실운영현황 VO + * @param bindingResult + * BindingResult 객체 + * @param model + * Model 객체 + * @param status + * SessionStatus 객체 + * @param multiRequest + * MultipartHttpServletRequest 객체 + * @return 외사분실운영현황 정보 조회화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/add.do", method = RequestMethod.POST) + public String add(@ModelAttribute("divMngVO") final DivMngVO divMngVO, + final BindingResult bindingResult, final Model model, + final SessionStatus status, + final MultipartHttpServletRequest multiRequest) throws Exception { + // 사용자 인증 검사 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (isAuthenticated && UserUtil.isAdmin()) { + // 유효성 검사 + beanValidator.validate(divMngVO, bindingResult); + if (bindingResult.hasErrors()) { + return add(model, divMngVO); + } + + final Map fileMap = multiRequest.getFileMap(); + HashMap resultMap = divMngService.insert(divMngVO, fileMap); + + if ((Integer) resultMap.get("result") == 1) { + status.setComplete(); + return makeRedirectUri(PageType.View, divMngVO); + } + } + return "error/bizError"; + } + + /** + * 외사분실운영현황 수정화면을 반환한다. + * + * @param divMngVO + * 외사분실운영현황 VO + * @param model + * Model 객체 + * @return 외사분실운영현황 수정화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/update.do") + public String update(final DivMngVO divMngVO, final Model model) throws Exception { + if (UserUtil.isAdmin()) { + model.addAttribute("registerFlag", "modify"); + + DivMngVO vo = divMngService.select(divMngVO); + model.addAttribute("divMngVO", vo); + + LoginUserVO loginUserVO = UserUtil.getMemberInfo(); + model.addAttribute("loginUserVO", loginUserVO); + + return "/target/divMngAdd.tiles"; + } + + return makeRedirectUri(PageType.View, divMngVO); + } + + /** + * 외사분실운영현황 정보를 수정한다. + * + * @param divMngVO + * 외사분실운영현황 VO + * @param bindingResult + * BindingResult 객체 + * @param model + * Model 객체 + * @param status + * SessionStatus 객체 + * @param multiRequest + * MultipartHttpServletRequest 객체 + * @return 외사분실운영현황 조회화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/update.do", method = RequestMethod.POST) + public String update(@ModelAttribute("divMngVO") final DivMngVO divMngVO, + final BindingResult bindingResult, final Model model, + final SessionStatus status, + final MultipartHttpServletRequest multiRequest) throws Exception { + // 사용자 인증 검사 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (isAuthenticated && UserUtil.isAdmin()) { + // 유효성 검사 + beanValidator.validate(divMngVO, bindingResult); + if (bindingResult.hasErrors()) { + return update(divMngVO, model); + } + + String[] deleteFiles = multiRequest.getParameterValues("deleteFile"); + final Map fileMap = multiRequest.getFileMap(); + HashMap resultMap = divMngService.update(divMngVO, fileMap, deleteFiles); + + if ((Integer) resultMap.get("result") > 0) { + status.setComplete(); + return makeRedirectUri(PageType.View, divMngVO); + } + } + + return update(divMngVO, model); + } + + /** + * 외사분실운영현황 정보를 삭제한다. + * + * @param divMngVO + * 외사분실운영현황 VO + * @param model + * Model 객체 + * @param status + * SessionStatus 객체 + * @return 외사분실운영현황 목록화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/delete.do", method = RequestMethod.POST) + public String delete(final DivMngVO divMngVO, final Model model, + final SessionStatus status) throws Exception { + + if (UserUtil.isAdmin()) { + DivMngVO vo = divMngService.select(divMngVO); + if (vo != null) { + HashMap map = divMngService.delete(vo); + if ((Integer) map.get("result") > 0) { + return makeRedirectUri(PageType.List, vo); + } + } + } + + return makeRedirectUri(PageType.View, divMngVO); + } + + /** + * 파일을 반환한다. + * + * @param divMngVO + * 외사분실운영현황 VO + * @param fileId + * 파일ID + * @param request + * HttpServletRequest 객체 + * @param response + * HttpServletResponse 객체 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/download.do") + public void fileResponse(final DivMngVO divMngVO, final String fileId, + final HttpServletRequest request, final HttpServletResponse response) + throws Exception { + DivMngVO vo = divMngService.select(divMngVO); + String filename = ""; + if ("fileImg".equals(fileId)) { + filename = vo.getFileImg(); + } else if ("file1".equals(fileId)) { + filename = vo.getFile1(); + } else if ("file2".equals(fileId)) { + filename = vo.getFile2(); + } else if ("file3".equals(fileId)) { + filename = vo.getFile3(); + } + + if (StringUtils.isNotBlank(filename)) { + String fileFullPath = propertiesService + .getString(DivMngServiceImpl.FILE_PATH_KEYWORD) + filename; + File file = new File(fileFullPath); + if (file.exists()) { + FileResponser.setResponse(file, filename, request, response); + BufferedInputStream in = null; + try { + in = new BufferedInputStream(new FileInputStream(file)); + FileCopyUtils.copy(in, response.getOutputStream()); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (in != null) { + try { + in.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + } else { + response.setStatus(HttpStatus.NOT_FOUND.value()); + throw new Exception(); + } + } + } +} diff --git a/src/main/java/kcg/faics/tg/web/FerryController.java b/src/main/java/kcg/faics/tg/web/FerryController.java new file mode 100644 index 0000000..1446993 --- /dev/null +++ b/src/main/java/kcg/faics/tg/web/FerryController.java @@ -0,0 +1,398 @@ +package kcg.faics.target.web; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.util.Arrays; +import java.util.HashMap; +import java.util.List; +import java.util.Locale; +import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import kcg.faics.cmmn.bbs.BaseBbsService; +import kcg.faics.cmmn.bbs.PageType; +import kcg.faics.cmmn.file.FileResponser; +import kcg.faics.cmmn.service.CodeService; +import kcg.faics.sec.LoginUserVO; +import kcg.faics.sec.UserUtil; +import kcg.faics.target.FerryRouteType; +import kcg.faics.target.FerryRunTermType; +import kcg.faics.target.service.impl.FerryServiceImpl; +import kcg.faics.target.vo.FerrySearchVO; +import kcg.faics.target.vo.FerryVO; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.MessageSource; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.util.FileCopyUtils; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.support.SessionStatus; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.rte.fdl.property.EgovPropertyService; +import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper; + +/** + * 국제여객선 컨트롤러. + * + * @author kimnomin + * + */ +@Controller +@RequestMapping("/target/ferry") +public class FerryController { + /** + * properties값을 가져오는 인터페이스. + **/ + @Resource(name = "propertiesService") + private EgovPropertyService propertiesService; + + /** + * message.properties의 값을 가져오는 인터페이스. + */ + @Autowired + private MessageSource messageSource; + + /** + * Validator - 유효성 검사. + **/ + @Resource(name = "beanValidator") + private DefaultBeanValidator beanValidator; + + /** + * 코드관련 정보 인터페이스. + */ + @Resource(name = "codeService") + private CodeService codeService; + + /** + * 국제여객선 비지니스 로직 클래스. + */ + @Resource(name = "ferryService") + private BaseBbsService ferryService; + + /** + * Redirect URI를 조합하여 반환한다. + * + * @param pageType + * 화면구분 + * @param vo + * 국제여객선 VO + * @return Redirect URI + */ + private String makeRedirectUri(final PageType pageType, final FerryVO vo) { + String uri = "redirect:/target/ferry"; + + switch (pageType) { + case View: + uri = String.format("%s/view.do?serNo=%s", uri, vo.getSerNo()); + break; + case List: + uri = String.format("%s/list.do?route=%s", uri, vo.getFerryRoute()); + break; + default: + break; + } + + return uri; + } + + /** + * 국제여객선 정보 조회화면을 반환한다. + * + * @param model + * Model 객체 + * @param ferryVO + * 국제여객선 VO + * @return 국제여객선 정보 조회화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/view.do") + public String view(final Model model, final FerryVO ferryVO) throws Exception { + LoginUserVO loginUserVO = UserUtil.getMemberInfo(); + model.addAttribute("loginUserVO", loginUserVO); + + FerryVO vo = ferryService.select(ferryVO); + model.addAttribute("ferryVO", vo); + + return "/target/ferryView.tiles"; + } + + /** + * 국제여객선 목록화면을 반환한다. + * + * @param model + * Model 객체 + * @param locale + * Locale 객체 + * @param searchVO + * 검색조건 VO + * @return 국제여객선 목록화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/list.do") + public String list(final Model model, final Locale locale, + @ModelAttribute("searchVO") final FerrySearchVO searchVO) + throws Exception { + LoginUserVO loginUserVO = UserUtil.getMemberInfo(); + model.addAttribute("loginUserVO", loginUserVO); + + List routeList = Arrays.asList(FerryRouteType.values()); + model.addAttribute("routeList", routeList); + + if (StringUtils.isBlank(searchVO.getFerryRoute())) { + searchVO.setFerryRoute(FerryRouteType.KR_CH.getCode()); + } + List ferryList = ferryService.selectList(searchVO); + model.addAttribute("ferryList", ferryList); + + return "/target/ferryList.tiles"; + } + + /** + * 국제여객선 입력화면을 반환한다. + * + * @param model + * Model 객체 + * @param ferryVO + * 국제여객선 VO + * @return 국제여객선 입력화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/add.do") + public String add(final Model model, final FerryVO ferryVO) + throws Exception { + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + + if (isAuthenticated && UserUtil.isAdmin()) { + model.addAttribute("registerFlag", "create"); + + LoginUserVO loginUserVO = UserUtil.getMemberInfo(); + model.addAttribute("loginUserVO", loginUserVO); + + List routeList = FerryRouteType.values(FerryRouteType.KP); + model.addAttribute("routeList", routeList); + + List runTermList = Arrays.asList(FerryRunTermType.values()); + model.addAttribute("runTermList", runTermList); + + ferryVO.setWriter(loginUserVO.getUserid()); + + return "/target/ferryAdd.tiles"; + } else { + return makeRedirectUri(PageType.List, ferryVO); + } + } + + /** + * 국제여객선 정보를 입력한다. + * + * @param ferryVO + * 국제여객선 VO + * @param bindingResult + * BindingResult 객체 + * @param model + * Model 객체 + * @param status + * SessionStatus 객체 + * @param multiRequest + * MultipartHttpServletRequest 객체 + * @return 국제여객선 정보 조회화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/add.do", method = RequestMethod.POST) + public String add(@ModelAttribute("ferryVO") final FerryVO ferryVO, + final BindingResult bindingResult, final Model model, + final SessionStatus status, + final MultipartHttpServletRequest multiRequest) throws Exception { + // 사용자 인증 검사 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (isAuthenticated && UserUtil.isAdmin()) { + // 유효성 검사 + beanValidator.validate(ferryVO, bindingResult); + if (bindingResult.hasErrors()) { + return add(model, ferryVO); + } + + final Map fileMap = multiRequest.getFileMap(); + HashMap resultMap = ferryService.insert(ferryVO, fileMap); + + if ((Integer) resultMap.get("result") == 1) { + status.setComplete(); + return makeRedirectUri(PageType.View, ferryVO); + } + } + return "error/bizError"; + } + + /** + * 국제여객선 수정화면을 반환한다. + * + * @param ferryVO + * 국제여객선 VO + * @param model + * Model 객체 + * @return 국제여객선 수정화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/update.do") + public String update(final FerryVO ferryVO, final Model model) throws Exception { + if (UserUtil.isAdmin()) { + model.addAttribute("registerFlag", "modify"); + + FerryVO vo = ferryService.select(ferryVO); + model.addAttribute("ferryVO", vo); + + LoginUserVO loginUserVO = UserUtil.getMemberInfo(); + model.addAttribute("loginUserVO", loginUserVO); + + List routeList = FerryRouteType.values(FerryRouteType.KP); + model.addAttribute("routeList", routeList); + + List runTermList = Arrays.asList(FerryRunTermType.values()); + model.addAttribute("runTermList", runTermList); + + return "/target/ferryAdd.tiles"; + } + + return makeRedirectUri(PageType.View, ferryVO); + } + + /** + * 국제여객선 정보를 수정한다. + * + * @param ferryVO + * 국제여객선 VO + * @param bindingResult + * BindingResult 객체 + * @param model + * Model 객체 + * @param status + * SessionStatus 객체 + * @param multiRequest + * MultipartHttpServletRequest 객체 + * @return 국제여객선 조회화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/update.do", method = RequestMethod.POST) + public String update(@ModelAttribute("ferryVO") final FerryVO ferryVO, + final BindingResult bindingResult, final Model model, + final SessionStatus status, + final MultipartHttpServletRequest multiRequest) throws Exception { + // 사용자 인증 검사 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (isAuthenticated && UserUtil.isAdmin()) { + // 유효성 검사 + beanValidator.validate(ferryVO, bindingResult); + if (bindingResult.hasErrors()) { + return update(ferryVO, model); + } + + String[] deleteFiles = multiRequest.getParameterValues("deleteFile"); + final Map fileMap = multiRequest.getFileMap(); + HashMap resultMap = ferryService.update(ferryVO, fileMap, deleteFiles); + + if ((Integer) resultMap.get("result") > 0) { + status.setComplete(); + return makeRedirectUri(PageType.View, ferryVO); + } + } + + return update(ferryVO, model); + } + + /** + * 국제여객선 정보를 삭제한다. + * + * @param ferryVO + * 국제여객선 VO + * @param model + * Model 객체 + * @param status + * SessionStatus 객체 + * @return 국제여객선 목록화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/delete.do", method = RequestMethod.POST) + public String delete(final FerryVO ferryVO, final Model model, + final SessionStatus status) throws Exception { + + if (UserUtil.isAdmin()) { + FerryVO vo = ferryService.select(ferryVO); + if (vo != null) { + HashMap map = ferryService.delete(vo); + if ((Integer) map.get("result") > 0) { + return makeRedirectUri(PageType.List, vo); + } + } + } + + return makeRedirectUri(PageType.View, ferryVO); + } + + /** + * 파일을 반환한다. + * + * @param ferryVO + * 국제여객선 VO + * @param request + * HttpServletRequest 객체 + * @param response + * HttpServletResponse 객체 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/download.do") + public void fileResponse(final FerryVO ferryVO, + final HttpServletRequest request, final HttpServletResponse response) + throws Exception { + FerryVO vo = ferryService.select(ferryVO); + String filename = vo.getImgFile(); + + if (StringUtils.isNotBlank(filename)) { + String fileFullPath = propertiesService + .getString(FerryServiceImpl.FILE_PATH_KEYWORD) + filename; + File file = new File(fileFullPath); + if (file.exists()) { + FileResponser.setResponse(file, filename, request, response); + BufferedInputStream in = null; + try { + in = new BufferedInputStream(new FileInputStream(file)); + FileCopyUtils.copy(in, response.getOutputStream()); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (in != null) { + try { + in.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + } else { + response.setStatus(HttpStatus.NOT_FOUND.value()); + throw new Exception(); + } + } + } +} diff --git a/src/main/java/kcg/faics/tg/web/WeakPlaceController.java b/src/main/java/kcg/faics/tg/web/WeakPlaceController.java new file mode 100644 index 0000000..09568b5 --- /dev/null +++ b/src/main/java/kcg/faics/tg/web/WeakPlaceController.java @@ -0,0 +1,418 @@ +package kcg.faics.target.web; + +import java.io.BufferedInputStream; +import java.io.File; +import java.io.FileInputStream; +import java.text.SimpleDateFormat; +import java.util.Date; +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 javax.validation.Valid; + +import kcg.faics.cmmn.file.FileResponser; +import kcg.faics.cmmn.service.CodeService; +import kcg.faics.cmmn.vo.CodeVO; +import kcg.faics.sec.LoginUserVO; +import kcg.faics.sec.UserUtil; +import kcg.faics.target.service.WeakPlaceService; +import kcg.faics.target.vo.WeakPlaceSearchVO; +import kcg.faics.target.vo.WeakPlaceVO; + +import org.apache.commons.io.FilenameUtils; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.MessageSource; +import org.springframework.http.HttpStatus; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.ui.ModelMap; +import org.springframework.util.FileCopyUtils; +import org.springframework.validation.BindingResult; +import org.springframework.web.bind.annotation.ModelAttribute; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestMethod; +import org.springframework.web.bind.support.SessionStatus; +import org.springframework.web.multipart.MultipartFile; +import org.springframework.web.multipart.MultipartHttpServletRequest; +import org.springmodules.validation.commons.DefaultBeanValidator; + +import egovframework.rte.fdl.property.EgovPropertyService; +import egovframework.rte.fdl.security.userdetails.util.EgovUserDetailsHelper; + +/** + * 외사취약지 컨트롤러. + * + * @author kimnomin + * + */ +@Controller +@RequestMapping("/target/weakplace") +public class WeakPlaceController { + /** + * properties값을 가져오는 인터페이스. + **/ + @Resource(name = "propertiesService") + private EgovPropertyService propertiesService; + + /** + * message.properties의 값을 가져오는 인터페이스. + */ + @Autowired + private MessageSource messageSource; + + /** + * 코드관련 정보 인터페이스. + */ + @Resource(name = "codeService") + private CodeService codeService; + + /** + * Validator - 유효성 검사. + **/ + @Resource(name = "beanValidator") + private DefaultBeanValidator beanValidator; + + /** + * 외사취약지 비지니스 로직 클래스. + */ + @Resource(name = "weakPlaceService") + private WeakPlaceService weakPlaceService; + + /** + * 외사취약지 조회 화면을 반환한다. + * + * @param vo + * 검색할 외사취약지 VO + * @param model + * Model 객체 + * @return 외사취약지 조회 화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/view.do") + public String view(final WeakPlaceVO vo, final ModelMap model) + throws Exception { + + LoginUserVO loginUserVO = UserUtil.getMemberInfo(); + model.addAttribute("loginUserVO", loginUserVO); + + WeakPlaceVO weakPlaceVO = weakPlaceService.select(vo); + model.addAttribute("weakPlaceVO", weakPlaceVO); + + String filename1Ext = ""; + String filename1 = weakPlaceVO.getFilename1(); + if (!StringUtils.isBlank(filename1)) { + filename1Ext = FilenameUtils.getExtension(filename1).toLowerCase(); + } + model.addAttribute("filename1Ext", filename1Ext); + + return "/target/weakPlaceView.tiles"; + } + + /** + * 외사취약지 목록 화면을 반환한다. + * + * @param searchVO + * 검색정보 VO + * @param model + * Model 객체 + * @return 외사취약지 목록화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/list.do") + public String list(@ModelAttribute("searchVO") final WeakPlaceSearchVO searchVO, + final ModelMap model) throws Exception { + + LoginUserVO loginUserVO = UserUtil.getMemberInfo(); + model.addAttribute("loginUserVO", loginUserVO); + + List placeList = codeService.getPlace1List(CodeService.POLICE_STATION_LIST); + model.addAttribute("placeList", placeList); + + List> statsPerPlace = weakPlaceService.selectStatsPerPlace(); + model.addAttribute("statsPerPlace", statsPerPlace); + + List weakPlaceList = weakPlaceService.selectList(searchVO); + model.addAttribute("weakPlaceList", weakPlaceList); + + Date today = new Date(); + SimpleDateFormat simpleDate = new SimpleDateFormat("yyyy. MM. dd."); + String todayStr = simpleDate.format(today); + model.addAttribute("today", todayStr); + + + return "/target/weakPlaceList.tiles"; + } + + /** + * 외사취약지 입력화면을 반환한다. + * + * @param model + * Model 객체 + * @param weakPlaceVO + * 입력할 외사취약지 VO + * @return 외사취약지 입력화면 + * @throws Exception + * 기본예외처리 + */ + @RequestMapping(value = "/add.do") + public String add(final Model model, final WeakPlaceVO weakPlaceVO) throws Exception { + LoginUserVO loginUserVO = UserUtil.getMemberInfo(); + WeakPlaceVO vo; + if (weakPlaceVO == null) { + vo = new WeakPlaceVO(); + } else { + vo = weakPlaceVO; + } + vo.setWriter(loginUserVO.getUserid()); + vo.setPlace1(loginUserVO.getPlace1()); + vo.setPlace1str(loginUserVO.getPlace1Str()); + + List placeList = codeService.getPlace1List(CodeService.POLICE_STATION_LIST); + + int tempWpNo = 0; + String tempPlace1Code = ""; + HashMap wpNoMap = new HashMap(); + for (int i = 0; i < CodeService.POLICE_STATION_LIST.length; i++) { + tempWpNo = 0; + tempPlace1Code = CodeService.POLICE_STATION_LIST[i]; + tempWpNo = weakPlaceService.selectMaxWpNo(tempPlace1Code); + wpNoMap.put(tempPlace1Code, ++tempWpNo); + + // 중앙부처 사용자는 placeList의 첫번째 기관의 wpno 값을 기본으로 한다. + if ("PS00".equalsIgnoreCase(vo.getPlace1()) + && tempPlace1Code.equalsIgnoreCase(placeList.get(0).getCode2())) { + vo.setWpNo(tempWpNo); + } else if (tempPlace1Code.equalsIgnoreCase(vo.getPlace1())) { + vo.setWpNo(tempWpNo); + } + } + model.addAttribute("wpNoMap", wpNoMap); + + model.addAttribute("placeList", placeList); + model.addAttribute("weakPlaceVO", vo); + model.addAttribute("loginUserVO", "loginUserVO"); + model.addAttribute("registerFlag", "create"); + + return "/target/weakPlaceAdd.tiles"; + } + + /** + * 외사취약지 정보를 입력한다. + * + * @param multiRequest + * mutipartform 객체 + * @param weakPlaceVO + * 외사취약지 VO + * @param bindingResult + * 유효성 검사결과 객체 + * @param model + * 모델 객체 + * @param status + * SessionStatus 객체 + * @return 외사취약지 조회 화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/add.do", method = RequestMethod.POST) + public String add(final MultipartHttpServletRequest multiRequest, + @Valid @ModelAttribute("weakPlaceVO") final WeakPlaceVO weakPlaceVO, + final BindingResult bindingResult, final Model model, + final SessionStatus status) throws Exception { + // 사용자 인증 검사 + Boolean isAuthenticated = EgovUserDetailsHelper.isAuthenticated(); + if (isAuthenticated) { + // 유효성 검사 + beanValidator.validate(weakPlaceVO, bindingResult); + if (bindingResult.hasErrors()) { + model.addAttribute("weakPlaceVO", weakPlaceVO); + model.addAttribute("registerFlag", "create"); + return "target/weakPlaceAdd.tiles"; + } + + // 파일 저장 및 데이터 입력 + final Map fileMap = multiRequest.getFileMap(); + HashMap map = weakPlaceService.insert(weakPlaceVO, fileMap); + + status.setComplete(); + + if ((Integer) map.get("result") == 1) { + return String.format("redirect:/target/weakplace/view.do?place1=%s&wpNo=%s", map.get("place1"), map.get("wpNo")); + } + } + + return "error/bizError"; + } + + /** + * 외사취약지 수정화면을 반환한다. + * + * @param model + * Model 객체 + * @param weakPlaceVO + * 외사취약지 VO + * @return 외사취약지 수정화면 + * @throws Exception + * 기본예외처리 + */ + @RequestMapping(value = "/update.do", method = RequestMethod.GET) + public String update(final Model model, final WeakPlaceVO weakPlaceVO) throws Exception { + LoginUserVO loginUserVO = UserUtil.getMemberInfo(); + + // 관리자만 수정 가능 + if (loginUserVO.getAuthAdmin() == 1) { + WeakPlaceVO vo = weakPlaceService.select(weakPlaceVO); + model.addAttribute("weakPlaceVO", vo); + model.addAttribute("loginUserVO", loginUserVO); + model.addAttribute("registerFlag", "modify"); + + return "/target/weakPlaceAdd.tiles"; + } + + return "redirect:/target/weakplace/view.do?place1=" + + weakPlaceVO.getPlace1() + "&wpNo=" + weakPlaceVO.getWpNo(); + + } + + /** + * 외사취약지 정보를 수정한다. + * + * @param multiRequest + * mutipartform 객체 + * @param weakPlaceVO + * 외사취약지 VO + * @param bindingResult + * 유효성 검사결과 객체 + * @param model + * 모델 객체 + * @param status + * SessionStatus 객체 + * @return 외사취약지 조회 화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/update.do", method = RequestMethod.POST) + public String update(final MultipartHttpServletRequest multiRequest, + @Valid @ModelAttribute("weakPlaceVO") final WeakPlaceVO weakPlaceVO, + final BindingResult bindingResult, final Model model, + final SessionStatus status) throws Exception { + LoginUserVO loginUserVO = UserUtil.getMemberInfo(); + + // 관리자만 수정 가능 + if (loginUserVO.getAuthAdmin() == 1) { + // 유효성 검사 + beanValidator.validate(weakPlaceVO, bindingResult); + if (bindingResult.hasErrors()) { + model.addAttribute("weakPlaceVO", weakPlaceVO); + model.addAttribute("registerFlag", "modify"); + return "target/weakPlaceAdd.tiles"; + } + + String[] deleteFiles = multiRequest.getParameterValues("deleteFile"); + final Map fileMap = multiRequest.getFileMap(); + HashMap map = weakPlaceService.update(weakPlaceVO, fileMap, deleteFiles); + + status.setComplete(); + + if ((Integer) map.get("result") > 0) { + return "redirect:/target/weakplace/view.do?place1=" + + weakPlaceVO.getPlace1() + "&wpNo=" + + weakPlaceVO.getWpNo(); + } + } + + return "redirect:/target/weakplace/view.do?place1=" + + weakPlaceVO.getPlace1() + "&wpNo=" + weakPlaceVO.getWpNo(); + } + + /** + * 외사취약지 정보를 삭제한다. + * + * @param weakPlaceVO + * 외사취약지 VO + * @param model + * Model 객체 + * @param status + * SessionStatus 객체 + * @return 외사취약지 목록 화면 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/delete.do", method = RequestMethod.POST) + public String delete(final WeakPlaceVO weakPlaceVO, final Model model, + final SessionStatus status) throws Exception { + LoginUserVO loginUserVO = UserUtil.getMemberInfo(); + + // 관리자만 삭제 가능 + if (loginUserVO.getAuthAdmin() == 1) { + WeakPlaceVO vo = weakPlaceService.select(weakPlaceVO); + if (vo != null) { + HashMap map = weakPlaceService.delete(weakPlaceVO); + if ((Integer) map.get("result") > 0) { + return "redirect:/target/weakplace/list.do"; + } + } + } + + return "redirect:/susa/incident/view.do?place1=" + + weakPlaceVO.getPlace1() + "&wpNo=" + weakPlaceVO.getWpNo(); + } + + /** + * 파일을 반환한다. + * + * @param weakPlaceVO + * 외사취약지 VO + * @param seq + * 파일 인덱스 + * @param request + * HttpServletRequest 객체 + * @param response + * HttpServletResponse 객체 + * @throws Exception + * 기본 예외 처리 + */ + @RequestMapping(value = "/download.do") + public void fileResponse(final WeakPlaceVO weakPlaceVO, final int seq, + final HttpServletRequest request, final HttpServletResponse response) throws Exception { + WeakPlaceVO vo = weakPlaceService.select(weakPlaceVO); + String filename = ""; + if (seq == 1) { + filename = vo.getFilename1(); + } else if (seq == 2) { + filename = vo.getFilename2(); + } + + if (StringUtils.isNotBlank(filename)) { + String fileFullPath = propertiesService.getString("Target.wp.fileStorePath") + filename; + File file = new File(fileFullPath); + if (file.exists()) { + FileResponser.setResponse(file, filename, request, response); + BufferedInputStream in = null; + try { + in = new BufferedInputStream(new FileInputStream(file)); + FileCopyUtils.copy(in, response.getOutputStream()); + } catch (Exception e) { + e.printStackTrace(); + } finally { + if (in != null) { + try { + in.close(); + } catch (Exception e) { + e.printStackTrace(); + } + } + } + } else { + response.setStatus(HttpStatus.NOT_FOUND.value()); + throw new Exception(); + } + } + } +} diff --git a/src/main/java/kcg/faics/tg/web/package-info.java b/src/main/java/kcg/faics/tg/web/package-info.java new file mode 100644 index 0000000..fb39dfb --- /dev/null +++ b/src/main/java/kcg/faics/tg/web/package-info.java @@ -0,0 +1,8 @@ +/** + * 외사대상목표 컨트롤러 패키지. + */ +/** + * @author kimnomin + * + */ +package kcg.faics.target.web; \ No newline at end of file diff --git a/src/main/resources/sqlmapper/mappers/tg/corp.xml b/src/main/resources/sqlmapper/mappers/tg/corp.xml new file mode 100644 index 0000000..38d9fa9 --- /dev/null +++ b/src/main/resources/sqlmapper/mappers/tg/corp.xml @@ -0,0 +1,171 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/sqlmapper/mappers/tg/divmng.xml b/src/main/resources/sqlmapper/mappers/tg/divmng.xml new file mode 100644 index 0000000..29c3a0b --- /dev/null +++ b/src/main/resources/sqlmapper/mappers/tg/divmng.xml @@ -0,0 +1,119 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/sqlmapper/mappers/tg/ferry.xml b/src/main/resources/sqlmapper/mappers/tg/ferry.xml new file mode 100644 index 0000000..a20771e --- /dev/null +++ b/src/main/resources/sqlmapper/mappers/tg/ferry.xml @@ -0,0 +1,124 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/sqlmapper/mappers/tg/weakplace.xml b/src/main/resources/sqlmapper/mappers/tg/weakplace.xml new file mode 100644 index 0000000..8524570 --- /dev/null +++ b/src/main/resources/sqlmapper/mappers/tg/weakplace.xml @@ -0,0 +1,147 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/main/resources/sqlmapper/sql-mapper-config.xml b/src/main/resources/sqlmapper/sql-mapper-config.xml index 0b610b4..01d6426 100644 --- a/src/main/resources/sqlmapper/sql-mapper-config.xml +++ b/src/main/resources/sqlmapper/sql-mapper-config.xml @@ -54,15 +54,15 @@ - - - - - - - - - + + + + + + + + +