refactor: service 내 transaction, throw QcastException 처리 추가
This commit is contained in:
parent
30b06b7f8b
commit
ff25eb4565
@ -23,7 +23,8 @@ public class CanvasBasicSettingController {
|
||||
|
||||
@Operation(description = "Canvas Basic Setting 정보를 조회 한다.")
|
||||
@GetMapping("/canvas-basic-settings/by-object/{objectNo}")
|
||||
public List<CanvasBasicSettingResponse> selectCanvasBasicSetting(@PathVariable String objectNo) {
|
||||
public List<CanvasBasicSettingResponse> selectCanvasBasicSetting(@PathVariable String objectNo)
|
||||
throws QcastException {
|
||||
|
||||
log.debug("Basic Setting 조회 ::::: " + objectNo);
|
||||
|
||||
|
||||
@ -13,19 +13,27 @@ import java.util.Map;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional(readOnly = true)
|
||||
public class CanvasBasicSettingService {
|
||||
private final CanvasBasicSettingMapper canvasBasicSettingMapper;
|
||||
|
||||
// Canvas Basic Setting 조회(objectNo)
|
||||
public List<CanvasBasicSettingResponse> selectCanvasBasicSetting(String 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 등록
|
||||
@Transactional
|
||||
public Map<String, String> insertCanvasBasicSetting(CanvasBasicSettingInfo csi)
|
||||
throws QcastException {
|
||||
|
||||
@ -56,9 +64,6 @@ public class CanvasBasicSettingService {
|
||||
canvasBasicSettingMapper.insertRoofMaterialsAdd(rma);
|
||||
}
|
||||
|
||||
response.put("objectNo", csi.getObjectNo());
|
||||
response.put("returnMessage", "common.message.confirm.mark");
|
||||
|
||||
} else {
|
||||
// 도면/치수/각도 정보 update
|
||||
canvasBasicSettingMapper.updateCanvasBasicSetting(csi);
|
||||
@ -70,14 +75,12 @@ public class CanvasBasicSettingService {
|
||||
// 신규 지붕재추가 정보 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");
|
||||
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
|
||||
}
|
||||
|
||||
// 생성된 objectNo 반환
|
||||
@ -85,6 +88,7 @@ public class CanvasBasicSettingService {
|
||||
}
|
||||
|
||||
// 지붕면 할당 Setting 등록
|
||||
@Transactional
|
||||
public Map<String, String> insertRoofAllocSetting(RoofAllocationSettingInfo rasi)
|
||||
throws QcastException {
|
||||
|
||||
@ -107,8 +111,7 @@ public class CanvasBasicSettingService {
|
||||
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");
|
||||
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
|
||||
}
|
||||
|
||||
// 생성된 objectNo 반환
|
||||
@ -116,12 +119,14 @@ public class CanvasBasicSettingService {
|
||||
}
|
||||
|
||||
// 지붕재추가 삭제
|
||||
@Transactional
|
||||
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);
|
||||
|
||||
@ -131,5 +136,9 @@ public class CanvasBasicSettingService {
|
||||
} 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -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.*;
|
||||
|
||||
@ -22,7 +20,8 @@ public class CanvasGridSettingController {
|
||||
|
||||
@Operation(description = "Canvas Grid Setting 정보를 조회 한다.")
|
||||
@GetMapping("/canvas-grid-settings/by-object/{objectNo}")
|
||||
public CanvasGridSettingInfo selectCanvasGridSetting(@PathVariable String objectNo) {
|
||||
public CanvasGridSettingInfo selectCanvasGridSetting(@PathVariable String objectNo)
|
||||
throws QcastException {
|
||||
|
||||
log.debug("Grid Setting 조회 ::::: " + objectNo);
|
||||
|
||||
@ -32,7 +31,8 @@ public class CanvasGridSettingController {
|
||||
@Operation(description = "Canvas Grid Setting 정보를 등록 한다.")
|
||||
@PostMapping("/canvas-grid-settings")
|
||||
@ResponseStatus(HttpStatus.CREATED)
|
||||
public Map<String, String> insertCanvasGridStatus(@RequestBody CanvasGridSettingInfo csi) {
|
||||
public Map<String, String> insertCanvasGridStatus(@RequestBody CanvasGridSettingInfo csi)
|
||||
throws QcastException {
|
||||
|
||||
log.debug("Grid Setting 등록 ::::: " + csi.getObjectNo());
|
||||
|
||||
|
||||
@ -2,25 +2,35 @@ package com.interplug.qcast.biz.canvasGridSetting;
|
||||
|
||||
import com.interplug.qcast.biz.canvasGridSetting.dto.CanvasGridSettingInfo;
|
||||
|
||||
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 org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional(readOnly = true)
|
||||
public class CanvasGridSettingService {
|
||||
private final CanvasGridSettingMapper canvasGridSettingMapper;
|
||||
|
||||
// Canvas Setting 조회(objectNo)
|
||||
public CanvasGridSettingInfo selectCanvasGridSetting(String 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) {
|
||||
@Transactional
|
||||
public Map<String, String> insertCanvasGridSetting(CanvasGridSettingInfo csi)
|
||||
throws QcastException {
|
||||
|
||||
Map<String, String> response = new HashMap<>();
|
||||
|
||||
@ -31,8 +41,7 @@ public class CanvasGridSettingService {
|
||||
response.put("returnMessage", "common.message.confirm.mark");
|
||||
|
||||
} catch (Exception e) {
|
||||
response.put("objectNo", csi.getObjectNo());
|
||||
response.put("returnMessage", "common.message.save.error");
|
||||
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
|
||||
}
|
||||
|
||||
// 생성된 objectNo 반환
|
||||
|
||||
@ -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.*;
|
||||
|
||||
@ -23,7 +20,8 @@ public class CanvasSettingController {
|
||||
|
||||
@Operation(description = "Canvas Setting 정보를 조회 한다.")
|
||||
@GetMapping("/canvas-settings/by-object/{objectNo}")
|
||||
public CanvasSettingInfo selectCanvasSetting(@PathVariable String objectNo) {
|
||||
public CanvasSettingInfo selectCanvasSetting(@PathVariable String objectNo)
|
||||
throws QcastException {
|
||||
|
||||
log.debug("Setting 조회 ::::: " + objectNo);
|
||||
|
||||
@ -43,7 +41,7 @@ public class CanvasSettingController {
|
||||
|
||||
@Operation(description = "Canvas Setting 정보를 수정 한다.")
|
||||
@PutMapping("/canvas-settings")
|
||||
public void updateCanvasStatus(@RequestBody CanvasSettingInfo csi) {
|
||||
public void updateCanvasStatus(@RequestBody CanvasSettingInfo csi) throws QcastException {
|
||||
|
||||
log.debug("Setting 수정 ::::: " + csi.getObjectNo());
|
||||
|
||||
|
||||
@ -7,18 +7,25 @@ import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional(readOnly = true)
|
||||
public class CanvasSettingService {
|
||||
private final CanvasSettingMapper canvasSettingMapper;
|
||||
|
||||
// Canvas Setting 조회(objectNo)
|
||||
public CanvasSettingInfo selectCanvasSetting(String 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 등록
|
||||
@Transactional
|
||||
public Map<String, String> insertCanvasSetting(CanvasSettingInfo csi) throws QcastException {
|
||||
|
||||
Map<String, String> response = new HashMap<>();
|
||||
@ -35,20 +42,13 @@ public class CanvasSettingService {
|
||||
// 데이터가 존재하지 않으면 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");
|
||||
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
|
||||
}
|
||||
|
||||
// 생성된 objectNo 반환
|
||||
@ -56,7 +56,12 @@ public class CanvasSettingService {
|
||||
}
|
||||
|
||||
// Canvas Setting 수정
|
||||
public void updateCanvasSetting(CanvasSettingInfo csi) {
|
||||
@Transactional
|
||||
public void updateCanvasSetting(CanvasSettingInfo csi) throws QcastException {
|
||||
try {
|
||||
canvasSettingMapper.updateCanvasSetting(csi);
|
||||
} catch (Exception e) {
|
||||
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -8,9 +8,11 @@ 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
|
||||
@Transactional(readOnly = true)
|
||||
public class CanvasStatusService {
|
||||
private final CanvasStatusMapper canvasStatusMapper;
|
||||
|
||||
@ -18,11 +20,16 @@ public class CanvasStatusService {
|
||||
public List<CanvasStatusResponse> selectAllCanvasStatus(String userId) throws QcastException {
|
||||
List<CanvasStatusResponse> result = null;
|
||||
|
||||
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,16 +39,22 @@ public class CanvasStatusService {
|
||||
throws QcastException {
|
||||
List<CanvasStatusResponse> result = null;
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// 캔버스 등록
|
||||
@Transactional
|
||||
public Integer insertCanvasStatus(CanvasStatus cs) throws QcastException {
|
||||
|
||||
Integer id = 0;
|
||||
@ -56,7 +69,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 반환
|
||||
@ -64,12 +77,14 @@ public class CanvasStatusService {
|
||||
}
|
||||
|
||||
// 캔버스 수정
|
||||
@Transactional
|
||||
public void updateCanvasStatus(CanvasStatus cs) throws QcastException {
|
||||
|
||||
if (cs.getId() == null) {
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, "올바르지 않은 입력값입니다.");
|
||||
}
|
||||
|
||||
try {
|
||||
// 먼저 데이터가 존재하는지 확인
|
||||
List<CanvasStatusResponse> existingStatus = canvasStatusMapper.getIdCanvasStatus(cs.getId());
|
||||
|
||||
@ -79,15 +94,21 @@ public class CanvasStatusService {
|
||||
} 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());
|
||||
}
|
||||
}
|
||||
|
||||
// 물건번호(objectNo)에 해당하는 캔버스 삭제
|
||||
@Transactional
|
||||
public void deleteObjectNoCanvasStatus(String objectNo) throws QcastException {
|
||||
|
||||
if (objectNo == null || objectNo.trim().isEmpty()) {
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, "올바르지 않은 입력값입니다.");
|
||||
}
|
||||
|
||||
try {
|
||||
// 먼저 데이터가 존재하는지 확인
|
||||
List<CanvasStatusResponse> existingStatus =
|
||||
canvasStatusMapper.getObjectNoCanvasStatus(objectNo);
|
||||
@ -98,15 +119,21 @@ public class CanvasStatusService {
|
||||
} 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());
|
||||
}
|
||||
}
|
||||
|
||||
// id에 해당하는 캔버스 삭제
|
||||
@Transactional
|
||||
public void deleteIdCanvasStatus(Integer id) throws QcastException {
|
||||
|
||||
if (id == null) {
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE, "올바르지 않은 입력값입니다.");
|
||||
}
|
||||
|
||||
try {
|
||||
// 먼저 데이터가 존재하는지 확인
|
||||
List<CanvasStatusResponse> existingStatus = canvasStatusMapper.getIdCanvasStatus(id);
|
||||
|
||||
@ -118,9 +145,14 @@ public class CanvasStatusService {
|
||||
} 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);
|
||||
|
||||
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@ -4,15 +4,19 @@ 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;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
@Transactional(readOnly = true)
|
||||
public class DisplayItemService {
|
||||
|
||||
private final EstimateMapper estimateMapper;
|
||||
@ -23,10 +27,15 @@ public class DisplayItemService {
|
||||
* 판매점 노출 아이템 정보 저장
|
||||
*
|
||||
* @param displayItemRequest
|
||||
* @throws Exception
|
||||
* @throws QcastException
|
||||
*/
|
||||
public void setStoreDisplayItemSave(DisplayItemRequest displayItemRequest) throws Exception {
|
||||
@Transactional
|
||||
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 +43,14 @@ public class DisplayItemService {
|
||||
*
|
||||
* @param itemRequest
|
||||
* @return
|
||||
* @throws QcastException
|
||||
*/
|
||||
public List<ItemResponse> getItemList(ItemRequest 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,8 +59,8 @@ public class DisplayItemService {
|
||||
* @param itemId
|
||||
* @return
|
||||
*/
|
||||
public ItemDetailResponse getItemDetail(String itemId) {
|
||||
|
||||
public ItemDetailResponse getItemDetail(String itemId) throws QcastException {
|
||||
try {
|
||||
ItemDetailResponse itemDetailResponse = displayItemMapper.getItemDetail(itemId);
|
||||
|
||||
if (itemDetailResponse != null) {
|
||||
@ -75,6 +89,9 @@ public class DisplayItemService {
|
||||
}
|
||||
|
||||
return itemDetailResponse;
|
||||
} catch (Exception e) {
|
||||
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR, e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user