Merge branch 'dev' into feature/qcast-231
# Conflicts: # src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java
This commit is contained in:
commit
4fb0ed4e47
@ -26,7 +26,7 @@ import com.interplug.qcast.biz.commCode.dto.HeadCodeRequest;
|
||||
import com.interplug.qcast.util.InterfaceQsp;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
|
||||
/** 영업사원 동기화 배치 */
|
||||
/** 공통코드 동기화 배치 */
|
||||
@Configuration
|
||||
@Slf4j
|
||||
public class CommonCodeConfiguration implements JobExecutionListener {
|
||||
|
||||
@ -21,7 +21,19 @@ public interface EstimateMapper {
|
||||
// 아이템 마스터 목록 조회
|
||||
public List<ItemResponse> selectItemMasterList(EstimateRequest estimateRequest);
|
||||
|
||||
// 아이템 마스터 목록 조회
|
||||
// 견적서 지붕재 인증용량 조회
|
||||
public String selectEstimateRoofCertVolKw(EstimateRequest estimateRequest);
|
||||
|
||||
// 견적서 지붕재 목록 조회
|
||||
public List<RoofResponse> selectEstimateRoofList(EstimateRequest estimateRequest);
|
||||
|
||||
// 견적서 지붕재 PC 목록 조회
|
||||
public List<RoofResponse> selectEstimateRoofPcList(EstimateRequest estimateRequest);
|
||||
|
||||
// 견적서 지붕재 용량 목록 조회
|
||||
public List<RoofResponse> selectEstimateRoofVolList(EstimateRequest estimateRequest);
|
||||
|
||||
// 견적서 특이사항 목록 조회
|
||||
public List<NoteResponse> selectEstimateNoteList(NoteRequest noteRequest);
|
||||
|
||||
// 아이템 마스터 목록 조회
|
||||
|
||||
@ -28,6 +28,7 @@ import java.beans.PropertyDescriptor;
|
||||
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;
|
||||
@ -117,8 +118,8 @@ public class EstimateService {
|
||||
/**
|
||||
* QSP 아이템 가격 목록 조회
|
||||
*
|
||||
* @param priceRequest
|
||||
* @return PriceResponse
|
||||
* @param priceRequest QSP 관련 아이템 목록 정보
|
||||
* @return PriceResponse QSP 아이템 가격 목록
|
||||
* @throws Exception
|
||||
*/
|
||||
public EstimateApiResponse selectItemPriceList(PriceRequest priceRequest) throws Exception {
|
||||
@ -158,10 +159,25 @@ public class EstimateService {
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 견적 특이사항 목록 조회
|
||||
*
|
||||
* @param noteRequest 견적 특이사항 조회 정보
|
||||
* @return List<NoteResponse> 견적 특이사항 목록
|
||||
* @throws Exception
|
||||
*/
|
||||
public List<NoteResponse> selectSpecialNoteList(NoteRequest noteRequest) throws Exception {
|
||||
return estimateMapper.selectEstimateNoteList(noteRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* 견적서 상세 조회
|
||||
*
|
||||
* @param objectNo 물건번호
|
||||
* @param planNo 플랜번호
|
||||
* @return EstimateResponse 견적서 상세 정보
|
||||
* @throws Exception
|
||||
*/
|
||||
public EstimateResponse selectEstimateDetail(String objectNo, String planNo) throws Exception {
|
||||
// Validation
|
||||
if (StringUtils.isEmpty(objectNo)) {
|
||||
@ -206,6 +222,12 @@ public class EstimateService {
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 견적서 저장
|
||||
*
|
||||
* @param estimateRequest 견적서 저장 정보
|
||||
* @throws Exception
|
||||
*/
|
||||
public void insertEstimate(EstimateRequest estimateRequest) throws Exception {
|
||||
// Validation
|
||||
if (StringUtils.isEmpty(estimateRequest.getObjectNo())) {
|
||||
@ -524,6 +546,13 @@ public class EstimateService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 견적서 복사
|
||||
*
|
||||
* @param estimateRequest 견적서 복사 정보
|
||||
* @return EstimateResponse 견적서 복사 후 상세 정보
|
||||
* @throws Exception
|
||||
*/
|
||||
public EstimateResponse insertEstimateCopy(EstimateRequest estimateRequest) throws Exception {
|
||||
// Validation
|
||||
if (StringUtils.isEmpty(estimateRequest.getObjectNo())) {
|
||||
@ -615,6 +644,14 @@ public class EstimateService {
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 견적서 엑셀 다운로드
|
||||
*
|
||||
* @param request HttpServletRequest
|
||||
* @param response HttpServletResponse
|
||||
* @param estimateRequest 견적서 엑셀 다운로드 요청 정보
|
||||
* @throws Exception
|
||||
*/
|
||||
public void excelDownload(
|
||||
HttpServletRequest request, HttpServletResponse response, EstimateRequest estimateRequest)
|
||||
throws Exception {
|
||||
@ -650,6 +687,36 @@ public class EstimateService {
|
||||
estimateResponse.setNoteList(noteList);
|
||||
}
|
||||
|
||||
// 지붕재 목록 조회
|
||||
RoofInfoResponse roofInfoResponse = new RoofInfoResponse();
|
||||
List<RoofResponse> roofList = estimateMapper.selectEstimateRoofList(estimateRequest);
|
||||
List<RoofResponse> roofPcList = estimateMapper.selectEstimateRoofPcList(estimateRequest);
|
||||
estimateRequest.setSchItemGroup("MODULE_");
|
||||
List<RoofResponse> roofVolList = estimateMapper.selectEstimateRoofVolList(estimateRequest);
|
||||
|
||||
BigDecimal moduleTotAmount = BigDecimal.ZERO;
|
||||
BigDecimal moduleTotVolKw = BigDecimal.ZERO;
|
||||
for (RoofResponse roofVol : roofVolList) {
|
||||
BigDecimal amount =
|
||||
new BigDecimal(StringUtils.isEmpty(roofVol.getAmount()) ? "0" : roofVol.getAmount());
|
||||
BigDecimal vol =
|
||||
new BigDecimal(StringUtils.isEmpty(roofVol.getVolKw()) ? "0" : roofVol.getVolKw());
|
||||
|
||||
moduleTotAmount = moduleTotAmount.add(amount);
|
||||
moduleTotVolKw = moduleTotVolKw.add(vol);
|
||||
}
|
||||
roofInfoResponse.setModuleTotAmount(String.valueOf(moduleTotAmount));
|
||||
roofInfoResponse.setModuleTotVolKw(String.valueOf(moduleTotVolKw));
|
||||
|
||||
roofInfoResponse.setRoofList(roofList);
|
||||
roofInfoResponse.setRoofPcList(roofPcList);
|
||||
roofInfoResponse.setRoofVolList(roofVolList);
|
||||
|
||||
// 인증용량 구하기 (지붕면마다 모듈과 PCS의 총 용량을 서로 비교해 낮은쪽 용량으로 합산)
|
||||
roofInfoResponse.setCertVolKw(estimateMapper.selectEstimateRoofCertVolKw(estimateRequest));
|
||||
|
||||
estimateResponse.setRoofInfo(roofInfoResponse);
|
||||
|
||||
// 아이템 목록 조회
|
||||
List<ItemResponse> estimateItemList = estimateMapper.selectEstimateItemList(estimateRequest);
|
||||
|
||||
@ -703,7 +770,6 @@ public class EstimateService {
|
||||
PwrGnrSimResponse pwrGnrSimResponse =
|
||||
pwrGnrSimService.selectPwrGnrSimulation(pwrGnrSimRequest);
|
||||
if (pwrGnrSimResponse != null) {
|
||||
|
||||
try {
|
||||
// 발전시뮬레이션 안내사항 조회
|
||||
PwrGnrSimGuideResponse pwrGnrSimGuideInfo =
|
||||
@ -722,20 +788,14 @@ public class EstimateService {
|
||||
int iSection = 0;
|
||||
|
||||
// PDF 다운로드
|
||||
String pdfFileName =
|
||||
"Quation_Detail_" + new SimpleDateFormat("yyyyMMdd").format(new Date());
|
||||
String templateFilePath = "pdf_download_quotation_detail_template.html";
|
||||
String pdfFileName = "Quation_Detail";
|
||||
|
||||
// 템플릿 html 조회
|
||||
Document doc = PdfUtil.getPdfDoc(request, templateFilePath);
|
||||
Element elm;
|
||||
|
||||
arrSection[iSection] = "div.section1";
|
||||
iSection++;
|
||||
|
||||
elm = doc.getElementsByClass("section2").first();
|
||||
elm.remove();
|
||||
// 1은 나누고 2는 지우고 3은 그리고
|
||||
|
||||
// 발전시뮬레이션 pdf Html 생성
|
||||
if (true) {
|
||||
arrSection[iSection] = "div.section3";
|
||||
@ -746,14 +806,13 @@ public class EstimateService {
|
||||
elm.remove();
|
||||
}
|
||||
|
||||
System.err.println(doc.toString());
|
||||
|
||||
// pdf 다운로드
|
||||
PdfUtil.pdfDownload(request, response, doc, pdfFileName, arrSection);
|
||||
|
||||
} else {
|
||||
|
||||
String excelFileName = "Quation_Detail";
|
||||
String excelFileName =
|
||||
"Quation_Detail_" + new SimpleDateFormat("yyyyMMdd").format(new Date());
|
||||
String excelTemplateNam = "excel_download_quotation_detail_template.xlsx";
|
||||
|
||||
excelUtil.download(
|
||||
@ -948,6 +1007,12 @@ public class EstimateService {
|
||||
return quoteList;
|
||||
}
|
||||
|
||||
/**
|
||||
* Object => Map 변환 함수
|
||||
*
|
||||
* @param vo Object
|
||||
* @return Map<String, Object> Map 변환 정보
|
||||
*/
|
||||
public Map<String, Object> convertVoToMap(Object vo) {
|
||||
Map<String, Object> result = new HashMap<String, Object>();
|
||||
|
||||
@ -965,6 +1030,12 @@ public class EstimateService {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* List<Object> => List<Map> 변환 함수
|
||||
*
|
||||
* @param target List<Object>
|
||||
* @return List<Map<String, Object>> List<Map> 변환 정보
|
||||
*/
|
||||
public static <T> List<Map<String, Object>> convertListToMap(Collection<T> target) {
|
||||
List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
|
||||
|
||||
|
||||
@ -163,18 +163,21 @@ public class EstimateRequest {
|
||||
private String[] arrItemId;
|
||||
|
||||
// 다운로드 관련 조건
|
||||
@Schema(description = "다운로드 정가 표시여부")
|
||||
@Schema(description = "검색 - 다운로드 정가 표시여부")
|
||||
private String schUnitPriceFlg;
|
||||
|
||||
@Schema(description = "다운로드 표시여부")
|
||||
@Schema(description = "검색 - 다운로드 표시여부")
|
||||
private String schDisplayFlg;
|
||||
|
||||
@Schema(description = "가대중량표 포함 여부")
|
||||
@Schema(description = "검색 - 가대중량표 포함 여부")
|
||||
private String schWeightFlg;
|
||||
|
||||
@Schema(description = "도면 포함 여부")
|
||||
@Schema(description = "검색 - 도면 포함 여부")
|
||||
private String schDrawingFlg;
|
||||
|
||||
@Schema(description = "검색 - 아이템 그룹")
|
||||
private String schItemGroup;
|
||||
|
||||
// 데이터 목록 관련 정보
|
||||
@Schema(description = "지붕재 목록")
|
||||
List<RoofRequest> roofList;
|
||||
|
||||
@ -80,6 +80,9 @@ public class EstimateResponse {
|
||||
@Schema(description = "기준풍속ID")
|
||||
private String standardWindSpeedId;
|
||||
|
||||
@Schema(description = "기준풍속명")
|
||||
private String standardWindSpeedName;
|
||||
|
||||
@Schema(description = "가대 메이커명")
|
||||
private String supportMeaker;
|
||||
|
||||
@ -175,6 +178,12 @@ public class EstimateResponse {
|
||||
@Schema(description = "경칭")
|
||||
private String objectNameOmit;
|
||||
|
||||
@Schema(description = "도도부현명")
|
||||
private String prefName;
|
||||
|
||||
@Schema(description = "지역명")
|
||||
private String areaName;
|
||||
|
||||
@Schema(description = "물건정보 비고")
|
||||
private String objectRemarks;
|
||||
|
||||
@ -235,6 +244,9 @@ public class EstimateResponse {
|
||||
@Schema(description = "첨부파일 목록")
|
||||
List<FileResponse> fileList;
|
||||
|
||||
@Schema(description = "지붕재 정보")
|
||||
RoofInfoResponse roofInfo;
|
||||
|
||||
@Schema(description = "발전시뮬레이션 정보")
|
||||
PwrGnrSimResponse pwrGnrSim;
|
||||
}
|
||||
|
||||
@ -19,6 +19,9 @@ public class EstimateSendResponse {
|
||||
@Schema(description = "물건명")
|
||||
private String objectName;
|
||||
|
||||
@Schema(description = "경칭코드")
|
||||
private String objectNameOmitCd;
|
||||
|
||||
@Schema(description = "견적서 등록일")
|
||||
private String estimateDetailCreateDate;
|
||||
|
||||
|
||||
@ -62,6 +62,9 @@ public class ItemRequest {
|
||||
@Schema(description = "아이템 변경 여부")
|
||||
private String itemChangeFlg;
|
||||
|
||||
@Schema(description = "PC 아이템 ID")
|
||||
private String pcItemId;
|
||||
|
||||
@Schema(description = "W")
|
||||
private String pnowW;
|
||||
|
||||
|
||||
@ -0,0 +1,29 @@
|
||||
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 RoofInfoResponse {
|
||||
@Schema(description = "인증용량")
|
||||
private String certVolKw;
|
||||
|
||||
@Schema(description = "모듈 총 수")
|
||||
private String moduleTotAmount;
|
||||
|
||||
@Schema(description = "모듈 총 용량")
|
||||
private String moduleTotVolKw;
|
||||
|
||||
@Schema(description = "지붕면 목록")
|
||||
private List<RoofResponse> roofList;
|
||||
|
||||
@Schema(description = "지붕면 파워컨디셔너 목록")
|
||||
private List<RoofResponse> roofPcList;
|
||||
|
||||
@Schema(description = "지붕면 용량 목록")
|
||||
private List<RoofResponse> roofVolList;
|
||||
}
|
||||
@ -0,0 +1,82 @@
|
||||
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 RoofResponse {
|
||||
@Schema(description = "물건번호")
|
||||
private String objectNo;
|
||||
|
||||
@Schema(description = "플랜번호")
|
||||
private String planNo;
|
||||
|
||||
@Schema(description = "지붕재 번호")
|
||||
private String roofNo;
|
||||
|
||||
@Schema(description = "지붕면")
|
||||
private String roofSurface;
|
||||
|
||||
@Schema(description = "지붕재 아이템 ID")
|
||||
private String roofMaterialId;
|
||||
|
||||
@Schema(description = "지붕재 아이템명")
|
||||
private String roofMaterialName;
|
||||
|
||||
@Schema(description = "공법 ID")
|
||||
private String supportMethodId;
|
||||
|
||||
@Schema(description = "공법명")
|
||||
private String supportMethodName;
|
||||
|
||||
@Schema(description = "시공사양 ID")
|
||||
private String constructSpecification;
|
||||
|
||||
@Schema(description = "시공사양명")
|
||||
private String constructSpecificationName;
|
||||
|
||||
@Schema(description = "지붕재 아이템명")
|
||||
private String roofMaterialIdMulti;
|
||||
|
||||
@Schema(description = "공법명")
|
||||
private String supportMethodIdMulti;
|
||||
|
||||
@Schema(description = "시공방법명")
|
||||
private String constructSpecificationMulti;
|
||||
|
||||
@Schema(description = "가대메이커명")
|
||||
private String supportMeaker;
|
||||
|
||||
@Schema(description = "경사")
|
||||
private String slope;
|
||||
|
||||
@Schema(description = "각도")
|
||||
private String angle;
|
||||
|
||||
@Schema(description = "방위각")
|
||||
private String azimuth;
|
||||
|
||||
@Schema(description = "면조도구분")
|
||||
private String surfaceType;
|
||||
|
||||
@Schema(description = "설치높이")
|
||||
private String setupHeight;
|
||||
|
||||
@Schema(description = "아이템 ID")
|
||||
private String itemId;
|
||||
|
||||
@Schema(description = "아이템 번호")
|
||||
private String itemNo;
|
||||
|
||||
@Schema(description = "매수")
|
||||
private String amount;
|
||||
|
||||
@Schema(description = "용량")
|
||||
private String volKw;
|
||||
|
||||
@Schema(description = "Pc 모듈 매수")
|
||||
private String pcModuleAmount;
|
||||
}
|
||||
@ -337,8 +337,41 @@ public class ObjectService {
|
||||
message.getMessage("common.message.required.data", "Object No"));
|
||||
}
|
||||
|
||||
// 물건정보 삭제
|
||||
result = objectMapper.deleteObject(objectRequest);
|
||||
// object 상세 정보 조회
|
||||
ObjectResponse objectResponse = objectMapper.selectObjectDetail(objectRequest.getObjectNo());
|
||||
if (objectResponse != null) {
|
||||
// 설계의뢰 번호가 존재하고 물건정보에 견적서가 없을 경우 QSP 설계의뢰 물건번호 초기화
|
||||
if (!StringUtils.isEmpty(objectResponse.getPlanReqNo())
|
||||
&& objectResponse.getEstimateTotCnt() == 0) {
|
||||
PlanReqResponse response = null;
|
||||
|
||||
PlanReqRequest planReqRequest = new PlanReqRequest();
|
||||
planReqRequest.setSaleStoreId(objectResponse.getSaleStoreId());
|
||||
planReqRequest.setSaleStoreLevel(objectResponse.getSaleStoreLevel());
|
||||
planReqRequest.setObjectNo(objectResponse.getObjectNo());
|
||||
planReqRequest.setPlanReqNo(objectResponse.getPlanReqNo());
|
||||
planReqRequest.setDelFlg("1");
|
||||
|
||||
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()
|
||||
.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
|
||||
response = om.readValue(strResponse, PlanReqResponse.class);
|
||||
|
||||
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")));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 물건정보 삭제
|
||||
result = objectMapper.deleteObject(objectRequest);
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
@ -125,6 +125,9 @@ public class ObjectResponse {
|
||||
@Schema(description = "플랜 전체 건수")
|
||||
private String planTotCnt;
|
||||
|
||||
@Schema(description = "견적서 전체 건수")
|
||||
private Integer estimateTotCnt;
|
||||
|
||||
// 플랜목록
|
||||
@Schema(description = "플랜목록")
|
||||
private List<PlanResponse> planList;
|
||||
|
||||
@ -17,6 +17,9 @@ public class PlanReqRequest {
|
||||
@Schema(description = "물건번호")
|
||||
private String objectNo;
|
||||
|
||||
@Schema(description = "삭제여부")
|
||||
private String delFlg;
|
||||
|
||||
@Schema(description = "검색 - 설계의뢰번호")
|
||||
private String schPlanReqNo;
|
||||
|
||||
|
||||
@ -84,7 +84,9 @@
|
||||
SELECT
|
||||
P.OBJECT_NO
|
||||
, P.PLAN_NO
|
||||
, CONVERT(VARCHAR(10), P.DRAWING_ESTIMATE_CREATE_DATE, 121) AS DRAWING_ESTIMATE_CREATE_DATE
|
||||
, P.ESTIMATE_VALIDITY_TERM
|
||||
, P.SNOWFALL
|
||||
, P.ESTIMATE_TYPE
|
||||
, P.ESTIMATE_OPTION
|
||||
, P.PKG_ASP
|
||||
@ -94,9 +96,20 @@
|
||||
, 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
|
||||
, ISNULL(MP.PREF_NAME, '') AS PREF_NAME
|
||||
, ISNULL(MPA.AREA_NAME, '') AS AREA_NAME
|
||||
, ISNULL(C1.CODE_NM, '') AS STANDARD_WIND_SPEED_NAME
|
||||
FROM T_PLAN P WITH (NOLOCK)
|
||||
INNER JOIN T_OBJECT O WITH (NOLOCK)
|
||||
ON P.OBJECT_NO = O.OBJECT_NO
|
||||
LEFT OUTER JOIN M_PREFECTURE MP WITH (NOLOCK)
|
||||
ON O.PREF_ID = MP.PREF_ID
|
||||
LEFT OUTER JOIN M_PREFECTURE_AREA MPA WITH (NOLOCK)
|
||||
ON O.PREF_ID = MPA.PREF_ID
|
||||
AND O.AREA_ID = MPA.AREA_ID
|
||||
LEFT OUTER JOIN M_COMM_L C1 WITH (NOLOCK)
|
||||
ON C1.HEAD_CD = '202000'
|
||||
AND P.STANDARD_WIND_SPEED_ID = C1.CODE
|
||||
WHERE P.OBJECT_NO = #{objectNo}
|
||||
AND P.PLAN_NO = #{planNo}
|
||||
) T
|
||||
@ -107,11 +120,12 @@
|
||||
</select>
|
||||
|
||||
<select id="selectEstimateApiDetail" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.EstimateSendResponse">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateDetail */
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateApiDetail */
|
||||
SELECT
|
||||
O.OBJECT_NO
|
||||
, O.SALE_STORE_ID
|
||||
, O.OBJECT_NAME
|
||||
, O.OBJECT_NAME_OMIT
|
||||
, O.RECEIVE_COMPANY_NAME
|
||||
, O.RECEIVE_USER
|
||||
, O.DELIVERY_ZIP_NO
|
||||
@ -139,6 +153,7 @@
|
||||
, CONVERT(NVARCHAR(10), P.CREATE_DATETIME, 121) AS ESTIMATE_DETAIL_CREATE_DATE
|
||||
, P.LAST_EDIT_DATETIME
|
||||
, P.LAST_EDIT_USER
|
||||
, (SELECT CODE FROM M_COMM_L WHERE HEAD_CD = '200800' AND CODE_NM = O.OBJECT_NAME_OMIT) AS OBJECT_NAME_OMIT_CD
|
||||
FROM T_PLAN P WITH (NOLOCK)
|
||||
INNER JOIN T_OBJECT O WITH (NOLOCK)
|
||||
ON P.OBJECT_NO = O.OBJECT_NO
|
||||
@ -167,6 +182,7 @@
|
||||
, PE.SPECIAL_NOTE_CD
|
||||
, PE.ITEM_CHANGE_FLG
|
||||
, I.PNOW_W
|
||||
, I.ITEM_GROUP
|
||||
, 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)
|
||||
@ -199,6 +215,161 @@
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<select id="selectEstimateRoofCertVolKw" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="String">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateRoofCertVolKw */
|
||||
SELECT
|
||||
FORMAT(ISNULL(SUM(CASE WHEN T.MODULE_VOL_KW <![CDATA[ <= ]]> T.PC_VOL_KW THEN T.MODULE_VOL_KW ELSE T.PC_VOL_KW END), 0), '#,##0.000') AS CERT_VOL_KW
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
P.OBJECT_NO
|
||||
, P.PLAN_NO
|
||||
, RE.ROOF_NO
|
||||
, RE.ROOF_SURFACE
|
||||
, ROUND(CAST(RE.SLOPE AS FLOAT), 2) AS SLOPE
|
||||
, RIE.AMOUNT
|
||||
, CAST(RIE.SPECIFICATION AS FLOAT) SPECIFICATION
|
||||
, ROUND((RIE.AMOUNT * CAST(ISNULL(RIE.SPECIFICATION, 0) AS FLOAT) / 1000), 4) AS PC_VOL_KW
|
||||
, I.ITEM_ID
|
||||
, I.ITEM_NO
|
||||
, ISNULL((
|
||||
SELECT
|
||||
SUM((AMOUNT * CAST(ISNULL(SPECIFICATION, 0) AS FLOAT) / 1000))
|
||||
FROM T_ROOF_ITEM_ESTIMATE
|
||||
WHERE ROOF_NO = RIE.ROOF_NO
|
||||
AND OBJECT_NO = RIE.OBJECT_NO
|
||||
AND PLAN_NO = RIE.PLAN_NO
|
||||
AND PC_ITEM_ID = RIE.ITEM_ID
|
||||
), 0) AS MODULE_VOL_KW
|
||||
FROM T_PLAN P WITH (NOLOCK)
|
||||
INNER JOIN T_ROOF_ESTIMATE RE WITH (NOLOCK)
|
||||
ON P.OBJECT_NO = RE.OBJECT_NO
|
||||
AND P.PLAN_NO = RE.PLAN_NO
|
||||
INNER JOIN T_ROOF_ITEM_ESTIMATE RIE WITH (NOLOCK)
|
||||
ON RE.ROOF_NO = RIE.ROOF_NO
|
||||
AND RE.OBJECT_NO = RE.OBJECT_NO
|
||||
AND RE.PLAN_NO = RE.PLAN_NO
|
||||
INNER JOIN M_ITEM I WITH (NOLOCK)
|
||||
ON RIE.ITEM_ID = I.ITEM_ID
|
||||
WHERE P.OBJECT_NO = #{objectNo}
|
||||
AND P.PLAN_NO = #{planNo}
|
||||
AND I.ITEM_GROUP = 'PC_'
|
||||
) T
|
||||
</select>
|
||||
|
||||
<select id="selectEstimateRoofList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.RoofResponse">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateRoofList */
|
||||
SELECT
|
||||
P.OBJECT_NO
|
||||
, P.PLAN_NO
|
||||
, ROUND(CAST(P.SETUP_HEIGHT AS FLOAT), 2) AS SETUP_HEIGHT
|
||||
, P.SURFACE_TYPE
|
||||
, RE.ROOF_SURFACE
|
||||
, RE.ROOF_MATERIAL_ID
|
||||
, RE.SUPPORT_METHOD_ID
|
||||
, RE.CONSTRUCT_SPECIFICATION
|
||||
, ROUND(CAST(RE.SLOPE AS FLOAT), 2) AS SLOPE
|
||||
, RE.ANGLE
|
||||
, RE.AZIMUTH
|
||||
, ISNULL(C1.CODE_NM, '') AS ROOF_MATERIAL_NAME
|
||||
, ISNULL(C2.CODE_NM, '') AS SUPPORT_METHOD_NAME
|
||||
, ISNULL(C3.CODE_NM, '') AS CONSTRUCT_SPECIFICATION_NAME
|
||||
FROM T_PLAN P WITH (NOLOCK)
|
||||
INNER JOIN T_ROOF_ESTIMATE RE WITH (NOLOCK)
|
||||
ON P.OBJECT_NO = RE.OBJECT_NO
|
||||
AND P.PLAN_NO = RE.PLAN_NO
|
||||
LEFT OUTER JOIN M_COMM_L C1 WITH (NOLOCK)
|
||||
ON C1.HEAD_CD = '201900'
|
||||
AND RE.ROOF_MATERIAL_ID = C1.CODE
|
||||
LEFT OUTER JOIN M_COMM_L C2 WITH (NOLOCK)
|
||||
ON C2.HEAD_CD = '202100'
|
||||
AND RE.SUPPORT_METHOD_ID = C2.CODE
|
||||
LEFT OUTER JOIN M_COMM_L C3 WITH (NOLOCK)
|
||||
ON C3.HEAD_CD = '201300'
|
||||
AND RE.CONSTRUCT_SPECIFICATION = C3.CODE
|
||||
WHERE P.OBJECT_NO = #{objectNo}
|
||||
AND P.PLAN_NO = #{planNo}
|
||||
</select>
|
||||
|
||||
<select id="selectEstimateRoofPcList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.RoofResponse">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateRoofPcList */
|
||||
SELECT
|
||||
T.ITEM_ID
|
||||
, T.ITEM_NO
|
||||
, SUM(T.AMOUNT) AS AMOUNT
|
||||
, SUM(T.PC_AMOUNT) AS PC_MODULE_AMOUNT
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
P.OBJECT_NO
|
||||
, P.PLAN_NO
|
||||
, RE.ROOF_NO
|
||||
, RE.ROOF_SURFACE
|
||||
, ROUND(CAST(RE.SLOPE AS FLOAT), 2) AS SLOPE
|
||||
, RIE.AMOUNT
|
||||
, CAST(RIE.SPECIFICATION AS FLOAT) SPECIFICATION
|
||||
, I.ITEM_ID
|
||||
, I.ITEM_NO
|
||||
, I.ITEM_GROUP
|
||||
, (SELECT SUM(AMOUNT) FROM T_ROOF_ITEM_ESTIMATE WHERE ROOF_NO = RIE.ROOF_NO AND OBJECT_NO = RIE.OBJECT_NO AND PLAN_NO = RIE.PLAN_NO AND PC_ITEM_ID = RIE.ITEM_ID) AS PC_AMOUNT
|
||||
FROM T_PLAN P WITH (NOLOCK)
|
||||
INNER JOIN T_ROOF_ESTIMATE RE WITH (NOLOCK)
|
||||
ON P.OBJECT_NO = RE.OBJECT_NO
|
||||
AND P.PLAN_NO = RE.PLAN_NO
|
||||
INNER JOIN T_ROOF_ITEM_ESTIMATE RIE WITH (NOLOCK)
|
||||
ON RE.ROOF_NO = RIE.ROOF_NO
|
||||
AND RE.OBJECT_NO = RE.OBJECT_NO
|
||||
AND RE.PLAN_NO = RE.PLAN_NO
|
||||
INNER JOIN M_ITEM I WITH (NOLOCK)
|
||||
ON RIE.ITEM_ID = I.ITEM_ID
|
||||
WHERE P.OBJECT_NO = #{objectNo}
|
||||
AND P.PLAN_NO = #{planNo}
|
||||
AND I.ITEM_GROUP = 'PC_'
|
||||
) T
|
||||
GROUP BY T.ITEM_ID, T.ITEM_NO
|
||||
</select>
|
||||
|
||||
<select id="selectEstimateRoofVolList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.RoofResponse">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateRoofVolList */
|
||||
SELECT
|
||||
T.OBJECT_NO
|
||||
, T.PLAN_NO
|
||||
, T.ROOF_NO
|
||||
, T.ROOF_SURFACE
|
||||
, T.SLOPE
|
||||
, SUM(T.AMOUNT) AS AMOUNT
|
||||
, ROUND(SUM(T.AMOUNT * T.SPECIFICATION / 1000), 4) AS VOL_KW
|
||||
FROM
|
||||
(
|
||||
SELECT
|
||||
P.OBJECT_NO
|
||||
, P.PLAN_NO
|
||||
, RE.ROOF_NO
|
||||
, RE.ROOF_SURFACE
|
||||
, ROUND(CAST(RE.SLOPE AS FLOAT), 2) AS SLOPE
|
||||
, RIE.AMOUNT
|
||||
, CAST(RIE.SPECIFICATION AS FLOAT) SPECIFICATION
|
||||
, I.ITEM_ID
|
||||
, I.ITEM_GROUP
|
||||
FROM T_PLAN P WITH (NOLOCK)
|
||||
INNER JOIN T_ROOF_ESTIMATE RE WITH (NOLOCK)
|
||||
ON P.OBJECT_NO = RE.OBJECT_NO
|
||||
AND P.PLAN_NO = RE.PLAN_NO
|
||||
INNER JOIN T_ROOF_ITEM_ESTIMATE RIE WITH (NOLOCK)
|
||||
ON RE.ROOF_NO = RIE.ROOF_NO
|
||||
AND RE.OBJECT_NO = RE.OBJECT_NO
|
||||
AND RE.PLAN_NO = RE.PLAN_NO
|
||||
INNER JOIN M_ITEM I WITH (NOLOCK)
|
||||
ON RIE.ITEM_ID = I.ITEM_ID
|
||||
WHERE P.OBJECT_NO = #{objectNo}
|
||||
AND P.PLAN_NO = #{planNo}
|
||||
<if test='schItemGroup != null and schItemGroup != ""'>
|
||||
AND I.ITEM_GROUP = #{schItemGroup}
|
||||
</if>
|
||||
) T
|
||||
GROUP BY T.OBJECT_NO, T.PLAN_NO, T.ROOF_NO, T.ROOF_SURFACE, T.SLOPE
|
||||
</select>
|
||||
|
||||
<select id="selectEstimateNoteList" parameterType="com.interplug.qcast.biz.estimate.dto.NoteRequest" resultType="com.interplug.qcast.biz.estimate.dto.NoteResponse">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateNoteList */
|
||||
SELECT
|
||||
@ -303,6 +474,8 @@
|
||||
, PKG_ASP = NULL
|
||||
, PRICE_CD = #{priceCd}
|
||||
, SURFACE_TYPE = #{surfaceType}
|
||||
, CREATE_DATETIME = GETDATE()
|
||||
, CREATE_USER = #{userId}
|
||||
</when>
|
||||
<otherwise>
|
||||
, CHARGER = #{charger}
|
||||
@ -445,6 +618,7 @@
|
||||
, ITEM_NAME
|
||||
, SPECIFICATION
|
||||
, AMOUNT
|
||||
, PC_ITEM_ID
|
||||
)
|
||||
SELECT
|
||||
#{roofNo} AS ROOF_NO
|
||||
@ -455,6 +629,7 @@
|
||||
, I.ITEM_NAME
|
||||
, I.PNOW_W
|
||||
, #{amount}
|
||||
, #{pcItemId}
|
||||
FROM M_ITEM I WITH (NOLOCK)
|
||||
WHERE I.ITEM_ID = #{itemId}
|
||||
</insert>
|
||||
|
||||
@ -307,6 +307,7 @@
|
||||
, S.SALE_STORE_LEVEL
|
||||
, ISNULL(P.PREF_NAME, '') AS PREF_NAME
|
||||
, ISNULL(PA.AREA_NAME, '') AS AREA_NAME
|
||||
, (SELECT COUNT(1) FROM T_PLAN WHERE OBJECT_NO = O.OBJECT_NO AND DEL_FLG = '0' AND DRAWING_ESTIMATE_CREATE_DATE IS NOT NULL) AS ESTIMATE_TOT_CNT
|
||||
FROM T_OBJECT O WITH (NOLOCK)
|
||||
INNER JOIN M_SALES_STORE S WITH(NOLOCK)
|
||||
ON O.SALE_STORE_ID = S.SALE_STORE_ID
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user