견적서 API 개발 (Price 관련 API 및 도면 저장 API)
This commit is contained in:
parent
d886e2a27a
commit
535e2c7217
@ -0,0 +1,52 @@
|
||||
package com.interplug.qcast.biz.estimate;
|
||||
|
||||
import com.interplug.qcast.biz.estimate.dto.EstimateRequest;
|
||||
import com.interplug.qcast.biz.estimate.dto.EstimateResponse;
|
||||
import com.interplug.qcast.biz.estimate.dto.PriceRequest;
|
||||
import com.interplug.qcast.biz.estimate.dto.PriceResponse;
|
||||
import com.interplug.qcast.biz.object.dto.*;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("/api/estimate")
|
||||
@RequiredArgsConstructor
|
||||
@Tag(name = "EstimateController", description = "견적서 관련 API")
|
||||
public class EstimateController {
|
||||
private final EstimateService estimateService;
|
||||
|
||||
@Operation(description = "1차점 가격 관리 목록을 조회한다.")
|
||||
@GetMapping("/price/store-price-list")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public PriceResponse selectStorePriceList(PriceRequest priceRequest) throws Exception {
|
||||
return estimateService.selectStorePriceList(priceRequest);
|
||||
}
|
||||
|
||||
@Operation(description = "아이템 가격 목록을 조회한다.")
|
||||
@PostMapping("/price/item-price-list")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public PriceResponse selectItemPriceList(@RequestBody PriceRequest priceRequest)
|
||||
throws Exception {
|
||||
return estimateService.selectItemPriceList(priceRequest);
|
||||
}
|
||||
|
||||
@Operation(description = "견적서 상세를 조회한다.")
|
||||
@GetMapping("/{objectNo}/{planNo}/detail")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public EstimateResponse selectObjectDetail(
|
||||
@PathVariable String objectNo, @PathVariable String planNo) throws Exception {
|
||||
return estimateService.selectEstimateDetail(objectNo, planNo);
|
||||
}
|
||||
|
||||
@Operation(description = "견적서를 저장한다.")
|
||||
@PostMapping("/save-estimate")
|
||||
@ResponseStatus(HttpStatus.CREATED)
|
||||
public void insertObject(@RequestBody EstimateRequest estimateRequest) throws Exception {
|
||||
estimateService.insertEstimate(estimateRequest);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package com.interplug.qcast.biz.estimate;
|
||||
|
||||
import com.interplug.qcast.biz.estimate.dto.EstimateRequest;
|
||||
import com.interplug.qcast.biz.estimate.dto.EstimateResponse;
|
||||
import com.interplug.qcast.biz.estimate.dto.ItemRequest;
|
||||
import com.interplug.qcast.biz.estimate.dto.ItemResponse;
|
||||
import com.interplug.qcast.biz.object.dto.*;
|
||||
import java.util.List;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
public interface EstimateMapper {
|
||||
// 견적서 상세 확인
|
||||
public EstimateResponse selectEstimateDetail(EstimateRequest estimateRequest);
|
||||
|
||||
// 견적서 아이템 목록 조회
|
||||
public List<ItemResponse> selectEstimateItemList(EstimateRequest estimateRequest);
|
||||
|
||||
// 아이템 마스터 목록 조회
|
||||
public List<ItemResponse> selectItemMasterList(EstimateRequest estimateRequest);
|
||||
|
||||
// 견적서 정보 수정
|
||||
public int updateEstimate(EstimateRequest estimateRequest);
|
||||
|
||||
// 견적서 아이템 등록
|
||||
public int insertEstimateItem(ItemRequest itemRequest);
|
||||
|
||||
// 견적서 아이템 목록 삭제(물리 삭제)
|
||||
public int deleteEstimateItemList(EstimateRequest estimateRequest);
|
||||
}
|
||||
@ -0,0 +1,421 @@
|
||||
package com.interplug.qcast.biz.estimate;
|
||||
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.interplug.qcast.biz.estimate.dto.*;
|
||||
import com.interplug.qcast.biz.file.FileMapper;
|
||||
import com.interplug.qcast.biz.file.dto.FileRequest;
|
||||
import com.interplug.qcast.biz.file.dto.FileResponse;
|
||||
import com.interplug.qcast.biz.object.ObjectMapper;
|
||||
import com.interplug.qcast.biz.object.dto.ObjectResponse;
|
||||
import com.interplug.qcast.config.Exception.ErrorCode;
|
||||
import com.interplug.qcast.config.Exception.QcastException;
|
||||
import com.interplug.qcast.config.message.Messages;
|
||||
import com.interplug.qcast.util.InterfaceQsp;
|
||||
import io.micrometer.common.util.StringUtils;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
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.web.util.UriComponentsBuilder;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@RequiredArgsConstructor
|
||||
public class EstimateService {
|
||||
private final InterfaceQsp interfaceQsp;
|
||||
|
||||
@Autowired Messages message;
|
||||
|
||||
@Value("${qsp.url}")
|
||||
private String QSP_API_URL;
|
||||
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
private final EstimateMapper estimateMapper;
|
||||
|
||||
private final FileMapper fileMapper;
|
||||
|
||||
public PriceResponse selectStorePriceList(PriceRequest priceRequest) throws Exception {
|
||||
// Validation
|
||||
if (StringUtils.isEmpty(priceRequest.getSaleStoreId())) {
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Sale Store ID"));
|
||||
}
|
||||
if (StringUtils.isEmpty(priceRequest.getDocTpCd())) {
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Estimate Type"));
|
||||
}
|
||||
|
||||
PriceResponse response = null;
|
||||
/* [1]. QSP API (url + param) Setting */
|
||||
String url = QSP_API_URL + "/api/price/storePriceList";
|
||||
String apiUrl =
|
||||
UriComponentsBuilder.fromHttpUrl(url)
|
||||
.queryParam("saleStoreId", priceRequest.getSaleStoreId())
|
||||
.queryParam("docTpCd", priceRequest.getDocTpCd())
|
||||
.build()
|
||||
.toUriString();
|
||||
|
||||
/* [2]. QSP API CALL -> Response */
|
||||
String strResponse = interfaceQsp.callApi(HttpMethod.GET, apiUrl, null);
|
||||
|
||||
if (!"".equals(strResponse)) {
|
||||
com.fasterxml.jackson.databind.ObjectMapper om =
|
||||
new com.fasterxml.jackson.databind.ObjectMapper()
|
||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
response = om.readValue(strResponse, PriceResponse.class);
|
||||
} else {
|
||||
// [msg] No data
|
||||
throw new QcastException(ErrorCode.NOT_FOUND, message.getMessage("common.message.no.data"));
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
public PriceResponse selectItemPriceList(PriceRequest priceRequest) throws Exception {
|
||||
// Validation
|
||||
if (StringUtils.isEmpty(priceRequest.getSaleStoreId())) {
|
||||
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,
|
||||
message.getMessage("common.message.required.data", "Sap Sale Store Code"));
|
||||
}
|
||||
if (StringUtils.isEmpty(priceRequest.getPriceCd())) {
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Price Code"));
|
||||
}
|
||||
|
||||
PriceResponse response = null;
|
||||
/* [1]. QSP API CALL -> Response */
|
||||
String strResponse =
|
||||
interfaceQsp.callApi(
|
||||
HttpMethod.POST, QSP_API_URL + "/api//price/storePriceItemList", priceRequest);
|
||||
|
||||
if (!"".equals(strResponse)) {
|
||||
com.fasterxml.jackson.databind.ObjectMapper om =
|
||||
new com.fasterxml.jackson.databind.ObjectMapper()
|
||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
response = om.readValue(strResponse, PriceResponse.class);
|
||||
} else {
|
||||
// [msg] No data
|
||||
throw new QcastException(ErrorCode.NOT_FOUND, message.getMessage("common.message.no.data"));
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
public EstimateResponse selectEstimateDetail(String objectNo, String planNo) throws Exception {
|
||||
// Validation
|
||||
if (StringUtils.isEmpty(objectNo)) {
|
||||
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,
|
||||
message.getMessage("common.message.required.data", "Plan No"));
|
||||
}
|
||||
|
||||
EstimateRequest estimateRequest = new EstimateRequest();
|
||||
estimateRequest.setObjectNo(objectNo);
|
||||
estimateRequest.setPlanNo(planNo);
|
||||
|
||||
// 견적서 상세 조회
|
||||
EstimateResponse response = estimateMapper.selectEstimateDetail(estimateRequest);
|
||||
|
||||
if (response == null) {
|
||||
throw new QcastException(ErrorCode.NOT_FOUND, message.getMessage("common.message.no.data"));
|
||||
} else {
|
||||
|
||||
// 아이템 목록 조회
|
||||
List<ItemResponse> itemList = estimateMapper.selectEstimateItemList(estimateRequest);
|
||||
response.setItemList(itemList);
|
||||
|
||||
// 총 합산금액 계산
|
||||
this.selectTotalPriceInfo(response);
|
||||
|
||||
// 첨부파일 목록 조회
|
||||
FileRequest fileDeleteReq = new FileRequest();
|
||||
fileDeleteReq.setObjectNo(objectNo);
|
||||
fileDeleteReq.setCategory("10");
|
||||
fileDeleteReq.setPlanNo(planNo);
|
||||
|
||||
List<FileResponse> fileList = fileMapper.selectFileList(fileDeleteReq);
|
||||
response.setFileList(fileList);
|
||||
}
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
public void insertEstimate(EstimateRequest estimateRequest) throws Exception {
|
||||
// Validation
|
||||
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.getSapSalesStoreCd())) {
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Sap Sale Store Code"));
|
||||
}
|
||||
|
||||
String splitStr = "、";
|
||||
List<ItemRequest> itemList = estimateRequest.getItemList();
|
||||
|
||||
// 도면 작성일 경우에만 지붕재 데이터를 셋팅
|
||||
if ("1".equals(estimateRequest.getDrawingFlg())) {
|
||||
// [1]. 견적서 기본셋팅
|
||||
estimateRequest.setEstimateType("YJOD");
|
||||
estimateRequest.setPriceCd("UNIT_PRICE");
|
||||
|
||||
// 물건정보 조회 후 데이터 축출
|
||||
ObjectResponse objectResponse =
|
||||
objectMapper.selectObjectDetail(estimateRequest.getObjectNo());
|
||||
if (objectResponse != null) {
|
||||
estimateRequest.setWeatherPoint(
|
||||
objectResponse.getPrefName() + " - " + objectResponse.getAreaName());
|
||||
estimateRequest.setCharger(objectResponse.getReceiveUser());
|
||||
}
|
||||
|
||||
// [2]. 지붕재 관련 데이터 셋팅
|
||||
List<RoofRequest> roofList = estimateRequest.getRoofList();
|
||||
|
||||
// 지붕재 아이템 ID
|
||||
String roofMaterialIds = "";
|
||||
// 지붕재 공법 ID
|
||||
String supportMethodIds = "";
|
||||
// 지붕재 시공사양 ID
|
||||
String constructSpecifications = "";
|
||||
// 지붕재 아이템명
|
||||
String roofMaterialIdMultis = "";
|
||||
// 지붕재 공법명
|
||||
String supportMethodIdMultis = "";
|
||||
// 가대 메이커명
|
||||
String supportMeakers = "";
|
||||
for (RoofRequest roofRequest : roofList) {
|
||||
if (!StringUtils.isEmpty(roofRequest.getRoofMaterialId())) {
|
||||
roofMaterialIds += !StringUtils.isEmpty(roofMaterialIds) ? splitStr : "";
|
||||
roofMaterialIds += roofRequest.getRoofMaterialId();
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(roofRequest.getSupportMethodId())) {
|
||||
supportMethodIds += !StringUtils.isEmpty(supportMethodIds) ? splitStr : "";
|
||||
supportMethodIds += roofRequest.getSupportMethodId();
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(roofRequest.getConstructSpecification())) {
|
||||
constructSpecifications += !StringUtils.isEmpty(constructSpecifications) ? splitStr : "";
|
||||
constructSpecifications += roofRequest.getConstructSpecification();
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(roofRequest.getRoofMaterialIdMulti())) {
|
||||
roofMaterialIdMultis += !StringUtils.isEmpty(roofMaterialIdMultis) ? splitStr : "";
|
||||
roofMaterialIdMultis += roofRequest.getRoofMaterialIdMulti();
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(roofRequest.getSupportMethodIdMulti())) {
|
||||
supportMethodIdMultis += !StringUtils.isEmpty(supportMethodIdMultis) ? splitStr : "";
|
||||
supportMethodIdMultis += roofRequest.getSupportMethodIdMulti();
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(roofRequest.getSupportMeaker())) {
|
||||
supportMeakers += !StringUtils.isEmpty(supportMeakers) ? splitStr : "";
|
||||
supportMeakers += roofRequest.getSupportMeaker();
|
||||
}
|
||||
}
|
||||
|
||||
// 지붕재 관련 데이터 셋팅
|
||||
estimateRequest.setRoofMaterialId(roofMaterialIds);
|
||||
estimateRequest.setSupportMethodId(supportMethodIds);
|
||||
estimateRequest.setConstructSpecification(constructSpecifications);
|
||||
estimateRequest.setRoofMaterialIdMulti(roofMaterialIdMultis);
|
||||
estimateRequest.setSupportMethodIdMulti(supportMethodIdMultis);
|
||||
estimateRequest.setSupportMeaker(supportMeakers);
|
||||
|
||||
// [3]. 아이템 관련 데이터 셋팅
|
||||
String[] arrItemId = new String[itemList.size()];
|
||||
int i = 0;
|
||||
for (ItemRequest itemRequest : itemList) {
|
||||
arrItemId[i++] = itemRequest.getItemId();
|
||||
}
|
||||
estimateRequest.setArrItemId(arrItemId);
|
||||
// 아이템의 마스터 정보 및 정가 정보 조회
|
||||
List<ItemResponse> itemResponseList = estimateMapper.selectItemMasterList(estimateRequest);
|
||||
|
||||
int j = 1;
|
||||
for (ItemRequest itemRequest : itemList) {
|
||||
itemRequest.setDispOrder(String.valueOf(j++));
|
||||
|
||||
for (ItemResponse itemResponse : itemResponseList) {
|
||||
if (itemRequest.getItemId().equals(itemResponse.getItemId())) {
|
||||
itemRequest.setItemNo(itemResponse.getItemNo());
|
||||
itemRequest.setItemName(itemResponse.getItemName());
|
||||
itemRequest.setUnit(itemResponse.getUnit());
|
||||
itemRequest.setPnowW(itemResponse.getPnowW());
|
||||
itemRequest.setSpecification(itemResponse.getPnowW());
|
||||
itemRequest.setSalePrice(itemResponse.getSalePrice());
|
||||
itemRequest.setPkgMaterialFlg(itemResponse.getPkgMaterialFlg());
|
||||
itemRequest.setItemGroup(itemResponse.getItemGroup());
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 아아템 목록 필수 값 체크
|
||||
BigDecimal capacity = BigDecimal.ZERO;
|
||||
String moduleModel = "";
|
||||
String pcTypeNo = "";
|
||||
for (ItemRequest itemRequest : itemList) {
|
||||
if (StringUtils.isEmpty(itemRequest.getItemId())) {
|
||||
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,
|
||||
message.getMessage("common.message.required.data", "Item Amount"));
|
||||
}
|
||||
|
||||
// 수량
|
||||
BigDecimal amount =
|
||||
new BigDecimal(
|
||||
StringUtils.isEmpty(itemRequest.getAmount()) ? "0" : itemRequest.getAmount());
|
||||
// 아이템용량
|
||||
BigDecimal pnowW =
|
||||
new BigDecimal(
|
||||
StringUtils.isEmpty(itemRequest.getPnowW()) ? "0" : itemRequest.getPnowW());
|
||||
|
||||
// 모듈/PC 체크
|
||||
if ("MODULE_".equals(itemRequest.getItemGroup())) {
|
||||
moduleModel += !StringUtils.isEmpty(moduleModel) ? splitStr : "";
|
||||
moduleModel += itemRequest.getItemNo();
|
||||
|
||||
capacity = capacity.add(amount.multiply(pnowW));
|
||||
} else if ("PC_".equals(itemRequest.getItemGroup())) {
|
||||
pcTypeNo += !StringUtils.isEmpty(pcTypeNo) ? splitStr : "";
|
||||
pcTypeNo += itemRequest.getItemNo();
|
||||
}
|
||||
}
|
||||
estimateRequest.setCapacity(String.valueOf(capacity));
|
||||
estimateRequest.setModuleModel(moduleModel);
|
||||
estimateRequest.setPcTypeNo(pcTypeNo);
|
||||
|
||||
// 견적서 정보 수정
|
||||
estimateMapper.updateEstimate(estimateRequest);
|
||||
|
||||
// 견적서 모든 아이템 제거
|
||||
estimateMapper.deleteEstimateItemList(estimateRequest);
|
||||
|
||||
// 견적서 아이템 신규 추가
|
||||
for (ItemRequest itemRequest : itemList) {
|
||||
itemRequest.setObjectNo(estimateRequest.getObjectNo());
|
||||
itemRequest.setPlanNo(estimateRequest.getPlanNo());
|
||||
itemRequest.setPartAdd(
|
||||
!StringUtils.isEmpty(itemRequest.getPartAdd()) ? itemRequest.getPartAdd() : "0");
|
||||
itemRequest.setItemChangeFlg(
|
||||
!StringUtils.isEmpty(itemRequest.getItemChangeFlg())
|
||||
? itemRequest.getItemChangeFlg()
|
||||
: "0");
|
||||
itemRequest.setUserId(estimateRequest.getUserId());
|
||||
|
||||
estimateMapper.insertEstimateItem(itemRequest);
|
||||
}
|
||||
}
|
||||
|
||||
public void selectTotalPriceInfo(EstimateResponse estimateResponse) throws Exception {
|
||||
BigDecimal totAmount = BigDecimal.ZERO;
|
||||
BigDecimal totVol = BigDecimal.ZERO;
|
||||
BigDecimal supplyPrice = BigDecimal.ZERO;
|
||||
BigDecimal vatPrice = BigDecimal.ZERO;
|
||||
BigDecimal totPrice = BigDecimal.ZERO;
|
||||
|
||||
String estimateType = estimateResponse.getEstimateType();
|
||||
List<ItemResponse> itemList = estimateResponse.getItemList();
|
||||
|
||||
// 주택패키지 단가
|
||||
BigDecimal pkgAsp =
|
||||
new BigDecimal(
|
||||
StringUtils.isEmpty(estimateResponse.getPkgAsp()) ? "0" : estimateResponse.getPkgAsp());
|
||||
|
||||
for (ItemResponse itemResponse : itemList) {
|
||||
// 수량
|
||||
BigDecimal amount =
|
||||
new BigDecimal(
|
||||
StringUtils.isEmpty(itemResponse.getAmount()) ? "0" : itemResponse.getAmount());
|
||||
// 판매가
|
||||
BigDecimal salePrice =
|
||||
new BigDecimal(
|
||||
StringUtils.isEmpty(itemResponse.getSalePrice()) ? "0" : itemResponse.getSalePrice());
|
||||
// 아이템용량
|
||||
BigDecimal pnowW =
|
||||
new BigDecimal(
|
||||
StringUtils.isEmpty(itemResponse.getPnowW()) ? "0" : itemResponse.getPnowW());
|
||||
|
||||
// 아이템 단가 합산
|
||||
itemResponse.setSaleTotPrice(String.valueOf(salePrice.multiply(amount)));
|
||||
|
||||
// YJSS인 경우 (PKG 단가 * 모듈용량) + 패키지 제외상품 총 합산
|
||||
// YJOD인 경우 모든 아이템의 총 합산
|
||||
if ("YJSS".equals(estimateType)) {
|
||||
if ("1".equals(itemResponse.getPkgMaterialFlg())) { // 패키지 제외상품 여부(1)
|
||||
supplyPrice = supplyPrice.add(salePrice.multiply(amount));
|
||||
} else {
|
||||
if ("1".equals(itemResponse.getModuleFlg())) {
|
||||
totVol = totVol.add(pnowW.multiply(amount));
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ("1".equals(itemResponse.getModuleFlg())) {
|
||||
totVol = totVol.add(pnowW.multiply(amount));
|
||||
}
|
||||
|
||||
supplyPrice = supplyPrice.add(salePrice.multiply(amount));
|
||||
}
|
||||
|
||||
// 주문수량 더하기
|
||||
totAmount = totAmount.add(amount);
|
||||
}
|
||||
|
||||
if ("YJSS".equals(estimateType)) {
|
||||
supplyPrice.add(pkgAsp.multiply(totVol));
|
||||
}
|
||||
|
||||
// 부가세 계산 (10프로)
|
||||
vatPrice = supplyPrice.multiply(new BigDecimal("0.01"));
|
||||
// 총 가격 합산 (공급가 + 부가세)
|
||||
totPrice = totPrice.add(supplyPrice.add(vatPrice));
|
||||
|
||||
estimateResponse.setTotAmount(String.valueOf(totAmount.setScale(0, BigDecimal.ROUND_HALF_UP)));
|
||||
estimateResponse.setTotVol(String.valueOf(totVol.setScale(0, BigDecimal.ROUND_HALF_UP)));
|
||||
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)));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,153 @@
|
||||
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 EstimateRequest {
|
||||
@Schema(description = "물건번호")
|
||||
private String objectNo;
|
||||
|
||||
@Schema(description = "플랜번호")
|
||||
private String planNo;
|
||||
|
||||
@Schema(description = "판매점ID")
|
||||
private String saleStoreId;
|
||||
|
||||
@Schema(description = "SAP 판매점코드")
|
||||
private String sapSalesStoreCd;
|
||||
|
||||
@Schema(description = "시공방법")
|
||||
private String constructSpecification;
|
||||
|
||||
@Schema(description = "설치높이")
|
||||
private String setupHeight;
|
||||
|
||||
@Schema(description = "날씨포인트")
|
||||
private String weatherPoint;
|
||||
|
||||
@Schema(description = "날씨포인트")
|
||||
private String roofKindId;
|
||||
|
||||
@Schema(description = "경사")
|
||||
private String slope;
|
||||
|
||||
@Schema(description = "지붕재 아이템 CLASS ID")
|
||||
private String roofMaterialClassId;
|
||||
|
||||
@Schema(description = "지붕재 아이템 ID")
|
||||
private String roofMaterialId;
|
||||
|
||||
@Schema(description = "가대 설치 ID")
|
||||
private String supportMethodId;
|
||||
|
||||
@Schema(description = "모델")
|
||||
private String moduleModel;
|
||||
|
||||
@Schema(description = "담당자")
|
||||
private String charger;
|
||||
|
||||
@Schema(description = "견적서 유효기간")
|
||||
private String estimateValidityTerm;
|
||||
|
||||
@Schema(description = "결정 플랜")
|
||||
private String decisionPlan;
|
||||
|
||||
@Schema(description = "넘버")
|
||||
private String number;
|
||||
|
||||
@Schema(description = "시스템용량")
|
||||
private String capacity;
|
||||
|
||||
@Schema(description = "강설량")
|
||||
private String snowfall;
|
||||
|
||||
@Schema(description = "표준풍속검사")
|
||||
private String standardWindSpeedCheck;
|
||||
|
||||
@Schema(description = "옵션커버")
|
||||
private String optionCover;
|
||||
|
||||
@Schema(description = "한화여부")
|
||||
private String hanwfaFlg;
|
||||
|
||||
@Schema(description = "기준종류ID")
|
||||
private String standKindId;
|
||||
|
||||
@Schema(description = "기준풍속ID")
|
||||
private String standardWindSpeedId;
|
||||
|
||||
@Schema(description = "가대 메이커")
|
||||
private String supportMeaker;
|
||||
|
||||
@Schema(description = "소비세ID")
|
||||
private String consumptionTaxId;
|
||||
|
||||
@Schema(description = "상태코드")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "사용자아이디")
|
||||
private String userId;
|
||||
|
||||
@Schema(description = "삭제여부")
|
||||
private String delFlg;
|
||||
|
||||
@Schema(description = "파워컨디셔너")
|
||||
private String pcTypeNo;
|
||||
|
||||
@Schema(description = "북면설치여부")
|
||||
private String northArrangement;
|
||||
|
||||
@Schema(description = "지붕재")
|
||||
private String roofMaterialIdMulti;
|
||||
|
||||
@Schema(description = "가대")
|
||||
private String supportMethodIdMulti;
|
||||
|
||||
@Schema(description = "가대 메이커")
|
||||
private String supportMeakerMulti;
|
||||
|
||||
@Schema(description = "다른 지붕재여부")
|
||||
private String diffRoofEnabled;
|
||||
|
||||
@Schema(description = "발주여부")
|
||||
private String orderFlg;
|
||||
|
||||
@Schema(description = "도면저장여부")
|
||||
private String drawingFlg;
|
||||
|
||||
@Schema(description = "견적일")
|
||||
private String estimateDate;
|
||||
|
||||
@Schema(description = "견적서번호")
|
||||
private String docNo;
|
||||
|
||||
@Schema(description = "견적서타입")
|
||||
private String estimateType;
|
||||
|
||||
@Schema(description = "후일자료제출")
|
||||
private String fileFlg;
|
||||
|
||||
@Schema(description = "견적서 특이사항")
|
||||
private String estimateOption;
|
||||
|
||||
@Schema(description = "PKG 단가")
|
||||
private String pkgAsp;
|
||||
|
||||
@Schema(description = "가격코드")
|
||||
private String priceCd;
|
||||
|
||||
@Schema(description = "비고")
|
||||
private String remarks;
|
||||
|
||||
@Schema(description = "아이템번호 목록")
|
||||
private String[] arrItemId;
|
||||
|
||||
// 데이터 목록 관련 정보
|
||||
@Schema(description = "지붕재 목록")
|
||||
List<RoofRequest> roofList;
|
||||
|
||||
@Schema(description = "아이템 목록")
|
||||
List<ItemRequest> itemList;
|
||||
}
|
||||
@ -0,0 +1,162 @@
|
||||
package com.interplug.qcast.biz.estimate.dto;
|
||||
|
||||
import com.interplug.qcast.biz.file.dto.FileResponse;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.util.List;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class EstimateResponse {
|
||||
@Schema(description = "물건번호")
|
||||
private String objectNo;
|
||||
|
||||
@Schema(description = "플랜번호")
|
||||
private String planNo;
|
||||
|
||||
@Schema(description = "시공방법")
|
||||
private String constructSpecification;
|
||||
|
||||
@Schema(description = "설치높이")
|
||||
private String setupHeight;
|
||||
|
||||
@Schema(description = "날씨포인트")
|
||||
private String weatherPoint;
|
||||
|
||||
@Schema(description = "날씨포인트")
|
||||
private String roofKindId;
|
||||
|
||||
@Schema(description = "경사")
|
||||
private String slope;
|
||||
|
||||
@Schema(description = "지붕재 아이템 CLASS ID")
|
||||
private String roofMaterialClassId;
|
||||
|
||||
@Schema(description = "지붕재 아이템 ID")
|
||||
private String roofMaterialId;
|
||||
|
||||
@Schema(description = "가대 설치 ID")
|
||||
private String supportMethodId;
|
||||
|
||||
@Schema(description = "모델")
|
||||
private String moduleModel;
|
||||
|
||||
@Schema(description = "담당자")
|
||||
private String charger;
|
||||
|
||||
@Schema(description = "견적서 유효기간")
|
||||
private String estimateValidityTerm;
|
||||
|
||||
@Schema(description = "결정 플랜")
|
||||
private String decisionPlan;
|
||||
|
||||
@Schema(description = "넘버")
|
||||
private String number;
|
||||
|
||||
@Schema(description = "시스템용량")
|
||||
private String capacity;
|
||||
|
||||
@Schema(description = "강설량")
|
||||
private String snowfall;
|
||||
|
||||
@Schema(description = "표준풍속검사")
|
||||
private String standardWindSpeedCheck;
|
||||
|
||||
@Schema(description = "옵션커버")
|
||||
private String optionCover;
|
||||
|
||||
@Schema(description = "한화여부")
|
||||
private String hanwfaFlg;
|
||||
|
||||
@Schema(description = "기준종류ID")
|
||||
private String standKindId;
|
||||
|
||||
@Schema(description = "기준풍속ID")
|
||||
private String standardWindSpeedId;
|
||||
|
||||
@Schema(description = "가대 메이커")
|
||||
private String supportMeaker;
|
||||
|
||||
@Schema(description = "소비세ID")
|
||||
private String consumptionTaxId;
|
||||
|
||||
@Schema(description = "상태코드")
|
||||
private String status;
|
||||
|
||||
@Schema(description = "사용자아이디")
|
||||
private String userId;
|
||||
|
||||
@Schema(description = "삭제여부")
|
||||
private String delFlg;
|
||||
|
||||
@Schema(description = "파워컨디셔너")
|
||||
private String pcTypeNo;
|
||||
|
||||
@Schema(description = "북면설치여부")
|
||||
private String northArrangement;
|
||||
|
||||
@Schema(description = "지붕재")
|
||||
private String roofMaterialIdMulti;
|
||||
|
||||
@Schema(description = "가대")
|
||||
private String supportMethodIdMulti;
|
||||
|
||||
@Schema(description = "가대 메이커")
|
||||
private String supportMeakerMulti;
|
||||
|
||||
@Schema(description = "다른 지붕재여부")
|
||||
private String diffRoofEnabled;
|
||||
|
||||
@Schema(description = "견적일")
|
||||
private String estimateDate;
|
||||
|
||||
@Schema(description = "발주여부")
|
||||
private String orderFlg;
|
||||
|
||||
@Schema(description = "견적서번호")
|
||||
private String docNo;
|
||||
|
||||
@Schema(description = "견적서타입")
|
||||
private String estimateType;
|
||||
|
||||
@Schema(description = "후일자료제출")
|
||||
private String fileFlg;
|
||||
|
||||
@Schema(description = "견적서 특이사항")
|
||||
private String estimateOption;
|
||||
|
||||
@Schema(description = "PKG 단가")
|
||||
private String pkgAsp;
|
||||
|
||||
@Schema(description = "가격코드")
|
||||
private String priceCd;
|
||||
|
||||
// 가격 관련 정보
|
||||
@Schema(description = "총 수량")
|
||||
private String totAmount;
|
||||
|
||||
@Schema(description = "총 용량")
|
||||
private String totVol;
|
||||
|
||||
@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 = "아이템 목록")
|
||||
List<ItemResponse> itemList;
|
||||
|
||||
@Schema(description = "첨부파일 목록")
|
||||
List<FileResponse> fileList;
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package com.interplug.qcast.biz.estimate.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
// @Data
|
||||
@Getter
|
||||
@Setter
|
||||
public class ItemRequest {
|
||||
@Schema(description = "물건번호")
|
||||
private String objectNo;
|
||||
|
||||
@Schema(description = "플랜번호")
|
||||
private String planNo;
|
||||
|
||||
@Schema(description = "아이템 ID")
|
||||
private String itemId;
|
||||
|
||||
@Schema(description = "정렬순서")
|
||||
private String dispOrder;
|
||||
|
||||
@Schema(description = "아이템 번호")
|
||||
private String itemNo;
|
||||
|
||||
@Schema(description = "아이템명")
|
||||
private String itemName;
|
||||
|
||||
@Schema(description = "단위")
|
||||
private String unit;
|
||||
|
||||
@Schema(description = "용량")
|
||||
private String specification;
|
||||
|
||||
@Schema(description = "수량")
|
||||
private String amount;
|
||||
|
||||
@Schema(description = "변경수량")
|
||||
private String amountChange;
|
||||
|
||||
@Schema(description = "추가구분코드")
|
||||
private String partAdd;
|
||||
|
||||
@Schema(description = "단가")
|
||||
private String salePrice;
|
||||
|
||||
@Schema(description = "PKG 제외상품 여부")
|
||||
private String pkgMaterialFlg;
|
||||
|
||||
@Schema(description = "아이템 변경 여부")
|
||||
private String itemChangeFlg;
|
||||
|
||||
@Schema(description = "W")
|
||||
private String pnowW;
|
||||
|
||||
@Schema(description = "아이템 그룹코드")
|
||||
private String itemGroup;
|
||||
|
||||
@Schema(description = "사용자아이디")
|
||||
private String userId;
|
||||
}
|
||||
@ -0,0 +1,58 @@
|
||||
package com.interplug.qcast.biz.estimate.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
// @Data
|
||||
@Getter
|
||||
@Setter
|
||||
public class ItemResponse {
|
||||
@Schema(description = "물건번호")
|
||||
private String objectNo;
|
||||
|
||||
@Schema(description = "플랜번호")
|
||||
private String planNo;
|
||||
|
||||
@Schema(description = "아이템 ID")
|
||||
private String itemId;
|
||||
|
||||
@Schema(description = "아이템 번호")
|
||||
private String itemNo;
|
||||
|
||||
@Schema(description = "아이템명")
|
||||
private String itemName;
|
||||
|
||||
@Schema(description = "단위")
|
||||
private String unit;
|
||||
|
||||
@Schema(description = "용량")
|
||||
private String specification;
|
||||
|
||||
@Schema(description = "수량")
|
||||
private String amount;
|
||||
|
||||
@Schema(description = "단가")
|
||||
private String salePrice;
|
||||
|
||||
@Schema(description = "합산")
|
||||
private String saleTotPrice;
|
||||
|
||||
@Schema(description = "PKG 제외상품 여부")
|
||||
private String pkgMaterialFlg;
|
||||
|
||||
@Schema(description = "아이템 변경 여부")
|
||||
private String itemChangeFlg;
|
||||
|
||||
@Schema(description = "W")
|
||||
private String pnowW;
|
||||
|
||||
@Schema(description = "아이템 그룹코드")
|
||||
private String itemGroup;
|
||||
|
||||
@Schema(description = "파일첨부 필수여부")
|
||||
private String fileUploadFlg;
|
||||
|
||||
@Schema(description = "모듈여부")
|
||||
private String moduleFlg;
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package com.interplug.qcast.biz.estimate.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
// @Data
|
||||
@Getter
|
||||
@Setter
|
||||
public class PriceItemRequest {
|
||||
@Schema(description = "Item ID")
|
||||
private String itemId;
|
||||
|
||||
@Schema(description = "BOM Item ID")
|
||||
private String bomItemId;
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.interplug.qcast.biz.estimate.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import java.util.List;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
// @Data
|
||||
@Getter
|
||||
@Setter
|
||||
public class PriceRequest {
|
||||
@Schema(description = "판매점ID")
|
||||
private String saleStoreId;
|
||||
|
||||
@Schema(description = "SAP 판매점코드")
|
||||
private String sapSalesStoreCd;
|
||||
|
||||
@Schema(description = "견적구분")
|
||||
private String docTpCd;
|
||||
|
||||
@Schema(description = "가격조회코드")
|
||||
private String priceCd;
|
||||
|
||||
@Schema(description = "아이템번호 목록")
|
||||
private List<PriceItemRequest> itemIdList;
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.interplug.qcast.biz.estimate.dto;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class PriceResponse {
|
||||
/** API response result */
|
||||
private Object result;
|
||||
|
||||
/** API response data */
|
||||
private Object data;
|
||||
|
||||
/** API response data */
|
||||
private Object data2;
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.interplug.qcast.biz.estimate.dto;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
// @Data
|
||||
@Getter
|
||||
@Setter
|
||||
public class RoofRequest {
|
||||
@Schema(description = "지붕재 아이템 ID")
|
||||
private String roofMaterialId;
|
||||
|
||||
@Schema(description = "공법 ID")
|
||||
private String supportMethodId;
|
||||
|
||||
@Schema(description = "시공사양 ID")
|
||||
private String constructSpecification;
|
||||
|
||||
@Schema(description = "지붕재 아이템명")
|
||||
private String roofMaterialIdMulti;
|
||||
|
||||
@Schema(description = "공법명")
|
||||
private String supportMethodIdMulti;
|
||||
|
||||
@Schema(description = "가대메이커명")
|
||||
private String supportMeaker;
|
||||
}
|
||||
@ -5,7 +5,7 @@ import java.util.List;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
@Mapper
|
||||
interface ObjectMapper {
|
||||
public interface ObjectMapper {
|
||||
// 도도부현 목록 조회
|
||||
public List<PrefResponse> selectPrefList();
|
||||
|
||||
|
||||
@ -51,8 +51,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
public class ObjectService {
|
||||
private final InterfaceQsp interfaceQsp;
|
||||
|
||||
@Autowired
|
||||
Messages message;
|
||||
@Autowired Messages message;
|
||||
|
||||
@Value("${file.ini.root.path}")
|
||||
private String baseDirPath;
|
||||
@ -124,7 +123,6 @@ public class ObjectService {
|
||||
}
|
||||
|
||||
return storeList;
|
||||
|
||||
}
|
||||
|
||||
public SaleStoreResponse selectSaleStoreInfo(String saleStoreId) throws Exception {
|
||||
@ -157,11 +155,13 @@ public class ObjectService {
|
||||
|
||||
// Validation
|
||||
if (StringUtils.isEmpty(objectRequest.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(objectRequest.getSaleStoreLevel())) {
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Sale Store Level"));
|
||||
}
|
||||
|
||||
@ -190,8 +190,11 @@ public class ObjectService {
|
||||
objectRequest.setObjectNo(objectNo);
|
||||
|
||||
// 물건정보 등록
|
||||
objectRequest.setAddress(objectRequest.getPrefName()
|
||||
+ ((!StringUtils.isEmpty(objectRequest.getAddress())) ? objectRequest.getAddress() : ""));
|
||||
objectRequest.setAddress(
|
||||
objectRequest.getPrefName()
|
||||
+ ((!StringUtils.isEmpty(objectRequest.getAddress()))
|
||||
? objectRequest.getAddress()
|
||||
: ""));
|
||||
objectRequest.setAddresseeCompanyName(
|
||||
objectRequest.getObjectName() + ' ' + objectRequest.getObjectNameOmit());
|
||||
objectRequest.setAddresseeCompanyNameOmit(objectRequest.getObjectNameOmit());
|
||||
@ -223,8 +226,9 @@ public class ObjectService {
|
||||
planReqRequest.setPlanReqNo(objectRequest.getPlanReqNo());
|
||||
planReqRequest.setObjectNo(objectRequest.getObjectNo());
|
||||
|
||||
String strResponse = interfaceQsp.callApi(HttpMethod.POST,
|
||||
QSP_API_URL + "/api/planReq/updateObjectNo", planReqRequest);
|
||||
String strResponse =
|
||||
interfaceQsp.callApi(
|
||||
HttpMethod.POST, QSP_API_URL + "/api/planReq/updateObjectNo", planReqRequest);
|
||||
if (!"".equals(strResponse)) {
|
||||
com.fasterxml.jackson.databind.ObjectMapper om =
|
||||
new com.fasterxml.jackson.databind.ObjectMapper()
|
||||
@ -233,8 +237,8 @@ public class ObjectService {
|
||||
|
||||
Map<String, Object> map = (Map<String, Object>) response.getResult();
|
||||
if ("E".equals(String.valueOf(map.get("resultCode")))) {
|
||||
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR,
|
||||
String.valueOf(map.get("resultMsg")));
|
||||
throw new QcastException(
|
||||
ErrorCode.INTERNAL_SERVER_ERROR, String.valueOf(map.get("resultMsg")));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -253,11 +257,13 @@ public class ObjectService {
|
||||
|
||||
// Validation
|
||||
if (StringUtils.isEmpty(objectRequest.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(objectRequest.getSaleStoreLevel())) {
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Sale Store Level"));
|
||||
}
|
||||
|
||||
@ -274,13 +280,18 @@ public class ObjectService {
|
||||
}
|
||||
|
||||
// 물건정보 수정
|
||||
objectRequest.setAddress(objectRequest.getPrefName()
|
||||
+ ((!StringUtils.isEmpty(objectRequest.getAddress())) ? objectRequest.getAddress() : ""));
|
||||
objectRequest.setAddress(
|
||||
objectRequest.getPrefName()
|
||||
+ ((!StringUtils.isEmpty(objectRequest.getAddress()))
|
||||
? objectRequest.getAddress()
|
||||
: ""));
|
||||
objectRequest.setAddresseeCompanyName(
|
||||
objectRequest.getObjectName() + ' ' + objectRequest.getObjectNameOmit());
|
||||
objectRequest.setAddresseeCompanyNameOmit(objectRequest.getObjectNameOmit());
|
||||
objectRequest.setContentsPath(baseDirPath + "\\\\"
|
||||
+ (tempChgFlg ? objectRequest.getNewObjectNo() : objectRequest.getObjectNo()));
|
||||
objectRequest.setContentsPath(
|
||||
baseDirPath
|
||||
+ "\\\\"
|
||||
+ (tempChgFlg ? objectRequest.getNewObjectNo() : objectRequest.getObjectNo()));
|
||||
result += objectMapper.updateObject(objectRequest);
|
||||
|
||||
// 임시저장에서 저장상태로 돌리기
|
||||
@ -298,8 +309,9 @@ public class ObjectService {
|
||||
planReqRequest.setPlanReqNo(objectRequest.getPlanReqNo());
|
||||
planReqRequest.setObjectNo(objectRequest.getNewObjectNo());
|
||||
|
||||
String strResponse = interfaceQsp.callApi(HttpMethod.POST,
|
||||
QSP_API_URL + "/api/planReq/updateObjectNo", planReqRequest);
|
||||
String strResponse =
|
||||
interfaceQsp.callApi(
|
||||
HttpMethod.POST, QSP_API_URL + "/api/planReq/updateObjectNo", planReqRequest);
|
||||
if (!"".equals(strResponse)) {
|
||||
com.fasterxml.jackson.databind.ObjectMapper om =
|
||||
new com.fasterxml.jackson.databind.ObjectMapper()
|
||||
@ -308,8 +320,8 @@ public class ObjectService {
|
||||
|
||||
Map<String, Object> map = (Map<String, Object>) response.getResult();
|
||||
if ("E".equals(String.valueOf(map.get("resultCode")))) {
|
||||
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR,
|
||||
String.valueOf(map.get("resultMsg")));
|
||||
throw new QcastException(
|
||||
ErrorCode.INTERNAL_SERVER_ERROR, String.valueOf(map.get("resultMsg")));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -317,8 +329,9 @@ public class ObjectService {
|
||||
}
|
||||
|
||||
// 모든 변경 완료 후 재호출
|
||||
objectResponse = objectMapper.selectObjectDetail(
|
||||
(tempChgFlg ? objectRequest.getNewObjectNo() : objectRequest.getObjectNo()));
|
||||
objectResponse =
|
||||
objectMapper.selectObjectDetail(
|
||||
(tempChgFlg ? objectRequest.getNewObjectNo() : objectRequest.getObjectNo()));
|
||||
return objectResponse;
|
||||
}
|
||||
|
||||
@ -327,7 +340,8 @@ public class ObjectService {
|
||||
|
||||
// Validation
|
||||
if (StringUtils.isEmpty(objectRequest.getObjectNo())) {
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Object No"));
|
||||
}
|
||||
|
||||
@ -340,7 +354,8 @@ public class ObjectService {
|
||||
public String insertPlan(PlanRequest planRequest) throws Exception {
|
||||
// Validation
|
||||
if (StringUtils.isEmpty(planRequest.getObjectNo())) {
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Object No"));
|
||||
}
|
||||
|
||||
@ -366,44 +381,68 @@ public class ObjectService {
|
||||
|
||||
// Validation
|
||||
if (StringUtils.isEmpty(planReqRequest.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(planReqRequest.getSaleStoreLevel())) {
|
||||
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||
throw new QcastException(
|
||||
ErrorCode.INVALID_INPUT_VALUE,
|
||||
message.getMessage("common.message.required.data", "Sale Store Level"));
|
||||
}
|
||||
|
||||
PlanReqResponse response = null;
|
||||
|
||||
/* [1]. QSP API (url + param) Setting */
|
||||
String encodedSchTitle = URLEncoder.encode(
|
||||
StringUtils.isEmpty(planReqRequest.getSchTitle()) ? "" : planReqRequest.getSchTitle(),
|
||||
StandardCharsets.UTF_8);
|
||||
String encodedSchAddress = URLEncoder.encode(
|
||||
StringUtils.isEmpty(planReqRequest.getSchAddress()) ? "" : planReqRequest.getSchAddress(),
|
||||
StandardCharsets.UTF_8);
|
||||
String encodedSchPlanReqNo =
|
||||
URLEncoder.encode(
|
||||
StringUtils.isEmpty(planReqRequest.getSchPlanReqNo())
|
||||
? ""
|
||||
: planReqRequest.getSchPlanReqNo(),
|
||||
StandardCharsets.UTF_8);
|
||||
String encodedSchTitle =
|
||||
URLEncoder.encode(
|
||||
StringUtils.isEmpty(planReqRequest.getSchTitle()) ? "" : planReqRequest.getSchTitle(),
|
||||
StandardCharsets.UTF_8);
|
||||
String encodedSchAddress =
|
||||
URLEncoder.encode(
|
||||
StringUtils.isEmpty(planReqRequest.getSchAddress())
|
||||
? ""
|
||||
: planReqRequest.getSchAddress(),
|
||||
StandardCharsets.UTF_8);
|
||||
|
||||
String encodedSchSaleStoreName =
|
||||
URLEncoder.encode(StringUtils.isEmpty(planReqRequest.getSchSaleStoreName()) ? ""
|
||||
: planReqRequest.getSchSaleStoreName(), StandardCharsets.UTF_8);
|
||||
URLEncoder.encode(
|
||||
StringUtils.isEmpty(planReqRequest.getSchSaleStoreName())
|
||||
? ""
|
||||
: planReqRequest.getSchSaleStoreName(),
|
||||
StandardCharsets.UTF_8);
|
||||
String encodedSchPlanReqName =
|
||||
URLEncoder.encode(StringUtils.isEmpty(planReqRequest.getSchPlanReqName()) ? ""
|
||||
: planReqRequest.getSchPlanReqName(), StandardCharsets.UTF_8);
|
||||
URLEncoder.encode(
|
||||
StringUtils.isEmpty(planReqRequest.getSchPlanReqName())
|
||||
? ""
|
||||
: planReqRequest.getSchPlanReqName(),
|
||||
StandardCharsets.UTF_8);
|
||||
|
||||
String url = QSP_API_URL + "/api/planReq/list";
|
||||
String apiUrl = UriComponentsBuilder.fromHttpUrl(url)
|
||||
.queryParam("saleStoreId", planReqRequest.getSaleStoreId())
|
||||
.queryParam("saleStoreLevel", planReqRequest.getSaleStoreLevel())
|
||||
.queryParam("schPlanReqNo", planReqRequest.getSchPlanReqNo())
|
||||
.queryParam("schTitle", encodedSchTitle).queryParam("schAddress", encodedSchAddress)
|
||||
.queryParam("schSaleStoreName", encodedSchSaleStoreName)
|
||||
.queryParam("schPlanReqName", encodedSchPlanReqName)
|
||||
.queryParam("schPlanStatCd", planReqRequest.getSchPlanStatCd())
|
||||
.queryParam("schDateGbn", planReqRequest.getSchDateGbn())
|
||||
.queryParam("schStartDt", planReqRequest.getSchStartDt())
|
||||
.queryParam("schEndDt", planReqRequest.getSchEndDt())
|
||||
.queryParam("startRow", planReqRequest.getStartRow())
|
||||
.queryParam("endRow", planReqRequest.getEndRow()).build().toUriString();
|
||||
|
||||
String apiUrl =
|
||||
UriComponentsBuilder.fromHttpUrl(url)
|
||||
.queryParam("saleStoreId", planReqRequest.getSaleStoreId())
|
||||
.queryParam("saleStoreLevel", planReqRequest.getSaleStoreLevel())
|
||||
.queryParam("schPlanReqNo", encodedSchPlanReqNo)
|
||||
.queryParam("schTitle", encodedSchTitle)
|
||||
.queryParam("schAddress", encodedSchAddress)
|
||||
.queryParam("schSaleStoreName", encodedSchSaleStoreName)
|
||||
.queryParam("schPlanReqName", encodedSchPlanReqName)
|
||||
.queryParam("schPlanStatCd", planReqRequest.getSchPlanStatCd())
|
||||
.queryParam("schDateGbn", planReqRequest.getSchDateGbn())
|
||||
.queryParam("schStartDt", planReqRequest.getSchStartDt())
|
||||
.queryParam("schEndDt", planReqRequest.getSchEndDt())
|
||||
.queryParam("startRow", planReqRequest.getStartRow())
|
||||
.queryParam("endRow", planReqRequest.getEndRow())
|
||||
.build()
|
||||
.toUriString();
|
||||
|
||||
/* [2]. QSP API CALL -> Response */
|
||||
String strResponse = interfaceQsp.callApi(HttpMethod.GET, apiUrl, null);
|
||||
@ -422,8 +461,9 @@ public class ObjectService {
|
||||
return response;
|
||||
}
|
||||
|
||||
public void fileDownload(HttpServletRequest request, HttpServletResponse response,
|
||||
UploadRequest uploadRequest) throws Exception {
|
||||
public void fileDownload(
|
||||
HttpServletRequest request, HttpServletResponse response, UploadRequest uploadRequest)
|
||||
throws Exception {
|
||||
|
||||
InputStream inputStream = null;
|
||||
|
||||
@ -433,8 +473,12 @@ public class ObjectService {
|
||||
|
||||
if (uploadResponse != null) {
|
||||
// 첨부파일 물리적 경로
|
||||
String filePath = baseDirPath + File.separator + uploadResponse.getObjectNo()
|
||||
+ File.separator + uploadResponse.getFaileName();
|
||||
String filePath =
|
||||
baseDirPath
|
||||
+ File.separator
|
||||
+ uploadResponse.getObjectNo()
|
||||
+ File.separator
|
||||
+ uploadResponse.getFaileName();
|
||||
File file = new File(filePath);
|
||||
|
||||
if (file.exists()) {
|
||||
|
||||
@ -43,6 +43,9 @@ public class ObjectResponse {
|
||||
@Schema(description = "도도부현코드")
|
||||
private String prefId;
|
||||
|
||||
@Schema(description = "도도부현명")
|
||||
private String prefName;
|
||||
|
||||
@Schema(description = "주소")
|
||||
private String address;
|
||||
|
||||
|
||||
@ -93,9 +93,9 @@
|
||||
, MI.MODULE_FLG
|
||||
, MI.PKG_MATERIAL_FLG
|
||||
, MI.FILE_UPLOAD_FLG
|
||||
, MPPM.SALE_PRICE
|
||||
, ISNULL(MPPM.SALE_PRICE, '0') AS SALE_PRICE
|
||||
FROM M_ITEM MI
|
||||
INNER JOIN M_PRICE_PATTERN_MONEY MPPM
|
||||
LEFT OUTER JOIN M_PRICE_PATTERN_MONEY MPPM
|
||||
ON MPPM.PRICE_PATTERN = '510'
|
||||
AND MI.ITEM_ID = MPPM.ITEM_ID
|
||||
WHERE MI.DEL_FLG = 0
|
||||
|
||||
203
src/main/resources/mappers/estimate/estimateMapper.xml
Normal file
203
src/main/resources/mappers/estimate/estimateMapper.xml
Normal file
@ -0,0 +1,203 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
|
||||
<mapper namespace="com.interplug.qcast.biz.estimate.EstimateMapper">
|
||||
|
||||
<select id="selectEstimateDetail" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.EstimateResponse">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateDetail */
|
||||
SELECT
|
||||
T.OBJECT_NO
|
||||
, T.PLAN_NO
|
||||
, T.CONSTRUCT_SPECIFICATION
|
||||
, T.SETUP_HEIGHT
|
||||
, T.WEATHER_POINT
|
||||
, T.ROOF_KIND_ID
|
||||
, T.SLOPE
|
||||
, T.ROOF_MATERIAL_CLASS_ID
|
||||
, T.ROOF_MATERIAL_ID
|
||||
, T.SUPPORT_METHOD_ID
|
||||
, T.MODULE_MODEL
|
||||
, T.CHARGER
|
||||
, T.ESTIMATE_VALIDITY_TERM
|
||||
, T.DECISION_PLAN
|
||||
, T.NUMBER
|
||||
, T.CAPACITY
|
||||
, T.SNOWFALL
|
||||
, T.STANDARD_WIND_SPEED_CHECK
|
||||
, T.OPTION_COVER
|
||||
, T.HANWFA_FLG
|
||||
, T.STAND_KIND_ID
|
||||
, T.STANDARD_WIND_SPEED_ID
|
||||
, T.SUPPORT_MEAKER
|
||||
, T.CONSUMPTION_TAX_ID
|
||||
, T.STATUS
|
||||
, T.PC_TYPE_NO
|
||||
, T.NORTH_ARRANGEMENT
|
||||
, T.ROOF_MATERIAL_ID_MULTI
|
||||
, T.SUPPORT_METHOD_ID_MULTI
|
||||
, T.SUPPORT_MEAKER_MULTI
|
||||
, T.DIFF_ROOF_ENABLED
|
||||
, T.ORDER_FLG
|
||||
, T.ESTIMATE_DATE
|
||||
, T.DOC_NO
|
||||
, T.ESTIMATE_TYPE
|
||||
, T.FILE_FLG
|
||||
, T.ESTIMATE_OPTION
|
||||
, T.PKG_ASP
|
||||
, O.OBJECT_NAME
|
||||
, O.OBJECT_NAME_OMIT
|
||||
FROM T_PLAN T 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'
|
||||
</select>
|
||||
|
||||
<select id="selectEstimateItemList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.ItemResponse">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateItemList */
|
||||
SELECT
|
||||
PE.OBJECT_NO
|
||||
, PE.PLAN_NO
|
||||
, PE.ITEM_ID
|
||||
, PE.ITEM_NO
|
||||
, PE.ITEM_NAME
|
||||
, PE.UNIT
|
||||
, PE.SPECIFICATION
|
||||
, PE.AMOUNT
|
||||
, PE.SALE_PRICE
|
||||
, PE.PKG_MATERIAL_FLG
|
||||
, PE.ITEM_CHANGE_FLG
|
||||
, I.PNOW_W
|
||||
, I.FILE_UPLOAD_FLG
|
||||
, CASE WHEN I.ITEM_GROUP = 'MODULE_' THEN '1' ELSE '0' END AS MODULE_FLG
|
||||
FROM T_PART_ESTIMATE PE WITH (NOLOCK)
|
||||
INNER JOIN M_ITEM I WITH (NOLOCK)
|
||||
ON PE.ITEM_ID = I.ITEM_ID
|
||||
WHERE PE.OBJECT_NO = #{objectNo}
|
||||
AND PE.PLAN_NO = #{planNo}
|
||||
ORDER BY
|
||||
PE.DISP_ORDER ASC
|
||||
</select>
|
||||
|
||||
<select id="selectItemMasterList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.ItemResponse">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.selectItemMasterList */
|
||||
SELECT
|
||||
I.ITEM_ID
|
||||
, I.ITEM_NO
|
||||
, I.ITEM_NAME
|
||||
, I.UNIT
|
||||
, I.PNOW_W
|
||||
, I.ITEM_GROUP
|
||||
, I.PKG_MATERIAL_FLG
|
||||
, ISNULL(PPM.SALE_PRICE, '0') AS SALE_PRICE
|
||||
FROM M_ITEM I WITH (NOLOCK)
|
||||
LEFT OUTER JOIN M_PRICE_PATTERN_MONEY PPM
|
||||
ON PPM.PRICE_PATTERN = '510'
|
||||
AND I.ITEM_ID = PPM.ITEM_ID
|
||||
WHERE I.ITEM_ID IN
|
||||
<foreach collection="arrItemId" item="itemId" index="index" separator="," open="(" close=")">
|
||||
#{itemId}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<update id="updateEstimate" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.updateEstimate */
|
||||
UPDATE T_PLAN
|
||||
SET
|
||||
ESTIMATE_TYPE = #{estimateType}
|
||||
<choose>
|
||||
<when test='drawingFlg != null and drawingFlg == "1"'>
|
||||
, CONSTRUCT_SPECIFICATION = #{constructSpecification}
|
||||
, SETUP_HEIGHT = #{setupHeight}
|
||||
, WEATHER_POINT = #{weatherPoint}
|
||||
, SLOPE = #{slope}
|
||||
, ROOF_MATERIAL_ID = #{roofMaterialId}
|
||||
, SUPPORT_METHOD_ID = #{supportMethodId}
|
||||
, DRAWING_ESTIMATE_CREATE_DATE = GETDATE()
|
||||
, CHARGER = #{charger}
|
||||
, ESTIMATE_VALIDITY_TERM = '発行日より1ヶ月'
|
||||
, SNOWFALL = #{snowfall}
|
||||
, STANDARD_WIND_SPEED_ID = #{standardWindSpeedId}
|
||||
, SUPPORT_MEAKER = #{supportMeaker}
|
||||
, NORTH_ARRANGEMENT = #{northArrangement}
|
||||
, ROOF_MATERIAL_ID_MULTI = #{roofMaterialIdMulti}
|
||||
, SUPPORT_METHOD_ID_MULTI = #{supportMethodIdMulti}
|
||||
, SUPPORT_MEAKER_MULTI = #{supportMeaker}
|
||||
, ESTIMATE_DATE = CONVERT(NVARCHAR(10), GETDATE(), 121)
|
||||
, FILE_FLG = '0'
|
||||
, ESTIMATE_OPTION = NULL
|
||||
, PKG_ASP = NULL
|
||||
, PRICE_CD = #{priceCd}
|
||||
</when>
|
||||
<otherwise>
|
||||
, CHARGER = #{charger}
|
||||
, ESTIMATE_DATE = #{estimateDate}
|
||||
, FILE_FLG = #{fileFlg}
|
||||
, ESTIMATE_OPTION = #{estimateOption}
|
||||
, REMARKS = #{remarks}
|
||||
, PKG_ASP = #{pkgAsp}
|
||||
, PRICE_CD = #{priceCd}
|
||||
</otherwise>
|
||||
</choose>
|
||||
, CAPACITY = #{capacity}
|
||||
, MODULE_MODEL = #{moduleModel}
|
||||
, PC_TYPE_NO = #{pcTypeNo}
|
||||
, LAST_EDIT_DATETIME = GETDATE()
|
||||
, LAST_EDIT_USER = #{userId}
|
||||
WHERE OBJECT_NO = #{objectNo}
|
||||
AND PLAN_NO = #{planNo}
|
||||
</update>
|
||||
|
||||
<insert id="insertEstimateItem" parameterType="com.interplug.qcast.biz.estimate.dto.ItemRequest">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.insertEstimateItem*/
|
||||
INSERT INTO T_PART_ESTIMATE
|
||||
(
|
||||
OBJECT_NO
|
||||
, PLAN_NO
|
||||
, DISP_ORDER
|
||||
, ITEM_ID
|
||||
, ITEM_NO
|
||||
, ITEM_NAME
|
||||
, UNIT
|
||||
, SPECIFICATION
|
||||
, AMOUNT
|
||||
<if test='amountChange != null and amountChange != ""'>
|
||||
, AMOUNT_CHANGE
|
||||
</if>
|
||||
, PART_ADD
|
||||
, LAST_EDIT_DATETIME
|
||||
, LAST_EDIT_USER
|
||||
, SALE_PRICE
|
||||
, PKG_MATERIAL_FLG
|
||||
, ITEM_CHANGE_FLG
|
||||
) VALUES (
|
||||
#{objectNo}
|
||||
, #{planNo}
|
||||
, #{dispOrder}
|
||||
, #{itemId}
|
||||
, #{itemNo}
|
||||
, #{itemName}
|
||||
, #{unit}
|
||||
, #{specification}
|
||||
, #{amount}
|
||||
<if test='amountChange != null and amountChange != ""'>
|
||||
, #{amountChange}
|
||||
</if>
|
||||
, #{partAdd}
|
||||
, GETDATE()
|
||||
, #{userId}
|
||||
, #{salePrice}
|
||||
, #{pkgMaterialFlg}
|
||||
, #{itemChangeFlg}
|
||||
)
|
||||
</insert>
|
||||
|
||||
<delete id="deleteEstimateItemList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.deleteEstimateItemList */
|
||||
DELETE FROM T_PART_ESTIMATE
|
||||
WHERE OBJECT_NO = #{objectNo}
|
||||
AND PLAN_NO = #{planNo}
|
||||
</delete>
|
||||
|
||||
</mapper>
|
||||
@ -261,9 +261,15 @@
|
||||
, (SELECT NAME FROM M_USER WHERE USER_ID = O.LAST_EDIT_USER) AS LAST_EDIT_USER_NAME
|
||||
, S.FIRST_AGENT_ID
|
||||
, S.SALE_STORE_LEVEL
|
||||
, ISNULL(P.PREF_NAME, '') AS PREF_NAME
|
||||
, ISNULL(PA.AREA_NAME, '') AS AREA_NAME
|
||||
FROM T_OBJECT O WITH (NOLOCK)
|
||||
INNER JOIN M_SALES_STORE S WITH(NOLOCK)
|
||||
ON O.SALE_STORE_ID = S.SALE_STORE_ID
|
||||
LEFT OUTER JOIN M_PREFECTURE P
|
||||
ON O.PREF_ID = P.PREF_ID
|
||||
LEFT OUTER JOIN M_PREFECTURE_AREA PA
|
||||
ON O.AREA_ID = PA.AREA_ID
|
||||
WHERE O.OBJECT_NO = #{objectNo}
|
||||
AND (O.DEL_FLG = '0' OR (O.TEMP_FLG = '1' AND O.TEMP_DEL_FLG = '0'))
|
||||
</select>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user