|
|
|
@ -1,5 +1,9 @@
|
|
|
|
|
package com.palnet.biz.api.comn.coordinate.controller; |
|
|
|
|
|
|
|
|
|
import java.util.HashMap; |
|
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
|
|
import org.springframework.http.HttpStatus; |
|
|
|
|
import org.springframework.http.ResponseEntity; |
|
|
|
|
import org.springframework.web.bind.annotation.GetMapping; |
|
|
|
|
import org.springframework.web.bind.annotation.RequestMapping; |
|
|
|
@ -8,7 +12,13 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
import com.palnet.biz.api.comn.coordinate.model.CompotentAuthorityRQ; |
|
|
|
|
import com.palnet.biz.api.comn.coordinate.model.CompotentAuthorityRS; |
|
|
|
|
import com.palnet.biz.api.comn.coordinate.service.ComnCoordinateService; |
|
|
|
|
import com.palnet.biz.api.comn.response.BasicResponse; |
|
|
|
|
import com.palnet.biz.api.comn.response.ErrorResponse; |
|
|
|
|
import com.palnet.biz.api.comn.response.SuccessResponse; |
|
|
|
|
import com.palnet.comn.exception.CustomException; |
|
|
|
|
|
|
|
|
|
import io.swagger.annotations.ApiOperation; |
|
|
|
|
import io.swagger.v3.oas.annotations.tags.Tag; |
|
|
|
|
import lombok.RequiredArgsConstructor; |
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
|
@ -16,17 +26,39 @@ import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
@RequiredArgsConstructor |
|
|
|
|
@RequestMapping("/api/comn/coordinate") |
|
|
|
|
@Slf4j |
|
|
|
|
@Tag(name = "공통 API", description = "공통 API") |
|
|
|
|
public class ComnCoordinateController { |
|
|
|
|
|
|
|
|
|
private final ComnCoordinateService comnCoordinateService; |
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 좌표로 관할기관 가져오기 |
|
|
|
|
* @param rq |
|
|
|
|
* @return |
|
|
|
|
*/ |
|
|
|
|
@GetMapping("/comptent-authority") |
|
|
|
|
public ResponseEntity<CompotentAuthorityRS> getCompetentAuthority(CompotentAuthorityRQ rq){ |
|
|
|
|
log.warn("ComnCoordinateController - getCompetentAuthority()"); |
|
|
|
|
log.warn("RQ => {}", rq); |
|
|
|
|
@ApiOperation(value = "좌표로 관할 기관청 가져오기") |
|
|
|
|
@Tag(name = "공통 API", description = "공통 API") |
|
|
|
|
public ResponseEntity<? extends BasicResponse> getCompetentAuthority(CompotentAuthorityRQ rq){ |
|
|
|
|
|
|
|
|
|
CompotentAuthorityRS result = new CompotentAuthorityRS(); |
|
|
|
|
|
|
|
|
|
try { |
|
|
|
|
result = comnCoordinateService.getCompetentAuthority(rq); |
|
|
|
|
} catch (CustomException e) { |
|
|
|
|
Map<String, Object> resultMap = new HashMap<>(); |
|
|
|
|
log.error("IGNORE : ", e); |
|
|
|
|
resultMap.put("result", false); |
|
|
|
|
resultMap.put("errorCode", e.getErrorCode()); |
|
|
|
|
resultMap.put("errorMessage", e.getMessage()); |
|
|
|
|
return ResponseEntity.ok().body(new SuccessResponse<>(resultMap)); |
|
|
|
|
} catch (Exception e) { |
|
|
|
|
log.error("IGNORE : ", e); |
|
|
|
|
return ResponseEntity.status(HttpStatus.INTERNAL_SERVER_ERROR) |
|
|
|
|
.body(new ErrorResponse("Server Error", "-1")); |
|
|
|
|
|
|
|
|
|
CompotentAuthorityRS result = comnCoordinateService.getCompetentAuthority(rq); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
return ResponseEntity.ok().body(result); |
|
|
|
|
return ResponseEntity.ok().body(new SuccessResponse<>(result)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|