diff --git a/.settings/org.eclipse.buildship.core.prefs b/.settings/org.eclipse.buildship.core.prefs index 4fcda001..9cab572a 100644 --- a/.settings/org.eclipse.buildship.core.prefs +++ b/.settings/org.eclipse.buildship.core.prefs @@ -1,3 +1,3 @@ -connection.gradle.distribution=GRADLE_DISTRIBUTION(WRAPPER) -connection.project.dir=mago3d-user +#Wed Nov 29 16:27:40 KST 2017 eclipse.preferences.version=1 +connection.project.dir= diff --git a/.settings/org.eclipse.core.resources.prefs b/.settings/org.eclipse.core.resources.prefs new file mode 100644 index 00000000..99f26c02 --- /dev/null +++ b/.settings/org.eclipse.core.resources.prefs @@ -0,0 +1,2 @@ +eclipse.preferences.version=1 +encoding/=UTF-8 diff --git a/mago3d-admin/build.gradle b/mago3d-admin/build.gradle index 85615104..edf21f54 100644 --- a/mago3d-admin/build.gradle +++ b/mago3d-admin/build.gradle @@ -88,6 +88,9 @@ dependencies { compile 'javax.servlet:jstl:1.2' compile 'org.apache.logging.log4j:log4j:2.8.2' //compile('org.springframework.boot:spring-boot-starter-actuator') + + //compile 'io.springfox:springfox-swagger2:2.7.0' + //compile 'io.springfox:springfox-swagger-ui:2.7.0' compileOnly('org.projectlombok:lombok') diff --git a/mago3d-admin/src/main/java/com/gaia3d/config/CacheConfig.java b/mago3d-admin/src/main/java/com/gaia3d/config/CacheConfig.java index 0f78aef6..840a3e4d 100644 --- a/mago3d-admin/src/main/java/com/gaia3d/config/CacheConfig.java +++ b/mago3d-admin/src/main/java/com/gaia3d/config/CacheConfig.java @@ -14,21 +14,21 @@ import com.gaia3d.domain.CacheName; import com.gaia3d.domain.CacheType; import com.gaia3d.domain.CommonCode; -import com.gaia3d.domain.DataGroup; -import com.gaia3d.domain.DataInfo; import com.gaia3d.domain.ExternalService; import com.gaia3d.domain.Menu; +import com.gaia3d.domain.OSType; import com.gaia3d.domain.Policy; +import com.gaia3d.domain.Project; import com.gaia3d.domain.UserGroup; import com.gaia3d.domain.UserGroupMenu; import com.gaia3d.helper.HttpClientHelper; import com.gaia3d.security.Crypt; import com.gaia3d.service.APIService; import com.gaia3d.service.CommonCodeService; -import com.gaia3d.service.DataGroupService; import com.gaia3d.service.DataService; import com.gaia3d.service.MenuService; import com.gaia3d.service.PolicyService; +import com.gaia3d.service.ProjectService; import com.gaia3d.service.UserGroupService; import lombok.extern.slf4j.Slf4j; @@ -42,7 +42,7 @@ public class CacheConfig { @Autowired private DataService dataService; @Autowired - private DataGroupService dataGroupService; + private ProjectService projectService; // @Autowired // private LicenseService licenseService; @Autowired @@ -99,7 +99,7 @@ public void loadCache(CacheName cacheName, CacheType cacheType) { else if(cacheName == CacheName.POLICY) policy(cacheType); else if(cacheName == CacheName.MENU) menu(cacheType); else if(cacheName == CacheName.COMMON_CODE) commonCode(cacheType); - else if(cacheName == CacheName.DATA_GROUP) data(cacheType); + else if(cacheName == CacheName.PROJECT) data(cacheType); } private void license(CacheType cacheType) { @@ -157,36 +157,15 @@ private void menu(CacheType cacheType) { * @param cacheType */ private void data(CacheType cacheType) { - Map> dataGroupMap = new HashMap<>(); - List allDataInfoList = new ArrayList<>(); - - // 1 Depth group 정보를 전부 가져옴 - List dataGroupList = dataGroupService.getListDataGroupByDepth(1); - // 1 그룹별 하위 object 정보들을 전부 가져옴 - for(DataGroup dataGroup : dataGroupList) { - List childGroupList = dataGroupService.getListDataGroupByAncestor(dataGroup.getData_group_id()); -// List allChildDataInfoList = new ArrayList<>(); - for(DataGroup childDataGroup : childGroupList) { - DataInfo dataInfo = new DataInfo(); - dataInfo.setData_group_id(childDataGroup.getData_group_id()); -// allChildDataInfoList.addAll(dataService.getListDataByDataGroupId(dataInfo)); - allDataInfoList.addAll(dataService.getListDataByDataGroupId(dataInfo)); - } -// dataGroupMap.put(dataGroup.getData_group_key(), allChildDataInfoList); - } - - Map allDataInfoMap = new HashMap<>(); - for(DataInfo dataInfo : allDataInfoList) { - allDataInfoMap.put(dataInfo.getData_key(), dataInfo); + List projectList = projectService.getListProject(new Project()); + Map projectMap = new HashMap<>(); + for(Project project : projectList) { + projectMap.put(project.getProject_id(), project); } - - dataGroupMap.put("alldata", allDataInfoMap); - - CacheManager.setProjectDataGroupList(dataGroupList); - CacheManager.setDataGroupMap(dataGroupMap); + CacheManager.setProjectMap(projectMap); if(cacheType == CacheType.BROADCAST) { - callRemoteCache(CacheName.DATA_GROUP); + callRemoteCache(CacheName.PROJECT); } } @@ -271,6 +250,11 @@ private void externalServiceCache(CacheType cacheType) { private void callRemoteCache(CacheName cacheName) { log.info("@@@@@@@@@@@@@@@@@@@@@@@@@@ callRemoteCache start! "); + if(propertiesConfig.getOsType().toUpperCase().equals(OSType.WINDOW.toString().toUpperCase())) { + log.info("@@@@@@@@@@@@@@@@@@@@@@@@@@ OS Type = {}. skip callRemoteCache ", propertiesConfig.getOsType().toUpperCase()); + return; + } + // TODO 로컬, 이중화 등의 분기 처리가 생략되어 있음 List remoteCacheServerList = CacheManager.getRemoteCacheServiceList(); for(ExternalService externalService : remoteCacheServerList) { diff --git a/mago3d-admin/src/main/java/com/gaia3d/config/ServletConfig.java b/mago3d-admin/src/main/java/com/gaia3d/config/ServletConfig.java index c206ece2..18437880 100644 --- a/mago3d-admin/src/main/java/com/gaia3d/config/ServletConfig.java +++ b/mago3d-admin/src/main/java/com/gaia3d/config/ServletConfig.java @@ -2,7 +2,9 @@ import java.util.Locale; import java.util.Properties; +import java.util.concurrent.TimeUnit; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan.Filter; @@ -11,10 +13,12 @@ import org.springframework.context.support.MessageSourceAccessor; import org.springframework.context.support.ReloadableResourceBundleMessageSource; import org.springframework.core.Ordered; +import org.springframework.http.CacheControl; import org.springframework.stereotype.Component; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.servlet.LocaleResolver; +import org.springframework.web.servlet.config.annotation.CorsRegistry; import org.springframework.web.servlet.config.annotation.DefaultServletHandlerConfigurer; import org.springframework.web.servlet.config.annotation.EnableWebMvc; import org.springframework.web.servlet.config.annotation.InterceptorRegistry; @@ -39,6 +43,7 @@ * @author Cheon JeongDae * */ +//@EnableSwagger2 @Slf4j @EnableWebMvc @Configuration @@ -104,12 +109,28 @@ public MessageSourceAccessor getMessageSourceAccessor(){ @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { + log.info(" @@@ ServletConfig addResourceHandlers @@@"); registry.addResourceHandler("/css/**").addResourceLocations("/css/"); registry.addResourceHandler("/externlib/**").addResourceLocations("/externlib/"); // registry.addResourceHandler("/hompage/**").addResourceLocations("/homepage/"); registry.addResourceHandler("/images/**").addResourceLocations("/images/"); registry.addResourceHandler("/js/**").addResourceLocations("/js/"); + //registry.addResourceHandler("swagger-ui.html").addResourceLocations("classpath:/META-INF/resources/"); +// registry.addResourceHandler("/swagger-ui.html**").addResourceLocations("classpath:/META-INF/resources/swagger-ui.html"); +// registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); + //registry.addResourceHandler("/webjars/**").addResourceLocations("classpath:/META-INF/resources/webjars/"); + +// if (!registry.hasMappingForPattern("/webjars/**")) { +// registry.addResourceHandler("/webjars/**") +// .addResourceLocations("classpath:/resources/webjars/") +// .setCacheControl( CacheControl.maxAge(1, TimeUnit.HOURS).cachePublic() ); +// } +// if (!registry.hasMappingForPattern("/**")) { +// registry.addResourceHandler("/**") +// .addResourceLocations("classpath:/static") +// .setCacheControl( CacheControl.maxAge(0, TimeUnit.SECONDS).cachePublic()); +// } } @Override @@ -149,6 +170,7 @@ public SimpleMappingExceptionResolver simpleMappingExceptionResolver() { } @Bean + @ConditionalOnMissingBean(InternalResourceViewResolver.class) public InternalResourceViewResolver viewResolver() { log.info(" @@@ ServletConfig viewResolver @@@"); InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); @@ -164,4 +186,30 @@ public RequestDataValueProcessor requestDataValueProcessor() { log.info(" @@@ ServletConfig requestDataValueProcessor @@@ "); return new CSRFRequestDataValueProcessor(); } + +// /** +// * Global CORS Configuration +// */ +// @Override +// public void addCorsMappings(CorsRegistry registry) { +// // 간략설정 +// registry.addMapping("/**"); +// +// // 상세설정 +// registry.addMapping("/api/**").allowedOrigins("http://domain2.com") +// .allowedMethods("PUT", "DELETE") +// .allowedHeaders("header1", "header2", "header3") +// .exposedHeaders("header1", "header2").allowCredentials(false) +// .maxAge(3600); +// } + +// @Bean +// public Docket petApi() { +// return new Docket(DocumentationType.SWAGGER_2) +// .select() +// .apis(RequestHandlerSelectors.any()) +// .paths(PathSelectors.any()) +// .build() +// .pathMapping("/"); +// } } diff --git a/mago3d-admin/src/main/java/com/gaia3d/controller/DataController.java b/mago3d-admin/src/main/java/com/gaia3d/controller/DataController.java index 173483ea..6472feb9 100644 --- a/mago3d-admin/src/main/java/com/gaia3d/controller/DataController.java +++ b/mago3d-admin/src/main/java/com/gaia3d/controller/DataController.java @@ -31,13 +31,13 @@ import com.gaia3d.config.PropertiesConfig; import com.gaia3d.domain.CacheManager; import com.gaia3d.domain.CommonCode; -import com.gaia3d.domain.DataGroup; +import com.gaia3d.domain.Project; import com.gaia3d.domain.DataInfo; import com.gaia3d.domain.FileInfo; import com.gaia3d.domain.Pagination; import com.gaia3d.domain.Policy; import com.gaia3d.domain.UserSession; -import com.gaia3d.service.DataGroupService; +import com.gaia3d.service.ProjectService; import com.gaia3d.service.DataService; import com.gaia3d.service.FileService; import com.gaia3d.util.DateUtil; @@ -63,7 +63,7 @@ public class DataController { private DataValidator dataValidator; @Autowired - private DataGroupService dataGroupService; + private ProjectService projectService; @Autowired private DataService dataService; @Autowired @@ -82,11 +82,11 @@ public class DataController { public String listData( HttpServletRequest request, DataInfo dataInfo, @RequestParam(defaultValue="1") String pageNo, Model model) { log.info("@@ dataInfo = {}", dataInfo); - DataGroup dataGroup = new DataGroup(); - dataGroup.setUse_yn(DataGroup.IN_USE); - List dataGroupList = dataGroupService.getListDataGroup(dataGroup); - if(dataInfo.getData_group_id() == null) { - dataInfo.setData_group_id(Long.valueOf(0l)); + Project project = new Project(); + project.setUse_yn(Project.IN_USE); + List projectList = projectService.getListProject(project); + if(dataInfo.getProject_id() == null) { + dataInfo.setProject_id(Long.valueOf(0l)); } if(StringUtil.isNotEmpty(dataInfo.getStart_date())) { dataInfo.setStart_date(dataInfo.getStart_date().substring(0, 8) + DateUtil.START_TIME); @@ -116,7 +116,7 @@ public String listData( HttpServletRequest request, DataInfo dataInfo, @RequestP model.addAttribute(pagination); model.addAttribute("dataRegisterTypeList", dataRegisterTypeList); - model.addAttribute("dataGroupList", dataGroupList); + model.addAttribute("projectList", projectList); model.addAttribute("txtDownloadFlag", Boolean.valueOf(txtDownloadFlag)); model.addAttribute("dataList", dataList); model.addAttribute("excelDataInfo", dataInfo); @@ -124,105 +124,93 @@ public String listData( HttpServletRequest request, DataInfo dataInfo, @RequestP } /** - * Data 그룹 등록된 Data 목록 + * 프로젝트에 등록된 Data 목록 * @param request * @return */ - @RequestMapping(value = "ajax-list-data-group-data.do", produces = "application/json; charset=utf8") + @RequestMapping(value = "ajax-list-data-by-project-id.do") @ResponseBody - public Map ajaxListDataGroupData(HttpServletRequest request, @RequestParam("data_group_id") Long data_group_id, @RequestParam(defaultValue="1") String pageNo) { + public Map ajaxListDataByProjectId(HttpServletRequest request, @RequestParam("project_id") Long project_id) { Map jSONObject = new HashMap(); String result = "success"; - Pagination pagination = null; List dataList = new ArrayList(); try { DataInfo dataInfo = new DataInfo(); - dataInfo.setData_group_id(data_group_id); - - long totalCount = dataService.getDataTotalCount(dataInfo); - pagination = new Pagination(request.getRequestURI(), getSearchParameters(dataInfo), totalCount, Long.valueOf(pageNo).longValue()); - - dataInfo.setOffset(pagination.getOffset()); - dataInfo.setLimit(pagination.getPageRows()); - if(totalCount > 0l) { - dataList = dataService.getListData(dataInfo); - } + dataInfo.setProject_id(project_id); + dataList = dataService.getListDataByProjectId(dataInfo); } catch(Exception e) { e.printStackTrace(); result = "db.exception"; } jSONObject.put("result", result); - jSONObject.put("pagination", pagination); jSONObject.put("dataList", dataList); - log.info(">>>>>>>>>>>>>>>>>> datalist = {}", jSONObject); - - return jSONObject; - } - - /** - * Data 그룹 전체 Data 에서 선택한 Data 그룹에 등록된 Data 를 제외한 Data 목록 - * @param request - * @return - */ - @RequestMapping(value = "ajax-list-except-data-group-data-by-group-id.do") - @ResponseBody - public Map ajaxListExceptDataGroupDataByGroupId(HttpServletRequest request, DataInfo dataInfo, @RequestParam(defaultValue="1") String pageNo) { - Map jSONObject = new HashMap(); - String result = "success"; - Pagination pagination = null; - List dataList = new ArrayList(); - try { - long totalCount = dataService.getExceptDataGroupDataByGroupIdTotalCount(dataInfo); - pagination = new Pagination(request.getRequestURI(), getSearchParameters(dataInfo), totalCount, Long.valueOf(pageNo).longValue()); - - dataInfo.setOffset(pagination.getOffset()); - dataInfo.setLimit(pagination.getPageRows()); - if(totalCount > 0l) { - dataList = dataService.getListExceptDataGroupDataByGroupId(dataInfo); - } - } catch(Exception e) { - e.printStackTrace(); - result = "db.exception"; - } - jSONObject.put("result", result); - jSONObject.put("pagination", pagination); - jSONObject.put("dataList", dataList); return jSONObject; } - /** - * 선택한 Data 그룹에 등록된 Data 목록 - * @param request - * @return - */ - @RequestMapping(value = "ajax-list-data-group-data-by-group-id.do") - @ResponseBody - public Map ajaxListDataGroupDataByGroupId(HttpServletRequest request, DataInfo dataInfo, @RequestParam(defaultValue="1") String pageNo) { - Map jSONObject = new HashMap(); - String result = "success"; - Pagination pagination = null; - List dataList = new ArrayList(); - try { - - long totalCount = dataService.getDataTotalCount(dataInfo); - pagination = new Pagination(request.getRequestURI(), getSearchParameters(dataInfo), totalCount, Long.valueOf(pageNo).longValue()); - - dataInfo.setOffset(pagination.getOffset()); - dataInfo.setLimit(pagination.getPageRows()); - if(totalCount > 0l) { - dataList = dataService.getListData(dataInfo); - } - } catch(Exception e) { - e.printStackTrace(); - result = "db.exception"; - } - jSONObject.put("result", result); - jSONObject.put("pagination", pagination); - jSONObject.put("dataList", dataList); - return jSONObject; - } +// /** +// * Data 그룹 전체 Data 에서 선택한 Data 그룹에 등록된 Data 를 제외한 Data 목록 +// * @param request +// * @return +// */ +// @RequestMapping(value = "ajax-list-except-data-group-data-by-group-id.do") +// @ResponseBody +// public Map ajaxListExceptDataGroupDataByGroupId(HttpServletRequest request, DataInfo dataInfo, @RequestParam(defaultValue="1") String pageNo) { +// Map jSONObject = new HashMap(); +// String result = "success"; +// Pagination pagination = null; +// List dataList = new ArrayList(); +// try { +// long totalCount = dataService.getExceptDataGroupDataByGroupIdTotalCount(dataInfo); +// pagination = new Pagination(request.getRequestURI(), getSearchParameters(dataInfo), totalCount, Long.valueOf(pageNo).longValue()); +// +// dataInfo.setOffset(pagination.getOffset()); +// dataInfo.setLimit(pagination.getPageRows()); +// if(totalCount > 0l) { +// dataList = dataService.getListExceptDataGroupDataByGroupId(dataInfo); +// } +// } catch(Exception e) { +// e.printStackTrace(); +// result = "db.exception"; +// } +// jSONObject.put("result", result); +// jSONObject.put("pagination", pagination); +// jSONObject.put("dataList", dataList); +// return jSONObject; +// } +// +// /** +// * 선택한 Data 그룹에 등록된 Data 목록 +// * @param request +// * @return +// */ +// @RequestMapping(value = "ajax-list-data-group-data-by-group-id.do") +// @ResponseBody +// public Map ajaxListDataGroupDataByGroupId(HttpServletRequest request, DataInfo dataInfo, @RequestParam(defaultValue="1") String pageNo) { +// Map jSONObject = new HashMap(); +// String result = "success"; +// Pagination pagination = null; +// List dataList = new ArrayList(); +// try { +// +// long totalCount = dataService.getDataTotalCount(dataInfo); +// pagination = new Pagination(request.getRequestURI(), getSearchParameters(dataInfo), totalCount, Long.valueOf(pageNo).longValue()); +// +// dataInfo.setOffset(pagination.getOffset()); +// dataInfo.setLimit(pagination.getPageRows()); +// if(totalCount > 0l) { +// dataList = dataService.getListData(dataInfo); +// } +// } catch(Exception e) { +// e.printStackTrace(); +// result = "db.exception"; +// } +// jSONObject.put("result", result); +// jSONObject.put("pagination", pagination); +// jSONObject.put("dataList", dataList); +// return jSONObject; +// } /** * Data 등록 화면 @@ -231,17 +219,16 @@ public Map ajaxListDataGroupDataByGroupId(HttpServletRequest req */ @GetMapping(value = "input-data.do") public String inputData(Model model) { - - DataGroup dataGroup = new DataGroup(); - dataGroup.setUse_yn(DataGroup.IN_USE); - List dataGroupList = dataGroupService.getListDataGroup(dataGroup); + Project project = new Project(); + project.setUse_yn(Project.IN_USE); + List projectList = projectService.getListProject(project); Policy policy = CacheManager.getPolicy(); DataInfo dataInfo = new DataInfo(); model.addAttribute(dataInfo); model.addAttribute("policy", policy); - model.addAttribute("dataGroupList", dataGroupList); + model.addAttribute("projectList", projectList); return "/data/input-data"; } @@ -251,11 +238,13 @@ public String inputData(Model model) { * @param dataInfo * @return */ - @PostMapping(value = "ajax-insert-data-info.do", produces = "application/json; charset=utf8") + @PostMapping(value = "ajax-insert-data-info.do") @ResponseBody public Map ajaxInsertDataInfo(HttpServletRequest request, DataInfo dataInfo) { Map jSONObject = new HashMap(); String result = "success"; + + log.info("@@@@@@@@@@@@@@@@@@ before dataInfo = {}", dataInfo); try { dataInfo.setMethod_mode("insert"); String errorcode = dataValidate(dataInfo); @@ -265,15 +254,36 @@ public Map ajaxInsertDataInfo(HttpServletRequest request, DataIn return jSONObject; } - int count = dataService.getDuplicationKeyCount(dataInfo.getData_key()); + int count = dataService.getDuplicationKeyCount(dataInfo); if(count > 0) { result = "data.key.duplication"; jSONObject.put("result", result); return jSONObject; } - - dataInfo.setLocation("POINT(" + dataInfo.getLongitude() + " " + dataInfo.getLatitude() + ")"); - log.info("@@@@@@@@@@@@@@@@@@ dataInfo = {}", dataInfo); + + if(dataInfo.getLatitude() != null && dataInfo.getLatitude().floatValue() != 0f && + dataInfo.getLongitude() != null && dataInfo.getLongitude().floatValue() != 0f) { + dataInfo.setLocation("POINT(" + dataInfo.getLongitude() + " " + dataInfo.getLatitude() + ")"); + } + + if(dataInfo.getParent().longValue() == 0l) { + dataInfo.setDepth(1); + } else { + dataInfo.setDepth(dataInfo.getParent_depth() + 1); + } + + if(dataInfo.getParent() == 0l && dataInfo.getDepth() == 1) { + int rootCount = dataService.getRootParentCount(dataInfo); + if(rootCount > 0) { + result = "data.project.root.duplication"; + jSONObject.put("result", result); + return jSONObject; + } + } + + dataInfo.setView_order(dataService.getViewOrderByParent(dataInfo)); + log.info("@@@@@@@@@@@@@@@@@@ after dataInfo = {}", dataInfo); + dataService.insertData(dataInfo); } catch(Exception e) { e.printStackTrace(); @@ -285,51 +295,51 @@ public Map ajaxInsertDataInfo(HttpServletRequest request, DataIn return jSONObject; } - /** - * 선택 Data 그룹내 Data 등록 - * @param request - * @param data_all_id - * @param data_group_id - * @param model - * @return - */ - @PostMapping(value = "ajax-insert-data-group-data.do", produces = "application/json; charset=utf8") - @ResponseBody - public Map ajaxInsertDataGroupData(HttpServletRequest request, - @RequestParam("data_group_id") Long data_group_id, - @RequestParam("data_all_id") String[] data_all_id) { - - log.info("@@@ data_group_id = {}, data_all_id = {}", data_group_id, data_all_id); - Map jSONObject = new HashMap(); - List exceptDataList = new ArrayList(); - List dataList = new ArrayList(); - String result = "success"; - try { - if(data_group_id == null || data_group_id.longValue() == 0l || - data_all_id == null || data_all_id.length < 1) { - result = "input.invalid"; - jSONObject.put("result", result); - return jSONObject; - } - - DataInfo dataInfo = new DataInfo(); - dataInfo.setData_group_id(data_group_id); - dataInfo.setData_all_id(data_all_id); - - dataService.updateDataGroupData(dataInfo); - - dataList = dataService.getListData(dataInfo); - exceptDataList = dataService.getListExceptDataGroupDataByGroupId(dataInfo); - } catch(Exception e) { - e.printStackTrace(); - jSONObject.put("result", "db.exception"); - } - - jSONObject.put("result", result ); - jSONObject.put("exceptDataList", exceptDataList); - jSONObject.put("dataList", dataList); - return jSONObject; - } +// /** +// * 선택 Data 그룹내 Data 등록 +// * @param request +// * @param data_all_id +// * @param data_group_id +// * @param model +// * @return +// */ +// @PostMapping(value = "ajax-insert-data-group-data.do", produces = "application/json; charset=utf8") +// @ResponseBody +// public Map ajaxInsertDataGroupData(HttpServletRequest request, +// @RequestParam("data_group_id") Long data_group_id, +// @RequestParam("data_all_id") String[] data_all_id) { +// +// log.info("@@@ data_group_id = {}, data_all_id = {}", data_group_id, data_all_id); +// Map jSONObject = new HashMap(); +// List exceptDataList = new ArrayList(); +// List dataList = new ArrayList(); +// String result = "success"; +// try { +// if(data_group_id == null || data_group_id.longValue() == 0l || +// data_all_id == null || data_all_id.length < 1) { +// result = "input.invalid"; +// jSONObject.put("result", result); +// return jSONObject; +// } +// +// DataInfo dataInfo = new DataInfo(); +// dataInfo.setData_group_id(data_group_id); +// dataInfo.setData_all_id(data_all_id); +// +// dataService.updateDataGroupData(dataInfo); +// +// dataList = dataService.getListData(dataInfo); +// exceptDataList = dataService.getListExceptDataGroupDataByGroupId(dataInfo); +// } catch(Exception e) { +// e.printStackTrace(); +// jSONObject.put("result", "db.exception"); +// } +// +// jSONObject.put("result", result ); +// jSONObject.put("exceptDataList", exceptDataList); +// jSONObject.put("dataList", dataList); +// return jSONObject; +// } /** * ajax 용 Data validation 체크 @@ -341,9 +351,9 @@ private String dataValidate(DataInfo dataInfo) { return "data.input.invalid"; } - if(dataInfo.getData_group_id() == null || dataInfo.getData_group_id() <= 0 + if(dataInfo.getProject_id() == null || dataInfo.getProject_id().longValue() <= 0 || dataInfo.getData_name() == null || "".equals(dataInfo.getData_name())) { - return "data.input.invalid"; + return "data.project.id.invalid"; } return null; @@ -357,12 +367,16 @@ private String dataValidate(DataInfo dataInfo) { @PostMapping(value = "ajax-data-key-duplication-check.do") @ResponseBody public Map ajaxDataKeyDuplicationCheck(HttpServletRequest request, DataInfo dataInfo) { - Map jSONObject = new HashMap(); String result = "success"; String duplication_value = ""; try { - if(dataInfo.getData_key() == null || "".equals(dataInfo.getData_key())) { + if(dataInfo.getProject_id() == null || dataInfo.getProject_id().longValue() < 0) { + result = "project.id.empty"; + jSONObject.put("result", result); + return jSONObject; + } + else if(dataInfo.getData_key() == null || "".equals(dataInfo.getData_key())) { result = "data.key.empty"; jSONObject.put("result", result); return jSONObject; @@ -374,7 +388,7 @@ public Map ajaxDataKeyDuplicationCheck(HttpServletRequest reques } } - int count = dataService.getDuplicationKeyCount(dataInfo.getData_key()); + int count = dataService.getDuplicationKeyCount(dataInfo); log.info("@@ duplication_value = {}", count); duplication_value = String.valueOf(count); } catch(Exception e) { @@ -417,13 +431,13 @@ public String detailData(@RequestParam("data_id") String data_id, HttpServletReq * @return */ @GetMapping(value = "modify-data.do") - public String modifyData(@RequestParam("data_id") Long data_id, HttpServletRequest request, @RequestParam(defaultValue="1") String pageNo, Model model) { + public String modifyData(HttpServletRequest request, @RequestParam("data_id") Long data_id, Model model) { String listParameters = getListParameters(request); - DataGroup dataGroup = new DataGroup(); - dataGroup.setUse_yn(DataGroup.IN_USE); - List dataGroupList = dataGroupService.getListDataGroup(dataGroup); + Project project = new Project(); + project.setUse_yn(Project.IN_USE); + List projectList = projectService.getListProject(project); DataInfo dataInfo = dataService.getData(data_id); dataInfo.setOld_data_key(dataInfo.getData_key()); @@ -436,7 +450,7 @@ public String modifyData(@RequestParam("data_id") Long data_id, HttpServletReque model.addAttribute("dataRegisterTypeList", dataRegisterTypeList); model.addAttribute("listParameters", listParameters); model.addAttribute("policy", policy); - model.addAttribute("dataGroupList", dataGroupList); + model.addAttribute("projectList", projectList); model.addAttribute(dataInfo); return "/data/modify-data"; @@ -461,67 +475,82 @@ public Map ajaxUpdateDataInfo(HttpServletRequest request, DataIn jSONObject.put("result", result); return jSONObject; } - - dataService.updateData(dataInfo); - } catch(Exception e) { - e.printStackTrace(); - result = "db.exception"; - } - - jSONObject.put("result", result); - return jSONObject; - } - - /** - * Data 상태 수정(패스워드 실패 잠금, 해제 등) - * @param request - * @param dataInfo - * @return - */ - @PostMapping(value = "ajax-update-data-status.do", produces = "application/json; charset=utf8") - @ResponseBody - public Map ajaxUpdateDataStatus( HttpServletRequest request, - @RequestParam("check_ids") String check_ids, - @RequestParam("business_type") String business_type, - @RequestParam("status_value") String status_value) { - - log.info("@@@@@@@ check_ids = {}, business_type = {}, status_value = {}", check_ids, business_type, status_value); - Map jSONObject = new HashMap(); - String result = "success"; - String result_message = ""; - try { - if(check_ids.length() <= 0) { - jSONObject.put("result", "check.value.required"); - return jSONObject; - } - List dataList = dataService.updateDataStatus(business_type, status_value, check_ids); - if(!dataList.isEmpty()) { - int count = dataList.size(); - int i = 1; - for(String dataId : dataList) { - if(count == i) { - result_message = result_message + dataId; - } else { - result_message = result_message + dataId + ", "; - } - i++; + + if(dataInfo.getParent() == 0l && dataInfo.getDepth() == 1) { + int rootCount = dataService.getRootParentCount(dataInfo); + if(rootCount > 0) { + result = "data.project.root.duplication"; + jSONObject.put("result", result); + return jSONObject; } - - String[] dataIds = check_ids.split(","); - jSONObject.put("update_count", dataIds.length - dataList.size()); - jSONObject.put("business_type", business_type); - jSONObject.put("result_message", result_message); } + + if(dataInfo.getLatitude() != null && dataInfo.getLatitude().floatValue() != 0f && + dataInfo.getLongitude() != null && dataInfo.getLongitude().floatValue() != 0f) { + dataInfo.setLocation("POINT(" + dataInfo.getLongitude() + " " + dataInfo.getLatitude() + ")"); + } + log.info("@@@@@@@@ dataInfo = {}", dataInfo); + + dataService.updateData(dataInfo); } catch(Exception e) { e.printStackTrace(); result = "db.exception"; } jSONObject.put("result", result); - return jSONObject; } +// /** +// * Data 상태 수정(패스워드 실패 잠금, 해제 등) +// * @param request +// * @param dataInfo +// * @return +// */ +// @PostMapping(value = "ajax-update-data-status.do", produces = "application/json; charset=utf8") +// @ResponseBody +// public Map ajaxUpdateDataStatus( HttpServletRequest request, +// @RequestParam("check_ids") String check_ids, +// @RequestParam("business_type") String business_type, +// @RequestParam("status_value") String status_value) { +// +// log.info("@@@@@@@ check_ids = {}, business_type = {}, status_value = {}", check_ids, business_type, status_value); +// Map jSONObject = new HashMap(); +// String result = "success"; +// String result_message = ""; +// try { +// if(check_ids.length() <= 0) { +// jSONObject.put("result", "check.value.required"); +// return jSONObject; +// } +// List dataList = dataService.updateDataStatus(business_type, status_value, check_ids); +// if(!dataList.isEmpty()) { +// int count = dataList.size(); +// int i = 1; +// for(String dataId : dataList) { +// if(count == i) { +// result_message = result_message + dataId; +// } else { +// result_message = result_message + dataId + ", "; +// } +// i++; +// } +// +// String[] dataIds = check_ids.split(","); +// jSONObject.put("update_count", dataIds.length - dataList.size()); +// jSONObject.put("business_type", business_type); +// jSONObject.put("result_message", result_message); +// } +// } catch(Exception e) { +// e.printStackTrace(); +// result = "db.exception"; +// } +// +// jSONObject.put("result", result); +// +// return jSONObject; +// } + /** * Data 삭제 * @param data_id @@ -540,11 +569,10 @@ public String deleteData(@RequestParam("data_id") String data_id, Model model) { * 선택 Data 삭제 * @param request * @param data_select_id - * @param data_group_id * @param model * @return */ - @PostMapping(value = "ajax-delete-datas.do", produces = "application/json; charset=utf8") + @PostMapping(value = "ajax-delete-datas.do") @ResponseBody public Map ajaxDeleteDatas(HttpServletRequest request, @RequestParam("check_ids") String check_ids) { @@ -567,170 +595,170 @@ public Map ajaxDeleteDatas(HttpServletRequest request, @RequestP return jSONObject; } - /** - * 선택 Data 그룹내 Data 삭제 - * @param request - * @param data_select_id - * @param data_group_id - * @param model - * @return - */ - @PostMapping(value = "ajax-delete-data-group-data.do", produces = "application/json; charset=utf8") - @ResponseBody - public Map ajaxDeleteDataGroupData(HttpServletRequest request, - @RequestParam("data_group_id") Long data_group_id, - @RequestParam("data_select_id") String[] data_select_id) { - - log.info("@@@ data_group_id = {}, data_select_id = {}", data_group_id, data_select_id); - Map jSONObject = new HashMap(); - List exceptDataList = new ArrayList(); - List dataList = new ArrayList(); - String result = "success"; - try { - if(data_group_id == null || data_group_id.longValue() == 0l || - data_select_id == null || data_select_id.length < 1) { - result = "input.invalid"; - jSONObject.put("result", result); - return jSONObject; - } - - DataInfo dataInfo = new DataInfo(); - dataInfo.setData_group_id(data_group_id); - dataInfo.setData_select_id(data_select_id); - - dataService.updateDataGroupData(dataInfo); - - // UPDATE 문에서 data_group_id 를 temp 그룹으로 변경 - dataInfo.setData_group_id(data_group_id); - - dataList = dataService.getListData(dataInfo); - exceptDataList = dataService.getListExceptDataGroupDataByGroupId(dataInfo); - } catch(Exception e) { - e.printStackTrace(); - jSONObject.put("result", "db.exception"); - } - - jSONObject.put("result", result ); - jSONObject.put("exceptDataList", exceptDataList); - jSONObject.put("dataList", dataList); - return jSONObject; - } - - /** - * Data 일괄 등록 화면 - * @param model - * @return - */ - @GetMapping(value = "popup-input-excel-data.do", produces = "application/json; charset=utf8") - public String popupInputExcelData(Model model) { - - FileInfo fileInfo = new FileInfo(); - - model.addAttribute("fileInfo", fileInfo); - - return "/data/popup-input-excel-data"; - } - - /** - * Data 일괄 등록 - * @param model - * @return - */ - @PostMapping(value = "ajax-insert-excel-data.do", produces = "application/json; charset=utf8") - @ResponseBody - public Map ajaxInsertExcelData(MultipartHttpServletRequest request) { - - Map jSONObject = new HashMap(); - String result = "success"; - try { - MultipartFile multipartFile = request.getFile("file_name"); - FileInfo fileInfo = FileUtil.upload(multipartFile, FileUtil.EXCEL_DATA_UPLOAD, propertiesConfig.getExcelDataUploadDir()); - if(fileInfo.getError_code() != null && !"".equals(fileInfo.getError_code())) { - jSONObject.put("result", fileInfo.getError_code()); - return jSONObject; - } - - UserSession userSession = (UserSession)request.getSession().getAttribute(UserSession.KEY); - fileInfo.setUser_id(userSession.getUser_id()); - - fileInfo = fileService.insertExcelData(fileInfo, userSession.getUser_id()); - - jSONObject.put("total_count", fileInfo.getTotal_count()); - jSONObject.put("parse_success_count", fileInfo.getParse_success_count()); - jSONObject.put("parse_error_count", fileInfo.getParse_error_count()); - jSONObject.put("insert_success_count", fileInfo.getInsert_success_count()); - jSONObject.put("insert_error_count", fileInfo.getInsert_error_count()); - - // 파일 삭제 - File copyFile = new File(fileInfo.getFile_path() + fileInfo.getFile_real_name()); - if(copyFile.exists()) { - copyFile.delete(); - } - } catch(Exception e) { - e.printStackTrace(); - result = "db.exception"; - } - - jSONObject.put("result", result); - - return jSONObject; - } - - /** - * Data Excel 다운로드 - * @param model - * @return - */ - @RequestMapping(value = "download-excel-data.do") - public ModelAndView downloadExcelData(HttpServletRequest request, HttpServletResponse response, DataInfo dataInfo, Model model) { - log.info("@@ dataInfo = {}", dataInfo); - if(dataInfo.getData_group_id() == null) { - dataInfo.setData_group_id(Long.valueOf(0l)); - } - if(StringUtil.isNotEmpty(dataInfo.getStart_date())) { - dataInfo.setStart_date(dataInfo.getStart_date().substring(0, 8) + DateUtil.START_TIME); - } - if(StringUtil.isNotEmpty(dataInfo.getEnd_date())) { - dataInfo.setEnd_date(dataInfo.getEnd_date().substring(0, 8) + DateUtil.END_TIME); - } - - long totalCount = 0l; - List dataList = new ArrayList(); - try { - // 논리적 삭제는 SELECT에서 제외 -// dataInfo.setDelete_flag(DataInfo.STATUS_LOGICAL_DELETE); - totalCount = dataService.getDataTotalCount(dataInfo); - long pageNo = 1l; - long lastPage = 0l; - long pagePerCount = 1000l; - long pageListCount = 1000l; - if(totalCount > 0l) { - Pagination pagination = new Pagination(request.getRequestURI(), getSearchParameters(dataInfo), totalCount, pageNo, pagePerCount, pageListCount); - lastPage = pagination.getLastPage(); - for(; pageNo<= lastPage; pageNo++) { - pagination = new Pagination(request.getRequestURI(), getSearchParameters(dataInfo), totalCount, pageNo, pagePerCount, pageListCount); - log.info("@@ pagination = {}", pagination); - - dataInfo.setOffset(pagination.getOffset()); - dataInfo.setLimit(pagination.getPageRows()); - List subDataList = dataService.getListData(dataInfo); - - dataList.addAll(subDataList); - - Thread.sleep(3000); - } - } - } catch(Exception e) { - e.printStackTrace(); - } - - ModelAndView modelAndView = new ModelAndView(); - modelAndView.setViewName("pOIExcelView"); - modelAndView.addObject("fileType", "USER_LIST"); - modelAndView.addObject("fileName", "USER_LIST"); - modelAndView.addObject("dataList", dataList); - return modelAndView; - } +// /** +// * 선택 Data 그룹내 Data 삭제 +// * @param request +// * @param data_select_id +// * @param data_group_id +// * @param model +// * @return +// */ +// @PostMapping(value = "ajax-delete-data-group-data.do", produces = "application/json; charset=utf8") +// @ResponseBody +// public Map ajaxDeleteDataGroupData(HttpServletRequest request, +// @RequestParam("data_group_id") Long data_group_id, +// @RequestParam("data_select_id") String[] data_select_id) { +// +// log.info("@@@ data_group_id = {}, data_select_id = {}", data_group_id, data_select_id); +// Map jSONObject = new HashMap(); +// List exceptDataList = new ArrayList(); +// List dataList = new ArrayList(); +// String result = "success"; +// try { +// if(data_group_id == null || data_group_id.longValue() == 0l || +// data_select_id == null || data_select_id.length < 1) { +// result = "input.invalid"; +// jSONObject.put("result", result); +// return jSONObject; +// } +// +// DataInfo dataInfo = new DataInfo(); +// dataInfo.setData_group_id(data_group_id); +// dataInfo.setData_select_id(data_select_id); +// +// dataService.updateDataGroupData(dataInfo); +// +// // UPDATE 문에서 data_group_id 를 temp 그룹으로 변경 +// dataInfo.setData_group_id(data_group_id); +// +// dataList = dataService.getListData(dataInfo); +// exceptDataList = dataService.getListExceptDataGroupDataByGroupId(dataInfo); +// } catch(Exception e) { +// e.printStackTrace(); +// jSONObject.put("result", "db.exception"); +// } +// +// jSONObject.put("result", result ); +// jSONObject.put("exceptDataList", exceptDataList); +// jSONObject.put("dataList", dataList); +// return jSONObject; +// } + +// /** +// * Data 일괄 등록 화면 +// * @param model +// * @return +// */ +// @GetMapping(value = "popup-input-excel-data.do", produces = "application/json; charset=utf8") +// public String popupInputExcelData(Model model) { +// +// FileInfo fileInfo = new FileInfo(); +// +// model.addAttribute("fileInfo", fileInfo); +// +// return "/data/popup-input-excel-data"; +// } +// +// /** +// * Data 일괄 등록 +// * @param model +// * @return +// */ +// @PostMapping(value = "ajax-insert-excel-data.do", produces = "application/json; charset=utf8") +// @ResponseBody +// public Map ajaxInsertExcelData(MultipartHttpServletRequest request) { +// +// Map jSONObject = new HashMap(); +// String result = "success"; +// try { +// MultipartFile multipartFile = request.getFile("file_name"); +// FileInfo fileInfo = FileUtil.upload(multipartFile, FileUtil.EXCEL_DATA_UPLOAD, propertiesConfig.getExcelDataUploadDir()); +// if(fileInfo.getError_code() != null && !"".equals(fileInfo.getError_code())) { +// jSONObject.put("result", fileInfo.getError_code()); +// return jSONObject; +// } +// +// UserSession userSession = (UserSession)request.getSession().getAttribute(UserSession.KEY); +// fileInfo.setUser_id(userSession.getUser_id()); +// +// fileInfo = fileService.insertExcelData(fileInfo, userSession.getUser_id()); +// +// jSONObject.put("total_count", fileInfo.getTotal_count()); +// jSONObject.put("parse_success_count", fileInfo.getParse_success_count()); +// jSONObject.put("parse_error_count", fileInfo.getParse_error_count()); +// jSONObject.put("insert_success_count", fileInfo.getInsert_success_count()); +// jSONObject.put("insert_error_count", fileInfo.getInsert_error_count()); +// +// // 파일 삭제 +// File copyFile = new File(fileInfo.getFile_path() + fileInfo.getFile_real_name()); +// if(copyFile.exists()) { +// copyFile.delete(); +// } +// } catch(Exception e) { +// e.printStackTrace(); +// result = "db.exception"; +// } +// +// jSONObject.put("result", result); +// +// return jSONObject; +// } + +// /** +// * Data Excel 다운로드 +// * @param model +// * @return +// */ +// @RequestMapping(value = "download-excel-data.do") +// public ModelAndView downloadExcelData(HttpServletRequest request, HttpServletResponse response, DataInfo dataInfo, Model model) { +// log.info("@@ dataInfo = {}", dataInfo); +// if(dataInfo.getData_group_id() == null) { +// dataInfo.setData_group_id(Long.valueOf(0l)); +// } +// if(StringUtil.isNotEmpty(dataInfo.getStart_date())) { +// dataInfo.setStart_date(dataInfo.getStart_date().substring(0, 8) + DateUtil.START_TIME); +// } +// if(StringUtil.isNotEmpty(dataInfo.getEnd_date())) { +// dataInfo.setEnd_date(dataInfo.getEnd_date().substring(0, 8) + DateUtil.END_TIME); +// } +// +// long totalCount = 0l; +// List dataList = new ArrayList(); +// try { +// // 논리적 삭제는 SELECT에서 제외 +//// dataInfo.setDelete_flag(DataInfo.STATUS_LOGICAL_DELETE); +// totalCount = dataService.getDataTotalCount(dataInfo); +// long pageNo = 1l; +// long lastPage = 0l; +// long pagePerCount = 1000l; +// long pageListCount = 1000l; +// if(totalCount > 0l) { +// Pagination pagination = new Pagination(request.getRequestURI(), getSearchParameters(dataInfo), totalCount, pageNo, pagePerCount, pageListCount); +// lastPage = pagination.getLastPage(); +// for(; pageNo<= lastPage; pageNo++) { +// pagination = new Pagination(request.getRequestURI(), getSearchParameters(dataInfo), totalCount, pageNo, pagePerCount, pageListCount); +// log.info("@@ pagination = {}", pagination); +// +// dataInfo.setOffset(pagination.getOffset()); +// dataInfo.setLimit(pagination.getPageRows()); +// List subDataList = dataService.getListData(dataInfo); +// +// dataList.addAll(subDataList); +// +// Thread.sleep(3000); +// } +// } +// } catch(Exception e) { +// e.printStackTrace(); +// } +// +// ModelAndView modelAndView = new ModelAndView(); +// modelAndView.setViewName("pOIExcelView"); +// modelAndView.addObject("fileType", "USER_LIST"); +// modelAndView.addObject("fileName", "USER_LIST"); +// modelAndView.addObject("dataList", dataList); +// return modelAndView; +// } /** * Data Txt 다운로드 @@ -745,128 +773,128 @@ public String downloadTxtData(HttpServletRequest request, HttpServletResponse re response.setHeader("Content-Transfer-Encoding", "binary"); response.setHeader("Content-Disposition", "attachment; filename=\"data_info.txt\""); - log.info("@@ dataInfo = {}", dataInfo); - if(dataInfo.getData_group_id() == null) { - dataInfo.setData_group_id(Long.valueOf(0l)); - } - if(StringUtil.isNotEmpty(dataInfo.getStart_date())) { - dataInfo.setStart_date(dataInfo.getStart_date().substring(0, 8) + DateUtil.START_TIME); - } - if(StringUtil.isNotEmpty(dataInfo.getEnd_date())) { - dataInfo.setEnd_date(dataInfo.getEnd_date().substring(0, 8) + DateUtil.END_TIME); - } - - long totalCount = 0l; - try { - // 논리적 삭제는 SELECT에서 제외 -// dataInfo.setDelete_flag(DataInfo.STATUS_LOGICAL_DELETE); - totalCount = dataService.getDataTotalCount(dataInfo); - long pageNo = 1l; - long lastPage = 0l; - long pagePerCount = 1000l; - long pageListCount = 1000l; - long number = 1l; - String SEPARATE = "|"; - String NEW_LINE = "\n"; - if(totalCount > 0l) { - Pagination pagination = new Pagination(request.getRequestURI(), getSearchParameters(dataInfo), totalCount, pageNo, pagePerCount, pageListCount); - lastPage = pagination.getLastPage(); - for(; pageNo<= lastPage; pageNo++) { - pagination = new Pagination(request.getRequestURI(), getSearchParameters(dataInfo), totalCount, pageNo, pagePerCount, pageListCount); - log.info("@@ pagination = {}", pagination); - - dataInfo.setOffset(pagination.getOffset()); - dataInfo.setLimit(pagination.getPageRows()); - List dataList = dataService.getListData(dataInfo); - - int count = dataList.size(); - for(int j=0; j 0l) { +// Pagination pagination = new Pagination(request.getRequestURI(), getSearchParameters(dataInfo), totalCount, pageNo, pagePerCount, pageListCount); +// lastPage = pagination.getLastPage(); +// for(; pageNo<= lastPage; pageNo++) { +// pagination = new Pagination(request.getRequestURI(), getSearchParameters(dataInfo), totalCount, pageNo, pagePerCount, pageListCount); +// log.info("@@ pagination = {}", pagination); +// +// dataInfo.setOffset(pagination.getOffset()); +// dataInfo.setLimit(pagination.getPageRows()); +// List dataList = dataService.getListData(dataInfo); +// +// int count = dataList.size(); +// for(int j=0; j ajaxDataGroupInfo(HttpServletRequest request, @RequestParam("data_group_id") Long data_group_id) { - - log.info("@@@@@@@ data_group_id = {}", data_group_id); - - Map jSONObject = new HashMap(); - String result = "success"; - DataGroup dataGroup = null; - try { - dataGroup = dataGroupService.getDataGroup(data_group_id); - log.info("@@@@@@@ dataGroup = {}", dataGroup); - } catch(Exception e) { - e.printStackTrace(); - result = "db.exception"; - } - jSONObject.put("result", result); - jSONObject.put("dataGroup", dataGroup); - - return jSONObject; - } +// /** +// * Data 다운로드 Sample +// * @param model +// * @return +// */ +// @RequestMapping(value = "download-excel-data-sample.do") +// @ResponseBody +// public void downloadExcelDataSample(HttpServletRequest request, HttpServletResponse response, Model model) { +// +// File rootDirectory = new File(propertiesConfig.getExcelSampleUploadDir()); +// if(!rootDirectory.exists()) { +// rootDirectory.mkdir(); +// } +// +// File file = new File(propertiesConfig.getExcelSampleUploadDir() + "sample.xlsx"); +// if(file.exists()) { +// String mimetype = "application/x-msdownload"; +// response.setContentType(mimetype); +// String dispositionPrefix = "attachment; filename="; +// String encodedFilename = "sample.xlsx"; +// +// response.setHeader("Content-Disposition", dispositionPrefix + encodedFilename); +// response.setContentLength((int)file.length()); +// +// try (BufferedInputStream in = new BufferedInputStream(new FileInputStream(file)); BufferedOutputStream out = new BufferedOutputStream(response.getOutputStream())) { +// FileCopyUtils.copy(in, out); +// out.flush(); +// } catch (Exception e) { +// e.printStackTrace(); +// } +// } else { +// response.setContentType("application/x-msdownload"); +// try (PrintWriter printwriter = response.getWriter()) { +// printwriter.println("샘플 파일이 존재하지 않습니다."); +// printwriter.flush(); +// printwriter.close(); +// } catch(Exception e) { +// e.printStackTrace(); +// } +// } +// } +// +// /** +// * Data 그룹 정보 +// * @param request +// * @return +// */ +// @RequestMapping(value = "ajax-data-group-info.do") +// @ResponseBody +// public Map ajaxDataGroupInfo(HttpServletRequest request, @RequestParam("data_group_id") Long data_group_id) { +// +// log.info("@@@@@@@ data_group_id = {}", data_group_id); +// +// Map jSONObject = new HashMap(); +// String result = "success"; +// Project dataGroup = null; +// try { +// dataGroup = dataGroupService.getDataGroup(data_group_id); +// log.info("@@@@@@@ dataGroup = {}", dataGroup); +// } catch(Exception e) { +// e.printStackTrace(); +// result = "db.exception"; +// } +// jSONObject.put("result", result); +// jSONObject.put("dataGroup", dataGroup); +// +// return jSONObject; +// } /** * 검색 조건 @@ -888,7 +916,7 @@ private String getSearchParameters(DataInfo dataInfo) { builder.append("search_value="); } builder.append("&"); - builder.append("data_group_id=" + dataInfo.getData_group_id()); + builder.append("project_id=" + dataInfo.getProject_id()); builder.append("&"); builder.append("status=" + StringUtil.getDefaultValue(dataInfo.getStatus())); builder.append("&"); @@ -925,7 +953,7 @@ private String getListParameters(HttpServletRequest request) { builder.append("search_value="); } builder.append("&"); - builder.append("data_group_id=" + request.getParameter("data_group_id")); + builder.append("project_id=" + request.getParameter("project_id")); builder.append("&"); builder.append("status=" + StringUtil.getDefaultValue(request.getParameter("status"))); builder.append("&"); diff --git a/mago3d-admin/src/main/java/com/gaia3d/controller/DataGroupController.java b/mago3d-admin/src/main/java/com/gaia3d/controller/DataGroupController.java deleted file mode 100644 index e547727c..00000000 --- a/mago3d-admin/src/main/java/com/gaia3d/controller/DataGroupController.java +++ /dev/null @@ -1,423 +0,0 @@ -package com.gaia3d.controller; - -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.ui.Model; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestMethod; -import org.springframework.web.bind.annotation.ResponseBody; - -import com.gaia3d.domain.CacheManager; -import com.gaia3d.domain.DataGroup; -import com.gaia3d.domain.Policy; -import com.gaia3d.service.DataGroupService; -import com.gaia3d.util.JSONUtil; - -import lombok.extern.slf4j.Slf4j; - -/** - * Data 그룹 - * @author jeongdae - * - */ -@Slf4j -@Controller -@RequestMapping("/data/") -public class DataGroupController { - - @Autowired - private DataGroupService dataGroupService; - - /** - * Data 그룹 목록 - * @param model - * @return - */ - @GetMapping(value = "list-data-group.do") - public String dataGroupList(Model model) { - return "/data/list-data-group"; - } - - /** - * Data 그룹 트리(데이터) - * @param request - * @return - */ - @PostMapping(value = "ajax-list-data-group.do", produces = "application/json; charset=utf8") - @ResponseBody - public String ajaxListDataGroup(HttpServletRequest request) { -// Gson gson = new Gson(); -// Map jSONObject = new HashMap(); - String result = "success"; - String dataGroupTree = null; - List dataGroupList = new ArrayList(); - dataGroupList.add(getRootDataGroup()); - try { - dataGroupList.addAll(dataGroupService.getListDataGroup(new DataGroup())); - dataGroupTree = getDataGroupTree(dataGroupList); - log.info("@@ dataGroupTree = {} ", dataGroupTree); - } catch(Exception e) { - e.printStackTrace(); - result = "db.execption"; - } - -// jSONObject.put("result", result); -// jSONObject.put("dataGroupTree", dataGroupTree); -// return gson.toJson(jSONObject); - - return JSONUtil.getResultTreeString(result, dataGroupTree); - } - - /** - * Data 그룹 추가 - * @param request - * @param dataGroup - * @return - */ - @PostMapping(value = "ajax-insert-data-group.do", produces = "application/json; charset=utf8") - @ResponseBody - public String ajaxInsertDataGroup(HttpServletRequest request, DataGroup dataGroup) { -// Gson gson = new Gson(); -// Map jSONObject = new HashMap(); - String result = "success"; - String dataGroupTree = null; - List dataGroupList = new ArrayList(); - dataGroupList.add(getRootDataGroup()); - try { - log.info("@@ dataGroup = {} ", dataGroup); - - String parent = request.getParameter("parent"); - String depth = request.getParameter("depth"); - if(dataGroup.getData_group_name() == null || "".equals(dataGroup.getData_group_name()) - || parent == null || "".equals(parent) - || dataGroup.getUse_yn() == null || "".equals(dataGroup.getUse_yn())) { - - dataGroupList.addAll(dataGroupService.getListDataGroup(new DataGroup())); - - result = "input.invalid"; -// jSONObject.put("result", result); -// jSONObject.put("dataGroupTree", getDataGroupTree(dataGroupList)); -// return jSONObject.toString(); - - return JSONUtil.getResultTreeString(result, dataGroupTree); - } - - // TODO group_key 중복 체크 해야 함 - dataGroup.setParent(Long.parseLong(parent)); - dataGroup.setDepth(Integer.parseInt(depth)); - - DataGroup childGroup = dataGroupService.getMaxViewOrderChildDataGroup(dataGroup.getParent()); - if(childGroup == null) { - dataGroup.setView_order(1); - } else { - dataGroup.setView_order(childGroup.getView_order() + 1); - dataGroup.setAncestor(childGroup.getAncestor()); - } - - if(dataGroup.getParent() < 0) dataGroup.setParent(0l); - - dataGroupService.insertDataGroup(dataGroup); - dataGroupList.addAll(dataGroupService.getListDataGroup(new DataGroup())); - dataGroupTree = getDataGroupTree(dataGroupList); - log.info("@@ dataGroupTree = {} ", dataGroupTree); - } catch(Exception e) { - e.printStackTrace(); - result = "db.exception"; - } - -// jSONObject.put("result", result); -// jSONObject.put("dataGroupTree", dataGroupTree); -// return gson.toJson(jSONObject); - - return JSONUtil.getResultTreeString(result, dataGroupTree); - } - - /** - * Data 그룹 수정 - * @param request - * @param dataGroup - * @return - */ - @PostMapping(value = "ajax-update-data-group.do", produces = "application/json; charset=utf8") - @ResponseBody - public String ajaxUpdateDataGroup(HttpServletRequest request, DataGroup dataGroup) { -// Gson gson = new Gson(); -// Map jSONObject = new HashMap(); - String result = "success"; - String dataGroupTree = null; - List dataGroupList = new ArrayList(); - dataGroupList.add(getRootDataGroup()); - try { - - log.info("@@ dataGroup = {} ", dataGroup); - if(dataGroup.getData_group_id() == null || dataGroup.getData_group_id().intValue() == 0l - || dataGroup.getData_group_name() == null || "".equals(dataGroup.getData_group_name()) - || dataGroup.getUse_yn() == null || "".equals(dataGroup.getUse_yn())) { - - dataGroupList.addAll(dataGroupService.getListDataGroup(new DataGroup())); - - result = "input.invalid"; -// jSONObject.put("result", result); -// jSONObject.put("dataGroupTree", getDataGroupTree(dataGroupList)); -// return jSONObject.toString(); - - return JSONUtil.getResultTreeString(result, dataGroupTree); - } - - dataGroupService.updateDataGroup(dataGroup); - dataGroupList.addAll(dataGroupService.getListDataGroup(new DataGroup())); - - dataGroupTree = getDataGroupTree(dataGroupList); - log.info("@@ dataGroupTree = {} ", dataGroupTree); - } catch(Exception e) { - e.printStackTrace(); - result = "db.exception"; - } - -// jSONObject.put("result", result); -// jSONObject.put("dataGroupTree", dataGroupTree); -// return gson.toJson(jSONObject); - - return JSONUtil.getResultTreeString(result, dataGroupTree); - } - - /** - * Data 그룹 순서 수정 - up, down 형태 - * @param request - * @param dataGroup - * @return - */ - @PostMapping(value = "ajax-update-move-data-group.do", produces = "application/json; charset=utf8") - @ResponseBody - public String ajaxUpdateMoveDataGroup(HttpServletRequest request, DataGroup dataGroup) { -// Gson gson = new Gson(); -// Map jSONObject = new HashMap(); - String result = "success"; - String dataGroupTree = null; - List dataGroupList = new ArrayList(); - dataGroupList.add(getRootDataGroup()); - try { - - log.info("@@ dataGroup = {} ", dataGroup); - if(dataGroup.getData_group_id() == null || dataGroup.getData_group_id().longValue() == 0l - || dataGroup.getView_order() == null || dataGroup.getView_order().intValue() == 0 - || dataGroup.getUpdate_type() == null || "".equals(dataGroup.getUpdate_type())) { - - dataGroupList.addAll(dataGroupService.getListDataGroup(new DataGroup())); - - result = "input.invalid"; -// jSONObject.put("result", result); -// jSONObject.put("dataGroupTree", getDataGroupTree(dataGroupList)); -// -// return jSONObject.toString(); - return JSONUtil.getResultTreeString(result, dataGroupTree); - } - - dataGroupService.updateMoveDataGroup(dataGroup); - dataGroupList.addAll(dataGroupService.getListDataGroup(new DataGroup())); - - dataGroupTree = getDataGroupTree(dataGroupList); - log.info("@@ dataGroupTree = {}", dataGroupTree); - } catch(Exception e) { - e.printStackTrace(); - result = "db.exception"; - } -// jSONObject.put("result", result); -// jSONObject.put("dataGroupTree", dataGroupTree); -// -// return gson.toJson(jSONObject); - return JSONUtil.getResultTreeString(result, dataGroupTree); - } - - /** - * Data 그룹 삭제 - * @param request - * @param dataGroup - * @return - */ - @PostMapping(value = "ajax-delete-data-group.do", produces = "application/json; charset=utf8") - @ResponseBody - public String ajaxDeleteDataGroup(HttpServletRequest request, DataGroup dataGroup) { -// Gson gson = new Gson(); -// Map jSONObject = new HashMap(); - String result = "success"; - String dataGroupTree = null; - List dataGroupList = new ArrayList(); - dataGroupList.add(getRootDataGroup()); - try { - log.info("@@ dataGroup = {} ", dataGroup); - if(dataGroup.getData_group_id() == null || dataGroup.getData_group_id().longValue() == 0l) { - dataGroupList.addAll(dataGroupService.getListDataGroup(new DataGroup())); - - result = "input.invalid"; -// jSONObject.put("result", result); -// jSONObject.put("dataGroupTree", getDataGroupTree(dataGroupList)); -// -// return jSONObject.toString(); - return JSONUtil.getResultTreeString(result, dataGroupTree); - } - - dataGroupService.deleteDataGroup(dataGroup.getData_group_id()); - dataGroupList.addAll(dataGroupService.getListDataGroup(new DataGroup())); - - dataGroupTree = getDataGroupTree(dataGroupList); - log.info("@@ dataGroupTree = {} ", dataGroupTree); - } catch(Exception e) { - e.printStackTrace(); - result = "db.exception"; - } -// jSONObject.put("result", result); -// jSONObject.put("dataGroupTree", dataGroupTree); -// -// return gson.toJson(jSONObject); - return JSONUtil.getResultTreeString(result, dataGroupTree); - } - - /** - * 최상위 그룹 생성 - * @return - */ - private DataGroup getRootDataGroup() { - DataGroup dataGroup = new DataGroup(); - dataGroup.setData_group_id(0l); - Policy policy = CacheManager.getPolicy(); - if(policy.getContent_data_group_root() != null && !"".equals(policy.getContent_data_group_root())) { - dataGroup.setData_group_name(policy.getContent_data_group_root()); - } else { - dataGroup.setData_group_name("Mago3D"); - } - dataGroup.setData_group_key("Mago3D"); - dataGroup.setOpen("true"); - dataGroup.setNode_type("company"); - dataGroup.setAncestor(-1l); - dataGroup.setParent(-1l); - dataGroup.setParent_name(""); - dataGroup.setView_order(0); - dataGroup.setDepth(0); - dataGroup.setDefault_yn("Y"); - dataGroup.setUse_yn("Y"); - dataGroup.setLatitude(""); - dataGroup.setLongitude(""); - dataGroup.setHeight(""); - dataGroup.setDuration(2000); - dataGroup.setDescription(""); - - return dataGroup; - } - - /** - * Data 그룹 트리 JSON 생성 - * @param dataGroupList - * @return - */ - private String getDataGroupTree(List dataGroupList) { - - StringBuilder builder = new StringBuilder(256); - - int dataGroupCount = dataGroupList.size(); - DataGroup dataGroup = dataGroupList.get(0); - - builder.append("["); - builder.append("{"); - - builder.append("\"data_group_id\"").append(":").append("\"" + dataGroup.getData_group_id() + "\"").append(","); - builder.append("\"data_group_key\"").append(":").append("\"" + dataGroup.getData_group_key() + "\"").append(","); - builder.append("\"data_group_name\"").append(":").append("\"" + dataGroup.getData_group_name() + "\"").append(","); - builder.append("\"open\"").append(":").append("\"" + dataGroup.getOpen() + "\"").append(","); - builder.append("\"node_type\"").append(":").append("\"" + dataGroup.getNode_type() + "\"").append(","); - builder.append("\"ancestor\"").append(":").append("\"" + dataGroup.getAncestor() + "\"").append(","); - builder.append("\"parent\"").append(":").append("\"" + dataGroup.getParent() + "\"").append(","); - builder.append("\"parent_name\"").append(":").append("\"" + dataGroup.getParent_name() + "\"").append(","); - builder.append("\"view_order\"").append(":").append("\"" + dataGroup.getView_order() + "\"").append(","); - builder.append("\"depth\"").append(":").append("\"" + dataGroup.getDepth() + "\"").append(","); - builder.append("\"default_yn\"").append(":").append("\"" + dataGroup.getDefault_yn() + "\"").append(","); - builder.append("\"use_yn\"").append(":").append("\"" + dataGroup.getUse_yn() + "\"").append(","); - builder.append("\"child_yn\"").append(":").append("\"" + dataGroup.getUse_yn() + "\"").append(","); - builder.append("\"latitude\"").append(":").append("\"" + dataGroup.getLatitude() + "\"").append(","); - builder.append("\"longitude\"").append(":").append("\"" + dataGroup.getLongitude() + "\"").append(","); - builder.append("\"height\"").append(":").append("\"" + dataGroup.getHeight() + "\"").append(","); - builder.append("\"duration\"").append(":").append("\"" + dataGroup.getDuration() + "\"").append(","); - builder.append("\"description\"").append(":").append("\"" + dataGroup.getDescription() + "\""); - - if(dataGroupCount > 1) { - long preParent = dataGroup.getParent(); - int preDepth = dataGroup.getDepth(); - int bigParentheses = 0; - for(int i = 1; i < dataGroupCount; i++) { - dataGroup = dataGroupList.get(i); - - if(preParent == dataGroup.getParent()) { - // 부모가 같은 경우 - builder.append("}"); - builder.append(","); - } else { - if(preDepth > dataGroup.getDepth()) { - // 닫힐때 - int closeCount = preDepth - dataGroup.getDepth(); - for(int j=0; j dataGroupList = dataGroupService.getListDataGroupByDepth(1); + Project project = new Project(); + project.setUse_yn(Project.IN_USE); + List projectList = projectService.getListProject(project); + @SuppressWarnings("unchecked") List issuePriorityList = (List)CacheManager.getCommonCode(CommonCode.ISSUE_PRIORITY); @SuppressWarnings("unchecked") @@ -114,7 +117,7 @@ public String inputIssue(Model model) { Issue issue = new Issue(); model.addAttribute(issue); - model.addAttribute("dataGroupList", dataGroupList); + model.addAttribute("projectList", projectList); model.addAttribute("issuePriorityList", issuePriorityList); model.addAttribute("issueTypeList", issueTypeList); @@ -140,14 +143,17 @@ public String ajaxInsertIssue(MultipartHttpServletRequest request, Issue issue, if(fileInfo.getError_code() != null && !"".equals(fileInfo.getError_code())) { bindingResult.rejectValue("file_name", fileInfo.getError_code()); - List dataGroupList = dataGroupService.getListDataGroupByDepth(1); + Project project = new Project(); + project.setUse_yn(Project.IN_USE); + List projectList = projectService.getListProject(project); + @SuppressWarnings("unchecked") List issuePriorityList = (List)CacheManager.getCommonCode(CommonCode.ISSUE_PRIORITY); @SuppressWarnings("unchecked") List issueTypeList = (List)CacheManager.getCommonCode(CommonCode.ISSUE_TYPE); model.addAttribute(issue); - model.addAttribute("dataGroupList", dataGroupList); + model.addAttribute("projectList", projectList); model.addAttribute("issuePriorityList", issuePriorityList); model.addAttribute("issueTypeList", issueTypeList); @@ -175,14 +181,17 @@ public String ajaxInsertIssue(MultipartHttpServletRequest request, Issue issue, bindingResult.rejectValue("contents", errorcode); } - List dataGroupList = dataGroupService.getListDataGroupByDepth(1); + Project project = new Project(); + project.setUse_yn(Project.IN_USE); + List projectList = projectService.getListProject(project); + @SuppressWarnings("unchecked") List issuePriorityList = (List)CacheManager.getCommonCode(CommonCode.ISSUE_PRIORITY); @SuppressWarnings("unchecked") List issueTypeList = (List)CacheManager.getCommonCode(CommonCode.ISSUE_TYPE); model.addAttribute(issue); - model.addAttribute("dataGroupList", dataGroupList); + model.addAttribute("projectList", projectList); model.addAttribute("issuePriorityList", issuePriorityList); model.addAttribute("issueTypeList", issueTypeList); diff --git a/mago3d-admin/src/main/java/com/gaia3d/controller/ProjectController.java b/mago3d-admin/src/main/java/com/gaia3d/controller/ProjectController.java new file mode 100644 index 00000000..42c564da --- /dev/null +++ b/mago3d-admin/src/main/java/com/gaia3d/controller/ProjectController.java @@ -0,0 +1,240 @@ +package com.gaia3d.controller; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import javax.servlet.http.HttpServletRequest; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Controller; +import org.springframework.ui.Model; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.ResponseBody; + +import com.gaia3d.domain.CacheManager; +import com.gaia3d.domain.Policy; +import com.gaia3d.domain.Project; +import com.gaia3d.service.ProjectService; + +import lombok.extern.slf4j.Slf4j; + +/** + * Project + * @author jeongdae + * + */ +@Slf4j +@Controller +@RequestMapping("/data/") +public class ProjectController { + + @Autowired + private ProjectService projectService; + + /** + * Project 목록 + * @param model + * @return + */ + @GetMapping(value = "list-project.do") + public String projectList(Model model) { + List projectList = projectService.getListProject(new Project()); + + model.addAttribute("projectListSize", projectList.size()); + model.addAttribute("projectList", projectList); + + return "/data/list-project"; + } + + /** + * Ajax Project 목록 + * @param request + * @return + */ + @PostMapping(value = "ajax-list-project.do") + @ResponseBody + public Map ajaxListProject(HttpServletRequest request) { + Map jSONObject = new HashMap(); + String result = "success"; + try { + List projectList = projectService.getListProject(new Project()); + jSONObject.put("projectList", projectList); + } catch(Exception e) { + e.printStackTrace(); + result = "db.exception"; + } + + jSONObject.put("result", result); + return jSONObject; + } + + /** + * Project 등록 화면 + * @param model + * @return + */ + @GetMapping(value = "input-project.do") + public String inputProject(Model model) { + Policy policy = CacheManager.getPolicy(); + + model.addAttribute("policy", policy); + model.addAttribute("project", new Project()); + + return "/data/input-project"; + } + + /** + * Project key 중복 체크 + * @param model + * @return + */ + @PostMapping(value = "ajax-project-key-duplication-check.do") + @ResponseBody + public Map ajaxProjectKeyDuplicationCheck(HttpServletRequest request, Project project) { + + Map jSONObject = new HashMap(); + String result = "success"; + String duplication_value = ""; + + log.info("@@ project = {}", project); + try { + if(project.getProject_key() == null || "".equals(project.getProject_key())) { + result = "project.key.empty"; + jSONObject.put("result", result); + return jSONObject; + } else if(project.getOld_project_key() != null && !"".equals(project.getOld_project_key())) { + if(project.getProject_key().equals(project.getOld_project_key())) { + result = "project.key.same"; + jSONObject.put("result", result); + return jSONObject; + } + } + + int count = projectService.getDuplicationKeyCount(project.getProject_key()); + log.info("@@ duplication_value = {}", count); + duplication_value = String.valueOf(count); + } catch(Exception e) { + e.printStackTrace(); + result = "db.exception"; + } + + jSONObject.put("result", result); + jSONObject.put("duplication_value", duplication_value); + + return jSONObject; + } + + /** + * Project 추가 + * @param request + * @param project + * @return + */ + @PostMapping(value = "ajax-insert-project.do") + @ResponseBody + public Map ajaxInsertProject(HttpServletRequest request, Project project) { + Map jSONObject = new HashMap(); + String result = "success"; + try { + log.info("@@ project = {} ", project); + + if(project.getProject_key() == null || "".equals(project.getProject_key()) + || project.getProject_name() == null || "".equals(project.getProject_name())) { + result = "input.invalid"; + jSONObject.put("result", result); + return jSONObject; + } + + projectService.insertProject(project); + } catch(Exception e) { + e.printStackTrace(); + result = "db.exception"; + } + + jSONObject.put("result", result); + return jSONObject; + } + + /** + * Project 수정 화면 + * @param model + * @return + */ + @GetMapping(value = "modify-project.do") + public String modifyProject(Model model, Long project_id) { + + Project project = projectService.getProject(project_id); + project.setOld_project_key(project.getProject_key()); + + model.addAttribute("project", project); + + return "/data/modify-project"; + } + + /** + * Project 수정 + * @param request + * @param project + * @return + */ + @PostMapping(value = "ajax-update-project.do") + @ResponseBody + public Map ajaxUpdateProject(HttpServletRequest request, Project project) { + Map jSONObject = new HashMap(); + String result = "success"; + try { + + log.info("@@ project = {} ", project); + if(project.getProject_id() == null || project.getProject_id().longValue() == 0l + || project.getProject_name() == null || "".equals(project.getProject_name())) { + + result = "input.invalid"; + jSONObject.put("result", result); + return jSONObject; + } + + projectService.updateProject(project); + } catch(Exception e) { + e.printStackTrace(); + result = "db.exception"; + } + + jSONObject.put("result", result); + return jSONObject; + } + + /** + * Project 삭제 + * @param request + * @param project + * @return + */ + @PostMapping(value = "ajax-delete-project.do") + @ResponseBody + public Map ajaxDeleteProject(HttpServletRequest request, Project project) { + Map jSONObject = new HashMap(); + String result = "success"; + try { + log.info("@@ project = {} ", project); +// if(dataGroup.getData_group_id() == null || dataGroup.getData_group_id().longValue() == 0l) { +// dataGroupList.addAll(projectService.getListDataGroup(new Project())); +// +// result = "input.invalid"; +// return JSONUtil.getResultTreeString(result, dataGroupTree); +// } +// +// projectService.deleteDataGroup(dataGroup.getData_group_id()); +// dataGroupList.addAll(projectService.getListDataGroup(new Project())); + + } catch(Exception e) { + e.printStackTrace(); + result = "db.exception"; + } + + jSONObject.put("result", result); + return jSONObject; + } +} diff --git a/mago3d-admin/src/main/java/com/gaia3d/controller/UserGroupController.java b/mago3d-admin/src/main/java/com/gaia3d/controller/UserGroupController.java index 3b62a7e6..dcced79e 100644 --- a/mago3d-admin/src/main/java/com/gaia3d/controller/UserGroupController.java +++ b/mago3d-admin/src/main/java/com/gaia3d/controller/UserGroupController.java @@ -1,9 +1,7 @@ package com.gaia3d.controller; import java.util.ArrayList; -import java.util.HashMap; import java.util.List; -import java.util.Map; import javax.servlet.http.HttpServletRequest; @@ -144,8 +142,6 @@ public String resultUserGroupMenu(@RequestParam("user_group_id") Long user_group @PostMapping(value = "ajax-list-user-group.do", produces = "application/json; charset=utf8") @ResponseBody public String ajaxListUserGroup(HttpServletRequest request) { -// Gson gson = new Gson(); -// Map jSONObject = new HashMap(); String result = "success"; String userGroupTree = null; List userGroupList = new ArrayList(); @@ -159,13 +155,7 @@ public String ajaxListUserGroup(HttpServletRequest request) { result = "db.execption"; } -// jSONObject.put("result", result); -// jSONObject.put("userGroupTree", userGroupTree); - - String jsonResult = "{\"result\": \"" + result + "\",\"userGroupTree\":" + userGroupTree + "}"; - return jsonResult; - -// return gson.toJson(jSONObject); + return "{\"result\": \"" + result + "\",\"userGroupTree\":" + userGroupTree + "}"; } /** @@ -194,12 +184,7 @@ public String ajaxInsertUserGroup(HttpServletRequest request, UserGroup userGrou userGroupTree = getUserGroupTree(userGroupList); result = "input.invalid"; -// jSONObject.put("result", result); -// jSONObject.put("userGroupTree", getUserGroupTree(userGroupList)); -// -// return gson.toJson(jSONObject); - String jsonResult = "{\"result\": \"" + result + "\",\"userGroupTree\":" + userGroupTree + "}"; - return jsonResult; + return "{\"result\": \"" + result + "\",\"userGroupTree\":" + userGroupTree + "}"; } // TODO group_key 중복 체크 해야 함 @@ -222,13 +207,7 @@ public String ajaxInsertUserGroup(HttpServletRequest request, UserGroup userGrou result = "db.exception"; } -// jSONObject.put("result", result); -// jSONObject.put("userGroupTree", userGroupTree); -// -// return gson.toJson(jSONObject); - - String jsonResult = "{\"result\": \"" + result + "\",\"userGroupTree\":" + userGroupTree + "}"; - return jsonResult; + return "{\"result\": \"" + result + "\",\"userGroupTree\":" + userGroupTree + "}"; } /** @@ -240,8 +219,6 @@ public String ajaxInsertUserGroup(HttpServletRequest request, UserGroup userGrou @PostMapping(value = "ajax-update-user-group.do", produces = "application/json; charset=utf8") @ResponseBody public String ajaxUpdateUserGroup(HttpServletRequest request, UserGroup userGroup) { -// Gson gson = new Gson(); -// Map jSONObject = new HashMap(); String result = "success"; String userGroupTree = null; List userGroupList = new ArrayList(); @@ -257,12 +234,7 @@ public String ajaxUpdateUserGroup(HttpServletRequest request, UserGroup userGrou userGroupTree = getUserGroupTree(userGroupList); result = "input.invalid"; -// jSONObject.put("result", result); -// jSONObject.put("userGroupTree", getUserGroupTree(userGroupList)); -// -// return jSONObject.toString(); - String jsonResult = "{\"result\": \"" + result + "\",\"userGroupTree\":" + userGroupTree + "}"; - return jsonResult; + return "{\"result\": \"" + result + "\",\"userGroupTree\":" + userGroupTree + "}"; } userGroupService.updateUserGroup(userGroup); @@ -275,11 +247,7 @@ public String ajaxUpdateUserGroup(HttpServletRequest request, UserGroup userGrou result = "db.exception"; } -// jSONObject.put("result", result); -// jSONObject.put("userGroupTree", userGroupTree); -// return gson.toJson(jSONObject); - String jsonResult = "{\"result\": \"" + result + "\",\"userGroupTree\":" + userGroupTree + "}"; - return jsonResult; + return "{\"result\": \"" + result + "\",\"userGroupTree\":" + userGroupTree + "}"; } /** @@ -288,10 +256,9 @@ public String ajaxUpdateUserGroup(HttpServletRequest request, UserGroup userGrou * @param userGroup * @return */ - @PostMapping(value = "ajax-update-move-user-group.do") + @PostMapping(value = "ajax-update-move-user-group.do", produces = "application/json; charset=utf8") @ResponseBody - public Map ajaxUpdateMoveUserGroup(HttpServletRequest request, UserGroup userGroup) { - Map jSONObject = new HashMap(); + public String ajaxUpdateMoveUserGroup(HttpServletRequest request, UserGroup userGroup) { String result = "success"; String userGroupTree = null; List userGroupList = new ArrayList(); @@ -305,10 +272,7 @@ public Map ajaxUpdateMoveUserGroup(HttpServletRequest request, U userGroupList.addAll(userGroupService.getListUserGroup(new UserGroup())); result = "input.invalid"; - jSONObject.put("result", result); - jSONObject.put("userGroupTree", getUserGroupTree(userGroupList)); - - return jSONObject; + return "{\"result\": \"" + result + "\",\"userGroupTree\":" + userGroupTree + "}"; } userGroupService.updateMoveUserGroup(userGroup); @@ -320,10 +284,8 @@ public Map ajaxUpdateMoveUserGroup(HttpServletRequest request, U e.printStackTrace(); result = "db.exception"; } - jSONObject.put("result", result); - jSONObject.put("userGroupTree", userGroupTree); - return jSONObject; + return "{\"result\": \"" + result + "\",\"userGroupTree\":" + userGroupTree + "}"; } /** @@ -332,10 +294,9 @@ public Map ajaxUpdateMoveUserGroup(HttpServletRequest request, U * @param userGroup * @return */ - @PostMapping(value = "ajax-delete-user-group.do") + @PostMapping(value = "ajax-delete-user-group.do", produces = "application/json; charset=utf8") @ResponseBody - public Map ajaxDeleteUserGroup(HttpServletRequest request, UserGroup userGroup) { - Map jSONObject = new HashMap(); + public String ajaxDeleteUserGroup(HttpServletRequest request, UserGroup userGroup) { String result = "success"; String userGroupTree = null; List userGroupList = new ArrayList(); @@ -346,10 +307,7 @@ public Map ajaxDeleteUserGroup(HttpServletRequest request, UserG userGroupList.addAll(userGroupService.getListUserGroup(new UserGroup())); result = "input.invalid"; - jSONObject.put("result", result); - jSONObject.put("userGroupTree", getUserGroupTree(userGroupList)); - - return jSONObject; + return "{\"result\": \"" + result + "\",\"userGroupTree\":" + userGroupTree + "}"; } userGroupService.deleteUserGroup(userGroup.getUser_group_id()); @@ -361,10 +319,7 @@ public Map ajaxDeleteUserGroup(HttpServletRequest request, UserG e.printStackTrace(); result = "db.exception"; } - jSONObject.put("result", result); - jSONObject.put("userGroupTree", userGroupTree); - - return jSONObject; + return "{\"result\": \"" + result + "\",\"userGroupTree\":" + userGroupTree + "}"; } /** diff --git a/mago3d-admin/src/main/java/com/gaia3d/service/DataGroupService.java b/mago3d-admin/src/main/java/com/gaia3d/service/DataGroupService.java deleted file mode 100644 index d93fb32c..00000000 --- a/mago3d-admin/src/main/java/com/gaia3d/service/DataGroupService.java +++ /dev/null @@ -1,85 +0,0 @@ -package com.gaia3d.service; - -import java.util.List; - -import com.gaia3d.domain.DataGroup; - -/** - * Data 그룹 관리 - * - * @author jeongdae - * - */ -public interface DataGroupService { - - /** - * Data 그룹 목록 - * - * @param dataGroup - * @return - */ - List getListDataGroup(DataGroup dataGroup); - - /** - * depth별 Data 그룹 목록 - * @param depth - * @return - */ - List getListDataGroupByDepth(Integer depth); - - /** - * ancestor별 Data 그룹 목록 - * @param ancestor - * @return - */ - List getListDataGroupByAncestor(Long ancestor); - - /** - * Data 그룹 조회 - * - * @param data_group_id - * @return - */ - DataGroup getDataGroup(Long data_group_id); - - /** - * 자식 그룹 중 순서가 최대인 그룹을 검색 - * - * @param parent - * @return - */ - DataGroup getMaxViewOrderChildDataGroup(Long parent); - - /** - * Data 그룹 등록 - * - * @param dataGroup - * @return - */ - int insertDataGroup(DataGroup dataGroup); - - /** - * Data 그룹 수정 - * - * @param dataGroup - * @return - */ - int updateDataGroup(DataGroup dataGroup); - - /** - * Data 그룹 위로/아래로 수정 - * - * @param dataGroup - * @return - */ - int updateMoveDataGroup(DataGroup dataGroup); - - /** - * Data 그룹 삭제 - * - * @param data_group_id - * @return - */ - int deleteDataGroup(Long data_group_id); - -} diff --git a/mago3d-admin/src/main/java/com/gaia3d/service/DataService.java b/mago3d-admin/src/main/java/com/gaia3d/service/DataService.java index 303066eb..c033ccfe 100644 --- a/mago3d-admin/src/main/java/com/gaia3d/service/DataService.java +++ b/mago3d-admin/src/main/java/com/gaia3d/service/DataService.java @@ -37,7 +37,7 @@ public interface DataService { * @param dataInfo * @return */ - List getListDataByDataGroupId(DataInfo dataInfo); + List getListDataByProjectId(DataInfo dataInfo); /** * data_group_id를 제외한 Data 목록 @@ -48,10 +48,10 @@ public interface DataService { /** * Data Key 중복 건수 - * @param data_key + * @param dataInfo * @return */ - Integer getDuplicationKeyCount(String data_key); + Integer getDuplicationKeyCount(DataInfo dataInfo); /** * Data 정보 취득 @@ -60,6 +60,20 @@ public interface DataService { */ DataInfo getData(Long data_id); + /** + * 표시 순서 + * @param dvataInfo + * @return + */ + Integer getViewOrderByParent(DataInfo dvataInfo); + + /** + * 한 프로젝트 내 Root Parent 개수를 체크 + * @param dvataInfo + * @return + */ + Integer getRootParentCount(DataInfo dvataInfo); + /** * Data 등록 * @param dataInfo diff --git a/mago3d-admin/src/main/java/com/gaia3d/service/ProjectService.java b/mago3d-admin/src/main/java/com/gaia3d/service/ProjectService.java new file mode 100644 index 00000000..0fdc22d1 --- /dev/null +++ b/mago3d-admin/src/main/java/com/gaia3d/service/ProjectService.java @@ -0,0 +1,62 @@ +package com.gaia3d.service; + +import java.util.List; + +import com.gaia3d.domain.Project; + +/** + * Project 관리 + * + * @author jeongdae + * + */ +public interface ProjectService { + + /** + * Project 목록 + * + * @param project + * @return + */ + List getListProject(Project project); + + /** + * Project 조회 + * + * @param project_id + * @return + */ + Project getProject(Long project_id); + + /** + * Project Key 중복 건수 + * @param project_key + * @return + */ + Integer getDuplicationKeyCount(String project_key); + + /** + * Project 등록 + * + * @param project + * @return + */ + int insertProject(Project project); + + /** + * Project 수정 + * + * @param project + * @return + */ + int updateProject(Project project); + + /** + * Project 삭제 + * + * @param project_id + * @return + */ + int deleteProject(Long project_id); + +} diff --git a/mago3d-admin/src/main/java/com/gaia3d/service/impl/DataGroupServiceImpl.java b/mago3d-admin/src/main/java/com/gaia3d/service/impl/DataGroupServiceImpl.java deleted file mode 100644 index 5f63772f..00000000 --- a/mago3d-admin/src/main/java/com/gaia3d/service/impl/DataGroupServiceImpl.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.gaia3d.service.impl; - -import java.util.List; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; -import org.springframework.transaction.annotation.Transactional; - -import com.gaia3d.domain.DataGroup; -import com.gaia3d.persistence.DataGroupMapper; -import com.gaia3d.service.DataGroupService; - -/** - * Data 그룹 - * - * @author jeongdae - * - */ -@Service -public class DataGroupServiceImpl implements DataGroupService { - - @Autowired - private DataGroupMapper dataGroupMapper; - - /** - * Data 그룹 목록 - * - * @param dataGroup - * @return - */ - @Transactional(readOnly = true) - public List getListDataGroup(DataGroup dataGroup) { - return dataGroupMapper.getListDataGroup(dataGroup); - } - - /** - * depth별 Data 그룹 목록 - * @param depth - * @return - */ - @Transactional(readOnly = true) - public List getListDataGroupByDepth(Integer depth) { - return dataGroupMapper.getListDataGroupByDepth(depth); - } - - /** - * ancestor별 Data 그룹 목록 - * @param ancestor - * @return - */ - @Transactional(readOnly = true) - public List getListDataGroupByAncestor(Long ancestor) { - return dataGroupMapper.getListDataGroupByAncestor(ancestor); - } - - /** - * Data 그룹 조회 - * - * @param data_group_id - * @return - */ - @Transactional(readOnly = true) - public DataGroup getDataGroup(Long data_group_id) { - return dataGroupMapper.getDataGroup(data_group_id); - } - - /** - * 자식 그룹 중에 순서가 최대인 그룹을 검색 - * - * @param parent - * @return - */ - @Transactional(readOnly = true) - public DataGroup getMaxViewOrderChildDataGroup(Long parent) { - return dataGroupMapper.getMaxViewOrderChildDataGroup(parent); - } - - /** - * Data 그룹 등록 - * - * @param dataGroup - * @return - */ - @Transactional - public int insertDataGroup(DataGroup dataGroup) { - - // TODO 이건 bdr 때문에 한거 같은데.... sequence 로 바꿔야 할 듯 - dataGroup.setData_group_id(dataGroupMapper.getMaxDataGroupId()); - dataGroupMapper.insertDataGroup(dataGroup); - - // 부모 그룹 자식 존재 유무 컬럼 수정 - DataGroup parentDataGroup = new DataGroup(); - parentDataGroup.setData_group_id(dataGroup.getParent()); - parentDataGroup.setChild_yn("Y"); - dataGroupMapper.updateDataGroupChildYN(parentDataGroup); - return 0; - } - - /** - * Data 그룹 수정 - * - * @param dataGroup - * @return - */ - @Transactional - public int updateDataGroup(DataGroup dataGroup) { - return dataGroupMapper.updateDataGroup(dataGroup); - } - - /** - * Data 그룹 트리에서 정렬 순서 변경 - * - * @param dataGroup - * @return - */ - @Transactional - public int updateMoveDataGroup(DataGroup dataGroup) { - Integer modifyViewOrder = dataGroup.getView_order(); - DataGroup searchDataGroup = new DataGroup(); - searchDataGroup.setUpdate_type(dataGroup.getUpdate_type()); - searchDataGroup.setParent(dataGroup.getParent()); - - if ("up".equals(dataGroup.getUpdate_type())) { - // 바로 위 메뉴의 view_order 를 +1 - searchDataGroup.setView_order(dataGroup.getView_order()); - searchDataGroup = getDataGroupByParentAndViewOrder(searchDataGroup); - dataGroup.setView_order(searchDataGroup.getView_order()); - searchDataGroup.setView_order(modifyViewOrder); - } else { - // 바로 아래 메뉴의 view_order 를 -1 함 - searchDataGroup.setView_order(dataGroup.getView_order()); - searchDataGroup = getDataGroupByParentAndViewOrder(searchDataGroup); - dataGroup.setView_order(searchDataGroup.getView_order()); - searchDataGroup.setView_order(modifyViewOrder); - } - updateViewOrderDataGroup(searchDataGroup); - - return updateViewOrderDataGroup(dataGroup); - } - - /** - * 부모와 표시 순서로 메뉴 조회 - * - * @param dataGroup - * @return - */ - private DataGroup getDataGroupByParentAndViewOrder(DataGroup dataGroup) { - return dataGroupMapper.getDataGroupByParentAndViewOrder(dataGroup); - } - - /** - * - * @param dataGroup - * @return - */ - private int updateViewOrderDataGroup(DataGroup dataGroup) { - return dataGroupMapper.updateViewOrderDataGroup(dataGroup); - } - - /** - * Data 그룹 삭제 - * - * @param data_group_id - * @return - */ - @Transactional - public int deleteDataGroup(Long data_group_id) { - return deleteDataGroupList(data_group_id); - } - - /** - * Data 그룹 삭제 메소드 - * - * @param data_group_id - * @return - */ - public int deleteDataGroupList(Long data_group_id) { - // 자식 목록 리스트 - List childDataGroupIdList = dataGroupMapper.getListDataGroupChild(data_group_id); - - if (childDataGroupIdList != null && !childDataGroupIdList.isEmpty()) { - for (Long childDataGroupId : childDataGroupIdList) { - deleteDataGroup(childDataGroupId); - } - } - return dataGroupMapper.deleteDataGroup(data_group_id); - } -} diff --git a/mago3d-admin/src/main/java/com/gaia3d/service/impl/DataServiceImpl.java b/mago3d-admin/src/main/java/com/gaia3d/service/impl/DataServiceImpl.java index c881e60a..611020cd 100644 --- a/mago3d-admin/src/main/java/com/gaia3d/service/impl/DataServiceImpl.java +++ b/mago3d-admin/src/main/java/com/gaia3d/service/impl/DataServiceImpl.java @@ -4,16 +4,12 @@ import java.util.List; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.authentication.encoding.ShaPasswordEncoder; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; -import com.gaia3d.domain.CacheManager; -import com.gaia3d.domain.Policy; import com.gaia3d.domain.DataInfo; import com.gaia3d.persistence.DataMapper; import com.gaia3d.service.DataService; -import com.gaia3d.util.StringUtil; /** * Data @@ -62,8 +58,8 @@ public List getListData(DataInfo dataInfo) { * @return */ @Transactional(readOnly=true) - public List getListDataByDataGroupId(DataInfo dataInfo) { - return dataMapper.getListDataByDataGroupId(dataInfo); + public List getListDataByProjectId(DataInfo dataInfo) { + return dataMapper.getListDataByProjectId(dataInfo); } /** @@ -78,12 +74,12 @@ public List getListExceptDataGroupDataByGroupId(DataInfo dataInfo) { /** * Data Key 중복 건수 - * @param data_key + * @param dataInfo * @return */ @Transactional(readOnly=true) - public Integer getDuplicationKeyCount(String data_key) { - return dataMapper.getDuplicationKeyCount(data_key); + public Integer getDuplicationKeyCount(DataInfo dataInfo) { + return dataMapper.getDuplicationKeyCount(dataInfo); } /** @@ -96,6 +92,26 @@ public DataInfo getData(Long data_id) { return dataMapper.getData(data_id); } + /** + * 표시 순서 + * @param dvataInfo + * @return + */ + @Transactional(readOnly=true) + public Integer getViewOrderByParent(DataInfo dvataInfo) { + return dataMapper.getViewOrderByParent(dvataInfo); + } + + /** + * 한 프로젝트 내 Root Parent 개수를 체크 + * @param dvataInfo + * @return + */ + @Transactional(readOnly=true) + public Integer getRootParentCount(DataInfo dvataInfo) { + return dataMapper.getRootParentCount(dvataInfo); + } + /** * Data 등록 * @param dataInfo diff --git a/mago3d-admin/src/main/java/com/gaia3d/service/impl/FileServiceImpl.java b/mago3d-admin/src/main/java/com/gaia3d/service/impl/FileServiceImpl.java index 78e6d122..0335a761 100644 --- a/mago3d-admin/src/main/java/com/gaia3d/service/impl/FileServiceImpl.java +++ b/mago3d-admin/src/main/java/com/gaia3d/service/impl/FileServiceImpl.java @@ -730,17 +730,17 @@ private Map excelParsePoiData(FileInfo fileInfo, String userId) private DataInfo getDataInfoFromPoi(List excelObject) { DataInfo dataInfo = new DataInfo(); - dataInfo.setData_key((String)excelObject.get(0)); - dataInfo.setData_group_id(Long.valueOf((String)excelObject.get(1))); - dataInfo.setData_name(StringUtil.getDefaultValue((String)excelObject.get(2))); - dataInfo.setLatitude(StringUtil.getDefaultValue((String)excelObject.get(3))); - dataInfo.setLongitude(StringUtil.getDefaultValue((String)excelObject.get(4))); - dataInfo.setLocation("POINT(" + dataInfo.getLongitude() + " " + dataInfo.getLatitude() + ")"); - log.info("@@@@@@@@@ location = {}", dataInfo.getLocation()); - dataInfo.setHeight(StringUtil.getDefaultValue((String)excelObject.get(5))); - dataInfo.setHeading(StringUtil.getDefaultValue((String)excelObject.get(6))); - dataInfo.setPitch(StringUtil.getDefaultValue((String)excelObject.get(7))); - dataInfo.setRoll(StringUtil.getDefaultValue((String)excelObject.get(8))); +// dataInfo.setData_key((String)excelObject.get(0)); +// //dataInfo.setData_group_id(Long.valueOf((String)excelObject.get(1))); +// dataInfo.setData_name(StringUtil.getDefaultValue((String)excelObject.get(2))); +// dataInfo.setLatitude(StringUtil.getDefaultValue((String)excelObject.get(3))); +// dataInfo.setLongitude(StringUtil.getDefaultValue((String)excelObject.get(4))); +// dataInfo.setLocation("POINT(" + dataInfo.getLongitude() + " " + dataInfo.getLatitude() + ")"); +// log.info("@@@@@@@@@ location = {}", dataInfo.getLocation()); +// dataInfo.setHeight(StringUtil.getDefaultValue((String)excelObject.get(5))); +// dataInfo.setHeading(StringUtil.getDefaultValue((String)excelObject.get(6))); +// dataInfo.setPitch(StringUtil.getDefaultValue((String)excelObject.get(7))); +// dataInfo.setRoll(StringUtil.getDefaultValue((String)excelObject.get(8))); return dataInfo; } diff --git a/mago3d-admin/src/main/java/com/gaia3d/service/impl/ProjectServiceImpl.java b/mago3d-admin/src/main/java/com/gaia3d/service/impl/ProjectServiceImpl.java new file mode 100644 index 00000000..896cd02a --- /dev/null +++ b/mago3d-admin/src/main/java/com/gaia3d/service/impl/ProjectServiceImpl.java @@ -0,0 +1,89 @@ +package com.gaia3d.service.impl; + +import java.util.List; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import com.gaia3d.domain.Project; +import com.gaia3d.persistence.ProjectMapper; +import com.gaia3d.service.ProjectService; + +/** + * Project + * + * @author jeongdae + * + */ +@Service +public class ProjectServiceImpl implements ProjectService { + + @Autowired + private ProjectMapper projectMapper; + + /** + * Project 목록 + * + * @param project + * @return + */ + @Transactional(readOnly = true) + public List getListProject(Project project) { + return projectMapper.getListProject(project); + } + + /** + * Project 조회 + * + * @param project_id + * @return + */ + @Transactional(readOnly = true) + public Project getProject(Long project_id) { + return projectMapper.getProject(project_id); + } + + /** + * Project Key 중복 건수 + * @param project_key + * @return + */ + @Transactional(readOnly=true) + public Integer getDuplicationKeyCount(String project_key) { + return projectMapper.getDuplicationKeyCount(project_key); + } + + /** + * Project 등록 + * + * @param project + * @return + */ + @Transactional + public int insertProject(Project project) { + return projectMapper.insertProject(project); + } + + /** + * Project 수정 + * + * @param project + * @return + */ + @Transactional + public int updateProject(Project project) { + return projectMapper.updateProject(project); + } + + /** + * Project 삭제 + * + * @param project_id + * @return + */ + @Transactional + public int deleteProject(Long project_id) { + return projectMapper.deleteProject(project_id); + } +} diff --git a/mago3d-admin/src/main/java/com/gaia3d/validator/DataValidator.java b/mago3d-admin/src/main/java/com/gaia3d/validator/DataValidator.java index 8439023e..b647ec1a 100644 --- a/mago3d-admin/src/main/java/com/gaia3d/validator/DataValidator.java +++ b/mago3d-admin/src/main/java/com/gaia3d/validator/DataValidator.java @@ -28,8 +28,8 @@ public void validate(Object target, Errors errors) { ValidationUtilsHelper.rejectIfEmptyOrWhitespace(errors, "data_id", "field.required"); } - if(dataInfo.getData_group_id() <= 0) { - errors.rejectValue("data_group_id", "field.required", null, null); + if(dataInfo.getProject_id() <= 0) { + errors.rejectValue("project_id", "field.required", null, null); } ValidationUtilsHelper.rejectIfEmptyOrWhitespace(errors, "data_name", "field.required"); } diff --git a/mago3d-admin/src/main/java/com/gaia3d/validator/DataGroupValidator.java b/mago3d-admin/src/main/java/com/gaia3d/validator/ProjectValidator.java similarity index 51% rename from mago3d-admin/src/main/java/com/gaia3d/validator/DataGroupValidator.java rename to mago3d-admin/src/main/java/com/gaia3d/validator/ProjectValidator.java index 99464aea..cb21ee43 100644 --- a/mago3d-admin/src/main/java/com/gaia3d/validator/DataGroupValidator.java +++ b/mago3d-admin/src/main/java/com/gaia3d/validator/ProjectValidator.java @@ -5,27 +5,27 @@ import org.springframework.validation.ValidationUtils; import org.springframework.validation.Validator; -import com.gaia3d.domain.DataGroup; +import com.gaia3d.domain.Project; /** - * Data 그룹 등록, 수정 Validation 체크 + * project 등록, 수정 Validation 체크 * @author jeongdae * */ -@Component("dataGroupValidator") -public class DataGroupValidator implements Validator { +@Component("projectValidator") +public class ProjectValidator implements Validator { @Override public boolean supports(Class clazz) { - return (DataGroup.class.isAssignableFrom(clazz)); + return (Project.class.isAssignableFrom(clazz)); } @Override public void validate(Object target, Errors errors) { - //DataGroup dataGroup = (DataGroup)target; + //Project project = (Project)target; - ValidationUtils.rejectIfEmptyOrWhitespace(errors, "data_group_key", "field.required"); - ValidationUtils.rejectIfEmptyOrWhitespace(errors, "data_group_name", "field.required"); + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "project_key", "field.required"); + ValidationUtils.rejectIfEmptyOrWhitespace(errors, "project_name", "field.required"); ValidationUtils.rejectIfEmptyOrWhitespace(errors, "use_yn", "field.required"); } } diff --git a/mago3d-admin/src/main/resources/application.properties b/mago3d-admin/src/main/resources/application.properties index 454e0d58..f11b84c6 100644 --- a/mago3d-admin/src/main/resources/application.properties +++ b/mago3d-admin/src/main/resources/application.properties @@ -1,4 +1,5 @@ #https://docs.spring.io/spring-boot/docs/current/reference/html/common-application-properties.html +debug=true server.port=80 spring.thymeleaf.cache=false @@ -44,4 +45,9 @@ spring.http.multipart.max-request-size=10MB #server.error.include-stacktrace=always # 스프링 부트에서 기본적으로 제공하는 에러 페이지를 볼것인가? (기본값은 본다.) # 안본다고(false) 설정하면 기본 서블릿 컨테이너 에러 화면을 보게 된다. -#server.error.whitelabel.enabled=false \ No newline at end of file +#server.error.whitelabel.enabled=false + +# EMBEDDED SERVER CONFIGURATION (ServerProperties) +server.compression.enabled=true +server.compression.mime-types=application/json,text/plain,image/jpeg +server.compression.min-response-size=2048 \ No newline at end of file diff --git a/mago3d-admin/src/main/resources/logback-spring.xml b/mago3d-admin/src/main/resources/logback-spring.xml index af6a120e..32fbee2b 100644 --- a/mago3d-admin/src/main/resources/logback-spring.xml +++ b/mago3d-admin/src/main/resources/logback-spring.xml @@ -31,12 +31,18 @@ - + --> + - + + + + + diff --git a/mago3d-admin/src/main/resources/mago3d.properties b/mago3d-admin/src/main/resources/mago3d.properties index 42dff6a6..5079ad56 100644 --- a/mago3d-admin/src/main/resources/mago3d.properties +++ b/mago3d-admin/src/main/resources/mago3d.properties @@ -1,5 +1,5 @@ ################# mago3d configuration ############################ -mago3d.os-type=window +mago3d.os-type=WINDOW mago3d.server-ip=localhost mago3d.server-info=1 mago3d.rest-auth-key=fnjnu55siF++Mkr5Nr9zMBYf2FHvf9zrKe/K/0HsQxs= diff --git a/mago3d-admin/src/main/resources/messages/messages_ko.properties b/mago3d-admin/src/main/resources/messages/messages_ko.properties index 0da7f8c9..f0514ba7 100644 --- a/mago3d-admin/src/main/resources/messages/messages_ko.properties +++ b/mago3d-admin/src/main/resources/messages/messages_ko.properties @@ -264,14 +264,11 @@ user.input.check.box=체크표시는 필수입력 항목입니다. #data data=데이터 -data.group.name=그룹명 -data.group=데이터 그룹 -data.group.name.en=그룹명(영문) +project.name=Project명 +project=Project +project.name.en=Project(영문) data.cache.init=캐시갱신 -data.sub.group.add=하위그룹추가 data.select.delete=선택삭제 -data.group.up=위로 -data.group.down=아래로 data.use.not=사용여부 data.lat.lon.height.s=위도/경도/높이/초 data.management=데이터 관리 diff --git a/mago3d-admin/src/main/resources/mybatis-config.xml b/mago3d-admin/src/main/resources/mybatis-config.xml index c3b10d62..dd196139 100644 --- a/mago3d-admin/src/main/resources/mybatis-config.xml +++ b/mago3d-admin/src/main/resources/mybatis-config.xml @@ -12,7 +12,7 @@ - + @@ -38,4 +38,12 @@ + + diff --git a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-backoffice.jsp b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-backoffice.jsp index aebdbf39..710eb6b1 100644 --- a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-backoffice.jsp +++ b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-backoffice.jsp @@ -1,7 +1,6 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
- diff --git a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-content.jsp b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-content.jsp index 3305122a..a1b68db5 100644 --- a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-content.jsp +++ b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-content.jsp @@ -1,7 +1,6 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
-
diff --git a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-geo.jsp b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-geo.jsp index 9aa4a772..d568ff73 100644 --- a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-geo.jsp +++ b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-geo.jsp @@ -1,7 +1,6 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
-
@@ -27,6 +26,15 @@ + + + + + + + + + + + + " + + " " + + ""; + } else { + projectListCount = projectList.length; + for(i=0; i" + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " " + + " "; + } + } + + $("#projectList").empty(); + $("#projectList").html(content); + } else { + alert(JS_MESSAGE[msg.result]); + } + }, + error:function(request, status, error) { + //alert(JS_MESSAGE["ajax.error.message"]); + alert(" code : " + request.status + "\n" + ", message : " + request.responseText + "\n" + ", error : " + error); + } + }); + } + + // 전체 선택 + $("#chk_all").click(function() { + $(":checkbox[name=project_id]").prop("checked", this.checked); + }); + + $( "#projectSelect" ).on( "click", function() { + var checkedValue = ""; + $("input:checkbox[name=project_id]:checked").each(function(index){ + checkedValue += $(this).val() + ","; + }); + if(checkedValue.indexOf(",") > 0) { + checkedValue =checkedValue.substring(0, checkedValue.lastIndexOf(",")); + } + + $("#geo_data_default_projects").val(checkedValue); + dataDialog.dialog( "close" ); + }); + // GeoServer var updatePolicyGeoServerFlag = true; function updatePolicyGeoServer() { if(updatePolicyGeoServerFlag) { // validation 나중에 updatePolicyGeoServerFlag = false; - var info = $("#policyGeoServer").serialize(); + var info = $("#policyGeoServer").serialize() + "&policy_id=" + $("#policy_id").val(); $.ajax({ url: "/config/ajax-update-policy-geoserver.do", type: "POST", data: info, cache: false, - async:false, dataType: "json", success: function(msg){ if(msg.result == "success") { @@ -478,13 +558,12 @@ if(updatePolicyGeoCallBackFlag) { // validation 나중에 updatePolicyGeoCallBackFlag = false; - var info = $("#policyGeoCallBack").serialize(); + var info = $("#policyGeoCallBack").serialize() + "&policy_id=" + $("#policy_id").val(); $.ajax({ url: "/config/ajax-update-policy-geocallback.do", type: "POST", data: info, cache: false, - async:false, dataType: "json", success: function(msg){ if(msg.result == "success") { @@ -521,13 +600,12 @@ } } updateSecurityFlag = false; - var info = $("#policySecurity").serialize(); + var info = $("#policySecurity").serialize() + "&policy_id=" + $("#policy_id").val(); $.ajax({ url: "/config/ajax-update-policy-security.do", type: "POST", data: info, cache: false, - async:false, dataType: "json", success: function(msg){ if(msg.result == "success") { @@ -601,13 +679,12 @@ } updateContentFlag = false; - var info = $("#policyContent").serialize(); + var info = $("#policyContent").serialize() + "&policy_id=" + $("#policy_id").val(); $.ajax({ url: "/config/ajax-update-policy-content.do", type: "POST", data: info, cache: false, - async:false, dataType: "json", success: function(msg){ if(msg.result == "success") { @@ -633,13 +710,12 @@ function updatePolicyBackoffice() { if(updateBackofficeFlag) { updateBackofficeFlag = false; - var info = $("#policyBackoffice").serialize(); + var info = $("#policyBackoffice").serialize() + "&policy_id=" + $("#policy_id").val(); $.ajax({ url: "/config/ajax-update-policy-backoffice.do", type: "POST", data: info, cache: false, - async:false, dataType: "json", success: function(msg){ if(msg.result == "success") { @@ -687,13 +763,12 @@ } updateSiteFlag = false; - var info = $("#policySite").serialize(); + var info = $("#policySite").serialize() + "&policy_id=" + $("#policy_id").val(); $.ajax({ url: "/config/ajax-update-policy-site.do", type: "POST", data: info, cache: false, - async:false, dataType: "json", success: function(msg){ if(msg.result == "success") { @@ -740,13 +815,12 @@ } updateSolutionFlag = false; - var info = $("#policySolution").serialize(); + var info = $("#policySolution").serialize() + "&policy_id=" + $("#policy_id").val(); $.ajax({ url: "/config/ajax-update-policy-solution.do", type: "POST", data: info, cache: false, - async:false, dataType: "json", success: function(msg){ if(msg.result == "success") { @@ -766,15 +840,6 @@ return; } } - - /* function checkChangLogo() { - if($("#uploadfile_top").val() != null && $("#uploadfile_top").val() != "") { - $("#uploadfile_top_value").val("logo"); - } - if($("#uploadfile_bottom").val() != null && $("#uploadfile_bottom").val() != "") { - $("#uploadfile_bottom_value").val("logo"); - } - } */ \ No newline at end of file diff --git a/mago3d-admin/src/main/webapp/WEB-INF/views/data/input-data.jsp b/mago3d-admin/src/main/webapp/WEB-INF/views/data/input-data.jsp index 65d41822..21cf77b5 100644 --- a/mago3d-admin/src/main/webapp/WEB-INF/views/data/input-data.jsp +++ b/mago3d-admin/src/main/webapp/WEB-INF/views/data/input-data.jsp @@ -39,40 +39,54 @@ + + + + - - + + + +
+ 시작시 로딩 프로젝트 + + + +
@@ -85,7 +93,7 @@
- + @@ -93,6 +101,24 @@
+ Terrain + + + +
+ Field Of View + + + +
@@ -190,3 +216,40 @@ + + +
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
Key프로젝트명순서기본값사용유무위도경도높이이동시간등록일
+
+ +
+
diff --git a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-geocallback.jsp b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-geocallback.jsp index 501a28ab..8608e14c 100644 --- a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-geocallback.jsp +++ b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-geocallback.jsp @@ -1,7 +1,6 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
- @@ -17,6 +16,15 @@ + + + + diff --git a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-geoserver.jsp b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-geoserver.jsp index 892bacd4..5f9fda63 100644 --- a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-geoserver.jsp +++ b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-geoserver.jsp @@ -1,7 +1,6 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
-
+ api 처리 결과 Callback + + + +
Object Select Callback
diff --git a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-os.jsp b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-os.jsp index 06d8e51c..fcb34201 100644 --- a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-os.jsp +++ b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-os.jsp @@ -1,7 +1,6 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
-
diff --git a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-password.jsp b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-password.jsp index df68cb37..c9cfeed8 100644 --- a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-password.jsp +++ b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-password.jsp @@ -1,7 +1,6 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
-
diff --git a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-security.jsp b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-security.jsp index 87d072f1..4adc869d 100644 --- a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-security.jsp +++ b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-security.jsp @@ -1,7 +1,6 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
-
diff --git a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-site.jsp b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-site.jsp index 00c97521..bc0971d0 100644 --- a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-site.jsp +++ b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-site.jsp @@ -1,7 +1,6 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
-
diff --git a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-solution.jsp b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-solution.jsp index 28adcf30..f8865610 100644 --- a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-solution.jsp +++ b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-solution.jsp @@ -1,7 +1,6 @@ <%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
-
diff --git a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-user.jsp b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-user.jsp index f5fd2c3b..b3498c28 100644 --- a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-user.jsp +++ b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy-user.jsp @@ -74,16 +74,6 @@ - - - -
- - - - - -
diff --git a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy.jsp b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy.jsp index c6a5295f..b9b535ac 100644 --- a/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy.jsp +++ b/mago3d-admin/src/main/webapp/WEB-INF/views/config/modify-policy.jsp @@ -131,13 +131,12 @@ if(updateOsFlag) { updateOsFlag = false; - var info = $("#policyOs").serialize(); + var info = $("#policyOs").serialize() + "&policy_id=" + $("#policy_id").val(); $.ajax({ url: "/config/ajax-update-policy-os.do", type: "POST", data: info, cache: false, - async:false, dataType: "json", success: function(msg){ if(msg.result == "success") { @@ -211,7 +210,6 @@ type: "POST", data: info, cache: false, - async:false, dataType: "json", success: function(msg){ if(msg.result == "success") { @@ -315,13 +313,12 @@ } */ updatePasswordFlag = false; - var info = $("#policyPassword").serialize(); + var info = $("#policyPassword").serialize() + "&policy_id=" + $("#policy_id").val(); $.ajax({ url: "/config/ajax-update-policy-password.do", type: "POST", data: info, cache: false, - async:false, dataType: "json", success: function(msg){ if(msg.result == "success") { @@ -353,7 +350,7 @@ info.find(item => item.name === "geo_ambient_reflection_coef").value = $("#geo_ambient_reflection_coef").val(); info.find(item => item.name === "geo_diffuse_reflection_coef").value = $("#geo_diffuse_reflection_coef").val(); info.find(item => item.name === "geo_specular_reflection_coef").value = $("#geo_specular_reflection_coef").val(); - info = $.param(info); + info = $.param(info) + "&policy_id=" + $("#policy_id").val(); $.ajax({ url: "/config/ajax-update-policy-geo.do", type: "POST", @@ -439,19 +436,102 @@ }); } + var dataDialog = $( ".dataDialog" ).dialog({ + autoOpen: false, + height: 600, + width: 1200, + modal: true, + overflow : "auto", + resizable: false + }); + + // 시작 프로젝트 찾기 + $( "#projectFind" ).on( "click", function() { + dataDialog.dialog( "open" ); + drawProjectList(); + }); + + function drawProjectList() { + $.ajax({ + url: "/data/ajax-list-project.do", + type: "POST", + //data: info, + cache: false, + dataType: "json", + success: function(msg){ + if(msg.result == "success") { + var content = ""; + var projectList = msg.projectList; + if(projectList == null || projectList.length == 0) { + content = content + + "
프로젝트가 존재하지 않습니다.
" + project.project_key + " " + project.project_name + " " + project.view_order + "" + project.default_yn + "" + project.use_yn + "" + project.latitude + "" + project.longitude + "" + project.height + "" + project.duration + "" + project.insert_date +"
- Key + 프로젝트명 - - - - +
- + 상위 Node - - - + + + + +
+ Key + + + + + +
+ - +
- @@ -82,7 +96,6 @@
- @@ -92,7 +105,6 @@
- @@ -102,7 +114,6 @@
Heading - @@ -112,7 +123,6 @@
Pitch - @@ -122,7 +132,6 @@
Roll - @@ -131,20 +140,27 @@
- + 속성 - - + + +
+ 설명 + + +
-