[1068] 견적서 삭제 api 추가 #38

Merged
ysCha merged 1 commits from feature/cha into dev 2025-05-30 15:45:45 +09:00
4 changed files with 104 additions and 1 deletions

View File

@ -103,4 +103,11 @@ public class EstimateController {
public EstimateApiResponse selectAgencyCustList(PriceRequest priceRequest) throws Exception { public EstimateApiResponse selectAgencyCustList(PriceRequest priceRequest) throws Exception {
return estimateService.selectAgencyCustList(priceRequest); return estimateService.selectAgencyCustList(priceRequest);
} }
@Operation(description = "견적서를 삭제한다.")
@PostMapping("/delete-estimate")
@ResponseStatus(HttpStatus.CREATED)
public void deleteEstimate(@RequestBody EstimateRequest estimateRequest) throws Exception {
estimateService.deleteEstimate(estimateRequest);
}
} }

View File

@ -146,4 +146,8 @@ public interface EstimateMapper {
// 견적서 수정일 변경 // 견적서 수정일 변경
public int updateEstimateLastEditDate(EstimateRequest estimateRequest); public int updateEstimateLastEditDate(EstimateRequest estimateRequest);
public int updateEstimateInit(EstimateRequest estimateRequest);
public int updateEstimateInfoInit(EstimateRequest estimateRequest);
} }

View File

@ -1628,7 +1628,7 @@ public class EstimateService {
} }
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); log.error("Failed to excelDownload estimate. Request: {}", request, e);
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR); throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR);
} }
} }
@ -2327,4 +2327,47 @@ public class EstimateService {
return response; return response;
} }
/**
* 견적서 삭제 (복사이후 배치면 저장)
* @param estimateRequest
* @throws Exception
*/
public void deleteEstimate(EstimateRequest estimateRequest) throws Exception{
if (StringUtils.isEmpty(estimateRequest.getObjectNo())) {
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
message.getMessage("common.message.required.data", "Object No"));
}
if (StringUtils.isEmpty(estimateRequest.getPlanNo())) {
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
message.getMessage("common.message.required.data", "Plan No"));
}
if (StringUtils.isEmpty(estimateRequest.getSaleStoreId())) {
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
message.getMessage("common.message.required.data", "Sale Store ID"));
}
if (StringUtils.isEmpty(estimateRequest.getUserId())) {
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
message.getMessage("common.message.required.data", "User ID"));
}
try {
// T_PLAN
int cnt = estimateMapper.updateEstimateInit(estimateRequest);
// T_PLAN_INFO
int cnt2 = estimateMapper.updateEstimateInfoInit(estimateRequest);
// 견적서 모든 아이템 제거
int cnt3 = estimateMapper.deleteEstimateItemList(estimateRequest);
int cnt4 = estimateMapper.deleteEstimateInfoItemList(estimateRequest);
} catch (Exception e) {
log.error("Failed to delete estimate. Request: {}", estimateRequest, e);
throw e; // 예외를 재던지기하여 상위 계층에서도 예외를 처리할 있도록
}
}
} }

View File

@ -729,6 +729,32 @@
AND PLAN_NO = #{planNo} AND PLAN_NO = #{planNo}
</update> </update>
<update id="updateEstimateInit" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest">
/* sqlid : com.interplug.qcast.biz.estimate.updateEstimate */
UPDATE T_PLAN
SET
CONSTRUCT_SPECIFICATION = NULL
,SETUP_HEIGHT = NULL
,WEATHER_POINT = NULL
,SLOPE = NULL
,ROOF_MATERIAL_ID = NULL
,SUPPORT_METHOD_ID = NULL
,MODULE_MODEL = NULL
,DRAWING_ESTIMATE_CREATE_DATE = NULL
,ESTIMATE_VALIDITY_TERM = NULL
,CAPACITY = NULL
,SNOWFALL = NULL
,STANDARD_WIND_SPEED_ID = NULL
,PC_TYPE_NO = NULL
,ROOF_MATERIAL_ID_MULTI = NULL
,SUPPORT_MEAKER_MULTI = NULL
,SUPPORT_METHOD_ID_MULTI = NULL
,LAST_EDIT_DATETIME = GETDATE()
,LAST_EDIT_USER = #{userId}
WHERE OBJECT_NO = #{objectNo}
AND PLAN_NO = #{planNo}
</update>
<update id="updateEstimateInfoReset" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest"> <update id="updateEstimateInfoReset" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest">
/* sqlid : com.interplug.qcast.biz.estimate.updateEstimateInfoReset */ /* sqlid : com.interplug.qcast.biz.estimate.updateEstimateInfoReset */
UPDATE T_PLAN_INFO UPDATE T_PLAN_INFO
@ -745,6 +771,29 @@
AND PLAN_NO = #{planNo} AND PLAN_NO = #{planNo}
</update> </update>
<update id="updateEstimateInfoInit" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest">
/* sqlid : com.interplug.qcast.biz.estimate.updateEstimateInfoReset */
UPDATE T_PLAN_INFO
SET
CONSTRUCT_SPECIFICATION_MULTI = NULL
, SURFACE_TYPE = NULL
, ANGLE = NULL
, ESTIMATE_DATE = NULL
, ESTIMATE_TYPE = NULL
, FILE_FLG = 0
, ESTIMATE_OPTION = NULL
, PKG_ASP = NULL
, DOC_NO = NULL
, PRICE_CD = NULL
, REMARKS = NULL
, TEMP_FLG = 1
, LOCK_FLG = 0
, SYNC_FLG = NULL
, SEC_SAP_SALES_STORE_CD = NULL
WHERE OBJECT_NO = #{objectNo}
AND PLAN_NO = #{planNo}
</update>
<update id="updateEstimateLock" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest"> <update id="updateEstimateLock" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest">
/* sqlid : com.interplug.qcast.biz.estimate.updateEstimateLock */ /* sqlid : com.interplug.qcast.biz.estimate.updateEstimateLock */
UPDATE T_PLAN_INFO UPDATE T_PLAN_INFO