지붕재 엑셀다운로드 API 개발

This commit is contained in:
LAPTOP-L3VE7KK2\USER 2024-11-13 14:33:16 +09:00
parent 6ad6ce2cd3
commit 31d216f03c
6 changed files with 135 additions and 7 deletions

View File

@ -24,6 +24,12 @@ public interface EstimateMapper {
// 견적서 지붕재 목록 조회 // 견적서 지붕재 목록 조회
public List<RoofResponse> selectEstimateRoofList(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); public List<NoteResponse> selectEstimateNoteList(NoteRequest noteRequest);

View File

@ -683,9 +683,30 @@ 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> roofVolList = estimateMapper.selectEstimateRoofVolList(estimateRequest);
BigDecimal moduleTotAmount = BigDecimal.ZERO;
BigDecimal moduleTotVol = 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());
moduleTotAmount = moduleTotAmount.add(amount);
moduleTotVol = moduleTotVol.add(vol);
}
roofInfoResponse.setModuleTotAmount(String.valueOf(moduleTotAmount));
roofInfoResponse.setModuleTotVol(String.valueOf(moduleTotVol));
roofInfoResponse.setRoofList(roofList); roofInfoResponse.setRoofList(roofList);
roofInfoResponse.setRoofPcList(roofPcList);
roofInfoResponse.setRoofVolList(roofVolList);
estimateResponse.setRoofInfo(roofInfoResponse); estimateResponse.setRoofInfo(roofInfoResponse);

View File

@ -163,18 +163,21 @@ public class EstimateRequest {
private String[] arrItemId; private String[] arrItemId;
// 다운로드 관련 조건 // 다운로드 관련 조건
@Schema(description = "다운로드 정가 표시여부") @Schema(description = "검색 - 다운로드 정가 표시여부")
private String schUnitPriceFlg; private String schUnitPriceFlg;
@Schema(description = "다운로드 표시여부") @Schema(description = "검색 - 다운로드 표시여부")
private String schDisplayFlg; private String schDisplayFlg;
@Schema(description = "가대중량표 포함 여부") @Schema(description = "검색 - 가대중량표 포함 여부")
private String schWeightFlg; private String schWeightFlg;
@Schema(description = "도면 포함 여부") @Schema(description = "검색 - 도면 포함 여부")
private String schDrawingFlg; private String schDrawingFlg;
@Schema(description = "검색 - 아이템 그룹")
private String schItemGroup;
// 데이터 목록 관련 정보 // 데이터 목록 관련 정보
@Schema(description = "지붕재 목록") @Schema(description = "지붕재 목록")
List<RoofRequest> roofList; List<RoofRequest> roofList;

View File

@ -9,6 +9,12 @@ import lombok.Setter;
@Getter @Getter
@Setter @Setter
public class RoofInfoResponse { public class RoofInfoResponse {
@Schema(description = "모듈 총 수")
private String moduleTotAmount;
@Schema(description = "모듈 총 용량")
private String moduleTotVol;
@Schema(description = "지붕면 목록") @Schema(description = "지붕면 목록")
private List<RoofResponse> roofList; private List<RoofResponse> roofList;

View File

@ -64,4 +64,19 @@ public class RoofResponse {
@Schema(description = "설치높이") @Schema(description = "설치높이")
private String setupHeight; private String setupHeight;
@Schema(description = "아이템 ID")
private String itemId;
@Schema(description = "아이템 번호")
private String itemNo;
@Schema(description = "매수")
private String amount;
@Schema(description = "용량")
private String vol;
@Schema(description = "Pc 모듈 매수")
private String pcModuleAmount;
} }

View File

@ -120,7 +120,7 @@
</select> </select>
<select id="selectEstimateApiDetail" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.EstimateSendResponse"> <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 SELECT
O.OBJECT_NO O.OBJECT_NO
, O.SALE_STORE_ID , O.SALE_STORE_ID
@ -220,13 +220,13 @@
SELECT SELECT
P.OBJECT_NO P.OBJECT_NO
, P.PLAN_NO , P.PLAN_NO
, P.SETUP_HEIGHT , ROUND(CAST(P.SETUP_HEIGHT AS FLOAT), 2) AS SETUP_HEIGHT
, P.SURFACE_TYPE , P.SURFACE_TYPE
, RE.ROOF_SURFACE , RE.ROOF_SURFACE
, RE.ROOF_MATERIAL_ID , RE.ROOF_MATERIAL_ID
, RE.SUPPORT_METHOD_ID , RE.SUPPORT_METHOD_ID
, RE.CONSTRUCT_SPECIFICATION , RE.CONSTRUCT_SPECIFICATION
, RE.SLOPE , ROUND(CAST(RE.SLOPE AS FLOAT), 2) AS SLOPE
, RE.ANGLE , RE.ANGLE
, RE.AZIMUTH , RE.AZIMUTH
, ISNULL(C1.CODE_NM, '') AS ROOF_MATERIAL_NAME , ISNULL(C1.CODE_NM, '') AS ROOF_MATERIAL_NAME
@ -249,6 +249,83 @@
AND P.PLAN_NO = #{planNo} AND P.PLAN_NO = #{planNo}
</select> </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_SURFACE
, T.SLOPE
, SUM(T.AMOUNT) AS AMOUNT
, ROUND(SUM(T.AMOUNT * T.SPECIFICATION / 1000), 4) AS VOL
FROM
(
SELECT
P.OBJECT_NO
, P.PLAN_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_SURFACE, T.SLOPE
</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">
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateNoteList */ /* sqlid : com.interplug.qcast.biz.estimate.selectEstimateNoteList */
SELECT SELECT