견적서 문서 다운로드 옵션 관련 수정
This commit is contained in:
parent
717ae6cfb9
commit
306d15f531
@ -1,7 +1,43 @@
|
||||
package com.interplug.qcast.biz.estimate;
|
||||
|
||||
import java.beans.BeanInfo;
|
||||
import java.beans.Introspector;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
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.web.util.UriComponentsBuilder;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.interplug.qcast.biz.estimate.dto.*;
|
||||
import com.interplug.qcast.biz.estimate.dto.EstimateApiResponse;
|
||||
import com.interplug.qcast.biz.estimate.dto.EstimateCopyRequest;
|
||||
import com.interplug.qcast.biz.estimate.dto.EstimateRequest;
|
||||
import com.interplug.qcast.biz.estimate.dto.EstimateResponse;
|
||||
import com.interplug.qcast.biz.estimate.dto.EstimateSendRequest;
|
||||
import com.interplug.qcast.biz.estimate.dto.EstimateSendResponse;
|
||||
import com.interplug.qcast.biz.estimate.dto.ItemRequest;
|
||||
import com.interplug.qcast.biz.estimate.dto.ItemResponse;
|
||||
import com.interplug.qcast.biz.estimate.dto.NoteRequest;
|
||||
import com.interplug.qcast.biz.estimate.dto.NoteResponse;
|
||||
import com.interplug.qcast.biz.estimate.dto.PlanSyncResponse;
|
||||
import com.interplug.qcast.biz.estimate.dto.PriceRequest;
|
||||
import com.interplug.qcast.biz.estimate.dto.RoofInfoResponse;
|
||||
import com.interplug.qcast.biz.estimate.dto.RoofRequest;
|
||||
import com.interplug.qcast.biz.estimate.dto.RoofResponse;
|
||||
import com.interplug.qcast.biz.file.FileMapper;
|
||||
import com.interplug.qcast.biz.file.dto.FileRequest;
|
||||
import com.interplug.qcast.biz.file.dto.FileResponse;
|
||||
@ -19,26 +55,8 @@ import com.interplug.qcast.util.InterfaceQsp;
|
||||
import com.interplug.qcast.util.PdfUtil;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.beans.BeanInfo;
|
||||
import java.beans.Introspector;
|
||||
import java.beans.PropertyDescriptor;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Method;
|
||||
import java.math.BigDecimal;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.jsoup.nodes.Document;
|
||||
import org.jsoup.nodes.Element;
|
||||
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.web.util.UriComponentsBuilder;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@ -46,7 +64,8 @@ import org.springframework.web.util.UriComponentsBuilder;
|
||||
public class EstimateService {
|
||||
private final InterfaceQsp interfaceQsp;
|
||||
|
||||
@Autowired Messages message;
|
||||
@Autowired
|
||||
Messages message;
|
||||
|
||||
@Value("${file.ini.root.path}")
|
||||
private String baseDirPath;
|
||||
@ -63,7 +82,8 @@ public class EstimateService {
|
||||
|
||||
private final FileMapper fileMapper;
|
||||
|
||||
@Autowired private PwrGnrSimService pwrGnrSimService;
|
||||
@Autowired
|
||||
private PwrGnrSimService pwrGnrSimService;
|
||||
|
||||
/**
|
||||
* QSP 1차점 price 관리 목록 조회
|
||||
@ -75,31 +95,25 @@ public class EstimateService {
|
||||
public EstimateApiResponse selectStorePriceList(PriceRequest priceRequest) throws Exception {
|
||||
// Validation
|
||||
if (StringUtils.isEmpty(priceRequest.getSaleStoreId())) {
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(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,
|
||||
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,
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Estimate Type"));
|
||||
}
|
||||
|
||||
EstimateApiResponse response = null;
|
||||
/* [1]. QSP API (url + param) Setting */
|
||||
String url = QSP_API_URL + "/api/price/storePriceList";
|
||||
String apiUrl =
|
||||
UriComponentsBuilder.fromHttpUrl(url)
|
||||
String apiUrl = UriComponentsBuilder.fromHttpUrl(url)
|
||||
.queryParam("saleStoreId", priceRequest.getSaleStoreId())
|
||||
.queryParam("sapSalesStoreCd", priceRequest.getSapSalesStoreCd())
|
||||
.queryParam("docTpCd", priceRequest.getDocTpCd())
|
||||
.build()
|
||||
.toUriString();
|
||||
.queryParam("docTpCd", priceRequest.getDocTpCd()).build().toUriString();
|
||||
|
||||
/* [2]. QSP API CALL -> Response */
|
||||
String strResponse = interfaceQsp.callApi(HttpMethod.GET, apiUrl, null);
|
||||
@ -127,26 +141,22 @@ public class EstimateService {
|
||||
public EstimateApiResponse selectItemPriceList(PriceRequest priceRequest) throws Exception {
|
||||
// Validation
|
||||
if (StringUtils.isEmpty(priceRequest.getSaleStoreId())) {
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(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,
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Sap Sale Store Code"));
|
||||
}
|
||||
if (StringUtils.isEmpty(priceRequest.getPriceCd())) {
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Price Code"));
|
||||
}
|
||||
|
||||
EstimateApiResponse response = null;
|
||||
/* [1]. QSP API CALL -> Response */
|
||||
String strResponse =
|
||||
interfaceQsp.callApi(
|
||||
HttpMethod.POST, QSP_API_URL + "/api//price/storePriceItemList", priceRequest);
|
||||
String strResponse = interfaceQsp.callApi(HttpMethod.POST,
|
||||
QSP_API_URL + "/api//price/storePriceItemList", priceRequest);
|
||||
|
||||
if (!"".equals(strResponse)) {
|
||||
com.fasterxml.jackson.databind.ObjectMapper om =
|
||||
@ -183,13 +193,11 @@ public class EstimateService {
|
||||
public EstimateResponse selectEstimateDetail(String objectNo, String planNo) throws Exception {
|
||||
// Validation
|
||||
if (StringUtils.isEmpty(objectNo)) {
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Object No"));
|
||||
}
|
||||
if (StringUtils.isEmpty(planNo)) {
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Plan No"));
|
||||
}
|
||||
|
||||
@ -233,23 +241,19 @@ public class EstimateService {
|
||||
public void insertEstimate(EstimateRequest estimateRequest) throws Exception {
|
||||
// Validation
|
||||
if (StringUtils.isEmpty(estimateRequest.getObjectNo())) {
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
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,
|
||||
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,
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Sale Store ID"));
|
||||
}
|
||||
if (StringUtils.isEmpty(estimateRequest.getSapSalesStoreCd())) {
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Sap Sale Store Code"));
|
||||
}
|
||||
|
||||
@ -268,8 +272,8 @@ public class EstimateService {
|
||||
ObjectResponse objectResponse =
|
||||
objectMapper.selectObjectDetail(estimateRequest.getObjectNo());
|
||||
if (objectResponse != null) {
|
||||
estimateRequest.setWeatherPoint(
|
||||
objectResponse.getPrefName() + " - " + objectResponse.getAreaName());
|
||||
estimateRequest
|
||||
.setWeatherPoint(objectResponse.getPrefName() + " - " + objectResponse.getAreaName());
|
||||
estimateRequest.setCharger(objectResponse.getReceiveUser());
|
||||
}
|
||||
|
||||
@ -391,9 +395,7 @@ public class EstimateService {
|
||||
bomItem.setUnit(itemResponse.getUnit());
|
||||
bomItem.setPnowW(itemResponse.getPnowW());
|
||||
bomItem.setSpecification(itemResponse.getPnowW());
|
||||
bomItem.setAmount(
|
||||
String.valueOf(
|
||||
Integer.parseInt(itemResponse.getBomAmount())
|
||||
bomItem.setAmount(String.valueOf(Integer.parseInt(itemResponse.getBomAmount())
|
||||
* Integer.parseInt(itemRequest.getAmount())));
|
||||
bomItem.setBomAmount(itemResponse.getBomAmount());
|
||||
bomItem.setUnitPrice(itemResponse.getSalePrice());
|
||||
@ -485,28 +487,23 @@ public class EstimateService {
|
||||
String pcTypeNo = "";
|
||||
for (ItemRequest itemRequest : itemList) {
|
||||
if (StringUtils.isEmpty(itemRequest.getDispOrder())) {
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Display Order"));
|
||||
}
|
||||
if (StringUtils.isEmpty(itemRequest.getItemId())) {
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Item ID"));
|
||||
}
|
||||
if (StringUtils.isEmpty(itemRequest.getAmount())) {
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Item Amount"));
|
||||
}
|
||||
|
||||
// 수량
|
||||
BigDecimal amount =
|
||||
new BigDecimal(
|
||||
BigDecimal amount = new BigDecimal(
|
||||
StringUtils.isEmpty(itemRequest.getAmount()) ? "0" : itemRequest.getAmount());
|
||||
// 아이템용량
|
||||
BigDecimal pnowW =
|
||||
new BigDecimal(
|
||||
BigDecimal pnowW = new BigDecimal(
|
||||
StringUtils.isEmpty(itemRequest.getPnowW()) ? "0" : itemRequest.getPnowW());
|
||||
|
||||
// 모듈/PC 체크
|
||||
@ -576,8 +573,7 @@ public class EstimateService {
|
||||
itemRequest.setPartAdd(
|
||||
!StringUtils.isEmpty(itemRequest.getPartAdd()) ? itemRequest.getPartAdd() : "0");
|
||||
itemRequest.setItemChangeFlg(
|
||||
!StringUtils.isEmpty(itemRequest.getItemChangeFlg())
|
||||
? itemRequest.getItemChangeFlg()
|
||||
!StringUtils.isEmpty(itemRequest.getItemChangeFlg()) ? itemRequest.getItemChangeFlg()
|
||||
: "0");
|
||||
itemRequest.setUserId(estimateRequest.getUserId());
|
||||
|
||||
@ -616,13 +612,11 @@ public class EstimateService {
|
||||
throws Exception {
|
||||
// Validation
|
||||
if (StringUtils.isEmpty(estimateCopyRequest.getObjectNo())) {
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Object No"));
|
||||
}
|
||||
if (StringUtils.isEmpty(estimateCopyRequest.getPlanNo())) {
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Plan No"));
|
||||
}
|
||||
// 응답 객체
|
||||
@ -632,8 +626,8 @@ public class EstimateService {
|
||||
|
||||
ObjectRequest objectRequest = new ObjectRequest();
|
||||
objectRequest.setSaleStoreId(estimateCopyRequest.getCopySaleStoreId());
|
||||
objectRequest.setReceiveUser(
|
||||
StringUtils.defaultString(estimateCopyRequest.getCopyReceiveUser()));
|
||||
objectRequest
|
||||
.setReceiveUser(StringUtils.defaultString(estimateCopyRequest.getCopyReceiveUser()));
|
||||
objectRequest.setDelFlg("0");
|
||||
objectRequest.setTempFlg("0");
|
||||
objectRequest.setTempDelFlg("0");
|
||||
@ -710,8 +704,7 @@ public class EstimateService {
|
||||
itemRequest.setPartAdd(
|
||||
!StringUtils.isEmpty(itemRequest.getPartAdd()) ? itemRequest.getPartAdd() : "0");
|
||||
itemRequest.setItemChangeFlg(
|
||||
!StringUtils.isEmpty(itemRequest.getItemChangeFlg())
|
||||
? itemRequest.getItemChangeFlg()
|
||||
!StringUtils.isEmpty(itemRequest.getItemChangeFlg()) ? itemRequest.getItemChangeFlg()
|
||||
: "0");
|
||||
itemRequest.setUserId(estimateCopyRequest.getUserId());
|
||||
|
||||
@ -800,14 +793,13 @@ public class EstimateService {
|
||||
* @param estimateRequest 견적서 엑셀 다운로드 요청 정보
|
||||
* @throws Exception
|
||||
*/
|
||||
public void excelDownload(
|
||||
HttpServletRequest request, HttpServletResponse response, EstimateRequest estimateRequest)
|
||||
throws Exception {
|
||||
public void excelDownload(HttpServletRequest request, HttpServletResponse response,
|
||||
EstimateRequest estimateRequest) throws Exception {
|
||||
|
||||
// file Name 명이 없는경우
|
||||
if (estimateRequest.getFileName() == null || "".equals(estimateRequest.getFileName())) {
|
||||
estimateRequest.setFileName(
|
||||
"Quation_Detail_" + new SimpleDateFormat("yyyyMMdd").format(new Date()));
|
||||
estimateRequest
|
||||
.setFileName("Quation_Detail_" + new SimpleDateFormat("yyyyMMdd").format(new Date()));
|
||||
}
|
||||
|
||||
EstimateResponse estimateResponse = new EstimateResponse();
|
||||
@ -883,8 +875,8 @@ public class EstimateService {
|
||||
List<ItemResponse> estimateItemList = estimateMapper.selectEstimateItemList(estimateRequest);
|
||||
|
||||
// 총 합산금액 계산
|
||||
this.selectTotalPriceInfo(
|
||||
estimateResponse, estimateItemList, estimateRequest.getSchUnitPriceFlg());
|
||||
this.selectTotalPriceInfo(estimateResponse, estimateItemList,
|
||||
estimateRequest.getSchUnitPriceFlg());
|
||||
|
||||
int j = 1;
|
||||
for (ItemResponse itemResponse : estimateItemList) {
|
||||
@ -893,8 +885,8 @@ public class EstimateService {
|
||||
// 문자열 통화로 변환 처리
|
||||
itemResponse.setSalePrice(
|
||||
String.format("%1$,.0f", Double.parseDouble(itemResponse.getSalePrice())));
|
||||
itemResponse.setAmount(
|
||||
String.format("%1$,.0f", Double.parseDouble(itemResponse.getAmount())));
|
||||
itemResponse
|
||||
.setAmount(String.format("%1$,.0f", Double.parseDouble(itemResponse.getAmount())));
|
||||
itemResponse.setSaleTotPrice(
|
||||
String.format("%1$,.0f", Double.parseDouble(itemResponse.getSaleTotPrice())));
|
||||
|
||||
@ -908,14 +900,14 @@ public class EstimateService {
|
||||
|
||||
// 합산 문자열 통화로 변환 처리
|
||||
estimateResponse.setPkgYn("YJSS".equals(estimateResponse.getEstimateType()) ? "Y" : "N");
|
||||
estimateResponse.setPkgNo(
|
||||
"YJSS".equals(estimateResponse.getEstimateType()) ? String.valueOf(j++) : "");
|
||||
estimateResponse
|
||||
.setPkgNo("YJSS".equals(estimateResponse.getEstimateType()) ? String.valueOf(j++) : "");
|
||||
if ("YJSS".equals(estimateResponse.getEstimateType())) {
|
||||
estimateResponse.setPkgAsp(
|
||||
String.format("%1$,.0f", Double.parseDouble(estimateResponse.getPkgAsp())));
|
||||
estimateResponse
|
||||
.setPkgAsp(String.format("%1$,.0f", Double.parseDouble(estimateResponse.getPkgAsp())));
|
||||
}
|
||||
estimateResponse.setTotVol(
|
||||
String.format("%1$,.0f", Double.parseDouble(estimateResponse.getTotVol())));
|
||||
estimateResponse
|
||||
.setTotVol(String.format("%1$,.0f", Double.parseDouble(estimateResponse.getTotVol())));
|
||||
estimateResponse.setPkgTotPrice(
|
||||
String.format("%1$,.0f", Double.parseDouble(estimateResponse.getPkgTotPrice())));
|
||||
estimateResponse.setSupplyPrice(
|
||||
@ -949,7 +941,7 @@ public class EstimateService {
|
||||
estimateResponse.setPwrGnrSim(pwrGnrSimResponse);
|
||||
|
||||
if ("PDF".equals(estimateRequest.getSchDownload())) { // PDF 다운로드
|
||||
String[] arrSection = new String[5];
|
||||
String[] arrSection = new String[6];
|
||||
int iSection = 0;
|
||||
|
||||
String templateFilePath = "pdf_download_quotation_detail_template.html";
|
||||
@ -997,12 +989,8 @@ public class EstimateService {
|
||||
String excelTemplateNam = "excel_download_quotation_detail_template.xlsx";
|
||||
|
||||
ExcelUtil excelUtil = new ExcelUtil();
|
||||
excelUtil.download(
|
||||
request,
|
||||
response,
|
||||
this.convertVoToMap(estimateResponse),
|
||||
this.convertListToMap(estimateItemList),
|
||||
estimateRequest.getFileName(),
|
||||
excelUtil.download(request, response, this.convertVoToMap(estimateResponse),
|
||||
this.convertListToMap(estimateItemList), estimateRequest.getFileName(),
|
||||
excelTemplateNam);
|
||||
}
|
||||
|
||||
@ -1019,9 +1007,8 @@ public class EstimateService {
|
||||
* @param unitPriceFlg 가격 표시 코드
|
||||
* @throws Exception
|
||||
*/
|
||||
public void selectTotalPriceInfo(
|
||||
EstimateResponse estimateResponse, List<ItemResponse> itemList, String unitPriceFlg)
|
||||
throws Exception {
|
||||
public void selectTotalPriceInfo(EstimateResponse estimateResponse, List<ItemResponse> itemList,
|
||||
String unitPriceFlg) throws Exception {
|
||||
BigDecimal totAmount = BigDecimal.ZERO;
|
||||
BigDecimal totVol = BigDecimal.ZERO;
|
||||
BigDecimal pkgTotPrice = BigDecimal.ZERO;
|
||||
@ -1032,33 +1019,24 @@ public class EstimateService {
|
||||
String estimateType = estimateResponse.getEstimateType();
|
||||
|
||||
// 주택패키지 단가
|
||||
BigDecimal pkgAsp =
|
||||
new BigDecimal(
|
||||
BigDecimal pkgAsp = new BigDecimal(
|
||||
StringUtils.isEmpty(estimateResponse.getPkgAsp()) ? "0" : estimateResponse.getPkgAsp());
|
||||
|
||||
for (ItemResponse itemResponse : itemList) {
|
||||
// 수량
|
||||
BigDecimal amount =
|
||||
new BigDecimal(
|
||||
BigDecimal amount = new BigDecimal(
|
||||
StringUtils.isEmpty(itemResponse.getAmount()) ? "0" : itemResponse.getAmount());
|
||||
// 판매가
|
||||
BigDecimal salePrice = BigDecimal.ZERO;
|
||||
if ("1".equals(unitPriceFlg)) {
|
||||
salePrice =
|
||||
new BigDecimal(
|
||||
StringUtils.isEmpty(itemResponse.getUnitPrice())
|
||||
? "0"
|
||||
: itemResponse.getUnitPrice());
|
||||
salePrice = new BigDecimal(
|
||||
StringUtils.isEmpty(itemResponse.getUnitPrice()) ? "0" : itemResponse.getUnitPrice());
|
||||
} else {
|
||||
salePrice =
|
||||
new BigDecimal(
|
||||
StringUtils.isEmpty(itemResponse.getSalePrice())
|
||||
? "0"
|
||||
: itemResponse.getSalePrice());
|
||||
salePrice = new BigDecimal(
|
||||
StringUtils.isEmpty(itemResponse.getSalePrice()) ? "0" : itemResponse.getSalePrice());
|
||||
}
|
||||
// 아이템용량
|
||||
BigDecimal pnowW =
|
||||
new BigDecimal(
|
||||
BigDecimal pnowW = new BigDecimal(
|
||||
StringUtils.isEmpty(itemResponse.getPnowW()) ? "0" : itemResponse.getPnowW());
|
||||
|
||||
// 아이템 단가 합산
|
||||
@ -1103,11 +1081,10 @@ public class EstimateService {
|
||||
estimateResponse.setPkgTotPrice(String.valueOf(pkgTotPrice));
|
||||
estimateResponse.setTotAmount(String.valueOf(totAmount.setScale(0, BigDecimal.ROUND_HALF_UP)));
|
||||
estimateResponse.setTotVol(String.valueOf(totVol));
|
||||
estimateResponse.setTotVolKw(
|
||||
String.valueOf(
|
||||
totVol.multiply(new BigDecimal("0.001")).setScale(3, BigDecimal.ROUND_FLOOR)));
|
||||
estimateResponse.setSupplyPrice(
|
||||
String.valueOf(supplyPrice.setScale(0, BigDecimal.ROUND_HALF_UP)));
|
||||
estimateResponse.setTotVolKw(String
|
||||
.valueOf(totVol.multiply(new BigDecimal("0.001")).setScale(3, BigDecimal.ROUND_FLOOR)));
|
||||
estimateResponse
|
||||
.setSupplyPrice(String.valueOf(supplyPrice.setScale(0, BigDecimal.ROUND_HALF_UP)));
|
||||
estimateResponse.setVatPrice(String.valueOf(vatPrice.setScale(0, BigDecimal.ROUND_HALF_UP)));
|
||||
estimateResponse.setTotPrice(String.valueOf(totPrice.setScale(0, BigDecimal.ROUND_HALF_UP)));
|
||||
}
|
||||
@ -1160,9 +1137,8 @@ public class EstimateService {
|
||||
|
||||
EstimateApiResponse response = null;
|
||||
/* [1]. QSP API CALL -> Response */
|
||||
String strResponse =
|
||||
interfaceQsp.callApi(
|
||||
HttpMethod.POST, QSP_API_URL + "/api/order/qcastQuotationSave", estimateSendRequest);
|
||||
String strResponse = interfaceQsp.callApi(HttpMethod.POST,
|
||||
QSP_API_URL + "/api/order/qcastQuotationSave", estimateSendRequest);
|
||||
|
||||
if (!"".equals(strResponse)) {
|
||||
com.fasterxml.jackson.databind.ObjectMapper om =
|
||||
@ -1256,28 +1232,18 @@ public class EstimateService {
|
||||
sb.append("<tr>");
|
||||
sb.append(
|
||||
"<td style='width:60px;'>" + StringUtils.defaultString(itemResponse.getNo()) + "</td>");
|
||||
sb.append(
|
||||
"<td style='width:120px;text-align:left;'>"
|
||||
+ StringUtils.defaultString(itemResponse.getItemName())
|
||||
+ "</td>");
|
||||
sb.append(
|
||||
"<td style='width:120px;'>"
|
||||
+ StringUtils.defaultString(itemResponse.getItemNo())
|
||||
+ "</td>");
|
||||
sb.append(
|
||||
"<td style='width:80px;text-align:right;'>"
|
||||
+ StringUtils.defaultString(itemResponse.getSalePrice())
|
||||
+ "</td>");
|
||||
sb.append(
|
||||
"<td style='width:60px;text-align:right;'>"
|
||||
+ StringUtils.defaultString(itemResponse.getAmount())
|
||||
sb.append("<td style='width:120px;text-align:left;'>"
|
||||
+ StringUtils.defaultString(itemResponse.getItemName()) + "</td>");
|
||||
sb.append("<td style='width:120px;'>" + StringUtils.defaultString(itemResponse.getItemNo())
|
||||
+ "</td>");
|
||||
sb.append("<td style='width:80px;text-align:right;'>"
|
||||
+ StringUtils.defaultString(itemResponse.getSalePrice()) + "</td>");
|
||||
sb.append("<td style='width:60px;text-align:right;'>"
|
||||
+ StringUtils.defaultString(itemResponse.getAmount()) + "</td>");
|
||||
sb.append(
|
||||
"<td style='width:60px;'>" + StringUtils.defaultString(itemResponse.getUnit()) + "</td>");
|
||||
sb.append(
|
||||
"<td style='width:80px;text-align:right;'>"
|
||||
+ StringUtils.defaultString(itemResponse.getSaleTotPrice())
|
||||
+ "</td>");
|
||||
sb.append("<td style='width:80px;text-align:right;'>"
|
||||
+ StringUtils.defaultString(itemResponse.getSaleTotPrice()) + "</td>");
|
||||
sb.append("</tr>");
|
||||
}
|
||||
if ("Y".equals(data.getPkgYn())) {
|
||||
@ -1285,19 +1251,13 @@ public class EstimateService {
|
||||
sb.append("<td style='width:60px;'>" + StringUtils.defaultString(data.getPkgNo()) + "</td>");
|
||||
sb.append("<td style='width:120px;text-align:left;'>住宅 PKG</td>");
|
||||
sb.append("<td style='width:120px;'>-</td>");
|
||||
sb.append(
|
||||
"<td style='width:80px;text-align:right;'>"
|
||||
+ StringUtils.defaultString(data.getPkgAsp())
|
||||
+ "</td>");
|
||||
sb.append(
|
||||
"<td style='width:60px;text-align:right;'>"
|
||||
+ StringUtils.defaultString(data.getTotVol())
|
||||
+ "</td>");
|
||||
sb.append("<td style='width:80px;text-align:right;'>"
|
||||
+ StringUtils.defaultString(data.getPkgAsp()) + "</td>");
|
||||
sb.append("<td style='width:60px;text-align:right;'>"
|
||||
+ StringUtils.defaultString(data.getTotVol()) + "</td>");
|
||||
sb.append("<td style='width:60px;'>W</td>");
|
||||
sb.append(
|
||||
"<td style='width:80px;text-align:right;'>"
|
||||
+ StringUtils.defaultString(data.getPkgTotPrice())
|
||||
+ "</td>");
|
||||
sb.append("<td style='width:80px;text-align:right;'>"
|
||||
+ StringUtils.defaultString(data.getPkgTotPrice()) + "</td>");
|
||||
sb.append("</tr>");
|
||||
}
|
||||
elm = doc.getElementById("itemList_detail");
|
||||
@ -1320,14 +1280,10 @@ public class EstimateService {
|
||||
sb = new StringBuilder();
|
||||
for (NoteResponse noteResponse : data.getNoteList()) {
|
||||
sb.append("<tr>");
|
||||
sb.append(
|
||||
"<td style='text-align:left;'>"
|
||||
+ StringUtils.defaultString(noteResponse.getCodeNm())
|
||||
+ "</td>");
|
||||
sb.append(
|
||||
"<td style='text-align:left;'>"
|
||||
+ StringUtils.defaultString(noteResponse.getRemarks())
|
||||
+ "</td>");
|
||||
sb.append("<td style='text-align:left;'>"
|
||||
+ StringUtils.defaultString(noteResponse.getCodeNm()) + "</td>");
|
||||
sb.append("<td style='text-align:left;'>"
|
||||
+ StringUtils.defaultString(noteResponse.getRemarks()) + "</td>");
|
||||
sb.append("</tr>");
|
||||
}
|
||||
elm = doc.getElementById("noteList_detail");
|
||||
@ -1336,11 +1292,8 @@ public class EstimateService {
|
||||
|
||||
// 도면 설정
|
||||
elm = doc.getElementById("objectNo4");
|
||||
elm.text(
|
||||
StringUtils.defaultString(data.getObjectNo())
|
||||
+ " (Plan No : "
|
||||
+ StringUtils.defaultString(data.getPlanNo())
|
||||
+ ")");
|
||||
elm.text(StringUtils.defaultString(data.getObjectNo()) + " (Plan No : "
|
||||
+ StringUtils.defaultString(data.getPlanNo()) + ")");
|
||||
|
||||
elm = doc.getElementById("objectName");
|
||||
elm.text(StringUtils.defaultString(data.getObjectName()));
|
||||
@ -1374,14 +1327,10 @@ public class EstimateService {
|
||||
if (!"STAND_".equals(itemResponse.getItemGroup())) {
|
||||
sb.append("<tr>");
|
||||
sb.append("<td>" + (no++) + "</td>");
|
||||
sb.append(
|
||||
"<td style='text-align:left;'>"
|
||||
+ StringUtils.defaultString(itemResponse.getItemNo())
|
||||
+ "</td>");
|
||||
sb.append(
|
||||
"<td style='text-align:right;'>"
|
||||
+ StringUtils.defaultString(itemResponse.getAmount())
|
||||
+ "</td>");
|
||||
sb.append("<td style='text-align:left;'>"
|
||||
+ StringUtils.defaultString(itemResponse.getItemNo()) + "</td>");
|
||||
sb.append("<td style='text-align:right;'>"
|
||||
+ StringUtils.defaultString(itemResponse.getAmount()) + "</td>");
|
||||
sb.append("</tr>");
|
||||
}
|
||||
}
|
||||
@ -1395,12 +1344,8 @@ public class EstimateService {
|
||||
sb.append("<tr>");
|
||||
sb.append("<td>" + (no++) + "</td>");
|
||||
sb.append(
|
||||
"<td style='text-align:left;'>"
|
||||
+ StringUtils.defaultString(roofResponse.getItemNo())
|
||||
+ "["
|
||||
+ roofResponse.getPcModuleAmount()
|
||||
+ "]"
|
||||
+ "</td>");
|
||||
"<td style='text-align:left;'>" + StringUtils.defaultString(roofResponse.getItemNo())
|
||||
+ "[" + roofResponse.getPcModuleAmount() + "]" + "</td>");
|
||||
sb.append("</tr>");
|
||||
}
|
||||
elm = doc.getElementById("pcsItemList_detail");
|
||||
@ -1414,10 +1359,8 @@ public class EstimateService {
|
||||
sb.append("<td>" + StringUtils.defaultString(roofResponse.getRoofSurface()) + "</td>");
|
||||
sb.append("<td>" + StringUtils.defaultString(roofResponse.getClassTypeName()) + "</td>");
|
||||
sb.append("<td>" + StringUtils.defaultString(roofResponse.getAmount()) + "</td>");
|
||||
sb.append(
|
||||
"<td style='text-align:right;'>"
|
||||
+ StringUtils.defaultString(roofResponse.getVolKw())
|
||||
+ "</td>");
|
||||
sb.append("<td style='text-align:right;'>"
|
||||
+ StringUtils.defaultString(roofResponse.getVolKw()) + "</td>");
|
||||
sb.append("</tr>");
|
||||
}
|
||||
elm = doc.getElementById("surFaceList_detail");
|
||||
@ -1435,19 +1378,13 @@ public class EstimateService {
|
||||
for (RoofResponse roofResponse : data.getRoofInfo().getRoofList()) {
|
||||
sb.append("<tr>");
|
||||
sb.append("<td>" + StringUtils.defaultString(roofResponse.getRoofSurface()) + "</td>");
|
||||
sb.append(
|
||||
"<td style='text-align:left;'>"
|
||||
+ StringUtils.defaultString(roofResponse.getRoofMaterialName())
|
||||
+ "</td>");
|
||||
sb.append("<td style='text-align:left;'>"
|
||||
+ StringUtils.defaultString(roofResponse.getRoofMaterialName()) + "</td>");
|
||||
sb.append("<td>" + StringUtils.defaultString(roofResponse.getSlope()) + "寸</td>");
|
||||
sb.append(
|
||||
"<td>"
|
||||
+ StringUtils.defaultString(roofResponse.getConstructSpecificationName())
|
||||
+ "</td>");
|
||||
sb.append(
|
||||
"<td style='text-align:left;'>"
|
||||
+ StringUtils.defaultString(roofResponse.getSupportMethodName())
|
||||
sb.append("<td>" + StringUtils.defaultString(roofResponse.getConstructSpecificationName())
|
||||
+ "</td>");
|
||||
sb.append("<td style='text-align:left;'>"
|
||||
+ StringUtils.defaultString(roofResponse.getSupportMethodName()) + "</td>");
|
||||
sb.append("<td>" + StringUtils.defaultString(roofResponse.getSurfaceType()) + "</td>");
|
||||
sb.append("<td>" + StringUtils.defaultString(roofResponse.getSetupHeight()) + "</td>");
|
||||
sb.append("</tr>");
|
||||
@ -1457,11 +1394,8 @@ public class EstimateService {
|
||||
}
|
||||
|
||||
elm = doc.getElementById("objectNo5");
|
||||
elm.text(
|
||||
StringUtils.defaultString(data.getObjectNo())
|
||||
+ " (Plan No : "
|
||||
+ StringUtils.defaultString(data.getPlanNo())
|
||||
+ ")");
|
||||
elm.text(StringUtils.defaultString(data.getObjectNo()) + " (Plan No : "
|
||||
+ StringUtils.defaultString(data.getPlanNo()) + ")");
|
||||
|
||||
elm = doc.getElementById("objectName5");
|
||||
elm.text(StringUtils.defaultString(data.getObjectName()));
|
||||
@ -1495,14 +1429,10 @@ public class EstimateService {
|
||||
if ("STAND_".equals(itemResponse.getItemGroup())) {
|
||||
sb.append("<tr>");
|
||||
sb.append("<td>" + (no++) + "</td>");
|
||||
sb.append(
|
||||
"<td style='text-align:left;'>"
|
||||
+ StringUtils.defaultString(itemResponse.getItemNo())
|
||||
+ "</td>");
|
||||
sb.append(
|
||||
"<td style='text-align:right;'>"
|
||||
+ StringUtils.defaultString(itemResponse.getAmount())
|
||||
+ "</td>");
|
||||
sb.append("<td style='text-align:left;'>"
|
||||
+ StringUtils.defaultString(itemResponse.getItemNo()) + "</td>");
|
||||
sb.append("<td style='text-align:right;'>"
|
||||
+ StringUtils.defaultString(itemResponse.getAmount()) + "</td>");
|
||||
sb.append("</tr>");
|
||||
}
|
||||
}
|
||||
@ -1514,19 +1444,13 @@ public class EstimateService {
|
||||
for (RoofResponse roofResponse : data.getRoofInfo().getRoofList()) {
|
||||
sb.append("<tr>");
|
||||
sb.append("<td>" + StringUtils.defaultString(roofResponse.getRoofSurface()) + "</td>");
|
||||
sb.append(
|
||||
"<td style='text-align:left;'>"
|
||||
+ StringUtils.defaultString(roofResponse.getRoofMaterialName())
|
||||
+ "</td>");
|
||||
sb.append("<td style='text-align:left;'>"
|
||||
+ StringUtils.defaultString(roofResponse.getRoofMaterialName()) + "</td>");
|
||||
sb.append("<td>" + StringUtils.defaultString(roofResponse.getSlope()) + "寸</td>");
|
||||
sb.append(
|
||||
"<td>"
|
||||
+ StringUtils.defaultString(roofResponse.getConstructSpecificationName())
|
||||
+ "</td>");
|
||||
sb.append(
|
||||
"<td style='text-align:left;'>"
|
||||
+ StringUtils.defaultString(roofResponse.getSupportMethodName())
|
||||
sb.append("<td>" + StringUtils.defaultString(roofResponse.getConstructSpecificationName())
|
||||
+ "</td>");
|
||||
sb.append("<td style='text-align:left;'>"
|
||||
+ StringUtils.defaultString(roofResponse.getSupportMethodName()) + "</td>");
|
||||
sb.append("<td>" + StringUtils.defaultString(roofResponse.getSurfaceType()) + "</td>");
|
||||
sb.append("<td>" + StringUtils.defaultString(roofResponse.getSetupHeight()) + "</td>");
|
||||
sb.append("</tr>");
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user