견적서 인증용량 계산 API 추가
This commit is contained in:
parent
77ea9441f6
commit
c881f67875
@ -21,6 +21,9 @@ public interface EstimateMapper {
|
|||||||
// 아이템 마스터 목록 조회
|
// 아이템 마스터 목록 조회
|
||||||
public List<ItemResponse> selectItemMasterList(EstimateRequest estimateRequest);
|
public List<ItemResponse> selectItemMasterList(EstimateRequest estimateRequest);
|
||||||
|
|
||||||
|
// 견적서 지붕재 인증용량 조회
|
||||||
|
public String selectEstimateRoofCertVolKw(EstimateRequest estimateRequest);
|
||||||
|
|
||||||
// 견적서 지붕재 목록 조회
|
// 견적서 지붕재 목록 조회
|
||||||
public List<RoofResponse> selectEstimateRoofList(EstimateRequest estimateRequest);
|
public List<RoofResponse> selectEstimateRoofList(EstimateRequest estimateRequest);
|
||||||
|
|
||||||
|
|||||||
@ -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.PlanRequest;
|
||||||
import com.interplug.qcast.biz.object.dto.PlanResponse;
|
import com.interplug.qcast.biz.object.dto.PlanResponse;
|
||||||
import com.interplug.qcast.biz.pwrGnrSimulation.PwrGnrSimService;
|
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.ErrorCode;
|
||||||
import com.interplug.qcast.config.Exception.QcastException;
|
import com.interplug.qcast.config.Exception.QcastException;
|
||||||
import com.interplug.qcast.config.message.Messages;
|
import com.interplug.qcast.config.message.Messages;
|
||||||
@ -28,6 +25,7 @@ import java.io.File;
|
|||||||
import java.lang.reflect.Field;
|
import java.lang.reflect.Field;
|
||||||
import java.lang.reflect.Method;
|
import java.lang.reflect.Method;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@ -685,31 +683,33 @@ public class EstimateService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 지붕재 목록 조회
|
// 지붕재 목록 조회
|
||||||
estimateRequest.setSchItemGroup("MODULE_");
|
|
||||||
|
|
||||||
RoofInfoResponse roofInfoResponse = new RoofInfoResponse();
|
RoofInfoResponse roofInfoResponse = new RoofInfoResponse();
|
||||||
List<RoofResponse> roofList = estimateMapper.selectEstimateRoofList(estimateRequest);
|
List<RoofResponse> roofList = estimateMapper.selectEstimateRoofList(estimateRequest);
|
||||||
List<RoofResponse> roofPcList = estimateMapper.selectEstimateRoofPcList(estimateRequest);
|
List<RoofResponse> roofPcList = estimateMapper.selectEstimateRoofPcList(estimateRequest);
|
||||||
|
estimateRequest.setSchItemGroup("MODULE_");
|
||||||
List<RoofResponse> roofVolList = estimateMapper.selectEstimateRoofVolList(estimateRequest);
|
List<RoofResponse> roofVolList = estimateMapper.selectEstimateRoofVolList(estimateRequest);
|
||||||
|
|
||||||
BigDecimal moduleTotAmount = BigDecimal.ZERO;
|
BigDecimal moduleTotAmount = BigDecimal.ZERO;
|
||||||
BigDecimal moduleTotVol = BigDecimal.ZERO;
|
BigDecimal moduleTotVolKw = BigDecimal.ZERO;
|
||||||
for (RoofResponse roofVol : roofVolList) {
|
for (RoofResponse roofVol : roofVolList) {
|
||||||
BigDecimal amount =
|
BigDecimal amount =
|
||||||
new BigDecimal(StringUtils.isEmpty(roofVol.getAmount()) ? "0" : roofVol.getAmount());
|
new BigDecimal(StringUtils.isEmpty(roofVol.getAmount()) ? "0" : roofVol.getAmount());
|
||||||
BigDecimal vol =
|
BigDecimal vol =
|
||||||
new BigDecimal(StringUtils.isEmpty(roofVol.getVol()) ? "0" : roofVol.getVol());
|
new BigDecimal(StringUtils.isEmpty(roofVol.getVolKw()) ? "0" : roofVol.getVolKw());
|
||||||
|
|
||||||
moduleTotAmount = moduleTotAmount.add(amount);
|
moduleTotAmount = moduleTotAmount.add(amount);
|
||||||
moduleTotVol = moduleTotVol.add(vol);
|
moduleTotVolKw = moduleTotVolKw.add(vol);
|
||||||
}
|
}
|
||||||
roofInfoResponse.setModuleTotAmount(String.valueOf(moduleTotAmount));
|
roofInfoResponse.setModuleTotAmount(String.valueOf(moduleTotAmount));
|
||||||
roofInfoResponse.setModuleTotVol(String.valueOf(moduleTotVol));
|
roofInfoResponse.setModuleTotVolKw(String.valueOf(moduleTotVolKw));
|
||||||
|
|
||||||
roofInfoResponse.setRoofList(roofList);
|
roofInfoResponse.setRoofList(roofList);
|
||||||
roofInfoResponse.setRoofPcList(roofPcList);
|
roofInfoResponse.setRoofPcList(roofPcList);
|
||||||
roofInfoResponse.setRoofVolList(roofVolList);
|
roofInfoResponse.setRoofVolList(roofVolList);
|
||||||
|
|
||||||
|
// 인증용량 구하기 (지붕면마다 모듈과 PCS의 총 용량을 서로 비교해 낮은쪽 용량으로 합산)
|
||||||
|
roofInfoResponse.setCertVolKw(estimateMapper.selectEstimateRoofCertVolKw(estimateRequest));
|
||||||
|
|
||||||
estimateResponse.setRoofInfo(roofInfoResponse);
|
estimateResponse.setRoofInfo(roofInfoResponse);
|
||||||
|
|
||||||
// 아이템 목록 조회
|
// 아이템 목록 조회
|
||||||
@ -757,11 +757,13 @@ public class EstimateService {
|
|||||||
estimateResponse.setTotPrice(
|
estimateResponse.setTotPrice(
|
||||||
String.format("%1$,.0f", Double.parseDouble(estimateResponse.getTotPrice())));
|
String.format("%1$,.0f", Double.parseDouble(estimateResponse.getTotPrice())));
|
||||||
|
|
||||||
String excelFileName = "Quation_Detail";
|
String excelFileName =
|
||||||
|
"Quation_Detail_" + new SimpleDateFormat("yyyyMMdd").format(new Date());
|
||||||
String excelTemplatePath =
|
String excelTemplatePath =
|
||||||
excelTemplateFilePath + File.separator + "excel_download_quotation_detail_template.xlsx";
|
excelTemplateFilePath + File.separator + "excel_download_quotation_detail_template.xlsx";
|
||||||
|
|
||||||
// 발전시뮬레이션 계산
|
// 발전시뮬레이션 계산
|
||||||
|
/*
|
||||||
PwrGnrSimRequest pwrGnrSimRequest = new PwrGnrSimRequest();
|
PwrGnrSimRequest pwrGnrSimRequest = new PwrGnrSimRequest();
|
||||||
pwrGnrSimRequest.setObjectNo(estimateResponse.getObjectNo());
|
pwrGnrSimRequest.setObjectNo(estimateResponse.getObjectNo());
|
||||||
pwrGnrSimRequest.setPlanNo(estimateResponse.getPlanNo());
|
pwrGnrSimRequest.setPlanNo(estimateResponse.getPlanNo());
|
||||||
@ -784,6 +786,8 @@ public class EstimateService {
|
|||||||
|
|
||||||
estimateResponse.setPwrGnrSim(pwrGnrSimResponse);
|
estimateResponse.setPwrGnrSim(pwrGnrSimResponse);
|
||||||
|
|
||||||
|
*/
|
||||||
|
|
||||||
excelUtil.download(
|
excelUtil.download(
|
||||||
request,
|
request,
|
||||||
response,
|
response,
|
||||||
|
|||||||
@ -9,11 +9,14 @@ import lombok.Setter;
|
|||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public class RoofInfoResponse {
|
public class RoofInfoResponse {
|
||||||
|
@Schema(description = "인증용량")
|
||||||
|
private String certVolKw;
|
||||||
|
|
||||||
@Schema(description = "모듈 총 수")
|
@Schema(description = "모듈 총 수")
|
||||||
private String moduleTotAmount;
|
private String moduleTotAmount;
|
||||||
|
|
||||||
@Schema(description = "모듈 총 용량")
|
@Schema(description = "모듈 총 용량")
|
||||||
private String moduleTotVol;
|
private String moduleTotVolKw;
|
||||||
|
|
||||||
@Schema(description = "지붕면 목록")
|
@Schema(description = "지붕면 목록")
|
||||||
private List<RoofResponse> roofList;
|
private List<RoofResponse> roofList;
|
||||||
|
|||||||
@ -75,7 +75,7 @@ public class RoofResponse {
|
|||||||
private String amount;
|
private String amount;
|
||||||
|
|
||||||
@Schema(description = "용량")
|
@Schema(description = "용량")
|
||||||
private String vol;
|
private String volKw;
|
||||||
|
|
||||||
@Schema(description = "Pc 모듈 매수")
|
@Schema(description = "Pc 모듈 매수")
|
||||||
private String pcModuleAmount;
|
private String pcModuleAmount;
|
||||||
|
|||||||
@ -215,6 +215,48 @@
|
|||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</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">
|
<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 */
|
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateRoofList */
|
||||||
SELECT
|
SELECT
|
||||||
@ -290,17 +332,19 @@
|
|||||||
<select id="selectEstimateRoofVolList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.RoofResponse">
|
<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 */
|
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateRoofVolList */
|
||||||
SELECT
|
SELECT
|
||||||
T.OBJECT_NO
|
T.OBJECT_NO
|
||||||
, T.PLAN_NO
|
, T.PLAN_NO
|
||||||
|
, T.ROOF_NO
|
||||||
, T.ROOF_SURFACE
|
, T.ROOF_SURFACE
|
||||||
, T.SLOPE
|
, T.SLOPE
|
||||||
, SUM(T.AMOUNT) AS AMOUNT
|
, 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
|
FROM
|
||||||
(
|
(
|
||||||
SELECT
|
SELECT
|
||||||
P.OBJECT_NO
|
P.OBJECT_NO
|
||||||
, P.PLAN_NO
|
, P.PLAN_NO
|
||||||
|
, RE.ROOF_NO
|
||||||
, RE.ROOF_SURFACE
|
, RE.ROOF_SURFACE
|
||||||
, ROUND(CAST(RE.SLOPE AS FLOAT), 2) AS SLOPE
|
, ROUND(CAST(RE.SLOPE AS FLOAT), 2) AS SLOPE
|
||||||
, RIE.AMOUNT
|
, RIE.AMOUNT
|
||||||
@ -323,7 +367,7 @@
|
|||||||
AND I.ITEM_GROUP = #{schItemGroup}
|
AND I.ITEM_GROUP = #{schItemGroup}
|
||||||
</if>
|
</if>
|
||||||
) T
|
) 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
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
<select id="selectEstimateNoteList" parameterType="com.interplug.qcast.biz.estimate.dto.NoteRequest" resultType="com.interplug.qcast.biz.estimate.dto.NoteResponse">
|
<select id="selectEstimateNoteList" parameterType="com.interplug.qcast.biz.estimate.dto.NoteRequest" resultType="com.interplug.qcast.biz.estimate.dto.NoteResponse">
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user