diff --git a/src/main/java/cokr/xit/fims/FimsApplication.java b/src/main/java/cokr/xit/fims/FimsApplication.java index ef98fcba..30b0c074 100644 --- a/src/main/java/cokr/xit/fims/FimsApplication.java +++ b/src/main/java/cokr/xit/fims/FimsApplication.java @@ -6,9 +6,10 @@ import org.springframework.context.annotation.ImportResource; import cokr.xit.base.ServletCustomizer; import cokr.xit.base.boot.XitBaseApplication; +import cokr.xit.fims.task.TaskMvcConfig; import cokr.xit.foundation.boot.Yml; -@ImportAutoConfiguration({ServletCustomizer.class}) +@ImportAutoConfiguration({ServletCustomizer.class, TaskMvcConfig.class}) @ImportResource("classpath:spring/context-*.xml") public class FimsApplication extends XitBaseApplication { diff --git a/src/main/java/cokr/xit/fims/MainController.java b/src/main/java/cokr/xit/fims/MainController.java index 2aea0872..717eea14 100644 --- a/src/main/java/cokr/xit/fims/MainController.java +++ b/src/main/java/cokr/xit/fims/MainController.java @@ -9,19 +9,20 @@ import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; -import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; import cokr.xit.base.user.ManagedUser; import cokr.xit.base.user.service.UserService; import cokr.xit.fims.mngt.dao.FactionMapper; +import cokr.xit.fims.task.TaskRequestMappingHandlerMapping; import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.web.AbstractController; import cokr.xit.foundation.web.RequestHandlerReader; @Controller public class MainController extends AbstractController { + @Autowired - private RequestMappingHandlerMapping requestHandlers; + private TaskRequestMappingHandlerMapping requestHandlers; @Resource(name="factionMapper") FactionMapper factionMapper; @@ -84,8 +85,32 @@ public class MainController extends AbstractController { @RequestMapping(name="기능 URL 선택", value="/urls.do") public ModelAndView getURLs(boolean multiple) { List urls = new RequestHandlerReader().read(requestHandlers); + attachTaskPrefixName(urls); + return new ModelAndView("select-url") .addObject("multiple", multiple) .addObject("urls", toJson(urls)); } + + @SuppressWarnings("unchecked") + private void attachTaskPrefixName(List list) { + for(DataObject item : list) { + String name = item.string("name"); + String url = item.string("url"); + if(!name.equals(url)) { + switch (url) { + case "/BPV": item.set("name","전용차로과태료업무 "+name); + case "/PVS": item.set("name","주정차위반과태료업무 "+name); + case "/DPV": item.set("name","장애인주차위반과태료업무 "+name); + case "/ECA": item.set("name","전기차주차위반과태료업무 "+name); + case "/PES": item.set("name","밤샘주차위반과태료업무 "+name); + case "/DVS": item.set("name","미세먼지과태료업무 "+name); + } + } + if(item.get("children") != null) { + attachTaskPrefixName((List) item.get("children")); + } + } + } + } \ No newline at end of file diff --git a/src/main/java/cokr/xit/fims/crdn/web/Crdn07Controller.java b/src/main/java/cokr/xit/fims/crdn/web/Crdn07Controller.java index f83be300..30791869 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn07Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn07Controller.java @@ -5,6 +5,8 @@ import java.util.Map; import javax.annotation.Resource; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import cokr.xit.base.code.CommonCode; @@ -15,11 +17,14 @@ import cokr.xit.fims.cmmn.service.bean.StngBean; import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.Team; import cokr.xit.fims.crdn.service.CrdnStngService; +import cokr.xit.fims.task.Task; /**단속팀 관리 서비스 웹 컨트롤러.
* {웹 컨텍스트}/crdn/crdn07 로 접근할 수 있다. * @author leebj */ +@Controller +@RequestMapping(name="단속팀 관리", value=Crdn07Controller.CLASS_URL) public class Crdn07Controller extends ApplicationController { public static final String CLASS_URL = "/crdn/crdn07"; @@ -47,6 +52,7 @@ public class Crdn07Controller extends ApplicationController { /** 단속팀 관리 메인화면을 연다. * @return fims/crdn/crdn07010-main */ + @RequestMapping(name="단속팀 관리 메인", value=METHOD_URL.crackdownTeamManagementMain) public ModelAndView crackdownTeamManagementMain() { ModelAndView mav = new ModelAndView(); mav.setViewName("fims/crdn/crdn07010-main"); @@ -68,6 +74,8 @@ public class Crdn07Controller extends ApplicationController { * @param crdn 단속 * @return jsonView */ + @Task({"PVS","BPV"}) + @RequestMapping(name="단속팀 목록 조회", value=METHOD_URL.getTeamList) public ModelAndView getTeamList(CrdnQuery query) { ModelAndView mav = new ModelAndView("jsonView"); @@ -82,6 +90,8 @@ public class Crdn07Controller extends ApplicationController { * @param crdn 단속 * @return jsonView */ + @Task({"PVS","BPV"}) + @RequestMapping(name="비사용 단속팀 목록 조회", value=METHOD_URL.getRemovedTeamList) public ModelAndView getRemovedTeamList(CrdnQuery query) { ModelAndView mav = new ModelAndView("jsonView"); @@ -100,6 +110,8 @@ public class Crdn07Controller extends ApplicationController { * "saved": 저장되었으면 true, 그렇지 않으면 false * } */ + @Task({"PVS","BPV"}) + @RequestMapping(name="단속팀 정보 삭제", value=METHOD_URL.removeTeamInfo) public ModelAndView removeTeamInfo(String teamId) { boolean saved = false; @@ -121,6 +133,8 @@ public class Crdn07Controller extends ApplicationController { * "saved": 저장되었으면 true, 그렇지 않으면 false * } */ + @Task({"PVS","BPV"}) + @RequestMapping(name="단속팀 정보 저장", value=METHOD_URL.saveTeamInfo) public ModelAndView saveTeamInfo(Team team) { boolean saved = false; @@ -143,6 +157,8 @@ public class Crdn07Controller extends ApplicationController { * @param crdn 단속 * @return jsonView */ + @Task({"PVS","BPV"}) + @RequestMapping(name="단속팀 정보 조회", value=METHOD_URL.getTeamInfo) public ModelAndView getTeamInfo(String teamId) { ModelAndView mav = new ModelAndView("jsonView"); mav.addObject("teamInfo", crdnStngService.getTeamInfo(teamId)); diff --git a/src/main/java/cokr/xit/fims/crdn/web/Crdn08Controller.java b/src/main/java/cokr/xit/fims/crdn/web/Crdn08Controller.java index 7c3a5739..02e61b87 100644 --- a/src/main/java/cokr/xit/fims/crdn/web/Crdn08Controller.java +++ b/src/main/java/cokr/xit/fims/crdn/web/Crdn08Controller.java @@ -8,6 +8,8 @@ import java.util.Map; import javax.annotation.Resource; import org.apache.poi.ss.usermodel.CellStyle; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.servlet.ModelAndView; import com.fasterxml.jackson.core.type.TypeReference; @@ -23,12 +25,15 @@ import cokr.xit.fims.cmmn.CmmnUtil; import cokr.xit.fims.crdn.CrdnQuery; import cokr.xit.fims.crdn.ExmptnVhcl; import cokr.xit.fims.crdn.service.CrdnStngService; +import cokr.xit.fims.task.Task; import cokr.xit.foundation.data.DataObject; /**면제차량 관리 서비스 웹 컨트롤러.
* {웹 컨텍스트}/crdn/crdn08 로 접근할 수 있다. * @author leebj */ +@Controller +@RequestMapping(name="면제차량 관리", value=Crdn08Controller.CLASS_URL) public class Crdn08Controller extends ApplicationController { public static final String CLASS_URL = "/crdn/crdn08"; @@ -54,6 +59,7 @@ public class Crdn08Controller extends ApplicationController { /** 면제차량 관리 메인화면을 연다. * @return fims/crdn/crdn08010-main */ + @RequestMapping(name="면제차량 관리", value=METHOD_URL.exemptionVehicleManagementMain) public ModelAndView exemptionVehicleManagementMain() { ModelAndView mav = new ModelAndView(); mav.setViewName("fims/crdn/crdn08010-main"); @@ -69,6 +75,8 @@ public class Crdn08Controller extends ApplicationController { * @param query 면제차량 목록 조회 조건 * @return jsonView */ + @Task("BPV") + @RequestMapping(name="면제차량 목록 조회", value=METHOD_URL.getExemptionVehicleList) public ModelAndView getExemptionVehicleList(CrdnQuery query) { ManagedUser currentUser = (ManagedUser) currentUser().getUser(); @@ -123,6 +131,8 @@ public class Crdn08Controller extends ApplicationController { /**면제차량 상세조회 팝업 화면을 연다.
* @return fims/crdn/crdn08020-info */ + @Task("BPV") + @RequestMapping(name="면제차량 정보 조회", value=METHOD_URL.getExemptionVehicleInfo) public ModelAndView getExemptionVehicleInfo(String exmptnVhclId) { ModelAndView mav = new ModelAndView("fims/crdn/crdn08020-info"); @@ -146,6 +156,8 @@ public class Crdn08Controller extends ApplicationController { * "saved": 저장되었으면 true, 그렇지 않으면 false * } */ + @Task("BPV") + @RequestMapping(name="면제차량 정보 등록", value=METHOD_URL.createExemptionVehicleInfo) public ModelAndView createExemptionVehicleInfo(ExmptnVhcl exmptnVhcl) { ModelAndView mav = new ModelAndView("jsonView"); @@ -171,6 +183,8 @@ public class Crdn08Controller extends ApplicationController { * "saved": 저장되었으면 true, 그렇지 않으면 false * } */ + @Task("BPV") + @RequestMapping(name="면제차량 정보 수정", value=METHOD_URL.updateExemptionVehicleInfo) public ModelAndView updateExemptionVehicleInfo(ExmptnVhcl exmptnVhcl) { ModelAndView mav = new ModelAndView("jsonView"); @@ -196,6 +210,8 @@ public class Crdn08Controller extends ApplicationController { * "saved": 저장되었으면 true, 그렇지 않으면 false * } */ + @Task("BPV") + @RequestMapping(name="면제차량 정보 삭제", value=METHOD_URL.removeExemptionVehicleInfo) public ModelAndView removeExemptionVehicleInfo(ExmptnVhcl exmptnVhcl) { ModelAndView mav = new ModelAndView("jsonView"); @@ -215,6 +231,8 @@ public class Crdn08Controller extends ApplicationController { * @param exmptnVhclId 면제차량 ID * @return jsonView */ + @Task("BPV") + @RequestMapping(name="면제차량 이력 조회", value=METHOD_URL.getExemptionVehicleHistoryList) public ModelAndView getExemptionVehicleHistoryList(String exmptnVhclId) { ModelAndView mav = new ModelAndView("fims/crdn/crdn08030-info"); diff --git a/src/main/java/cokr/xit/fims/task/Task.java b/src/main/java/cokr/xit/fims/task/Task.java new file mode 100644 index 00000000..132435fd --- /dev/null +++ b/src/main/java/cokr/xit/fims/task/Task.java @@ -0,0 +1,12 @@ +package cokr.xit.fims.task; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +@Target(ElementType.METHOD) +@Retention(RetentionPolicy.RUNTIME) +public @interface Task { + String[] value(); +} diff --git a/src/main/java/cokr/xit/fims/task/TaskMvcConfig.java b/src/main/java/cokr/xit/fims/task/TaskMvcConfig.java new file mode 100644 index 00000000..71ebc5bc --- /dev/null +++ b/src/main/java/cokr/xit/fims/task/TaskMvcConfig.java @@ -0,0 +1,22 @@ +package cokr.xit.fims.task; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.web.servlet.config.annotation.DelegatingWebMvcConfiguration; +import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; + + +@Configuration +public class TaskMvcConfig extends DelegatingWebMvcConfiguration { + + @Override + protected RequestMappingHandlerMapping createRequestMappingHandlerMapping() { + return new TaskRequestMappingHandlerMapping(); + } + + @Bean + TaskRequestMappingHandlerMapping taskRequestMappingHandlerMapping() { + return new TaskRequestMappingHandlerMapping(); + } + +} diff --git a/src/main/java/cokr/xit/fims/task/TaskRequestMappingHandlerMapping.java b/src/main/java/cokr/xit/fims/task/TaskRequestMappingHandlerMapping.java new file mode 100644 index 00000000..531c68b8 --- /dev/null +++ b/src/main/java/cokr/xit/fims/task/TaskRequestMappingHandlerMapping.java @@ -0,0 +1,64 @@ +package cokr.xit.fims.task; + +import java.lang.reflect.Method; +import java.util.Set; + +import org.springframework.core.annotation.AnnotatedElementUtils; +import org.springframework.lang.Nullable; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.servlet.mvc.method.RequestMappingInfo; +import org.springframework.web.servlet.mvc.method.RequestMappingInfo.BuilderConfiguration; +import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; + +public class TaskRequestMappingHandlerMapping extends RequestMappingHandlerMapping { + + @Override + @Nullable + public RequestMappingInfo getMappingForMethod(Method method, Class handlerType) { + + RequestMappingInfo info = super.getMappingForMethod(method, handlerType); + + Task task = AnnotatedElementUtils.findMergedAnnotation(method, Task.class); + + if(task != null && info != null) { + return createRequestMappingInfo(task, method, info); + } else { + return info; + } + + } + + protected RequestMappingInfo createRequestMappingInfo(Task task, Method method, + RequestMappingInfo info) { + + String[] prefix = task.value(); + + RequestMapping rm = AnnotatedElementUtils.findMergedAnnotation(method, RequestMapping.class); + + Set olds0 = info.getPatternValues(); + String[] olds = olds0.toArray(new String[olds0.size()]); + String[] news = new String[prefix.length*olds.length]; + for(int i=0;i < prefix.length; i++) { + for(int j=0;j < olds.length; j++) { + String newPattern = "/"+prefix[i]+olds[j]; + news[i*(olds.length)+j] = newPattern; + } + } + + BuilderConfiguration bc = new RequestMappingInfo.BuilderConfiguration(); + bc.setContentNegotiationManager(super.getContentNegotiationManager()); + bc.setPatternParser(super.getPatternParser()); + + return RequestMappingInfo + .paths(super.resolveEmbeddedValuesInPatterns(news)) + .mappingName(rm.name()) + .methods(rm.method()) + .params(rm.params()) + .headers(rm.headers()) + .consumes(rm.consumes()) + .produces(rm.produces()) + .options(bc) + .build(); + + } +} diff --git a/src/main/java/cokr/xit/fims/task/web/BpvController.java b/src/main/java/cokr/xit/fims/task/web/BpvController.java index 8e977037..d529bf53 100644 --- a/src/main/java/cokr/xit/fims/task/web/BpvController.java +++ b/src/main/java/cokr/xit/fims/task/web/BpvController.java @@ -10,8 +10,6 @@ import org.springframework.web.servlet.ModelAndView; import cokr.xit.fims.cmmn.ftp.RemoteSystemInfo; import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.CrdnQuery; -import cokr.xit.fims.crdn.ExmptnVhcl; -import cokr.xit.fims.crdn.Team; import cokr.xit.fims.crdn.receive.eqpmnt.LayoutDescriptor; import cokr.xit.fims.cvlc.CrdnCvlcpt; import cokr.xit.fims.excl.CrdnReReg; @@ -355,83 +353,9 @@ public class BpvController { } - @Controller - @RequestMapping(name="전용차로과태료업무 단속팀 관리", value=CLASS_URL+Crdn07Controller.CLASS_URL) - class Crdn07Controller extends cokr.xit.fims.crdn.web.Crdn07Controller { - @Override - @RequestMapping(name="전용차로과태료업무 단속팀 목록 조회", value=METHOD_URL.getTeamList) - public ModelAndView getTeamList(CrdnQuery query) { - return super.getTeamList(query); - } - - @Override - @RequestMapping(name="전용차로과태료업무 비사용 단속팀 목록 조회", value=METHOD_URL.getRemovedTeamList) - public ModelAndView getRemovedTeamList(CrdnQuery query) { - return super.getRemovedTeamList(query); - } - @Override - @RequestMapping(name="전용차로과태료업무 단속팀 정보 삭제", value=METHOD_URL.removeTeamInfo) - public ModelAndView removeTeamInfo(String teamId) { - return super.removeTeamInfo(teamId); - } - @Override - @RequestMapping(name="전용차로과태료업무 단속팀 정보 저장", value=METHOD_URL.saveTeamInfo) - public ModelAndView saveTeamInfo(Team team) { - return super.saveTeamInfo(team); - } - - @Override - @RequestMapping(name="전용차로과태료업무 단속팀 정보 조회", value=METHOD_URL.getTeamInfo) - public ModelAndView getTeamInfo(String teamId) { - return super.getTeamInfo(teamId); - } - - } - - @Controller - @RequestMapping(name="전용차로과태료업무 면제차량 관리", value=CLASS_URL+Crdn08Controller.CLASS_URL) - class Crdn08Controller extends cokr.xit.fims.crdn.web.Crdn08Controller { - - @Override - @RequestMapping(name="전용차로과태료업무 면제차량 목록 조회", value=METHOD_URL.getExemptionVehicleList) - public ModelAndView getExemptionVehicleList(CrdnQuery query) { - return super.getExemptionVehicleList(query); - } - - @Override - @RequestMapping(name="전용차로과태료업무 면제차량 정보 조회", value=METHOD_URL.getExemptionVehicleInfo) - public ModelAndView getExemptionVehicleInfo(String exmptnVhclId) { - return super.getExemptionVehicleInfo(exmptnVhclId); - } - - @Override - @RequestMapping(name="전용차로과태료업무 면제차량 정보 등록", value=METHOD_URL.createExemptionVehicleInfo) - public ModelAndView createExemptionVehicleInfo(ExmptnVhcl exmptnVhcl) { - return super.createExemptionVehicleInfo(exmptnVhcl); - } - - @Override - @RequestMapping(name="전용차로과태료업무 면제차량 정보 수정", value=METHOD_URL.updateExemptionVehicleInfo) - public ModelAndView updateExemptionVehicleInfo(ExmptnVhcl exmptnVhcl) { - return super.updateExemptionVehicleInfo(exmptnVhcl); - } - - @Override - @RequestMapping(name="전용차로과태료업무 면제차량 정보 삭제", value=METHOD_URL.removeExemptionVehicleInfo) - public ModelAndView removeExemptionVehicleInfo(ExmptnVhcl exmptnVhcl) { - return super.removeExemptionVehicleInfo(exmptnVhcl); - } - - @Override - @RequestMapping(name="전용차로과태료업무 면제차량 이력 조회", value=METHOD_URL.getExemptionVehicleHistoryList) - public ModelAndView getExemptionVehicleHistoryList(String exmptnVhclId) { - return super.getExemptionVehicleHistoryList(exmptnVhclId); - } - - } @Controller @RequestMapping(name="전용차로과태료업무 부과제외_부과제외 관리", value=CLASS_URL+Excl01Controller.CLASS_URL) diff --git a/src/main/java/cokr/xit/fims/task/web/CmnController.java b/src/main/java/cokr/xit/fims/task/web/CmnController.java index 6ba18e3c..c660e778 100644 --- a/src/main/java/cokr/xit/fims/task/web/CmnController.java +++ b/src/main/java/cokr/xit/fims/task/web/CmnController.java @@ -177,31 +177,6 @@ public class CmnController { } } - @Controller - @RequestMapping(name="단속팀 관리", value=Crdn07Controller.CLASS_URL) - class Crdn07Controller extends cokr.xit.fims.crdn.web.Crdn07Controller { - /** 단속팀 관리 메인화면을 연다. - * @return fims/crdn/crdn07010-main - */ - @Override - @RequestMapping(name="단속팀 관리 메인", value=METHOD_URL.crackdownTeamManagementMain) - public ModelAndView crackdownTeamManagementMain() { - return super.crackdownTeamManagementMain(); - } - } - - @Controller - @RequestMapping(name="면제차량 관리", value=Crdn08Controller.CLASS_URL) - class Crdn08Controller extends cokr.xit.fims.crdn.web.Crdn08Controller { - /** 면제차량 관리 메인화면을 연다. - * @return fims/crdn/crdn08010-main - */ - @Override - @RequestMapping(name="면제차량 관리 메인", value=METHOD_URL.exemptionVehicleManagementMain) - public ModelAndView exemptionVehicleManagementMain() { - return super.exemptionVehicleManagementMain(); - } - } @Controller @RequestMapping(name="부과제외 관리", value=Excl01Controller.CLASS_URL) diff --git a/src/main/java/cokr/xit/fims/task/web/PvsController.java b/src/main/java/cokr/xit/fims/task/web/PvsController.java index 8722e485..c47465bc 100644 --- a/src/main/java/cokr/xit/fims/task/web/PvsController.java +++ b/src/main/java/cokr/xit/fims/task/web/PvsController.java @@ -10,7 +10,6 @@ import org.springframework.web.servlet.ModelAndView; import cokr.xit.fims.cmmn.ftp.RemoteSystemInfo; import cokr.xit.fims.crdn.Crdn; import cokr.xit.fims.crdn.CrdnQuery; -import cokr.xit.fims.crdn.Team; import cokr.xit.fims.crdn.receive.eqpmnt.LayoutDescriptor; import cokr.xit.fims.cvlc.CrdnCvlcpt; import cokr.xit.fims.excl.CrdnReReg; @@ -367,41 +366,6 @@ public class PvsController { } - @Controller - @RequestMapping(name="주정차과태료업무 단속팀 관리", value=CLASS_URL+Crdn07Controller.CLASS_URL) - class Crdn07Controller extends cokr.xit.fims.crdn.web.Crdn07Controller { - - @Override - @RequestMapping(name="주정차과태료업무 단속팀 목록 조회", value=METHOD_URL.getTeamList) - public ModelAndView getTeamList(CrdnQuery query) { - return super.getTeamList(query); - } - - @Override - @RequestMapping(name="주정차과태료업무 비사용 단속팀 목록 조회", value=METHOD_URL.getRemovedTeamList) - public ModelAndView getRemovedTeamList(CrdnQuery query) { - return super.getRemovedTeamList(query); - } - - @Override - @RequestMapping(name="주정차과태료업무 단속팀 정보 삭제", value=METHOD_URL.removeTeamInfo) - public ModelAndView removeTeamInfo(String teamId) { - return super.removeTeamInfo(teamId); - } - - @Override - @RequestMapping(name="주정차과태료업무 단속팀 정보 저장", value=METHOD_URL.saveTeamInfo) - public ModelAndView saveTeamInfo(Team team) { - return super.saveTeamInfo(team); - } - - @Override - @RequestMapping(name="주정차과태료업무 단속팀 정보 조회", value=METHOD_URL.getTeamInfo) - public ModelAndView getTeamInfo(String teamId) { - return super.getTeamInfo(teamId); - } - - } @Controller @RequestMapping(name="주정차과태료업무 부과제외_부과제외 관리", value=CLASS_URL+Excl01Controller.CLASS_URL)