견적서 API 개발 수정
This commit is contained in:
parent
1e4b68b7b0
commit
6c45592b0f
@ -31,9 +31,21 @@ public interface EstimateMapper {
|
||||
// 견적서 정보 수정
|
||||
public int updateEstimate(EstimateRequest estimateRequest);
|
||||
|
||||
// 견적서 지붕재 등록
|
||||
public int insertEstimateRoof(RoofRequest roofRequest);
|
||||
|
||||
// 견적서 지붕재 아이템 등록
|
||||
public int insertEstimateRoofItem(ItemRequest itemRequest);
|
||||
|
||||
// 견적서 아이템 등록
|
||||
public int insertEstimateItem(ItemRequest itemRequest);
|
||||
|
||||
// 견적서 지붕재 목록 삭제(물리 삭제)
|
||||
public int deleteEstimateRoofList(EstimateRequest estimateRequest);
|
||||
|
||||
// 견적서 지붕재 아이템 목록 삭제(물리 삭제)
|
||||
public int deleteEstimateRoofItemList(EstimateRequest estimateRequest);
|
||||
|
||||
// 견적서 아이템 목록 삭제(물리 삭제)
|
||||
public int deleteEstimateItemList(EstimateRequest estimateRequest);
|
||||
|
||||
|
||||
@ -207,8 +207,10 @@ public class EstimateService {
|
||||
}
|
||||
|
||||
String splitStr = "、";
|
||||
List<RoofRequest> roofList = new ArrayList<RoofRequest>();
|
||||
List<ItemRequest> itemList = estimateRequest.getItemList();
|
||||
|
||||
try {
|
||||
// 도면 작성일 경우에만 지붕재 데이터를 셋팅
|
||||
if ("1".equals(estimateRequest.getDrawingFlg())) {
|
||||
// [1]. 견적서 기본셋팅
|
||||
@ -225,7 +227,7 @@ public class EstimateService {
|
||||
}
|
||||
|
||||
// [2]. 지붕재 관련 데이터 셋팅
|
||||
List<RoofRequest> roofList = estimateRequest.getRoofList();
|
||||
roofList = estimateRequest.getRoofList();
|
||||
|
||||
// 지붕재 시공사양 ID
|
||||
String constructSpecifications = "";
|
||||
@ -253,7 +255,8 @@ public class EstimateService {
|
||||
}
|
||||
|
||||
if (!StringUtils.isEmpty(roofRequest.getConstructSpecification())) {
|
||||
constructSpecifications += !StringUtils.isEmpty(constructSpecifications) ? splitStr : "";
|
||||
constructSpecifications +=
|
||||
!StringUtils.isEmpty(constructSpecifications) ? splitStr : "";
|
||||
constructSpecifications += roofRequest.getConstructSpecification();
|
||||
}
|
||||
|
||||
@ -370,7 +373,7 @@ public class EstimateService {
|
||||
estimateRequest.setEstimateOption(estimateOptions);
|
||||
}
|
||||
|
||||
// 아아템 목록 필수 값 체크
|
||||
// 아이템 목록 필수 값 체크
|
||||
BigDecimal capacity = BigDecimal.ZERO;
|
||||
String moduleModel = "";
|
||||
String pcTypeNo = "";
|
||||
@ -423,6 +426,31 @@ public class EstimateService {
|
||||
estimateRequest.setPriceCd("UNIT_PRICE");
|
||||
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);
|
||||
|
||||
@ -440,6 +468,9 @@ public class EstimateService {
|
||||
|
||||
estimateMapper.insertEstimateItem(itemRequest);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public EstimateResponse insertEstimateCopy(EstimateRequest estimateRequest) throws Exception {
|
||||
|
||||
@ -36,6 +36,9 @@ public class EstimateRequest {
|
||||
@Schema(description = "경사")
|
||||
private String slope;
|
||||
|
||||
@Schema(description = "각도")
|
||||
private String angle;
|
||||
|
||||
@Schema(description = "지붕재 아이템 CLASS ID")
|
||||
private String roofMaterialClassId;
|
||||
|
||||
|
||||
@ -28,6 +28,9 @@ public class EstimateResponse {
|
||||
@Schema(description = "경사")
|
||||
private String slope;
|
||||
|
||||
@Schema(description = "각도")
|
||||
private String angle;
|
||||
|
||||
@Schema(description = "지붕재 아이템 CLASS ID")
|
||||
private String roofMaterialClassId;
|
||||
|
||||
|
||||
@ -14,6 +14,9 @@ public class ItemRequest {
|
||||
@Schema(description = "플랜번호")
|
||||
private String planNo;
|
||||
|
||||
@Schema(description = "지붕재 번호")
|
||||
private String roofNo;
|
||||
|
||||
@Schema(description = "아이템 ID")
|
||||
private String itemId;
|
||||
|
||||
|
||||
@ -14,6 +14,9 @@ public class ItemResponse {
|
||||
@Schema(description = "플랜번호")
|
||||
private String planNo;
|
||||
|
||||
@Schema(description = "노출번호")
|
||||
private String dispOrder;
|
||||
|
||||
@Schema(description = "번호")
|
||||
private String no;
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
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;
|
||||
|
||||
@ -8,6 +9,18 @@ import lombok.Setter;
|
||||
@Getter
|
||||
@Setter
|
||||
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")
|
||||
private String roofMaterialId;
|
||||
|
||||
@ -28,4 +41,19 @@ public class RoofRequest {
|
||||
|
||||
@Schema(description = "가대메이커명")
|
||||
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;
|
||||
}
|
||||
|
||||
@ -13,6 +13,7 @@
|
||||
, P.WEATHER_POINT
|
||||
, P.ROOF_KIND_ID
|
||||
, P.SLOPE
|
||||
, P.ANGLE
|
||||
, P.ROOF_MATERIAL_CLASS_ID
|
||||
, P.ROOF_MATERIAL_ID
|
||||
, P.SUPPORT_METHOD_ID
|
||||
@ -108,6 +109,7 @@
|
||||
SELECT
|
||||
PE.OBJECT_NO
|
||||
, PE.PLAN_NO
|
||||
, PE.DISP_ORDER
|
||||
, PE.ITEM_ID
|
||||
, PE.ITEM_NO
|
||||
, PE.ITEM_NAME
|
||||
@ -233,6 +235,7 @@
|
||||
, SETUP_HEIGHT = #{setupHeight}
|
||||
, WEATHER_POINT = #{weatherPoint}
|
||||
, SLOPE = #{slope}
|
||||
, ANGLE = #{angle}
|
||||
, ROOF_MATERIAL_ID = #{roofMaterialId}
|
||||
, SUPPORT_METHOD_ID = #{supportMethodId}
|
||||
, DRAWING_ESTIMATE_CREATE_DATE = GETDATE()
|
||||
@ -251,6 +254,7 @@
|
||||
, ESTIMATE_OPTION = #{estimateOption}
|
||||
, PKG_ASP = NULL
|
||||
, PRICE_CD = #{priceCd}
|
||||
, SURFACE_TYPE = #{surfaceType}
|
||||
</when>
|
||||
<otherwise>
|
||||
, CHARGER = #{charger}
|
||||
@ -272,7 +276,7 @@
|
||||
</update>
|
||||
|
||||
<insert id="insertEstimateItem" parameterType="com.interplug.qcast.biz.estimate.dto.ItemRequest">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.insertEstimateItem*/
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.insertEstimateItem */
|
||||
INSERT INTO T_PART_ESTIMATE
|
||||
(
|
||||
OBJECT_NO
|
||||
@ -317,6 +321,92 @@
|
||||
)
|
||||
</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">
|
||||
/* sqlid : com.interplug.qcast.biz.estimate.deleteEstimateItemList */
|
||||
DELETE FROM T_PART_ESTIMATE
|
||||
|
||||
@ -41,6 +41,7 @@
|
||||
, U.LAST_EDIT_USER
|
||||
FROM T_UPLOAD U WITH (NOLOCK)
|
||||
WHERE U.OBJECT_NO = #{objectNo}
|
||||
AND U.DEL_FLG = '0'
|
||||
<if test="planNo != null and planNo != ''">
|
||||
AND U.PLAN_NO = #{planNo}
|
||||
</if>
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user