-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
perf($auth-center): create fallback for remote API
- Loading branch information
1 parent
984fff2
commit c445d6f
Showing
12 changed files
with
88 additions
and
12 deletions.
There are no files selected for viewing
32 changes: 32 additions & 0 deletions
32
...nter-domain/src/main/java/com/jmsoftware/maf/authcenter/remote/OssCenterFeignService.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,32 @@ | ||
/* | ||
* Copyright By ZATI | ||
* Copyright By 3a3c88295d37870dfd3b25056092d1a9209824b256c341f2cdc296437f671617 | ||
* All rights reserved. | ||
* | ||
* If you are not the intended user, you are hereby notified that any use, disclosure, copying, printing, forwarding or | ||
* dissemination of this property is strictly prohibited. If you have got this file in error, delete it from your | ||
* system. | ||
*/ | ||
package com.jmsoftware.maf.authcenter.remote; | ||
|
||
import com.jmsoftware.maf.common.domain.osscenter.write.ObjectResponse; | ||
import org.springframework.validation.annotation.Validated; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import javax.validation.constraints.NotNull; | ||
|
||
/** | ||
* Description: OssCenterFeignService, change description here. | ||
* | ||
* @author 钟俊 (za-zhongjun), email: jun.zhong@zatech.com, date: 2/5/2022 7:46 PM | ||
**/ | ||
@Validated | ||
public interface OssCenterFeignService { | ||
/** | ||
* Upload single resource object response. | ||
* | ||
* @param multipartFile the multipart file | ||
* @return the object response | ||
*/ | ||
ObjectResponse uploadSingleResource(@NotNull MultipartFile multipartFile); | ||
} |
45 changes: 45 additions & 0 deletions
45
...in/src/main/java/com/jmsoftware/maf/authcenter/remote/impl/OssCenterFeignServiceImpl.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,45 @@ | ||
/* | ||
* Copyright By ZATI | ||
* Copyright By 3a3c88295d37870dfd3b25056092d1a9209824b256c341f2cdc296437f671617 | ||
* All rights reserved. | ||
* | ||
* If you are not the intended user, you are hereby notified that any use, disclosure, copying, printing, forwarding or | ||
* dissemination of this property is strictly prohibited. If you have got this file in error, delete it from your | ||
* system. | ||
*/ | ||
package com.jmsoftware.maf.authcenter.remote.impl; | ||
|
||
import com.jmsoftware.maf.authcenter.remote.OssCenterFeignClient; | ||
import com.jmsoftware.maf.authcenter.remote.OssCenterFeignService; | ||
import com.jmsoftware.maf.common.bean.ResponseBodyBean; | ||
import com.jmsoftware.maf.common.domain.osscenter.write.ObjectResponse; | ||
import lombok.RequiredArgsConstructor; | ||
import lombok.extern.slf4j.Slf4j; | ||
import org.springframework.stereotype.Service; | ||
import org.springframework.web.multipart.MultipartFile; | ||
|
||
import javax.validation.constraints.NotNull; | ||
import java.util.Optional; | ||
|
||
/** | ||
* Description: OssCenterFeignServiceImpl, change description here. | ||
* | ||
* @author 钟俊 (za-zhongjun), email: jun.zhong@zatech.com, date: 2/5/2022 7:47 PM | ||
**/ | ||
@Slf4j | ||
@Service | ||
@RequiredArgsConstructor | ||
public class OssCenterFeignServiceImpl implements OssCenterFeignService { | ||
private final OssCenterFeignClient ossCenterFeignClient; | ||
|
||
@Override | ||
public ObjectResponse uploadSingleResource(@NotNull MultipartFile multipartFile) { | ||
log.info("Uploading single resource to oss center. multipartFile: {}", multipartFile); | ||
return Optional.ofNullable(ossCenterFeignClient.uploadSingleResource(multipartFile)) | ||
.map(ResponseBodyBean::getData) | ||
.orElseThrow(() -> { | ||
log.error("Failed to upload single resource to oss center. multipartFile: {}", multipartFile); | ||
return new RuntimeException("Upload single resource to oss center failed."); | ||
}); | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...ter/auth-center-domain/src/main/java/com/jmsoftware/maf/authcenter/user/package-info.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 @@ | ||
package com.jmsoftware.maf.authcenter.user; |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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