Merge branch 'err-test' into dev

This commit is contained in:
yoosangwook 2025-02-13 10:05:04 +09:00
commit a8430a83fd
22 changed files with 528 additions and 460 deletions

View File

@ -20,41 +20,43 @@ import org.springframework.web.bind.annotation.*;
@Tag(name = "CanvasBasicSettingController", description = "Canvas Basic Setting 관련 API")
public class CanvasBasicSettingController {
private final CanvasBasicSettingService canvasBasicSettingService;
@Operation(description = "Canvas Basic Setting 정보를 조회 한다.")
@GetMapping("/canvas-basic-settings/by-object/{objectNo}")
public List<CanvasBasicSettingResponse> selectCanvasBasicSetting(@PathVariable String objectNo) {
log.debug("Basic Setting 조회 ::::: " + objectNo);
return canvasBasicSettingService.selectCanvasBasicSetting(objectNo);
public List<CanvasBasicSettingResponse> selectCanvasBasicSetting(@PathVariable String objectNo)
throws QcastException {
log.debug("Basic Setting 조회 ::::: " + objectNo);
return canvasBasicSettingService.selectCanvasBasicSetting(objectNo);
}
@Operation(description = "Canvas Basic Setting 정보를 등록 한다.")
@PostMapping("/canvas-basic-settings")
@ResponseStatus(HttpStatus.CREATED)
public Map<String, String> insertCanvasBasicSetting(@RequestBody CanvasBasicSettingInfo csi) throws QcastException {
log.debug("Basic Setting 등록 ::::: " + csi.getObjectNo());
return canvasBasicSettingService.insertCanvasBasicSetting(csi);
public Map<String, String> insertCanvasBasicSetting(@RequestBody CanvasBasicSettingInfo csi)
throws QcastException {
log.debug("Basic Setting 등록 ::::: " + csi.getObjectNo());
return canvasBasicSettingService.insertCanvasBasicSetting(csi);
}
@Operation(description = "지붕면 할당 정보를 등록 한다.")
@PostMapping("/roof-allocation-settings")
@ResponseStatus(HttpStatus.CREATED)
public Map<String, String> insertRoofAllocSetting(@RequestBody RoofAllocationSettingInfo rasi) throws QcastException {
log.debug("지붕면 할당 등록 ::::: " + rasi.getObjectNo());
return canvasBasicSettingService.insertRoofAllocSetting(rasi);
public Map<String, String> insertRoofAllocSetting(@RequestBody RoofAllocationSettingInfo rasi)
throws QcastException {
log.debug("지붕면 할당 등록 ::::: " + rasi.getObjectNo());
return canvasBasicSettingService.insertRoofAllocSetting(rasi);
}
@Operation(description = "Canvas 지붕재추가 Setting 정보를 삭제 한다.")
@DeleteMapping("/canvas-basic-settings/delete-RoofMaterials/{objectNo}")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void deleteRoofMaterialsAdd(@PathVariable String objectNo) throws QcastException {
canvasBasicSettingService.deleteRoofMaterialsAdd(objectNo);
canvasBasicSettingService.deleteRoofMaterialsAdd(objectNo);
}
}

View File

@ -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,124 +7,133 @@ 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
@RequiredArgsConstructor
public class CanvasBasicSettingService {
private final CanvasBasicSettingMapper canvasBasicSettingMapper;
private final CanvasBasicSettingMapper canvasBasicSettingMapper;
// Canvas Basic Setting 조회(objectNo)
public List<CanvasBasicSettingResponse> selectCanvasBasicSetting(String objectNo) {
return canvasBasicSettingMapper.selectCanvasBasicSetting(objectNo);
}
// Canvas Basic Setting 조회(objectNo)
public List<CanvasBasicSettingResponse> selectCanvasBasicSetting(String objectNo)
throws QcastException {
try {
return canvasBasicSettingMapper.selectCanvasBasicSetting(objectNo);
} catch (Exception e) {
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
}
}
// Canvas Basic Setting 등록
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 ,"올바르지 않은 입력값입니다.");
}
// Canvas Basic Setting 등록
public Map<String, String> insertCanvasBasicSetting(CanvasBasicSettingInfo csi)
throws QcastException {
try {
// 먼저 데이터가 존재하는지 확인
CanvasBasicSettingInfo cntData = canvasBasicSettingMapper.getCanvasBasicSettingCnt(csi.getObjectNo());
log.debug("cntData ::::: " + cntData);
// 데이터가 존재하지 않으면 insert
if (cntData.getRoofCnt().intValue() < 1) {
// 도면/치수/각도 정보 insert
canvasBasicSettingMapper.insertCanvasBasicSetting(csi);
// for-each 루프를 사용하여 지붕재추가 Setting
for (RoofMaterialsAddInfo rma : csi.getRoofMaterialsAddList()) {
rma.setObjectNo(csi.getObjectNo());
// 신규 지붕재추가 정보 insert
canvasBasicSettingMapper.insertRoofMaterialsAdd(rma);
}
response.put("objectNo", csi.getObjectNo());
response.put("returnMessage", "common.message.confirm.mark");
} else {
// 도면/치수/각도 정보 update
canvasBasicSettingMapper.updateCanvasBasicSetting(csi);
// for-each 루프를 사용하여 지붕재추가 Setting
for (RoofMaterialsAddInfo rma : csi.getRoofMaterialsAddList()) {
rma.setObjectNo(csi.getObjectNo());
// 신규 지붕재추가 정보 insert
canvasBasicSettingMapper.updateRoofMaterialsAdd(rma);
}
response.put("objectNo", csi.getObjectNo());
response.put("returnMessage", "common.message.confirm.mark");
}
} catch (Exception e) {
response.put("objectNo", csi.getObjectNo());
response.put("returnMessage", "common.message.save.error");
}
Map<String, String> response = new HashMap<>();
// 생성된 objectNo 반환
return response;
if (csi.getObjectNo() == null) {
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, "올바르지 않은 입력값입니다.");
}
}
// 지붕면 할당 Setting 등록
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 ,"올바르지 않은 입력값입니다.");
}
try {
try {
// 기존 지붕재추가 정보 삭제 insert
canvasBasicSettingMapper.deleteRoofMaterialsAdd(rasi.getObjectNo());
// for-each 루프를 사용하여 지붕재추가 Setting
for (RoofAllocationInfo rai : rasi.getRoofAllocationList()) {
rai.setObjectNo(rasi.getObjectNo());
canvasBasicSettingMapper.insertRoofAllocation(rai);
}
response.put("objectNo", rasi.getObjectNo());
response.put("returnMessage", "common.message.confirm.mark");
} catch (Exception e) {
response.put("objectNo", rasi.getObjectNo());
response.put("returnMessage", "common.message.save.error");
}
// 먼저 데이터가 존재하는지 확인
CanvasBasicSettingInfo cntData =
canvasBasicSettingMapper.getCanvasBasicSettingCnt(csi.getObjectNo());
// 생성된 objectNo 반환
return response;
log.debug("cntData ::::: " + cntData);
}
// 지붕재추가 삭제
public void deleteRoofMaterialsAdd(String objectNo) throws QcastException {
if (objectNo == null || objectNo.trim().isEmpty()) {
throw new QcastException (ErrorCode.INVALID_INPUT_VALUE ,"올바르지 않은 입력값입니다.");
}
// 먼저 데이터가 존재하는지 확인
RoofMaterialsAddInfo cntData = canvasBasicSettingMapper.getRoofMaterialsCnt(objectNo);
// 데이터가 존재하지 않으면 수정하지 않고 예외를 던짐
if (cntData.getRoofCnt().intValue() > 0) {
canvasBasicSettingMapper.deleteRoofMaterialsAdd(objectNo);
} else {
throw new QcastException (ErrorCode.NOT_FOUND ,"삭제할 지붕재가 존재하지 않습니다.");
}
}
// 데이터가 존재하지 않으면 insert
if (cntData.getRoofCnt().intValue() < 1) {
// 도면/치수/각도 정보 insert
canvasBasicSettingMapper.insertCanvasBasicSetting(csi);
// for-each 루프를 사용하여 지붕재추가 Setting
for (RoofMaterialsAddInfo rma : csi.getRoofMaterialsAddList()) {
rma.setObjectNo(csi.getObjectNo());
// 신규 지붕재추가 정보 insert
canvasBasicSettingMapper.insertRoofMaterialsAdd(rma);
}
} else {
// 도면/치수/각도 정보 update
canvasBasicSettingMapper.updateCanvasBasicSetting(csi);
// for-each 루프를 사용하여 지붕재추가 Setting
for (RoofMaterialsAddInfo rma : csi.getRoofMaterialsAddList()) {
rma.setObjectNo(csi.getObjectNo());
// 신규 지붕재추가 정보 insert
canvasBasicSettingMapper.updateRoofMaterialsAdd(rma);
}
}
response.put("objectNo", csi.getObjectNo());
response.put("returnMessage", "common.message.confirm.mark");
} catch (Exception e) {
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
}
// 생성된 objectNo 반환
return response;
}
// 지붕면 할당 Setting 등록
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, "올바르지 않은 입력값입니다.");
}
try {
// 기존 지붕재추가 정보 삭제 insert
canvasBasicSettingMapper.deleteRoofMaterialsAdd(rasi.getObjectNo());
// for-each 루프를 사용하여 지붕재추가 Setting
for (RoofAllocationInfo rai : rasi.getRoofAllocationList()) {
rai.setObjectNo(rasi.getObjectNo());
canvasBasicSettingMapper.insertRoofAllocation(rai);
}
response.put("objectNo", rasi.getObjectNo());
response.put("returnMessage", "common.message.confirm.mark");
} catch (Exception e) {
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
}
// 생성된 objectNo 반환
return response;
}
// 지붕재추가 삭제
public void deleteRoofMaterialsAdd(String objectNo) throws QcastException {
if (objectNo == null || objectNo.trim().isEmpty()) {
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, "올바르지 않은 입력값입니다.");
}
try {
// 먼저 데이터가 존재하는지 확인
RoofMaterialsAddInfo cntData = canvasBasicSettingMapper.getRoofMaterialsCnt(objectNo);
// 데이터가 존재하지 않으면 수정하지 않고 예외를 던짐
if (cntData.getRoofCnt().intValue() > 0) {
canvasBasicSettingMapper.deleteRoofMaterialsAdd(objectNo);
} else {
throw new QcastException(ErrorCode.NOT_FOUND, "삭제할 지붕재가 존재하지 않습니다.");
}
} catch (Exception e) {
if (e instanceof QcastException) throw e;
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
}
}
}

View File

@ -1,14 +1,12 @@
package com.interplug.qcast.biz.canvasGridSetting;
import com.interplug.qcast.biz.canvasGridSetting.dto.CanvasGridSettingInfo;
import com.interplug.qcast.config.Exception.QcastException;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.Map;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import java.util.Map;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
@ -19,24 +17,25 @@ import org.springframework.web.bind.annotation.*;
@Tag(name = "CanvasGridSettingController", description = "Canvas Grid Setting 관련 API")
public class CanvasGridSettingController {
private final CanvasGridSettingService canvasGridSettingService;
@Operation(description = "Canvas Grid Setting 정보를 조회 한다.")
@GetMapping("/canvas-grid-settings/by-object/{objectNo}")
public CanvasGridSettingInfo selectCanvasGridSetting(@PathVariable String objectNo) {
log.debug("Grid Setting 조회 ::::: " + objectNo);
return canvasGridSettingService.selectCanvasGridSetting(objectNo);
public CanvasGridSettingInfo selectCanvasGridSetting(@PathVariable String objectNo)
throws QcastException {
log.debug("Grid Setting 조회 ::::: " + objectNo);
return canvasGridSettingService.selectCanvasGridSetting(objectNo);
}
@Operation(description = "Canvas Grid Setting 정보를 등록 한다.")
@PostMapping("/canvas-grid-settings")
@ResponseStatus(HttpStatus.CREATED)
public Map<String, String> insertCanvasGridStatus(@RequestBody CanvasGridSettingInfo csi) {
log.debug("Grid Setting 등록 ::::: " + csi.getObjectNo());
return canvasGridSettingService.insertCanvasGridSetting(csi);
public Map<String, String> insertCanvasGridStatus(@RequestBody CanvasGridSettingInfo csi)
throws QcastException {
log.debug("Grid Setting 등록 ::::: " + csi.getObjectNo());
return canvasGridSettingService.insertCanvasGridSetting(csi);
}
}

View File

@ -1,43 +1,44 @@
package com.interplug.qcast.biz.canvasGridSetting;
import com.interplug.qcast.biz.canvasGridSetting.dto.CanvasGridSettingInfo;
import lombok.RequiredArgsConstructor;
import com.interplug.qcast.config.Exception.ErrorCode;
import com.interplug.qcast.config.Exception.QcastException;
import java.util.HashMap;
import java.util.Map;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class CanvasGridSettingService {
private final CanvasGridSettingMapper canvasGridSettingMapper;
private final CanvasGridSettingMapper canvasGridSettingMapper;
// Canvas Setting 조회(objectNo)
public CanvasGridSettingInfo selectCanvasGridSetting(String objectNo) {
return canvasGridSettingMapper.selectCanvasGridSetting(objectNo);
}
// Canvas Setting 조회(objectNo)
public CanvasGridSettingInfo selectCanvasGridSetting(String objectNo) throws QcastException {
try {
return canvasGridSettingMapper.selectCanvasGridSetting(objectNo);
} catch (Exception e) {
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
}
}
// Canvas Setting 등록
public Map<String, String> insertCanvasGridSetting(CanvasGridSettingInfo csi) {
Map<String, String> response = new HashMap<>();
// Canvas Setting 등록
public Map<String, String> insertCanvasGridSetting(CanvasGridSettingInfo csi)
throws QcastException {
try {
canvasGridSettingMapper.insertCanvasGridSetting(csi);
response.put("objectNo", csi.getObjectNo());
response.put("returnMessage", "common.message.confirm.mark");
} catch (Exception e) {
response.put("objectNo", csi.getObjectNo());
response.put("returnMessage", "common.message.save.error");
}
Map<String, String> response = new HashMap<>();
// 생성된 objectNo 반환
return response;
try {
canvasGridSettingMapper.insertCanvasGridSetting(csi);
}
response.put("objectNo", csi.getObjectNo());
response.put("returnMessage", "common.message.confirm.mark");
} catch (Exception e) {
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
}
// 생성된 objectNo 반환
return response;
}
}

View File

@ -2,14 +2,11 @@ package com.interplug.qcast.biz.canvasSetting;
import com.interplug.qcast.biz.canvasSetting.dto.CanvasSettingInfo;
import com.interplug.qcast.config.Exception.QcastException;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.Map;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import java.util.Map;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.*;
@ -20,33 +17,34 @@ import org.springframework.web.bind.annotation.*;
@Tag(name = "CanvasSettingController", description = "Canvas Setting 관련 API")
public class CanvasSettingController {
private final CanvasSettingService canvasSettingService;
@Operation(description = "Canvas Setting 정보를 조회 한다.")
@GetMapping("/canvas-settings/by-object/{objectNo}")
public CanvasSettingInfo selectCanvasSetting(@PathVariable String objectNo) {
log.debug("Setting 조회 ::::: " + objectNo);
return canvasSettingService.selectCanvasSetting(objectNo);
public CanvasSettingInfo selectCanvasSetting(@PathVariable String objectNo)
throws QcastException {
log.debug("Setting 조회 ::::: " + objectNo);
return canvasSettingService.selectCanvasSetting(objectNo);
}
@Operation(description = "Canvas Setting 정보를 등록 한다.")
@PostMapping("/canvas-settings")
@ResponseStatus(HttpStatus.CREATED)
public Map<String, String> insertCanvasSetting(@RequestBody CanvasSettingInfo csi) throws QcastException {
log.debug("Setting 등록 ::::: " + csi.getObjectNo());
return canvasSettingService.insertCanvasSetting(csi);
public Map<String, String> insertCanvasSetting(@RequestBody CanvasSettingInfo csi)
throws QcastException {
log.debug("Setting 등록 ::::: " + csi.getObjectNo());
return canvasSettingService.insertCanvasSetting(csi);
}
@Operation(description = "Canvas Setting 정보를 수정 한다.")
@PutMapping("/canvas-settings")
public void updateCanvasStatus(@RequestBody CanvasSettingInfo csi) {
log.debug("Setting 수정 ::::: " + csi.getObjectNo());
canvasSettingService.updateCanvasSetting(csi);
public void updateCanvasStatus(@RequestBody CanvasSettingInfo csi) throws QcastException {
log.debug("Setting 수정 ::::: " + csi.getObjectNo());
canvasSettingService.updateCanvasSetting(csi);
}
}

View File

@ -3,65 +3,61 @@ 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
@RequiredArgsConstructor
public class CanvasSettingService {
private final CanvasSettingMapper canvasSettingMapper;
private final CanvasSettingMapper canvasSettingMapper;
// Canvas Setting 조회(objectNo)
public CanvasSettingInfo selectCanvasSetting(String objectNo) {
return canvasSettingMapper.selectCanvasSetting(objectNo);
}
// Canvas Setting 조회(objectNo)
public CanvasSettingInfo selectCanvasSetting(String objectNo) throws QcastException {
try {
return canvasSettingMapper.selectCanvasSetting(objectNo);
} catch (Exception e) {
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
}
}
// Canvas Setting 등록
public Map<String, String> insertCanvasSetting(CanvasSettingInfo csi) throws QcastException {
Map<String, String> response = new HashMap<>();
if (csi.getObjectNo() == null) {
throw new QcastException (ErrorCode.INVALID_INPUT_VALUE ,"올바르지 않은 입력값입니다.");
}
try {
// 먼저 데이터가 존재하는지 확인
CanvasSettingInfo cntData = canvasSettingMapper.getCanvasSettingCnt(csi.getObjectNo());
// 데이터가 존재하지 않으면 insert
if (cntData.getCnt().intValue() < 1) {
canvasSettingMapper.insertCanvasSetting(csi);
response.put("objectNo", csi.getObjectNo());
response.put("returnMessage", "common.message.confirm.mark");
} else {
canvasSettingMapper.updateCanvasSetting(csi);
response.put("objectNo", csi.getObjectNo());
response.put("returnMessage", "common.message.confirm.mark");
}
} catch (Exception e) {
response.put("objectNo", csi.getObjectNo());
response.put("returnMessage", "common.message.save.error");
}
// Canvas Setting 등록
public Map<String, String> insertCanvasSetting(CanvasSettingInfo csi) throws QcastException {
// 생성된 objectNo 반환
return response;
Map<String, String> response = new HashMap<>();
}
if (csi.getObjectNo() == null) {
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, "올바르지 않은 입력값입니다.");
}
// Canvas Setting 수정
public void updateCanvasSetting(CanvasSettingInfo csi) {
canvasSettingMapper.updateCanvasSetting(csi);
}
try {
// 먼저 데이터가 존재하는지 확인
CanvasSettingInfo cntData = canvasSettingMapper.getCanvasSettingCnt(csi.getObjectNo());
// 데이터가 존재하지 않으면 insert
if (cntData.getCnt().intValue() < 1) {
canvasSettingMapper.insertCanvasSetting(csi);
} else {
canvasSettingMapper.updateCanvasSetting(csi);
}
response.put("objectNo", csi.getObjectNo());
response.put("returnMessage", "common.message.confirm.mark");
} catch (Exception e) {
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
}
// 생성된 objectNo 반환
return response;
}
// Canvas Setting 수정
public void updateCanvasSetting(CanvasSettingInfo csi) throws QcastException {
try {
canvasSettingMapper.updateCanvasSetting(csi);
} catch (Exception e) {
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
}
}
}

View File

@ -8,6 +8,7 @@ import com.interplug.qcast.config.Exception.QcastException;
import java.util.List;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@RequiredArgsConstructor
@ -18,10 +19,15 @@ public class CanvasStatusService {
public List<CanvasStatusResponse> selectAllCanvasStatus(String userId) throws QcastException {
List<CanvasStatusResponse> result = null;
if (userId != null && !userId.trim().isEmpty()) {
result = canvasStatusMapper.selectAllCanvasStatus(userId);
} else {
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, "올바르지 않은 입력값입니다.");
try {
if (userId != null && !userId.trim().isEmpty()) {
result = canvasStatusMapper.selectAllCanvasStatus(userId);
} else {
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, "올바르지 않은 입력값입니다.");
}
} catch (Exception e) {
if (e instanceof QcastException) throw e;
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
}
return result;
@ -32,10 +38,15 @@ public class CanvasStatusService {
throws QcastException {
List<CanvasStatusResponse> result = null;
if (objectNo != null && !objectNo.trim().isEmpty()) {
result = canvasStatusMapper.selectObjectNoCanvasStatus(objectNo);
} else {
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, "올바르지 않은 입력값입니다.");
try {
if (objectNo != null && !objectNo.trim().isEmpty()) {
result = canvasStatusMapper.selectObjectNoCanvasStatus(objectNo);
} else {
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, "올바르지 않은 입력값입니다.");
}
} catch (Exception e) {
if (e instanceof QcastException) throw e;
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
}
return result;
@ -56,7 +67,7 @@ public class CanvasStatusService {
id = maxId.get(0).getId();
} catch (Exception e) {
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, "캔버스 등록 중 오류 발생");
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
}
// 생성된 id 반환
@ -70,14 +81,19 @@ public class CanvasStatusService {
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, "올바르지 않은 입력값입니다.");
}
// 먼저 데이터가 존재하는지 확인
List<CanvasStatusResponse> existingStatus = canvasStatusMapper.getIdCanvasStatus(cs.getId());
try {
// 먼저 데이터가 존재하는지 확인
List<CanvasStatusResponse> existingStatus = canvasStatusMapper.getIdCanvasStatus(cs.getId());
// 데이터가 존재하지 않으면 수정하지 않고 예외를 던짐
if (existingStatus.size() > 0) {
canvasStatusMapper.updateCanvasStatus(cs);
} else {
throw new QcastException(ErrorCode.NOT_FOUND, "수정할 캔버스가 존재하지 않습니다.");
// 데이터가 존재하지 않으면 수정하지 않고 예외를 던짐
if (existingStatus.size() > 0) {
canvasStatusMapper.updateCanvasStatus(cs);
} else {
throw new QcastException(ErrorCode.NOT_FOUND, "수정할 캔버스가 존재하지 않습니다.");
}
} catch (Exception e) {
if (e instanceof QcastException) throw e;
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
}
}
@ -88,15 +104,20 @@ public class CanvasStatusService {
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, "올바르지 않은 입력값입니다.");
}
// 먼저 데이터가 존재하는지 확인
List<CanvasStatusResponse> existingStatus =
canvasStatusMapper.getObjectNoCanvasStatus(objectNo);
try {
// 먼저 데이터가 존재하는지 확인
List<CanvasStatusResponse> existingStatus =
canvasStatusMapper.getObjectNoCanvasStatus(objectNo);
// 데이터가 존재하지 않으면 수정하지 않고 예외를 던짐
if (existingStatus.size() > 0) {
canvasStatusMapper.deleteObjectNoCanvasStatus(objectNo);
} else {
throw new QcastException(ErrorCode.NOT_FOUND, "삭제할 캔버스가 존재하지 않습니다.");
// 데이터가 존재하지 않으면 수정하지 않고 예외를 던짐
if (existingStatus.size() > 0) {
canvasStatusMapper.deleteObjectNoCanvasStatus(objectNo);
} else {
throw new QcastException(ErrorCode.NOT_FOUND, "삭제할 캔버스가 존재하지 않습니다.");
}
} catch (Exception e) {
if (e instanceof QcastException) throw e;
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
}
}
@ -107,20 +128,26 @@ public class CanvasStatusService {
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, "올바르지 않은 입력값입니다.");
}
// 먼저 데이터가 존재하는지 확인
List<CanvasStatusResponse> existingStatus = canvasStatusMapper.getIdCanvasStatus(id);
try {
// 먼저 데이터가 존재하는지 확인
List<CanvasStatusResponse> existingStatus = canvasStatusMapper.getIdCanvasStatus(id);
// 데이터가 존재하지 않으면 처리하지 않고 예외를 던짐
if (existingStatus.size() > 0) {
// 데이터를 삭제하는 기존 방식에서 데이터를 삭제하지 않고 deleted 데이터를 바꾸는 방식으로 변경 (2025.02.11)
// canvasStatusMapper.deleteIdCanvasStatus(id);
canvasStatusMapper.updateDeletedCanvasStatus(id);
} else {
throw new QcastException(ErrorCode.NOT_FOUND, "삭제할 캔버스가 존재하지 않습니다.");
// 데이터가 존재하지 않으면 처리하지 않고 예외를 던짐
if (existingStatus.size() > 0) {
// 데이터를 삭제하는 기존 방식에서 데이터를 삭제하지 않고 deleted 데이터를 바꾸는 방식으로 변경 (2025.02.11)
// canvasStatusMapper.deleteIdCanvasStatus(id);
canvasStatusMapper.updateDeletedCanvasStatus(id);
} else {
throw new QcastException(ErrorCode.NOT_FOUND, "삭제할 캔버스가 존재하지 않습니다.");
}
} catch (Exception e) {
if (e instanceof QcastException) throw e;
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
}
}
// 캔버스 복사 등록
@Transactional
public int copyCanvasStatus(CanvasStatusCopyRequest cs) throws QcastException {
try {
canvasStatusMapper.copyCanvasStatus(cs);

View File

@ -5,9 +5,11 @@ import com.interplug.qcast.config.Exception.ErrorCode;
import com.interplug.qcast.config.Exception.QcastException;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Service
@RequiredArgsConstructor
@Transactional(readOnly = true)
public class CanvasPopupStatusService {
private final CanvasPopupStatusMapper canvasPopupStatusMapper;
@ -34,6 +36,7 @@ public class CanvasPopupStatusService {
* @param cps 저장할 CanvasPopupStatus 객체
* @throws QcastException 저장 예외 발생
*/
@Transactional
public void saveCanvasPopupStatus(CanvasPopupStatus cps) throws QcastException {
CanvasPopupStatus chk = canvasPopupStatusMapper.selectCanvasPopupStatus(cps);
if (chk == null) {
@ -49,6 +52,7 @@ public class CanvasPopupStatusService {
* @param cps 생성할 CanvasPopupStatus 객체
* @throws QcastException 생성 예외 발생
*/
@Transactional
public void createCanvasPopupStatus(CanvasPopupStatus cps) throws QcastException {
try {
canvasPopupStatusMapper.insertCanvasPopupStatus(cps);

View File

@ -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,18 +53,23 @@ 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())
.build());
});
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;
}
/**
* 헤더코드 동기화
*
*
* @param headCodeList
* @throws Exception
*/
@ -81,13 +86,12 @@ public class CommCodeService {
} catch (Exception e) {
log.error(e.getMessage());
}
}
}
/**
* 상세코드 동기화
*
*
* @param detailCodeList
* @throws Exception
*/
@ -104,8 +108,6 @@ public class CommCodeService {
} catch (Exception e) {
log.error(e.getMessage());
}
}
}
}

View File

@ -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);
}
}

View File

@ -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)
.queryParam("schNoticeTpCd", boardRequest.getSchNoticeTpCd())
.queryParam("schNoticeClsCd", boardRequest.getSchNoticeClsCd())
.queryParam("startRow", boardRequest.getStartRow())
.queryParam("endRow", boardRequest.getEndRow())
.queryParam("schMainYn", boardRequest.getSchMainYn()).build().toUriString();
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();
/* [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"));
}
}
}

View File

@ -4,6 +4,7 @@ import com.interplug.qcast.biz.displayItem.dto.DisplayItemRequest;
import com.interplug.qcast.biz.displayItem.dto.ItemDetailResponse;
import com.interplug.qcast.biz.displayItem.dto.ItemRequest;
import com.interplug.qcast.biz.displayItem.dto.ItemResponse;
import com.interplug.qcast.config.Exception.QcastException;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import java.util.List;
@ -30,13 +31,13 @@ public class DisplayItemController {
* 전시제품 정보 등록/수정
*
* @param displayItemRequest
* @throws Exception
* @throws QcastException
*/
@Operation(description = "전시제품 정보를 등록/수정한다. (동기화)")
@PostMapping("/display-item-save")
@ResponseStatus(HttpStatus.OK)
public void setStoreDisplayItemSave(@RequestBody DisplayItemRequest displayItemRequest)
throws Exception {
throws QcastException {
displayItemService.setStoreDisplayItemSave(displayItemRequest);
}
@ -45,12 +46,13 @@ public class DisplayItemController {
*
* @param itemRequest
* @return
* @throws Exception
* @throws QcastException
*/
@Operation(description = "제품 목록을 조회한다.")
@PostMapping("/item-list")
@ResponseStatus(HttpStatus.OK)
public List<ItemResponse> getItemList(@RequestBody ItemRequest itemRequest) throws Exception {
public List<ItemResponse> getItemList(@RequestBody ItemRequest itemRequest)
throws QcastException {
return displayItemService.getItemList(itemRequest);
}
@ -59,12 +61,12 @@ public class DisplayItemController {
*
* @param itemId
* @return
* @throws Exception
* @throws QcastException
*/
@Operation(description = "제품 상세 정보를 조회한다.")
@GetMapping("/item-detail")
@ResponseStatus(HttpStatus.OK)
public ItemDetailResponse getItemDetail(@RequestParam String itemId) throws Exception {
public ItemDetailResponse getItemDetail(@RequestParam String itemId) throws QcastException {
return displayItemService.getItemDetail(itemId);
}
}

View File

@ -4,6 +4,8 @@ import com.interplug.qcast.biz.displayItem.dto.*;
import com.interplug.qcast.biz.estimate.EstimateMapper;
import com.interplug.qcast.biz.estimate.dto.NoteRequest;
import com.interplug.qcast.biz.estimate.dto.NoteResponse;
import com.interplug.qcast.config.Exception.ErrorCode;
import com.interplug.qcast.config.Exception.QcastException;
import io.micrometer.common.util.StringUtils;
import java.util.List;
import lombok.RequiredArgsConstructor;
@ -23,10 +25,14 @@ public class DisplayItemService {
* 판매점 노출 아이템 정보 저장
*
* @param displayItemRequest
* @throws Exception
* @throws QcastException
*/
public void setStoreDisplayItemSave(DisplayItemRequest displayItemRequest) throws Exception {
displayItemMapper.setStoreDisplayItemSave(displayItemRequest);
public void setStoreDisplayItemSave(DisplayItemRequest displayItemRequest) throws QcastException {
try {
displayItemMapper.setStoreDisplayItemSave(displayItemRequest);
} catch (Exception e) {
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
}
}
/**
@ -34,9 +40,14 @@ public class DisplayItemService {
*
* @param itemRequest
* @return
* @throws QcastException
*/
public List<ItemResponse> getItemList(ItemRequest itemRequest) {
return displayItemMapper.getItemList(itemRequest);
public List<ItemResponse> getItemList(ItemRequest itemRequest) throws QcastException {
try {
return displayItemMapper.getItemList(itemRequest);
} catch (Exception e) {
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
}
}
/**
@ -45,36 +56,39 @@ public class DisplayItemService {
* @param itemId
* @return
*/
public ItemDetailResponse getItemDetail(String itemId) {
public ItemDetailResponse getItemDetail(String itemId) throws QcastException {
try {
ItemDetailResponse itemDetailResponse = displayItemMapper.getItemDetail(itemId);
ItemDetailResponse itemDetailResponse = displayItemMapper.getItemDetail(itemId);
if (itemDetailResponse != null) {
// BOM 헤더 아이템인 경우 BOM List를 내려준다.
if ("ERLA".equals(itemDetailResponse.getItemCtgGr())) {
List<ItemResponse> itemBomList = displayItemMapper.selectItemBomList(itemId);
if (itemDetailResponse != null) {
// BOM 헤더 아이템인 경우 BOM List를 내려준다.
if ("ERLA".equals(itemDetailResponse.getItemCtgGr())) {
List<ItemResponse> itemBomList = displayItemMapper.selectItemBomList(itemId);
itemDetailResponse.setItemBomList(itemBomList);
}
itemDetailResponse.setItemBomList(itemBomList);
// 견적특이사항 관련 데이터 셋팅
String[] arrItemId = {itemId};
NoteRequest noteRequest = new NoteRequest();
noteRequest.setArrItemId(arrItemId);
noteRequest.setSchSpnTypeCd("PROD");
List<NoteResponse> noteItemList = estimateMapper.selectEstimateNoteItemList(noteRequest);
String spnAttrCds = "";
for (NoteResponse noteResponse : noteItemList) {
spnAttrCds += !StringUtils.isEmpty(spnAttrCds) ? "" : "";
spnAttrCds += noteResponse.getCode();
}
itemDetailResponse.setSpnAttrCds(spnAttrCds);
}
// 견적특이사항 관련 데이터 셋팅
String[] arrItemId = {itemId};
NoteRequest noteRequest = new NoteRequest();
noteRequest.setArrItemId(arrItemId);
noteRequest.setSchSpnTypeCd("PROD");
List<NoteResponse> noteItemList = estimateMapper.selectEstimateNoteItemList(noteRequest);
String spnAttrCds = "";
for (NoteResponse noteResponse : noteItemList) {
spnAttrCds += !StringUtils.isEmpty(spnAttrCds) ? "" : "";
spnAttrCds += noteResponse.getCode();
}
itemDetailResponse.setSpnAttrCds(spnAttrCds);
return itemDetailResponse;
} catch (Exception e) {
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
}
return itemDetailResponse;
}
/**
@ -130,7 +144,7 @@ public class DisplayItemService {
/**
* 노출 아이템 동기화 - Batch
*
*
* @param displayItemList
* @throws Exception
*/
@ -144,5 +158,4 @@ public class DisplayItemService {
}
}
}
}

View File

@ -74,5 +74,4 @@ public class ExcelDownController {
log.error(e.getMessage());
}
}
}

View File

@ -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 = "파일을 삭제 한다.")

View File

@ -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,10 +45,9 @@ public class LoginController {
@Value("${qsp.auto.login.aes256.key}")
String autoLoginAesKey;
/**
* Q.CAST III에 로그인하여 사용자 정보를 획득한다.
*
*
* @param loginUser LoginUser
* @return UserLoginResponse
* @throws Exception
@ -69,7 +67,7 @@ public class LoginController {
/**
* 가입 신청 정보를 등록한다.
*
*
* @param joinUser JoinUser
* @return DefaultResponse
* @throws Exception
@ -83,7 +81,7 @@ public class LoginController {
/**
* 비밀번호를 초기화한다.
*
*
* @param userPassword UserPassword
* @return DefaultResponse
* @throws Exception
@ -96,7 +94,7 @@ public class LoginController {
/**
* 비밀번호를 변경한다.
*
*
* @param userPassword UserPassword
* @return DefaultResponse
* @throws Exception
@ -109,7 +107,7 @@ public class LoginController {
/**
* 자동 로그인에 사용하는 아이디를 암호화한다.
*
*
* @param loginUser LoginUser
* @return String
* @throws Exception
@ -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;
@ -153,7 +155,7 @@ public class LoginController {
/**
* 자동 로그인에 사용하는 아이디를 복호화한다.
*
*
* @param loginUser LoginUser
* @return String
* @throws Exception
@ -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;
}
}

View File

@ -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,23 +30,24 @@ public class LoginService {
@Value("${qsp.url}")
private String qspUrl;
@Autowired
Messages message;
@Autowired Messages message;
/**
* 로그인 처리
*
*
* @param loginUser LoginUser
* @return UserLoginResponse
* @throws Exception
*/
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;
@ -72,42 +73,49 @@ public class LoginService {
/**
* 가입 신청 등록
*
*
* @param joinUser JoinUser
* @return DefaultResponse
* @throws Exception
*/
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..
@ -145,18 +155,20 @@ public class LoginService {
/**
* 비밀번호 초기화
*
*
* @param userPassword UserPassword
* @return DefaultResponse
* @throws Exception
*/
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..
@ -177,22 +189,25 @@ public class LoginService {
/**
* 비밀번호 변경
*
*
* @param userPassword UserPassword
* @return DefaultResponse
* @throws Exception
*/
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..

View File

@ -24,7 +24,7 @@ public class MyInfoController {
/**
* 사용자 ID의 정보 조회
*
*
* @param myInfoRequest
* @return
*/
@ -34,5 +34,4 @@ public class MyInfoController {
public MyInfoResponse getMyInfo(@ModelAttribute MyInfoRequest myInfoRequest) {
return myInfoService.getMyInfo(myInfoRequest);
}
}

View File

@ -22,5 +22,4 @@ public class MyInfoService {
public MyInfoResponse getMyInfo(MyInfoRequest myInfoRequest) {
return myInfoMapper.selectMyInfo(myInfoRequest);
}
}

View File

@ -24,7 +24,7 @@ public class SpecialNoteController {
/**
* 견적 특이사항 정보 등록/수정
*
*
* @param specialNoteRequest
* @throws Exception
*/
@ -38,7 +38,7 @@ public class SpecialNoteController {
/**
* 견적 특이사항 ITEM 정보 등록/수정
*
*
* @param specialNoteItemRequest
* @throws Exception
*/
@ -49,5 +49,4 @@ public class SpecialNoteController {
throws Exception {
specialNoteService.setSpecialNoteItemSave(specialNoteItemRequest);
}
}

View File

@ -16,7 +16,7 @@ public class SpecialNoteService {
/**
* 견적 특이사항 저장
*
*
* @param specialNoteRequest
* @throws Exception
*/
@ -26,7 +26,7 @@ public class SpecialNoteService {
/**
* 견적 특이사항 아이템 저장
*
*
* @param specialNoteItemRequest
* @throws Exception
*/
@ -37,7 +37,7 @@ public class SpecialNoteService {
/**
* 견적 특이사항 동기화 - Batch
*
*
* @param specialNoteList
* @throws Exception
*/
@ -54,7 +54,7 @@ public class SpecialNoteService {
/**
* 견적 특이사항 아이템 동기화 - Batch
*
*
* @param specialNoteItemList
* @throws Exception
*/
@ -69,5 +69,4 @@ public class SpecialNoteService {
}
}
}
}

View File

@ -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);
}
}