style: biz 하위 패키지 controller, service 파일 내 코드 포맷터 적용
This commit is contained in:
parent
3224dc96bb
commit
30b06b7f8b
@ -33,7 +33,8 @@ public class CanvasBasicSettingController {
|
||||
@Operation(description = "Canvas Basic Setting 정보를 등록 한다.")
|
||||
@PostMapping("/canvas-basic-settings")
|
||||
@ResponseStatus(HttpStatus.CREATED)
|
||||
public Map<String, String> insertCanvasBasicSetting(@RequestBody CanvasBasicSettingInfo csi) throws QcastException {
|
||||
public Map<String, String> insertCanvasBasicSetting(@RequestBody CanvasBasicSettingInfo csi)
|
||||
throws QcastException {
|
||||
|
||||
log.debug("Basic Setting 등록 ::::: " + csi.getObjectNo());
|
||||
|
||||
@ -43,7 +44,8 @@ public class CanvasBasicSettingController {
|
||||
@Operation(description = "지붕면 할당 정보를 등록 한다.")
|
||||
@PostMapping("/roof-allocation-settings")
|
||||
@ResponseStatus(HttpStatus.CREATED)
|
||||
public Map<String, String> insertRoofAllocSetting(@RequestBody RoofAllocationSettingInfo rasi) throws QcastException {
|
||||
public Map<String, String> insertRoofAllocSetting(@RequestBody RoofAllocationSettingInfo rasi)
|
||||
throws QcastException {
|
||||
|
||||
log.debug("지붕면 할당 등록 ::::: " + rasi.getObjectNo());
|
||||
|
||||
@ -56,5 +58,4 @@ public class CanvasBasicSettingController {
|
||||
public void deleteRoofMaterialsAdd(@PathVariable String objectNo) throws QcastException {
|
||||
canvasBasicSettingService.deleteRoofMaterialsAdd(objectNo);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,14 +1,5 @@
|
||||
package com.interplug.qcast.biz.canvasBasicSetting;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import com.interplug.qcast.biz.canvasBasicSetting.dto.CanvasBasicSettingInfo;
|
||||
import com.interplug.qcast.biz.canvasBasicSetting.dto.CanvasBasicSettingResponse;
|
||||
import com.interplug.qcast.biz.canvasBasicSetting.dto.RoofAllocationInfo;
|
||||
@ -16,6 +7,12 @@ import com.interplug.qcast.biz.canvasBasicSetting.dto.RoofAllocationSettingInfo;
|
||||
import com.interplug.qcast.biz.canvasBasicSetting.dto.RoofMaterialsAddInfo;
|
||||
import com.interplug.qcast.config.Exception.ErrorCode;
|
||||
import com.interplug.qcast.config.Exception.QcastException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@ -29,18 +26,20 @@ public class CanvasBasicSettingService {
|
||||
}
|
||||
|
||||
// Canvas Basic Setting 등록
|
||||
public Map<String, String> insertCanvasBasicSetting(CanvasBasicSettingInfo csi) throws QcastException {
|
||||
public Map<String, String> insertCanvasBasicSetting(CanvasBasicSettingInfo csi)
|
||||
throws QcastException {
|
||||
|
||||
Map<String, String> response = new HashMap<>();
|
||||
|
||||
if (csi.getObjectNo() == null) {
|
||||
throw new QcastException (ErrorCode.INVALID_INPUT_VALUE ,"올바르지 않은 입력값입니다.");
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, "올바르지 않은 입력값입니다.");
|
||||
}
|
||||
|
||||
try {
|
||||
|
||||
// 먼저 데이터가 존재하는지 확인
|
||||
CanvasBasicSettingInfo cntData = canvasBasicSettingMapper.getCanvasBasicSettingCnt(csi.getObjectNo());
|
||||
CanvasBasicSettingInfo cntData =
|
||||
canvasBasicSettingMapper.getCanvasBasicSettingCnt(csi.getObjectNo());
|
||||
|
||||
log.debug("cntData ::::: " + cntData);
|
||||
|
||||
@ -83,16 +82,16 @@ public class CanvasBasicSettingService {
|
||||
|
||||
// 생성된 objectNo 반환
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
// 지붕면 할당 Setting 등록
|
||||
public Map<String, String> insertRoofAllocSetting(RoofAllocationSettingInfo rasi) throws QcastException {
|
||||
public Map<String, String> insertRoofAllocSetting(RoofAllocationSettingInfo rasi)
|
||||
throws QcastException {
|
||||
|
||||
Map<String, String> response = new HashMap<>();
|
||||
|
||||
if (rasi.getObjectNo() == null) {
|
||||
throw new QcastException (ErrorCode.INVALID_INPUT_VALUE ,"올바르지 않은 입력값입니다.");
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, "올바르지 않은 입력값입니다.");
|
||||
}
|
||||
|
||||
try {
|
||||
@ -114,14 +113,13 @@ public class CanvasBasicSettingService {
|
||||
|
||||
// 생성된 objectNo 반환
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
// 지붕재추가 삭제
|
||||
public void deleteRoofMaterialsAdd(String objectNo) throws QcastException {
|
||||
|
||||
if (objectNo == null || objectNo.trim().isEmpty()) {
|
||||
throw new QcastException (ErrorCode.INVALID_INPUT_VALUE ,"올바르지 않은 입력값입니다.");
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, "올바르지 않은 입력값입니다.");
|
||||
}
|
||||
|
||||
// 먼저 데이터가 존재하는지 확인
|
||||
@ -131,9 +129,7 @@ public class CanvasBasicSettingService {
|
||||
if (cntData.getRoofCnt().intValue() > 0) {
|
||||
canvasBasicSettingMapper.deleteRoofMaterialsAdd(objectNo);
|
||||
} else {
|
||||
throw new QcastException (ErrorCode.NOT_FOUND ,"삭제할 지붕재가 존재하지 않습니다.");
|
||||
throw new QcastException(ErrorCode.NOT_FOUND, "삭제할 지붕재가 존재하지 않습니다.");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -38,5 +38,4 @@ public class CanvasGridSettingController {
|
||||
|
||||
return canvasGridSettingService.insertCanvasGridSetting(csi);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -37,7 +37,5 @@ public class CanvasGridSettingService {
|
||||
|
||||
// 생성된 objectNo 반환
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -33,7 +33,8 @@ public class CanvasSettingController {
|
||||
@Operation(description = "Canvas Setting 정보를 등록 한다.")
|
||||
@PostMapping("/canvas-settings")
|
||||
@ResponseStatus(HttpStatus.CREATED)
|
||||
public Map<String, String> insertCanvasSetting(@RequestBody CanvasSettingInfo csi) throws QcastException {
|
||||
public Map<String, String> insertCanvasSetting(@RequestBody CanvasSettingInfo csi)
|
||||
throws QcastException {
|
||||
|
||||
log.debug("Setting 등록 ::::: " + csi.getObjectNo());
|
||||
|
||||
@ -48,5 +49,4 @@ public class CanvasSettingController {
|
||||
|
||||
canvasSettingService.updateCanvasSetting(csi);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -3,12 +3,9 @@ package com.interplug.qcast.biz.canvasSetting;
|
||||
import com.interplug.qcast.biz.canvasSetting.dto.CanvasSettingInfo;
|
||||
import com.interplug.qcast.config.Exception.ErrorCode;
|
||||
import com.interplug.qcast.config.Exception.QcastException;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
@ -27,7 +24,7 @@ public class CanvasSettingService {
|
||||
Map<String, String> response = new HashMap<>();
|
||||
|
||||
if (csi.getObjectNo() == null) {
|
||||
throw new QcastException (ErrorCode.INVALID_INPUT_VALUE ,"올바르지 않은 입력값입니다.");
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, "올바르지 않은 입력값입니다.");
|
||||
}
|
||||
|
||||
try {
|
||||
@ -56,12 +53,10 @@ public class CanvasSettingService {
|
||||
|
||||
// 생성된 objectNo 반환
|
||||
return response;
|
||||
|
||||
}
|
||||
|
||||
// Canvas Setting 수정
|
||||
public void updateCanvasSetting(CanvasSettingInfo csi) {
|
||||
canvasSettingMapper.updateCanvasSetting(csi);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,15 +1,15 @@
|
||||
package com.interplug.qcast.biz.commCode;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import org.springframework.stereotype.Service;
|
||||
import com.interplug.qcast.biz.commCode.dto.CodeReq;
|
||||
import com.interplug.qcast.biz.commCode.dto.CodeRes;
|
||||
import com.interplug.qcast.biz.commCode.dto.CommCodeRes;
|
||||
import com.interplug.qcast.biz.commCode.dto.DetailCodeRequest;
|
||||
import com.interplug.qcast.biz.commCode.dto.HeadCodeRequest;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@ -53,15 +53,20 @@ public class CommCodeService {
|
||||
public List<CommCodeRes> selectQcastCommCode() {
|
||||
List<CodeRes> result = commCodeMapper.selectQcastCommCode();
|
||||
List<CommCodeRes> commCodeList = new ArrayList<>();
|
||||
result.forEach(cr -> {
|
||||
commCodeList.add(CommCodeRes.builder().clHeadCd(cr.getClHeadCd()).clCode(cr.getClCode())
|
||||
.clCodeNm(cr.getClCodeNm()).clCodeJp(cr.getClCodeJp()).clPriority(cr.getClPriority())
|
||||
result.forEach(
|
||||
cr -> {
|
||||
commCodeList.add(
|
||||
CommCodeRes.builder()
|
||||
.clHeadCd(cr.getClHeadCd())
|
||||
.clCode(cr.getClCode())
|
||||
.clCodeNm(cr.getClCodeNm())
|
||||
.clCodeJp(cr.getClCodeJp())
|
||||
.clPriority(cr.getClPriority())
|
||||
.build());
|
||||
});
|
||||
return commCodeList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 헤더코드 동기화
|
||||
*
|
||||
@ -81,7 +86,6 @@ public class CommCodeService {
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -104,8 +108,6 @@ public class CommCodeService {
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,12 +1,5 @@
|
||||
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;
|
||||
@ -14,6 +7,13 @@ import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
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;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@ -41,9 +41,11 @@ public class BoardController {
|
||||
@Operation(description = "커뮤니티(공지사항, FAQ, 자료다운로드) 파일 다운로드를 진행한다.")
|
||||
@GetMapping("/file/download")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public void getFileDownload(HttpServletResponse response,
|
||||
@RequestParam(required = true) String keyNo, @RequestParam String zipYn) throws Exception {
|
||||
public void getFileDownload(
|
||||
HttpServletResponse response,
|
||||
@RequestParam(required = true) String keyNo,
|
||||
@RequestParam String zipYn)
|
||||
throws Exception {
|
||||
boardService.getFileDownload(response, keyNo, zipYn);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,17 +1,5 @@
|
||||
package com.interplug.qcast.biz.community;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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;
|
||||
@ -21,8 +9,20 @@ import com.interplug.qcast.config.Exception.QcastException;
|
||||
import com.interplug.qcast.config.message.Messages;
|
||||
import com.interplug.qcast.util.InterfaceQsp;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@ -30,8 +30,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
public class BoardService {
|
||||
|
||||
private final InterfaceQsp interfaceQsp;
|
||||
@Autowired
|
||||
Messages message;
|
||||
@Autowired Messages message;
|
||||
|
||||
@Value("${qsp.url}")
|
||||
private String QSP_API_URL;
|
||||
@ -50,12 +49,14 @@ public class BoardService {
|
||||
/* [0]. Validation Check */
|
||||
if ("".equals(boardRequest.getSchNoticeClsCd())) {
|
||||
// [msg] {0} is required input value.
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Notice Cls Code"));
|
||||
}
|
||||
if ("".equals(boardRequest.getSchNoticeTpCd())) {
|
||||
// [msg] {0} is required input value.
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Notice Type Code"));
|
||||
}
|
||||
|
||||
@ -66,14 +67,17 @@ public class BoardService {
|
||||
}
|
||||
|
||||
String url = QSP_API_URL + "/api/board/list";
|
||||
String apiUrl = UriComponentsBuilder.fromHttpUrl(url)
|
||||
.queryParam("noticeNo", boardRequest.getNoticeNo()).queryParam("schTitle", encodedSchTitle)
|
||||
String apiUrl =
|
||||
UriComponentsBuilder.fromHttpUrl(url)
|
||||
.queryParam("noticeNo", boardRequest.getNoticeNo())
|
||||
.queryParam("schTitle", encodedSchTitle)
|
||||
.queryParam("schNoticeTpCd", boardRequest.getSchNoticeTpCd())
|
||||
.queryParam("schNoticeClsCd", boardRequest.getSchNoticeClsCd())
|
||||
.queryParam("startRow", boardRequest.getStartRow())
|
||||
.queryParam("endRow", boardRequest.getEndRow())
|
||||
.queryParam("schMainYn", boardRequest.getSchMainYn()).build().toUriString();
|
||||
|
||||
.queryParam("schMainYn", boardRequest.getSchMainYn())
|
||||
.build()
|
||||
.toUriString();
|
||||
|
||||
/* [2]. QSP API CALL -> Response */
|
||||
String strResponse = interfaceQsp.callApi(HttpMethod.GET, apiUrl, null);
|
||||
@ -105,14 +109,18 @@ public class BoardService {
|
||||
/* [0]. Validation Check */
|
||||
if (boardRequest.getNoticeNo() == null) {
|
||||
// [msg] {0} is required input value.
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Notice No"));
|
||||
}
|
||||
|
||||
/* [1]. QSP API (url + param) Setting */
|
||||
String url = QSP_API_URL + "/api/board/detail";
|
||||
String apiUrl = UriComponentsBuilder.fromHttpUrl(url)
|
||||
.queryParam("noticeNo", boardRequest.getNoticeNo()).build().toUriString();
|
||||
String apiUrl =
|
||||
UriComponentsBuilder.fromHttpUrl(url)
|
||||
.queryParam("noticeNo", boardRequest.getNoticeNo())
|
||||
.build()
|
||||
.toUriString();
|
||||
|
||||
/* [2]. QSP API CALL -> Response */
|
||||
String strResponse = interfaceQsp.callApi(HttpMethod.GET, apiUrl, null);
|
||||
@ -144,8 +152,8 @@ public class BoardService {
|
||||
if ("".equals(keyNo)) {
|
||||
// [msg] {0} is required input value.
|
||||
String arg = "Y".equals(zipYn) ? "Notice No" : "File No";
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", arg));
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE, message.getMessage("common.message.required.data", arg));
|
||||
}
|
||||
|
||||
/* [1]. QSP API (url + fileNo) Setting */
|
||||
@ -165,9 +173,11 @@ public class BoardService {
|
||||
/* [3]. API 응답 파일 처리 */
|
||||
response.addHeader("Access-Control-Expose-Headers", "Content-Disposition");
|
||||
response.setContentType(
|
||||
!"".equals(result.get("type")) && result.get("type") != null ? result.get("type")
|
||||
!"".equals(result.get("type")) && result.get("type") != null
|
||||
? result.get("type")
|
||||
: "application/octet-stream");
|
||||
response.setHeader("Content-Disposition",
|
||||
response.setHeader(
|
||||
"Content-Disposition",
|
||||
!"".equals(result.get("disposition")) && result.get("disposition") != null
|
||||
? result.get("disposition")
|
||||
: "attachment;");
|
||||
@ -180,14 +190,15 @@ public class BoardService {
|
||||
|
||||
} catch (Exception e) {
|
||||
// [msg] File download error
|
||||
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR,
|
||||
throw new QcastException(
|
||||
ErrorCode.INTERNAL_SERVER_ERROR,
|
||||
message.getMessage("common.message.file.download.error"));
|
||||
}
|
||||
|
||||
} else {
|
||||
// [msg] File does not exist.
|
||||
throw new QcastException(ErrorCode.NOT_FOUND,
|
||||
message.getMessage("common.message.file.download.exists"));
|
||||
throw new QcastException(
|
||||
ErrorCode.NOT_FOUND, message.getMessage("common.message.file.download.exists"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -144,5 +144,4 @@ public class DisplayItemService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -74,5 +74,4 @@ public class ExcelDownController {
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -51,7 +51,7 @@ public class FileController {
|
||||
public List<FileRequest> fileUpload(
|
||||
HttpServletRequest request, HttpServletResponse response, FileRequest fileRequest)
|
||||
throws Exception {
|
||||
return fileService.fileUpload(request,fileRequest);
|
||||
return fileService.fileUpload(request, fileRequest);
|
||||
}
|
||||
|
||||
@Operation(description = "파일을 삭제 한다.")
|
||||
|
||||
@ -1,21 +1,5 @@
|
||||
package com.interplug.qcast.biz.login;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Base64;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
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;
|
||||
@ -26,8 +10,24 @@ import com.interplug.qcast.config.Exception.QcastException;
|
||||
import com.interplug.qcast.config.message.Messages;
|
||||
import com.interplug.qcast.util.DefaultResponse;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import java.time.LocalDate;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Base64;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.SecretKey;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
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;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@ -37,8 +37,7 @@ public class LoginController {
|
||||
// @Autowired private LoginService loginService;
|
||||
private final LoginService loginService;
|
||||
|
||||
@Autowired
|
||||
Messages message;
|
||||
@Autowired Messages message;
|
||||
|
||||
@Value("${qsp.aes256.key}")
|
||||
String loginPasswordAesKey;
|
||||
@ -46,7 +45,6 @@ public class LoginController {
|
||||
@Value("${qsp.auto.login.aes256.key}")
|
||||
String autoLoginAesKey;
|
||||
|
||||
|
||||
/**
|
||||
* Q.CAST III에 로그인하여 사용자 정보를 획득한다.
|
||||
*
|
||||
@ -121,7 +119,8 @@ public class LoginController {
|
||||
String loginEncryptId = "";
|
||||
|
||||
if ("".equals(loginUser.getLoginId()) || loginUser.getLoginId() == null) {
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "User Id"));
|
||||
}
|
||||
|
||||
@ -136,16 +135,19 @@ public class LoginController {
|
||||
byte[] keyData = loginPasswordAesKey.getBytes();
|
||||
SecretKey secureKey = new SecretKeySpec(keyData, "AES");
|
||||
Cipher c = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
||||
c.init(Cipher.ENCRYPT_MODE, secureKey,
|
||||
c.init(
|
||||
Cipher.ENCRYPT_MODE,
|
||||
secureKey,
|
||||
new IvParameterSpec(encryptKey.substring(0, 16).getBytes()));
|
||||
byte[] encrypted = c.doFinal(loginUser.getLoginId().getBytes("UTF-8"));
|
||||
|
||||
// [2]. 암호화 값 셋팅
|
||||
loginEncryptId = new String(Base64.getEncoder().encode(encrypted));;
|
||||
loginEncryptId = new String(Base64.getEncoder().encode(encrypted));
|
||||
;
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR,
|
||||
message.getMessage("common.message.error"));
|
||||
throw new QcastException(
|
||||
ErrorCode.INTERNAL_SERVER_ERROR, message.getMessage("common.message.error"));
|
||||
}
|
||||
|
||||
return loginEncryptId;
|
||||
@ -165,7 +167,8 @@ public class LoginController {
|
||||
String loginDecryptId = "";
|
||||
|
||||
if ("".equals(loginUser.getLoginId()) || loginUser.getLoginId() == null) {
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "User Id"));
|
||||
}
|
||||
|
||||
@ -180,7 +183,9 @@ public class LoginController {
|
||||
byte[] keyData = loginPasswordAesKey.getBytes();
|
||||
SecretKey secureKey = new SecretKeySpec(keyData, "AES");
|
||||
Cipher c = Cipher.getInstance("AES/CBC/PKCS5Padding");
|
||||
c.init(Cipher.DECRYPT_MODE, secureKey,
|
||||
c.init(
|
||||
Cipher.DECRYPT_MODE,
|
||||
secureKey,
|
||||
new IvParameterSpec(decryptKey.substring(0, 16).getBytes("UTF-8")));
|
||||
|
||||
byte[] byteStr = Base64.getDecoder().decode(loginUser.getLoginId().getBytes());
|
||||
@ -189,11 +194,10 @@ public class LoginController {
|
||||
loginDecryptId = new String(c.doFinal(byteStr), "UTF-8");
|
||||
|
||||
} catch (Exception e) {
|
||||
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR,
|
||||
message.getMessage("common.message.error"));
|
||||
throw new QcastException(
|
||||
ErrorCode.INTERNAL_SERVER_ERROR, message.getMessage("common.message.error"));
|
||||
}
|
||||
|
||||
return loginDecryptId;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -1,9 +1,5 @@
|
||||
package com.interplug.qcast.biz.login;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
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;
|
||||
@ -18,6 +14,10 @@ import com.interplug.qcast.util.DefaultResponse;
|
||||
import com.interplug.qcast.util.InterfaceQsp;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@ -30,8 +30,7 @@ public class LoginService {
|
||||
@Value("${qsp.url}")
|
||||
private String qspUrl;
|
||||
|
||||
@Autowired
|
||||
Messages message;
|
||||
@Autowired Messages message;
|
||||
|
||||
/**
|
||||
* 로그인 처리
|
||||
@ -42,11 +41,13 @@ public class LoginService {
|
||||
*/
|
||||
public UserLoginResponse getLogin(LoginUser loginUser) throws Exception {
|
||||
if (loginUser.getLoginId() == null || "".equals(loginUser.getLoginId()))
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Login Id"));
|
||||
|
||||
if (loginUser.getPwd() == null || "".equals(loginUser.getPwd()))
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Password"));
|
||||
|
||||
UserLoginResponse userLoginResponse = null;
|
||||
@ -79,35 +80,42 @@ public class LoginService {
|
||||
*/
|
||||
public DefaultResponse joinUser(JoinUser joinUser) throws Exception {
|
||||
if (joinUser.getStoreQcastNm() == null || "".equals(joinUser.getStoreQcastNm()))
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Store QCast Name"));
|
||||
|
||||
if (joinUser.getStoreQcastNmKana() == null || "".equals(joinUser.getStoreQcastNmKana()))
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Store QCast Name Kana"));
|
||||
|
||||
if (joinUser.getPostCd() == null || "".equals(joinUser.getPostCd()))
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Postal Code"));
|
||||
|
||||
if (joinUser.getAddr() == null || "".equals(joinUser.getAddr()))
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Address"));
|
||||
|
||||
if (joinUser.getTelNo() == null || "".equals(joinUser.getTelNo()))
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Telephone"));
|
||||
|
||||
if (joinUser.getFax() == null || "".equals(joinUser.getFax()))
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Fax"));
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE, message.getMessage("common.message.required.data", "Fax"));
|
||||
|
||||
if (joinUser.getUserInfo().getUserId() == null || "".equals(joinUser.getUserInfo().getUserId()))
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "User Id"));
|
||||
|
||||
if (joinUser.getUserInfo().getUserNm() == null || "".equals(joinUser.getUserInfo().getUserNm()))
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Name"));
|
||||
|
||||
// if (joinUser.getUserInfo().getUserNmKana() == null
|
||||
@ -116,15 +124,17 @@ public class LoginService {
|
||||
// message.getMessage("common.message.required.data", "Name Kana"));
|
||||
|
||||
if (joinUser.getUserInfo().getTelNo() == null || "".equals(joinUser.getUserInfo().getTelNo()))
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Telephone"));
|
||||
|
||||
if (joinUser.getUserInfo().getFax() == null || "".equals(joinUser.getUserInfo().getFax()))
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Fax"));
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE, message.getMessage("common.message.required.data", "Fax"));
|
||||
|
||||
if (joinUser.getUserInfo().getEmail() == null || "".equals(joinUser.getUserInfo().getEmail()))
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "E-Mail"));
|
||||
|
||||
// QSP API Call..
|
||||
@ -152,11 +162,13 @@ public class LoginService {
|
||||
*/
|
||||
public DefaultResponse initPassword(UserPassword userPassword) throws Exception {
|
||||
if (userPassword.getLoginId() == null || "".equals(userPassword.getLoginId()))
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Login Id"));
|
||||
|
||||
if (userPassword.getEmail() == null || "".equals(userPassword.getEmail()))
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "E-Mail"));
|
||||
|
||||
// QSP API Call..
|
||||
@ -184,15 +196,18 @@ public class LoginService {
|
||||
*/
|
||||
public DefaultResponse changePassword(UserPassword userPassword) throws Exception {
|
||||
if (userPassword.getLoginId() == null || "".equals(userPassword.getLoginId()))
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Login Id"));
|
||||
|
||||
if (userPassword.getChgType() == null || "".equals(userPassword.getChgType()))
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Change Type (I :Init , C: Change)"));
|
||||
|
||||
if (userPassword.getChgPwd() == null || "".equals(userPassword.getChgPwd()))
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Change Password"));
|
||||
|
||||
// QSP API Call..
|
||||
|
||||
@ -34,5 +34,4 @@ public class MyInfoController {
|
||||
public MyInfoResponse getMyInfo(@ModelAttribute MyInfoRequest myInfoRequest) {
|
||||
return myInfoService.getMyInfo(myInfoRequest);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -22,5 +22,4 @@ public class MyInfoService {
|
||||
public MyInfoResponse getMyInfo(MyInfoRequest myInfoRequest) {
|
||||
return myInfoMapper.selectMyInfo(myInfoRequest);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -49,5 +49,4 @@ public class SpecialNoteController {
|
||||
throws Exception {
|
||||
specialNoteService.setSpecialNoteItemSave(specialNoteItemRequest);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -69,5 +69,4 @@ public class SpecialNoteService {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -32,10 +32,8 @@ public class StoreFavoriteController {
|
||||
|
||||
int resultCnt = storeFavService.setStoreFavoriteSave(req);
|
||||
|
||||
if (resultCnt > 0)
|
||||
userResponse.setCode("200");
|
||||
else
|
||||
userResponse.setCode("500");
|
||||
if (resultCnt > 0) userResponse.setCode("200");
|
||||
else userResponse.setCode("500");
|
||||
|
||||
return userResponse;
|
||||
}
|
||||
@ -47,5 +45,4 @@ public class StoreFavoriteController {
|
||||
throws Exception {
|
||||
return storeFavService.getStoreFavoriteList(req);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user