diff --git a/src/main/java/cokr/xit/fims/cmmn/pdf/ExtractText.java b/src/main/java/cokr/xit/fims/cmmn/pdf/ExtractText.java index 1fcd5d3b..0b4e3ba2 100644 --- a/src/main/java/cokr/xit/fims/cmmn/pdf/ExtractText.java +++ b/src/main/java/cokr/xit/fims/cmmn/pdf/ExtractText.java @@ -25,7 +25,7 @@ public class ExtractText { e.printStackTrace(); } - String[] textArr = summaryText.split("\r\n"); + String[] textArr = summaryText.split("\r?\n|\r"); for(int i=0; i < textArr.length; i++) { boolean isNumber = Pattern.matches(REGEXP_PATTERN_NUMBER, textArr[i]); diff --git a/src/main/java/cokr/xit/fims/crdn/service/ImportService.java b/src/main/java/cokr/xit/fims/crdn/service/ImportService.java index ff221469..f595e5a2 100644 --- a/src/main/java/cokr/xit/fims/crdn/service/ImportService.java +++ b/src/main/java/cokr/xit/fims/crdn/service/ImportService.java @@ -2,6 +2,8 @@ package cokr.xit.fims.crdn.service; import java.util.List; +import cokr.xit.foundation.data.DataObject; + /**외부 연계 파일에서 단속자료를 추출하여 등록하는 서비스 * @author mjkhan */ @@ -11,4 +13,10 @@ public interface ImportService { * @return 저장된 정보수 */ int createCrdns(List interfaceSequences); + + /** 장비 연계 파일로 단속자료를 생성한다. + * @param dataObject 연계 파일 정보 + * @return 저장 여부 + */ + boolean createCrdnByEquipmentLinkFile(String entType, List linkFileInfoList); } \ No newline at end of file diff --git a/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnServiceBean.java b/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnServiceBean.java index 1e25cb73..43daa8d8 100644 --- a/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnServiceBean.java +++ b/src/main/java/cokr/xit/fims/crdn/service/bean/CrdnServiceBean.java @@ -20,6 +20,7 @@ import cokr.xit.fims.crdn.dao.CrdnInstMapper; import cokr.xit.fims.crdn.dao.CrdnListMapper; import cokr.xit.fims.crdn.dao.CrdnUpdtMapper; import cokr.xit.fims.crdn.dao.GlobalStngMapper; +import cokr.xit.fims.crdn.dao.ImportMapper; import cokr.xit.fims.crdn.service.CrdnService; import cokr.xit.fims.cvlc.dao.CrdnCvlcptMapper; import cokr.xit.fims.cvlc.service.bean.CrdnCvlcptMainBean; @@ -51,6 +52,12 @@ public class CrdnServiceBean extends AbstractServiceBean implements CrdnService @Resource(name="fileBean") private FileBean fileBean; + @Resource(name="importBean") + private ImportBean importBean; + + @Resource(name="importMapper") + private ImportMapper importMapper; + @Resource(name="crdnStngBean") protected CrdnStngBean crdnStngBean; diff --git a/src/main/java/cokr/xit/fims/crdn/service/bean/ImportBean.java b/src/main/java/cokr/xit/fims/crdn/service/bean/ImportBean.java index 40150cb6..da6f62dd 100644 --- a/src/main/java/cokr/xit/fims/crdn/service/bean/ImportBean.java +++ b/src/main/java/cokr/xit/fims/crdn/service/bean/ImportBean.java @@ -174,6 +174,27 @@ public class ImportBean extends AbstractComponent { .toList(); } + /**단속 정보에 차량 정보를 설정한다. + * @param crdns + * @param basicInfoMap + */ + public void setVehicleInfo(List crdns) { + Map carModelMap = importMapper.selectCarMdl(); + BiFunction getCarModel = (vhctyAsortCd, mxmmLdg) -> { + if (isEmpty(vhctyAsortCd)) return null; + + if ("3".equals(vhctyAsortCd)) { + int weight = toInt(mxmmLdg); + if (weight < 1) return null; + + vhctyAsortCd = weight <= 4000 ? "3-1" : "3-2"; + } + return carModelMap.get(vhctyAsortCd); + }; + + setVehicleInfo(crdns, getCarModel); + } + /**단속 정보에 차량 정보를 설정한다. * @param crdns * @param basicInfoMap diff --git a/src/main/java/cokr/xit/fims/crdn/service/bean/ImportServiceBean.java b/src/main/java/cokr/xit/fims/crdn/service/bean/ImportServiceBean.java index 2068dde1..e7a9049d 100644 --- a/src/main/java/cokr/xit/fims/crdn/service/bean/ImportServiceBean.java +++ b/src/main/java/cokr/xit/fims/crdn/service/bean/ImportServiceBean.java @@ -14,6 +14,7 @@ import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.service.CrdnService; import cokr.xit.fims.crdn.service.ImportService; import cokr.xit.foundation.component.AbstractServiceBean; +import cokr.xit.foundation.data.DataObject; import cokr.xit.interfaces.smg.Petition; import cokr.xit.interfaces.smg.service.bean.SmgReceiverBean; @@ -62,4 +63,18 @@ public class ImportServiceBean extends AbstractServiceBean implements ImportServ return 0; } + + @Override + public boolean createCrdnByEquipmentLinkFile(String entType, List linkFileInfoList) { + + Crdn crdn = new Crdn(); + + if(entType.equals("이노")) { + + + } + + return true; + } + } \ No newline at end of file diff --git a/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java b/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java index bfad523e..a3c134e4 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn05Controller.java @@ -32,6 +32,7 @@ import cokr.xit.fims.crdn.parsing.Ino; import cokr.xit.fims.crdn.parsing.Knl; import cokr.xit.fims.crdn.service.CrdnService; import cokr.xit.fims.crdn.service.CrdnStngService; +import cokr.xit.fims.crdn.service.ImportService; import cokr.xit.foundation.data.DataObject; /**단속 자료 등록 서비스 웹 컨트롤러.
@@ -50,12 +51,16 @@ public class Crdn05Controller extends ApplicationController { getFileRegistrationScreen = "/020/info.do", getCrdnFileListFromEquipmentEnterprise = "/020/list.do", removeLinkFile = "/020/remove.do", + createCrdnByLinkFile = "/020/create.do", getManualRegistrationScreen = "/030/info.do", createCrdnDataByManual = "/030/create.do" ; } + @Resource(name="importService") + private ImportService importService; + @Resource(name="crdnService") private CrdnService crdnService; @@ -224,6 +229,31 @@ public class Crdn05Controller extends ApplicationController { return mav; } + + /**단속 연계 파일로 단속자료를 생성한다. + * @param entType 장비업체 유형, linkFileInfos 연계파일정보 + * @return jsonView + *
 {
+	 *     "saved": 등록되었으면 true, 그렇지 않으면 false
+	 * }
+ */ + public ModelAndView createCrdnByLinkFile(String entType, String[] linkFileInfos) { + ModelAndView mav = new ModelAndView("jsonView"); + boolean saved = false; + + List linkFileInfoList = new ArrayList(); + for(String linkFileInfo : linkFileInfos) { + linkFileInfoList.add(fromJson(linkFileInfo, DataObject.class)); + } + + saved = importService.createCrdnByEquipmentLinkFile(entType, linkFileInfoList); + + mav.addObject("saved", saved); + return mav; + } + + + /**단속자료 수기 등록 팝업화면을 반환한다. * @param * @return fims/crdn/crdn05030-info @@ -307,7 +337,7 @@ public class Crdn05Controller extends ApplicationController { } Map nonQueryRequest = new HashMap(); crdn.setCvlcptLinkYn("N"); - saved = crdnService.create(nonQueryRequest , crdn, fileInfoList); + saved = crdnService.create(nonQueryRequest, crdn, fileInfoList); return new ModelAndView("jsonView") diff --git a/src/main/java/cokr/xit/fims/task/web/DpvController.java b/src/main/java/cokr/xit/fims/task/web/DpvController.java index 44e269a0..fd207fb8 100644 --- a/src/main/java/cokr/xit/fims/task/web/DpvController.java +++ b/src/main/java/cokr/xit/fims/task/web/DpvController.java @@ -3,6 +3,7 @@ package cokr.xit.fims.task.web; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; @@ -252,6 +253,12 @@ public class DpvController { return super.removeLinkFile(hReq); } + @Override + @PostMapping(name="장애인과태료업무 장비업체 단속파일로 단속자료 생성", value=METHOD_URL.createCrdnByLinkFile) + public ModelAndView createCrdnByLinkFile(String entType, String[] linkFileInfos) { + return super.createCrdnByLinkFile(entType, linkFileInfos); + } + @Override @RequestMapping(name="장애인과태료업무 단속자료 수기 등록 화면", value=METHOD_URL.getManualRegistrationScreen) public ModelAndView getManualRegistrationScreen(HttpServletRequest hReq) { diff --git a/src/main/java/cokr/xit/fims/task/web/EcaController.java b/src/main/java/cokr/xit/fims/task/web/EcaController.java index cfddf80d..4f979e1e 100644 --- a/src/main/java/cokr/xit/fims/task/web/EcaController.java +++ b/src/main/java/cokr/xit/fims/task/web/EcaController.java @@ -3,6 +3,7 @@ package cokr.xit.fims.task.web; import javax.servlet.http.HttpServletRequest; import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.multipart.MultipartFile; import org.springframework.web.servlet.ModelAndView; @@ -229,6 +230,12 @@ public class EcaController { return super.removeLinkFile(hReq); } + @Override + @PostMapping(name="전기차과태료업무 장비업체 단속파일로 단속자료 생성", value=METHOD_URL.createCrdnByLinkFile) + public ModelAndView createCrdnByLinkFile(String entType, String[] linkFileInfos) { + return super.createCrdnByLinkFile(entType, linkFileInfos); + } + @Override @RequestMapping(name="전기차과태료업무 단속자료 수기 등록 화면", value=METHOD_URL.getManualRegistrationScreen) public ModelAndView getManualRegistrationScreen(HttpServletRequest hReq) {