판매점 목록 검색 API 수정
This commit is contained in:
parent
87dcbea638
commit
33628655a9
@ -1,16 +1,5 @@
|
||||
package com.interplug.qcast.biz.object;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import com.interplug.qcast.biz.object.dto.ObjectRequest;
|
||||
import com.interplug.qcast.biz.object.dto.ObjectResponse;
|
||||
import com.interplug.qcast.biz.object.dto.PlanReqRequest;
|
||||
@ -24,8 +13,19 @@ import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.PutMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.ResponseStatus;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
@ -57,12 +57,20 @@ public class ObjectController {
|
||||
return objectService.selectWindSpeedList(city);
|
||||
}
|
||||
|
||||
@Operation(description = "1차점 판매점 목록을 조회한다.")
|
||||
@GetMapping("/saleStore/{saleStoreId}/firstList")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public List<SaleStoreResponse> selectFirstSaleStoreList(
|
||||
@PathVariable String saleStoreId, String userId) throws Exception {
|
||||
return objectService.selectFirstSaleStoreList(saleStoreId, userId);
|
||||
}
|
||||
|
||||
@Operation(description = "판매점 목록을 조회한다.")
|
||||
@GetMapping("/saleStore/{saleStoreId}/list")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public List<SaleStoreResponse> selectSaleStoreList(@PathVariable String saleStoreId,
|
||||
String userId) throws Exception {
|
||||
return objectService.selectSaleStoreList(saleStoreId, userId);
|
||||
public List<SaleStoreResponse> selectSaleStoreList(
|
||||
@PathVariable String saleStoreId, String firstFlg) throws Exception {
|
||||
return objectService.selectSaleStoreList(saleStoreId, firstFlg);
|
||||
}
|
||||
|
||||
@Operation(description = "물건정보 목록을 조회한다.")
|
||||
@ -131,8 +139,12 @@ public class ObjectController {
|
||||
@Operation(description = "견적서 파일을 다운로드한다.")
|
||||
@PostMapping("/file/{objectNo}/{no}")
|
||||
@ResponseStatus(HttpStatus.OK)
|
||||
public void fileDownload(HttpServletRequest request, HttpServletResponse response,
|
||||
@PathVariable String objectNo, @PathVariable String no) throws Exception {
|
||||
public void fileDownload(
|
||||
HttpServletRequest request,
|
||||
HttpServletResponse response,
|
||||
@PathVariable String objectNo,
|
||||
@PathVariable String no)
|
||||
throws Exception {
|
||||
|
||||
UploadRequest uploadRequest = new UploadRequest();
|
||||
uploadRequest.setObjectNo(objectNo);
|
||||
|
||||
@ -16,10 +16,10 @@ public interface ObjectMapper {
|
||||
public List<WindSpeedResponse> selectWindSpeedList(String city);
|
||||
|
||||
// 모든 판매점 목록 조회
|
||||
public List<SaleStoreResponse> selectSaleStoreAllList();
|
||||
public List<SaleStoreResponse> selectSaleStoreFirstList();
|
||||
|
||||
// 판매점 목록 조회
|
||||
public List<SaleStoreResponse> selectSaleStoreList(String saleStoreId);
|
||||
public List<SaleStoreResponse> selectSaleStoreList(String saleStoreId, String firstFlg);
|
||||
|
||||
// 판매점 정보 조회
|
||||
public SaleStoreResponse selectSaleStoreInfo(String saleStoreId);
|
||||
|
||||
@ -1,25 +1,5 @@
|
||||
package com.interplug.qcast.biz.object;
|
||||
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
import com.fasterxml.jackson.databind.DeserializationFeature;
|
||||
import com.interplug.qcast.biz.object.dto.ObjectRequest;
|
||||
import com.interplug.qcast.biz.object.dto.ObjectResponse;
|
||||
@ -42,8 +22,28 @@ import com.interplug.qcast.util.InterfaceQsp;
|
||||
import io.micrometer.common.util.StringUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.io.BufferedInputStream;
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.io.InputStream;
|
||||
import java.net.URLConnection;
|
||||
import java.net.URLEncoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.RandomStringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.http.HttpMethod;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.FileCopyUtils;
|
||||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
@ -75,14 +75,14 @@ public class ObjectService {
|
||||
return objectMapper.selectWindSpeedList(city);
|
||||
}
|
||||
|
||||
public List<SaleStoreResponse> selectSaleStoreList(String saleStoreId, String userId)
|
||||
public List<SaleStoreResponse> selectFirstSaleStoreList(String saleStoreId, String userId)
|
||||
throws Exception {
|
||||
|
||||
// [0]. 판매점 목록 조회
|
||||
List<SaleStoreResponse> storeList = new ArrayList<SaleStoreResponse>();
|
||||
|
||||
if ("T01".equals(saleStoreId)) {
|
||||
storeList = objectMapper.selectSaleStoreAllList();
|
||||
storeList = objectMapper.selectSaleStoreFirstList();
|
||||
|
||||
// [1]. 판매점 목록 조회 결과
|
||||
if (storeList.size() > 0) {
|
||||
@ -106,6 +106,7 @@ public class ObjectService {
|
||||
String favStoreId = (String) storeFavorite.get("storeId");
|
||||
if (storeId.equals(favStoreId)) {
|
||||
saleStore.setPriority("A" + (String) storeFavorite.get("priority"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -113,18 +114,24 @@ public class ObjectService {
|
||||
storeList.sort(Comparator.comparing(SaleStoreResponse::getPriority));
|
||||
}
|
||||
} else {
|
||||
throw new QcastException(ErrorCode.INTERNAL_SERVER_ERROR,
|
||||
(String) result.get("resultMsg"));
|
||||
throw new QcastException(
|
||||
ErrorCode.INTERNAL_SERVER_ERROR, (String) result.get("resultMsg"));
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
storeList = objectMapper.selectSaleStoreList(saleStoreId);
|
||||
}
|
||||
|
||||
return storeList;
|
||||
}
|
||||
|
||||
public List<SaleStoreResponse> selectSaleStoreList(String saleStoreId, String firstFlg)
|
||||
throws Exception {
|
||||
// [0]. 판매점 목록 조회
|
||||
List<SaleStoreResponse> storeList = new ArrayList<SaleStoreResponse>();
|
||||
storeList = objectMapper.selectSaleStoreList(saleStoreId, firstFlg);
|
||||
|
||||
return storeList;
|
||||
}
|
||||
|
||||
public SaleStoreResponse selectSaleStoreInfo(String saleStoreId) throws Exception {
|
||||
return objectMapper.selectSaleStoreInfo(saleStoreId);
|
||||
}
|
||||
|
||||
@ -33,8 +33,8 @@
|
||||
ORDER BY A.STANDARD_WIND_SPEED_ID ASC, A.CITY ASC
|
||||
</select>
|
||||
|
||||
<select id="selectSaleStoreAllList" resultType="com.interplug.qcast.biz.object.dto.SaleStoreResponse">
|
||||
/* sqlid : com.interplug.qcast.biz.object.selectSaleStoreList */
|
||||
<select id="selectSaleStoreFirstList" resultType="com.interplug.qcast.biz.object.dto.SaleStoreResponse">
|
||||
/* sqlid : com.interplug.qcast.biz.object.selectSaleStoreFirstList */
|
||||
SELECT
|
||||
CASE WHEN SALE_STORE_LEVEL = '1' THEN 'Y' ELSE 'N' END AS FIRST_AGENT_YN
|
||||
, SALE_STORE_ID
|
||||
@ -44,6 +44,7 @@
|
||||
FROM M_SALES_STORE WITH(NOLOCK)
|
||||
WHERE APPROVE_FLG = '2'
|
||||
AND DEL_FLG = '0'
|
||||
AND SALE_STORE_LEVEL = '1'
|
||||
ORDER BY SALE_STORE_LEVEL ASC, SALE_STORE_ID ASC
|
||||
</select>
|
||||
|
||||
@ -74,6 +75,7 @@
|
||||
AND A.DEL_FLG = '0'
|
||||
)
|
||||
|
||||
<if test='firstFlg != null and firstFlg == "1"'>
|
||||
SELECT
|
||||
'Y' AS FIRST_AGENT_YN
|
||||
, A.SALE_STORE_ID
|
||||
@ -85,6 +87,7 @@
|
||||
AND APPROVE_FLG = '2'
|
||||
AND DEL_FLG = '0'
|
||||
UNION ALL
|
||||
</if>
|
||||
SELECT
|
||||
CASE WHEN SALE_STORE_LEVEL = '1' THEN 'Y' ELSE 'N' END AS FIRST_AGENT_YN
|
||||
, A.SALE_STORE_ID
|
||||
@ -92,6 +95,9 @@
|
||||
, A.SALE_STORE_LEVEL
|
||||
, A.FIRST_AGENT_ID
|
||||
FROM SALES_STORE_CTE A
|
||||
<if test='firstFlg != null and firstFlg == "1"'>
|
||||
WHERE A.SALE_STORE_LEVEL <![CDATA[ <> ]]> '1'
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="selectSaleStoreInfo" parameterType="String" resultType="com.interplug.qcast.biz.object.dto.SaleStoreResponse">
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user