-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
26 changed files
with
208 additions
and
161 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 3 additions & 1 deletion
4
src/main/kotlin/com/albatros/springsecurity/SpringSecurityApplication.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
19 changes: 19 additions & 0 deletions
19
src/main/kotlin/com/albatros/springsecurity/config/webclient/TenderApiConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.albatros.springsecurity.config.webclient | ||
|
||
import jakarta.validation.constraints.Min | ||
import jakarta.validation.constraints.NotEmpty | ||
import org.springframework.boot.context.properties.ConfigurationProperties | ||
import org.springframework.boot.context.properties.EnableConfigurationProperties | ||
import org.springframework.validation.annotation.Validated | ||
|
||
@Validated | ||
@EnableConfigurationProperties(TenderApiConfig::class) | ||
@ConfigurationProperties(prefix = "tender-config") | ||
data class TenderApiConfig( | ||
@field:NotEmpty | ||
val apiUrl: String, | ||
@field:NotEmpty | ||
val apiKey: String, | ||
@field:Min(0) | ||
val timeoutMs: Int | ||
) |
37 changes: 37 additions & 0 deletions
37
src/main/kotlin/com/albatros/springsecurity/config/webclient/WebClientConfig.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package com.albatros.springsecurity.config.webclient | ||
|
||
import io.netty.channel.ChannelOption | ||
import io.netty.handler.timeout.ReadTimeoutHandler | ||
import io.netty.handler.timeout.WriteTimeoutHandler | ||
import java.util.concurrent.TimeUnit | ||
import org.springframework.context.annotation.Bean | ||
import org.springframework.context.annotation.Configuration | ||
import org.springframework.http.client.reactive.ReactorClientHttpConnector | ||
import org.springframework.http.codec.xml.Jaxb2XmlDecoder | ||
import org.springframework.http.codec.xml.Jaxb2XmlEncoder | ||
import org.springframework.web.reactive.function.client.ExchangeStrategies | ||
import org.springframework.web.reactive.function.client.WebClient | ||
import reactor.netty.http.client.HttpClient | ||
|
||
@Configuration | ||
class WebClientConfig( | ||
private val tenderApiConfig: TenderApiConfig | ||
) { | ||
|
||
fun clientHttpConnector() = ReactorClientHttpConnector( | ||
HttpClient.create().apply { | ||
option(ChannelOption.CONNECT_TIMEOUT_MILLIS, tenderApiConfig.timeoutMs).doOnConnected { | ||
it.addHandlerLast(ReadTimeoutHandler(tenderApiConfig.timeoutMs.toLong(), TimeUnit.MILLISECONDS)) | ||
it.addHandlerLast(WriteTimeoutHandler(tenderApiConfig.timeoutMs.toLong(), TimeUnit.MILLISECONDS)) | ||
} | ||
} | ||
) | ||
|
||
@Bean | ||
fun webClientWithTimeOut() = WebClient.builder().exchangeStrategies( | ||
ExchangeStrategies.builder().codecs { | ||
it.defaultCodecs().jaxb2Decoder(Jaxb2XmlDecoder()) | ||
it.defaultCodecs().jaxb2Encoder(Jaxb2XmlEncoder()) | ||
}.build() | ||
).clientConnector(clientHttpConnector()).baseUrl(tenderApiConfig.apiUrl).build() | ||
} |
45 changes: 0 additions & 45 deletions
45
src/main/kotlin/com/albatros/springsecurity/controller/UserController.kt
This file was deleted.
Oops, something went wrong.
2 changes: 1 addition & 1 deletion
2
...y/domain/model/database/AbstractEntity.kt → ...ity/data/model/database/AbstractEntity.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
22 changes: 22 additions & 0 deletions
22
src/main/kotlin/com/albatros/springsecurity/data/model/dto/TenderDto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package com.albatros.springsecurity.data.model.dto; | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty; | ||
import lombok.Data; | ||
|
||
@Data | ||
public class TenderDto { | ||
private int ID; | ||
private String Date; | ||
private String TenderName; | ||
private String Customer; | ||
private String Category; | ||
private String Region; | ||
private Long Price; | ||
private String EndTime; | ||
private String Etp; | ||
private String TenderLink; | ||
private String TenderLinkInner; | ||
@JsonProperty("User_id") | ||
private int UserId; | ||
private String CustomerINN; | ||
} |
13 changes: 13 additions & 0 deletions
13
src/main/kotlin/com/albatros/springsecurity/data/model/dto/TenderProviderDto.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package com.albatros.springsecurity.data.model.dto | ||
|
||
import com.fasterxml.jackson.annotation.JsonProperty | ||
import java.io.Serializable | ||
|
||
class TenderProviderDto( | ||
@JsonProperty("ID") | ||
var id: Int, | ||
@JsonProperty("EtpName") | ||
var etpName: String, | ||
@JsonProperty("EtpLink") | ||
var etpLink: String | ||
) : Serializable |
4 changes: 2 additions & 2 deletions
4
...n/model/exception/AbstractApiException.kt → ...a/model/exception/AbstractApiException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...main/model/exception/NotFoundException.kt → ...data/model/exception/NotFoundException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...del/exception/ValidationErrorException.kt → ...del/exception/ValidationErrorException.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rity/domain/model/response/ApiResponse.kt → ...curity/data/model/response/ApiResponse.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ity/domain/repository/CommonRepository.kt → ...urity/data/repository/CommonRepository.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
25 changes: 25 additions & 0 deletions
25
src/main/kotlin/com/albatros/springsecurity/data/service/TenderService.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package com.albatros.springsecurity.data.service | ||
|
||
import com.albatros.springsecurity.config.webclient.TenderApiConfig | ||
import com.albatros.springsecurity.data.model.dto.TenderProviderDto | ||
import org.springframework.http.MediaType | ||
import org.springframework.stereotype.Service | ||
import org.springframework.web.reactive.function.client.WebClient | ||
|
||
@Service | ||
class TenderService( | ||
private val tenderApiConfig: TenderApiConfig, | ||
private val webClient: WebClient | ||
) { | ||
fun getAllTenderProviders(mode: String = "eauc"): MutableList<TenderProviderDto>? = webClient | ||
.get() | ||
.uri("/export?mode=$mode&api_code=${tenderApiConfig.apiKey}&dtype=json") | ||
.accept(MediaType.APPLICATION_JSON) | ||
.retrieve() | ||
.bodyToFlux(TenderProviderDto::class.java) | ||
.collectList() | ||
.block() | ||
|
||
|
||
|
||
} |
19 changes: 0 additions & 19 deletions
19
src/main/kotlin/com/albatros/springsecurity/domain/model/database/User.kt
This file was deleted.
Oops, something went wrong.
7 changes: 0 additions & 7 deletions
7
src/main/kotlin/com/albatros/springsecurity/domain/repository/UserRepository.kt
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
src/main/kotlin/com/albatros/springsecurity/domain/service/UserService.kt
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.