Merge branch 'feature/SUPPORT-8660_fix_upload_file' into hotfix/1.9.2
This commit is contained in:
commit
10ca6c544b
3 changed files with 62 additions and 13 deletions
|
|
@ -1,10 +1,13 @@
|
|||
package ru.micord.ervu.kafka.controller;
|
||||
|
||||
import java.lang.invoke.MethodHandles;
|
||||
import javax.servlet.http.Cookie;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import ervu.client.fileupload.WebDavClient;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
|
@ -22,6 +25,7 @@ import ru.micord.ervu.security.webbpm.jwt.service.JwtTokenService;
|
|||
*/
|
||||
@RestController
|
||||
public class ErvuKafkaController {
|
||||
private static final Logger LOGGER = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());
|
||||
|
||||
@Autowired
|
||||
private ReplyingKafkaService replyingKafkaService;
|
||||
|
|
@ -56,7 +60,14 @@ public class ErvuKafkaController {
|
|||
objectMapper.writeValueAsString(data)
|
||||
);
|
||||
ExcerptResponse excerptResponse = objectMapper.readValue(kafkaResponse, ExcerptResponse.class);
|
||||
return webDavClient.webDavDownloadFile(excerptResponse.getFileUrl());
|
||||
if (!excerptResponse.getSuccess()) {
|
||||
throw new RuntimeException("Error with getting excerpt url " + excerptResponse.getMessage());
|
||||
}
|
||||
else if (excerptResponse.getData() == null || excerptResponse.getData().getFileUrl() == null
|
||||
|| excerptResponse.getData().getFileUrl().isEmpty()) {
|
||||
return ResponseEntity.noContent().build();
|
||||
}
|
||||
return webDavClient.webDavDownloadFile(excerptResponse.getData().getFileUrl());
|
||||
}
|
||||
catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
|
|
|
|||
|
|
@ -0,0 +1,31 @@
|
|||
package ru.micord.ervu.kafka.model;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
|
||||
/**
|
||||
* @author Eduard Tihomirov
|
||||
*/
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class ExcerptData implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private String orgId;
|
||||
private String fileUrl;
|
||||
|
||||
public String getOrgId() {
|
||||
return orgId;
|
||||
}
|
||||
|
||||
public void setOrgId(String orgId) {
|
||||
this.orgId = orgId;
|
||||
}
|
||||
|
||||
public String getFileUrl() {
|
||||
return fileUrl;
|
||||
}
|
||||
|
||||
public void setFileUrl(String fileUrl) {
|
||||
this.fileUrl = fileUrl;
|
||||
}
|
||||
}
|
||||
|
|
@ -9,24 +9,31 @@ import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
|||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class ExcerptResponse implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
private boolean success;
|
||||
private String message;
|
||||
private ExcerptData data;
|
||||
|
||||
private String orgId;
|
||||
|
||||
private String fileUrl;
|
||||
|
||||
public String getOrgId() {
|
||||
return orgId;
|
||||
public boolean getSuccess() {
|
||||
return success;
|
||||
}
|
||||
|
||||
public void setOrgId(String orgId) {
|
||||
this.orgId = orgId;
|
||||
public void setSuccess(boolean success) {
|
||||
this.success = success;
|
||||
}
|
||||
|
||||
public String getFileUrl() {
|
||||
return fileUrl;
|
||||
public String getMessage() {
|
||||
return message;
|
||||
}
|
||||
|
||||
public void setFileUrl(String fileUrl) {
|
||||
this.fileUrl = fileUrl;
|
||||
public void setMessage(String message) {
|
||||
this.message = message;
|
||||
}
|
||||
|
||||
public ExcerptData getData() {
|
||||
return data;
|
||||
}
|
||||
|
||||
public void setData(ExcerptData data) {
|
||||
this.data = data;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue