qcast-api/src/main/java/com/interplug/qcast/biz/estimate/EstimateController.java

107 lines
4.2 KiB
Java

package com.interplug.qcast.biz.estimate;
import com.interplug.qcast.biz.estimate.dto.*;
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.*;
@Slf4j
@RestController
@RequestMapping("/api/estimate")
@RequiredArgsConstructor
@Tag(name = "EstimateController", description = "견적서 관련 API")
public class EstimateController {
private final EstimateService estimateService;
@Operation(description = "1차점 가격 관리 목록을 조회한다.")
@GetMapping("/price/store-price-list")
@ResponseStatus(HttpStatus.OK)
public EstimateApiResponse selectStorePriceList(PriceRequest priceRequest) throws Exception {
return estimateService.selectStorePriceList(priceRequest);
}
@Operation(description = "아이템 가격 목록을 조회한다.")
@PostMapping("/price/item-price-list")
@ResponseStatus(HttpStatus.OK)
public EstimateApiResponse selectItemPriceList(@RequestBody PriceRequest priceRequest)
throws Exception {
return estimateService.selectItemPriceList(priceRequest);
}
@Operation(description = "견적서 특이사항 타이틀 목록을 조회한다.")
@GetMapping("/special-note-title-list")
@ResponseStatus(HttpStatus.OK)
public List<NoteResponse> selectSpecialNoteTitleList(NoteRequest noteRequest) throws Exception {
return estimateService.selectSpecialNoteTitleList(noteRequest);
}
@Operation(description = "견적서 특이사항 목록을 조회한다.")
@GetMapping("/special-note-list")
@ResponseStatus(HttpStatus.OK)
public List<NoteResponse> selectSpecialNoteList(NoteRequest noteRequest) throws Exception {
return estimateService.selectSpecialNoteList(noteRequest);
}
@Operation(description = "견적서 상세를 조회한다.")
@GetMapping("/{objectNo}/{planNo}/detail")
@ResponseStatus(HttpStatus.OK)
public EstimateResponse selectEstimateDetail(
@PathVariable String objectNo, @PathVariable String planNo) throws Exception {
return estimateService.selectEstimateDetail(objectNo, planNo);
}
@Operation(description = "견적서를 저장한다.")
@PostMapping("/save-estimate")
@ResponseStatus(HttpStatus.CREATED)
public void insertEstimate(@RequestBody EstimateRequest estimateRequest) throws Exception {
estimateService.insertEstimate(estimateRequest);
}
@Operation(description = "견적서를 복사한다.")
@PostMapping("/save-estimate-copy")
@ResponseStatus(HttpStatus.CREATED)
public EstimateResponse insertEstimateCopy(@RequestBody EstimateCopyRequest estimateCopyRequest)
throws Exception {
return estimateService.insertEstimateCopy(estimateCopyRequest);
}
@Operation(description = "견적서를 초기화한다.")
@PostMapping("/reset-estimate")
@ResponseStatus(HttpStatus.CREATED)
public EstimateResponse updateEstimateReset(@RequestBody EstimateRequest estimateRequest)
throws Exception {
return estimateService.updateEstimateReset(estimateRequest);
}
@Operation(description = "견적서 잠금여부를 저장한다.")
@PostMapping("/save-estimate-lock")
@ResponseStatus(HttpStatus.CREATED)
public void updateEstimateLock(@RequestBody EstimateRequest estimateRequest) throws Exception {
estimateService.updateEstimateLock(estimateRequest);
}
@Operation(description = "견적서를 엑셀로 다운로드한다.")
@PostMapping("/excel-download")
@ResponseStatus(HttpStatus.OK)
public void excelDownload(
HttpServletRequest request,
HttpServletResponse response,
@RequestBody EstimateRequest estimateRequest)
throws Exception {
estimateService.excelDownload(request, response, estimateRequest);
}
@Operation(description = "2차점 특가 있는 2nd Agency 목록을 조회한다.")
@GetMapping("/agency-cust-list")
@ResponseStatus(HttpStatus.OK)
public EstimateApiResponse selectAgencyCustList(PriceRequest priceRequest) throws Exception {
return estimateService.selectAgencyCustList(priceRequest);
}
}