로그인, 로그아웃 추적 #462
@ -59,6 +59,20 @@ public class LoginController {
|
||||
return loginService.getLogin(loginUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* Q.CAST III에서 로그아웃한다.
|
||||
*
|
||||
* @param loginUser LoginUser
|
||||
* @return DefaultResponse
|
||||
* @throws Exception
|
||||
*/
|
||||
@Operation(description = "Q.CAST III에서 로그아웃한다.")
|
||||
@PostMapping("/v1.0/logout")
|
||||
@ResponseStatus(HttpStatus.CREATED)
|
||||
public DefaultResponse logout(@RequestBody LoginUser loginUser) throws Exception {
|
||||
return loginService.getLogout(loginUser);
|
||||
}
|
||||
|
||||
@PostMapping("/v1.0/user")
|
||||
@ResponseStatus(HttpStatus.CREATED)
|
||||
public UserResponse getUser(@RequestBody LoginUser loginUser) {
|
||||
|
||||
@ -50,6 +50,12 @@ public class LoginService {
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Password"));
|
||||
|
||||
loginUser.setAccsSiteCd("DESIGN");
|
||||
loginUser.setActLog("LOGIN");
|
||||
|
||||
String sessionId = UUID.randomUUID().toString();
|
||||
loginUser.setRequestId(sessionId);
|
||||
|
||||
UserLoginResponse userLoginResponse = null;
|
||||
|
||||
// QSP API Call..
|
||||
@ -67,12 +73,43 @@ public class LoginService {
|
||||
if (userLoginResponse != null
|
||||
&& userLoginResponse.getResult() != null
|
||||
&& "S".equalsIgnoreCase(userLoginResponse.getResult().getResultCode())) {
|
||||
userLoginResponse.setSessionId(UUID.randomUUID().toString());
|
||||
userLoginResponse.setSessionId(sessionId);
|
||||
}
|
||||
|
||||
return userLoginResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 로그아웃 처리
|
||||
*
|
||||
* @param loginUser LoginUser
|
||||
* @return DefaultResponse
|
||||
* @throws Exception
|
||||
*/
|
||||
public DefaultResponse getLogout(LoginUser loginUser) throws Exception {
|
||||
if (loginUser.getLoginId() == null || "".equals(loginUser.getLoginId()))
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Login Id"));
|
||||
|
||||
loginUser.setAccsSiteCd("DESIGN");
|
||||
loginUser.setActLog("LOGOUT");
|
||||
|
||||
// QSP API Call..
|
||||
// Q.CAST 로그아웃
|
||||
// post
|
||||
// /api/user/logout
|
||||
DefaultResponse defaultResponse = null;
|
||||
String strResponse =
|
||||
interfaceQsp.callApi(HttpMethod.POST, qspUrl + "/api/user/logout", loginUser);
|
||||
if (!"".equals(strResponse)) {
|
||||
ObjectMapper om =
|
||||
new ObjectMapper().configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
defaultResponse = om.readValue(strResponse, DefaultResponse.class);
|
||||
}
|
||||
|
||||
return defaultResponse;
|
||||
}
|
||||
|
||||
public UserResponse getUser(LoginUser loginUser) {
|
||||
return loginMapper.getUser(loginUser);
|
||||
}
|
||||
|
||||
@ -6,4 +6,7 @@ import lombok.Data;
|
||||
public class LoginUser {
|
||||
private String loginId; // Login Id
|
||||
private String pwd; // Password
|
||||
private String accsSiteCd; // Access Site Code (QSP, QORDER, QMUSUBI_DESIGN, QREAD, QWARRANTY, QPARTNERS)
|
||||
private String actLog; // Action Log (LOGIN, AUTO_LOGIN, LOGOUT)
|
||||
private String requestId; // Request ID <= Unique ID
|
||||
}
|
||||
|
||||
@ -28,4 +28,6 @@ public class UserResponse {
|
||||
private String custNm;
|
||||
//시공사 번호
|
||||
private String builderNo;
|
||||
private String builderNm; // Builder Name
|
||||
private String builderId; // Builder Id
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user