订单管理图片上传改为sftp

This commit is contained in:
zhanghan11 2024-05-06 09:20:29 +08:00
parent c173418103
commit 287a602a2a
9 changed files with 55 additions and 42 deletions

View File

@ -8,8 +8,12 @@ import javax.servlet.http.HttpServletResponse;
import com.inspur.common.constant.OmConstants;
import com.inspur.common.utils.StringUtils;
import com.inspur.common.utils.file.SftpUtils;
import com.inspur.common.utils.uuid.IdUtils;
import org.mybatis.logging.LoggerFactory;
import org.springframework.core.io.ByteArrayResource;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -34,7 +38,8 @@ import org.springframework.web.multipart.MultipartFile;
public class OmTeamApplicationController extends BaseController {
@Autowired
private IOmTeamApplicationService omTeamApplicationService;
@Autowired
private SftpUtils sftpUtils;
/**
* 用户查询团队注册申请列表
*/
@ -151,4 +156,16 @@ public class OmTeamApplicationController extends BaseController {
out.write(bytes);
}
}
/**
* 图片展示
*/
@GetMapping("/show")
public ResponseEntity<ByteArrayResource> show(@RequestParam(value = "saveName", required = true) String saveName) {
byte[] bytes = omTeamApplicationService.downLoadFile(OmConstants.SAVE_PATH_SEPARATOR + sftpUtils.getBasePath() + OmConstants.SAVE_PATH_SEPARATOR + OmConstants.SAVE_PATH, saveName);
ByteArrayResource resource = new ByteArrayResource(bytes);
return ResponseEntity.ok()
.contentType(MediaType.IMAGE_JPEG)
.body(resource);
}
}

View File

@ -1654,13 +1654,13 @@ export default {
upload: {
//
headers: { Authorization: "Bearer " + getToken() },
// TODO
url: process.env.VUE_APP_BASE_API + "/common/upload",
//
url: process.env.VUE_APP_BASE_API + "/om/application/upload/file",
//
imageUrl: "",
},
fileList: [],
prefix: process.env.VUE_APP_BASE_API,
prefix: process.env.VUE_APP_BASE_API + "/om/application/show?saveName=",
path1: null,
path2: null,
formFeedback: {},

View File

@ -1600,13 +1600,13 @@ export default {
upload: {
//
headers: { Authorization: "Bearer " + getToken() },
// TODO
url: process.env.VUE_APP_BASE_API + "/common/upload",
//
url: process.env.VUE_APP_BASE_API + "/om/application/upload/file",
//
imageUrl: "",
},
fileList: [],
prefix: process.env.VUE_APP_BASE_API,
prefix: process.env.VUE_APP_BASE_API + "/om/application/show?saveName=",
path1: null,
path2: null,
formFeedback: {},

View File

@ -1622,13 +1622,13 @@ export default {
upload: {
//
headers: { Authorization: "Bearer " + getToken() },
// TODO
url: process.env.VUE_APP_BASE_API + "/common/upload",
//
url: process.env.VUE_APP_BASE_API + "/om/application/upload/file",
//
imageUrl: "",
},
fileList: [],
prefix: process.env.VUE_APP_BASE_API,
prefix: process.env.VUE_APP_BASE_API + "/om/application/show?saveName=",
path1: null,
path2: null,
formFeedback: {},

View File

@ -1684,13 +1684,13 @@ export default {
upload: {
//
headers: { Authorization: "Bearer " + getToken() },
// TODO
url: process.env.VUE_APP_BASE_API + "/common/upload",
//
url: process.env.VUE_APP_BASE_API + "/om/application/upload/file",
//
imageUrl: "",
},
fileList: [],
prefix: process.env.VUE_APP_BASE_API,
prefix: process.env.VUE_APP_BASE_API + "/om/application/show?saveName=",
path1: null,
path2: null,
formFeedback: {},

View File

@ -1557,13 +1557,13 @@ export default {
upload: {
//
headers: { Authorization: "Bearer " + getToken() },
// TODO
url: process.env.VUE_APP_BASE_API + "/common/upload",
//
url: process.env.VUE_APP_BASE_API + "/om/application/upload/file",
//
imageUrl: "",
},
fileList: [],
prefix: process.env.VUE_APP_BASE_API,
prefix: process.env.VUE_APP_BASE_API + "/om/application/show?saveName=",
path1: null,
path2: null,
formFeedback: {},
@ -1956,7 +1956,7 @@ export default {
this.formFeedback.omPerson = null;
this.formFeedback.fileId = this.fileList
.map((file) => {
return file.response.fileName;
return file.response.data.saveName;
})
.join(",");
}
@ -2077,26 +2077,22 @@ export default {
},
handleSuccess(response, file, fileList) {
this.fileList = fileList;
console.log(this.fileList);
this.formFeedback.fileId = this.fileList
.map((file) => {
console.log(file);
return file.response.fileName;
})
.join(",");
// this.formFeedback.fileId = this.fileList
// .map((file) => {
// return file.response.data.saveName;
// })
// .join(",");
this.$modal.msgSuccess("上传成功");
},
handleRemove(file, fileList) {
this.fileList = fileList;
this.formFeedback.fileId = this.fileList
.map((file) => {
return file.response.fileName;
})
.join(",");
},
handlePreview(file, fileList) {
console.log("--->>预览文件", file);
// this.formFeedback.fileId = this.fileList
// .map((file) => {
// return file.response.data.saveName;
// })
// .join(",");
},
handlePreview(file, fileList) {},
//
/** 查询备件基础维护列表 */
getSparePartsList() {

View File

@ -1666,13 +1666,13 @@ export default {
upload: {
//
headers: { Authorization: "Bearer " + getToken() },
// TODO
url: process.env.VUE_APP_BASE_API + "/common/upload",
//
url: process.env.VUE_APP_BASE_API + "/om/application/upload/file",
//
imageUrl: "",
},
fileList: [],
prefix: process.env.VUE_APP_BASE_API,
prefix: process.env.VUE_APP_BASE_API + "/om/application/show?saveName=",
path1: null,
path2: null,
formFeedback: {},

View File

@ -1642,13 +1642,13 @@ export default {
upload: {
//
headers: { Authorization: "Bearer " + getToken() },
// TODO
url: process.env.VUE_APP_BASE_API + "/common/upload",
//
url: process.env.VUE_APP_BASE_API + "/om/application/upload/file",
//
imageUrl: "",
},
fileList: [],
prefix: process.env.VUE_APP_BASE_API,
prefix: process.env.VUE_APP_BASE_API + "/om/application/show?saveName=",
path1: null,
path2: null,
formFeedback: {},

View File

@ -1643,13 +1643,13 @@ export default {
upload: {
//
headers: { Authorization: "Bearer " + getToken() },
// TODO
url: process.env.VUE_APP_BASE_API + "/common/upload",
//
url: process.env.VUE_APP_BASE_API + "/om/application/upload/file",
//
imageUrl: "",
},
fileList: [],
prefix: process.env.VUE_APP_BASE_API,
prefix: process.env.VUE_APP_BASE_API + "/om/application/show?saveName=",
path1: null,
path2: null,
formFeedback: {},