订单管理图片上传改为sftp
This commit is contained in:
parent
c173418103
commit
287a602a2a
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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: {},
|
||||
|
@ -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: {},
|
||||
|
@ -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: {},
|
||||
|
@ -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: {},
|
||||
|
@ -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() {
|
||||
|
@ -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: {},
|
||||
|
@ -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: {},
|
||||
|
@ -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: {},
|
||||
|
Loading…
Reference in New Issue
Block a user