견적서 API 개발 수정

This commit is contained in:
LAPTOP-L3VE7KK2\USER 2024-11-07 15:42:17 +09:00
parent 1e4b68b7b0
commit 6c45592b0f
9 changed files with 393 additions and 219 deletions

View File

@ -31,9 +31,21 @@ public interface EstimateMapper {
// 견적서 정보 수정 // 견적서 정보 수정
public int updateEstimate(EstimateRequest estimateRequest); public int updateEstimate(EstimateRequest estimateRequest);
// 견적서 지붕재 등록
public int insertEstimateRoof(RoofRequest roofRequest);
// 견적서 지붕재 아이템 등록
public int insertEstimateRoofItem(ItemRequest itemRequest);
// 견적서 아이템 등록 // 견적서 아이템 등록
public int insertEstimateItem(ItemRequest itemRequest); public int insertEstimateItem(ItemRequest itemRequest);
// 견적서 지붕재 목록 삭제(물리 삭제)
public int deleteEstimateRoofList(EstimateRequest estimateRequest);
// 견적서 지붕재 아이템 목록 삭제(물리 삭제)
public int deleteEstimateRoofItemList(EstimateRequest estimateRequest);
// 견적서 아이템 목록 삭제(물리 삭제) // 견적서 아이템 목록 삭제(물리 삭제)
public int deleteEstimateItemList(EstimateRequest estimateRequest); public int deleteEstimateItemList(EstimateRequest estimateRequest);

View File

@ -207,8 +207,10 @@ public class EstimateService {
} }
String splitStr = ""; String splitStr = "";
List<RoofRequest> roofList = new ArrayList<RoofRequest>();
List<ItemRequest> itemList = estimateRequest.getItemList(); List<ItemRequest> itemList = estimateRequest.getItemList();
try {
// 도면 작성일 경우에만 지붕재 데이터를 셋팅 // 도면 작성일 경우에만 지붕재 데이터를 셋팅
if ("1".equals(estimateRequest.getDrawingFlg())) { if ("1".equals(estimateRequest.getDrawingFlg())) {
// [1]. 견적서 기본셋팅 // [1]. 견적서 기본셋팅
@ -225,7 +227,7 @@ public class EstimateService {
} }
// [2]. 지붕재 관련 데이터 셋팅 // [2]. 지붕재 관련 데이터 셋팅
List<RoofRequest> roofList = estimateRequest.getRoofList(); roofList = estimateRequest.getRoofList();
// 지붕재 시공사양 ID // 지붕재 시공사양 ID
String constructSpecifications = ""; String constructSpecifications = "";
@ -253,7 +255,8 @@ public class EstimateService {
} }
if (!StringUtils.isEmpty(roofRequest.getConstructSpecification())) { if (!StringUtils.isEmpty(roofRequest.getConstructSpecification())) {
constructSpecifications += !StringUtils.isEmpty(constructSpecifications) ? splitStr : ""; constructSpecifications +=
!StringUtils.isEmpty(constructSpecifications) ? splitStr : "";
constructSpecifications += roofRequest.getConstructSpecification(); constructSpecifications += roofRequest.getConstructSpecification();
} }
@ -370,7 +373,7 @@ public class EstimateService {
estimateRequest.setEstimateOption(estimateOptions); estimateRequest.setEstimateOption(estimateOptions);
} }
// 아아 목록 필수 체크 // 아이 목록 필수 체크
BigDecimal capacity = BigDecimal.ZERO; BigDecimal capacity = BigDecimal.ZERO;
String moduleModel = ""; String moduleModel = "";
String pcTypeNo = ""; String pcTypeNo = "";
@ -423,6 +426,31 @@ public class EstimateService {
estimateRequest.setPriceCd("UNIT_PRICE"); estimateRequest.setPriceCd("UNIT_PRICE");
estimateMapper.updateEstimate(estimateRequest); estimateMapper.updateEstimate(estimateRequest);
// 도면 작성일 경우에만 지붕재 데이터 초기화 저장
if ("1".equals(estimateRequest.getDrawingFlg())) {
// 견적서 지붕면/아이템 제거
estimateMapper.deleteEstimateRoofList(estimateRequest);
estimateMapper.deleteEstimateRoofItemList(estimateRequest);
// 견적서 지붕면/아이템 신규 추가
for (RoofRequest roofRequest : roofList) {
roofRequest.setObjectNo(estimateRequest.getObjectNo());
roofRequest.setPlanNo(estimateRequest.getPlanNo());
roofRequest.setUserId(estimateRequest.getUserId());
estimateMapper.insertEstimateRoof(roofRequest);
List<ItemRequest> roofItemList = roofRequest.getRoofItemList();
for (ItemRequest itemRequest : roofItemList) {
itemRequest.setObjectNo(estimateRequest.getObjectNo());
itemRequest.setPlanNo(estimateRequest.getPlanNo());
itemRequest.setRoofNo(roofRequest.getRoofNo());
estimateMapper.insertEstimateRoofItem(itemRequest);
}
}
}
// 견적서 모든 아이템 제거 // 견적서 모든 아이템 제거
estimateMapper.deleteEstimateItemList(estimateRequest); estimateMapper.deleteEstimateItemList(estimateRequest);
@ -440,6 +468,9 @@ public class EstimateService {
estimateMapper.insertEstimateItem(itemRequest); estimateMapper.insertEstimateItem(itemRequest);
} }
} catch (Exception e) {
e.printStackTrace();
}
} }
public EstimateResponse insertEstimateCopy(EstimateRequest estimateRequest) throws Exception { public EstimateResponse insertEstimateCopy(EstimateRequest estimateRequest) throws Exception {

View File

@ -36,6 +36,9 @@ public class EstimateRequest {
@Schema(description = "경사") @Schema(description = "경사")
private String slope; private String slope;
@Schema(description = "각도")
private String angle;
@Schema(description = "지붕재 아이템 CLASS ID") @Schema(description = "지붕재 아이템 CLASS ID")
private String roofMaterialClassId; private String roofMaterialClassId;

View File

@ -28,6 +28,9 @@ public class EstimateResponse {
@Schema(description = "경사") @Schema(description = "경사")
private String slope; private String slope;
@Schema(description = "각도")
private String angle;
@Schema(description = "지붕재 아이템 CLASS ID") @Schema(description = "지붕재 아이템 CLASS ID")
private String roofMaterialClassId; private String roofMaterialClassId;

View File

@ -14,6 +14,9 @@ public class ItemRequest {
@Schema(description = "플랜번호") @Schema(description = "플랜번호")
private String planNo; private String planNo;
@Schema(description = "지붕재 번호")
private String roofNo;
@Schema(description = "아이템 ID") @Schema(description = "아이템 ID")
private String itemId; private String itemId;

View File

@ -14,6 +14,9 @@ public class ItemResponse {
@Schema(description = "플랜번호") @Schema(description = "플랜번호")
private String planNo; private String planNo;
@Schema(description = "노출번호")
private String dispOrder;
@Schema(description = "번호") @Schema(description = "번호")
private String no; private String no;

View File

@ -1,6 +1,7 @@
package com.interplug.qcast.biz.estimate.dto; package com.interplug.qcast.biz.estimate.dto;
import io.swagger.v3.oas.annotations.media.Schema; import io.swagger.v3.oas.annotations.media.Schema;
import java.util.List;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -8,6 +9,18 @@ import lombok.Setter;
@Getter @Getter
@Setter @Setter
public class RoofRequest { public class RoofRequest {
@Schema(description = "물건번호")
private String objectNo;
@Schema(description = "플랜번호")
private String planNo;
@Schema(description = "지붕재 번호")
private String roofNo;
@Schema(description = "지붕면")
private String roofSurface;
@Schema(description = "지붕재 아이템 ID") @Schema(description = "지붕재 아이템 ID")
private String roofMaterialId; private String roofMaterialId;
@ -28,4 +41,19 @@ public class RoofRequest {
@Schema(description = "가대메이커명") @Schema(description = "가대메이커명")
private String supportMeaker; private String supportMeaker;
@Schema(description = "경사")
private String slope;
@Schema(description = "각도")
private String angle;
@Schema(description = "방위각")
private String azimuth;
@Schema(description = "사용자아이디")
private String userId;
@Schema(description = "아이템 목록")
List<ItemRequest> roofItemList;
} }

View File

@ -13,6 +13,7 @@
, P.WEATHER_POINT , P.WEATHER_POINT
, P.ROOF_KIND_ID , P.ROOF_KIND_ID
, P.SLOPE , P.SLOPE
, P.ANGLE
, P.ROOF_MATERIAL_CLASS_ID , P.ROOF_MATERIAL_CLASS_ID
, P.ROOF_MATERIAL_ID , P.ROOF_MATERIAL_ID
, P.SUPPORT_METHOD_ID , P.SUPPORT_METHOD_ID
@ -108,6 +109,7 @@
SELECT SELECT
PE.OBJECT_NO PE.OBJECT_NO
, PE.PLAN_NO , PE.PLAN_NO
, PE.DISP_ORDER
, PE.ITEM_ID , PE.ITEM_ID
, PE.ITEM_NO , PE.ITEM_NO
, PE.ITEM_NAME , PE.ITEM_NAME
@ -233,6 +235,7 @@
, SETUP_HEIGHT = #{setupHeight} , SETUP_HEIGHT = #{setupHeight}
, WEATHER_POINT = #{weatherPoint} , WEATHER_POINT = #{weatherPoint}
, SLOPE = #{slope} , SLOPE = #{slope}
, ANGLE = #{angle}
, ROOF_MATERIAL_ID = #{roofMaterialId} , ROOF_MATERIAL_ID = #{roofMaterialId}
, SUPPORT_METHOD_ID = #{supportMethodId} , SUPPORT_METHOD_ID = #{supportMethodId}
, DRAWING_ESTIMATE_CREATE_DATE = GETDATE() , DRAWING_ESTIMATE_CREATE_DATE = GETDATE()
@ -251,6 +254,7 @@
, ESTIMATE_OPTION = #{estimateOption} , ESTIMATE_OPTION = #{estimateOption}
, PKG_ASP = NULL , PKG_ASP = NULL
, PRICE_CD = #{priceCd} , PRICE_CD = #{priceCd}
, SURFACE_TYPE = #{surfaceType}
</when> </when>
<otherwise> <otherwise>
, CHARGER = #{charger} , CHARGER = #{charger}
@ -317,6 +321,92 @@
) )
</insert> </insert>
<insert id="insertEstimateRoof" parameterType="com.interplug.qcast.biz.estimate.dto.RoofRequest">
/* sqlid : com.interplug.qcast.biz.estimate.insertEstimateRoof */
<selectKey keyProperty="roofNo" keyColumn="roofNo" resultType="String" order="AFTER">
SELECT @@IDENTITY
</selectKey>
INSERT INTO T_ROOF_ESTIMATE
(
OBJECT_NO
, PLAN_NO
, ROOF_SURFACE
, ROOF_MATERIAL_ID
, SUPPORT_METHOD_ID
, CONSTRUCT_SPECIFICATION
<if test='slope != null and slope != ""'>
, SLOPE
</if>
<if test='angle != null and angle != ""'>
, ANGLE
</if>
<if test='azimuth != null and azimuth != ""'>
, AZIMUTH
</if>
, CREATE_DATETIME
, CREATE_USER
) VALUES (
#{objectNo}
, #{planNo}
, #{roofSurface}
, #{roofMaterialId}
, #{supportMethodId}
, #{constructSpecification}
<if test='slope != null and slope != ""'>
, #{slope}
</if>
<if test='angle != null and angle != ""'>
, #{angle}
</if>
<if test='azimuth != null and azimuth != ""'>
, #{azimuth}
</if>
, GETDATE()
, #{userId}
)
</insert>
<insert id="insertEstimateRoofItem" parameterType="com.interplug.qcast.biz.estimate.dto.ItemRequest">
/* sqlid : com.interplug.qcast.biz.estimate.insertEstimateRoofItem */
INSERT INTO T_ROOF_ITEM_ESTIMATE
(
ROOF_NO
, OBJECT_NO
, PLAN_NO
, ITEM_ID
, ITEM_NO
, ITEM_NAME
, SPECIFICATION
, AMOUNT
)
SELECT
#{roofNo} AS ROOF_NO
, #{objectNo} AS OBJECT_NO
, #{planNo} AS PLAN_NO
, I.ITEM_ID
, I.ITEM_NO
, I.ITEM_NAME
, I.PNOW_W
, #{amount}
FROM M_ITEM I WITH (NOLOCK)
WHERE I.ITEM_ID = #{itemId}
</insert>
<delete id="deleteEstimateRoofList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest">
/* sqlid : com.interplug.qcast.biz.estimate.deleteEstimateRoofList */
DELETE FROM T_ROOF_ESTIMATE
WHERE OBJECT_NO = #{objectNo}
AND PLAN_NO = #{planNo}
</delete>
<delete id="deleteEstimateRoofItemList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest">
/* sqlid : com.interplug.qcast.biz.estimate.deleteEstimateRoofItemList */
DELETE FROM T_ROOF_ITEM_ESTIMATE
WHERE OBJECT_NO = #{objectNo}
AND PLAN_NO = #{planNo}
</delete>
<delete id="deleteEstimateItemList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest"> <delete id="deleteEstimateItemList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest">
/* sqlid : com.interplug.qcast.biz.estimate.deleteEstimateItemList */ /* sqlid : com.interplug.qcast.biz.estimate.deleteEstimateItemList */
DELETE FROM T_PART_ESTIMATE DELETE FROM T_PART_ESTIMATE

View File

@ -41,6 +41,7 @@
, U.LAST_EDIT_USER , U.LAST_EDIT_USER
FROM T_UPLOAD U WITH (NOLOCK) FROM T_UPLOAD U WITH (NOLOCK)
WHERE U.OBJECT_NO = #{objectNo} WHERE U.OBJECT_NO = #{objectNo}
AND U.DEL_FLG = '0'
<if test="planNo != null and planNo != ''"> <if test="planNo != null and planNo != ''">
AND U.PLAN_NO = #{planNo} AND U.PLAN_NO = #{planNo}
</if> </if>