업무별 URL매핑용 어노테이션 추가

main
이범준 7 months ago
parent ad1a1665dc
commit d48e4ca4bf

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

@ -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<DataObject> 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<DataObject> 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<DataObject>) item.get("children"));
}
}
}
}

@ -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;
/** .<br />
* { }/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
* }</code></pre>
*/
@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
* }</code></pre>
*/
@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));

@ -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;
/** .<br />
* { }/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 {
/** .<br />
* @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
* }</code></pre>
*/
@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
* }</code></pre>
*/
@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
* }</code></pre>
*/
@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");

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

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

@ -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<String> 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();
}
}

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

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

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

Loading…
Cancel
Save