diff --git a/src/main/java/com/interplug/qcast/biz/estimate/EstimateMapper.java b/src/main/java/com/interplug/qcast/biz/estimate/EstimateMapper.java index caa65943..48bf6fed 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/EstimateMapper.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/EstimateMapper.java @@ -21,6 +21,9 @@ public interface EstimateMapper { // 아이템 마스터 목록 조회 public List selectItemMasterList(EstimateRequest estimateRequest); + // 견적서 지붕재 인증용량 조회 + public String selectEstimateRoofCertVolKw(EstimateRequest estimateRequest); + // 견적서 지붕재 목록 조회 public List selectEstimateRoofList(EstimateRequest estimateRequest); diff --git a/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java b/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java index 8e813283..23c54b5f 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/EstimateService.java @@ -10,9 +10,6 @@ import com.interplug.qcast.biz.object.dto.ObjectResponse; import com.interplug.qcast.biz.object.dto.PlanRequest; import com.interplug.qcast.biz.object.dto.PlanResponse; import com.interplug.qcast.biz.pwrGnrSimulation.PwrGnrSimService; -import com.interplug.qcast.biz.pwrGnrSimulation.dto.PwrGnrSimGuideResponse; -import com.interplug.qcast.biz.pwrGnrSimulation.dto.PwrGnrSimRequest; -import com.interplug.qcast.biz.pwrGnrSimulation.dto.PwrGnrSimResponse; import com.interplug.qcast.config.Exception.ErrorCode; import com.interplug.qcast.config.Exception.QcastException; import com.interplug.qcast.config.message.Messages; @@ -28,6 +25,7 @@ import java.io.File; 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; @@ -685,31 +683,33 @@ public class EstimateService { } // 지붕재 목록 조회 - estimateRequest.setSchItemGroup("MODULE_"); - RoofInfoResponse roofInfoResponse = new RoofInfoResponse(); List roofList = estimateMapper.selectEstimateRoofList(estimateRequest); List roofPcList = estimateMapper.selectEstimateRoofPcList(estimateRequest); + estimateRequest.setSchItemGroup("MODULE_"); List roofVolList = estimateMapper.selectEstimateRoofVolList(estimateRequest); BigDecimal moduleTotAmount = BigDecimal.ZERO; - BigDecimal moduleTotVol = 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.getVol()) ? "0" : roofVol.getVol()); + new BigDecimal(StringUtils.isEmpty(roofVol.getVolKw()) ? "0" : roofVol.getVolKw()); moduleTotAmount = moduleTotAmount.add(amount); - moduleTotVol = moduleTotVol.add(vol); + moduleTotVolKw = moduleTotVolKw.add(vol); } roofInfoResponse.setModuleTotAmount(String.valueOf(moduleTotAmount)); - roofInfoResponse.setModuleTotVol(String.valueOf(moduleTotVol)); + roofInfoResponse.setModuleTotVolKw(String.valueOf(moduleTotVolKw)); roofInfoResponse.setRoofList(roofList); roofInfoResponse.setRoofPcList(roofPcList); roofInfoResponse.setRoofVolList(roofVolList); + // 인증용량 구하기 (지붕면마다 모듈과 PCS의 총 용량을 서로 비교해 낮은쪽 용량으로 합산) + roofInfoResponse.setCertVolKw(estimateMapper.selectEstimateRoofCertVolKw(estimateRequest)); + estimateResponse.setRoofInfo(roofInfoResponse); // 아이템 목록 조회 @@ -757,11 +757,13 @@ public class EstimateService { estimateResponse.setTotPrice( String.format("%1$,.0f", Double.parseDouble(estimateResponse.getTotPrice()))); - String excelFileName = "Quation_Detail"; + String excelFileName = + "Quation_Detail_" + new SimpleDateFormat("yyyyMMdd").format(new Date()); String excelTemplatePath = excelTemplateFilePath + File.separator + "excel_download_quotation_detail_template.xlsx"; // 발전시뮬레이션 계산 + /* PwrGnrSimRequest pwrGnrSimRequest = new PwrGnrSimRequest(); pwrGnrSimRequest.setObjectNo(estimateResponse.getObjectNo()); pwrGnrSimRequest.setPlanNo(estimateResponse.getPlanNo()); @@ -784,6 +786,8 @@ public class EstimateService { estimateResponse.setPwrGnrSim(pwrGnrSimResponse); + */ + excelUtil.download( request, response, diff --git a/src/main/java/com/interplug/qcast/biz/estimate/dto/RoofInfoResponse.java b/src/main/java/com/interplug/qcast/biz/estimate/dto/RoofInfoResponse.java index c367eb4a..4c035da5 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/dto/RoofInfoResponse.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/dto/RoofInfoResponse.java @@ -9,11 +9,14 @@ import lombok.Setter; @Getter @Setter public class RoofInfoResponse { + @Schema(description = "인증용량") + private String certVolKw; + @Schema(description = "모듈 총 수") private String moduleTotAmount; @Schema(description = "모듈 총 용량") - private String moduleTotVol; + private String moduleTotVolKw; @Schema(description = "지붕면 목록") private List roofList; diff --git a/src/main/java/com/interplug/qcast/biz/estimate/dto/RoofResponse.java b/src/main/java/com/interplug/qcast/biz/estimate/dto/RoofResponse.java index 81c95d57..361fc215 100644 --- a/src/main/java/com/interplug/qcast/biz/estimate/dto/RoofResponse.java +++ b/src/main/java/com/interplug/qcast/biz/estimate/dto/RoofResponse.java @@ -75,7 +75,7 @@ public class RoofResponse { private String amount; @Schema(description = "용량") - private String vol; + private String volKw; @Schema(description = "Pc 모듈 매수") private String pcModuleAmount; diff --git a/src/main/resources/mappers/estimate/estimateMapper.xml b/src/main/resources/mappers/estimate/estimateMapper.xml index a9c30992..9e51be6c 100644 --- a/src/main/resources/mappers/estimate/estimateMapper.xml +++ b/src/main/resources/mappers/estimate/estimateMapper.xml @@ -215,6 +215,48 @@ + + /* sqlid : com.interplug.qcast.biz.estimate.selectEstimateRoofVolList */ SELECT - T.OBJECT_NO + 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 + , 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 @@ -323,7 +367,7 @@ AND I.ITEM_GROUP = #{schItemGroup} ) T - GROUP BY T.OBJECT_NO, T.PLAN_NO, T.ROOF_SURFACE, T.SLOPE + GROUP BY T.OBJECT_NO, T.PLAN_NO, T.ROOF_NO, T.ROOF_SURFACE, T.SLOPE