견적서 API 오류 수정
This commit is contained in:
parent
fda8746aa0
commit
8df66cd591
@ -53,7 +53,8 @@ public class EstimateController {
|
||||
@Operation(description = "견적서를 복사한다.")
|
||||
@PostMapping("/save-estimate-copy")
|
||||
@ResponseStatus(HttpStatus.CREATED)
|
||||
public void insertEstimateCopy(@RequestBody EstimateRequest estimateRequest) throws Exception {
|
||||
estimateService.insertEstimateCopy(estimateRequest);
|
||||
public EstimateResponse insertEstimateCopy(@RequestBody EstimateRequest estimateRequest)
|
||||
throws Exception {
|
||||
return estimateService.insertEstimateCopy(estimateRequest);
|
||||
}
|
||||
}
|
||||
|
||||
@ -49,6 +49,11 @@ public class EstimateService {
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Sale Store ID"));
|
||||
}
|
||||
if (StringUtils.isEmpty(priceRequest.getSapSalesStoreCd())) {
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Sap Sale Store Code"));
|
||||
}
|
||||
if (StringUtils.isEmpty(priceRequest.getDocTpCd())) {
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
@ -61,6 +66,7 @@ public class EstimateService {
|
||||
String apiUrl =
|
||||
UriComponentsBuilder.fromHttpUrl(url)
|
||||
.queryParam("saleStoreId", priceRequest.getSaleStoreId())
|
||||
.queryParam("sapSalesStoreCd", priceRequest.getSapSalesStoreCd())
|
||||
.queryParam("docTpCd", priceRequest.getDocTpCd())
|
||||
.build()
|
||||
.toUriString();
|
||||
@ -412,7 +418,7 @@ public class EstimateService {
|
||||
}
|
||||
}
|
||||
|
||||
public void insertEstimateCopy(EstimateRequest estimateRequest) throws Exception {
|
||||
public EstimateResponse insertEstimateCopy(EstimateRequest estimateRequest) throws Exception {
|
||||
// Validation
|
||||
if (StringUtils.isEmpty(estimateRequest.getObjectNo())) {
|
||||
throw new QcastException(
|
||||
@ -425,6 +431,8 @@ public class EstimateService {
|
||||
message.getMessage("common.message.required.data", "Plan No"));
|
||||
}
|
||||
|
||||
EstimateResponse response = new EstimateResponse();
|
||||
|
||||
// [1]. 총 플랜 목록 조회 및 제약조건 처리 (플랜 10개까지만 등록)
|
||||
PlanRequest planRequest = new PlanRequest();
|
||||
planRequest.setObjectNo(estimateRequest.getObjectNo());
|
||||
@ -494,11 +502,17 @@ public class EstimateService {
|
||||
}
|
||||
|
||||
// 도면 복사 (추후 개발 필요)
|
||||
|
||||
// 리턴
|
||||
response.setObjectNo(estimateRequest.getObjectNo());
|
||||
response.setPlanNo(estimateRequest.getCopyPlanNo());
|
||||
return response;
|
||||
}
|
||||
|
||||
public void selectTotalPriceInfo(EstimateResponse estimateResponse) throws Exception {
|
||||
BigDecimal totAmount = BigDecimal.ZERO;
|
||||
BigDecimal totVol = BigDecimal.ZERO;
|
||||
BigDecimal pkgTotPrice = BigDecimal.ZERO;
|
||||
BigDecimal supplyPrice = BigDecimal.ZERO;
|
||||
BigDecimal vatPrice = BigDecimal.ZERO;
|
||||
BigDecimal totPrice = BigDecimal.ZERO;
|
||||
@ -551,7 +565,9 @@ public class EstimateService {
|
||||
}
|
||||
|
||||
if ("YJSS".equals(estimateType)) {
|
||||
supplyPrice.add(pkgAsp.multiply(totVol));
|
||||
pkgTotPrice = pkgAsp.multiply(totVol);
|
||||
pkgTotPrice = pkgTotPrice.setScale(0, BigDecimal.ROUND_HALF_UP);
|
||||
supplyPrice = supplyPrice.add(pkgTotPrice);
|
||||
}
|
||||
|
||||
// 부가세 계산 (10프로)
|
||||
@ -559,6 +575,7 @@ public class EstimateService {
|
||||
// 총 가격 합산 (공급가 + 부가세)
|
||||
totPrice = totPrice.add(supplyPrice.add(vatPrice));
|
||||
|
||||
estimateResponse.setPkgTotPrice(String.valueOf(pkgTotPrice));
|
||||
estimateResponse.setTotAmount(String.valueOf(totAmount.setScale(0, BigDecimal.ROUND_HALF_UP)));
|
||||
estimateResponse.setTotVol(String.valueOf(totVol.setScale(0, BigDecimal.ROUND_HALF_UP)));
|
||||
estimateResponse.setSupplyPrice(
|
||||
|
||||
@ -0,0 +1,85 @@
|
||||
package com.interplug.qcast.biz.estimate.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class EstimatePdfResponse {
|
||||
@Schema(description = "물건번호")
|
||||
private String objectNo;
|
||||
|
||||
@Schema(description = "플랜번호")
|
||||
private String planNo;
|
||||
|
||||
@Schema(description = "판매점ID")
|
||||
private String saleStoreId;
|
||||
|
||||
@Schema(description = "견적서 유효기간")
|
||||
private String estimateValidityTerm;
|
||||
|
||||
@Schema(description = "견적갱신일")
|
||||
private String estimateDate;
|
||||
|
||||
@Schema(description = "PKG 단가")
|
||||
private String pkgAsp;
|
||||
|
||||
@Schema(description = "비고")
|
||||
private String remarks;
|
||||
|
||||
// 가격 관련 정보
|
||||
@Schema(description = "총 수량")
|
||||
private String totAmount;
|
||||
|
||||
@Schema(description = "총 용량")
|
||||
private String totVol;
|
||||
|
||||
@Schema(description = "PKG 총액")
|
||||
private String pkgTotPrice;
|
||||
|
||||
@Schema(description = "공급가액")
|
||||
private String supplyPrice;
|
||||
|
||||
@Schema(description = "부가세")
|
||||
private String vatPrice;
|
||||
|
||||
@Schema(description = "총액")
|
||||
private String totPrice;
|
||||
|
||||
// 물건정보 정보
|
||||
@Schema(description = "물건명")
|
||||
private String objectName;
|
||||
|
||||
@Schema(description = "경칭")
|
||||
private String objectNameOmit;
|
||||
|
||||
// 판매점 정보
|
||||
@Schema(description = "고객 판매점명")
|
||||
private String custSaleStoreName;
|
||||
|
||||
@Schema(description = "판매점명")
|
||||
private String saleStoreName;
|
||||
|
||||
@Schema(description = "우편번호")
|
||||
private String zipNo;
|
||||
|
||||
@Schema(description = "주소")
|
||||
private String address;
|
||||
|
||||
@Schema(description = "전화번호")
|
||||
private String tel;
|
||||
|
||||
@Schema(description = "Fax번호")
|
||||
private String fax;
|
||||
|
||||
// PKG 정보
|
||||
@Schema(description = "주택패키지 여부")
|
||||
private String pkgYn;
|
||||
|
||||
@Schema(description = "주택패키지 번호")
|
||||
private String pkgNo;
|
||||
|
||||
// 데이터 목록 관련 정보
|
||||
@Schema(description = "아이템 목록")
|
||||
List<ItemResponse> itemList;
|
||||
}
|
||||
@ -133,6 +133,9 @@ public class EstimateResponse {
|
||||
@Schema(description = "가격코드")
|
||||
private String priceCd;
|
||||
|
||||
@Schema(description = "비고")
|
||||
private String remarks;
|
||||
|
||||
@Schema(description = "갱신일")
|
||||
private String lastEditDatetime;
|
||||
|
||||
@ -143,6 +146,9 @@ public class EstimateResponse {
|
||||
@Schema(description = "총 용량")
|
||||
private String totVol;
|
||||
|
||||
@Schema(description = "PKG 총액")
|
||||
private String pkgTotPrice;
|
||||
|
||||
@Schema(description = "공급가액")
|
||||
private String supplyPrice;
|
||||
|
||||
@ -159,6 +165,9 @@ public class EstimateResponse {
|
||||
@Schema(description = "경칭")
|
||||
private String objectNameOmit;
|
||||
|
||||
@Schema(description = "물건정보 비고")
|
||||
private String objectRemarks;
|
||||
|
||||
// 데이터 목록 관련 정보
|
||||
@Schema(description = "아이템 목록")
|
||||
List<ItemResponse> itemList;
|
||||
|
||||
@ -45,15 +45,52 @@
|
||||
, P.FILE_FLG
|
||||
, P.ESTIMATE_OPTION
|
||||
, P.PKG_ASP
|
||||
, P.PRICE_CD
|
||||
, P.REMARKS
|
||||
, P.LAST_EDIT_DATETIME
|
||||
, O.OBJECT_NAME
|
||||
, O.OBJECT_NAME_OMIT
|
||||
, O.REMARKS AS OBJECT_REMARKS
|
||||
FROM T_PLAN P WITH (NOLOCK)
|
||||
INNER JOIN T_OBJECT O WITH (NOLOCK)
|
||||
ON T.OBJECT_NO = O.OBJECT_NO
|
||||
WHERE T.OBJECT_NO = #{objectNo}
|
||||
AND T.PLAN_NO = #{planNo}
|
||||
AND T.DEL_FLG = '0'
|
||||
ON P.OBJECT_NO = O.OBJECT_NO
|
||||
WHERE P.OBJECT_NO = #{objectNo}
|
||||
AND P.PLAN_NO = #{planNo}
|
||||
AND P.DEL_FLG = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectEstimatePdfDetail" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.EstimatePdfResponse">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.selectPdfEstimateDetail */
|
||||
SELECT
|
||||
T.*
|
||||
, SS1.SALE_STORE_NAME AS CUST_SALE_STORE_NAME
|
||||
, SS2.SALE_STORE_NAME
|
||||
, SS2.ZIP_NO
|
||||
, SS2.ADDRESS
|
||||
, SS2.TEL
|
||||
, SS2.FAX
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
P.OBJECT_NO
|
||||
, P.PLAN_NO
|
||||
, P.ESTIMATE_VALIDITY_TERM
|
||||
, P.REMARKS
|
||||
, CONVERT(NVARCHAR(10), P.LAST_EDIT_DATETIME, 121) AS ESTIMATE_DATE
|
||||
, O.SALE_STORE_ID
|
||||
, O.OBJECT_NAME
|
||||
, O.OBJECT_NAME_OMIT
|
||||
, (SELECT SALE_STORE_ID FROM M_USER WHERE USER_ID = O.CREATE_USER) AS CREATE_SALE_STORE_ID
|
||||
FROM T_PLAN P WITH (NOLOCK)
|
||||
INNER JOIN T_OBJECT O WITH (NOLOCK)
|
||||
ON P.OBJECT_NO = O.OBJECT_NO
|
||||
WHERE P.OBJECT_NO = #{objectNo}
|
||||
AND P.PLAN_NO = #{planNo}
|
||||
) T
|
||||
LEFT OUTER JOIN M_SALES_STORE SS1 WITH (NOLOCK)
|
||||
ON T.SALE_STORE_ID = SS1.SALE_STORE_ID
|
||||
LEFT OUTER JOIN M_SALES_STORE SS2 WITH (NOLOCK)
|
||||
ON T.CREATE_SALE_STORE_ID = SS2.SALE_STORE_ID
|
||||
</select>
|
||||
|
||||
<select id="selectEstimateItemList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.ItemResponse">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user