오류수정.

master
강석 최 2022-03-25 12:55:38 +09:00
parent 6574428fb4
commit 9e28a540a0
36 changed files with 5550 additions and 13 deletions

View File

@ -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;

View File

@ -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;

View File

@ -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<FerryRouteType> values(final FerryRouteType... exclude) {
List<FerryRouteType> list = new ArrayList<FerryRouteType>();
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;
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,8 @@
/**
* .
*/
/**
* @author kimnomin
*
*/
package kcg.faics.target;

View File

@ -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<CorpSearchVO, CorpVO> {
/**
* .
*
* @return
* @throws Exception
*
*/
List<HashMap<String, Object>> selectStats() throws Exception;
}

View File

@ -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<WeakPlaceSearchVO, WeakPlaceVO> {
/**
* .
*
* @return
* @throws Exception
*
*/
List<HashMap<String, Object>> selectStatsPerPlace() throws Exception;
/**
* .
*
* @param place1
*
* @return
* @throws Exception
*
*/
int selectMaxWpNo(String place1) throws Exception;
}

View File

@ -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<CorpVO> selectList(final CorpSearchVO searchVO) {
return selectList("Corp.selectList", searchVO);
}
/**
* .
*
* @param map
* Map
* @return
* @throws Exception
*
*/
public List<HashMap<String, Object>> selectStats(final HashMap<String, Object> map)
throws Exception {
return selectList("Corp.selectStats", map);
}
/**
* .
*
* @param corpVO
* VO
* @return <code>1</code> , <code>0</code>
*/
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 <code>1</code>, <code>0</code>
* @throws Exception
*
*/
public int delete(final CorpVO corpVO) throws Exception {
return delete("Corp.delete", corpVO);
}
/**
* .
*
* @param corpVO
* VO
* @return <code>1</code>, <code>0</code>
* @throws Exception
*
*/
public int update(final CorpVO corpVO) throws Exception {
return update("Corp.update", corpVO);
}
}

View File

@ -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<CorpVO> selectListAll(final CorpSearchVO searchVO) throws Exception {
// TODO Auto-generated method stub
return null;
}
@Override
public List<CorpVO> 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<String, Object> insert(final CorpVO dataVO,
final Map<String, MultipartFile> fileMap) throws Exception {
int nextOrgNo = selectNextOrgNo(dataVO);
dataVO.setOrgNo(nextOrgNo);
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("result", corpMapper.insert(dataVO));
return map;
}
@Override
public HashMap<String, Object> update(final CorpVO dataVO,
final Map<String, MultipartFile> fileMap, final String[] deleteFiles)
throws Exception {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("result", corpMapper.update(dataVO));
return map;
}
@Override
public HashMap<String, Object> delete(final CorpVO dataVO) throws Exception {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("result", corpMapper.delete(dataVO));
return map;
}
@Override
public List<HashMap<String, Object>> selectStats() throws Exception {
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("placeList", CodeService.POLICE_STATION_LIST);
return corpMapper.selectStats(map);
}
}

View File

@ -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<DivMngVO> selectList(final DivMngSearchVO searchVO) {
return selectList("DivMng.selectList", searchVO);
}
/**
* .
*
* @param vo
* VO
* @return <code>1</code> , <code>0</code>
*/
public int insert(final DivMngVO vo) {
return insert("DivMng.insert", vo);
}
/**
* .
*
* @param vo
* VO
* @return <code>1</code>, <code>0</code>
* @throws Exception
*
*/
public int delete(final DivMngVO vo) throws Exception {
return delete("DivMng.delete", vo);
}
/**
* .
*
* @param vo
* VO
* @return <code>1</code>, <code>0</code>
* @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);
}
}

View File

@ -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<DivMngSearchVO, DivMngVO> {
/**
* 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<DivMngVO> selectListAll(final DivMngSearchVO searchVO)
throws Exception {
// TODO Auto-generated method stub
return null;
}
@Override
public List<DivMngVO> 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<String, Object> insert(final DivMngVO dataVO,
final Map<String, MultipartFile> fileMap) throws Exception {
HashMap<String, Object> map = new HashMap<String, Object>();
int no = selectNextNo(dataVO);
if (no > 0) {
dataVO.setNo(no);
List<FileVO> 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<String, MultipartFile> fileMap,
final String fileMapKey, final List<String> 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<String, Object> update(final DivMngVO dataVO,
final Map<String, MultipartFile> 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<String> deleteFileList = new ArrayList<String>();
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<FileVO> 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<String, Object> map = new HashMap<String, Object>();
map.put("result", divMngMapper.update(dataVO));
return map;
}
@Override
public HashMap<String, Object> delete(final DivMngVO dataVO) throws Exception {
DivMngVO vo = select(dataVO);
HashMap<String, Object> map = new HashMap<String, Object>();
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;
}
}

View File

@ -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<FerryVO> selectList(final FerrySearchVO searchVO) {
return selectList("Ferry.selectList", searchVO);
}
/**
* .
*
* @param vo
* VO
* @return <code>1</code> , <code>0</code>
*/
public int insert(final FerryVO vo) {
return insert("Ferry.insert", vo);
}
/**
* .
*
* @param vo
* VO
* @return <code>1</code>, <code>0</code>
* @throws Exception
*
*/
public int delete(final FerryVO vo) throws Exception {
return delete("Ferry.delete", vo);
}
/**
* .
*
* @param vo
* VO
* @return <code>1</code>, <code>0</code>
* @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);
}
}

View File

@ -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<FerrySearchVO, FerryVO> {
/**
* 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<FerryVO> selectListAll(final FerrySearchVO searchVO)
throws Exception {
// TODO Auto-generated method stub
return null;
}
@Override
public List<FerryVO> 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<String, Object> insert(final FerryVO dataVO,
final Map<String, MultipartFile> fileMap) throws Exception {
HashMap<String, Object> map = new HashMap<String, Object>();
int no = selectNextSerNo(dataVO);
if (no > 0) {
dataVO.setSerNo(no);
List<FileVO> 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<String, MultipartFile> fileMap,
final String fileMapKey, final List<String> 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<String, Object> update(final FerryVO dataVO,
final Map<String, MultipartFile> fileMap, final String[] deleteFiles)
throws Exception {
FerryVO vo = select(dataVO);
dataVO.setImgFile(vo.getImgFile());
List<String> deleteFileList = new ArrayList<String>();
if (deleteFiles != null) {
deleteFileList = Arrays.asList(deleteFiles);
}
if (isRemoveTarget(fileMap, "imgFileObj", deleteFileList, "imgFile")) {
fileUtil.deleteFile(vo.getImgFile(), FILE_PATH_KEYWORD);
dataVO.setImgFile("");
}
List<FileVO> fileList = fileUtil.parseFileInf(fileMap, null, 0, "", FILE_PATH_KEYWORD);
for (FileVO fileVO : fileList) {
if ("imgFileObj".equalsIgnoreCase(fileVO.getFileSn())) {
dataVO.setImgFile(fileVO.getStreFileNm());
}
}
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("result", ferryMapper.update(dataVO));
return map;
}
@Override
public HashMap<String, Object> delete(final FerryVO dataVO) throws Exception {
FerryVO vo = select(dataVO);
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("result", ferryMapper.delete(dataVO));
if (StringUtils.isNotBlank(vo.getImgFile())) {
fileUtil.deleteFile(vo.getImgFile(), FILE_PATH_KEYWORD);
}
return map;
}
}

View File

@ -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<WeakPlaceVO> 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<HashMap<String, Object>> selectStatsPerPlace(final String[] placeList) throws Exception {
HashMap<String, String[]> map = new HashMap<String, String[]>();
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);
}
}

View File

@ -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<WeakPlaceVO> selectListAll(final WeakPlaceSearchVO searchVO)
throws Exception {
// 사용하지 않음
return null;
}
@Override
public List<WeakPlaceVO> selectList(final WeakPlaceSearchVO searchVO)
throws Exception {
return weakPlaceMapper.selectList(searchVO);
}
@Override
public List<HashMap<String, Object>> selectStatsPerPlace() throws Exception {
List<HashMap<String, Object>> statsList = new ArrayList<HashMap<String, Object>>();
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<String, Object> insert(final WeakPlaceVO dataVO,
final Map<String, MultipartFile> fileMap) throws Exception {
int result = 0;
try {
// 파일저장
if (fileMap != null) {
List<FileVO> 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<String, Object> map = new HashMap<String, Object>();
map.put("result", result);
if (result == 1) {
map.put("place1", dataVO.getPlace1());
map.put("wpNo", dataVO.getWpNo());
}
return map;
}
@Override
public HashMap<String, Object> update(final WeakPlaceVO dataVO,
final Map<String, MultipartFile> 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<FileVO> 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<String, Object> map = new HashMap<String, Object>();
map.put("result", result);
return map;
}
@Override
public HashMap<String, Object> delete(final WeakPlaceVO dataVO) throws Exception {
// 기존 PHP 소스에서 실제 물리적인 파일은 삭제하지 않는다. 이를 준용한다.
int result = weakPlaceMapper.delete(dataVO);
HashMap<String, Object> map = new HashMap<String, Object>();
map.put("result", result);
return map;
}
}

View File

@ -0,0 +1,8 @@
/**
* .
*/
/**
* @author kimnomin
*
*/
package kcg.faics.target.service.impl;

View File

@ -0,0 +1,8 @@
/**
* .
*/
/**
* @author kimnomin
*
*/
package kcg.faics.target.service;

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,8 @@
/**
* Value Object .
*/
/**
* @author kimnomin
*
*/
package kcg.faics.target.vo;

View File

@ -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<String, String> getFieldName(final String grpNo, final Locale locale) {
LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
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<HashMap<String, Object>> 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<String, String> header = new LinkedHashMap<String, String>();
header.put("ORG_NM", "구분");
header.put("TOT_CNT", "계");
List<CodeVO> policeStations = codeService.getPlace1List(CodeService.POLICE_STATION_LIST);
for (CodeVO placeCode : policeStations) {
header.put(placeCode.getCode2() + "_CNT", placeCode.getCodenmYak());
}
// 데이터 생성
List<HashMap<String, Object>> stats = corpService.selectStats();
// Export
model.addAttribute("excel", new ExcelExporter<HashMap<String, Object>>(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<CodeVO> 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<CodeVO> corpOrgList = codeService.getCorpOrgList();
LinkedHashMap<String, String> corpOrgMap = new LinkedHashMap<String, String>();
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<CorpVO> corpList = corpService.selectList(searchVO);
model.addAttribute("corpList", corpList);
LinkedHashMap<String, String> 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<String, String> header = getFieldName(grpNo, locale);
// 데이터 생성
List<CorpVO> corpList = corpService.selectList(searchVO);
// Export
model.addAttribute("excel", new ExcelExporter<CorpVO>(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<String, String> 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<CodeVO> 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<String, String> fieldNameMap = getFieldName(corpVO.getGrpNo(), locale);
model.addAttribute("fieldNameMap", fieldNameMap);
model.addAttribute("registerFlag", "create");
}
return "/target/corpAdd.tiles";
}
/**
* .
*
* <pre>
* php ,
* DB .
* </pre>
*
* @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<String, Object> 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<String, String> fieldNameMap = getFieldName(vo.getGrpNo(), locale);
model.addAttribute("fieldNameMap", fieldNameMap);
model.addAttribute("registerFlag", "modify");
return "/target/corpAdd.tiles";
}
return makeRedirectUri(PageType.View, corpVO);
}
/**
* .
*
* <pre>
* php ,
* DB .
* </pre>
*
* @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<String, Object> 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<String, Object> result = corpService.delete(corpVO);
if ((Integer) result.get("result") == 1) {
return makeRedirectUri(PageType.List, vo);
}
}
return makeRedirectUri(PageType.View, corpVO);
}
}

View File

@ -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<DivMngSearchVO, DivMngVO> 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<CodeVO> placeList = codeService.getPlace1List(false, true);
model.addAttribute("placeList", placeList);
List<DivMngVO> 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<String, String> header = new LinkedHashMap<String, String>();
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<DivMngVO> divMngList = divMngService.selectList(searchVO);
// Export
model.addAttribute("excel", new ExcelExporter<DivMngVO>(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<CodeVO> 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<String, MultipartFile> fileMap = multiRequest.getFileMap();
HashMap<String, Object> 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<String, MultipartFile> fileMap = multiRequest.getFileMap();
HashMap<String, Object> 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<String, Object> 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();
}
}
}
}

View File

@ -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<FerrySearchVO, FerryVO> 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<FerryRouteType> routeList = Arrays.asList(FerryRouteType.values());
model.addAttribute("routeList", routeList);
if (StringUtils.isBlank(searchVO.getFerryRoute())) {
searchVO.setFerryRoute(FerryRouteType.KR_CH.getCode());
}
List<FerryVO> 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<FerryRouteType> routeList = FerryRouteType.values(FerryRouteType.KP);
model.addAttribute("routeList", routeList);
List<FerryRunTermType> 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<String, MultipartFile> fileMap = multiRequest.getFileMap();
HashMap<String, Object> 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<FerryRouteType> routeList = FerryRouteType.values(FerryRouteType.KP);
model.addAttribute("routeList", routeList);
List<FerryRunTermType> 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<String, MultipartFile> fileMap = multiRequest.getFileMap();
HashMap<String, Object> 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<String, Object> 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();
}
}
}
}

View File

@ -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<CodeVO> placeList = codeService.getPlace1List(CodeService.POLICE_STATION_LIST);
model.addAttribute("placeList", placeList);
List<HashMap<String, Object>> statsPerPlace = weakPlaceService.selectStatsPerPlace();
model.addAttribute("statsPerPlace", statsPerPlace);
List<WeakPlaceVO> 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<CodeVO> placeList = codeService.getPlace1List(CodeService.POLICE_STATION_LIST);
int tempWpNo = 0;
String tempPlace1Code = "";
HashMap<String, Integer> wpNoMap = new HashMap<String, Integer>();
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<String, MultipartFile> fileMap = multiRequest.getFileMap();
HashMap<String, Object> 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<String, MultipartFile> fileMap = multiRequest.getFileMap();
HashMap<String, Object> 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<String, Object> 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();
}
}
}
}

View File

@ -0,0 +1,8 @@
/**
* .
*/
/**
* @author kimnomin
*
*/
package kcg.faics.target.web;

View File

@ -0,0 +1,171 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="Corp">
<resultMap id="corpResult" type="corpVO">
<result property="place1" column="PLACE1" />
<result property="place1str" column="CODENM" />
<result property="orgId" column="ORG_ID" />
<result property="orgNo" column="ORG_NO" />
<result property="grpNo" column="GRP_NO" />
<result property="name" column="NAME" />
<result property="location" column="LOCATION" />
<result property="ceo" column="CEO" />
<result property="jobType" column="JOBTYPE" />
<result property="tel" column="TEL" />
<result property="fax" column="FAX" />
<result property="comments" column="COMMENTS" />
<result property="partner" column="PARTNER" />
<result property="shipCnt" column="SHIPCNT" />
<result property="memberCnt" column="MEMBERCNT" />
<result property="basicYear" column="BASICYEAR" />
<result property="fund" column="FUND" />
<result property="writerPlace1" column="WRITER_PLACE1" />
<result property="writer" column="WRITER" />
<result property="credate" column="CREDATE" />
<result property="logdate" column="LOGDATE" />
</resultMap>
<select id="select" parameterType="corpVO" resultMap="corpResult">
<![CDATA[
SELECT
CP.*, C.CODENM
FROM
TCORP CP, TCODE C
WHERE
C.CODE1 = 'C001'
AND CP.PLACE1 = C.CODE2
AND CP.PLACE1 = #{place1}
AND CP.ORG_ID = #{orgId}
AND CP.ORG_NO = #{orgNo}
]]>
</select>
<select id="selectList" parameterType="corpSearchVO" resultMap="corpResult">
<![CDATA[
SELECT
CP.*, C.CODENM
FROM
TCORP CP, TCODE C
WHERE
C.CODE1 = 'C001'
AND CP.PLACE1 = C.CODE2
AND CP.ORG_ID = #{orgId}
AND CP.GRP_NO = #{grpNo}
]]>
<if test="place1 != null and place1 != ''">
AND CP.PLACE1 = #{place1}
</if>
<if test="name != null and name != ''">
AND CP.NAME LIKE '%' || #{name} || '%'
</if>
<if test="jobType != null and jobType != ''">
AND CP.JOBTYPE = #{jobType}
</if>
<![CDATA[
ORDER BY
CP.PLACE1 ASC
]]>
</select>
<select id="selectStats" parameterType="hashmap" resultType="hashmap" >
<![CDATA[
SELECT
COUNT(ORG_ID) AS TOT_CNT,
'00' AS ORG_ID,
'계' AS ORG_NM,
'00' AS GRP_NO,
]]>
<foreach collection="placeList" item="item" index="index" separator="," open="" close="">
SUM(CASE PLACE1 WHEN #{item} THEN 1 ELSE 0 END) AS ${item}_CNT
</foreach>
<![CDATA[
FROM TCORP
UNION
SELECT
COUNT(TP.ORG_ID) AS TOT_CNT,
SUBSTR(TD.CODE2,1,2) AS ORG_ID,
TD.CODENM AS ORG_NM,
SUBSTR(TD.CODE2,3,2) AS GRP_NO,
]]>
<foreach collection="placeList" item="item" index="index" separator="," open="" close="">
SUM(CASE PLACE1 WHEN #{item} THEN 1 ELSE 0 END) AS ${item}_CNT
</foreach>
<![CDATA[
FROM TCORP TP LEFT JOIN TCODE TD ON TP.ORG_ID = SUBSTR(TD.CODE2,1,2)
WHERE TD.CODE1 = 'CORP'
GROUP BY TP.ORG_ID, TD.CODENM, GRP_NO, TD.CODE2
ORDER BY ORG_ID ASC
]]>
</select>
<insert id="insert" parameterType="corpVO">
<![CDATA[
INSERT INTO TCORP
(
PLACE1, ORG_ID, ORG_NO, GRP_NO, NAME,
LOCATION, CEO, JOBTYPE, TEL, FAX,
COMMENTS, PARTNER, SHIPCNT, MEMBERCNT, BASICYEAR,
FUND, WRITER_PLACE1, WRITER, CREDATE, LOGDATE
)
VALUES
(
#{place1}, #{orgId}, #{orgNo}, #{grpNo}, #{name},
#{location}, #{ceo}, #{jobType}, #{tel}, #{fax},
#{comments}, #{partner}, #{shipCnt}, #{memberCnt}, #{basicYear},
#{fund}, #{writerPlace1}, #{writer}, TO_CHAR(NOW(), 'YYYYMMDDHH24MISS'), TO_CHAR(NOW(), 'YYYYMMDDHH24MISS')
)
]]>
</insert>
<update id="update" parameterType="corpVO">
<![CDATA[
UPDATE
TCORP
SET
GRP_NO = #{grpNo},
NAME = #{name},
LOCATION = #{location},
CEO = #{ceo},
JOBTYPE = #{jobType},
TEL = #{tel},
FAX = #{fax},
COMMENTS = #{comments},
PARTNER = #{partner},
BASICYEAR = #{basicYear},
SHIPCNT = #{shipCnt},
MEMBERCNT = #{memberCnt},
FUND = #{fund},
WRITER = #{writer},
WRITER_PLACE1 = #{writerPlace1},
LOGDATE = TO_CHAR(NOW(), 'YYYYMMDDHH24MISS')
WHERE
PLACE1 = #{place1}
AND ORG_ID = #{orgId}
AND ORG_NO = #{orgNo}
]]>
</update>
<delete id="delete" parameterType="corpVO">
<![CDATA[
DELETE
FROM
TCORP
WHERE
PLACE1 = #{place1}
AND ORG_ID = #{orgId}
AND ORG_NO = #{orgNo}
]]>
</delete>
<select id="selectMaxOrgNo" parameterType="corpVO" resultType="int">
<![CDATA[
SELECT
MAX(ORG_NO)
FROM
TCORP
WHERE
ORG_ID = #{orgId}
]]>
</select>
</mapper>

View File

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="DivMng">
<resultMap id="divMngResult" type="divMngVO">
<result property="place" column="DS_PLACE" />
<result property="placeStr" column="CODENM" />
<result property="no" column="DS_NO" />
<result property="local" column="DS_LOCAL" />
<result property="gubun" column="DS_GUBUN" />
<result property="staffNum" column="DS_STAFF_NUM" />
<result property="tel" column="DS_TEL" />
<result property="condition" column="DS_CONDITION" />
<result property="equipStat" column="DS_EQUIP_STAT" />
<result property="fileImg" column="DS_FILEIMG" />
<result property="file1" column="DS_FILE1" />
<result property="file2" column="DS_FILE2" />
<result property="file3" column="DS_FILE3" />
<result property="creDate" column="DS_CREDATE" />
<result property="logDate" column="DS_LOGDATE" />
<result property="writer" column="DS_WRITER" />
</resultMap>
<select id="select" parameterType="divMngVO" resultMap="divMngResult">
<![CDATA[
SELECT
DS.*, C.CODENM
FROM
H3_DIVISION_MANAGE_STAT DS, TCODE C
WHERE
C.CODE1 = 'C001'
AND DS.DS_PLACE = C.CODE2
AND DS.DS_PLACE = #{place}
AND DS.DS_NO = #{no}
]]>
</select>
<select id="selectList" parameterType="divMngSearchVO" resultMap="divMngResult">
<![CDATA[
SELECT
DS.*, C.CODENM
FROM
H3_DIVISION_MANAGE_STAT DS, TCODE C
WHERE
C.CODE1 = 'C001'
AND DS.DS_PLACE = C.CODE2
]]>
<if test="place != null and place != ''">
AND DS.DS_PLACE = #{place}
</if>
<![CDATA[
ORDER BY
DS.DS_PLACE ASC,
DS.DS_NO ASC
]]>
</select>
<insert id="insert" parameterType="divMngVO">
<![CDATA[
INSERT INTO H3_DIVISION_MANAGE_STAT
(
DS_PLACE, DS_NO, DS_LOCAL, DS_GUBUN, DS_STAFF_NUM,
DS_TEL, DS_CONDITION, DS_EQUIP_STAT, DS_FILEIMG, DS_FILE1,
DS_FILE2, DS_FILE3, DS_CREDATE, DS_WRITER
)
VALUES
(
#{place}, #{no}, #{local}, #{gubun}, #{staffNum},
#{tel}, #{condition}, #{equipStat}, #{fileImg}, #{file1},
#{file2}, #{file3}, NOW(), #{writer}
)
]]>
</insert>
<update id="update" parameterType="divMngVO">
<![CDATA[
UPDATE
H3_DIVISION_MANAGE_STAT
SET
DS_LOCAL = #{local},
DS_GUBUN = #{gubun},
DS_STAFF_NUM = #{staffNum},
DS_TEL = #{tel},
DS_CONDITION = #{condition},
DS_EQUIP_STAT = #{equipStat},
DS_FILEIMG = #{fileImg},
DS_FILE1 = #{file1},
DS_FILE2 = #{file2},
DS_FILE3 = #{file3},
DS_LOGDATE = NOW()
WHERE
DS_PLACE = #{place}
AND DS_NO = #{no}
]]>
</update>
<delete id="delete" parameterType="divMngVO">
<![CDATA[
DELETE
FROM
H3_DIVISION_MANAGE_STAT
WHERE
DS_PLACE = #{place}
AND DS_NO = #{no}
]]>
</delete>
<select id="selectMaxNo" parameterType="divMngVO" resultType="int">
<![CDATA[
SELECT
MAX(DS_NO)
FROM
H3_DIVISION_MANAGE_STAT
WHERE
DS_PLACE = #{place}
]]>
</select>
</mapper>

View File

@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="Ferry">
<resultMap id="ferryResult" type="ferryVO">
<result property="serNo" column="SER_NO" />
<result property="ferryOffice" column="FERRYOFFICE" />
<result property="ferryName" column="FERRYNAME" />
<result property="ferryTon" column="FERRYTON" />
<result property="ferryRoute" column="FERRYROUTE" />
<result property="ferryTime" column="FERRYTIME" />
<result property="ferrySpeedMax" column="FERRYSPEEDMAX" />
<result property="ferrySpeedNor" column="FERRYSPEEDNOR" />
<result property="ferryGuestCnt" column="FERRYGUESTCNT" />
<result property="ferryClueCnt" column="FERRYCLUECNT" />
<result property="runTerm" column="RUNTERM" />
<result property="runCnt" column="RUNCNT" />
<result property="repreName" column="REPRENAME" />
<result property="tel" column="TEL" />
<result property="ferrySosok" column="FERRYSOSOK" />
<result property="sailingDistance" column="SAILINGDISTANCE" />
<result property="sailingDate" column="SAILINGDATE" />
<result property="cooperateNation" column="COOPERATENATION" />
<result property="writer" column="WRITER" />
<result property="creDate" column="CREDATE" />
<result property="logDate" column="LOGDATE" />
<result property="imgFile" column="IMGFILE" />
<result property="comments" column="COMMENTS" />
</resultMap>
<select id="select" parameterType="ferryVO" resultMap="ferryResult">
<![CDATA[
SELECT
*
FROM
TFERRY
WHERE
SER_NO = #{serNo}
]]>
</select>
<select id="selectList" parameterType="divMngSearchVO" resultMap="ferryResult">
<![CDATA[
SELECT
*
FROM
TFERRY
WHERE
FERRYROUTE = #{ferryRoute}
ORDER BY
SER_NO ASC
]]>
</select>
<insert id="insert" parameterType="ferryVO">
<![CDATA[
INSERT INTO TFERRY
(
SER_NO, FERRYOFFICE, FERRYNAME, FERRYTON, FERRYROUTE,
FERRYTIME, FERRYSPEEDMAX, FERRYSPEEDNOR, FERRYGUESTCNT, FERRYCLUECNT,
RUNTERM, RUNCNT, REPRENAME, TEL, FERRYSOSOK,
SAILINGDISTANCE, SAILINGDATE, COOPERATENATION, WRITER, CREDATE,
LOGDATE, IMGFILE, COMMENTS
)
VALUES
(
#{serNo}, #{ferryOffice}, #{ferryName}, #{ferryTon}, #{ferryRoute},
#{ferryTime}, #{ferrySpeedMax}, #{ferrySpeedNor}, #{ferryGuestCnt}, #{ferryClueCnt},
#{runTerm}, #{runCnt}, #{repreName}, #{tel}, #{ferrySosok},
#{sailingDistance}, #{sailingDate}, #{cooperateNation}, #{writer}, TO_CHAR(NOW(), 'YYYYMMDDHH24MISS'),
TO_CHAR(NOW(), 'YYYYMMDDHH24MISS'), #{imgFile}, #{comments}
)
]]>
</insert>
<update id="update" parameterType="ferryVO">
<![CDATA[
UPDATE
TFERRY
SET
FERRYOFFICE = #{ferryOffice},
FERRYNAME = #{ferryName},
FERRYTON = #{ferryTon},
FERRYROUTE = #{ferryRoute},
FERRYTIME = #{ferryTime},
FERRYSPEEDMAX = #{ferrySpeedMax},
FERRYSPEEDNOR = #{ferrySpeedNor},
FERRYGUESTCNT = #{ferryGuestCnt},
FERRYCLUECNT = #{ferryClueCnt},
RUNTERM = #{runTerm},
RUNCNT = #{runCnt},
REPRENAME = #{repreName},
TEL = #{tel},
FERRYSOSOK = #{ferrySosok},
SAILINGDISTANCE = #{sailingDistance},
SAILINGDATE = #{sailingDate},
COOPERATENATION = #{cooperateNation},
LOGDATE = TO_CHAR(NOW(), 'YYYYMMDDHH24MISS'),
IMGFILE = #{imgFile},
COMMENTS = #{comments}
WHERE
SER_NO = #{serNo}
]]>
</update>
<delete id="delete" parameterType="ferryVO">
<![CDATA[
DELETE
FROM
TFERRY
WHERE
SER_NO = #{serNo}
]]>
</delete>
<select id="selectMaxSerNo" parameterType="ferryVO" resultType="int">
<![CDATA[
SELECT
MAX(SER_NO)
FROM
TFERRY
]]>
</select>
</mapper>

View File

@ -0,0 +1,147 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="WeakPlace">
<resultMap id="weakplaceResult" type="weakPlaceVO">
<result property="place1" column="PLACE1" />
<result property="place1str" column="CODENM" />
<result property="wpNo" column="WP_NO" />
<result property="name" column="NAME" />
<result property="location" column="LOCATION" />
<result property="comments" column="COMMENTS" />
<result property="filename1" column="FILENAME1" />
<result property="filename2" column="FILENAME2" />
<result property="writer" column="WRITER" />
<result property="credate" column="CREDATE" />
<result property="logdate" column="LOGDATE" />
</resultMap>
<select id="WeakPlace.select" parameterType="weakPlaceVO" resultMap="weakplaceResult">
<![CDATA[
SELECT
WP.*, C.CODENM
FROM
TWEAKPLACE WP, TCODE C
WHERE
UPPER(WP.PLACE1) = UPPER(C.CODE2)
AND C.CODE1 = 'C001'
AND WP.PLACE1 = #{place1}
AND WP.WP_NO = #{wpNo}
]]>
</select>
<select id="WeakPlace.selectList" parameterType="weakPlaceSearchVO" resultMap="weakplaceResult">
<![CDATA[
SELECT
WP.*, C.CODENM
FROM
TWEAKPLACE WP, TCODE C
WHERE
UPPER(WP.PLACE1) = UPPER(C.CODE2)
AND C.CODE1 = 'C001'
]]>
<if test="place1 != null and place1 != '' and place1 != 'PS00'">
AND WP.PLACE1 = #{place1}
</if>
<![CDATA[
ORDER BY
WP.PLACE1 ASC, WP.WP_NO ASC
]]>
</select>
<select id="WeakPlace.selectStatsPerPlace" parameterType="hashmap" resultType="hashmap" >
<![CDATA[
SELECT
*
FROM
(
SELECT
'0' AS PLACE1, '전체' AS CODENM_YAK, COUNT(*) AS CNT
FROM
TWEAKPLACE
UNION
SELECT
C.CODE2, C.CODENM_YAK, COUNT(WP.WP_NO) AS CNT
FROM
TCODE C LEFT JOIN TWEAKPLACE WP ON UPPER(C.CODE2) = UPPER(WP.PLACE1)
WHERE
C.CODE1 = 'C001'
AND UPPER(C.CODE2) IN
]]>
<foreach collection="placeList" item="item" index="index" separator="," open="(" close=")">
UPPER(#{item})
</foreach>
<![CDATA[
GROUP BY
C.CODE2, C.CODENM_YAK
)
ORDER BY
UPPER(PLACE1) ASC
]]>
</select>
<select id="selectMaxWpNo" parameterType="String" resultType="int">
<![CDATA[
SELECT
COALESCE(WP_NO, 0)
FROM
(
SELECT
WP_NO
FROM
TWEAKPLACE
WHERE
1=1
AND PLACE1 = #{_parameter}
ORDER BY WP_NO DESC
)
WHERE
ROWNUM = 1
]]>
</select>
<insert id="insert" parameterType="weakPlaceVO">
<![CDATA[
INSERT
INTO TWEAKPLACE
(
PLACE1, WP_NO, NAME, LOCATION, COMMENTS,
FILENAME1, FILENAME2, WRITER, CREDATE, LOGDATE
)
VALUES
(
#{place1}, #{wpNo}, #{name}, #{location}, #{comments},
#{filename1}, #{filename2}, #{writer}, TO_CHAR(NOW(), 'YYYYMMDDHH24MISS'), NULL
)
]]>
</insert>
<update id="update" parameterType="weakPlaceVO">
<![CDATA[
UPDATE
TWEAKPLACE
SET
NAME = #{name},
LOCATION = #{location},
COMMENTS = #{comments},
FILENAME1 = #{filename1},
FILENAME2 = #{filename2},
LOGDATE = TO_CHAR(NOW(), 'YYYYMMDDHH24MISS')
WHERE
PLACE1 = #{place1}
AND WP_NO = #{wpNo}
]]>
</update>
<delete id="delete" parameterType="weakPlaceVO">
<![CDATA[
DELETE
FROM
TWEAKPLACE
WHERE
PLACE1 = #{place1}
AND WP_NO = #{wpNo}
]]>
</delete>
</mapper>

View File

@ -54,15 +54,15 @@
<typeAlias alias="eduVO" type="kcg.faics.fa.vo.EduVO"/>
<typeAlias alias="eduSearchVO" type="kcg.faics.fa.vo.EduSearchVO"/>
<!-- kcg.faics.target -->
<typeAlias alias="weakPlaceVO" type="kcg.faics.target.vo.WeakPlaceVO"/>
<typeAlias alias="weakPlaceSearchVO" type="kcg.faics.target.vo.WeakPlaceSearchVO" />
<typeAlias alias="corpVO" type="kcg.faics.target.vo.CorpVO"/>
<typeAlias alias="corpSearchVO" type="kcg.faics.target.vo.CorpSearchVO" />
<typeAlias alias="divMngVO" type="kcg.faics.target.vo.DivMngVO"/>
<typeAlias alias="divMngSearchVO" type="kcg.faics.target.vo.DivMngSearchVO" />
<typeAlias alias="ferryVO" type="kcg.faics.target.vo.FerryVO"/>
<typeAlias alias="ferrySearchVO" type="kcg.faics.target.vo.FerrySearchVO" />
<!-- kcg.faics.tg -->
<typeAlias alias="weakPlaceVO" type="kcg.faics.tg.vo.WeakPlaceVO"/>
<typeAlias alias="weakPlaceSearchVO" type="kcg.faics.tg.vo.WeakPlaceSearchVO" />
<typeAlias alias="corpVO" type="kcg.faics.tg.vo.CorpVO"/>
<typeAlias alias="corpSearchVO" type="kcg.faics.tg.vo.CorpSearchVO" />
<typeAlias alias="divMngVO" type="kcg.faics.tg.vo.DivMngVO"/>
<typeAlias alias="divMngSearchVO" type="kcg.faics.tg.vo.DivMngSearchVO" />
<typeAlias alias="ferryVO" type="kcg.faics.tg.vo.FerryVO"/>
<typeAlias alias="ferrySearchVO" type="kcg.faics.tg.vo.FerrySearchVO" />
<!-- kcg.faics.admin -->
<typeAlias alias="logSearchVO" type="kcg.faics.admin.vo.LogSearchVO" />