Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
D
dizhen
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
jiangyun
dizhen
Commits
b8a17480
Commit
b8a17480
authored
Oct 30, 2025
by
jiang'yun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
fd236a0a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
12 deletions
+67
-12
src/main/java/com/ruoyi/project/dz/controller/DzController.java
+67
-12
No files found.
src/main/java/com/ruoyi/project/dz/controller/DzController.java
View file @
b8a17480
...
...
@@ -3,9 +3,12 @@ package com.ruoyi.project.dz.controller;
import
com.alibaba.fastjson2.JSONArray
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.common.utils.file.FileUploadUtils
;
import
com.ruoyi.common.utils.file.FileUtils
;
import
com.ruoyi.framework.config.RuoYiConfig
;
import
com.ruoyi.framework.config.ServerConfig
;
import
com.ruoyi.framework.web.controller.BaseController
;
import
com.ruoyi.framework.web.domain.AjaxResult
;
import
com.ruoyi.project.dz.utils.Point
;
import
com.ruoyi.project.dz.utils.SegyReadUtil
;
import
com.ruoyi.project.dz.utils.SegyReader
;
...
...
@@ -15,10 +18,8 @@ import org.slf4j.Logger;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.MediaType
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
org.springframework.web.bind.annotation.*
;
import
org.springframework.web.multipart.MultipartFile
;
import
javax.servlet.http.HttpServletRequest
;
import
javax.servlet.http.HttpServletResponse
;
...
...
@@ -36,6 +37,9 @@ public class DzController extends BaseController
{
private
static
final
Logger
log
=
LoggerFactory
.
getLogger
(
DzController
.
class
);
@Autowired
private
ServerConfig
serverConfig
;
// @Autowired
// private ServerConfig serverConfig;
...
...
@@ -44,12 +48,13 @@ public class DzController extends BaseController
// private static String tempPath = "/root/nandongyong/temp.Sgy";
// private static String tempPath = "C:\\ruoyi\\uploadPath\\11-VPVS.Sgy";
// private static String tempPath = "D:\\qianhe\\file\\地震\\cgm及配对的效果图\\line603_out.segy";
private
static
String
tempPath
=
"D:\\qianhe\\file\\地震\\20250715-04segy\\qt_line662_stk.sgy"
;
// private static String tempPath = "D:\\qianhe\\file\\地震\\segy对比图\\line603_out_new_20250508.segy";
// private static String tempPath = "E:\\qianhe\\file\\地震\\20250715-04segy\\qt_line662_stk.sgy";
// private static String tempPath = "E:\\qianhe\\file\\qt_line662_stk.sgy";
private
static
String
tempPath
=
"D:\\qianhe\\file\\地震\\segy对比图\\line603_out_new_20250508.segy"
;
//
// private static String inPath = "/root/nandongyong/1-VPVS.Sgy";
// private static String inPath = "D:\\SoftWork\\2023-06-05 物地震\\地震\\1-VPVS.Sgy";
private
static
String
inPath
=
"
D
:\\qianhe\\file\\地震\\segy对比图\\line603_out_new_20250508.segy"
;
private
static
String
inPath
=
"
E
:\\qianhe\\file\\地震\\segy对比图\\line603_out_new_20250508.segy"
;
/**
* 获取segy文件数据返回前端
...
...
@@ -95,18 +100,38 @@ public class DzController extends BaseController
}
String
realFileName
=
System
.
currentTimeMillis
()
+
fileName
.
substring
(
fileName
.
indexOf
(
"_"
)
+
1
);
String
filePath
=
RuoYiConfig
.
getDownloadPath
()
+
fileName
;
filePath
=
"/root"
+
filePath
;
// filePath = "D:\\SoftWork\\2023-06-05 物地震\\地震\\temp.Sgy";
filePath
=
tempPath
;
System
.
out
.
println
(
"/n/n filePath = "
+
filePath
+
"/n/n"
);
// String filePath = "/root/D:/home/ruoyi/uploadPath/avatar/2023/06/13/density.segy";
// String filePath = "D:\\SoftWork\\2023-06-05 钻井院难动用\\density.segy";
// String realFileName = "density.segy";
response
.
setContentType
(
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
);
FileUtils
.
setAttachmentResponseHeader
(
response
,
realFileName
);
FileUtils
.
writeBytes
(
filePath
,
response
.
getOutputStream
());
}
catch
(
Exception
e
)
{
log
.
error
(
"下载文件失败"
,
e
);
}
}
@GetMapping
(
"/getSegyDataFile3"
)
public
void
getSegyDataFile3
(
String
fileName
,
HttpServletResponse
response
,
HttpServletRequest
request
)
{
try
{
if
(!
FileUtils
.
checkAllowDownload
(
fileName
))
{
throw
new
Exception
(
StringUtils
.
format
(
"文件名称({})非法,不允许下载。 "
,
fileName
));
}
String
realFileName
=
System
.
currentTimeMillis
()
+
fileName
.
substring
(
fileName
.
indexOf
(
"_"
)
+
1
);
fileName
=
fileName
.
replace
(
"/profile/upload"
,
""
);
String
filePath
=
RuoYiConfig
.
getUploadPath
()
+
fileName
;
System
.
out
.
println
(
"/n/n filePath = "
+
filePath
+
"/n/n"
);
response
.
setContentType
(
MediaType
.
APPLICATION_OCTET_STREAM_VALUE
);
FileUtils
.
setAttachmentResponseHeader
(
response
,
realFileName
);
FileUtils
.
writeBytes
(
filePath
,
response
.
getOutputStream
());
}
catch
(
Exception
e
)
{
...
...
@@ -115,6 +140,36 @@ public class DzController extends BaseController
}
/**
* 通用上传请求(单个)
*/
@PostMapping
(
"/upload"
)
public
AjaxResult
uploadFile
(
MultipartFile
file
)
throws
Exception
{
try
{
// 上传文件路径
String
filePath
=
RuoYiConfig
.
getUploadPath
();
// 上传并返回新文件名称
String
fileName
=
FileUploadUtils
.
upload
(
filePath
,
file
);
String
url
=
serverConfig
.
getUrl
()
+
fileName
;
AjaxResult
ajax
=
AjaxResult
.
success
();
ajax
.
put
(
"url"
,
url
);
ajax
.
put
(
"filePath"
,
RuoYiConfig
.
getDownloadPath
()
+
fileName
);
ajax
.
put
(
"fileName"
,
fileName
);
ajax
.
put
(
"newFileName"
,
FileUtils
.
getName
(
fileName
));
ajax
.
put
(
"originalFilename"
,
file
.
getOriginalFilename
());
return
ajax
;
}
catch
(
Exception
e
)
{
return
AjaxResult
.
error
(
e
.
getMessage
());
}
}
/**
* 获取工区坐标范围
*/
@GetMapping
(
"/getGqInfo"
)
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment