견적서 API 개발 수정
This commit is contained in:
parent
1e4b68b7b0
commit
6c45592b0f
@ -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);
|
||||||
|
|
||||||
|
|||||||
@ -207,238 +207,269 @@ 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())) {
|
// 도면 작성일 경우에만 지붕재 데이터를 셋팅
|
||||||
// [1]. 견적서 기본셋팅
|
if ("1".equals(estimateRequest.getDrawingFlg())) {
|
||||||
estimateRequest.setEstimateType("YJOD");
|
// [1]. 견적서 기본셋팅
|
||||||
|
estimateRequest.setEstimateType("YJOD");
|
||||||
|
estimateRequest.setPriceCd("UNIT_PRICE");
|
||||||
|
|
||||||
|
// 물건정보 조회 후 데이터 축출
|
||||||
|
ObjectResponse objectResponse =
|
||||||
|
objectMapper.selectObjectDetail(estimateRequest.getObjectNo());
|
||||||
|
if (objectResponse != null) {
|
||||||
|
estimateRequest.setWeatherPoint(
|
||||||
|
objectResponse.getPrefName() + " - " + objectResponse.getAreaName());
|
||||||
|
estimateRequest.setCharger(objectResponse.getReceiveUser());
|
||||||
|
}
|
||||||
|
|
||||||
|
// [2]. 지붕재 관련 데이터 셋팅
|
||||||
|
roofList = estimateRequest.getRoofList();
|
||||||
|
|
||||||
|
// 지붕재 시공사양 ID
|
||||||
|
String constructSpecifications = "";
|
||||||
|
// 지붕재 아이템 ID
|
||||||
|
String roofMaterialIds = "";
|
||||||
|
// 지붕재 공법 ID
|
||||||
|
String supportMethodIds = "";
|
||||||
|
// 지붕재 아이템명
|
||||||
|
String roofMaterialIdMultis = "";
|
||||||
|
// 지붕재 공법명
|
||||||
|
String supportMethodIdMultis = "";
|
||||||
|
// 지붕재 시공사양명
|
||||||
|
String constructSpecificationMultis = "";
|
||||||
|
// 가대 메이커명
|
||||||
|
String supportMeakers = "";
|
||||||
|
for (RoofRequest roofRequest : roofList) {
|
||||||
|
if (!StringUtils.isEmpty(roofRequest.getRoofMaterialId())) {
|
||||||
|
roofMaterialIds += !StringUtils.isEmpty(roofMaterialIds) ? splitStr : "";
|
||||||
|
roofMaterialIds += roofRequest.getRoofMaterialId();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!StringUtils.isEmpty(roofRequest.getSupportMethodId())) {
|
||||||
|
supportMethodIds += !StringUtils.isEmpty(supportMethodIds) ? splitStr : "";
|
||||||
|
supportMethodIds += roofRequest.getSupportMethodId();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!StringUtils.isEmpty(roofRequest.getConstructSpecification())) {
|
||||||
|
constructSpecifications +=
|
||||||
|
!StringUtils.isEmpty(constructSpecifications) ? splitStr : "";
|
||||||
|
constructSpecifications += roofRequest.getConstructSpecification();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!StringUtils.isEmpty(roofRequest.getRoofMaterialIdMulti())) {
|
||||||
|
roofMaterialIdMultis += !StringUtils.isEmpty(roofMaterialIdMultis) ? splitStr : "";
|
||||||
|
roofMaterialIdMultis += roofRequest.getRoofMaterialIdMulti();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!StringUtils.isEmpty(roofRequest.getSupportMethodIdMulti())) {
|
||||||
|
supportMethodIdMultis += !StringUtils.isEmpty(supportMethodIdMultis) ? splitStr : "";
|
||||||
|
supportMethodIdMultis += roofRequest.getSupportMethodIdMulti();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!StringUtils.isEmpty(roofRequest.getConstructSpecificationMulti())) {
|
||||||
|
constructSpecificationMultis +=
|
||||||
|
!StringUtils.isEmpty(constructSpecificationMultis) ? splitStr : "";
|
||||||
|
constructSpecificationMultis += roofRequest.getConstructSpecificationMulti();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!StringUtils.isEmpty(roofRequest.getSupportMeaker())) {
|
||||||
|
supportMeakers += !StringUtils.isEmpty(supportMeakers) ? splitStr : "";
|
||||||
|
supportMeakers += roofRequest.getSupportMeaker();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 지붕재 관련 데이터 셋팅
|
||||||
|
estimateRequest.setRoofMaterialId(roofMaterialIds);
|
||||||
|
estimateRequest.setSupportMethodId(supportMethodIds);
|
||||||
|
estimateRequest.setConstructSpecification(constructSpecifications);
|
||||||
|
estimateRequest.setRoofMaterialIdMulti(roofMaterialIdMultis);
|
||||||
|
estimateRequest.setSupportMethodIdMulti(supportMethodIdMultis);
|
||||||
|
estimateRequest.setConstructSpecificationMulti(constructSpecificationMultis);
|
||||||
|
estimateRequest.setSupportMeaker(supportMeakers);
|
||||||
|
|
||||||
|
// [3]. 아이템 관련 데이터 셋팅
|
||||||
|
String[] arrItemId = new String[itemList.size()];
|
||||||
|
int i = 0;
|
||||||
|
for (ItemRequest itemRequest : itemList) {
|
||||||
|
arrItemId[i++] = itemRequest.getItemId();
|
||||||
|
}
|
||||||
|
estimateRequest.setArrItemId(arrItemId);
|
||||||
|
// 아이템의 마스터 정보 및 정가 정보 조회
|
||||||
|
List<ItemResponse> itemResponseList = estimateMapper.selectItemMasterList(estimateRequest);
|
||||||
|
|
||||||
|
int j = 1;
|
||||||
|
for (ItemRequest itemRequest : itemList) {
|
||||||
|
itemRequest.setDispOrder(String.valueOf(j++));
|
||||||
|
|
||||||
|
for (ItemResponse itemResponse : itemResponseList) {
|
||||||
|
if (itemRequest.getItemId().equals(itemResponse.getItemId())) {
|
||||||
|
itemRequest.setItemNo(itemResponse.getItemNo());
|
||||||
|
itemRequest.setItemName(itemResponse.getItemName());
|
||||||
|
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());
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// [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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 아이템 목록 필수 값 체크
|
||||||
|
BigDecimal capacity = BigDecimal.ZERO;
|
||||||
|
String moduleModel = "";
|
||||||
|
String pcTypeNo = "";
|
||||||
|
for (ItemRequest itemRequest : itemList) {
|
||||||
|
if (StringUtils.isEmpty(itemRequest.getItemId())) {
|
||||||
|
throw new QcastException(
|
||||||
|
ErrorCode.INVALID_INPUT_VALUE,
|
||||||
|
message.getMessage("common.message.required.data", "Item ID"));
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(itemRequest.getAmount())) {
|
||||||
|
throw new QcastException(
|
||||||
|
ErrorCode.INVALID_INPUT_VALUE,
|
||||||
|
message.getMessage("common.message.required.data", "Item Amount"));
|
||||||
|
}
|
||||||
|
|
||||||
|
// 수량
|
||||||
|
BigDecimal amount =
|
||||||
|
new BigDecimal(
|
||||||
|
StringUtils.isEmpty(itemRequest.getAmount()) ? "0" : itemRequest.getAmount());
|
||||||
|
// 아이템용량
|
||||||
|
BigDecimal pnowW =
|
||||||
|
new BigDecimal(
|
||||||
|
StringUtils.isEmpty(itemRequest.getPnowW()) ? "0" : itemRequest.getPnowW());
|
||||||
|
|
||||||
|
// 모듈/PC 체크
|
||||||
|
if ("MODULE_".equals(itemRequest.getItemGroup())) {
|
||||||
|
moduleModel += !StringUtils.isEmpty(moduleModel) ? splitStr : "";
|
||||||
|
moduleModel += itemRequest.getItemNo();
|
||||||
|
|
||||||
|
capacity = capacity.add(amount.multiply(pnowW));
|
||||||
|
} else if ("PC_".equals(itemRequest.getItemGroup())) {
|
||||||
|
pcTypeNo += !StringUtils.isEmpty(pcTypeNo) ? splitStr : "";
|
||||||
|
pcTypeNo += itemRequest.getItemNo();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
estimateRequest.setCapacity(String.valueOf(capacity));
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 견적서 정보 수정
|
||||||
estimateRequest.setPriceCd("UNIT_PRICE");
|
estimateRequest.setPriceCd("UNIT_PRICE");
|
||||||
|
estimateMapper.updateEstimate(estimateRequest);
|
||||||
|
|
||||||
// 물건정보 조회 후 데이터 축출
|
// 도면 작성일 경우에만 지붕재 데이터 초기화 후 저장
|
||||||
ObjectResponse objectResponse =
|
if ("1".equals(estimateRequest.getDrawingFlg())) {
|
||||||
objectMapper.selectObjectDetail(estimateRequest.getObjectNo());
|
// 견적서 지붕면/아이템 제거
|
||||||
if (objectResponse != null) {
|
estimateMapper.deleteEstimateRoofList(estimateRequest);
|
||||||
estimateRequest.setWeatherPoint(
|
estimateMapper.deleteEstimateRoofItemList(estimateRequest);
|
||||||
objectResponse.getPrefName() + " - " + objectResponse.getAreaName());
|
|
||||||
estimateRequest.setCharger(objectResponse.getReceiveUser());
|
|
||||||
}
|
|
||||||
|
|
||||||
// [2]. 지붕재 관련 데이터 셋팅
|
// 견적서 지붕면/아이템 신규 추가
|
||||||
List<RoofRequest> roofList = estimateRequest.getRoofList();
|
for (RoofRequest roofRequest : roofList) {
|
||||||
|
roofRequest.setObjectNo(estimateRequest.getObjectNo());
|
||||||
|
roofRequest.setPlanNo(estimateRequest.getPlanNo());
|
||||||
|
roofRequest.setUserId(estimateRequest.getUserId());
|
||||||
|
|
||||||
// 지붕재 시공사양 ID
|
estimateMapper.insertEstimateRoof(roofRequest);
|
||||||
String constructSpecifications = "";
|
|
||||||
// 지붕재 아이템 ID
|
|
||||||
String roofMaterialIds = "";
|
|
||||||
// 지붕재 공법 ID
|
|
||||||
String supportMethodIds = "";
|
|
||||||
// 지붕재 아이템명
|
|
||||||
String roofMaterialIdMultis = "";
|
|
||||||
// 지붕재 공법명
|
|
||||||
String supportMethodIdMultis = "";
|
|
||||||
// 지붕재 시공사양명
|
|
||||||
String constructSpecificationMultis = "";
|
|
||||||
// 가대 메이커명
|
|
||||||
String supportMeakers = "";
|
|
||||||
for (RoofRequest roofRequest : roofList) {
|
|
||||||
if (!StringUtils.isEmpty(roofRequest.getRoofMaterialId())) {
|
|
||||||
roofMaterialIds += !StringUtils.isEmpty(roofMaterialIds) ? splitStr : "";
|
|
||||||
roofMaterialIds += roofRequest.getRoofMaterialId();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!StringUtils.isEmpty(roofRequest.getSupportMethodId())) {
|
List<ItemRequest> roofItemList = roofRequest.getRoofItemList();
|
||||||
supportMethodIds += !StringUtils.isEmpty(supportMethodIds) ? splitStr : "";
|
for (ItemRequest itemRequest : roofItemList) {
|
||||||
supportMethodIds += roofRequest.getSupportMethodId();
|
itemRequest.setObjectNo(estimateRequest.getObjectNo());
|
||||||
}
|
itemRequest.setPlanNo(estimateRequest.getPlanNo());
|
||||||
|
itemRequest.setRoofNo(roofRequest.getRoofNo());
|
||||||
|
|
||||||
if (!StringUtils.isEmpty(roofRequest.getConstructSpecification())) {
|
estimateMapper.insertEstimateRoofItem(itemRequest);
|
||||||
constructSpecifications += !StringUtils.isEmpty(constructSpecifications) ? splitStr : "";
|
|
||||||
constructSpecifications += roofRequest.getConstructSpecification();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!StringUtils.isEmpty(roofRequest.getRoofMaterialIdMulti())) {
|
|
||||||
roofMaterialIdMultis += !StringUtils.isEmpty(roofMaterialIdMultis) ? splitStr : "";
|
|
||||||
roofMaterialIdMultis += roofRequest.getRoofMaterialIdMulti();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!StringUtils.isEmpty(roofRequest.getSupportMethodIdMulti())) {
|
|
||||||
supportMethodIdMultis += !StringUtils.isEmpty(supportMethodIdMultis) ? splitStr : "";
|
|
||||||
supportMethodIdMultis += roofRequest.getSupportMethodIdMulti();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!StringUtils.isEmpty(roofRequest.getConstructSpecificationMulti())) {
|
|
||||||
constructSpecificationMultis +=
|
|
||||||
!StringUtils.isEmpty(constructSpecificationMultis) ? splitStr : "";
|
|
||||||
constructSpecificationMultis += roofRequest.getConstructSpecificationMulti();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!StringUtils.isEmpty(roofRequest.getSupportMeaker())) {
|
|
||||||
supportMeakers += !StringUtils.isEmpty(supportMeakers) ? splitStr : "";
|
|
||||||
supportMeakers += roofRequest.getSupportMeaker();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// 지붕재 관련 데이터 셋팅
|
|
||||||
estimateRequest.setRoofMaterialId(roofMaterialIds);
|
|
||||||
estimateRequest.setSupportMethodId(supportMethodIds);
|
|
||||||
estimateRequest.setConstructSpecification(constructSpecifications);
|
|
||||||
estimateRequest.setRoofMaterialIdMulti(roofMaterialIdMultis);
|
|
||||||
estimateRequest.setSupportMethodIdMulti(supportMethodIdMultis);
|
|
||||||
estimateRequest.setConstructSpecificationMulti(constructSpecificationMultis);
|
|
||||||
estimateRequest.setSupportMeaker(supportMeakers);
|
|
||||||
|
|
||||||
// [3]. 아이템 관련 데이터 셋팅
|
|
||||||
String[] arrItemId = new String[itemList.size()];
|
|
||||||
int i = 0;
|
|
||||||
for (ItemRequest itemRequest : itemList) {
|
|
||||||
arrItemId[i++] = itemRequest.getItemId();
|
|
||||||
}
|
|
||||||
estimateRequest.setArrItemId(arrItemId);
|
|
||||||
// 아이템의 마스터 정보 및 정가 정보 조회
|
|
||||||
List<ItemResponse> itemResponseList = estimateMapper.selectItemMasterList(estimateRequest);
|
|
||||||
|
|
||||||
int j = 1;
|
|
||||||
for (ItemRequest itemRequest : itemList) {
|
|
||||||
itemRequest.setDispOrder(String.valueOf(j++));
|
|
||||||
|
|
||||||
for (ItemResponse itemResponse : itemResponseList) {
|
|
||||||
if (itemRequest.getItemId().equals(itemResponse.getItemId())) {
|
|
||||||
itemRequest.setItemNo(itemResponse.getItemNo());
|
|
||||||
itemRequest.setItemName(itemResponse.getItemName());
|
|
||||||
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());
|
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// [4]. 견적특이사항 관련 데이터 셋팅
|
// 견적서 모든 아이템 제거
|
||||||
NoteRequest noteRequest = new NoteRequest();
|
estimateMapper.deleteEstimateItemList(estimateRequest);
|
||||||
noteRequest.setArrItemId(arrItemId);
|
|
||||||
noteRequest.setSchSpnTypeCd("COMM");
|
|
||||||
List<NoteResponse> noteList = estimateMapper.selectEstimateNoteList(noteRequest);
|
|
||||||
noteRequest.setSchSpnTypeCd("PROD");
|
|
||||||
List<NoteResponse> noteItemList = estimateMapper.selectEstimateNoteItemList(noteRequest);
|
|
||||||
|
|
||||||
// 견적특이사항 코드
|
// 견적서 아이템 신규 추가
|
||||||
String estimateOptions = "";
|
for (ItemRequest itemRequest : itemList) {
|
||||||
for (NoteResponse noteResponse : noteList) {
|
itemRequest.setObjectNo(estimateRequest.getObjectNo());
|
||||||
if ("ATTR001".equals(noteResponse.getCode())) {
|
itemRequest.setPlanNo(estimateRequest.getPlanNo());
|
||||||
estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : "";
|
itemRequest.setPartAdd(
|
||||||
estimateOptions += "ATTR001"; // 공통 필수체크
|
!StringUtils.isEmpty(itemRequest.getPartAdd()) ? itemRequest.getPartAdd() : "0");
|
||||||
} else if ("ATTR002".equals(noteResponse.getCode())) {
|
itemRequest.setItemChangeFlg(
|
||||||
estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : "";
|
!StringUtils.isEmpty(itemRequest.getItemChangeFlg())
|
||||||
estimateOptions += "ATTR002"; // YJOD 필수체크
|
? itemRequest.getItemChangeFlg()
|
||||||
} else if ("ATTR003".equals(noteResponse.getCode())) {
|
: "0");
|
||||||
estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : "";
|
itemRequest.setUserId(estimateRequest.getUserId());
|
||||||
estimateOptions += "ATTR003"; // 출력제어시간 기본 체크
|
|
||||||
} else if ("ATTR004".equals(noteResponse.getCode())
|
estimateMapper.insertEstimateItem(itemRequest);
|
||||||
&& "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) {
|
} catch (Exception e) {
|
||||||
estimateOptions += !StringUtils.isEmpty(estimateOptions) ? splitStr : "";
|
e.printStackTrace();
|
||||||
estimateOptions += noteResponse.getCode();
|
|
||||||
}
|
|
||||||
|
|
||||||
estimateRequest.setEstimateOption(estimateOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 아아템 목록 필수 값 체크
|
|
||||||
BigDecimal capacity = BigDecimal.ZERO;
|
|
||||||
String moduleModel = "";
|
|
||||||
String pcTypeNo = "";
|
|
||||||
for (ItemRequest itemRequest : itemList) {
|
|
||||||
if (StringUtils.isEmpty(itemRequest.getItemId())) {
|
|
||||||
throw new QcastException(
|
|
||||||
ErrorCode.INVALID_INPUT_VALUE,
|
|
||||||
message.getMessage("common.message.required.data", "Item ID"));
|
|
||||||
}
|
|
||||||
if (StringUtils.isEmpty(itemRequest.getAmount())) {
|
|
||||||
throw new QcastException(
|
|
||||||
ErrorCode.INVALID_INPUT_VALUE,
|
|
||||||
message.getMessage("common.message.required.data", "Item Amount"));
|
|
||||||
}
|
|
||||||
|
|
||||||
// 수량
|
|
||||||
BigDecimal amount =
|
|
||||||
new BigDecimal(
|
|
||||||
StringUtils.isEmpty(itemRequest.getAmount()) ? "0" : itemRequest.getAmount());
|
|
||||||
// 아이템용량
|
|
||||||
BigDecimal pnowW =
|
|
||||||
new BigDecimal(
|
|
||||||
StringUtils.isEmpty(itemRequest.getPnowW()) ? "0" : itemRequest.getPnowW());
|
|
||||||
|
|
||||||
// 모듈/PC 체크
|
|
||||||
if ("MODULE_".equals(itemRequest.getItemGroup())) {
|
|
||||||
moduleModel += !StringUtils.isEmpty(moduleModel) ? splitStr : "";
|
|
||||||
moduleModel += itemRequest.getItemNo();
|
|
||||||
|
|
||||||
capacity = capacity.add(amount.multiply(pnowW));
|
|
||||||
} else if ("PC_".equals(itemRequest.getItemGroup())) {
|
|
||||||
pcTypeNo += !StringUtils.isEmpty(pcTypeNo) ? splitStr : "";
|
|
||||||
pcTypeNo += itemRequest.getItemNo();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
estimateRequest.setCapacity(String.valueOf(capacity));
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
|
|
||||||
// 견적서 정보 수정
|
|
||||||
estimateRequest.setPriceCd("UNIT_PRICE");
|
|
||||||
estimateMapper.updateEstimate(estimateRequest);
|
|
||||||
|
|
||||||
// 견적서 모든 아이템 제거
|
|
||||||
estimateMapper.deleteEstimateItemList(estimateRequest);
|
|
||||||
|
|
||||||
// 견적서 아이템 신규 추가
|
|
||||||
for (ItemRequest itemRequest : itemList) {
|
|
||||||
itemRequest.setObjectNo(estimateRequest.getObjectNo());
|
|
||||||
itemRequest.setPlanNo(estimateRequest.getPlanNo());
|
|
||||||
itemRequest.setPartAdd(
|
|
||||||
!StringUtils.isEmpty(itemRequest.getPartAdd()) ? itemRequest.getPartAdd() : "0");
|
|
||||||
itemRequest.setItemChangeFlg(
|
|
||||||
!StringUtils.isEmpty(itemRequest.getItemChangeFlg())
|
|
||||||
? itemRequest.getItemChangeFlg()
|
|
||||||
: "0");
|
|
||||||
itemRequest.setUserId(estimateRequest.getUserId());
|
|
||||||
|
|
||||||
estimateMapper.insertEstimateItem(itemRequest);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
||||||
|
|
||||||
|
|||||||
@ -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;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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}
|
||||||
@ -272,7 +276,7 @@
|
|||||||
</update>
|
</update>
|
||||||
|
|
||||||
<insert id="insertEstimateItem" parameterType="com.interplug.qcast.biz.estimate.dto.ItemRequest">
|
<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
|
INSERT INTO T_PART_ESTIMATE
|
||||||
(
|
(
|
||||||
OBJECT_NO
|
OBJECT_NO
|
||||||
@ -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
|
||||||
|
|||||||
@ -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>
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user