Merge branch 'dev' into feature/add-profiles
This commit is contained in:
commit
ec3d6348b5
260
pom.xml
260
pom.xml
@ -1,127 +1,133 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.interplug</groupId>
|
||||
<artifactId>qcast</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>qcast</name>
|
||||
<description>qcast</description>
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<!-- Spring Boot Start -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<!-- Spring Boot End -->
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.mybatis.spring.boot/mybatis-spring-boot-starter -->
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
|
||||
<dependency>
|
||||
<groupId>org.bgee.log4jdbc-log4j2</groupId>
|
||||
<artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
|
||||
<version>1.16</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.github.ulisesbocchio/jasypt-spring-boot-starter -->
|
||||
<dependency>
|
||||
<groupId>com.github.ulisesbocchio</groupId>
|
||||
<artifactId>jasypt-spring-boot-starter</artifactId>
|
||||
<version>3.0.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.microsoft.sqlserver</groupId>
|
||||
<artifactId>mssql-jdbc</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||
<version>2.6.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.16.0</version>
|
||||
</dependency>
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-parent</artifactId>
|
||||
<version>3.3.0</version>
|
||||
<relativePath/> <!-- lookup parent from repository -->
|
||||
</parent>
|
||||
<groupId>com.interplug</groupId>
|
||||
<artifactId>qcast</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>qcast</name>
|
||||
<description>qcast</description>
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<!-- Spring Boot Start -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-jdbc</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-devtools</artifactId>
|
||||
<scope>runtime</scope>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-security</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-actuator</artifactId>
|
||||
</dependency>
|
||||
<!-- Spring Boot End -->
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.mybatis.spring.boot/mybatis-spring-boot-starter -->
|
||||
<dependency>
|
||||
<groupId>org.mybatis.spring.boot</groupId>
|
||||
<artifactId>mybatis-spring-boot-starter</artifactId>
|
||||
<version>3.0.3</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/log4j/log4j -->
|
||||
<dependency>
|
||||
<groupId>org.bgee.log4jdbc-log4j2</groupId>
|
||||
<artifactId>log4jdbc-log4j2-jdbc4.1</artifactId>
|
||||
<version>1.16</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.github.ulisesbocchio/jasypt-spring-boot-starter -->
|
||||
<dependency>
|
||||
<groupId>com.github.ulisesbocchio</groupId>
|
||||
<artifactId>jasypt-spring-boot-starter</artifactId>
|
||||
<version>3.0.5</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.microsoft.sqlserver</groupId>
|
||||
<artifactId>mssql-jdbc</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.springdoc</groupId>
|
||||
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
|
||||
<version>2.6.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/org.apache.commons/commons-lang3 -->
|
||||
<dependency>
|
||||
<groupId>org.apache.commons</groupId>
|
||||
<artifactId>commons-lang3</artifactId>
|
||||
<version>3.16.0</version>
|
||||
</dependency>
|
||||
|
||||
<!-- https://mvnrepository.com/artifact/com.fasterxml.jackson.core/jackson-databind -->
|
||||
<dependency>
|
||||
<groupId>com.fasterxml.jackson.core</groupId>
|
||||
<artifactId>jackson-databind</artifactId>
|
||||
<version>2.18.0-rc1</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<excludes>
|
||||
<exclude>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
</exclude>
|
||||
</excludes>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
@ -0,0 +1,49 @@
|
||||
package com.interplug.qcast.biz.community;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.interplug.qcast.biz.community.dto.BoardRequest;
|
||||
import com.interplug.qcast.biz.community.dto.BoardResponse;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/board")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "BoardController", description = "Community Board API")
|
||||
public class BoardController {
|
||||
|
||||
private final BoardService boardService;
|
||||
|
||||
@Operation(description = "커뮤니티(공지사항, FAQ, 자료다운로드) 게시글 목록을 조회한다.")
|
||||
@GetMapping("/list")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public BoardResponse getBoardList(@ModelAttribute BoardRequest boardRequest) throws Exception {
|
||||
return boardService.getBoardList(boardRequest);
|
||||
}
|
||||
|
||||
@Operation(description = "커뮤니티(공지사항, FAQ, 자료다운로드) 게시글 상세 정보를 조회한다.")
|
||||
@GetMapping("/detail")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public BoardResponse getBoardDetail(@ModelAttribute BoardRequest boardRequest) throws Exception {
|
||||
return boardService.getBoardDetail(boardRequest);
|
||||
}
|
||||
|
||||
@Operation(description = "커뮤니티(공지사항, FAQ, 자료다운로드) 파일 다운로드를 진행한다.")
|
||||
@GetMapping("/file/download")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public void getFileDownload(HttpServletResponse response,
|
||||
@RequestParam(required = true) String encodeFileNo) throws Exception {
|
||||
boardService.getFileDownload(response, encodeFileNo);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,122 @@
|
||||
package com.interplug.qcast.biz.community;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.StreamUtils;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.interplug.qcast.biz.community.dto.BoardRequest;
|
||||
import com.interplug.qcast.biz.community.dto.BoardResponse;
|
||||
import com.interplug.qcast.util.InterfaceQsp;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class BoardService {
|
||||
|
||||
@Value("${qsp.url}")
|
||||
private String QSP_API_URL;
|
||||
|
||||
private final InterfaceQsp interfaceQsp;
|
||||
|
||||
/**
|
||||
* ※ 게시판 목록 조회 QSP -> Q.CAST3
|
||||
*
|
||||
* @param boardRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public BoardResponse getBoardList(BoardRequest boardRequest) throws Exception {
|
||||
|
||||
BoardResponse response = null;
|
||||
|
||||
/* [0]. QSP API (url + param) Setting */
|
||||
String url = QSP_API_URL + "/api/board/list";
|
||||
String apiUrl =
|
||||
UriComponentsBuilder.fromHttpUrl(url).queryParam("noticeNo", boardRequest.getNoticeNo())
|
||||
.queryParam("schTitle", boardRequest.getSchTitle())
|
||||
.queryParam("schNoticeTpCd", boardRequest.getSchNoticeTpCd())
|
||||
.queryParam("schNoticeClsCd", boardRequest.getSchNoticeClsCd())
|
||||
.queryParam("startRow", boardRequest.getStartRow())
|
||||
.queryParam("endRow", boardRequest.getEndRow()).build().toUriString();
|
||||
|
||||
/* [1]. QSP API CALL -> Response */
|
||||
String strResponse = interfaceQsp.callApi(HttpMethod.GET, apiUrl, null);
|
||||
|
||||
if (!"".equals(strResponse)) {
|
||||
ObjectMapper om =
|
||||
new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
|
||||
response = om.readValue(strResponse, BoardResponse.class);
|
||||
}
|
||||
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* ※ 게시판 상세 조회 QSP -> Q.CAST3
|
||||
*
|
||||
* @param boardRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public BoardResponse getBoardDetail(BoardRequest boardRequest) throws Exception {
|
||||
|
||||
BoardResponse response = null;
|
||||
|
||||
/* [0]. QSP API (url + param) Setting */
|
||||
String url = QSP_API_URL + "/api/board/detail";
|
||||
String apiUrl = UriComponentsBuilder.fromHttpUrl(url)
|
||||
.queryParam("noticeNo", boardRequest.getNoticeNo()).build().toUriString();
|
||||
|
||||
/* [1]. QSP API CALL -> Response */
|
||||
String strResponse = interfaceQsp.callApi(HttpMethod.GET, apiUrl, null);
|
||||
|
||||
if (!"".equals(strResponse)) {
|
||||
ObjectMapper om =
|
||||
new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
|
||||
response = om.readValue(strResponse, BoardResponse.class);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* ※ 게시판 파일 다운로드 QSP -> Q.CAST3
|
||||
*
|
||||
* @param response
|
||||
* @param encodeFileNo
|
||||
* @throws Exception
|
||||
*/
|
||||
public void getFileDownload(HttpServletResponse response, String encodeFileNo) throws Exception {
|
||||
|
||||
/* [0]. QSP API (url + fileNo) Setting */
|
||||
String url = QSP_API_URL + "/api/file/downloadFile" + "?encodeFileNo=" + encodeFileNo;
|
||||
|
||||
/* [1]. QSP API CALL -> Response */
|
||||
String strResponse = interfaceQsp.callApi(HttpMethod.GET, url, null);
|
||||
|
||||
if (!"".equals(strResponse)) {
|
||||
/* [2]. API 응답 파일 처리 */
|
||||
response.setContentType("application/octet-stream");
|
||||
response.setHeader("Content-Disposition", "attachment;");
|
||||
|
||||
InputStream inputStream = new ByteArrayInputStream(strResponse.getBytes());
|
||||
StreamUtils.copy(inputStream, response.getOutputStream());
|
||||
|
||||
response.flushBuffer();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.interplug.qcast.biz.community.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class BoardRequest {
|
||||
|
||||
/** NOTICE_NO */
|
||||
private Integer noticeNo;
|
||||
|
||||
/** 제목 검색조건 */
|
||||
private String schTitle;
|
||||
|
||||
/** Notice Type Code 검색조건 */
|
||||
private String schNoticeTpCd;
|
||||
|
||||
/** Notice Type Code 검색조건 */
|
||||
private String schNoticeClsCd;
|
||||
|
||||
/** 시작 행 */
|
||||
private Integer startRow;
|
||||
|
||||
/** 종료 행 */
|
||||
private int endRow;
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.interplug.qcast.biz.community.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class BoardResponse {
|
||||
|
||||
/** API response result */
|
||||
private Object result;
|
||||
|
||||
/** API response data */
|
||||
private Object data;
|
||||
}
|
||||
@ -1,34 +1,58 @@
|
||||
package com.interplug.qcast.biz.login;
|
||||
|
||||
import com.interplug.qcast.biz.login.dto.LoginUser;
|
||||
import com.interplug.qcast.biz.login.dto.UserResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/login")
|
||||
@RequiredArgsConstructor
|
||||
public class LoginController {
|
||||
// @Autowired private LoginService loginService;
|
||||
private final LoginService loginService;
|
||||
|
||||
@PostMapping("/v1.0/login")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public void login(@RequestBody LoginUser loginUser) {
|
||||
log.warn(String.valueOf(log.isDebugEnabled()));
|
||||
if (log.isDebugEnabled()) {
|
||||
log.debug("Login username : " + loginUser.getUsername());
|
||||
log.debug("Login password : " + loginUser.getPassword());
|
||||
log.debug("isLogin : " + loginService.getLogin(loginUser));
|
||||
}
|
||||
}
|
||||
|
||||
@PostMapping("/v1.0/user")
|
||||
@ResponseStatus(HttpStatus.CREATED)
|
||||
public UserResponse getUser(@RequestBody LoginUser loginUser) {
|
||||
return loginService.getUser(loginUser);
|
||||
}
|
||||
}
|
||||
package com.interplug.qcast.biz.login;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.PatchMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.interplug.qcast.biz.login.dto.JoinUser;
|
||||
import com.interplug.qcast.biz.login.dto.LoginUser;
|
||||
import com.interplug.qcast.biz.login.dto.UserLoginResponse;
|
||||
import com.interplug.qcast.biz.login.dto.UserPassword;
|
||||
import com.interplug.qcast.biz.login.dto.UserResponse;
|
||||
import com.interplug.qcast.util.DefaultResponse;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/login")
|
||||
@RequiredArgsConstructor
|
||||
public class LoginController {
|
||||
// @Autowired private LoginService loginService;
|
||||
private final LoginService loginService;
|
||||
|
||||
@Operation(description = "Q.CAST III에 로그인하여 사용자 정보를 획득한다.")
|
||||
@PostMapping("/v1.0/login")
|
||||
public UserLoginResponse login(@RequestBody LoginUser loginUser) throws Exception {
|
||||
return loginService.getLogin(loginUser);
|
||||
}
|
||||
|
||||
@PostMapping("/v1.0/user")
|
||||
@ResponseStatus(HttpStatus.CREATED)
|
||||
public UserResponse getUser(@RequestBody LoginUser loginUser) {
|
||||
return loginService.getUser(loginUser);
|
||||
}
|
||||
|
||||
@Operation(description = "가입 신청 정보를 등록한다.")
|
||||
@PostMapping("/v1.0/user/join")
|
||||
@ResponseStatus(HttpStatus.CREATED)
|
||||
public DefaultResponse joinUser(@RequestBody JoinUser joinUser) throws Exception {
|
||||
return loginService.joinUser(joinUser);
|
||||
}
|
||||
|
||||
@Operation(description = "비밀번호를 초기화한다.")
|
||||
@PatchMapping("/v1.0/user/init-password")
|
||||
public DefaultResponse initPassword(@RequestBody UserPassword userPassword) throws Exception {
|
||||
return loginService.initPassword(userPassword);
|
||||
}
|
||||
|
||||
@Operation(description = "비밀번호를 변경한다.")
|
||||
@PatchMapping("/v1.0/user/change-password")
|
||||
public DefaultResponse changePassword(@RequestBody UserPassword userPassword) throws Exception {
|
||||
return loginService.changePassword(userPassword);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,24 +1,200 @@
|
||||
package com.interplug.qcast.biz.login;
|
||||
|
||||
import com.interplug.qcast.biz.login.dto.LoginUser;
|
||||
import com.interplug.qcast.biz.login.dto.UserResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class LoginService {
|
||||
// @Autowired LoginMapper loginMapper;
|
||||
private final LoginMapper loginMapper;
|
||||
|
||||
public boolean getLogin(LoginUser loginUser) {
|
||||
return loginMapper.getLogin(loginUser);
|
||||
}
|
||||
|
||||
public UserResponse getUser(LoginUser loginUser) {
|
||||
log.info("Build Test");
|
||||
return loginMapper.getUser(loginUser);
|
||||
}
|
||||
}
|
||||
package com.interplug.qcast.biz.login;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.interplug.qcast.biz.login.dto.JoinUser;
|
||||
import com.interplug.qcast.biz.login.dto.LoginUser;
|
||||
import com.interplug.qcast.biz.login.dto.UserLoginResponse;
|
||||
import com.interplug.qcast.biz.login.dto.UserPassword;
|
||||
import com.interplug.qcast.biz.login.dto.UserResponse;
|
||||
import com.interplug.qcast.util.DefaultResponse;
|
||||
import com.interplug.qcast.util.InterfaceQsp;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class LoginService {
|
||||
// @Autowired LoginMapper loginMapper;
|
||||
private final LoginMapper loginMapper;
|
||||
private final InterfaceQsp interfaceQsp;
|
||||
|
||||
@Value("${qsp.url}")
|
||||
private String qspUrl;
|
||||
|
||||
// 로그인 처리
|
||||
public UserLoginResponse getLogin(LoginUser loginUser) throws Exception {
|
||||
if (loginUser == null)
|
||||
throw new IllegalArgumentException("DTO 설정이 필요합니다.");
|
||||
|
||||
if (loginUser.getLangCd() == null || "".equals(loginUser.getLangCd()))
|
||||
throw new IllegalArgumentException("Language Code" + "은(는) 필수값입니다.");
|
||||
|
||||
if (loginUser.getLastEditUser() == null || "".equals(loginUser.getLastEditUser()))
|
||||
throw new IllegalArgumentException("Last Edit User Id" + "은(는) 필수값입니다.");
|
||||
|
||||
if (loginUser.getLoginId() == null || "".equals(loginUser.getLoginId()))
|
||||
throw new IllegalArgumentException("Login Id" + "은(는) 필수값입니다.");
|
||||
|
||||
if (loginUser.getPwd() == null || "".equals(loginUser.getPwd()))
|
||||
throw new IllegalArgumentException("Password" + "은(는) 필수값입니다.");
|
||||
|
||||
UserLoginResponse userLoginResponse = null;
|
||||
|
||||
// QSP API Call..
|
||||
// Q.CAST 로그인
|
||||
// post
|
||||
// /api/user/login
|
||||
String strResponse =
|
||||
interfaceQsp.callApi(HttpMethod.POST, qspUrl + "/api/user/login", loginUser);
|
||||
if (!"".equals(strResponse)) {
|
||||
ObjectMapper om =
|
||||
new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
userLoginResponse = om.readValue(strResponse, UserLoginResponse.class);
|
||||
}
|
||||
|
||||
return userLoginResponse;
|
||||
}
|
||||
|
||||
public UserResponse getUser(LoginUser loginUser) {
|
||||
log.info("Build Test");
|
||||
return loginMapper.getUser(loginUser);
|
||||
}
|
||||
|
||||
// 가입 신청 등록
|
||||
public DefaultResponse joinUser(JoinUser joinUser) throws Exception {
|
||||
if (joinUser == null)
|
||||
throw new IllegalArgumentException("DTO 설정이 필요합니다.");
|
||||
|
||||
if (joinUser.getLangCd() == null || "".equals(joinUser.getLangCd()))
|
||||
throw new IllegalArgumentException("Language Code" + "은(는) 필수값입니다.");
|
||||
|
||||
if (joinUser.getLastEditUser() == null || "".equals(joinUser.getLastEditUser()))
|
||||
throw new IllegalArgumentException("Last Edit User Id" + "은(는) 필수값입니다.");
|
||||
|
||||
if (joinUser.getStoreQcastNm() == null || "".equals(joinUser.getStoreQcastNm()))
|
||||
throw new IllegalArgumentException("Store QCast Name" + "은(는) 필수값입니다.");
|
||||
|
||||
if (joinUser.getStoreQcastNmKana() == null || "".equals(joinUser.getStoreQcastNmKana()))
|
||||
throw new IllegalArgumentException("Store QCast Name Kana" + "은(는) 필수값입니다.");
|
||||
|
||||
if (joinUser.getPostCd() == null || "".equals(joinUser.getPostCd()))
|
||||
throw new IllegalArgumentException("Postal Code" + "은(는) 필수값입니다.");
|
||||
|
||||
if (joinUser.getAddr() == null || "".equals(joinUser.getAddr()))
|
||||
throw new IllegalArgumentException("Address" + "은(는) 필수값입니다.");
|
||||
|
||||
if (joinUser.getTelNo() == null || "".equals(joinUser.getTelNo()))
|
||||
throw new IllegalArgumentException("Telephone" + "은(는) 필수값입니다.");
|
||||
|
||||
if (joinUser.getFax() == null || "".equals(joinUser.getFax()))
|
||||
throw new IllegalArgumentException("Fax" + "은(는) 필수값입니다.");
|
||||
|
||||
if (joinUser.getUserInfo() == null)
|
||||
throw new IllegalArgumentException("사용자 정보 DTO 설정이 필요합니다.");
|
||||
|
||||
if (joinUser.getUserInfo().getUserId() == null || "".equals(joinUser.getUserInfo().getUserId()))
|
||||
throw new IllegalArgumentException("User Id" + "은(는) 필수값입니다.");
|
||||
|
||||
if (joinUser.getUserInfo().getUserNm() == null || "".equals(joinUser.getUserInfo().getUserNm()))
|
||||
throw new IllegalArgumentException("Name" + "은(는) 필수값입니다.");
|
||||
|
||||
if (joinUser.getUserInfo().getUserNmKana() == null
|
||||
|| "".equals(joinUser.getUserInfo().getUserNmKana()))
|
||||
throw new IllegalArgumentException("Name_Kana" + "은(는) 필수값입니다.");
|
||||
|
||||
if (joinUser.getUserInfo().getTelNo() == null || "".equals(joinUser.getUserInfo().getTelNo()))
|
||||
throw new IllegalArgumentException("Telephone" + "은(는) 필수값입니다.");
|
||||
|
||||
if (joinUser.getUserInfo().getFax() == null || "".equals(joinUser.getUserInfo().getFax()))
|
||||
throw new IllegalArgumentException("Fax" + "은(는) 필수값입니다.");
|
||||
|
||||
if (joinUser.getUserInfo().getEmail() == null || "".equals(joinUser.getUserInfo().getEmail()))
|
||||
throw new IllegalArgumentException("E-Mail" + "은(는) 필수값입니다.");
|
||||
|
||||
// QSP API Call..
|
||||
// Q.CAST 신규 사용자 요청
|
||||
// post
|
||||
// /api/user/newUserIdReq
|
||||
DefaultResponse defaultResponse = null;
|
||||
String strResponse =
|
||||
interfaceQsp.callApi(HttpMethod.POST, qspUrl + "/api/user/newUserIdReq", joinUser);
|
||||
if (!"".equals(strResponse)) {
|
||||
ObjectMapper om =
|
||||
new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
defaultResponse = om.readValue(strResponse, DefaultResponse.class);
|
||||
}
|
||||
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
// 비밀번호 초기화
|
||||
public DefaultResponse initPassword(UserPassword userPassword) throws Exception {
|
||||
if (userPassword == null)
|
||||
throw new IllegalArgumentException("DTO 설정이 필요합니다.");
|
||||
|
||||
if (userPassword.getLangCd() == null || "".equals(userPassword.getLangCd()))
|
||||
throw new IllegalArgumentException("Language Code" + "은(는) 필수값입니다.");
|
||||
|
||||
if (userPassword.getLastEditUser() == null || "".equals(userPassword.getLastEditUser()))
|
||||
throw new IllegalArgumentException("Last Edit User Id" + "은(는) 필수값입니다.");
|
||||
|
||||
if (userPassword.getLoginId() == null || "".equals(userPassword.getLoginId()))
|
||||
throw new IllegalArgumentException("Login Id" + "은(는) 필수값입니다.");
|
||||
|
||||
if (userPassword.getEmail() == null || "".equals(userPassword.getEmail()))
|
||||
throw new IllegalArgumentException("E-Mail" + "은(는) 필수값입니다.");
|
||||
|
||||
// QSP API Call..
|
||||
// Q.CAST 비밀번호 초기화
|
||||
// post
|
||||
// /api/user/initUserPwd
|
||||
DefaultResponse defaultResponse = null;
|
||||
String strResponse =
|
||||
interfaceQsp.callApi(HttpMethod.POST, qspUrl + "/api/user/initUserPwd", userPassword);
|
||||
if (!"".equals(strResponse)) {
|
||||
ObjectMapper om =
|
||||
new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
defaultResponse = om.readValue(strResponse, DefaultResponse.class);
|
||||
}
|
||||
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
// 비밀번호 변경
|
||||
public DefaultResponse changePassword(UserPassword userPassword) throws Exception {
|
||||
if (userPassword == null)
|
||||
throw new IllegalArgumentException("DTO 설정이 필요합니다.");
|
||||
|
||||
if (userPassword.getLangCd() == null || "".equals(userPassword.getLangCd()))
|
||||
throw new IllegalArgumentException("Language Code" + "은(는) 필수값입니다.");
|
||||
|
||||
if (userPassword.getLastEditUser() == null || "".equals(userPassword.getLastEditUser()))
|
||||
throw new IllegalArgumentException("Last Edit User Id" + "은(는) 필수값입니다.");
|
||||
|
||||
if (userPassword.getPwd() == null || "".equals(userPassword.getPwd()))
|
||||
throw new IllegalArgumentException("Now Password" + "은(는) 필수값입니다.");
|
||||
|
||||
if (userPassword.getChgPwd() == null || "".equals(userPassword.getChgPwd()))
|
||||
throw new IllegalArgumentException("Change Password" + "은(는) 필수값입니다.");
|
||||
|
||||
// QSP API Call..
|
||||
// Q.CAST 비밀번호 변경
|
||||
// post
|
||||
// /api/user/userPwdChg
|
||||
DefaultResponse defaultResponse = null;
|
||||
String strResponse =
|
||||
interfaceQsp.callApi(HttpMethod.POST, qspUrl + "/api/user/userPwdChg", userPassword);
|
||||
if (!"".equals(strResponse)) {
|
||||
ObjectMapper om =
|
||||
new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
defaultResponse = om.readValue(strResponse, DefaultResponse.class);
|
||||
}
|
||||
|
||||
return defaultResponse;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
package com.interplug.qcast.biz.login.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class JoinUser {
|
||||
private String langCd; // Language Code
|
||||
private String lastEditUser; // Last Edit User Id
|
||||
private String storeQcastNm; // Store QCast Name
|
||||
private String storeQcastNmKana; // Store QCast Name Kana
|
||||
private String postCd; // Postal Code
|
||||
private String addr; // Address
|
||||
private String telNo; // Telephone
|
||||
private String fax; // Fax
|
||||
private String payTermsCd; // Pay Terms Code
|
||||
private String kamId; // Kam Id
|
||||
private String qtCompNm; // Quotation Company name
|
||||
private String qtPostCd; // Quotation Postal Code
|
||||
private String qtAddr; // Quotation Address
|
||||
private String qtTelNo; // Quotation Telephone
|
||||
private String qtFax; // Quotation Fax
|
||||
private String qtEmail; // Quotation E-Mail
|
||||
private UserInfo userInfo; // user information
|
||||
}
|
||||
@ -1,9 +1,11 @@
|
||||
package com.interplug.qcast.biz.login.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class LoginUser {
|
||||
private String username;
|
||||
private String password;
|
||||
}
|
||||
package com.interplug.qcast.biz.login.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class LoginUser {
|
||||
private String langCd; // Language Code
|
||||
private String lastEditUser; // Last Edit User Id
|
||||
private String loginId; // Login Id
|
||||
private String pwd; // Password
|
||||
}
|
||||
|
||||
@ -0,0 +1,16 @@
|
||||
package com.interplug.qcast.biz.login.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class UserInfo {
|
||||
private String userId; // User Id
|
||||
private String userNm; // Name
|
||||
private String userNmKana; // Name_Kana
|
||||
private String telNo; // Telephone
|
||||
private String fax; // Fax
|
||||
private String email; // E-Mail
|
||||
private String category; // Category
|
||||
}
|
||||
@ -0,0 +1,11 @@
|
||||
package com.interplug.qcast.biz.login.dto;
|
||||
|
||||
import com.interplug.qcast.util.DefaultResponse;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class UserLoginResponse extends DefaultResponse {
|
||||
private UserResponse data;
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.interplug.qcast.biz.login.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class UserPassword {
|
||||
private String langCd; // Language Code
|
||||
private String lastEditUser; // Last Edit User Id
|
||||
private String loginId; // Login Id
|
||||
private String email; // Email
|
||||
private String pwd; // Now Password
|
||||
private String chgPwd; // Change Password
|
||||
}
|
||||
@ -1,15 +1,26 @@
|
||||
package com.interplug.qcast.biz.login.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
//@Data
|
||||
@Getter
|
||||
@Setter
|
||||
public class UserResponse {
|
||||
private String userId;
|
||||
private String saleStoreId;
|
||||
private String name;
|
||||
private String mail;
|
||||
private String tel;
|
||||
}
|
||||
package com.interplug.qcast.biz.login.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
// @Data
|
||||
@Getter
|
||||
@Setter
|
||||
public class UserResponse {
|
||||
private String userId;
|
||||
private String saleStoreId;
|
||||
private String name;
|
||||
private String mail;
|
||||
private String tel;
|
||||
|
||||
private String storeId; // Store Id
|
||||
// private String userId; // User Id
|
||||
private String userNm; // Name
|
||||
private String userNmKana; // Name_Kana
|
||||
private String category; // Category
|
||||
private String telNo; // Telephone
|
||||
private String fax; // Fax
|
||||
private String email; // E-Mail
|
||||
private String pwdInitYn; // Password Init Yn
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
package com.interplug.qcast.biz.myInfo;
|
||||
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.interplug.qcast.biz.myInfo.dto.MyInfoRequest;
|
||||
import com.interplug.qcast.biz.myInfo.dto.MyInfoResponse;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/my-info")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "MyInfoController", description = "내 정보 조회 API")
|
||||
public class MyInfoController {
|
||||
|
||||
private final MyInfoService myInfoService;
|
||||
|
||||
@Operation(description = "사용자 ID의 정보를 조회한다.")
|
||||
@GetMapping("/my-profile")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public MyInfoResponse getMyInfo(@ModelAttribute MyInfoRequest myInfoRequest) {
|
||||
return myInfoService.getMyInfo(myInfoRequest);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.interplug.qcast.biz.myInfo;
|
||||
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import com.interplug.qcast.biz.myInfo.dto.MyInfoRequest;
|
||||
import com.interplug.qcast.biz.myInfo.dto.MyInfoResponse;
|
||||
|
||||
@Mapper
|
||||
public interface MyInfoMapper {
|
||||
|
||||
/**
|
||||
* ※ 사용자 정보 조회
|
||||
*
|
||||
* @param myInfoRequest
|
||||
* @return
|
||||
*/
|
||||
MyInfoResponse selectMyInfo(MyInfoRequest myInfoRequest);
|
||||
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.interplug.qcast.biz.myInfo;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.interplug.qcast.biz.myInfo.dto.MyInfoRequest;
|
||||
import com.interplug.qcast.biz.myInfo.dto.MyInfoResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class MyInfoService {
|
||||
|
||||
private final MyInfoMapper myInfoMapper;
|
||||
|
||||
/**
|
||||
* ※ 사용자 정보 조회
|
||||
*
|
||||
* @param userId
|
||||
* @return MyInfoResponse
|
||||
*/
|
||||
public MyInfoResponse getMyInfo(MyInfoRequest myInfoRequest) {
|
||||
return myInfoMapper.selectMyInfo(myInfoRequest);
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.interplug.qcast.biz.myInfo.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class MyInfoRequest {
|
||||
|
||||
/** 사용자ID */
|
||||
private String userId;
|
||||
|
||||
}
|
||||
@ -0,0 +1,40 @@
|
||||
package com.interplug.qcast.biz.myInfo.dto;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class MyInfoResponse {
|
||||
|
||||
/** 사용자ID */
|
||||
private String userId;
|
||||
|
||||
/** 비밀번호 */
|
||||
private String password;
|
||||
|
||||
/** 담당자명 */
|
||||
private String name;
|
||||
|
||||
/** 담당자명 후리가나 */
|
||||
private String nameKana;
|
||||
|
||||
/** 부서명 */
|
||||
private String category;
|
||||
|
||||
/** 전화번호 */
|
||||
private String tel;
|
||||
|
||||
/** fax번호 */
|
||||
private String fax;
|
||||
|
||||
/** 이메일 주소 */
|
||||
private String mail;
|
||||
|
||||
/** GROUD ID */
|
||||
private String groupId;
|
||||
|
||||
/** GROUD 명 */
|
||||
private String groupName;
|
||||
|
||||
}
|
||||
10
src/main/java/com/interplug/qcast/util/DefaultResponse.java
Normal file
10
src/main/java/com/interplug/qcast/util/DefaultResponse.java
Normal file
@ -0,0 +1,10 @@
|
||||
package com.interplug.qcast.util;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DefaultResponse {
|
||||
private DefaultResponseResult result;
|
||||
}
|
||||
@ -0,0 +1,13 @@
|
||||
package com.interplug.qcast.util;
|
||||
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
@Getter
|
||||
@Setter
|
||||
public class DefaultResponseResult {
|
||||
private int code; // Result Code(success : 200, error : 400)
|
||||
private String message; // Result Message
|
||||
private String resultCode; // Result Code2(success : S, error : E)
|
||||
private String resultMsg; // Result Message2
|
||||
}
|
||||
82
src/main/java/com/interplug/qcast/util/InterfaceQsp.java
Normal file
82
src/main/java/com/interplug/qcast/util/InterfaceQsp.java
Normal file
@ -0,0 +1,82 @@
|
||||
package com.interplug.qcast.util;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.InputStreamReader;
|
||||
import java.io.OutputStreamWriter;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.stereotype.Component;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class InterfaceQsp {
|
||||
/**
|
||||
* API Call
|
||||
*
|
||||
* @param apiPath
|
||||
* @param requestObject
|
||||
* @return String
|
||||
* @throws Exception
|
||||
*/
|
||||
public String callApi(HttpMethod httpMethod, String apiPath, Object requestObject)
|
||||
throws Exception {
|
||||
|
||||
URL url = null;
|
||||
HttpURLConnection con = null;
|
||||
OutputStreamWriter osw = null;
|
||||
BufferedReader br = null;
|
||||
StringBuilder sb = null;
|
||||
|
||||
try {
|
||||
url = new URL(apiPath);
|
||||
con = (HttpURLConnection) url.openConnection();
|
||||
con.setConnectTimeout(5000); // 서버에 연결되는 Timeout 시간 설정
|
||||
con.setReadTimeout(5000); // InputStream 읽어 오는 Timeout 시간 설정
|
||||
con.setRequestMethod(httpMethod.toString());
|
||||
con.setRequestProperty("Content-Type", "application/json");
|
||||
con.setDoInput(true);
|
||||
con.setUseCaches(false);
|
||||
con.setDefaultUseCaches(false);
|
||||
|
||||
if (HttpMethod.GET.equals(httpMethod)) {
|
||||
con.setDoOutput(false);
|
||||
} else {
|
||||
con.setDoOutput(true); // POST 데이터를 OutputStream으로 넘겨 주겠다는 설정
|
||||
if (requestObject != null) {
|
||||
ObjectMapper om = new ObjectMapper();
|
||||
osw = new OutputStreamWriter(con.getOutputStream());
|
||||
osw.write(om.writeValueAsString(requestObject)); // json 형식의 message 전달
|
||||
osw.flush();
|
||||
}
|
||||
}
|
||||
|
||||
sb = new StringBuilder();
|
||||
if (con.getResponseCode() == HttpURLConnection.HTTP_OK) {
|
||||
br = new BufferedReader(new InputStreamReader(con.getInputStream(), "utf-8"));
|
||||
|
||||
String line;
|
||||
while ((line = br.readLine()) != null) {
|
||||
sb.append(line);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
} finally {
|
||||
try {
|
||||
if (osw != null)
|
||||
osw.close();
|
||||
if (br != null)
|
||||
br.close();
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
|
||||
return sb != null ? sb.toString() : null;
|
||||
}
|
||||
}
|
||||
86
src/main/java/com/interplug/qcast/util/ZipFileManager.java
Normal file
86
src/main/java/com/interplug/qcast/util/ZipFileManager.java
Normal file
@ -0,0 +1,86 @@
|
||||
package com.interplug.qcast.util;
|
||||
|
||||
import java.io.FileInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
import java.nio.file.Path;
|
||||
import java.util.List;
|
||||
import java.util.zip.ZipEntry;
|
||||
import java.util.zip.ZipOutputStream;
|
||||
import org.springframework.stereotype.Component;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
@Slf4j
|
||||
@Component
|
||||
@RequiredArgsConstructor
|
||||
public class ZipFileManager {
|
||||
|
||||
/**
|
||||
* zip file을 생성하여 ZipOutputStream를 반환하는 method
|
||||
*
|
||||
* @param response HttpServletResponse
|
||||
* @param strCreateFileName 생성할 file 이름
|
||||
* @param listFilePath 파일 경로 목록
|
||||
*/
|
||||
public void createZipFile(HttpServletResponse response, String strCreateFileName,
|
||||
List<String> listFilePath) throws Exception {
|
||||
// 압축될 파일명이 존재하지 않을 경우
|
||||
if (strCreateFileName == null || "".equals(strCreateFileName))
|
||||
throw new IllegalArgumentException("파일명이 존재하지 않습니다.");
|
||||
|
||||
// 파일이 존재하지 않을 경우
|
||||
if (listFilePath == null || listFilePath.size() == 0)
|
||||
throw new IllegalArgumentException("파일이 존재하지 않습니다.");
|
||||
|
||||
// zip 파일명
|
||||
String strZipName = strCreateFileName + ".zip";
|
||||
|
||||
// response 설정
|
||||
response.setContentType("application/zip");
|
||||
response.setHeader("Content-Disposition", "attachment; filename=" + strZipName + ";");
|
||||
response.setStatus(HttpServletResponse.SC_OK);
|
||||
|
||||
try (ZipOutputStream zos = new ZipOutputStream(response.getOutputStream())) {
|
||||
for (String strSourceFile : listFilePath) {
|
||||
Path path = Path.of(strSourceFile);
|
||||
|
||||
try (FileInputStream fis = new FileInputStream(path.toFile())) {
|
||||
// 압축될 파일명을 ZipEntry에 담아준다
|
||||
ZipEntry zipEntry = new ZipEntry(path.getFileName().toString());
|
||||
|
||||
// 압축될 파일명을 ZipOutputStream 에 담아준다
|
||||
zos.putNextEntry(zipEntry);
|
||||
byte[] buffer = new byte[1024];
|
||||
int length;
|
||||
|
||||
while ((length = fis.read(buffer)) >= 0) {
|
||||
zos.write(buffer, 0, length);
|
||||
}
|
||||
} catch (FileNotFoundException e) {
|
||||
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
|
||||
throw new IllegalArgumentException("파일 변환 작업중, [ " + strZipName + " ] 파일을 찾을 수 없습니다.");
|
||||
} catch (IOException e) {
|
||||
response.setStatus(HttpServletResponse.SC_INTERNAL_SERVER_ERROR);
|
||||
throw new IllegalArgumentException(
|
||||
"파일 변환 작업중, [ " + strZipName + " ] 파일을 다운로드 할 수 없습니다.");
|
||||
} finally {
|
||||
// ZipOutputStream 에 담아둔 압축될 파일명을 flush 시켜준다
|
||||
zos.flush();
|
||||
// ZipOutputStream 에 담아둔 압축될 파일명을 close 시켜준다
|
||||
zos.closeEntry();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
throw e;
|
||||
} finally {
|
||||
try {
|
||||
// response 에 담아둔 파일을 flush 시켜준다
|
||||
response.flushBuffer();
|
||||
} catch (IOException e) {
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1,24 +1,28 @@
|
||||
#server
|
||||
server:
|
||||
port: 8080
|
||||
|
||||
#spring
|
||||
spring:
|
||||
datasource:
|
||||
datasource:
|
||||
master:
|
||||
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
jdbc-url: jdbc:log4jdbc:sqlserver://1.248.227.176:1433;databaseName=NEWPVCAD;encrypt=true;trustServerCertificate=true
|
||||
username: pvDBuser
|
||||
password: ENC(W7owprYnvf7vqwO6Piw4dHfVBCSxE4Ck)
|
||||
maximum-pool-size: 4
|
||||
pool-name: Master-HikariPool
|
||||
read:
|
||||
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
jdbc-url: jdbc:log4jdbc:sqlserver://1.248.227.176:1433;databaseName=NEWPVCAD;encrypt=true;trustServerCertificate=true
|
||||
username: pvDBuser
|
||||
password: ENC(W7owprYnvf7vqwO6Piw4dHfVBCSxE4Ck)
|
||||
maximum-pool-size: 4
|
||||
pool-name: Read-HikariPool
|
||||
jackson:
|
||||
time-zone: Asia/Seoul
|
||||
#server
|
||||
server:
|
||||
port: 8080
|
||||
|
||||
#spring
|
||||
spring:
|
||||
datasource:
|
||||
datasource:
|
||||
master:
|
||||
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
jdbc-url: jdbc:log4jdbc:sqlserver://1.248.227.176:1433;databaseName=NEWPVCAD;encrypt=true;trustServerCertificate=true
|
||||
username: pvDBuser
|
||||
password: ENC(W7owprYnvf7vqwO6Piw4dHfVBCSxE4Ck)
|
||||
maximum-pool-size: 4
|
||||
pool-name: Master-HikariPool
|
||||
read:
|
||||
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
jdbc-url: jdbc:log4jdbc:sqlserver://1.248.227.176:1433;databaseName=NEWPVCAD;encrypt=true;trustServerCertificate=true
|
||||
username: pvDBuser
|
||||
password: ENC(W7owprYnvf7vqwO6Piw4dHfVBCSxE4Ck)
|
||||
maximum-pool-size: 4
|
||||
pool-name: Read-HikariPool
|
||||
jackson:
|
||||
time-zone: Asia/Seoul
|
||||
|
||||
#QSP
|
||||
qsp:
|
||||
url: http://172.23.4.129:8120
|
||||
|
||||
@ -1,25 +1,28 @@
|
||||
#server
|
||||
server:
|
||||
port: 8080
|
||||
|
||||
#spring
|
||||
spring:
|
||||
datasource:
|
||||
datasource:
|
||||
master:
|
||||
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
jdbc-url: jdbc:log4jdbc:sqlserver://1.248.227.176:1433;databaseName=NEWPVCAD;encrypt=true;trustServerCertificate=true
|
||||
username: pvDBuser
|
||||
password: ENC(W7owprYnvf7vqwO6Piw4dHfVBCSxE4Ck)
|
||||
maximum-pool-size: 4
|
||||
pool-name: Master-HikariPool
|
||||
read:
|
||||
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
jdbc-url: jdbc:log4jdbc:sqlserver://1.248.227.176:1433;databaseName=NEWPVCAD;encrypt=true;trustServerCertificate=true
|
||||
username: pvDBuser
|
||||
password: ENC(W7owprYnvf7vqwO6Piw4dHfVBCSxE4Ck)
|
||||
maximum-pool-size: 4
|
||||
pool-name: Read-HikariPool
|
||||
jackson:
|
||||
time-zone: Asia/Seoul
|
||||
|
||||
#server
|
||||
server:
|
||||
port: 8080
|
||||
|
||||
#spring
|
||||
spring:
|
||||
datasource:
|
||||
datasource:
|
||||
master:
|
||||
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
jdbc-url: jdbc:log4jdbc:sqlserver://1.248.227.176:1433;databaseName=NEWPVCAD;encrypt=true;trustServerCertificate=true
|
||||
username: pvDBuser
|
||||
password: ENC(W7owprYnvf7vqwO6Piw4dHfVBCSxE4Ck)
|
||||
maximum-pool-size: 4
|
||||
pool-name: Master-HikariPool
|
||||
read:
|
||||
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
jdbc-url: jdbc:log4jdbc:sqlserver://1.248.227.176:1433;databaseName=NEWPVCAD;encrypt=true;trustServerCertificate=true
|
||||
username: pvDBuser
|
||||
password: ENC(W7owprYnvf7vqwO6Piw4dHfVBCSxE4Ck)
|
||||
maximum-pool-size: 4
|
||||
pool-name: Read-HikariPool
|
||||
jackson:
|
||||
time-zone: Asia/Seoul
|
||||
|
||||
#QSP
|
||||
qsp:
|
||||
url: http://localhost:8120
|
||||
|
||||
@ -1,24 +1,28 @@
|
||||
#server
|
||||
server:
|
||||
port: 80
|
||||
|
||||
#spring
|
||||
spring:
|
||||
datasource:
|
||||
datasource:
|
||||
master:
|
||||
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
jdbc-url: jdbc:log4jdbc:sqlserver://1.248.227.176:1433;databaseName=NEWPVCAD;encrypt=true;trustServerCertificate=true
|
||||
username: pvDBuser
|
||||
password: ENC(W7owprYnvf7vqwO6Piw4dHfVBCSxE4Ck)
|
||||
maximum-pool-size: 4
|
||||
pool-name: Master-HikariPool
|
||||
read:
|
||||
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
jdbc-url: jdbc:log4jdbc:sqlserver://1.248.227.176:1433;databaseName=NEWPVCAD;encrypt=true;trustServerCertificate=true
|
||||
username: pvDBuser
|
||||
password: ENC(W7owprYnvf7vqwO6Piw4dHfVBCSxE4Ck)
|
||||
maximum-pool-size: 4
|
||||
pool-name: Read-HikariPool
|
||||
jackson:
|
||||
time-zone: Asia/Seoul
|
||||
#server
|
||||
server:
|
||||
port: 80
|
||||
|
||||
#spring
|
||||
spring:
|
||||
datasource:
|
||||
datasource:
|
||||
master:
|
||||
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
jdbc-url: jdbc:log4jdbc:sqlserver://1.248.227.176:1433;databaseName=NEWPVCAD;encrypt=true;trustServerCertificate=true
|
||||
username: pvDBuser
|
||||
password: ENC(W7owprYnvf7vqwO6Piw4dHfVBCSxE4Ck)
|
||||
maximum-pool-size: 4
|
||||
pool-name: Master-HikariPool
|
||||
read:
|
||||
driver-class-name: net.sf.log4jdbc.sql.jdbcapi.DriverSpy
|
||||
jdbc-url: jdbc:log4jdbc:sqlserver://1.248.227.176:1433;databaseName=NEWPVCAD;encrypt=true;trustServerCertificate=true
|
||||
username: pvDBuser
|
||||
password: ENC(W7owprYnvf7vqwO6Piw4dHfVBCSxE4Ck)
|
||||
maximum-pool-size: 4
|
||||
pool-name: Read-HikariPool
|
||||
jackson:
|
||||
time-zone: Asia/Seoul
|
||||
|
||||
#QSP
|
||||
qsp:
|
||||
url: http://jp.qsalesplatform.com
|
||||
|
||||
21
src/main/resources/mappers/myInfo/myInfoMapper.xml
Normal file
21
src/main/resources/mappers/myInfo/myInfoMapper.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.interplug.qcast.biz.myInfo.MyInfoMapper">
|
||||
<select id="selectMyInfo" parameterType="com.interplug.qcast.biz.myInfo.dto.MyInfoRequest" resultType="com.interplug.qcast.biz.myInfo.dto.MyInfoResponse">
|
||||
/* sqlid : com.interplug.qcast.myInfo.selectMyInfo (사용자 정보 조회) */
|
||||
select u.user_id
|
||||
, u.password
|
||||
, u.name
|
||||
, u.name_kana
|
||||
, u.category
|
||||
, u.tel
|
||||
, u.fax
|
||||
, u.mail
|
||||
, g.group_id
|
||||
, g.group_name
|
||||
from m_user u inner join m_group g
|
||||
on u.group_id = g.group_id
|
||||
where u.user_id = #{userId}
|
||||
</select>
|
||||
</mapper>
|
||||
Loading…
x
Reference in New Issue
Block a user