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
309e149a
Commit
309e149a
authored
Sep 18, 2025
by
wangqi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
验收前期
parent
8ecb442a
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
333 additions
and
6 deletions
+333
-6
src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java
+1
-1
src/main/java/com/ruoyi/project/dz/utils/SegyReadUtil.java
+74
-0
src/main/java/com/ruoyi/project/ys/controller/YsqqXmxxController.java
+9
-0
src/main/java/com/ruoyi/project/ys/domain/Hyjyxx.java
+2
-2
src/main/java/com/ruoyi/project/ys/domain/SegyZB.java
+98
-0
src/main/java/com/ruoyi/project/ys/domain/YsqqXmxx.java
+26
-0
src/main/java/com/ruoyi/project/ys/service/IYsqqXmxxService.java
+2
-0
src/main/java/com/ruoyi/project/ys/service/impl/YsqqXmxxSegyServiceImpl.java
+87
-2
src/main/java/com/ruoyi/project/ys/service/impl/YsqqXmxxServiceImpl.java
+34
-1
No files found.
src/main/java/com/ruoyi/common/utils/file/FileUploadUtils.java
View file @
309e149a
...
...
@@ -25,7 +25,7 @@ public class FileUploadUtils
/**
* 默认大小 50M
*/
public
static
final
long
DEFAULT_MAX_SIZE
=
5
0
*
1024
*
1024L
;
public
static
final
long
DEFAULT_MAX_SIZE
=
10
0
*
1024
*
1024L
;
/**
* 默认的文件名最大长度 100
...
...
src/main/java/com/ruoyi/project/dz/utils/SegyReadUtil.java
View file @
309e149a
package
com
.
ruoyi
.
project
.
dz
.
utils
;
import
com.ruoyi.project.ys.domain.SegyZB
;
import
org.apache.commons.io.IOUtils
;
import
java.io.*
;
import
java.util.ArrayList
;
import
java.util.List
;
import
java.nio.ByteBuffer
;
import
java.nio.ByteOrder
;
/**
* 读取segy文件
* Created by wj on 2023/8/30.
...
...
@@ -316,4 +319,75 @@ public class SegyReadUtil {
return
buf
;
}
/**
* 读取SEGY文件中所有道的坐标信息
*/
public
static
List
<
SegyZB
>
readCoordinates
(
String
filePath
)
throws
IOException
{
FileInputStream
fis
=
null
;
DataInputStream
dis
=
null
;
List
<
SegyZB
>
coordinates
=
new
ArrayList
<>();
SegyTextFileHeader
txtHdr
=
null
;
//3200
SegyReelHdr
reelHdr
=
null
;
// 400
try
{
File
file
=
new
File
(
filePath
);
long
totalFileLength
=
file
.
length
();
System
.
out
.
println
(
"文件总字节长度: "
+
totalFileLength
+
" 字节"
);
fis
=
new
FileInputStream
(
filePath
);
dis
=
new
DataInputStream
(
fis
);
// 获取文件头 3200
/* byte[] fileHeader = new byte[EBCDIC_FILE_HEADER_LENGTH];
dis.readFully(fileHeader);
byte[] b = CodeUtil.EBCDICToASCII(fileHeader);
txtHdr = new SegyTextFileHeader(b);*/
dis
.
skipBytes
(
EBCDIC_FILE_HEADER_LENGTH
);
// 跳过文件头(3200字节)
// 取400
byte
[]
buf_400
=
new
byte
[
BINARY_FILE_HEADER_LENGTH
];
dis
.
readFully
(
buf_400
);
reelHdr
=
new
SegyReelHdr
(
buf_400
);
// dis.skipBytes(BINARY_FILE_HEADER_LENGTH);// 跳过(400字节) readFully读了就不用跳了
// 根据卷头得出每一块数据集的大小 240+(每道采样点数*根据编码格式获取的数据长度)=每一道字符长度
int
samples_per_trace
=
reelHdr
.
samples_per_trace
;
int
sample_length
=
reelHdr
.
getMultiple
();
int
traceDataLength
=
samples_per_trace
*
sample_length
;
// 仅道数据长度
int
dao_dataCount
=
TRACE_HEADER_LENGTH
+
traceDataLength
;
int
sl
=
(
int
)
((
totalFileLength
-
3600
)/
dao_dataCount
);
System
.
out
.
println
(
"所有道数据读取完成,共"
+
sl
+
"个道"
);
for
(
int
i
=
0
;
i
<
sl
;
i
++){
byte
[]
traceHeader
=
new
byte
[
TRACE_HEADER_LENGTH
];
dis
.
readFully
(
traceHeader
);
int
sxh
=
ByteBuffer
.
wrap
(
traceHeader
,
0
,
4
)
.
order
(
ByteOrder
.
BIG_ENDIAN
).
getInt
();
int
x
=
ByteBuffer
.
wrap
(
traceHeader
,
80
,
4
)
.
order
(
ByteOrder
.
BIG_ENDIAN
).
getInt
();
// 读取Y坐标
int
y
=
ByteBuffer
.
wrap
(
traceHeader
,
84
,
4
)
.
order
(
ByteOrder
.
BIG_ENDIAN
)
.
getInt
();
coordinates
.
add
(
new
SegyZB
(
sxh
,
x
,
y
));
dis
.
skipBytes
(
traceDataLength
);
// 跳过当前道
}
}
catch
(
IOException
e
)
{
System
.
out
.
println
(
"读取文件头报错。"
);
e
.
printStackTrace
();
}
catch
(
SegyFileFormatException
e
)
{
System
.
out
.
println
(
"读取卷头报错:数据编码格式及大小。"
);
e
.
printStackTrace
();
}
finally
{
IOUtils
.
close
(
fis
);
IOUtils
.
close
(
dis
);
}
return
coordinates
;
}
}
src/main/java/com/ruoyi/project/ys/controller/YsqqXmxxController.java
View file @
309e149a
...
...
@@ -180,4 +180,13 @@ public class YsqqXmxxController extends BaseController
return
getDataTable
(
list
);
}
/**
* 获取验收前期-项目信息详细信息
*/
@GetMapping
(
value
=
"/dht/{id}"
)
public
AjaxResult
getInfo_XQ
(
@PathVariable
(
"id"
)
Long
id
)
{
return
success
(
ysqqXmxxService
.
selectYsqqXmxxById_XQ
(
id
));
}
}
src/main/java/com/ruoyi/project/ys/domain/Hyjyxx.java
View file @
309e149a
package
com
.
ruoyi
.
project
.
ys
.
domain
;
import
java.util.Date
;
import
java.util.List
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
...
...
@@ -88,8 +90,6 @@ public class Hyjyxx extends BaseEntity
private
String
jysczt
;
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
...
...
src/main/java/com/ruoyi/project/ys/domain/SegyZB.java
0 → 100644
View file @
309e149a
package
com
.
ruoyi
.
project
.
ys
.
domain
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
com.ruoyi.framework.aspectj.lang.annotation.Excel
;
import
com.ruoyi.framework.web.domain.BaseEntity
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
import
java.util.Date
;
/**
* segy信息对象 ysqq_xmxx_segy
*
* @author ruoyi
* @date 2025-09-18
*/
public
class
SegyZB
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** 主键 */
private
Long
id
;
/** 主表id */
@Excel
(
name
=
"segyid"
)
private
Long
segyid
;
private
int
sxh
;
/** x轴坐标 */
@Excel
(
name
=
"x轴坐标"
)
private
int
x
;
/** y轴坐标 */
@Excel
(
name
=
"y轴坐标"
)
private
int
y
;
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
}
public
Long
getId
()
{
return
id
;
}
public
int
getX
()
{
return
x
;
}
public
int
getY
()
{
return
y
;
}
public
void
setY
(
int
y
)
{
this
.
y
=
y
;
}
@Override
public
String
toString
()
{
return
new
ToStringBuilder
(
this
,
ToStringStyle
.
MULTI_LINE_STYLE
)
.
append
(
"id"
,
getId
())
.
append
(
"segyid"
,
getSegyid
())
.
append
(
"x"
,
getX
())
.
append
(
"y"
,
getY
())
.
toString
();
}
public
Long
getSegyid
()
{
return
segyid
;
}
public
void
setSegyid
(
Long
segyid
)
{
this
.
segyid
=
segyid
;
}
public
int
getSxh
()
{
return
sxh
;
}
public
void
setSxh
(
int
sxh
)
{
this
.
sxh
=
sxh
;
}
public
SegyZB
(
int
sxh
,
int
x
,
int
y
)
{
this
.
sxh
=
sxh
;
this
.
x
=
x
;
this
.
y
=
y
;
}
}
src/main/java/com/ruoyi/project/ys/domain/YsqqXmxx.java
View file @
309e149a
...
...
@@ -2,6 +2,8 @@ package com.ruoyi.project.ys.domain;
import
java.math.BigDecimal
;
import
java.util.Date
;
import
java.util.List
;
import
com.fasterxml.jackson.annotation.JsonFormat
;
import
org.apache.commons.lang3.builder.ToStringBuilder
;
import
org.apache.commons.lang3.builder.ToStringStyle
;
...
...
@@ -87,6 +89,14 @@ public class YsqqXmxx extends BaseEntity
@Excel
(
name
=
"项目日期"
,
width
=
30
,
dateFormat
=
"yyyy-MM-dd"
)
private
Date
xmrq
;
/** 验收前期-项目信息-井信息信息 */
private
List
<
YsqqXmxxJxx
>
ysqqXmxxJxxList
;
/** 验收前期-项目信息-segy信息 */
private
List
<
YsqqXmxxSegy
>
ysqqXmxxSegy
;
public
void
setId
(
Long
id
)
{
this
.
id
=
id
;
...
...
@@ -281,4 +291,20 @@ public class YsqqXmxx extends BaseEntity
.
append
(
"xmrq"
,
getXmrq
())
.
toString
();
}
public
List
<
YsqqXmxxJxx
>
getYsqqXmxxJxxList
()
{
return
ysqqXmxxJxxList
;
}
public
void
setYsqqXmxxJxxList
(
List
<
YsqqXmxxJxx
>
ysqqXmxxJxxList
)
{
this
.
ysqqXmxxJxxList
=
ysqqXmxxJxxList
;
}
public
List
<
YsqqXmxxSegy
>
getYsqqXmxxSegy
()
{
return
ysqqXmxxSegy
;
}
public
void
setYsqqXmxxSegy
(
List
<
YsqqXmxxSegy
>
ysqqXmxxSegy
)
{
this
.
ysqqXmxxSegy
=
ysqqXmxxSegy
;
}
}
src/main/java/com/ruoyi/project/ys/service/IYsqqXmxxService.java
View file @
309e149a
...
...
@@ -19,6 +19,8 @@ public interface IYsqqXmxxService
*/
public
YsqqXmxx
selectYsqqXmxxById
(
Long
id
);
public
YsqqXmxx
selectYsqqXmxxById_XQ
(
Long
id
);
/**
* 查询验收前期-项目信息列表
*
...
...
src/main/java/com/ruoyi/project/ys/service/impl/YsqqXmxxSegyServiceImpl.java
View file @
309e149a
package
com
.
ruoyi
.
project
.
ys
.
service
.
impl
;
import
java.io.IOException
;
import
java.util.ArrayList
;
import
java.util.List
;
import
com.alibaba.fastjson2.JSONArray
;
import
com.alibaba.fastjson2.JSONObject
;
import
com.ruoyi.common.constant.Constants
;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.common.utils.StringUtils
;
import
com.ruoyi.framework.config.RuoYiConfig
;
import
com.ruoyi.project.dz.utils.SegyReadUtil
;
import
com.ruoyi.project.ys.domain.SegyZB
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.ruoyi.project.ys.mapper.YsqqXmxxSegyMapper
;
...
...
@@ -53,9 +63,25 @@ public class YsqqXmxxSegyServiceImpl implements IYsqqXmxxSegyService
@Override
public
int
insertYsqqXmxxSegy
(
YsqqXmxxSegy
ysqqXmxxSegy
)
{
return
ysqqXmxxSegyMapper
.
insertYsqqXmxxSegy
(
ysqqXmxxSegy
);
// 新版segy路径
String
xbsegy
=
ysqqXmxxSegy
.
getXbsegy
();
// 本地资源路径
String
localPath
=
RuoYiConfig
.
getProfile
();
// 数据库资源地址
String
segyFilePath
=
localPath
+
StringUtils
.
substringAfter
(
xbsegy
,
Constants
.
RESOURCE_PREFIX
);
try
{
List
<
SegyZB
>
coordinates
=
SegyReadUtil
.
readCoordinates
(
segyFilePath
);
String
result
=
sampleAndConvertToJSON
(
coordinates
,
20
).
toString
();
ysqqXmxxSegy
.
setX
(
result
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
int
a
=
ysqqXmxxSegyMapper
.
insertYsqqXmxxSegy
(
ysqqXmxxSegy
);
return
a
;
}
/**
* 修改segy信息
*
...
...
@@ -66,7 +92,66 @@ public class YsqqXmxxSegyServiceImpl implements IYsqqXmxxSegyService
public
int
updateYsqqXmxxSegy
(
YsqqXmxxSegy
ysqqXmxxSegy
)
{
ysqqXmxxSegy
.
setUpdateTime
(
DateUtils
.
getNowDate
());
return
ysqqXmxxSegyMapper
.
updateYsqqXmxxSegy
(
ysqqXmxxSegy
);
// 新版segy路径
String
xbsegy
=
ysqqXmxxSegy
.
getXbsegy
();
// 本地资源路径
String
localPath
=
RuoYiConfig
.
getProfile
();
// 数据库资源地址
String
segyFilePath
=
localPath
+
StringUtils
.
substringAfter
(
xbsegy
,
Constants
.
RESOURCE_PREFIX
);
try
{
List
<
SegyZB
>
coordinates
=
SegyReadUtil
.
readCoordinates
(
segyFilePath
);
String
result
=
sampleAndConvertToJSON
(
coordinates
,
20
).
toString
();
ysqqXmxxSegy
.
setX
(
result
);
}
catch
(
IOException
e
)
{
e
.
printStackTrace
();
}
int
a
=
ysqqXmxxSegyMapper
.
updateYsqqXmxxSegy
(
ysqqXmxxSegy
);
return
a
;
}
/**
* 从列表中均匀保留20个元素(包含首尾),并转换为JSONArray
* @param originalList 原始SegyZB列表
* @return 包含20个均匀分布元素的JSONArray
*/
public
static
JSONArray
sampleAndConvertToJSON
(
List
<
SegyZB
>
originalList
,
int
keepCount
)
{
JSONArray
jsonArray
=
new
JSONArray
();
if
(
originalList
==
null
||
originalList
.
isEmpty
())
{
return
jsonArray
;
}
// 若元素数量少于等于20,直接全部保留
List
<
SegyZB
>
sampledList
;
if
(
originalList
.
size
()
<=
keepCount
)
{
sampledList
=
new
ArrayList
<>(
originalList
);
}
else
{
// 计算采样步长,确保首尾元素被选中
int
totalSize
=
originalList
.
size
();
double
step
=
(
totalSize
-
1.0
)
/
(
keepCount
-
1
);
sampledList
=
new
ArrayList
<>(
keepCount
);
for
(
int
i
=
0
;
i
<
keepCount
;
i
++)
{
// 计算当前索引(四舍五入取整)
int
index
=
(
int
)
Math
.
round
(
i
*
step
);
// 确保索引不越界
index
=
Math
.
min
(
index
,
totalSize
-
1
);
sampledList
.
add
(
originalList
.
get
(
index
));
}
}
// 转换为JSONArray
for
(
SegyZB
item
:
sampledList
)
{
JSONObject
jsonObj
=
new
JSONObject
();
jsonObj
.
put
(
"sxh"
,
item
.
getSxh
());
jsonObj
.
put
(
"x"
,
item
.
getX
());
jsonObj
.
put
(
"y"
,
item
.
getY
());
jsonArray
.
add
(
jsonObj
);
}
return
jsonArray
;
}
/**
...
...
src/main/java/com/ruoyi/project/ys/service/impl/YsqqXmxxServiceImpl.java
View file @
309e149a
...
...
@@ -2,6 +2,10 @@ package com.ruoyi.project.ys.service.impl;
import
java.util.List
;
import
com.ruoyi.common.utils.DateUtils
;
import
com.ruoyi.project.ys.domain.YsqqXmxxJxx
;
import
com.ruoyi.project.ys.domain.YsqqXmxxSegy
;
import
com.ruoyi.project.ys.mapper.YsqqXmxxJxxMapper
;
import
com.ruoyi.project.ys.mapper.YsqqXmxxSegyMapper
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.ruoyi.project.ys.mapper.YsqqXmxxMapper
;
...
...
@@ -22,6 +26,11 @@ public class YsqqXmxxServiceImpl implements IYsqqXmxxService
@Autowired
private
YsqqXmxxMapper
ysqqXmxxMapper
;
@Autowired
private
YsqqXmxxJxxMapper
ysqqXmxxJxxMapper
;
@Autowired
private
YsqqXmxxSegyMapper
ysqqXmxxSegyMapper
;
/**
* 查询验收前期-项目信息
*
...
...
@@ -31,7 +40,8 @@ public class YsqqXmxxServiceImpl implements IYsqqXmxxService
@Override
public
YsqqXmxx
selectYsqqXmxxById
(
Long
id
)
{
return
ysqqXmxxMapper
.
selectYsqqXmxxById
(
id
);
YsqqXmxx
ysqqXmxx
=
ysqqXmxxMapper
.
selectYsqqXmxxById
(
id
);
return
ysqqXmxx
;
}
/**
...
...
@@ -98,4 +108,27 @@ public class YsqqXmxxServiceImpl implements IYsqqXmxxService
{
return
ysqqXmxxMapper
.
deleteYsqqXmxxById
(
id
);
}
/**
* 查询验收前期-项目信息
*
* @param id 验收前期-项目信息主键
* @return 验收前期-项目信息
*/
@Override
public
YsqqXmxx
selectYsqqXmxxById_XQ
(
Long
id
)
{
YsqqXmxx
ysqqXmxx
=
ysqqXmxxMapper
.
selectYsqqXmxxById
(
id
);
// 井信息
YsqqXmxxJxx
ysqqXmxxJxx
=
new
YsqqXmxxJxx
();
ysqqXmxxJxx
.
setZbid
(
id
);
List
<
YsqqXmxxJxx
>
jwxxList
=
ysqqXmxxJxxMapper
.
selectYsqqXmxxJxxList
(
ysqqXmxxJxx
);
ysqqXmxx
.
setYsqqXmxxJxxList
(
jwxxList
);
// 井信息,区块信息
YsqqXmxxSegy
ysqqXmxxSegy
=
new
YsqqXmxxSegy
();
ysqqXmxxSegy
.
setZbid
(
id
);
List
<
YsqqXmxxSegy
>
segyList
=
ysqqXmxxSegyMapper
.
selectYsqqXmxxSegyList
(
ysqqXmxxSegy
);
ysqqXmxx
.
setYsqqXmxxSegy
(
segyList
);
return
ysqqXmxx
;
}
}
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