FAICS/src/main/java/kcg/faics/inter/web/InternationalController.java

583 lines
21 KiB
Java
Raw Normal View History

2022-03-17 02:42:45 +00:00
package kcg.faics.inter.web;
import java.util.Calendar;
import java.util.Collections;
import java.util.HashMap;
import java.util.LinkedHashMap;
import java.util.List;
import javax.annotation.Resource;
import kcg.faics.cmmn.excel.ExcelExporter;
import kcg.faics.cmmn.service.CodeService;
import kcg.faics.cmmn.vo.CodeVO;
import kcg.faics.inter.service.InternationalService;
import kcg.faics.inter.vo.InternationalSearchVO;
import kcg.faics.inter.vo.InternationalVO;
import kcg.faics.sec.AuthType;
import kcg.faics.sec.LoginUserVO;
import kcg.faics.sec.filter.ReloadableFilterInvocationSecurityMetadataSource;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
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.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.support.SessionStatus;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* @FileName : InternationalController.java
* @Project :
* @Date : 2018. 5. 8.
* @ : Moon
* @ :
* @ :
*/
@Controller
@RequestMapping("/inter")
public class InternationalController {
protected static Logger log = LoggerFactory.getLogger(InternationalController.class);
/**
* .
*/
@Resource(name = "codeService")
private CodeService codeService;
/**
* .
*/
@Resource(name = "internationalService")
private InternationalService internationalService;
/**
* .
* @param arrestSearchVo
* @param model
* @return
* @throws Exception
*/
@RequestMapping(value = "/arrestListView.do")
public String arrestListView(final InternationalSearchVO arrestSearchVo, Model model) throws Exception {
try {
// 공통코드 조회
model = getCommonCode(model);
// 국제어선 나포정보 목록 조회
//arrestList = internationalService.getArrestListAll(arrestSearchVo);
// 국제어선 나포정보 목록 집계정보 조회(단건)
//arrestCntList = internationalService.getArrestListAllCount(arrestSearchVo);
model.addAttribute("listFlag", "init");
} catch (Exception e) {
e.printStackTrace();
}
return "/inter/arrestList.tiles";
}
/**
* .
*
* @param internationalSearchVO
* @param model
* @return
* @throws Exception
*/
@RequestMapping(value = "/arrestList.do")
public String arrestList(@ModelAttribute final InternationalSearchVO internationalSearchVO, Model model) throws Exception {
List<InternationalVO> internationalList = null; // 국제어선나포정보목록
InternationalVO internationalCntList = null; // 국제어선나포정보 집계건수
HashMap<String, Object> resultMap = new HashMap<String, Object>();
try {
// 공통코드 조회
// model = getCommonCode(model);
model.addAttribute("internationalList", null);
model.addAttribute("internationalCntList", null);
// 국제어선 나포정보 목록 조회
internationalList = internationalService.getArrestList(internationalSearchVO);
if (internationalList.size() > 0) {
// 국제어선 나포정보 집계정보 조회
internationalCntList = internationalService.getArrestListCount(internationalSearchVO);
} else {
internationalCntList = null;
}
model.addAttribute("internationalList", internationalList);
model.addAttribute("internationalCntList", internationalCntList);
model.addAttribute("internationalSearchVO", internationalSearchVO);
resultMap.put("msg", "정상으로 조회되었습니다.");
resultMap.put("code", 0);
} catch (Exception e) {
e.printStackTrace();
}
return "/inter/arrestResult";
}
/**
* .
*
* @param model Model
* @return model
* @throws Exception
*/
public Model getCommonCode(final Model model) throws Exception {
List<CodeVO> agencyTypeList = null; // 기관종류
List<CodeVO> placeList = null; // 소속
List<CodeVO> addressList = null; // 주소
List<CodeVO> violateTypeList = null; // 위반내용구분
List<CodeVO> shipTypeList = null; // 선종
List<CodeVO> shipMentList = null; // 선적
List<CodeVO> shipQualityList = null; // 선질
List<CodeVO> shipProcTypeList = null; // 선박처리
List<CodeVO> invasionTypeList = null; // 침범유형
List<CodeVO> woDetentionTypeList = null; // 무혐의불구속
List<CodeVO> marginPaymentYnList = null; // 범죄유형
//List<CodeVO> foreignCrew = null; // 외국선원
List<CodeVO> transportation = null; // 외국선원
List<CodeVO> itemTest = null; // 밀수입 품목
List<CodeVO> smugglingName = null; // 밀수출 품목
List<CodeVO> remarksList = null;
List<CodeVO> aviolentcrime = null;// 강력범죄
List<CodeVO> violentcrime = null; // 폭력범죄
List<CodeVO> intelligentcrime = null; // 지능범죄
List<CodeVO> theftcrime = null; // 절도범죄
List<CodeVO> directSmuggling = null; // 직접밀입국 이동수단
List<CodeVO> speciallaw = null;
List<CodeVO> ar01List = null; // 범죄유형_해양국경관리
List<CodeVO> ar02List = null; // 범죄유형_통상질서교란
List<CodeVO> ar03List = null; // 범죄유형_국입산업보호
List<CodeVO> ar04List = null; // 범죄유형_국민사회안전
List<CodeVO> ar05List = null; // 범죄유형_외국인관련범죄
LoginUserVO loginUserVo = new LoginUserVO();
try {
if (AuthType.LOCAL_HEADQUARTERS == loginUserVo.getAuthType()) {
placeList = codeService.getPlace1SubList(loginUserVo.getPlace1());
} else {
placeList = codeService.getPlace1List(false);
}
ar01List = codeService.getCodeValues("AR01", "");
ar02List = codeService.getCodeValues("AR02", "");
ar03List = codeService.getCodeValues("AR03", "");
ar04List = codeService.getCodeValues("AR04", "");
ar05List = codeService.getCodeValues("AR05", "");
agencyTypeList = codeService.getCodeValues("T010", ""); /* 검거기관대분류 */
addressList = internationalService.getAddressAreaList("0000"); /* 주소(특별광역시도) */
violateTypeList = codeService.getCodeValues("T003", ""); /* 위반내용구분 */
shipTypeList = codeService.getCodeValues("FA81", ""); /* 선종 조회 */
shipMentList = codeService.getCodeValues("SSRR", ""); /* 선적 */
shipQualityList = codeService.getCodeValues("T004", ""); /* 선질 */
shipProcTypeList = codeService.getCodeValues("T007", ""); /* 선박처리 */
invasionTypeList = codeService.getCodeValues("T006", ""); /* 선박처리 */
woDetentionTypeList = codeService.getCodeValues("T005", ""); /* 선박처리 */
/*marginPaymentYnList = codeService.getCodeValues("T008", ""); 담보금납부여부 */
marginPaymentYnList = codeService.getCodeValues("T009", ""); /* 범죄유형 */
//foreignCrew = codeService.getCodeValues("CREW", ""); // 외국선원
transportation = codeService.getCodeValues("TRAN", ""); // 외국선원
itemTest = codeService.getCodeValues("TES1", ""); // 밀수입 품목
smugglingName = codeService.getCodeValues("TES2", ""); // 밀수입 품목
remarksList = codeService.getCodeValues("REMA", ""); // 비고
aviolentcrime = codeService.getCodeValues("AVIO", ""); // 강력범죄
violentcrime = codeService.getCodeValues("VIOL", ""); // 폭력범죄
intelligentcrime = codeService.getCodeValues("INTE", ""); // 지능범쥐
theftcrime = codeService.getCodeValues("THEF", ""); // 절도범죄
speciallaw = codeService.getCodeValues("SPEC", ""); // 특별법범
directSmuggling = codeService.getCodeValues("DIRT", ""); // 직접밀입국 이동수단
Collections.reverse(marginPaymentYnList);
//Collections.sort(marginPaymentYnList, comparator);
//CodeVO codeVO = marginPaymentYnList.get(1);
//marginPaymentYnList.set(1, marginPaymentYnList.get(0));
//marginPaymentYnList.set(0, codeVO);
model.addAttribute("ar01List", ar01List);
model.addAttribute("ar02List", ar02List);
model.addAttribute("ar03List", ar03List);
model.addAttribute("ar04List", ar04List);
model.addAttribute("ar05List", ar05List);
model.addAttribute("placeList", placeList);
model.addAttribute("addressList", addressList);
model.addAttribute("shipQualityList", shipQualityList);
model.addAttribute("shipMentList", shipMentList);
model.addAttribute("shipTypeList", shipTypeList);
model.addAttribute("violateTypeList", violateTypeList);
model.addAttribute("agencyTypeList", agencyTypeList);
model.addAttribute("shipProcTypeList", shipProcTypeList);
model.addAttribute("invasionTypeList", invasionTypeList);
model.addAttribute("woDetentionTypeList", woDetentionTypeList);
model.addAttribute("marginPaymentYnList", marginPaymentYnList);
log.trace("@@@@@@@ㅇㅅㅇㅅㅇㅅㅇㅅㅇㅅㅇㄴㅅㅇㅅㄴㅇㅅㄴㅇㅅㅇㅅㅇㅅㅇㅅㅇㅅㅇㅅㅇㅅㅇㅅㅇㅅㅇ");
//model.addAttribute("foreignCrew", foreignCrew);
model.addAttribute("transportation", transportation);
model.addAttribute("itemTest", itemTest);
model.addAttribute("smugglingName", smugglingName);
model.addAttribute("remarksList", remarksList);
model.addAttribute("aviolentcrime", aviolentcrime);
model.addAttribute("violentcrime", violentcrime);
model.addAttribute("intelligentcrime", intelligentcrime);
model.addAttribute("theftcrime", theftcrime);
model.addAttribute("speciallaw", speciallaw);
model.addAttribute("directSmuggling", directSmuggling);
} catch (Exception e) {
e.printStackTrace();
}
return model;
}
/**
* / .
*
* @param internationalVO
* @param model
* @return
* @throws Exception
*/
@RequestMapping(value = "/arrestAdd.do")
public String arrestAdd(final InternationalVO internationalVO, Model model) throws Exception {
try {
// 공통코드 조회
model = getCommonCode(model);
model.addAttribute("regFlag", "create");
} catch (Exception e) {
e.printStackTrace();
}
return "/inter/arrestAdd.tiles";
}
/**
* .
*
* @param area
* @param internationalVO
* @param model
* @return
* @throws Exception
*/
@RequestMapping(value = "/getAddressAreaList.do")
public String getAddressAreaList(@RequestParam("area") final String area,
final InternationalVO internationalVO, final Model model) throws Exception {
HashMap<String, Object> result = new HashMap<String, Object>();
List<CodeVO> addressCityList = null;
try {
/* 특별광역시&도청 목록조회 */
addressCityList = internationalService.getAddressAreaList(area);
model.addAttribute("addressCityList", addressCityList);
result.put("result", "OK");
result.put("msg", "시목록 조회성공");
} catch (Exception e) {
e.printStackTrace();
}
return "/inter/arrestAdd.tiles";
}
/**
* .
*
* @param codeVO
* VO
* @return
* @throws Exception
*
*/
@ResponseBody
@RequestMapping("/getAddressList.json")
public HashMap<String, Object> getAddressList(final CodeVO codeVO)
throws Exception {
HashMap<String, Object> result = new HashMap<String, Object>();
List<CodeVO> addressCityList = null;
String area = codeVO.getCode1();
/* 특별광역시&도청 목록조회 */
addressCityList = internationalService.getAddressAreaList(area);
result.put("data", addressCityList);
// model.addAttribute("addressCityList", addressCityList);
return result;
}
/**
* .
*
* @param internationalVO
*
* @param bindingResult
*
* @param model
*
* @param status
*
* @return
* @throws Exception
*
*/
@RequestMapping(value = "/arrestInsert.do", method = RequestMethod.POST)
public String arrestTempInsert(
@ModelAttribute("internationalVO") final InternationalVO internationalVO,
final BindingResult bindingResult, final Model model,
final SessionStatus status) throws Exception {
HashMap<String, Object> result = new HashMap<String, Object>();
try {
internationalVO.setDelYn("N"); // 삭제여부
/* 국제어선 나포정보 등록 */
result = internationalService.insert(internationalVO);
} catch (Exception e) {
e.printStackTrace();
}
if ((Integer) result.get("result") != 1) {
return "redirect:/inter/arrestAdd.do";
}
return "redirect:/inter/arrestListView.do";
}
/**
* .
* @param internationalVO
*
* @param bindingResult
*
* @param model
*
* @param status
*
* @return
* @throws Exception
*
*/
@RequestMapping(value = "/arrestUpdate.do", method = RequestMethod.POST)
public String arrestUpdate(@ModelAttribute("internationalVO") final InternationalVO internationalVO,
final BindingResult bindingResult, final Model model, final SessionStatus status) throws Exception {
HashMap<String, Object> result = new HashMap<String, Object>();
try {
internationalVO.setDelYn("N"); // 삭제여부
result = internationalService.update(internationalVO);
} catch (Exception e) {
e.printStackTrace();
}
if ((Integer) result.get("result") != 1) {
return "redirect:/inter/arrestAdd.do";
}
return "redirect:/inter/arrestListView.do";
}
/**
* .
* @param internationalVO
*
* @param bindingResult
*
* @param model
*
* @param status
*
* @return
* @throws Exception
*
*/
@RequestMapping(value = "/arrestDelete.do", method = RequestMethod.POST)
public String arrestDelete(@ModelAttribute("internationalVO") final InternationalVO internationalVO,
final BindingResult bindingResult, final Model model, final SessionStatus status) throws Exception {
HashMap<String, Object> result = new HashMap<String, Object>();
try {
internationalVO.setDelYn("Y"); // 삭제여부
result = internationalService.delete(internationalVO);
} catch (Exception e) {
e.printStackTrace();
}
if ((Integer) result.get("result") != 1) {
return "redirect:/inter/arrestAdd.do";
}
return "redirect:/inter/arrestListView.do";
}
/**
* .
*
* @param internationalVO
* @param model
* @return
* @throws Exception
*/
@RequestMapping("/arrestView.do")
public String arrestView(final InternationalVO internationalVO, Model model) throws Exception {
try {
// 국제어선 나포정보 단건조회
InternationalVO result = internationalService.select(internationalVO);
// 공통코드 조회
model = getCommonCode(model);
model.addAttribute("internationalVO", result);
model.addAttribute("regFlag", "modify");
} catch (Exception e) {
e.printStackTrace();
}
return "/inter/arrestAdd.tiles";
}
/**
*
* @param searchVO
* @param model Model
* @return
*/
@RequestMapping("/arrestExcelDownload.do")
public String arrestExcelDownload(final InternationalSearchVO searchVO, final Model model) throws Exception {
Calendar cal = Calendar.getInstance();
InternationalVO arrestCntList = null;
String title = cal.get(cal.YEAR) + "년 국제어선 검거현황";
List<InternationalVO> arrestList = internationalService.getArrestListExcel(searchVO);
if (arrestList.size() > 0) {
arrestCntList = internationalService.getArrestListCount(searchVO);
LinkedHashMap<String, String> header = new LinkedHashMap<String, String>();
header.put("arrestDate", "검거일시");
header.put("addrStr", "검거관서");
header.put("violateType", "사건개요");
header.put("violateDetail", "검거장소");
/*header.put("invasion3", "침범유형(영해)");
header.put("invasion4", "침범유형(검거장소)");
header.put("invasion1", "침범유형(검거장소)");
header.put("invasion2", "침범유형(검거장소)");
header.put("specBatlYn", "침범유형(검거장소)");*/
header.put("nllYn", "적용법조");
header.put("agencyGuardStr", "검거기관");
/*header.put("agencyVessel", "함정");*/
header.put("leadDistance", "검거인원(내국인)");
header.put("leadHour", "검거인원(외국인국적)");
header.put("leadMinute", "검거인원(비자종류)");
header.put("capName", "밀입증(무사증)_알선,운송");
header.put("capChnName", "밀입증(무사증)_불법이동자");
header.put("transportation", "밀입증(무사증)_이동수단");
header.put("otherMeansOfTransport", "밀입증(무사증)_기타이동수단");
header.put("arrangeTransport", "밀입국(직접밀입국)_알선,운송");
header.put("illegalMover", "밀입국(직접밀입국)_불법이동자");
header.put("directSmuggling", "밀입국(직접밀입국)_이동수단");
header.put("otherMeansOfDirect", "밀입국(직접밀입국)_기타이동수단");
header.put("foreignCrew", "밀입국(외국선원)");
header.put("itemTest", "밀수입(품목)");
header.put("quantity", "밀수입(수량kg)");
header.put("priceMoney", "밀수입(금액)");
header.put("targetCountry", "밀수입(대상국가)");
header.put("escapeChina", "밀출국(중국)_도피");
header.put("employmentChina", "밀출국(중국)_도피");
header.put("etcChina", "밀출국(중국)_도피");
header.put("escapeJapan", "밀출국(일본)_도피");
header.put("employmentJapan", "밀출국(일본)_도피");
header.put("etcJapan", "밀출국(일본)_도피");
header.put("escapeCountries", "밀출국(기타국가)_도피");
header.put("employmentCountries", "밀출국(기타국가)_도피");
header.put("etcCountries", "밀출국(기타국가)_도피");
header.put("smugglingName", "밀수출(품목)");
header.put("smugglingChn", "밀수출(수량kg)");
header.put("smugglingAge", "밀수출(금액)");
header.put("smugglingWorld", "밀수출(대상국가)");
header.put("spilltarget", "산업기술유출(유출대상)");
header.put("amountofcompensation", "산업기술유출(보상금액)");
header.put("intelProperty", "지식재산권(상표법_대상)");
header.put("quenching", "불법위폐,외국환거래(무등록외환)");
header.put("foreignCurrency", "불법위폐,외국환거래(외화밀반출)");
header.put("foreigncurrencyamount", "불법위폐,외국환거래(금액)");
header.put("noInsurance", "외국인인권보호(보험미가입)");
header.put("alienDamage", "외국인인권보호(외국인피해)");
header.put("originIndicationViolation", "원산지표시위반");
header.put("inhibitionOfSocialSafety", "사회 등 안전저해");
header.put("sailorPeople", "불법체류(선원)");
header.put("seamanOutside", "불법체류(선원외)");
header.put("drugadministration", "기타(마약)_투약");
header.put("carryonofdrugs", "기타(마약)_소지운반");
header.put("drugsale", "기타(마약)_판매");
header.put("drugitem", "기타(마약)_품목");
header.put("drugquantity", "기타(마약)_수량");
header.put("drugamount", "기타(마약)_금액");
header.put("aviolentcrime", "기타(외국인관련범죄)_강력범죄");
header.put("violentcrime", "기타(외국인관련범죄)_폭력범죄");
header.put("intelligentcrime", "기타(외국인관련범죄)_지능범죄");
header.put("theftcrime", "기타(외국인관련범죄)_절도범죄");
header.put("speciallaw", "기타(외국인관련범죄)_특별법범");
header.put("commissionCost", "비고");
arrestCntList.setDetentionTotalCnt(String.valueOf(arrestCntList.getCaptainCount()
+ arrestCntList.getMateCount()
+ arrestCntList.getEngineerCount()
+ arrestCntList.getCrewCount()));
arrestCntList.setSpecBatlYn(String.valueOf(arrestCntList.getSpecBatlCnt()));
arrestCntList.setNllYn(String.valueOf(arrestCntList.getNllCnt()));
arrestCntList.setNoPaymentCnt(String.valueOf(arrestCntList.getNotPayment()));
arrestList.add(0, arrestCntList);
model.addAttribute("excel", new ExcelExporter<InternationalVO>(header, arrestList, title));
model.addAttribute("filename", title);
return "excelView";
} else {
return "";
}
}
}