견적서 특이사항 처리 및 아이템 정가 데이터 저장 추가

This commit is contained in:
LAPTOP-L3VE7KK2\USER 2024-10-30 17:37:30 +09:00
parent 0f8444d312
commit b1d9f227c7
11 changed files with 219 additions and 9 deletions

View File

@ -27,7 +27,7 @@ public class DisplayItemController {
}
@Operation(description = "제품 목록을 조회한다.")
@GetMapping("/item_list")
@GetMapping("/item-list")
@ResponseStatus(HttpStatus.OK)
public List<ItemResponse> getItemList(@RequestParam("saleStoreId") String saleStoreId)
throws Exception {
@ -35,7 +35,7 @@ public class DisplayItemController {
}
@Operation(description = "제품 상세 정보를 조회한다.")
@GetMapping("/item_detail")
@GetMapping("/item-detail")
@ResponseStatus(HttpStatus.OK)
public ItemResponse getItemDetail(@RequestParam("itemId") String itemId) throws Exception {
return displayItemService.getItemDetail(itemId);

View File

@ -2,6 +2,10 @@ package com.interplug.qcast.biz.displayItem;
import com.interplug.qcast.biz.displayItem.dto.DisplayItemRequest;
import com.interplug.qcast.biz.displayItem.dto.ItemResponse;
import com.interplug.qcast.biz.estimate.EstimateMapper;
import com.interplug.qcast.biz.estimate.dto.NoteRequest;
import com.interplug.qcast.biz.estimate.dto.NoteResponse;
import io.micrometer.common.util.StringUtils;
import java.util.List;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -12,6 +16,8 @@ import org.springframework.stereotype.Service;
@RequiredArgsConstructor
public class DisplayItemService {
private final EstimateMapper estimateMapper;
private final DisplayItemMapper displayItemMapper;
public void setStoreDisplayItemSave(DisplayItemRequest displayItemRequest) throws Exception {
@ -23,6 +29,27 @@ public class DisplayItemService {
}
public ItemResponse getItemDetail(String itemId) {
return displayItemMapper.getItemDetail(itemId);
ItemResponse itemResponse = displayItemMapper.getItemDetail(itemId);
if (itemResponse != null) {
// 견적특이사항 관련 데이터 셋팅
String[] arrItemId = {itemId};
NoteRequest noteRequest = new NoteRequest();
noteRequest.setArrItemId(arrItemId);
noteRequest.setSchSpnTypeCd("PROD");
List<NoteResponse> noteItemList = estimateMapper.selectEstimateNoteItemList(noteRequest);
String spnAttrCds = "";
for (NoteResponse noteResponse : noteItemList) {
spnAttrCds += !StringUtils.isEmpty(spnAttrCds) ? "" : "";
spnAttrCds += noteResponse.getCode();
}
itemResponse.setSpnAttrCds(spnAttrCds);
}
return itemResponse;
}
}

View File

@ -38,4 +38,7 @@ public class ItemResponse {
@Schema(description = "Sale Price")
private String salePrice;
@Schema(description = "견적 특이사항 코드")
private String spnAttrCds;
}

View File

@ -1,9 +1,6 @@
package com.interplug.qcast.biz.estimate;
import com.interplug.qcast.biz.estimate.dto.EstimateRequest;
import com.interplug.qcast.biz.estimate.dto.EstimateResponse;
import com.interplug.qcast.biz.estimate.dto.ItemRequest;
import com.interplug.qcast.biz.estimate.dto.ItemResponse;
import com.interplug.qcast.biz.estimate.dto.*;
import com.interplug.qcast.biz.object.dto.*;
import java.util.List;
import org.apache.ibatis.annotations.Mapper;
@ -19,6 +16,15 @@ public interface EstimateMapper {
// 아이템 마스터 목록 조회
public List<ItemResponse> selectItemMasterList(EstimateRequest estimateRequest);
// 아이템 마스터 목록 조회
public List<NoteResponse> selectEstimateNoteList(NoteRequest noteRequest);
// 아이템 마스터 목록 조회
public List<NoteResponse> selectEstimateNoteItemList(NoteRequest noteRequest);
// 물건정보 수정
public int updateObject(EstimateRequest estimateRequest);
// 견적서 정보 수정
public int updateEstimate(EstimateRequest estimateRequest);

View File

@ -276,6 +276,7 @@ public class EstimateService {
itemRequest.setUnit(itemResponse.getUnit());
itemRequest.setPnowW(itemResponse.getPnowW());
itemRequest.setSpecification(itemResponse.getPnowW());
itemRequest.setUnitPrice(itemResponse.getSalePrice());
itemRequest.setSalePrice(itemResponse.getSalePrice());
itemRequest.setPkgMaterialFlg(itemResponse.getPkgMaterialFlg());
itemRequest.setItemGroup(itemResponse.getItemGroup());
@ -284,6 +285,56 @@ public class EstimateService {
}
}
}
// [4]. 견적특이사항 관련 데이터 셋팅
NoteRequest noteRequest = new NoteRequest();
noteRequest.setArrItemId(arrItemId);
noteRequest.setSchSpnTypeCd("COMM");
List<NoteResponse> noteList = estimateMapper.selectEstimateNoteList(noteRequest);
noteRequest.setSchSpnTypeCd("PROD");
List<NoteResponse> noteItemList = estimateMapper.selectEstimateNoteItemList(noteRequest);
// 견적특이사항 코드
String estimateOptions = "";
for (NoteResponse noteResponse : noteList) {
if ("ATTR001".equals(noteResponse.getCode())) {
estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : "";
estimateOptions += "ATTR001"; // 공통 필수체크
} else if ("ATTR002".equals(noteResponse.getCode())) {
estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : "";
estimateOptions += "ATTR002"; // YJOD 필수체크
} else if ("ATTR003".equals(noteResponse.getCode())) {
estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : "";
estimateOptions += "ATTR003"; // 출력제어시간 기본 체크
} else if ("ATTR004".equals(noteResponse.getCode())
&& "1".equals(estimateRequest.getNorthArrangement())) {
estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : "";
estimateOptions += "ATTR004"; // 북면설치 체크
} else if ("ATTR005".equals(noteResponse.getCode())
&& "1".equals(objectResponse.getSaltAreaFlg())) {
estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : "";
estimateOptions += "ATTR005"; // 염해지역 체크
} else if ("ATTR006".equals(objectResponse.getColdRegionFlg())
&& "1".equals(estimateRequest.getNorthArrangement())) {
estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : "";
estimateOptions += "ATTR006"; // 적설지역 체크
} else if ("ATTR007".equals(noteResponse.getCode())) {
estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : "";
estimateOptions += "ATTR007"; // 지붕재치수, 레이아웃 기본 체크
} else if ("ATTR008".equals(noteResponse.getCode())) {
estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : "";
estimateOptions += "ATTR008"; // 별도비용 기본 체크
} else if ("ATTR009".equals(noteResponse.getCode())) {
estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : "";
estimateOptions += "ATTR009"; // 과적재 기본 체크
}
}
for (NoteResponse noteResponse : noteItemList) {
estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : "";
estimateOptions += noteResponse.getCode();
}
estimateRequest.setEstimateOption(estimateOptions);
}
// 아아템 목록 필수 체크
@ -326,6 +377,15 @@ public class EstimateService {
estimateRequest.setModuleModel(moduleModel);
estimateRequest.setPcTypeNo(pcTypeNo);
// 물건정보 수정
if (!StringUtils.isEmpty(estimateRequest.getObjectName())
|| !StringUtils.isEmpty(estimateRequest.getSurfaceType())
|| !StringUtils.isEmpty(estimateRequest.getSetupHeight())
|| !StringUtils.isEmpty(estimateRequest.getStandardWindSpeedId())
|| !StringUtils.isEmpty(estimateRequest.getSnowfall())) {
estimateMapper.updateObject(estimateRequest);
}
// 견적서 정보 수정
estimateMapper.updateEstimate(estimateRequest);

View File

@ -18,6 +18,9 @@ public class EstimateRequest {
@Schema(description = "SAP 판매점코드")
private String sapSalesStoreCd;
@Schema(description = "안건명")
private String objectName;
@Schema(description = "시공방법")
private String constructSpecification;
@ -27,7 +30,7 @@ public class EstimateRequest {
@Schema(description = "날씨포인트")
private String weatherPoint;
@Schema(description = "날씨포인트")
@Schema(description = "지붕재 종류 ID")
private String roofKindId;
@Schema(description = "경사")
@ -60,6 +63,9 @@ public class EstimateRequest {
@Schema(description = "시스템용량")
private String capacity;
@Schema(description = "면조도구분")
private String surfaceType;
@Schema(description = "강설량")
private String snowfall;

View File

@ -37,6 +37,9 @@ public class EstimateResponse {
@Schema(description = "가대 설치 ID")
private String supportMethodId;
@Schema(description = "견적서 등록일")
private String drawingEstimateCreateDate;
@Schema(description = "모델")
private String moduleModel;
@ -130,6 +133,9 @@ public class EstimateResponse {
@Schema(description = "가격코드")
private String priceCd;
@Schema(description = "갱신일")
private String lastEditDatetime;
// 가격 관련 정보
@Schema(description = "총 수량")
private String totAmount;

View File

@ -41,6 +41,9 @@ public class ItemRequest {
@Schema(description = "추가구분코드")
private String partAdd;
@Schema(description = "정가")
private String unitPrice;
@Schema(description = "단가")
private String salePrice;

View File

@ -0,0 +1,13 @@
package com.interplug.qcast.biz.estimate.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class NoteRequest {
@Schema(description = "아이템번호 목록")
private String[] arrItemId;
@Schema(description = "검색 - 특이사항 타입 코드")
private String schSpnTypeCd;
}

View File

@ -0,0 +1,16 @@
package com.interplug.qcast.biz.estimate.dto;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
@Data
public class NoteResponse {
@Schema(description = "공통코드")
private String code;
@Schema(description = "공통코드명")
private String codeNm;
@Schema(description = "견적특이사항")
private String remarks;
}

View File

@ -16,6 +16,7 @@
, T.ROOF_MATERIAL_CLASS_ID
, T.ROOF_MATERIAL_ID
, T.SUPPORT_METHOD_ID
, T.DRAWING_ESTIMATE_CREATE_DATE
, T.MODULE_MODEL
, T.CHARGER
, T.ESTIMATE_VALIDITY_TERM
@ -44,6 +45,7 @@
, T.FILE_FLG
, T.ESTIMATE_OPTION
, T.PKG_ASP
, T.LAST_EDIT_DATETIME
, O.OBJECT_NAME
, O.OBJECT_NAME_OMIT
FROM T_PLAN T WITH (NOLOCK)
@ -101,6 +103,72 @@
</foreach>
</select>
<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 */
SELECT
CL.CODE
, CL.CODE_NM
, OSN.REMARKS
FROM M_COMM_L CL
INNER JOIN T_OBJECT_SPECIAL_NOTE OSN
ON CL.CODE = OSN.SPN_ATTR_CD
WHERE CL.HEAD_CD = '202400'
AND CL.DEL_FLG = '0'
AND OSN.USE_FLG = '1'
AND OSN.DEL_FLG = '0'
<if test='schSpnTypeCd != null and schSpnTypeCd != ""'>
AND OSN.SPN_TYPE_CD = #{schSpnTypeCd}
</if>
</select>
<select id="selectEstimateNoteItemList" parameterType="com.interplug.qcast.biz.estimate.dto.NoteRequest" resultType="com.interplug.qcast.biz.estimate.dto.NoteResponse">
/* sqlid : com.interplug.qcast.biz.estimate.selectEstimateNoteItemList */
SELECT
CL.CODE
FROM M_COMM_L CL
INNER JOIN T_OBJECT_SPECIAL_NOTE OSN
ON CL.CODE = OSN.SPN_ATTR_CD
INNER JOIN T_OBJECT_SPECIAL_NOTE_ITEM OSNI
ON OSN.SPN_ATTR_CD = OSNI.SPN_ATTR_CD
AND OSN.SPN_TYPE_CD = OSNI.SPN_TYPE_CD
WHERE CL.HEAD_CD = '202400'
AND CL.DEL_FLG = '0'
AND OSN.USE_FLG = '1'
AND OSN.DEL_FLG = '0'
AND OSNI.DEL_FLG = '0'
<if test='schSpnTypeCd != null and schSpnTypeCd != ""'>
AND OSN.SPN_TYPE_CD = #{schSpnTypeCd}
</if>
AND OSNI.ITEM_ID IN
<foreach collection="arrItemId" item="itemId" index="index" separator="," open="(" close=")">
#{itemId}
</foreach>
</select>
<update id="updateObject" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest">
/* sqlid : com.interplug.qcast.biz.estimate.updateObject */
UPDATE T_OBJECT
SET
LAST_EDIT_DATETIME = GETDATE()
, LAST_EDIT_USER = #{userId}
<if test='objectName != null and objectName != ""'>
, OBJECT_NAME = #{objectName}
</if>
<if test='standardWindSpeedId != null and standardWindSpeedId != ""'>
, STANDARD_WIND_SPEED_ID = #{standardWindSpeedId}
</if>
<if test='snowfall != null and snowfall != ""'>
, VERTICAL_SNOW_COVER = #{snowfall}
</if>
<if test='surfaceType != null and surfaceType != ""'>
, SURFACE_TYPE = #{surfaceType}
</if>
<if test='setupHeight != null and setupHeight != ""'>
, INSTALL_HEIGHT = #{setupHeight}
</if>
WHERE OBJECT_NO = #{objectNo}
</update>
<update id="updateEstimate" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest">
/* sqlid : com.interplug.qcast.biz.estimate.updateEstimate */
UPDATE T_PLAN
@ -126,7 +194,7 @@
, SUPPORT_MEAKER_MULTI = #{supportMeaker}
, ESTIMATE_DATE = CONVERT(NVARCHAR(10), GETDATE(), 121)
, FILE_FLG = '0'
, ESTIMATE_OPTION = NULL
, ESTIMATE_OPTION = #{estimateOption}
, PKG_ASP = NULL
, PRICE_CD = #{priceCd}
</when>
@ -168,6 +236,7 @@
, PART_ADD
, LAST_EDIT_DATETIME
, LAST_EDIT_USER
, UNIT_PRICE
, SALE_PRICE
, PKG_MATERIAL_FLG
, ITEM_CHANGE_FLG
@ -187,6 +256,7 @@
, #{partAdd}
, GETDATE()
, #{userId}
, #{unitPrice}
, #{salePrice}
, #{pkgMaterialFlg}
, #{itemChangeFlg}