SUPPORT-8599: Fix
This commit is contained in:
parent
d0691e26f1
commit
2ca5c3c0c7
7 changed files with 61 additions and 4 deletions
|
|
@ -28,6 +28,9 @@ public class S3Service {
|
|||
|
||||
public ResponseEntity<Resource> getFile(String fileUrl) {
|
||||
try {
|
||||
if (fileUrl == null || fileUrl.isEmpty()) {
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
AmazonS3URI uri = new AmazonS3URI(fileUrl);
|
||||
S3Object s3Object = outClient.getObject(uri.getBucket(), uri.getKey());
|
||||
InputStreamResource resource = new InputStreamResource(s3Object.getObjectContent());
|
||||
|
|
|
|||
|
|
@ -50,6 +50,9 @@ public class EsiaConfig {
|
|||
@Value("${esia.token.url:aas/oauth2/v3/te}")
|
||||
private String esiaTokenUrl;
|
||||
|
||||
@Value("${esia.role}")
|
||||
private String esiaRole;
|
||||
|
||||
public String getEsiaOrgScopes() {
|
||||
String[] scopeItems = esiaOrgScopes.split(",");
|
||||
return String.join(" ", Arrays.stream(scopeItems).map(item -> orgScopeUrl + item.trim()).toArray(String[]::new));
|
||||
|
|
@ -97,4 +100,8 @@ public class EsiaConfig {
|
|||
public String getEsiaTokenUrl() {
|
||||
return esiaTokenUrl;
|
||||
}
|
||||
|
||||
public String getEsiaRole() {
|
||||
return esiaRole;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -210,7 +210,7 @@ public class UlDataServiceImpl implements UlDataService {
|
|||
.build()
|
||||
.send(getReq, HttpResponse.BodyHandlers.ofString());
|
||||
errorHandler(getResp);
|
||||
if (getResp.body().contains("MNSV89_UPLOAD_DATA")) {
|
||||
if (getResp.body().contains(esiaConfig.getEsiaRole())) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ ESIA_ORG_SCOPE_URL=http://esia.gosuslugi.ru/
|
|||
ESIA_BASE_URI=https://esia-portal1.test.gosuslugi.ru/
|
||||
ESIA_CLIENT_ID=MNSV89
|
||||
ESIA_REDIRECT_URL=https://lkrp-dev.micord.ru/ul/
|
||||
ESIA_ROLE=MNSV89_UPLOAD_DATA
|
||||
SIGN_URL=https://ervu-sign-dev.k8s.micord.ru/sign
|
||||
ESIA_CLIENT_CERT_HASH=04508B4B0B58776A954A0E15F574B4E58799D74C61EE020B3330716C203E3BDD
|
||||
ERVU_KAFKA_BOOTSTRAP_SERVERS=10.10.31.11:32609
|
||||
|
|
|
|||
|
|
@ -94,6 +94,7 @@
|
|||
<property name="s3.secret_key" value="NUmY0wwRIEyAd98GCKd1cOgJWvLQYAcMMul5Ulu0"/>
|
||||
<property name="av.kafka.group.id" value="1"/>
|
||||
<property name="av.kafka.download.response" value="ervu.lkrp.av-fileupload-status"/>
|
||||
<property name="esia.url" value="MNSV89_UPLOAD_DATA"/>
|
||||
</system-properties>
|
||||
<management>
|
||||
<audit-log>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import {ChangeDetectionStrategy, ChangeDetectorRef, Component, ElementRef} from "@angular/core";
|
||||
import {AbstractButton, NotNull} from "@webbpm/base-package";
|
||||
import {AbstractButton, MessagesService, NotNull, ObjectRef} from "@webbpm/base-package";
|
||||
import {HttpClient} from "@angular/common/http";
|
||||
import {InMemoryStaticGrid} from "../grid/InMemoryStaticGrid";
|
||||
|
||||
/**
|
||||
* @author: Eduard Tihomirov
|
||||
|
|
@ -13,10 +14,18 @@ import {HttpClient} from "@angular/common/http";
|
|||
})
|
||||
export class ErvuDownloadFileButton extends AbstractButton {
|
||||
private httpClient: HttpClient;
|
||||
private messageService: MessagesService;
|
||||
|
||||
@ObjectRef()
|
||||
@NotNull()
|
||||
public grid: InMemoryStaticGrid;
|
||||
|
||||
@NotNull()
|
||||
public fileName: string;
|
||||
|
||||
@NotNull()
|
||||
public noFileMessage: string;
|
||||
|
||||
constructor(el: ElementRef, cd: ChangeDetectorRef) {
|
||||
super(el, cd);
|
||||
}
|
||||
|
|
@ -24,6 +33,21 @@ export class ErvuDownloadFileButton extends AbstractButton {
|
|||
initialize() {
|
||||
super.initialize();
|
||||
this.httpClient = this.injector.get(HttpClient);
|
||||
this.messageService = this.injector.get(MessagesService);
|
||||
if (this.grid.isInitialized() && this.grid.getRowDataSize() > 0) {
|
||||
this.setEnabled(true);
|
||||
this.setVisible(true);
|
||||
}
|
||||
this.grid.gridLoaded.subscribe(() => {
|
||||
if (this.grid.getRowDataSize() > 0) {
|
||||
this.setEnabled(true);
|
||||
this.setVisible(true);
|
||||
}
|
||||
else {
|
||||
this.setEnabled(false);
|
||||
this.setVisible(false);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public doClickActions(): Promise<any> {
|
||||
|
|
@ -31,6 +55,9 @@ export class ErvuDownloadFileButton extends AbstractButton {
|
|||
responseType: 'blob',
|
||||
observe: 'response'
|
||||
}).toPromise().then((response) => {
|
||||
if (response.status == 204) {
|
||||
this.messageService.info(this.noFileMessage)
|
||||
}
|
||||
const contentDisposition = response.headers.get('Content-Disposition');
|
||||
const url = window.URL.createObjectURL(response.body);
|
||||
const a = document.createElement('a');
|
||||
|
|
|
|||
|
|
@ -1299,16 +1299,34 @@
|
|||
<simple>"Запросить выписку"</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>disabled</key>
|
||||
<value>
|
||||
<simple>true</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>fileName</key>
|
||||
<value>
|
||||
<simple>"Выписка"</simple>
|
||||
<simple>"Выписка.xlsx"</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>grid</key>
|
||||
<value>
|
||||
<simple>{"objectId":"bbaf33d7-0679-440b-a394-cb805ce80300","packageName":"ervu.component.grid","className":"InMemoryStaticGrid","type":"TS"}</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>noFileMessage</key>
|
||||
<value>
|
||||
<simple>"Нет записей в выписке журнала взаимодействия"</simple>
|
||||
</value>
|
||||
</entry>
|
||||
<entry>
|
||||
<key>visible</key>
|
||||
<value>
|
||||
<simple>true</simple>
|
||||
<simple>false</simple>
|
||||
</value>
|
||||
</entry>
|
||||
</properties>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue