초기소스
This commit is contained in:
70
src/main/java/com/wb/domainserver/domain/comm/ApiSvc.java
Normal file
70
src/main/java/com/wb/domainserver/domain/comm/ApiSvc.java
Normal file
@@ -0,0 +1,70 @@
|
||||
package com.wb.domainserver.domain.comm;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.InputStreamReader;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URL;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class ApiSvc {
|
||||
|
||||
public String getConnect(String Url) throws Exception {
|
||||
HttpURLConnection con = connect(Url);
|
||||
try {
|
||||
con.setRequestMethod("GET");
|
||||
con.setRequestProperty("Content-Type", "application/json");
|
||||
|
||||
int responseCode = con.getResponseCode();
|
||||
log.debug("responseCode : " + responseCode);
|
||||
if(responseCode == HttpURLConnection.HTTP_OK) {
|
||||
return readBody(con.getInputStream());
|
||||
|
||||
} else {
|
||||
return readBody(con.getErrorStream());
|
||||
}
|
||||
}catch (IOException e) {
|
||||
throw new Exception("API 요청과 응답 실패",e);
|
||||
}finally {
|
||||
con.disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public HttpURLConnection connect(String apiUrl) throws Exception {
|
||||
try {
|
||||
URL url = new URL(apiUrl);
|
||||
return (HttpURLConnection)url.openConnection();
|
||||
}catch (MalformedURLException e) {
|
||||
throw new Exception("API URL이 잘못되었습니다. : "+apiUrl,e);
|
||||
}catch (IOException e) {
|
||||
throw new Exception("연결이 실패했습니다. : "+apiUrl,e);
|
||||
}
|
||||
}
|
||||
|
||||
public String readBody(InputStream body) throws Exception {
|
||||
InputStreamReader streamReader = new InputStreamReader(body, "UTF-8");
|
||||
|
||||
try (BufferedReader lineReader = new BufferedReader(streamReader)){
|
||||
StringBuilder responseBody = new StringBuilder();
|
||||
|
||||
String line;
|
||||
|
||||
while((line = lineReader.readLine()) != null) {
|
||||
responseBody.append(line);
|
||||
}
|
||||
return responseBody.toString();
|
||||
} catch (IOException e) {
|
||||
throw new Exception("API 응답을 읽는데 실패했습니다.",e);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
package com.wb.domainserver.domain.comm.controller;
|
||||
|
||||
import com.wb.domainserver.domain.mngr.bbs.cnslt.vo.CnsltVO;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
|
||||
/**
|
||||
* 공통화면 처리를 위한 Controller
|
||||
*
|
||||
* @author 박철민
|
||||
* @since 2023-11-27
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2023-11-27 박철민 최초 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
|
||||
@Slf4j
|
||||
@Controller
|
||||
@RequestMapping("/comm")
|
||||
public class CommonController {
|
||||
|
||||
/**
|
||||
* 공통화면 Include 처리
|
||||
* @return Include JSP 경로
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/include")
|
||||
public String include() {
|
||||
return "comm/Include";
|
||||
}
|
||||
|
||||
/**
|
||||
* 관리자시스템 CSS Include 처리
|
||||
* @return Include JSP 경로
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/mngrCss")
|
||||
public String mngrCss() {
|
||||
return "comm/MngrCssInclude";
|
||||
}
|
||||
|
||||
/**
|
||||
* 관리자 header영역 처리
|
||||
* @return header JSP 경로
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/mngr/header")
|
||||
public String mngrHeader() {
|
||||
return "comm/mngr/Header";
|
||||
}
|
||||
|
||||
/**
|
||||
* 관리자 Left영역 처리
|
||||
* @return String left JSP경로
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/mngr/left")
|
||||
public String mngrLeft() {
|
||||
return "comm/mngr/Left";
|
||||
}
|
||||
|
||||
/**
|
||||
* 통합관리자 Include영역 처리
|
||||
* @return String include JSP경로
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/admin/include")
|
||||
public String adminInclude() {
|
||||
return "comm/admin/Include";
|
||||
}
|
||||
|
||||
/**
|
||||
* 통합관리자 Header영역 처리
|
||||
* @return String header JSP경로
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/admin/header")
|
||||
public String adminHeader() {
|
||||
return "comm/admin/Header";
|
||||
}
|
||||
|
||||
/**
|
||||
* 통합관리자 Left영역 처리
|
||||
* @return String left JSP경로
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/admin/left")
|
||||
public String adminLeft() {
|
||||
return "comm/admin/Left";
|
||||
}
|
||||
/**
|
||||
* crm Include영역 처리
|
||||
* @return String include JSP경로
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/crm/include")
|
||||
public String crmInclude() {
|
||||
return "comm/crm/Include";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* crm Header영역 처리
|
||||
* @return String header JSP경로
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/crm/header")
|
||||
public String crmHeader() {
|
||||
return "comm/crm/Header";
|
||||
}
|
||||
|
||||
/**
|
||||
* crm Left영역 처리
|
||||
* @return String left JSP경로
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/crm/left")
|
||||
public String crmLeft(CnsltVO cnsltVO) {
|
||||
return "comm/crm/Left";
|
||||
}
|
||||
|
||||
/**
|
||||
* crm Right영역 처리
|
||||
* @return String right JSP경로
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/crm/right")
|
||||
public String crmRight(CnsltVO cnsltVO) {
|
||||
|
||||
return "comm/crm/Right";
|
||||
}
|
||||
|
||||
/**
|
||||
* 인트라넷 left 영역 처리
|
||||
* @return String right JSP경로
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/itrnt/left")
|
||||
public String itrntLeft() {
|
||||
return "comm/itrnt/Left";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 인트라넷 header영역 처리
|
||||
* @return String right JSP경로
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/itrnt/header")
|
||||
public String itrntHeader() {
|
||||
return "comm/itrnt/Header";
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 인트라넷 Include 처리
|
||||
* @return Include JSP 경로
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping(value = "/itrnt/include")
|
||||
public String itrntInclude() {
|
||||
return "comm/itrnt/Include";
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
package com.wb.domainserver.domain.comm.vo;
|
||||
|
||||
import com.wb.domainserver.common.mvc.tags.ui.pagination.PaginationInfo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.sql.Date;
|
||||
|
||||
@Data
|
||||
public abstract class AbstractVO implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/** 사용여부 */
|
||||
private String useAt;
|
||||
/** 등록자 */
|
||||
private int regusr;
|
||||
/** 등록일시 */
|
||||
private Date registDt;
|
||||
/** 등록일자 */
|
||||
private String registDe;
|
||||
/** 수정자 */
|
||||
private int updusr;
|
||||
/** 수정일시 */
|
||||
private Date updtDt;
|
||||
/** 수정일자 */
|
||||
private String updtDe;
|
||||
/** 현재페이지 */
|
||||
private int pageIndex = 1;
|
||||
/** 페이지갯수 */
|
||||
private int pageUnit = 10;
|
||||
/** 페이지사이즈 */
|
||||
private int pageSize = 10;
|
||||
/** 첫페이지 인덱스 */
|
||||
private int firstIndex = 1;
|
||||
/** 마지막페이지 인덱스 */
|
||||
private int lastIndex = 1;
|
||||
/** 페이지당 레코드 개수 */
|
||||
private int recordCountPerPage = 10;
|
||||
/** pagination객체 */
|
||||
private PaginationInfo paginationInfo;
|
||||
}
|
||||
@@ -0,0 +1,109 @@
|
||||
package com.wb.domainserver.domain.comm.vo;
|
||||
|
||||
import com.wb.domainserver.exception.WnbtRestException;
|
||||
import com.wb.domainserver.security.authorization.annotation.AuthPolicy;
|
||||
import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.util.file.FileMngUtil;
|
||||
import com.wb.domainserver.util.string.StringUtil;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.http.ResponseEntity;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||
import org.springframework.web.util.WebUtils;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 공통화면 처리를 위한 Controller
|
||||
* @author 김혜인
|
||||
* @since 2024-05-02
|
||||
* @version 1.0
|
||||
* @see
|
||||
*
|
||||
* <pre>
|
||||
* == (Modification Information) == 개정이력
|
||||
*
|
||||
* 수정일 수정자 수정내용
|
||||
* ------- -------- ---------------------------
|
||||
* 2024-05-02 김혜인. 최초 생성 생성
|
||||
*
|
||||
* </pre>
|
||||
*/
|
||||
@Slf4j
|
||||
// @Controller
|
||||
@RequestMapping("/comm")
|
||||
public class CommonController {
|
||||
// @Autowired
|
||||
private FileMngUtil fileMngUtil;
|
||||
|
||||
@Value("${sopmalfo.common.fileupload.uploaddirs.goods}")
|
||||
private String uploadFilePath;
|
||||
|
||||
@Value("${sopmalfo.common.fileupload.extensions.images}")
|
||||
private String whiteListFileUploadExtensions;
|
||||
|
||||
/**
|
||||
* CK에디터로 업로드된 이미지 파일 처리
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping("/ckeditor/image/fileUpload")
|
||||
public ResponseEntity<?> fileUpload(HttpServletRequest request) {
|
||||
Map<String, List<Map<String, Object>>> ulpladFileMap = new HashMap<>();
|
||||
Map<String, Object> resultMap = new HashMap<>();
|
||||
MultipartHttpServletRequest mptRequest = WebUtils.getNativeRequest(request, MultipartHttpServletRequest.class);
|
||||
//TODO : 에디터 이미지 경로 확정 후 수정
|
||||
if (mptRequest != null) {
|
||||
MultiValueMap<String, MultipartFile> files = mptRequest.getMultiFileMap();
|
||||
|
||||
Iterator<String> fInputs = files.keySet().iterator();
|
||||
while (fInputs.hasNext()) {
|
||||
String key = fInputs.next();
|
||||
ulpladFileMap.put(key, fileMngUtil.parseFileInf(files.get(key), "test", uploadFilePath, whiteListFileUploadExtensions));
|
||||
}
|
||||
}
|
||||
if(ulpladFileMap.get("upload") != null
|
||||
&& !ulpladFileMap.get("upload").isEmpty()) {
|
||||
resultMap.put("uploaded", true);
|
||||
resultMap.put("url", "/comm/ckeditor/image/fileView?item01="+ulpladFileMap.get("upload").get(0).get("streFileNm"));
|
||||
} else {
|
||||
resultMap.put("uploaded", false);
|
||||
resultMap.put("url", "");
|
||||
}
|
||||
return ResponseEntity.status(HttpStatus.OK).body(resultMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* CK에디터로 업로드된 이미지 view 처리
|
||||
* @param request
|
||||
* @param response
|
||||
*/
|
||||
@Policy(AuthPolicy.PUBLIC)
|
||||
@RequestMapping("/ckeditor/image/fileView")
|
||||
public void fileUpload(HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
String item01 = request.getParameter("item01");
|
||||
try {
|
||||
if(!StringUtil.isEmpty(item01)) {
|
||||
//TODO : 에디터 이미지 경로 확정 후 수정
|
||||
fileMngUtil.viewFile(response, uploadFilePath, item01, "", null);
|
||||
}
|
||||
|
||||
} catch (WnbtRestException wre){
|
||||
throw new WnbtRestException(wre.getMessage());
|
||||
} catch(Exception e) {
|
||||
log.error("에디터 업로드 이미지 조회 중 오류가 발생하였습니다.");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
63
src/main/java/com/wb/domainserver/domain/comm/vo/MenuVO.java
Normal file
63
src/main/java/com/wb/domainserver/domain/comm/vo/MenuVO.java
Normal file
@@ -0,0 +1,63 @@
|
||||
package com.wb.domainserver.domain.comm.vo;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
public class MenuVO extends AbstractVO {
|
||||
|
||||
/** 메뉴코드*/
|
||||
private String menuCd;
|
||||
/** 상위 메뉴코드*/
|
||||
private String upperMenuCd;
|
||||
/** 메뉴명*/
|
||||
@NotEmpty(message = "메뉴명")
|
||||
private String menuNm;
|
||||
/** 메뉴DETPH*/
|
||||
private String menuDepth;
|
||||
/** LEVEL*/
|
||||
@NotEmpty(message = "순서")
|
||||
private String sortOrdr;
|
||||
/** 최상단메뉴코드*/
|
||||
private String upmostMenuCd;
|
||||
/** 메뉴설명*/
|
||||
private String menuDc;
|
||||
/** 노출,미노출,기간노출*/
|
||||
private String expsrCd;
|
||||
/** 노출시작일시*/
|
||||
private String expsrBgnDt;
|
||||
/** 노출종료일시*/
|
||||
private String expsrEndDt;
|
||||
/** ++ 추가 접근권한 */
|
||||
private String authorDv;
|
||||
/** 쇼핑몰 코드 */
|
||||
private String sopmalCd;
|
||||
/** 카테고리 코드 */
|
||||
private String ctgry;
|
||||
/** 최상단메뉴코드 */
|
||||
private String topMenuCd;
|
||||
|
||||
private String nextDeptCd1;
|
||||
private String nextDeptCd2;
|
||||
private String nextDepth2;
|
||||
private String nextDepth3;
|
||||
|
||||
/** fm_auth_fnct_menu(mapping table) */
|
||||
private String url;
|
||||
|
||||
private String ty;
|
||||
private String ctgryId;
|
||||
private String upperCtgryId;
|
||||
private String ctgryNm;
|
||||
private String ctgryDepth;
|
||||
private String menuExpsrAt;
|
||||
private String gnbExpsrAt;
|
||||
private String bbsId;
|
||||
private String menuChrColor;
|
||||
private String originalHost;
|
||||
/*접속환경구분*/
|
||||
private String env;
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user