발전시뮬레이션 물건번호 목록 조회 API 개발 #474

Merged
ysCha merged 2 commits from dev into dev-deploy 2026-04-21 17:53:02 +09:00
5 changed files with 144 additions and 1 deletions
Showing only changes of commit c725338809 - Show all commits

View File

@ -1,6 +1,7 @@
package com.interplug.qcast.biz.estimate;
import com.interplug.qcast.biz.estimate.dto.*;
import com.interplug.qcast.biz.object.dto.ObjectRequest;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.servlet.http.HttpServletRequest;
@ -111,7 +112,14 @@ public class EstimateController {
estimateService.deleteEstimate(estimateRequest);
}
@Operation(description = "발전시뮬레이션 필요 데이터 상세 조회를 조회한다.")
@Operation(description = "발전시뮬레이션 필요 데이터 목록을 조회한다.")
@GetMapping("/simulation-estimate-list")
@ResponseStatus(HttpStatus.OK)
public SimulationEstimateListResponse selectSimulationEstimateList(ObjectRequest objectRequest) throws Exception {
return estimateService.selectSimulationEstimateList(objectRequest);
}
@Operation(description = "발전시뮬레이션 필요 데이터 상세 정보를 조회한다.")
@GetMapping("/simulation-estimate-info")
@ResponseStatus(HttpStatus.OK)
public SimulationEstimateResponse selectSimulationEstimateInfo(EstimateRequest estimateRequest) throws Exception {

View File

@ -2,6 +2,9 @@ package com.interplug.qcast.biz.estimate;
import com.interplug.qcast.biz.estimate.dto.*;
import java.util.List;
import com.interplug.qcast.biz.object.dto.ObjectRequest;
import com.interplug.qcast.biz.object.dto.ObjectResponse;
import org.apache.ibatis.annotations.Mapper;
@Mapper
@ -153,6 +156,9 @@ public interface EstimateMapper {
public int insertCanvasPopupStatusCopy(EstimateCopyRequest estimateCopyRequest);
// 발전시뮬레이션 물건번호 목록 조회
public List<ObjectResponse> selectSimulationEstimateList(ObjectRequest objectRequest);
// 발전시뮬레이션 지붕재 목록 조회
public List<SimulationRoofResponse> selectSimulationEstimateRoofList(EstimateRequest estimateRequest);

View File

@ -3164,6 +3164,34 @@ public class EstimateService {
}
}
/**
* 발전시뮬레이션 견적서 목록 조회
*
* @param objectRequest 견적서 정보(물건번호, 플랜번호)
* @return EstimateResponse 견적서 상세 정보
* @throws Exception
*/
public SimulationEstimateListResponse selectSimulationEstimateList(ObjectRequest objectRequest) throws Exception {
// Validation
if (StringUtils.isEmpty(objectRequest.getSaleStoreId())) {
throw new QcastException(ErrorCode.INVALID_INPUT_VALUE,
message.getMessage("common.message.required.data", "Sales Store ID"));
}
SimulationEstimateListResponse response = new SimulationEstimateListResponse();
// 견적서 목록 조회
List<ObjectResponse> objectList = estimateMapper.selectSimulationEstimateList(objectRequest);
if (objectList == null) {
throw new QcastException(ErrorCode.NOT_FOUND, message.getMessage("common.message.no.data"));
} else {
response.setObjectList(objectList);
}
return response;
}
/**
* 발전시뮬레이션 견적서 상세 조회
*

View File

@ -0,0 +1,13 @@
package com.interplug.qcast.biz.estimate.dto;
import com.interplug.qcast.biz.object.dto.ObjectResponse;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;
import java.util.List;
@Data
public class SimulationEstimateListResponse {
@Schema(description = "물건정보 목록")
List<ObjectResponse> objectList;
}

View File

@ -1544,6 +1544,94 @@
AND PLAN_NO = #{planNo}
</update>
<select id="selectSimulationEstimateList" parameterType="com.interplug.qcast.biz.object.dto.ObjectRequest" resultType="com.interplug.qcast.biz.object.dto.ObjectResponse">
/* sqlid : com.interplug.qcast.biz.estimate.selectSimulationEstimateList */
<if test='(saleStoreId != null and saleStoreId != "T01") or (schSelSaleStoreId != null and schSelSaleStoreId != "")'>
/* 계층형 구조에 맞는 SALE_STORE_ID 축출 - 재귀함수 */
WITH SALES_STORE_CTE AS (
SELECT
SALE_STORE_ID
, SALE_STORE_LEVEL
, PARENT_SALE_AGENT_ID
FROM M_SALES_STORE WITH(NOLOCK)
WHERE APPROVE_FLG = '2'
AND DEL_FLG = '0'
<choose>
<when test='schSelSaleStoreId != null and schSelSaleStoreId != ""'>
AND SALE_STORE_ID = #{schSelSaleStoreId}
</when>
<otherwise>
AND SALE_STORE_ID = #{saleStoreId}
</otherwise>
</choose>
UNION ALL
SELECT
A.SALE_STORE_ID
, A.SALE_STORE_LEVEL
, A.PARENT_SALE_AGENT_ID
FROM M_SALES_STORE A WITH(NOLOCK)
INNER JOIN SALES_STORE_CTE B
ON A.PARENT_SALE_AGENT_ID = B.SALE_STORE_ID
WHERE A.APPROVE_FLG = '2'
AND A.DEL_FLG = '0'
)
</if>
SELECT
TT.*
FROM
(
SELECT
COUNT(1) OVER() AS TOT_CNT
, ROW_NUMBER() OVER(ORDER BY O.OBJECT_NO DESC, P.PLAN_NO) AS ROW_NUMBER
, O.OBJECT_NO
, O.OBJECT_NAME
, O.SALE_STORE_ID
, S.SALE_STORE_NAME
, P.PLAN_NO
, P.LAST_EDIT_DATETIME
, ISNULL(SP.PREF_NAME, '') AS PREF_NAME
FROM T_OBJECT O WITH (NOLOCK)
INNER JOIN T_OBJECT_INFO OI WITH (NOLOCK)
ON O.OBJECT_NO = OI.OBJECT_NO
INNER JOIN M_SALES_STORE S WITH (NOLOCK)
ON O.SALE_STORE_ID = S.SALE_STORE_ID
INNER JOIN T_PLAN P WITH (NOLOCK)
ON O.OBJECT_NO = P.OBJECT_NO
<if test='(saleStoreId != null and saleStoreId != "T01") or (schSelSaleStoreId != null and schSelSaleStoreId != "")'>
INNER JOIN SALES_STORE_CTE T
ON S.SALE_STORE_ID = T.SALE_STORE_ID
</if>
LEFT OUTER JOIN T_SIMULATION_PREFECTURE SP
ON O.PREF_ID = SP.PREF_ID
WHERE OI.SOURCE_ORIGIN = 'QCAST_III'
AND (OI.ORG_DEL_FLG = '0' AND OI.TEMP_FLG = '0')
AND P.DEL_FLG = '0'
<if test='schObjectNo != null and schObjectNo != ""'>
AND O.OBJECT_NO LIKE '%' + #{schObjectNo} + '%'
</if>
<if test='schSaleStoreId != null and schSaleStoreId != ""'>
AND O.SALE_STORE_ID = #{schSaleStoreId}
</if>
<if test='schOtherSelSaleStoreId != null and schOtherSelSaleStoreId != ""'>
/* 2차점까지 고름 */
AND O.SALE_STORE_ID = #{schOtherSelSaleStoreId}
</if>
<if test='schObjectName != null and schObjectName != ""'>
AND O.OBJECT_NAME LIKE '%' + #{schObjectName} + '%'
</if>
<if test='schAddress != null and schAddress != ""'>
AND SP.PREF_NAME LIKE '%' + #{schAddress} + '%'
</if>
) TT
<if test='startRow != null and startRow != "" and endRow != null and endRow != ""'>
WHERE TT.ROW_NUMBER BETWEEN #{startRow} AND #{endRow}
</if>
ORDER BY TT.ROW_NUMBER
</select>
<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