발전시뮬레이션 관련 견적서 조회 API 개발 #449
@ -110,4 +110,11 @@ public class EstimateController {
|
|||||||
public void deleteEstimate(@RequestBody EstimateRequest estimateRequest) throws Exception {
|
public void deleteEstimate(@RequestBody EstimateRequest estimateRequest) throws Exception {
|
||||||
estimateService.deleteEstimate(estimateRequest);
|
estimateService.deleteEstimate(estimateRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Operation(description = "발전시뮬레이션 필요 데이터 상세 조회를 조회한다.")
|
||||||
|
@GetMapping("/simulation-estimate-info")
|
||||||
|
@ResponseStatus(HttpStatus.OK)
|
||||||
|
public SimulationEstimateResponse selectSimulationEstimateInfo(EstimateRequest estimateRequest) throws Exception {
|
||||||
|
return estimateService.selectSimulationEstimateInfo(estimateRequest);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -152,4 +152,13 @@ public interface EstimateMapper {
|
|||||||
public int updateEstimateInfoInit(EstimateRequest estimateRequest);
|
public int updateEstimateInfoInit(EstimateRequest estimateRequest);
|
||||||
|
|
||||||
public int insertCanvasPopupStatusCopy(EstimateCopyRequest estimateCopyRequest);
|
public int insertCanvasPopupStatusCopy(EstimateCopyRequest estimateCopyRequest);
|
||||||
|
|
||||||
|
// 발전시뮬레이션 지붕재 목록 조회
|
||||||
|
public List<SimulationRoofResponse> selectSimulationEstimateRoofList(EstimateRequest estimateRequest);
|
||||||
|
|
||||||
|
// 발전시뮬레이션 지붕재 아이템 목록 조회
|
||||||
|
public List<SimulationItemResponse> selectSimulationEstimateRoofModuleList(EstimateRequest estimateRequest);
|
||||||
|
|
||||||
|
// 발전시뮬레이션 지붕재 아이템 목록 조회
|
||||||
|
public List<SimulationItemResponse> selectSimulationEstimateRoofPcsList(EstimateRequest estimateRequest);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -18,6 +18,7 @@ import java.util.stream.Collectors;
|
|||||||
|
|
||||||
import com.interplug.qcast.biz.canvaspopupstatus.CanvasPopupStatusService;
|
import com.interplug.qcast.biz.canvaspopupstatus.CanvasPopupStatusService;
|
||||||
import com.interplug.qcast.biz.canvaspopupstatus.dto.CanvasPopupStatus;
|
import com.interplug.qcast.biz.canvaspopupstatus.dto.CanvasPopupStatus;
|
||||||
|
import com.interplug.qcast.biz.estimate.dto.*;
|
||||||
import com.interplug.qcast.biz.pwrGnrSimulation.dto.PwrGnrSimRoofResponse;
|
import com.interplug.qcast.biz.pwrGnrSimulation.dto.PwrGnrSimRoofResponse;
|
||||||
import org.apache.commons.lang3.StringEscapeUtils;
|
import org.apache.commons.lang3.StringEscapeUtils;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@ -41,21 +42,6 @@ import org.springframework.web.util.UriComponentsBuilder;
|
|||||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||||
import com.interplug.qcast.biz.canvasStatus.CanvasStatusService;
|
import com.interplug.qcast.biz.canvasStatus.CanvasStatusService;
|
||||||
import com.interplug.qcast.biz.canvasStatus.dto.CanvasStatusCopyRequest;
|
import com.interplug.qcast.biz.canvasStatus.dto.CanvasStatusCopyRequest;
|
||||||
import com.interplug.qcast.biz.estimate.dto.EstimateApiResponse;
|
|
||||||
import com.interplug.qcast.biz.estimate.dto.EstimateCopyRequest;
|
|
||||||
import com.interplug.qcast.biz.estimate.dto.EstimateRequest;
|
|
||||||
import com.interplug.qcast.biz.estimate.dto.EstimateResponse;
|
|
||||||
import com.interplug.qcast.biz.estimate.dto.EstimateSendRequest;
|
|
||||||
import com.interplug.qcast.biz.estimate.dto.EstimateSendResponse;
|
|
||||||
import com.interplug.qcast.biz.estimate.dto.ItemRequest;
|
|
||||||
import com.interplug.qcast.biz.estimate.dto.ItemResponse;
|
|
||||||
import com.interplug.qcast.biz.estimate.dto.NoteRequest;
|
|
||||||
import com.interplug.qcast.biz.estimate.dto.NoteResponse;
|
|
||||||
import com.interplug.qcast.biz.estimate.dto.PlanSyncResponse;
|
|
||||||
import com.interplug.qcast.biz.estimate.dto.PriceRequest;
|
|
||||||
import com.interplug.qcast.biz.estimate.dto.RoofInfoResponse;
|
|
||||||
import com.interplug.qcast.biz.estimate.dto.RoofRequest;
|
|
||||||
import com.interplug.qcast.biz.estimate.dto.RoofResponse;
|
|
||||||
import com.interplug.qcast.biz.file.FileMapper;
|
import com.interplug.qcast.biz.file.FileMapper;
|
||||||
import com.interplug.qcast.biz.file.dto.FileRequest;
|
import com.interplug.qcast.biz.file.dto.FileRequest;
|
||||||
import com.interplug.qcast.biz.file.dto.FileResponse;
|
import com.interplug.qcast.biz.file.dto.FileResponse;
|
||||||
@ -3013,4 +2999,62 @@ public class EstimateService {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 발전시뮬레이션 견적서 상세 조회
|
||||||
|
*
|
||||||
|
* @param estimateRequest 견적서 정보(물건번호, 플랜번호)
|
||||||
|
* @return EstimateResponse 견적서 상세 정보
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public SimulationEstimateResponse selectSimulationEstimateInfo(EstimateRequest estimateRequest) throws Exception {
|
||||||
|
// Validation
|
||||||
|
if (StringUtils.isEmpty(estimateRequest.getObjectNo())) {
|
||||||
|
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||||
|
message.getMessage("common.message.required.data", "Object No"));
|
||||||
|
}
|
||||||
|
if (StringUtils.isEmpty(estimateRequest.getPlanNo())) {
|
||||||
|
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
|
||||||
|
message.getMessage("common.message.required.data", "Plan No"));
|
||||||
|
}
|
||||||
|
|
||||||
|
SimulationEstimateResponse response = new SimulationEstimateResponse();
|
||||||
|
|
||||||
|
// 견적서 상세 조회
|
||||||
|
EstimateResponse estimateResponse = estimateMapper.selectEstimateDetail(estimateRequest);
|
||||||
|
|
||||||
|
if (estimateResponse == null) {
|
||||||
|
throw new QcastException(ErrorCode.NOT_FOUND, message.getMessage("common.message.no.data"));
|
||||||
|
} else {
|
||||||
|
|
||||||
|
// 지역코드 셋팅
|
||||||
|
response.setObjectNo(estimateRequest.getObjectNo());
|
||||||
|
response.setPlanNo(estimateRequest.getPlanNo());
|
||||||
|
response.setAreaId(estimateResponse.getAreaId());
|
||||||
|
|
||||||
|
// 지붕면 정보 목록 조회
|
||||||
|
List<SimulationRoofResponse> roofList = estimateMapper.selectSimulationEstimateRoofList(estimateRequest);
|
||||||
|
// 지붕면 설치 모듈 정보 목록 조회
|
||||||
|
List<SimulationItemResponse> roofModuleList = estimateMapper.selectSimulationEstimateRoofModuleList(estimateRequest);
|
||||||
|
|
||||||
|
// roofModuleList roofSurfaceId 기준으로 그룹핑
|
||||||
|
Map<String, List<SimulationItemResponse>> roofItemMap = roofModuleList.stream()
|
||||||
|
.collect(Collectors.groupingBy(SimulationItemResponse::getRoofSurfaceId));
|
||||||
|
|
||||||
|
// roofList 각 항목에 매핑된 roofModuleList 세팅
|
||||||
|
roofList.forEach(roof ->
|
||||||
|
roof.setRoofModuleList(
|
||||||
|
roofItemMap.getOrDefault(roof.getRoofSurfaceId(), Collections.emptyList())
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
// 지붕면 설치 PCS 목록 조회
|
||||||
|
List<SimulationItemResponse> pcsList = estimateMapper.selectSimulationEstimateRoofPcsList(estimateRequest);
|
||||||
|
|
||||||
|
response.setRoofList(roofList);
|
||||||
|
response.setPcsList(pcsList);
|
||||||
|
}
|
||||||
|
|
||||||
|
return response;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -215,6 +215,9 @@ public class EstimateResponse {
|
|||||||
@Schema(description = "하위 판매점명")
|
@Schema(description = "하위 판매점명")
|
||||||
private String agencySaleStoreName;
|
private String agencySaleStoreName;
|
||||||
|
|
||||||
|
@Schema(description = "지역코드")
|
||||||
|
private String areaId;
|
||||||
|
|
||||||
@Schema(description = "한랭지 대책여부")
|
@Schema(description = "한랭지 대책여부")
|
||||||
private String coldRegionFlg;
|
private String coldRegionFlg;
|
||||||
|
|
||||||
|
|||||||
@ -0,0 +1,24 @@
|
|||||||
|
package com.interplug.qcast.biz.estimate.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SimulationEstimateResponse {
|
||||||
|
@Schema(description = "물건번호")
|
||||||
|
private String objectNo;
|
||||||
|
|
||||||
|
@Schema(description = "플랜번호")
|
||||||
|
private String planNo;
|
||||||
|
|
||||||
|
@Schema(description = "지역코드")
|
||||||
|
private String areaId;
|
||||||
|
|
||||||
|
@Schema(description = "지붕면 정보 목록")
|
||||||
|
List<SimulationRoofResponse> roofList;
|
||||||
|
|
||||||
|
@Schema(description = "PCS 정보 목록")
|
||||||
|
List<SimulationItemResponse> pcsList;
|
||||||
|
}
|
||||||
@ -0,0 +1,25 @@
|
|||||||
|
package com.interplug.qcast.biz.estimate.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
// @Data
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class SimulationItemResponse {
|
||||||
|
@Schema(description = "지붕면 ID")
|
||||||
|
private String roofSurfaceId;
|
||||||
|
|
||||||
|
@Schema(description = "아이템 아이디")
|
||||||
|
private String itemId;
|
||||||
|
|
||||||
|
@Schema(description = "아이템 번호")
|
||||||
|
private String itemNo;
|
||||||
|
|
||||||
|
@Schema(description = "아이템명")
|
||||||
|
private String itemName;
|
||||||
|
|
||||||
|
@Schema(description = "매수")
|
||||||
|
private String amount;
|
||||||
|
}
|
||||||
@ -0,0 +1,30 @@
|
|||||||
|
package com.interplug.qcast.biz.estimate.dto;
|
||||||
|
|
||||||
|
import io.swagger.v3.oas.annotations.media.Schema;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
// @Data
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
public class SimulationRoofResponse {
|
||||||
|
@Schema(description = "지붕면 ID")
|
||||||
|
private String roofSurfaceId;
|
||||||
|
|
||||||
|
@Schema(description = "지붕면")
|
||||||
|
private String roofSurface;
|
||||||
|
|
||||||
|
@Schema(description = "경사")
|
||||||
|
private String slope;
|
||||||
|
|
||||||
|
@Schema(description = "각도")
|
||||||
|
private String angle;
|
||||||
|
|
||||||
|
@Schema(description = "방위각")
|
||||||
|
private String azimuth;
|
||||||
|
|
||||||
|
@Schema(description = "지붕면 모듈 정보 목록")
|
||||||
|
List<SimulationItemResponse> roofModuleList;
|
||||||
|
}
|
||||||
@ -63,6 +63,7 @@
|
|||||||
, O.SALE_STORE_ID
|
, O.SALE_STORE_ID
|
||||||
, B.SALE_STORE_ID AS SAP_SALE_STORE_ID
|
, B.SALE_STORE_ID AS SAP_SALE_STORE_ID
|
||||||
, B.SAP_SALES_STORE_CD
|
, B.SAP_SALES_STORE_CD
|
||||||
|
, OI.AREA_ID
|
||||||
, ISNULL(OI.COLD_REGION_FLG, '0') AS COLD_REGION_FLG
|
, ISNULL(OI.COLD_REGION_FLG, '0') AS COLD_REGION_FLG
|
||||||
, ISNULL(OI.SALT_AREA_FLG, '0') AS SALT_AREA_FLG
|
, ISNULL(OI.SALT_AREA_FLG, '0') AS SALT_AREA_FLG
|
||||||
, SS.FIRST_AGENT_ID
|
, SS.FIRST_AGENT_ID
|
||||||
@ -1543,4 +1544,45 @@
|
|||||||
AND PLAN_NO = #{planNo}
|
AND PLAN_NO = #{planNo}
|
||||||
</update>
|
</update>
|
||||||
|
|
||||||
|
<select id="selectSimulationEstimateRoofList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.SimulationRoofResponse">
|
||||||
|
/* sqlid : com.interplug.qcast.biz.estimate.selectSimulationEstimateRoofList */
|
||||||
|
SELECT
|
||||||
|
RE.ROOF_SURFACE_ID
|
||||||
|
, RE.OBJECT_NO
|
||||||
|
, RE.PLAN_NO
|
||||||
|
, RE.ROOF_SURFACE
|
||||||
|
, RE.SLOPE
|
||||||
|
, RE.ANGLE
|
||||||
|
, RE.AZIMUTH
|
||||||
|
FROM T_PART_ROOF_ESTIMATE RE WITH (NOLOCK)
|
||||||
|
WHERE RE.OBJECT_NO = #{objectNo}
|
||||||
|
AND RE.PLAN_NO = #{planNo}
|
||||||
|
ORDER BY RE.ROOF_SURFACE_ID
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectSimulationEstimateRoofModuleList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.SimulationItemResponse">
|
||||||
|
/* sqlid : com.interplug.qcast.biz.estimate.selectSimulationEstimateRoofModuleList */
|
||||||
|
SELECT
|
||||||
|
PIE.ROOF_SURFACE_ID
|
||||||
|
, PIE.ITEM_ID
|
||||||
|
, PIE.ITEM_NO
|
||||||
|
, PIE.ITEM_NAME
|
||||||
|
, SUM(AMOUNT) AS AMOUNT
|
||||||
|
FROM T_PART_ROOF_ITEM_ESTIMATE PIE WITH (NOLOCK)
|
||||||
|
WHERE PIE.OBJECT_NO = #{objectNo}
|
||||||
|
AND PIE.PLAN_NO = #{planNo}
|
||||||
|
GROUP BY PIE.ROOF_SURFACE_ID, PIE.ITEM_ID , PIE.ITEM_NO, PIE.ITEM_NAME
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectSimulationEstimateRoofPcsList" parameterType="com.interplug.qcast.biz.estimate.dto.EstimateRequest" resultType="com.interplug.qcast.biz.estimate.dto.SimulationItemResponse">
|
||||||
|
/* sqlid : com.interplug.qcast.biz.estimate.selectSimulationEstimateRoofPcsList */
|
||||||
|
SELECT
|
||||||
|
CIE.ITEM_ID
|
||||||
|
, COUNT(1) AS AMOUNT
|
||||||
|
FROM T_PART_CIRCUIT_ITEM_ESTIMATE CIE WITH (NOLOCK)
|
||||||
|
WHERE CIE.OBJECT_NO = #{objectNo}
|
||||||
|
AND CIE.PLAN_NO = #{planNo}
|
||||||
|
GROUP BY CIE.ITEM_ID
|
||||||
|
</select>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
Loading…
x
Reference in New Issue
Block a user