Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Z
zjsgfa_mysql
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
zjsgfa_mysql
Commits
1ada7cfc
Commit
1ada7cfc
authored
Dec 10, 2025
by
jiang'yun
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改
parent
544c564e
Show whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
1741 additions
and
128 deletions
+1741
-128
src/main/java/com/zjsgfa/framework/util/HttpsPostUtil.java
+79
-32
src/main/java/com/zjsgfa/framework/util/HttpsSkipVerifyUtil.java
+87
-0
src/main/java/com/zjsgfa/project/zjsgfa/controller/SjDjjcController.java
+271
-2
src/main/java/com/zjsgfa/project/zjsgfa/controller/SjFdsgcsDcylZjymdsjbController.java
+40
-6
src/main/java/com/zjsgfa/project/zjsgfa/controller/SjFdsgcsDcyxtController.java
+104
-0
src/main/java/com/zjsgfa/project/zjsgfa/domain/SjFdsgcsDcylZjymdsjb.java
+2
-0
src/main/java/com/zjsgfa/project/zjsgfa/domain/SjFdsgcsDcylZjymdtjb.java
+1
-0
src/main/java/com/zjsgfa/project/zjsgfa/domain/SjFdsgcsDcyxt.java
+28
-0
src/main/java/com/zjsgfa/project/zjsgfa/mapper/CommonFileMapper.java
+3
-0
src/main/java/com/zjsgfa/project/zjsgfa/mapper/SjFdsgcsDcyxtMapper.java
+63
-0
src/main/java/com/zjsgfa/project/zjsgfa/service/ICommonFileService.java
+2
-0
src/main/java/com/zjsgfa/project/zjsgfa/service/ISjFdsgcsDcyxtService.java
+61
-0
src/main/java/com/zjsgfa/project/zjsgfa/service/impl/CommonFileServiceImpl.java
+5
-0
src/main/java/com/zjsgfa/project/zjsgfa/service/impl/SjDjjcServiceImpl.java
+0
-82
src/main/java/com/zjsgfa/project/zjsgfa/service/impl/SjFdsgcsDcyxtServiceImpl.java
+94
-0
src/main/java/com/zjsgfa/project/zjsgfa/service/impl/SjFdsgcsServiceImpl.java
+292
-0
src/main/java/com/zjsgfa/project/zjsgfa/util/DrillingMenuRecognizer.java
+146
-0
src/main/java/com/zjsgfa/project/zjsgfa/util/FileBase64Converter.java
+100
-0
src/main/java/com/zjsgfa/project/zjsgfa/util/FileToMultipartFileConverter.java
+214
-0
src/main/java/com/zjsgfa/project/zjsgfa/util/ImageProcessUtil.java
+36
-0
src/main/java/com/zjsgfa/project/zt/domain/CommonParam.java
+3
-0
src/main/java/com/zjsgfa/project/zt/mapper/DjdcInfoMapper.java
+2
-0
src/main/java/com/zjsgfa/project/zt/service/DjdcService.java
+3
-0
src/main/java/com/zjsgfa/project/zt/service/impl/DjdcServiceImpl.java
+5
-0
src/main/resources/mybatis/zjsgfa/CommonFileMapper.xml
+4
-0
src/main/resources/mybatis/zjsgfa/SjFdsgcsDcylZjymdsjbMapper.xml
+10
-3
src/main/resources/mybatis/zjsgfa/SjFdsgcsDcylZjymdtjbMapper.xml
+8
-3
src/main/resources/mybatis/zjsgfa/SjFdsgcsDcyxtMapper.xml
+65
-0
src/main/resources/mybatis/zt/DjdcInfoMapper.xml
+13
-0
src/main/resources/static/excel/sgfamb.docx
+0
-0
No files found.
src/main/java/com/zjsgfa/framework/util/HttpsPostUtil.java
View file @
1ada7cfc
...
...
@@ -10,6 +10,7 @@ import org.apache.hc.client5.http.ssl.NoopHostnameVerifier;
import
org.apache.hc.client5.http.ssl.SSLConnectionSocketFactory
;
import
org.apache.hc.core5.http.ContentType
;
import
org.apache.hc.core5.http.HttpEntity
;
import
org.apache.hc.core5.http.HttpHeaders
;
import
org.apache.hc.core5.http.ParseException
;
import
org.apache.hc.core5.http.io.entity.EntityUtils
;
import
org.apache.hc.core5.http.io.entity.StringEntity
;
...
...
@@ -20,6 +21,7 @@ import javax.net.ssl.SSLContext;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.security.KeyManagementException
;
import
java.security.KeyStore
;
import
java.security.KeyStoreException
;
...
...
@@ -36,31 +38,39 @@ public class HttpsPostUtil {
private
static
final
int
CONNECT_TIMEOUT
=
5000
;
private
static
final
int
READ_TIMEOUT
=
5000
;
/**
* 场景1:跳过 SSL 证书验证(测试环境使用)
* @param url 请求地址
* @param jsonParam 请求体(JSON 字符串)
* @return 响应结果
*/
public
static
String
doPostWithoutSslVerify
(
String
url
,
String
jsonParam
)
{
// 1. 创建忽略证书验证的 SSLContext
/**
* 测试环境专用:跳过SSL证书验证调用HTTPS POST请求
* @param url HTTPS请求地址
* @param jsonParam JSON格式的请求体
* @return 服务端响应字符串
* @throws RuntimeException 请求异常
*/
public
static
String
doPostSkipSslVerify
(
String
url
,
String
jsonParam
)
{
// 1. 创建信任所有证书的SSL上下文
SSLContext
sslContext
;
try
{
sslContext
=
SSLContexts
.
custom
()
// 信任所有证书
.
loadTrustMaterial
((
TrustStrategy
)
(
chain
,
authType
)
->
true
)
.
loadTrustMaterial
((
TrustStrategy
)
(
chain
,
authType
)
->
true
)
// 信任所有证书
.
build
();
}
catch
(
KeyManagementException
|
NoSuchAlgorithmException
|
KeyStoreException
e
)
{
throw
new
RuntimeException
(
"创建
SSL
上下文失败"
,
e
);
throw
new
RuntimeException
(
"创建
SSL
上下文失败"
,
e
);
}
// 2. 创建
SSL 连接工厂(忽略主机名验证)
// 2. 创建
忽略主机名验证的SSL连接工厂
SSLConnectionSocketFactory
sslSocketFactory
=
new
SSLConnectionSocketFactory
(
sslContext
,
NoopHostnameVerifier
.
INSTANCE
// 忽略主机名与证书的匹配
验证
NoopHostnameVerifier
.
INSTANCE
// 忽略主机名与证书的匹配
);
// 3. 构建
HttpClient
// 3. 构建
带连接池的HttpClient(推荐生产环境使用连接池)
try
(
CloseableHttpClient
httpClient
=
HttpClients
.
custom
()
.
setConnectionManager
(
PoolingHttpClientConnectionManagerBuilder
.
create
()
.
setSSLSocketFactory
(
sslSocketFactory
)
...
...
@@ -68,29 +78,35 @@ public class HttpsPostUtil {
.
setDefaultRequestConfig
(
RequestConfig
.
custom
()
// .setConnectTimeout(CONNECT_TIMEOUT)
// .setResponseTimeout(READ_TIMEOUT)
// .setConnectionRequestTimeout(CONNECTION_REQUEST_TIMEOUT)
.
build
())
.
build
())
{
// 4. 构建
POST
请求
// 4. 构建
POST
请求
HttpPost
httpPost
=
new
HttpPost
(
url
);
httpPost
.
setHeader
(
"Content-Type"
,
"application/json;charset=UTF-8"
);
// 设置请求体
StringEntity
entity
=
new
StringEntity
(
jsonParam
,
ContentType
.
APPLICATION_JSON
);
httpPost
.
setEntity
(
entity
);
// 5. 执行请求
// 设置核心请求头
httpPost
.
setHeader
(
HttpHeaders
.
CONTENT_TYPE
,
"application/json;charset=UTF-8"
);
httpPost
.
setHeader
(
HttpHeaders
.
ACCEPT
,
"application/json"
);
// 设置请求体(确保UTF-8编码)
StringEntity
requestEntity
=
new
StringEntity
(
jsonParam
,
StandardCharsets
.
UTF_8
);
httpPost
.
setEntity
(
requestEntity
);
// 5. 执行请求并处理响应
try
(
CloseableHttpResponse
response
=
httpClient
.
execute
(
httpPost
))
{
// int statusCode = response.getStatusLine().getStatusCode();
// // 非200状态码抛出异常(便于排查)
// if (statusCode != HttpStatus.SC_OK) {
// String errorResponse = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
// throw new RuntimeException(String.format("请求失败,状态码:%d,响应内容:%s", statusCode, errorResponse));
// }
HttpEntity
responseEntity
=
response
.
getEntity
();
if
(
responseEntity
!=
null
)
{
return
EntityUtils
.
toString
(
responseEntity
,
"UTF-8"
);
}
return
responseEntity
!=
null
?
EntityUtils
.
toString
(
responseEntity
,
StandardCharsets
.
UTF_8
)
:
null
;
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
"解析响应结果失败"
,
e
);
throw
new
RuntimeException
(
e
);
}
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
"发送
HTTPS POST
请求失败"
,
e
);
throw
new
RuntimeException
(
"发送
HTTPS POST
请求失败"
,
e
);
}
return
null
;
}
/**
...
...
@@ -159,16 +175,46 @@ public class HttpsPostUtil {
return
null
;
}
// 测试示例
public
static
void
main
(
String
[]
args
)
{
// 场景1测试:跳过证书验证发送 POST 请求
String
testUrl
=
"https://localhost:8443/api/test"
;
String
testParam
=
"{\"name\":\"test\",\"age\":18}"
;
String
result1
=
doPostWithoutSslVerify
(
testUrl
,
testParam
);
System
.
out
.
println
(
"跳过证书验证的响应结果:"
+
result1
);
// 场景2测试:使用自定义证书发送 POST 请求
// String result2 = doPostWithCustomCert(testUrl, testParam, "D:/cert/test.jks", "123456");
// System.out.println("自定义证书的响应结果:" + result2);
/**
* 生产环境专用:合法验证SSL证书调用HTTPS POST请求
* @param url HTTPS请求地址
* @param jsonParam JSON格式的请求体
* @return 服务端响应字符串
* @throws RuntimeException 请求异常
*/
public
static
String
doPostProduction
(
String
url
,
String
jsonParam
)
{
// 无需自定义SSLContext,使用默认的即可(自动验证证书)
try
(
CloseableHttpClient
httpClient
=
HttpClients
.
custom
()
.
setConnectionManager
(
PoolingHttpClientConnectionManagerBuilder
.
create
().
build
())
.
setDefaultRequestConfig
(
RequestConfig
.
custom
()
// .setConnectTimeout(CONNECT_TIMEOUT)
// .setResponseTimeout(READ_TIMEOUT)
// .setConnectionRequestTimeout(CONNECTION_REQUEST_TIMEOUT)
.
build
())
.
build
())
{
HttpPost
httpPost
=
new
HttpPost
(
url
);
httpPost
.
setHeader
(
HttpHeaders
.
CONTENT_TYPE
,
"application/json;charset=UTF-8"
);
httpPost
.
setHeader
(
HttpHeaders
.
ACCEPT
,
"application/json"
);
StringEntity
requestEntity
=
new
StringEntity
(
jsonParam
,
StandardCharsets
.
UTF_8
);
httpPost
.
setEntity
(
requestEntity
);
try
(
CloseableHttpResponse
response
=
httpClient
.
execute
(
httpPost
))
{
// int statusCode = response.getStatusLine().getStatusCode();
// if (statusCode != HttpStatus.SC_OK) {
// String errorResponse = EntityUtils.toString(response.getEntity(), StandardCharsets.UTF_8);
// throw new RuntimeException(String.format("请求失败,状态码:%d,响应内容:%s", statusCode, errorResponse));
// }
HttpEntity
responseEntity
=
response
.
getEntity
();
return
responseEntity
!=
null
?
EntityUtils
.
toString
(
responseEntity
,
StandardCharsets
.
UTF_8
)
:
null
;
}
catch
(
ParseException
e
)
{
throw
new
RuntimeException
(
e
);
}
}
catch
(
IOException
e
)
{
throw
new
RuntimeException
(
"发送HTTPS POST请求失败"
,
e
);
}
}
}
\ No newline at end of file
src/main/java/com/zjsgfa/framework/util/HttpsSkipVerifyUtil.java
0 → 100644
View file @
1ada7cfc
package
com
.
zjsgfa
.
framework
.
util
;
import
cn.hutool.http.HttpRequest
;
import
cn.hutool.http.HttpResponse
;
import
cn.hutool.http.HttpUtil
;
import
javax.net.ssl.*
;
import
java.security.SecureRandom
;
import
java.security.cert.X509Certificate
;
public
class
HttpsSkipVerifyUtil
{
// 初始化跳过SSL验证的配置
static
{
try
{
// 1. 创建信任所有证书的TrustManager
TrustManager
[]
trustAllCerts
=
new
TrustManager
[]{
new
X509TrustManager
()
{
@Override
public
void
checkClientTrusted
(
X509Certificate
[]
chain
,
String
authType
)
{}
@Override
public
void
checkServerTrusted
(
X509Certificate
[]
chain
,
String
authType
)
{}
@Override
public
X509Certificate
[]
getAcceptedIssuers
()
{
return
new
X509Certificate
[
0
];
}
}
};
// 2. 初始化SSLContext,信任所有证书
SSLContext
sslContext
=
SSLContext
.
getInstance
(
"TLS"
);
sslContext
.
init
(
null
,
trustAllCerts
,
new
SecureRandom
());
// 3. 设置全局SSLContext
SSLContext
.
setDefault
(
sslContext
);
// 4. 设置主机名验证器,跳过主机名校验
HostnameVerifier
allHostsValid
=
(
hostname
,
session
)
->
true
;
HttpsURLConnection
.
setDefaultHostnameVerifier
(
allHostsValid
);
}
catch
(
Exception
e
)
{
throw
new
RuntimeException
(
"初始化SSL配置失败"
,
e
);
}
}
/**
* GET请求调用HTTPS接口(跳过SSL验证)
* @param url HTTPS接口地址
* @return 接口响应内容
*/
public
static
String
doGet
(
String
url
)
{
return
HttpUtil
.
get
(
url
);
}
/**
* POST请求调用HTTPS接口(跳过SSL验证)
* @param url HTTPS接口地址
* @param body 请求体(JSON/表单字符串)
* @return 接口响应内容
*/
public
static
String
doPost
(
String
url
,
String
body
)
{
return
HttpUtil
.
post
(
url
,
body
);
}
/**
* 自定义HttpRequest调用HTTPS接口(更灵活的配置)
* @param url HTTPS接口地址
* @return 接口响应内容
*/
public
static
String
customRequest
(
String
url
)
{
try
(
HttpResponse
response
=
HttpRequest
.
get
(
url
)
// 可添加header、超时时间等自定义配置
.
header
(
"Content-Type"
,
"application/json"
)
.
timeout
(
5000
)
.
execute
())
{
return
response
.
body
();
}
}
// 测试方法
public
static
void
main
(
String
[]
args
)
{
// 测试调用HTTPS接口(替换为实际的HTTPS地址)
String
result
=
HttpsSkipVerifyUtil
.
doGet
(
"https://www.baidu.com"
);
System
.
out
.
println
(
"接口响应:"
+
result
);
}
}
src/main/java/com/zjsgfa/project/zjsgfa/controller/SjDjjcController.java
View file @
1ada7cfc
...
...
@@ -9,6 +9,7 @@ import java.util.regex.Pattern;
import
java.util.stream.Collectors
;
import
javax.servlet.http.HttpServletResponse
;
import
cn.hutool.http.HttpRequest
;
import
com.deepoove.poi.XWPFTemplate
;
import
com.deepoove.poi.data.PictureRenderData
;
import
com.deepoove.poi.data.PictureType
;
...
...
@@ -16,6 +17,9 @@ import com.deepoove.poi.data.Pictures;
import
com.deepoove.poi.plugin.table.LoopColumnTableRenderPolicy
;
import
com.deepoove.poi.plugin.table.LoopRowTableRenderPolicy
;
import
com.fasterxml.jackson.core.JsonProcessingException
;
import
com.google.gson.Gson
;
import
com.google.gson.GsonBuilder
;
import
com.google.gson.JsonObject
;
import
com.zjsgfa.common.constant.Constants
;
import
com.zjsgfa.common.utils.SecurityUtils
;
import
com.zjsgfa.common.utils.StringUtils
;
...
...
@@ -29,8 +33,7 @@ import com.zjsgfa.project.zjsgfa.mapper.*;
import
com.zjsgfa.project.zjsgfa.service.ICommonFileService
;
import
com.zjsgfa.project.zjsgfa.service.ISjZjyFdxnbService
;
import
com.zjsgfa.project.zjsgfa.util.CxszhUtil
;
import
com.zjsgfa.project.zjsgfa.util.ImageProcessUtil
;
import
com.zjsgfa.project.zjsgfa.util.*
;
import
com.zjsgfa.project.zt.domain.CommonParam
;
import
com.zjsgfa.project.zt.service.DjdcService
;
import
org.apache.poi.ss.usermodel.*
;
...
...
@@ -211,6 +214,9 @@ public class SjDjjcController extends BaseController
@Autowired
private
ICommonFileService
commonFileService
;
@Autowired
private
SjFdsgcsDcyxtMapper
sjFdsgcsDcyxtMapper
;
...
...
@@ -1980,6 +1986,8 @@ public class SjDjjcController extends BaseController
upFile
.
setFileType
(
type
);
//文件类型
// upFile.setCreatedBy(SecurityUtils.getUsername());//创建人
upFile
.
setCreatedTime
(
new
Date
());
//创建时间
//删除同类型的文件,只保留一个
commonFileService
.
deleteCommonFileByICommonFile
(
upFile
);
int
i
=
commonFileService
.
insertCommonFile
(
upFile
);
return
AjaxResult
.
success
(
"上传成功"
);
...
...
@@ -2032,6 +2040,101 @@ public class SjDjjcController extends BaseController
return
sjDjjcService
.
jsljjz
(
sjDjjc
);
}
/**
* 解析文件
* @param sjDjjc
* @return
* @throws Exception
*/
@GetMapping
(
"/jxdzzl"
)
public
AjaxResult
jxdzzl
(
SjDjjc
sjDjjc
)
throws
Exception
{
Long
id
=
sjDjjc
.
getId
();
SjDjjc
sjDjjcnew
=
sjDjjcService
.
selectSjDjjcById
(
id
);
CommonFile
commonFile
=
new
CommonFile
();
commonFile
.
setBusinessId
(
id
.
toString
());
List
<
CommonFile
>
commonFiles
=
commonFileService
.
selectCommonFileList
(
commonFile
);
System
.
out
.
println
(
commonFiles
);
if
(
commonFiles
.
size
()
>
0
)
{
Map
<
String
,
List
<
CommonFile
>>
collect
=
commonFiles
.
stream
().
filter
(
it
->!
it
.
getTemplateName
().
equals
(
"模板数据导入"
))
.
filter
(
it
->
it
.
getFileSuffix
().
toLowerCase
().
equals
(
"pdf"
))
.
collect
(
Collectors
.
groupingBy
(
CommonFile:
:
getTemplateName
));
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
for
(
String
key:
collect
.
keySet
()){
if
(
key
.
equals
(
"地质设计"
)
||
key
.
equals
(
"工程设计"
)){
List
<
CommonFile
>
commonFiles1
=
collect
.
get
(
key
);
CommonFile
commonFile1
=
commonFiles1
.
get
(
0
);
String
filePath
=
commonFile1
.
getFilePath
();
filePath
=
filePath
.
replace
(
"/profile/upload"
,
""
);
String
path
=
RuoYiConfig
.
getUploadPath
()
+
filePath
;
File
file
=
new
File
(
path
);
if
(
file
.
exists
()){
//转换为base64
String
s
=
FileBase64Converter
.
fileToBase64
(
file
);
if
(
key
.
equals
(
"地质设计"
)){
map
.
put
(
"地质"
,
s
);
}
else
{
map
.
put
(
"工程"
,
s
);
}
}
}
}
if
(!
map
.
isEmpty
()){
System
.
out
.
println
(
"第一次map"
+
map
);
Map
<
String
,
Object
>
map2
=
new
HashMap
<>();
map2
.
put
(
"dict_content"
,
map
);
Gson
gson
=
new
GsonBuilder
().
setPrettyPrinting
().
create
();
String
param
=
gson
.
toJson
(
map2
);
System
.
out
.
println
(
"最终参数"
+
param
);
//调用接口
String
body
=
HttpRequest
.
post
(
"http://10.68.202.238:12001/api/pdf2xlsx"
).
body
(
param
).
execute
().
body
();
System
.
out
.
println
(
"接口返回数据"
+
body
);
String
s
=
gson
.
fromJson
(
body
,
String
.
class
);
if
(
StringUtils
.
isNotEmpty
(
s
)){
long
time
=
new
Date
().
getTime
();
String
fileName
=
sjDjjcnew
.
getJh
()+
"_"
+
time
+
".xlsx"
;
String
outPath
=
RuoYiConfig
.
getUploadPath
()+
"/jxh/"
+
fileName
;
System
.
out
.
println
(
"解析后存放的路径"
+
outPath
);
FileBase64Converter
.
base64ToExcel
(
s
,
outPath
);
File
testFile
=
new
File
(
outPath
);
MultipartFile
multipartFile
=
FileToMultipartFileConverter
.
convert
(
testFile
);
importData
(
multipartFile
,
false
,
sjDjjcnew
);
}
}
}
return
AjaxResult
.
success
(
"解析成功"
);
}
/**
* 解析文件
* @param sjDjjc
* @return
* @throws Exception
*/
@GetMapping
(
"/jxdzzl2"
)
public
AjaxResult
jxdzzl2
(
SjDjjc
sjDjjc
)
throws
Exception
{
Long
id
=
sjDjjc
.
getId
();
SjDjjc
sjDjjcnew
=
sjDjjcService
.
selectSjDjjcById
(
id
);
String
outPath
=
RuoYiConfig
.
getUploadPath
()+
"/jxh/XYL217X52.xlsx"
;
System
.
out
.
println
(
"解析后存放的路径"
+
outPath
);
File
testFile
=
new
File
(
outPath
);
MultipartFile
multipartFile
=
FileToMultipartFileConverter
.
convert
(
testFile
);
importData
(
multipartFile
,
false
,
sjDjjcnew
);
return
AjaxResult
.
success
(
"解析成功"
);
}
@PostMapping
(
"/exportWord"
)
public
void
exportWord
(
long
id
,
HttpServletResponse
response
)
throws
Exception
{
...
...
@@ -2542,6 +2645,30 @@ public class SjDjjcController extends BaseController
map
.
put
(
"gjfx"
,
sjFdsgcs1
.
getGjfx
());
map
.
put
(
"gjyh"
,
sjFdsgcs1
.
getGjyh
());
map
.
put
(
"dcyl"
,
sjFdsgcs1
.
getDcyl
());
SjFdsgcsDcyxt
sjFdsgcsDcyxt
=
new
SjFdsgcsDcyxt
();
sjFdsgcsDcyxt
.
setZbid
(
sjFdsgcs1
.
getId
().
toString
());
List
<
SjFdsgcsDcyxt
>
sjFdsgcsDcyxts
=
sjFdsgcsDcyxtMapper
.
selectSjFdsgcsDcyxtList
(
sjFdsgcsDcyxt
);
if
(
sjFdsgcsDcyxts
.
size
()>
0
){
SjFdsgcsDcyxt
sjFdsgcsDcyxt1
=
sjFdsgcsDcyxts
.
get
(
0
);
if
(
sjFdsgcsDcyxt1
!=
null
){
String
base64Prefix
=
"data:image/png;base64,"
;
if
(!
sjFdsgcsDcyxt1
.
getJsjgt
().
startsWith
(
base64Prefix
))
{
map
.
put
(
"dcylt"
,
null
);
}
else
{
InputStream
pngStream
=
ImageProcessUtil
.
convertBase64ToPngInputStream
(
sjFdsgcsDcyxt1
.
getJsjgt
());
PictureRenderData
image
=
Pictures
.
ofStream
(
pngStream
,
PictureType
.
PNG
)
.
size
(
400
,
450
)
.
create
();
map
.
put
(
"dcylt"
,
image
);
}
}
else
{
map
.
put
(
"dcylt"
,
null
);
}
}
else
{
map
.
put
(
"dcylt"
,
null
);
}
map
.
put
(
"zyfx"
,
sjFdsgcs1
.
getZyfx
());
map
.
put
(
"fxgkcs"
,
sjFdsgcs1
.
getFxgkcs
());
map
.
put
(
"zjzh"
,
sjFdsgcs1
.
getZjzh
());
...
...
@@ -2625,6 +2752,148 @@ public class SjDjjcController extends BaseController
@GetMapping
(
"/zskwd"
)
public
AjaxResult
zskwd
(
CommonParam
commonParam
)
throws
IOException
{
//
if
(
StringUtils
.
isEmpty
(
commonParam
.
getZskwd
())){
return
AjaxResult
.
success
(
"您还未输入任何问题!"
);
}
if
(
StringUtils
.
isEmpty
(
commonParam
.
getLb
())){
return
AjaxResult
.
success
(
"请选择类别!"
);
}
String
zskwd
=
commonParam
.
getZskwd
().
trim
();
Gson
gson
=
new
GsonBuilder
().
setPrettyPrinting
().
create
();
String
lb
=
commonParam
.
getLb
();
String
res
=
""
;
String
param
=
""
;
String
url
=
""
;
String
name
=
""
;
String
jh
=
""
;
Map
<
String
,
Object
>
reMap
=
new
HashMap
<>();
if
(
"方案智能设计"
.
equals
(
lb
)){
List
<
String
>
stringList
=
extractConditions
(
zskwd
);
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
if
(
stringList
.
size
()>
0
){
jh
=
stringList
.
get
(
0
);
map
.
put
(
"jh"
,
stringList
.
get
(
0
));
}
else
{
return
AjaxResult
.
success
(
"未识别到相关信息!"
);
}
//识别井号
param
=
gson
.
toJson
(
map
);
name
=
"方案编制助手"
;
url
=
"/designInformation/sjDjjc"
;
}
else
if
(
"经验挖掘助手"
.
equals
(
lb
)){
DrillingMenuRecognizer
.
RecognizeResult
recognize
=
DrillingMenuRecognizer
.
recognize
(
zskwd
);
String
menu
=
recognize
.
getMenu
();
jh
=
recognize
.
getWellNumber
();
if
(
StringUtils
.
isEmpty
(
jh
)
||
StringUtils
.
isEmpty
(
menu
))
{
return
AjaxResult
.
success
(
"未识别到相关信息!"
);
}
if
(
"钻头单支分析"
.
equals
(
menu
)){
url
=
"/adjacentWell/wellData"
;
}
else
if
(
"口井周期分析"
.
equals
(
menu
)){
url
=
"/adjacentWell/dataStatistics"
;
}
else
if
(
"钻头区块分析"
.
equals
(
menu
)){
url
=
"/adjacentWell/drillbitData"
;
}
else
if
(
"钻具组合分析"
.
equals
(
menu
)){
url
=
"/adjacentWell/drillbitCombination"
;
}
else
if
(
"钻头专家评价"
.
equals
(
menu
)){
url
=
"/adjacentWell/analysisResults"
;
}
else
if
(
"分段钻参分析"
.
equals
(
menu
)){
url
=
"/adjacentWell/schemeParameters"
;
}
else
if
(
"高指标井查询"
.
equals
(
menu
)){
url
=
"/adjacentWell/gzb"
;
}
else
if
(
"钻井液指标分析"
.
equals
(
menu
)){
url
=
"/adjacentWell/zjycx"
;
}
else
if
(
"造斜规律分析"
.
equals
(
menu
)){
url
=
"/adjacentWell/cxsj"
;
}
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"jh"
,
jh
);
param
=
gson
.
toJson
(
map
);
name
=
menu
;
}
System
.
out
.
println
(
url
);
System
.
out
.
println
(
param
);
System
.
out
.
println
(
name
);
res
=
"我从【<el-button type='primary' class='btnclass' style='color: #4848ea;background-color: white' @click=tzym('"
+
url
+
"',"
+
jh
+
")>"
+
name
+
"</el-button>】模块内找到相关内容,请点击查看。"
;
reMap
.
put
(
"res"
,
res
);
reMap
.
put
(
"url"
,
url
);
reMap
.
put
(
"name"
,
name
);
reMap
.
put
(
"jh"
,
jh
);
// return AjaxResult.success(reMap);
return
AjaxResult
.
success
(
res
);
}
public
static
List
<
String
>
extractConditions
(
String
inputText
)
{
// 1. 文本预处理:去除空格、中英文逗号、顿号等分隔符
String
normalizedText
=
inputText
.
replaceAll
(
"[\\s,,、;;]"
,
""
);
Set
<
String
>
conditionSet
=
new
HashSet
<>();
// 用Set自动去重
// 2. 修正后的正则表达式(保留原有匹配能力)
String
regex
=
"((邻井)?(滨)?\\d+-(直|斜)\\d*)|((梁|柱|墙|板)\\d+(-(直|斜)\\d*)?)|([A-Za-z0-9]+)"
;
Pattern
pattern
=
Pattern
.
compile
(
regex
);
Matcher
matcher
=
pattern
.
matcher
(
normalizedText
);
// 3. 遍历匹配结果,过滤无效内容+移除"邻井"前缀
while
(
matcher
.
find
())
{
String
condition
=
matcher
.
group
().
trim
();
// 核心修改:移除"邻井"前缀
condition
=
condition
.
replace
(
"邻井"
,
""
);
// 过滤空字符串、纯数字(避免匹配无关数字)
if
(!
condition
.
isEmpty
()
&&
!
condition
.
matches
(
"\\d+"
))
{
conditionSet
.
add
(
condition
);
}
}
// 4. 转换为List返回(保持有序)
return
new
ArrayList
<>(
conditionSet
);
}
public
void
tydydmx
(
String
nr
)
{
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"stream"
,
false
);
Map
<
String
,
Object
>
map2
=
new
HashMap
<>();
map2
.
put
(
"field_name"
,
"text"
);
map2
.
put
(
"type"
,
"input"
);
map2
.
put
(
"value"
,
nr
);
List
<
Map
>
listMap
=
new
ArrayList
<>();
listMap
.
add
(
map2
);
map
.
put
(
"content"
,
listMap
);
map
.
put
(
"value"
,
nr
);
String
url
=
"https://agent.ai.sinopec.com/aicoapi/gateway/v2/workflow/api_run/506d22a5e4e8479b879a836368002ac8"
;
String
key
=
"278GANwseRJ98YbADs3G1tj7Fg40sI7d"
;
Gson
gson
=
new
GsonBuilder
().
setPrettyPrinting
().
create
();
String
json
=
gson
.
toJson
(
map
);
String
result2
=
HttpRequest
.
post
(
url
).
header
(
"Authorization"
,
"Bearer "
+
key
).
body
(
json
).
execute
().
body
();
System
.
out
.
println
(
result2
);
// // 解析API响应
String
textPresentation
=
""
;
// 解析为顶层JsonObject
JsonObject
root
=
gson
.
fromJson
(
result2
,
JsonObject
.
class
);
// 逐层获取"文本呈现"内容
// 1. 获取外层data节点
JsonObject
outerData
=
root
.
getAsJsonObject
(
"data"
);
// 2. 获取内层data节点
JsonObject
innerData
=
outerData
.
getAsJsonObject
(
"data"
);
// 3. 获取"文本呈现"字段的值
textPresentation
=
innerData
.
get
(
"文本呈现"
).
getAsString
();
// 打印结果
System
.
out
.
println
(
"文本呈现内容:\n"
+
textPresentation
);
}
...
...
src/main/java/com/zjsgfa/project/zjsgfa/controller/SjFdsgcsDcylZjymdsjbController.java
View file @
1ada7cfc
package
com
.
zjsgfa
.
project
.
zjsgfa
.
controller
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.stream.Collectors
;
import
javax.servlet.http.HttpServletResponse
;
import
com.zjsgfa.common.utils.StringUtils
;
import
com.zjsgfa.project.zt.domain.DjZqsjfx
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
...
...
@@ -37,7 +44,7 @@ public class SjFdsgcsDcylZjymdsjbController extends BaseController
/**
* 查询邻井钻井液密度数据列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:sjFdsgcsDcylZjymdsjb:list')"
)
//
@PreAuthorize("@ss.hasPermi('system:sjFdsgcsDcylZjymdsjb:list')")
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SjFdsgcsDcylZjymdsjb
sjFdsgcsDcylZjymdsjb
)
{
...
...
@@ -49,7 +56,7 @@ public class SjFdsgcsDcylZjymdsjbController extends BaseController
/**
* 导出邻井钻井液密度数据列表
*/
@PreAuthorize
(
"@ss.hasPermi('system:sjFdsgcsDcylZjymdsjb:export')"
)
//
@PreAuthorize("@ss.hasPermi('system:sjFdsgcsDcylZjymdsjb:export')")
@Log
(
title
=
"邻井钻井液密度数据"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
SjFdsgcsDcylZjymdsjb
sjFdsgcsDcylZjymdsjb
)
...
...
@@ -62,7 +69,7 @@ public class SjFdsgcsDcylZjymdsjbController extends BaseController
/**
* 获取邻井钻井液密度数据详细信息
*/
@PreAuthorize
(
"@ss.hasPermi('system:sjFdsgcsDcylZjymdsjb:query')"
)
//
@PreAuthorize("@ss.hasPermi('system:sjFdsgcsDcylZjymdsjb:query')")
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
...
...
@@ -72,7 +79,7 @@ public class SjFdsgcsDcylZjymdsjbController extends BaseController
/**
* 新增邻井钻井液密度数据
*/
@PreAuthorize
(
"@ss.hasPermi('system:sjFdsgcsDcylZjymdsjb:add')"
)
//
@PreAuthorize("@ss.hasPermi('system:sjFdsgcsDcylZjymdsjb:add')")
@Log
(
title
=
"邻井钻井液密度数据"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
SjFdsgcsDcylZjymdsjb
sjFdsgcsDcylZjymdsjb
)
...
...
@@ -83,7 +90,7 @@ public class SjFdsgcsDcylZjymdsjbController extends BaseController
/**
* 修改邻井钻井液密度数据
*/
@PreAuthorize
(
"@ss.hasPermi('system:sjFdsgcsDcylZjymdsjb:edit')"
)
//
@PreAuthorize("@ss.hasPermi('system:sjFdsgcsDcylZjymdsjb:edit')")
@Log
(
title
=
"邻井钻井液密度数据"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
SjFdsgcsDcylZjymdsjb
sjFdsgcsDcylZjymdsjb
)
...
...
@@ -94,11 +101,38 @@ public class SjFdsgcsDcylZjymdsjbController extends BaseController
/**
* 删除邻井钻井液密度数据
*/
@PreAuthorize
(
"@ss.hasPermi('system:sjFdsgcsDcylZjymdsjb:remove')"
)
//
@PreAuthorize("@ss.hasPermi('system:sjFdsgcsDcylZjymdsjb:remove')")
@Log
(
title
=
"邻井钻井液密度数据"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
return
toAjax
(
sjFdsgcsDcylZjymdsjbService
.
deleteSjFdsgcsDcylZjymdsjbByIds
(
ids
));
}
@GetMapping
(
"/getDataList"
)
public
AjaxResult
getDataList
(
SjFdsgcsDcylZjymdsjb
sjFdsgcsDcylZjymdsjb
)
{
List
<
SjFdsgcsDcylZjymdsjb
>
list
=
sjFdsgcsDcylZjymdsjbService
.
selectSjFdsgcsDcylZjymdsjbList
(
sjFdsgcsDcylZjymdsjb
);
List
<
Map
>
mapList
=
new
ArrayList
<>();
Map
<
String
,
List
<
SjFdsgcsDcylZjymdsjb
>>
collect
=
list
.
stream
()
.
collect
(
Collectors
.
groupingBy
(
SjFdsgcsDcylZjymdsjb:
:
getLjjh
));
for
(
String
key
:
collect
.
keySet
()){
Map
<
String
,
Object
>
map
=
new
HashMap
<>();
map
.
put
(
"name"
,
key
);
List
<
Map
>
mapList2
=
new
ArrayList
<>();
for
(
SjFdsgcsDcylZjymdsjb
item:
collect
.
get
(
key
)){
Map
<
String
,
Object
>
map2
=
new
HashMap
<>();
map2
.
put
(
"depth"
,
item
.
getQyjs
());
map2
.
put
(
"density"
,
item
.
getMd
());
mapList2
.
add
(
map2
);
}
map
.
put
(
"data"
,
mapList2
);
mapList
.
add
(
map
);
}
return
AjaxResult
.
success
(
mapList
);
}
}
src/main/java/com/zjsgfa/project/zjsgfa/controller/SjFdsgcsDcyxtController.java
0 → 100644
View file @
1ada7cfc
package
com
.
zjsgfa
.
project
.
zjsgfa
.
controller
;
import
java.util.List
;
import
javax.servlet.http.HttpServletResponse
;
import
org.springframework.security.access.prepost.PreAuthorize
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.web.bind.annotation.GetMapping
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.PutMapping
;
import
org.springframework.web.bind.annotation.DeleteMapping
;
import
org.springframework.web.bind.annotation.PathVariable
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RequestMapping
;
import
org.springframework.web.bind.annotation.RestController
;
import
com.zjsgfa.framework.aspectj.lang.annotation.Log
;
import
com.zjsgfa.framework.aspectj.lang.enums.BusinessType
;
import
com.zjsgfa.project.zjsgfa.domain.SjFdsgcsDcyxt
;
import
com.zjsgfa.project.zjsgfa.service.ISjFdsgcsDcyxtService
;
import
com.zjsgfa.framework.web.controller.BaseController
;
import
com.zjsgfa.framework.web.domain.AjaxResult
;
import
com.zjsgfa.common.utils.poi.ExcelUtil
;
import
com.zjsgfa.framework.web.page.TableDataInfo
;
/**
* 地层压力图Controller
*
* @author ruoyi
* @date 2025-12-09
*/
@RestController
@RequestMapping
(
"/system/sjFdsgcsDcyxt"
)
public
class
SjFdsgcsDcyxtController
extends
BaseController
{
@Autowired
private
ISjFdsgcsDcyxtService
sjFdsgcsDcyxtService
;
/**
* 查询地层压力图列表
*/
//@PreAuthorize("@ss.hasPermi('system:sjFdsgcsDcyxt:list')")
@GetMapping
(
"/list"
)
public
TableDataInfo
list
(
SjFdsgcsDcyxt
sjFdsgcsDcyxt
)
{
startPage
();
List
<
SjFdsgcsDcyxt
>
list
=
sjFdsgcsDcyxtService
.
selectSjFdsgcsDcyxtList
(
sjFdsgcsDcyxt
);
return
getDataTable
(
list
);
}
/**
* 导出地层压力图列表
*/
//@PreAuthorize("@ss.hasPermi('system:sjFdsgcsDcyxt:export')")
@Log
(
title
=
"地层压力图"
,
businessType
=
BusinessType
.
EXPORT
)
@PostMapping
(
"/export"
)
public
void
export
(
HttpServletResponse
response
,
SjFdsgcsDcyxt
sjFdsgcsDcyxt
)
{
List
<
SjFdsgcsDcyxt
>
list
=
sjFdsgcsDcyxtService
.
selectSjFdsgcsDcyxtList
(
sjFdsgcsDcyxt
);
ExcelUtil
<
SjFdsgcsDcyxt
>
util
=
new
ExcelUtil
<
SjFdsgcsDcyxt
>(
SjFdsgcsDcyxt
.
class
);
util
.
exportExcel
(
response
,
list
,
"地层压力图数据"
);
}
/**
* 获取地层压力图详细信息
*/
//@PreAuthorize("@ss.hasPermi('system:sjFdsgcsDcyxt:query')")
@GetMapping
(
value
=
"/{id}"
)
public
AjaxResult
getInfo
(
@PathVariable
(
"id"
)
Long
id
)
{
return
success
(
sjFdsgcsDcyxtService
.
selectSjFdsgcsDcyxtById
(
id
));
}
/**
* 新增地层压力图
*/
//@PreAuthorize("@ss.hasPermi('system:sjFdsgcsDcyxt:add')")
@Log
(
title
=
"地层压力图"
,
businessType
=
BusinessType
.
INSERT
)
@PostMapping
public
AjaxResult
add
(
@RequestBody
SjFdsgcsDcyxt
sjFdsgcsDcyxt
)
{
return
toAjax
(
sjFdsgcsDcyxtService
.
insertSjFdsgcsDcyxt
(
sjFdsgcsDcyxt
));
}
/**
* 修改地层压力图
*/
//@PreAuthorize("@ss.hasPermi('system:sjFdsgcsDcyxt:edit')")
@Log
(
title
=
"地层压力图"
,
businessType
=
BusinessType
.
UPDATE
)
@PutMapping
public
AjaxResult
edit
(
@RequestBody
SjFdsgcsDcyxt
sjFdsgcsDcyxt
)
{
return
toAjax
(
sjFdsgcsDcyxtService
.
updateSjFdsgcsDcyxt
(
sjFdsgcsDcyxt
));
}
/**
* 删除地层压力图
*/
//@PreAuthorize("@ss.hasPermi('system:sjFdsgcsDcyxt:remove')")
@Log
(
title
=
"地层压力图"
,
businessType
=
BusinessType
.
DELETE
)
@DeleteMapping
(
"/{ids}"
)
public
AjaxResult
remove
(
@PathVariable
Long
[]
ids
)
{
return
toAjax
(
sjFdsgcsDcyxtService
.
deleteSjFdsgcsDcyxtByIds
(
ids
));
}
}
src/main/java/com/zjsgfa/project/zjsgfa/domain/SjFdsgcsDcylZjymdsjb.java
View file @
1ada7cfc
...
...
@@ -22,6 +22,8 @@ public class SjFdsgcsDcylZjymdsjb extends BaseEntity
@Excel
(
name
=
"井号"
)
private
String
jh
;
private
String
kc
;
/** 邻井井号 */
@Excel
(
name
=
"邻井井号"
)
private
String
ljjh
;
...
...
src/main/java/com/zjsgfa/project/zjsgfa/domain/SjFdsgcsDcylZjymdtjb.java
View file @
1ada7cfc
...
...
@@ -23,6 +23,7 @@ public class SjFdsgcsDcylZjymdtjb extends BaseEntity
@Excel
(
name
=
"井号"
)
private
String
jh
;
private
String
kc
;
/** 邻井井号 */
@Excel
(
name
=
"邻井井号"
)
private
String
ljjh
;
...
...
src/main/java/com/zjsgfa/project/zjsgfa/domain/SjFdsgcsDcyxt.java
0 → 100644
View file @
1ada7cfc
package
com
.
zjsgfa
.
project
.
zjsgfa
.
domain
;
import
com.zjsgfa.framework.aspectj.lang.annotation.Excel
;
import
com.zjsgfa.framework.web.domain.BaseEntity
;
import
lombok.Data
;
/**
* 地层压力图对象 sj_fdsgcs_dcyxt
*
* @author ruoyi
* @date 2025-12-09
*/
@Data
public
class
SjFdsgcsDcyxt
extends
BaseEntity
{
private
static
final
long
serialVersionUID
=
1L
;
/** 主键 */
private
Long
id
;
/** 主表id */
@Excel
(
name
=
"主表id"
)
private
String
zbid
;
/** 井身结构图 */
@Excel
(
name
=
"地层压力图"
)
private
String
jsjgt
;
}
src/main/java/com/zjsgfa/project/zjsgfa/mapper/CommonFileMapper.java
View file @
1ada7cfc
...
...
@@ -58,4 +58,7 @@ public interface CommonFileMapper
* @return 结果
*/
public
int
deleteCommonFileByIds
(
Long
[]
ids
);
int
deleteCommonFileByICommonFile
(
CommonFile
upFile
);
}
src/main/java/com/zjsgfa/project/zjsgfa/mapper/SjFdsgcsDcyxtMapper.java
0 → 100644
View file @
1ada7cfc
package
com
.
zjsgfa
.
project
.
zjsgfa
.
mapper
;
import
java.util.List
;
import
com.zjsgfa.project.zjsgfa.domain.SjFdsgcsDcyxt
;
/**
* 地层压力图Mapper接口
*
* @author ruoyi
* @date 2025-12-09
*/
public
interface
SjFdsgcsDcyxtMapper
{
/**
* 查询地层压力图
*
* @param id 地层压力图主键
* @return 地层压力图
*/
public
SjFdsgcsDcyxt
selectSjFdsgcsDcyxtById
(
Long
id
);
/**
* 查询地层压力图列表
*
* @param sjFdsgcsDcyxt 地层压力图
* @return 地层压力图集合
*/
public
List
<
SjFdsgcsDcyxt
>
selectSjFdsgcsDcyxtList
(
SjFdsgcsDcyxt
sjFdsgcsDcyxt
);
/**
* 新增地层压力图
*
* @param sjFdsgcsDcyxt 地层压力图
* @return 结果
*/
public
int
insertSjFdsgcsDcyxt
(
SjFdsgcsDcyxt
sjFdsgcsDcyxt
);
/**
* 修改地层压力图
*
* @param sjFdsgcsDcyxt 地层压力图
* @return 结果
*/
public
int
updateSjFdsgcsDcyxt
(
SjFdsgcsDcyxt
sjFdsgcsDcyxt
);
/**
* 删除地层压力图
*
* @param id 地层压力图主键
* @return 结果
*/
public
int
deleteSjFdsgcsDcyxtById
(
Long
id
);
/**
* 批量删除地层压力图
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public
int
deleteSjFdsgcsDcyxtByIds
(
Long
[]
ids
);
int
deleteSjFdsgcsDcyxtByZbid
(
String
zbid
);
}
src/main/java/com/zjsgfa/project/zjsgfa/service/ICommonFileService.java
View file @
1ada7cfc
...
...
@@ -58,4 +58,6 @@ public interface ICommonFileService
* @return 结果
*/
public
int
deleteCommonFileById
(
Long
id
);
int
deleteCommonFileByICommonFile
(
CommonFile
upFile
);
}
src/main/java/com/zjsgfa/project/zjsgfa/service/ISjFdsgcsDcyxtService.java
0 → 100644
View file @
1ada7cfc
package
com
.
zjsgfa
.
project
.
zjsgfa
.
service
;
import
java.util.List
;
import
com.zjsgfa.project.zjsgfa.domain.SjFdsgcsDcyxt
;
/**
* 地层压力图Service接口
*
* @author ruoyi
* @date 2025-12-09
*/
public
interface
ISjFdsgcsDcyxtService
{
/**
* 查询地层压力图
*
* @param id 地层压力图主键
* @return 地层压力图
*/
public
SjFdsgcsDcyxt
selectSjFdsgcsDcyxtById
(
Long
id
);
/**
* 查询地层压力图列表
*
* @param sjFdsgcsDcyxt 地层压力图
* @return 地层压力图集合
*/
public
List
<
SjFdsgcsDcyxt
>
selectSjFdsgcsDcyxtList
(
SjFdsgcsDcyxt
sjFdsgcsDcyxt
);
/**
* 新增地层压力图
*
* @param sjFdsgcsDcyxt 地层压力图
* @return 结果
*/
public
int
insertSjFdsgcsDcyxt
(
SjFdsgcsDcyxt
sjFdsgcsDcyxt
);
/**
* 修改地层压力图
*
* @param sjFdsgcsDcyxt 地层压力图
* @return 结果
*/
public
int
updateSjFdsgcsDcyxt
(
SjFdsgcsDcyxt
sjFdsgcsDcyxt
);
/**
* 批量删除地层压力图
*
* @param ids 需要删除的地层压力图主键集合
* @return 结果
*/
public
int
deleteSjFdsgcsDcyxtByIds
(
Long
[]
ids
);
/**
* 删除地层压力图信息
*
* @param id 地层压力图主键
* @return 结果
*/
public
int
deleteSjFdsgcsDcyxtById
(
Long
id
);
}
src/main/java/com/zjsgfa/project/zjsgfa/service/impl/CommonFileServiceImpl.java
View file @
1ada7cfc
...
...
@@ -92,4 +92,9 @@ public class CommonFileServiceImpl implements ICommonFileService
{
return
commonFileMapper
.
deleteCommonFileById
(
id
);
}
@Override
public
int
deleteCommonFileByICommonFile
(
CommonFile
upFile
)
{
return
commonFileMapper
.
deleteCommonFileByICommonFile
(
upFile
);
}
}
src/main/java/com/zjsgfa/project/zjsgfa/service/impl/SjDjjcServiceImpl.java
View file @
1ada7cfc
...
...
@@ -893,43 +893,6 @@ public class SjDjjcServiceImpl implements ISjDjjcService
}
//获取地层压力数据
Map
map
=
new
HashMap
<>();
map
.
put
(
"jh_list"
,
jh_list
);
Gson
gson
=
new
GsonBuilder
().
setPrettyPrinting
().
create
();
String
json
=
gson
.
toJson
(
map
);
//调用httpsPost请求获取数据
String
url
=
"https://10.68.249.59:12001/api/ljzjymd"
;
String
result
=
HttpsPostUtil
.
doPostWithoutSslVerify
(
url
,
json
);
JsonObject
root
=
gson
.
fromJson
(
result
,
JsonObject
.
class
);
JsonObject
outerData
=
root
.
getAsJsonObject
(
"data"
);
List
<
String
>
dcylmsList
=
new
ArrayList
<>();
List
<
SjFdsgcsDcylZjymdsjb
>
zjymdsjbList
=
new
ArrayList
<>();
List
<
SjFdsgcsDcylZjymdtjb
>
zjymdtjbList
=
new
ArrayList
<>();
for
(
String
ljh:
jh_list
){
JsonObject
innerData
=
outerData
.
getAsJsonObject
(
ljh
);
if
(
innerData
!=
null
){
//邻井钻井液密度数据表
JsonArray
zjymdsjb
=
innerData
.
getAsJsonArray
(
"邻井钻井液密度数据表"
);
List
<
SjFdsgcsDcylZjymdsjb
>
list
=
getZjymdsjbList
(
zjymdsjb
,
jh
);
zjymdsjbList
.
addAll
(
list
);
//邻井钻井液密度统计表
JsonArray
zjymdtjb
=
innerData
.
getAsJsonArray
(
"邻井钻井液密度统计表"
);
zjymdtjbList
.
addAll
(
getZjymdtjbList
(
zjymdtjb
,
ljh
,
jh
));
//地层压力描述文本
String
dcylms
=
innerData
.
get
(
"地层压力描述文本"
).
toString
();
dcylmsList
.
add
(
"邻井"
+
ljh
+
dcylms
);
}
}
if
(
zjymdsjbList
.
size
()>
0
){
sjFdsgcsDcylZjymdsjbMapper
.
deleteSjFdsgcsDcylZjymdsjbByjh
(
jh
);
sjFdsgcsDcylZjymdsjbMapper
.
insertSjFdsgcsDcylZjymdsjbBatch
(
zjymdsjbList
);
}
if
(
zjymdtjbList
.
size
()>
0
){
sjFdsgcsDcylZjymdtjbMapper
.
deleteSjFdsgcsDcylZjymdtjbByJh
(
jh
);
sjFdsgcsDcylZjymdtjbMapper
.
insertSjFdsgcsDcylZjymdtjbBatch
(
zjymdtjbList
);
}
return
AjaxResult
.
success
();
}
...
...
@@ -1389,52 +1352,7 @@ public class SjDjjcServiceImpl implements ISjDjjcService
public
List
<
SjFdsgcsDcylZjymdsjb
>
getZjymdsjbList
(
JsonArray
data
,
String
jh
)
{
List
<
SjFdsgcsDcylZjymdsjb
>
list
=
new
ArrayList
<>();
data
.
forEach
(
item
->
{
SjFdsgcsDcylZjymdsjb
sjFdsgcsDcylZjymdsjb
=
new
SjFdsgcsDcylZjymdsjb
();
JsonObject
jsonObject
=
item
.
getAsJsonObject
();
String
ljjh
=
jsonObject
.
get
(
"井号"
).
getAsString
();
Double
qyjs
=
jsonObject
.
get
(
"取样井深"
).
getAsDouble
();
Double
md
=
jsonObject
.
get
(
"密度"
).
getAsDouble
();
Double
dycs
=
jsonObject
.
get
(
"对应垂深"
).
getAsDouble
();
String
dycw
=
jsonObject
.
get
(
"对应层位"
).
getAsString
();
sjFdsgcsDcylZjymdsjb
.
setJh
(
jh
);
sjFdsgcsDcylZjymdsjb
.
setLjjh
(
ljjh
);
sjFdsgcsDcylZjymdsjb
.
setQyjs
(
qyjs
);
sjFdsgcsDcylZjymdsjb
.
setMd
(
md
);
sjFdsgcsDcylZjymdsjb
.
setDycs
(
dycs
);
sjFdsgcsDcylZjymdsjb
.
setDycw
(
dycw
);
list
.
add
(
sjFdsgcsDcylZjymdsjb
);
});
return
list
;
}
public
List
<
SjFdsgcsDcylZjymdtjb
>
getZjymdtjbList
(
JsonArray
data
,
String
ljjh
,
String
jh
)
{
List
<
SjFdsgcsDcylZjymdtjb
>
list
=
new
ArrayList
<>();
data
.
forEach
(
item
->
{
SjFdsgcsDcylZjymdtjb
sjFdsgcsDcylZjymdtjb
=
new
SjFdsgcsDcylZjymdtjb
();
JsonObject
jsonObject
=
item
.
getAsJsonObject
();
String
cw
=
jsonObject
.
get
(
"层位"
).
getAsString
();
Double
mdMin
=
jsonObject
.
get
(
"密度最小值"
).
getAsDouble
();
Double
mdMax
=
jsonObject
.
get
(
"密度最大值"
).
getAsDouble
();
Double
qycsMin
=
jsonObject
.
get
(
"取样垂深最小值"
).
getAsDouble
();
Double
qycsMax
=
jsonObject
.
get
(
"取样垂深最大值"
).
getAsDouble
();
sjFdsgcsDcylZjymdtjb
.
setLjjh
(
ljjh
);
sjFdsgcsDcylZjymdtjb
.
setJh
(
jh
);
sjFdsgcsDcylZjymdtjb
.
setCw
(
cw
);
sjFdsgcsDcylZjymdtjb
.
setMdMin
(
mdMin
);
sjFdsgcsDcylZjymdtjb
.
setMdMax
(
mdMax
);
sjFdsgcsDcylZjymdtjb
.
setQycsMin
(
qycsMin
);
sjFdsgcsDcylZjymdtjb
.
setQycsMax
(
qycsMax
);
list
.
add
(
sjFdsgcsDcylZjymdtjb
);
});
return
list
;
}
}
src/main/java/com/zjsgfa/project/zjsgfa/service/impl/SjFdsgcsDcyxtServiceImpl.java
0 → 100644
View file @
1ada7cfc
package
com
.
zjsgfa
.
project
.
zjsgfa
.
service
.
impl
;
import
java.util.List
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
import
com.zjsgfa.project.zjsgfa.mapper.SjFdsgcsDcyxtMapper
;
import
com.zjsgfa.project.zjsgfa.domain.SjFdsgcsDcyxt
;
import
com.zjsgfa.project.zjsgfa.service.ISjFdsgcsDcyxtService
;
/**
* 地层压力图Service业务层处理
*
* @author ruoyi
* @date 2025-12-09
*/
@Service
public
class
SjFdsgcsDcyxtServiceImpl
implements
ISjFdsgcsDcyxtService
{
@Autowired
private
SjFdsgcsDcyxtMapper
sjFdsgcsDcyxtMapper
;
/**
* 查询地层压力图
*
* @param id 地层压力图主键
* @return 地层压力图
*/
@Override
public
SjFdsgcsDcyxt
selectSjFdsgcsDcyxtById
(
Long
id
)
{
return
sjFdsgcsDcyxtMapper
.
selectSjFdsgcsDcyxtById
(
id
);
}
/**
* 查询地层压力图列表
*
* @param sjFdsgcsDcyxt 地层压力图
* @return 地层压力图
*/
@Override
public
List
<
SjFdsgcsDcyxt
>
selectSjFdsgcsDcyxtList
(
SjFdsgcsDcyxt
sjFdsgcsDcyxt
)
{
return
sjFdsgcsDcyxtMapper
.
selectSjFdsgcsDcyxtList
(
sjFdsgcsDcyxt
);
}
/**
* 新增地层压力图
*
* @param sjFdsgcsDcyxt 地层压力图
* @return 结果
*/
@Override
public
int
insertSjFdsgcsDcyxt
(
SjFdsgcsDcyxt
sjFdsgcsDcyxt
)
{
sjFdsgcsDcyxtMapper
.
deleteSjFdsgcsDcyxtByZbid
(
sjFdsgcsDcyxt
.
getZbid
());
return
sjFdsgcsDcyxtMapper
.
insertSjFdsgcsDcyxt
(
sjFdsgcsDcyxt
);
}
/**
* 修改地层压力图
*
* @param sjFdsgcsDcyxt 地层压力图
* @return 结果
*/
@Override
public
int
updateSjFdsgcsDcyxt
(
SjFdsgcsDcyxt
sjFdsgcsDcyxt
)
{
return
sjFdsgcsDcyxtMapper
.
updateSjFdsgcsDcyxt
(
sjFdsgcsDcyxt
);
}
/**
* 批量删除地层压力图
*
* @param ids 需要删除的地层压力图主键
* @return 结果
*/
@Override
public
int
deleteSjFdsgcsDcyxtByIds
(
Long
[]
ids
)
{
return
sjFdsgcsDcyxtMapper
.
deleteSjFdsgcsDcyxtByIds
(
ids
);
}
/**
* 删除地层压力图信息
*
* @param id 地层压力图主键
* @return 结果
*/
@Override
public
int
deleteSjFdsgcsDcyxtById
(
Long
id
)
{
return
sjFdsgcsDcyxtMapper
.
deleteSjFdsgcsDcyxtById
(
id
);
}
}
src/main/java/com/zjsgfa/project/zjsgfa/service/impl/SjFdsgcsServiceImpl.java
View file @
1ada7cfc
...
...
@@ -7,8 +7,15 @@ import java.util.*;
import
java.util.stream.Collectors
;
import
cn.hutool.core.codec.Base64
;
import
cn.hutool.http.HttpRequest
;
import
com.google.gson.Gson
;
import
com.google.gson.GsonBuilder
;
import
com.google.gson.JsonArray
;
import
com.google.gson.JsonObject
;
import
com.zjsgfa.common.utils.DateUtils
;
import
com.zjsgfa.common.utils.StringUtils
;
import
com.zjsgfa.framework.util.HttpsPostUtil
;
import
com.zjsgfa.framework.util.HttpsSkipVerifyUtil
;
import
com.zjsgfa.project.zjsgfa.domain.*
;
import
com.zjsgfa.project.zjsgfa.mapper.*
;
import
com.zjsgfa.project.zjsgfa.util.CxszhUtil
;
...
...
@@ -73,6 +80,13 @@ public class SjFdsgcsServiceImpl implements ISjFdsgcsService
@Autowired
private
SjJygjGdfdcsMapper
sjJygjGdfdcsMapper
;
@Autowired
private
SjFdsgcsDcylZjymdsjbMapper
sjFdsgcsDcylZjymdsjbMapper
;
@Autowired
private
SjFdsgcsDcylZjymdtjbMapper
sjFdsgcsDcylZjymdtjbMapper
;
/**
* 查询设计-分段施工措施
*
...
...
@@ -302,6 +316,64 @@ public class SjFdsgcsServiceImpl implements ISjFdsgcsService
System
.
out
.
println
(
"所有井的造斜规律数据"
+
djZqsjfxList
);
List
<
String
>
jh_list
=
sjLjjwList
.
stream
().
filter
(
it
->
"附近高指标井"
.
equals
(
it
.
getLb1
())).
map
(
SjLjjw:
:
getLjjh
).
collect
(
Collectors
.
toList
());
SjFdsgcsDcyx
sjFdsgcsDcyx1
=
new
SjFdsgcsDcyx
();
sjFdsgcsDcyx1
.
setJh
(
sjFdsgcs
.
getJh
());
List
<
SjFdsgcsDcyx
>
sjFdsgcsDcyxes
=
sjFdsgcsDcyxMapper
.
selectSjFdsgcsDcyxList
(
sjFdsgcsDcyx1
);
List
<
SjFdsgcsDcylZjymdsjb
>
zjymdsjbList
=
new
ArrayList
<>();
List
<
SjFdsgcsDcylZjymdtjb
>
zjymdtjbList
=
new
ArrayList
<>();
if
(
jh_list
.
size
()>
0
){
//获取地层压力数据
Map
map
=
new
HashMap
<>();
map
.
put
(
"jh_list"
,
jh_list
.
toArray
());
Gson
gson
=
new
GsonBuilder
().
setPrettyPrinting
().
create
();
String
json
=
gson
.
toJson
(
map
);
//调用httpsPost请求获取数据
String
url
=
"https://10.68.249.59:12001/api/ljzjymd"
;
System
.
out
.
println
(
json
);
String
result
=
HttpRequest
.
post
(
url
).
body
(
json
).
execute
().
body
();
// String result = HttpsSkipVerifyUtil.doPost(url, json);
System
.
out
.
println
(
result
);
JsonObject
root
=
gson
.
fromJson
(
result
,
JsonObject
.
class
);
JsonObject
outerData
=
root
.
getAsJsonObject
(
"data"
);
List
<
String
>
dcylmsList
=
new
ArrayList
<>();
for
(
String
ljh:
jh_list
){
JsonObject
innerData
=
outerData
.
getAsJsonObject
(
ljh
);
if
(
innerData
!=
null
){
//邻井钻井液密度数据表
JsonArray
zjymdsjb
=
innerData
.
getAsJsonArray
(
"邻井钻井液密度数据表"
);
List
<
SjFdsgcsDcylZjymdsjb
>
list
=
getZjymdsjbList
(
zjymdsjb
,
sjFdsgcs
.
getJh
(),
sjFdsgcsDcyxes
);
zjymdsjbList
.
addAll
(
list
);
//邻井钻井液密度统计表
JsonArray
zjymdtjb
=
innerData
.
getAsJsonArray
(
"邻井钻井液密度统计表"
);
zjymdtjbList
.
addAll
(
getZjymdtjbList
(
zjymdtjb
,
ljh
,
sjFdsgcs
.
getJh
(),
sjFdsgcsDcyxes
));
//地层压力描述文本
// String dcylms = innerData.get("地层压力描述文本").toString();
// dcylmsList.add("邻井"+ljh+dcylms);
}
}
//
//
////
// fillLiang217Xie40Data(sjFdsgcs.getJh(),"一开",zjymdsjbList);
// // 3. 填充梁217-斜29井 数据表数据(对应邻井钻井液密度数据表)
// fillLiang217Xie29Data(sjFdsgcs.getJh(),"二开",zjymdsjbList);
//
// fillLiang217Xie40Stat(sjFdsgcs.getJh(),"一开",zjymdtjbList);
// fillLiang217Xie29Stat(sjFdsgcs.getJh(),"二开",zjymdtjbList);
if
(
zjymdsjbList
.
size
()>
0
){
sjFdsgcsDcylZjymdsjbMapper
.
deleteSjFdsgcsDcylZjymdsjbByjh
(
sjFdsgcs
.
getJh
());
sjFdsgcsDcylZjymdsjbMapper
.
insertSjFdsgcsDcylZjymdsjbBatch
(
zjymdsjbList
);
}
if
(
zjymdtjbList
.
size
()>
0
){
sjFdsgcsDcylZjymdtjbMapper
.
deleteSjFdsgcsDcylZjymdtjbByJh
(
sjFdsgcs
.
getJh
());
sjFdsgcsDcylZjymdtjbMapper
.
insertSjFdsgcsDcylZjymdtjbBatch
(
zjymdtjbList
);
}
}
double
previousDepth
=
0
;
double
csaa
=
0
;
...
...
@@ -341,6 +413,10 @@ public class SjFdsgcsServiceImpl implements ISjFdsgcsService
}
String
kc
=
sjJsjg1
.
getKc
();
sjFdsgcs
.
setKc
(
kc
);
SjFdsgcs
sjFdsgcs1
=
sjFdsgcsMapper
.
selectSjFdsgcsByJhAndKc
(
sjFdsgcs
);
...
...
@@ -364,6 +440,20 @@ public class SjFdsgcsServiceImpl implements ISjFdsgcsService
}
System
.
out
.
println
(
"ytzl=========="
+
ytzl
);
List
<
SjFdsgcsDcylZjymdtjb
>
collect4
=
zjymdtjbList
.
stream
().
filter
(
zjymdtjb
->
kc
.
equals
(
zjymdtjb
.
getKc
())
).
collect
(
Collectors
.
toList
());
String
dcyl
=
""
;
if
(
collect4
.
size
()>
0
){
List
<
String
>
dcylList
=
new
ArrayList
<>();
collect4
.
forEach
(
zjymdtjb
->
{
String
aa
=
zjymdtjb
.
getCw
()+
" 密度范围为"
+
zjymdtjb
.
getMdMin
()+
"-"
+
zjymdtjb
.
getMdMax
()+
",取样垂深在"
+
zjymdtjb
.
getQycsMin
()+
"-"
+
zjymdtjb
.
getQycsMax
()+
"。"
;
dcylList
.
add
(
aa
);
});
String
bb
=
String
.
join
(
" "
,
dcylList
);
dcyl
=
"经分析,根据邻井钻井液密度分析出的压力情况如下。"
+
bb
;
}
if
(
sjFdsgcs1
==
null
){
//查询是否有复杂情况
...
...
@@ -455,6 +545,7 @@ public class SjFdsgcsServiceImpl implements ISjFdsgcsService
}
}
sjFdsgcs
.
setGjfx
(
gjyh
);
sjFdsgcs
.
setDcyl
(
dcyl
);
sjFdsgcsMapper
.
insertSjFdsgcs
(
sjFdsgcs
);
}
else
{
sjFdsgcs1
.
setGjfx
(
gjyh
);
...
...
@@ -554,6 +645,7 @@ public class SjFdsgcsServiceImpl implements ISjFdsgcsService
sjFdsgcs1
.
setJdqk
(
previousDepth
+
"-"
+
cs
+
","
+
sjFdsgcsDcyxList
.
get
(
0
).
getDcmc
()+
"-"
+
sjFdsgcsDcyxList
.
get
(
sjFdsgcsDcyxList
.
size
()-
1
).
getDcmc
());
}
}
sjFdsgcs1
.
setDcyl
(
dcyl
);
sjFdsgcsMapper
.
updateSjFdsgcs
(
sjFdsgcs1
);
}
...
...
@@ -717,4 +809,204 @@ public class SjFdsgcsServiceImpl implements ISjFdsgcsService
}
}
public
List
<
SjFdsgcsDcylZjymdsjb
>
getZjymdsjbList
(
JsonArray
data
,
String
jh
,
List
<
SjFdsgcsDcyx
>
dcyxList
)
{
List
<
SjFdsgcsDcylZjymdsjb
>
list
=
new
ArrayList
<>();
data
.
forEach
(
item
->
{
SjFdsgcsDcylZjymdsjb
sjFdsgcsDcylZjymdsjb
=
new
SjFdsgcsDcylZjymdsjb
();
JsonObject
jsonObject
=
item
.
getAsJsonObject
();
String
ljjh
=
jsonObject
.
get
(
"井号"
).
getAsString
();
Double
qyjs
=
jsonObject
.
get
(
"取样井深"
).
getAsDouble
();
Double
md
=
jsonObject
.
get
(
"密度"
).
getAsDouble
();
Double
dycs
=
jsonObject
.
get
(
"对应垂深"
).
getAsDouble
();
String
dycw
=
jsonObject
.
get
(
"对应层位"
).
getAsString
();
List
<
Djjc
>
kcList
=
djdcService
.
getJhKcList
(
ljjh
);
Djjc
djjc1
=
kcList
.
stream
()
.
filter
(
djjc
->
qyjs
>=
djjc
.
getKsjs
()
&&
qyjs
<=
djjc
.
getJs
())
.
findFirst
().
orElse
(
null
);
if
(
djjc1
!=
null
){
sjFdsgcsDcylZjymdsjb
.
setKc
(
getKc
(
djjc1
.
getKc
()));
}
sjFdsgcsDcylZjymdsjb
.
setJh
(
jh
);
sjFdsgcsDcylZjymdsjb
.
setLjjh
(
ljjh
);
sjFdsgcsDcylZjymdsjb
.
setQyjs
(
qyjs
);
sjFdsgcsDcylZjymdsjb
.
setMd
(
md
);
sjFdsgcsDcylZjymdsjb
.
setDycs
(
dycs
);
sjFdsgcsDcylZjymdsjb
.
setDycw
(
dycw
);
list
.
add
(
sjFdsgcsDcylZjymdsjb
);
});
return
list
;
}
public
String
getKc
(
String
kc
)
{
if
(
kc
.
equals
(
"1"
)){
kc
=
"一开"
;
}
else
if
(
kc
.
equals
(
"2"
)){
kc
=
"二开"
;
}
else
if
(
kc
.
equals
(
"3"
)){
kc
=
"三开"
;
}
else
if
(
kc
.
equals
(
"4"
)){
kc
=
"四开"
;
}
else
if
(
kc
.
equals
(
"5"
)){
kc
=
"五开"
;
}
return
kc
;
}
public
List
<
SjFdsgcsDcylZjymdtjb
>
getZjymdtjbList
(
JsonArray
data
,
String
ljjh
,
String
jh
,
List
<
SjFdsgcsDcyx
>
dcyxList
)
{
List
<
SjFdsgcsDcylZjymdtjb
>
list
=
new
ArrayList
<>();
data
.
forEach
(
item
->
{
SjFdsgcsDcylZjymdtjb
sjFdsgcsDcylZjymdtjb
=
new
SjFdsgcsDcylZjymdtjb
();
JsonObject
jsonObject
=
item
.
getAsJsonObject
();
String
cw
=
jsonObject
.
get
(
"层位"
).
getAsString
();
Double
mdMin
=
jsonObject
.
get
(
"密度最小值"
).
getAsDouble
();
Double
mdMax
=
jsonObject
.
get
(
"密度最大值"
).
getAsDouble
();
Double
qycsMin
=
jsonObject
.
get
(
"取样垂深最小值"
).
getAsDouble
();
Double
qycsMax
=
jsonObject
.
get
(
"取样垂深最大值"
).
getAsDouble
();
List
<
Djjc
>
kcList
=
djdcService
.
getJhKcList
(
ljjh
);
Djjc
djjc1
=
kcList
.
stream
()
.
filter
(
djjc
->
qycsMin
>=
djjc
.
getKsjs
()
&&
qycsMin
<=
djjc
.
getJs
())
.
findFirst
().
orElse
(
null
);
if
(
djjc1
!=
null
){
sjFdsgcsDcylZjymdtjb
.
setKc
(
getKc
(
djjc1
.
getKc
()));
}
sjFdsgcsDcylZjymdtjb
.
setLjjh
(
ljjh
);
sjFdsgcsDcylZjymdtjb
.
setJh
(
jh
);
sjFdsgcsDcylZjymdtjb
.
setCw
(
cw
);
sjFdsgcsDcylZjymdtjb
.
setMdMin
(
mdMin
);
sjFdsgcsDcylZjymdtjb
.
setMdMax
(
mdMax
);
sjFdsgcsDcylZjymdtjb
.
setQycsMin
(
qycsMin
);
sjFdsgcsDcylZjymdtjb
.
setQycsMax
(
qycsMax
);
list
.
add
(
sjFdsgcsDcylZjymdtjb
);
});
return
list
;
}
/**
* 填充梁217-斜40井 钻井液密度数据表数据
*/
private
static
void
fillLiang217Xie40Data
(
String
mainWellNo
,
String
kc
,
List
<
SjFdsgcsDcylZjymdsjb
>
dataList
)
{
// String mainWellNo = "主井号(可根据实际填写,如梁217-XX)"; // 实际场景需替换为目标井号
String
neighborWellNo
=
"梁217-斜40"
;
// 邻井井号
// String kc = "区块信息(可根据实际填写,如梁217区块)"; // 区块字段(文档未明确,预留默认值)
// 逐条映射文档中的"邻井钻井液密度数据表"数据
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
359.5
,
1.09
,
359.49
,
"东营组"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
359.5
,
1.09
,
359.49
,
"东营组"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
1100.0
,
1.09
,
1099.1132768752161
,
"东营组"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
1665.0
,
1.09
,
1612.229411764706
,
"东营组"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
2150.0
,
1.1
,
2028.5997203774903
,
"东营组"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
2450.0
,
1.21
,
2286.020289905693
,
"沙二段"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
2600.0
,
1.21
,
2419.1807601527244
,
"沙二段"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
2810.0
,
1.21
,
2601.9646916608267
,
"沙三上"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
3000.0
,
1.25
,
2764.699968652038
,
"沙三下"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
3122.0
,
1.26
,
2869.132985386221
,
"沙三下"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
3300.0
,
1.32
,
3024.5532614742697
,
"沙四上"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
3450.0
,
1.32
,
3162.20346355075
,
"沙四上"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
3571.0
,
1.35
,
3273.57
,
"沙四下"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
3571.0
,
1.35
,
3273.57
,
"沙四下"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
3571.0
,
1.35
,
3273.57
,
"沙四下"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
3571.0
,
1.35
,
3273.57
,
"沙四下"
);
}
/**
* 填充梁217-斜29井 钻井液密度数据表数据
*/
private
static
void
fillLiang217Xie29Data
(
String
mainWellNo
,
String
kc
,
List
<
SjFdsgcsDcylZjymdsjb
>
dataList
)
{
// String mainWellNo = "主井号(可根据实际填写,如梁217-XX)";
String
neighborWellNo
=
"梁217-斜29"
;
// String kc = "区块信息(可根据实际填写,如梁217区块)";
// 逐条映射文档中的"邻井钻井液密度数据表"数据
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
359.0
,
1.08
,
358.76275130434783
,
"东营组"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
530.0
,
1.08
,
529.5564785788924
,
"东营组"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
950.0
,
1.08
,
949.073211452225
,
"东营组"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
1579.0
,
1.09
,
1554.5117318435755
,
"东营组"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
2250.0
,
1.1
,
2151.504330543933
,
"沙二段"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
2486.0
,
1.15
,
2366.0411892270026
,
"沙二段"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
2486.0
,
1.18
,
2366.0411892270026
,
"沙二段"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
2873.0
,
1.21
,
2705.3184577978463
,
"沙三下"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
3050.0
,
1.26
,
2868.4271209480657
,
"沙三下"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
3280.0
,
1.35
,
3090.7713604488076
,
"沙四上"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
3445.0
,
1.35
,
3253.37
,
"沙四下"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
3445.0
,
1.35
,
3253.37
,
"沙四下"
);
addDataItem
(
dataList
,
mainWellNo
,
kc
,
neighborWellNo
,
3445.0
,
1.35
,
3253.37
,
"沙四下"
);
}
/**
* 填充梁217-斜40井 钻井液密度统计表数据
*/
private
static
void
fillLiang217Xie40Stat
(
String
mainWellNo
,
String
kc
,
List
<
SjFdsgcsDcylZjymdtjb
>
statList
)
{
// String mainWellNo = "主井号(可根据实际填写,如梁217-XX)";
String
neighborWellNo
=
"梁217-斜40"
;
// String kc = "区块信息(可根据实际填写,如梁217区块)";
// 逐条映射文档中的"邻井钻井液密度统计表"数据
addStatItem
(
statList
,
mainWellNo
,
kc
,
neighborWellNo
,
"东营组"
,
1.09
,
1.1
,
359.49
,
2028.5997203774903
);
addStatItem
(
statList
,
mainWellNo
,
kc
,
neighborWellNo
,
"沙二段"
,
1.21
,
1.21
,
2286.020289905693
,
2419.1807601527244
);
addStatItem
(
statList
,
mainWellNo
,
kc
,
neighborWellNo
,
"沙三上"
,
1.21
,
1.21
,
2601.9646916608267
,
2601.9646916608267
);
addStatItem
(
statList
,
mainWellNo
,
kc
,
neighborWellNo
,
"沙三下"
,
1.25
,
1.26
,
2764.699968652038
,
2869.132985386221
);
addStatItem
(
statList
,
mainWellNo
,
kc
,
neighborWellNo
,
"沙四上"
,
1.32
,
1.32
,
3024.5532614742697
,
3162.20346355075
);
addStatItem
(
statList
,
mainWellNo
,
kc
,
neighborWellNo
,
"沙四下"
,
1.35
,
1.35
,
3273.57
,
3273.57
);
}
/**
* 填充梁217-斜29井 钻井液密度统计表数据
*/
private
static
void
fillLiang217Xie29Stat
(
String
mainWellNo
,
String
kc
,
List
<
SjFdsgcsDcylZjymdtjb
>
statList
)
{
// String mainWellNo = "主井号(可根据实际填写,如梁217-XX)";
String
neighborWellNo
=
"梁217-斜29"
;
// String kc = "区块信息(可根据实际填写,如梁217区块)";
// 逐条映射文档中的"邻井钻井液密度统计表"数据
addStatItem
(
statList
,
mainWellNo
,
kc
,
neighborWellNo
,
"东营组"
,
1.08
,
1.09
,
358.76275130434783
,
1554.5117318435755
);
addStatItem
(
statList
,
mainWellNo
,
kc
,
neighborWellNo
,
"沙二段"
,
1.1
,
1.18
,
2151.504330543933
,
2366.0411892270026
);
addStatItem
(
statList
,
mainWellNo
,
kc
,
neighborWellNo
,
"沙三下"
,
1.21
,
1.26
,
2705.3184577978463
,
2868.4271209480657
);
addStatItem
(
statList
,
mainWellNo
,
kc
,
neighborWellNo
,
"沙四上"
,
1.35
,
1.35
,
3090.7713604488076
,
3090.7713604488076
);
addStatItem
(
statList
,
mainWellNo
,
kc
,
neighborWellNo
,
"沙四下"
,
1.35
,
1.35
,
3253.37
,
3253.37
);
}
/**
* 工具方法:创建数据表实体并添加到List
*/
private
static
void
addDataItem
(
List
<
SjFdsgcsDcylZjymdsjb
>
list
,
String
jh
,
String
kc
,
String
ljjh
,
Double
qyjs
,
Double
md
,
Double
dycs
,
String
dycw
)
{
SjFdsgcsDcylZjymdsjb
data
=
new
SjFdsgcsDcylZjymdsjb
();
data
.
setJh
(
jh
);
// 主井号
data
.
setKc
(
kc
);
// 区块
data
.
setLjjh
(
ljjh
);
// 邻井井号
data
.
setQyjs
(
qyjs
);
// 取样井深
data
.
setMd
(
md
);
// 密度
data
.
setDycs
(
dycs
);
// 对应垂深
data
.
setDycw
(
dycw
);
// 对应层位
list
.
add
(
data
);
}
/**
* 工具方法:创建统计表实体并添加到List
*/
private
static
void
addStatItem
(
List
<
SjFdsgcsDcylZjymdtjb
>
list
,
String
jh
,
String
kc
,
String
ljjh
,
String
cw
,
Double
mdMin
,
Double
mdMax
,
Double
qycsMin
,
Double
qycsMax
)
{
SjFdsgcsDcylZjymdtjb
stat
=
new
SjFdsgcsDcylZjymdtjb
();
stat
.
setJh
(
jh
);
// 主井号
stat
.
setKc
(
kc
);
// 区块
stat
.
setLjjh
(
ljjh
);
// 邻井井号
stat
.
setCw
(
cw
);
// 层位
stat
.
setMdMin
(
mdMin
);
// 密度最小值
stat
.
setMdMax
(
mdMax
);
// 密度最大值
stat
.
setQycsMin
(
qycsMin
);
// 取样垂深最小值
stat
.
setQycsMax
(
qycsMax
);
// 取样垂深最大值
list
.
add
(
stat
);
}
}
src/main/java/com/zjsgfa/project/zjsgfa/util/DrillingMenuRecognizer.java
0 → 100644
View file @
1ada7cfc
package
com
.
zjsgfa
.
project
.
zjsgfa
.
util
;
import
com.zjsgfa.common.utils.StringUtils
;
import
java.util.*
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
/**
* 钻井系统菜单与井号识别工具
* 功能:从用户自然语言中识别目标菜单和井号
*/
public
class
DrillingMenuRecognizer
{
// 定义菜单-关键词映射(静态常量,初始化一次即可)
private
static
final
Map
<
String
,
List
<
String
>>
MENU_KEYWORDS
;
// 静态代码块初始化菜单关键词映射
static
{
MENU_KEYWORDS
=
new
HashMap
<>();
// 逐个添加菜单和对应的关键词
MENU_KEYWORDS
.
put
(
"钻头单支分析"
,
Arrays
.
asList
(
"钻头单支"
,
"单支钻头"
,
"单支"
,
"分析"
,
"单支钻头分析"
));
MENU_KEYWORDS
.
put
(
"口井周期分析"
,
Arrays
.
asList
(
"周期"
,
"井周期"
,
"周期分析"
,
"口井周期分析"
,
"周期数据"
,
"口井周期"
));
MENU_KEYWORDS
.
put
(
"钻头区块分析"
,
Arrays
.
asList
(
"钻头区块"
,
"区块钻头"
,
"区块"
,
"区块钻头分析"
));
MENU_KEYWORDS
.
put
(
"钻具组合分析"
,
Arrays
.
asList
(
"钻具组合"
,
"组合钻具"
,
"钻具"
,
"钻具组合分析"
));
MENU_KEYWORDS
.
put
(
"邻井查询"
,
Arrays
.
asList
(
"邻井"
,
"邻井查询"
,
"周边井"
,
"相邻井"
));
MENU_KEYWORDS
.
put
(
"钻头专家评价"
,
Arrays
.
asList
(
"钻头专家"
,
"专家评价"
,
"评价"
,
"钻头评价"
));
MENU_KEYWORDS
.
put
(
"单井查询"
,
Arrays
.
asList
(
"单井"
,
"单井查询"
));
MENU_KEYWORDS
.
put
(
"分段钻参分析"
,
Arrays
.
asList
(
"分段钻参"
,
"钻参分段"
,
"分段"
,
"分段钻井参数"
));
MENU_KEYWORDS
.
put
(
"开次时间"
,
Arrays
.
asList
(
"开次时间"
,
"开次"
,
"钻井开次"
));
MENU_KEYWORDS
.
put
(
"高指标井查询"
,
Arrays
.
asList
(
"高指标井"
,
"高指标"
,
"指标井查询"
));
MENU_KEYWORDS
.
put
(
"典型地质岩性"
,
Arrays
.
asList
(
"地质岩性"
,
"岩性"
,
"典型岩性"
));
MENU_KEYWORDS
.
put
(
"钻井液指标分析"
,
Arrays
.
asList
(
"钻井液指标"
,
"泥浆指标"
,
"泥浆"
,
"钻井液"
,
"钻井液分析"
));
MENU_KEYWORDS
.
put
(
"造斜规律分析"
,
Arrays
.
asList
(
"造斜规律"
,
"造斜分析"
,
"造斜"
,
"井斜规律"
,
"井斜"
));
}
// 井号匹配的正则表达式(匹配汉字+数字+特殊字符的井号格式)
private
static
final
String
WELL_PATTERN_STR
=
"([\\u4e00-\\u9fa5]+[0-9]+[-\\u4e00-\\u9fa5]*[0-9]*)"
;
private
static
final
Pattern
WELL_PATTERN
=
Pattern
.
compile
(
WELL_PATTERN_STR
);
/**
* 识别用户语句中的菜单和井号
* @param text 用户输入的自然语言语句
* @return 识别结果(包含菜单名和井号)
*/
public
static
RecognizeResult
recognize
(
String
text
)
{
if
(
text
==
null
||
text
.
trim
().
isEmpty
())
{
return
new
RecognizeResult
(
""
,
""
);
}
String
lowerText
=
text
.
toLowerCase
();
// 转小写提高匹配容错率
// 1. 提取井号
String
wellNumber
=
extractWellNumber
(
text
);
// 2. 匹配目标菜单
String
targetMenu
=
matchTargetMenu
(
lowerText
);
String
uselessKeywords
=
"分析|查看|核对|查询|调取|查阅"
;
if
(
StringUtils
.
isNotEmpty
(
wellNumber
)){
wellNumber
=
wellNumber
.
replaceAll
(
uselessKeywords
,
""
);
}
return
new
RecognizeResult
(
targetMenu
,
wellNumber
.
trim
());
}
/**
* 从文本中提取井号
* @param text 原始文本
* @return 提取到的井号(无则返回空字符串)
*/
private
static
String
extractWellNumber
(
String
text
)
{
Matcher
matcher
=
WELL_PATTERN
.
matcher
(
text
);
if
(
matcher
.
find
())
{
return
matcher
.
group
(
1
);
// 返回第一个匹配的井号
}
return
""
;
}
/**
* 匹配目标菜单
* @param lowerText 小写后的用户文本
* @return 匹配到的菜单名(无则返回空字符串)
*/
private
static
String
matchTargetMenu
(
String
lowerText
)
{
for
(
Map
.
Entry
<
String
,
List
<
String
>>
entry
:
MENU_KEYWORDS
.
entrySet
())
{
String
menu
=
entry
.
getKey
();
List
<
String
>
keywords
=
entry
.
getValue
();
// 遍历当前菜单的所有关键词
for
(
String
keyword
:
keywords
)
{
if
(
lowerText
.
contains
(
keyword
.
toLowerCase
()))
{
return
menu
;
// 匹配到立即返回,保证效率
}
}
}
return
""
;
}
/**
* 识别结果封装类
* 用于返回菜单名和井号
*/
public
static
class
RecognizeResult
{
private
String
menu
;
// 目标菜单名
private
String
wellNumber
;
// 井号
public
RecognizeResult
(
String
menu
,
String
wellNumber
)
{
this
.
menu
=
menu
;
this
.
wellNumber
=
wellNumber
;
}
// Getter方法
public
String
getMenu
()
{
return
menu
;
}
public
String
getWellNumber
()
{
return
wellNumber
;
}
// 重写toString方便打印结果
@Override
public
String
toString
()
{
return
"识别结果:菜单="
+
menu
+
",井号="
+
wellNumber
;
}
}
// 测试主方法
public
static
void
main
(
String
[]
args
)
{
// 测试用例1:查询周期数据
String
testText1
=
"我需要查看梁217-斜12的周期数据"
;
RecognizeResult
result1
=
recognize
(
testText1
);
System
.
out
.
println
(
"输入语句:"
+
testText1
);
System
.
out
.
println
(
result1
+
"\n"
);
// 测试用例2:查询邻井信息
String
testText2
=
"帮我查询一下胜301的邻井数据"
;
RecognizeResult
result2
=
recognize
(
testText2
);
System
.
out
.
println
(
"输入语句:"
+
testText2
);
System
.
out
.
println
(
result2
+
"\n"
);
// 测试用例3:分析造斜规律
String
testText3
=
"分析一下东58-斜8的造斜规律"
;
RecognizeResult
result3
=
recognize
(
testText3
);
System
.
out
.
println
(
"输入语句:"
+
testText3
);
System
.
out
.
println
(
result3
);
}
}
\ No newline at end of file
src/main/java/com/zjsgfa/project/zjsgfa/util/FileBase64Converter.java
0 → 100644
View file @
1ada7cfc
package
com
.
zjsgfa
.
project
.
zjsgfa
.
util
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.FileOutputStream
;
import
java.io.IOException
;
import
java.nio.charset.StandardCharsets
;
import
java.util.Base64
;
public
class
FileBase64Converter
{
/**
* 将文件转换为Base64编码字符串
* @param file 要转换的文件对象
* @return Base64编码字符串
* @throws IOException 读取文件时的IO异常
*/
public
static
String
fileToBase64
(
File
file
)
throws
IOException
{
// 1. 校验文件是否有效
if
(
file
==
null
||
!
file
.
exists
()
||
!
file
.
isFile
())
{
throw
new
IllegalArgumentException
(
"文件不存在或不是有效文件"
);
}
// 2. 读取文件字节
try
(
FileInputStream
fis
=
new
FileInputStream
(
file
))
{
byte
[]
fileBytes
=
new
byte
[(
int
)
file
.
length
()];
fis
.
read
(
fileBytes
);
// 3. 编码为Base64字符串(使用URL安全的编码器,避免+、/等特殊字符问题)
return
Base64
.
getUrlEncoder
().
encodeToString
(
fileBytes
);
}
}
/**
* 将Base64字符串转回文件(用于测试验证)
* @param base64Str Base64编码字符串
* @param outputFile 输出文件对象
* @throws IOException 写入文件时的IO异常
*/
public
static
void
base64ToFile
(
String
base64Str
,
File
outputFile
)
throws
IOException
{
// 解码Base64字符串为字节数组
byte
[]
fileBytes
=
Base64
.
getUrlDecoder
().
decode
(
base64Str
);
// 写入文件
try
(
FileOutputStream
fos
=
new
FileOutputStream
(
outputFile
))
{
fos
.
write
(
fileBytes
);
}
}
/**
* 将 Base64 字符串转换为 Excel 文件
* @param base64Str 有效的 Excel 文件 Base64 编码字符串
* @param outputPath 生成 Excel 文件的完整路径(如:D:\\test.xlsx)
* @throws IOException 文件写入异常
* @throws IllegalArgumentException Base64 字符串为空/无效
*/
public
static
void
base64ToExcel
(
String
base64Str
,
String
outputPath
)
throws
IOException
{
// 1. 校验入参有效性
if
(
base64Str
==
null
||
base64Str
.
isEmpty
())
{
throw
new
IllegalArgumentException
(
"Base64 字符串不能为空"
);
}
if
(
outputPath
==
null
||
outputPath
.
isEmpty
())
{
throw
new
IllegalArgumentException
(
"Excel 文件输出路径不能为空"
);
}
File
excelFile
=
new
File
(
outputPath
);
// 确保输出目录存在(如果目录不存在则创建)
File
parentDir
=
excelFile
.
getParentFile
();
if
(!
parentDir
.
exists
())
{
boolean
mkdirsSuccess
=
parentDir
.
mkdirs
();
if
(!
mkdirsSuccess
)
{
throw
new
IOException
(
"创建输出目录失败:"
+
parentDir
.
getAbsolutePath
());
}
}
try
{
// 2. 解码 Base64 字符串为字节数组(兼容 URL 安全的 Base64 编码)
byte
[]
excelBytes
=
Base64
.
getUrlDecoder
().
decode
(
base64Str
);
// 3. 将字节数组写入 Excel 文件(try-with-resources 自动关闭流)
try
(
FileOutputStream
fos
=
new
FileOutputStream
(
excelFile
))
{
fos
.
write
(
excelBytes
);
System
.
out
.
println
(
"Excel 文件生成成功:"
+
excelFile
.
getAbsolutePath
());
}
}
catch
(
IllegalArgumentException
e
)
{
throw
new
IllegalArgumentException
(
"Base64 字符串格式无效,无法解码"
,
e
);
}
}
public
static
void
main
(
String
[]
args
)
throws
IOException
{
// 测试将文件转换为 Base64
File
file
=
new
File
(
"D:\\qianhe\\file\\钻井施工智能优选\\解析\\XYL217X52钻井地质设计.pdf"
);
String
base64Str
=
fileToBase64
(
file
);
System
.
out
.
println
(
"Base64 编码字符串:"
+
base64Str
);
base64ToExcel
(
base64Str
,
"D:\\qianhe\\file\\钻井施工智能优选\\解析\\XYL217X52.pdf"
);
}
}
src/main/java/com/zjsgfa/project/zjsgfa/util/FileToMultipartFileConverter.java
0 → 100644
View file @
1ada7cfc
package
com
.
zjsgfa
.
project
.
zjsgfa
.
util
;
import
org.springframework.web.multipart.MultipartFile
;
import
java.io.File
;
import
java.io.FileInputStream
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.FileOutputStream
;
import
java.io.OutputStream
;
public
class
FileToMultipartFileConverter
{
/**
* 将 File 转换为 MultipartFile(生产环境专用,JDK 1.8 兼容)
* @param file 待转换的 File 对象(非空、存在且为文件)
* @return 实现了 MultipartFile 接口的自定义对象
* @throws IllegalArgumentException 文件无效时抛出
* @throws IOException 文件读取异常时抛出
*/
public
static
MultipartFile
convert
(
File
file
)
throws
IOException
{
// 1. 严格校验文件有效性
if
(
file
==
null
)
{
throw
new
IllegalArgumentException
(
"待转换文件不能为null"
);
}
if
(!
file
.
exists
())
{
throw
new
IllegalArgumentException
(
"文件不存在:"
+
file
.
getAbsolutePath
());
}
if
(!
file
.
isFile
())
{
throw
new
IllegalArgumentException
(
"不是有效文件:"
+
file
.
getAbsolutePath
());
}
// 2. 返回自定义 MultipartFile 实现
return
new
CustomMultipartFile
(
file
);
}
/**
* 自定义 MultipartFile 实现类(核心,JDK 1.8 兼容)
* 完全实现 MultipartFile 接口,无外部依赖
*/
static
class
CustomMultipartFile
implements
MultipartFile
{
private
final
File
file
;
private
final
String
originalFilename
;
private
final
String
contentType
;
/**
* 构造方法:初始化文件信息
* @param file 原始 File 对象
*/
public
CustomMultipartFile
(
File
file
)
{
this
.
file
=
file
;
this
.
originalFilename
=
file
.
getName
();
this
.
contentType
=
getContentTypeByFileName
(
file
.
getName
());
}
/**
* 获取表单字段名(可根据业务自定义,默认返回 "file")
*/
@Override
public
String
getName
()
{
return
"file"
;
}
/**
* 获取文件原始名称(如 test.xlsx)
*/
@Override
public
String
getOriginalFilename
()
{
return
originalFilename
;
}
/**
* 获取文件 MIME 类型(关键:保证文件解析兼容性)
*/
@Override
public
String
getContentType
()
{
return
contentType
;
}
/**
* 判断文件是否为空
*/
@Override
public
boolean
isEmpty
()
{
return
file
.
length
()
==
0
;
}
/**
* 获取文件大小(字节)
*/
@Override
public
long
getSize
()
{
return
file
.
length
();
}
/**
* 获取文件字节数组(适用于小文件)
*/
@Override
public
byte
[]
getBytes
()
throws
IOException
{
try
(
FileInputStream
fis
=
new
FileInputStream
(
file
))
{
byte
[]
bytes
=
new
byte
[(
int
)
file
.
length
()];
int
readLen
=
fis
.
read
(
bytes
);
// 校验读取的字节数是否完整
if
(
readLen
!=
file
.
length
())
{
throw
new
IOException
(
"文件读取不完整,预期读取"
+
file
.
length
()
+
"字节,实际读取"
+
readLen
+
"字节"
);
}
return
bytes
;
}
}
/**
* 获取文件输入流(推荐:大文件优先使用流操作)
*/
@Override
public
InputStream
getInputStream
()
throws
IOException
{
return
new
FileInputStream
(
file
);
}
/**
* 文件转存方法(核心:实现文件保存逻辑)
* @param dest 目标文件
*/
@Override
public
void
transferTo
(
File
dest
)
throws
IOException
,
IllegalStateException
{
// 校验目标文件
if
(
dest
==
null
)
{
throw
new
IllegalArgumentException
(
"目标文件不能为null"
);
}
// 如果目标文件已存在,先删除(避免覆盖异常)
if
(
dest
.
exists
()
&&
!
dest
.
delete
())
{
throw
new
IOException
(
"无法删除已存在的目标文件:"
+
dest
.
getAbsolutePath
());
}
// 确保目标文件目录存在
File
parentDir
=
dest
.
getParentFile
();
if
(!
parentDir
.
exists
()
&&
!
parentDir
.
mkdirs
())
{
throw
new
IOException
(
"无法创建目标文件目录:"
+
parentDir
.
getAbsolutePath
());
}
// 流拷贝文件(高效、低内存占用)
try
(
InputStream
in
=
new
FileInputStream
(
file
);
OutputStream
out
=
new
FileOutputStream
(
dest
))
{
byte
[]
buffer
=
new
byte
[
8192
];
// 8K 缓冲区,平衡性能和内存
int
len
;
while
((
len
=
in
.
read
(
buffer
))
!=
-
1
)
{
out
.
write
(
buffer
,
0
,
len
);
}
out
.
flush
();
}
}
/**
* 根据文件名后缀获取 MIME 类型(JDK 1.8 兼容:替换 switch 表达式为 if-else)
* @param fileName 文件名
* @return MIME 类型字符串
*/
private
String
getContentTypeByFileName
(
String
fileName
)
{
if
(
fileName
==
null
||
fileName
.
lastIndexOf
(
"."
)
==
-
1
)
{
return
"application/octet-stream"
;
// 默认二进制流
}
String
suffix
=
fileName
.
toLowerCase
().
substring
(
fileName
.
lastIndexOf
(
"."
));
// JDK 1.8 支持的 if-else 分支(替换 switch 表达式)
if
(
".xlsx"
.
equals
(
suffix
)
||
".xls"
.
equals
(
suffix
))
{
return
"application/vnd.ms-excel"
;
}
else
if
(
".jpg"
.
equals
(
suffix
)
||
".jpeg"
.
equals
(
suffix
))
{
return
"image/jpeg"
;
}
else
if
(
".png"
.
equals
(
suffix
))
{
return
"image/png"
;
}
else
if
(
".pdf"
.
equals
(
suffix
))
{
return
"application/pdf"
;
}
else
if
(
".doc"
.
equals
(
suffix
)
||
".docx"
.
equals
(
suffix
))
{
return
"application/msword"
;
}
else
if
(
".txt"
.
equals
(
suffix
))
{
return
"text/plain"
;
}
else
if
(
".zip"
.
equals
(
suffix
))
{
return
"application/zip"
;
}
else
if
(
".json"
.
equals
(
suffix
))
{
return
"application/json"
;
}
else
{
return
"application/octet-stream"
;
}
}
}
// ------------------- 测试示例(JDK 1.8 验证) -------------------
public
static
void
main
(
String
[]
args
)
{
try
{
// 替换为你的测试文件路径
File
testFile
=
new
File
(
"D:\\qianhe\\file\\钻井施工智能优选\\滨648-斜69岩性数据.xlsx"
);
// 转换 File 为 MultipartFile
MultipartFile
multipartFile
=
FileToMultipartFileConverter
.
convert
(
testFile
);
// 验证转换结果
System
.
out
.
println
(
"转换成功!"
);
System
.
out
.
println
(
"文件名:"
+
multipartFile
.
getOriginalFilename
());
System
.
out
.
println
(
"文件类型:"
+
multipartFile
.
getContentType
());
System
.
out
.
println
(
"文件大小:"
+
multipartFile
.
getSize
()
+
" 字节"
);
System
.
out
.
println
(
"文件是否为空:"
+
multipartFile
.
isEmpty
());
// 测试文件转存(可选)
File
destFile
=
new
File
(
"D:\\test_copy.xlsx"
);
multipartFile
.
transferTo
(
destFile
);
System
.
out
.
println
(
"文件转存成功:"
+
destFile
.
getAbsolutePath
());
}
catch
(
Exception
e
)
{
System
.
err
.
println
(
"转换失败:"
+
e
.
getMessage
());
e
.
printStackTrace
();
}
}
}
src/main/java/com/zjsgfa/project/zjsgfa/util/ImageProcessUtil.java
View file @
1ada7cfc
...
...
@@ -80,5 +80,40 @@ public class ImageProcessUtil {
return
null
;
}
}
/**
* 将data:image/png;base64格式的字符串转换为PNG输入流
* @param base64Str 包含data:image/png;base64前缀的base64字符串
* @return 有效的PNG字节输入流
* @throws IllegalArgumentException 输入字符串格式错误或解码失败时抛出
*/
public
static
InputStream
convertBase64ToPngInputStream
(
String
base64Str
)
{
// 1. 校验输入是否为空
if
(
base64Str
==
null
||
base64Str
.
isEmpty
())
{
throw
new
IllegalArgumentException
(
"Base64字符串不能为空"
);
}
// 2. 剥离data:image/png;base64前缀
String
base64Prefix
=
"data:image/png;base64,"
;
if
(!
base64Str
.
startsWith
(
base64Prefix
))
{
throw
new
IllegalArgumentException
(
"输入字符串不是有效的PNG base64格式(缺少前缀)"
);
}
String
pureBase64Str
=
base64Str
.
substring
(
base64Prefix
.
length
());
try
{
// 3. Base64解码得到PNG原始字节数组
byte
[]
pngBytes
=
Base64
.
decodeBase64
(
pureBase64Str
);
// 4. 包装为ByteArrayInputStream(输入流)
return
new
ByteArrayInputStream
(
pngBytes
);
}
catch
(
IllegalArgumentException
e
)
{
throw
new
IllegalArgumentException
(
"Base64解码失败,输入字符串可能无效"
,
e
);
}
}
}
\ No newline at end of file
src/main/java/com/zjsgfa/project/zt/domain/CommonParam.java
View file @
1ada7cfc
...
...
@@ -10,6 +10,9 @@ import java.util.List;
public
class
CommonParam
{
private
String
lb
;
private
String
zskwd
;
//接口路径
private
String
path
;
...
...
src/main/java/com/zjsgfa/project/zt/mapper/DjdcInfoMapper.java
View file @
1ada7cfc
...
...
@@ -83,4 +83,6 @@ public interface DjdcInfoMapper {
List
<
Ljjw
>
getLjjwList3
(
CommonParam
param
);
List
<
Djjc
>
getJhKcList
(
String
jh
);
}
src/main/java/com/zjsgfa/project/zt/service/DjdcService.java
View file @
1ada7cfc
...
...
@@ -90,4 +90,7 @@ public interface DjdcService {
List
<
Ljjw
>
getLjjwList3
(
CommonParam
param
);
List
<
Djjc
>
getJhKcList
(
String
ljjh
);
}
src/main/java/com/zjsgfa/project/zt/service/impl/DjdcServiceImpl.java
View file @
1ada7cfc
...
...
@@ -2103,6 +2103,11 @@ public class DjdcServiceImpl implements DjdcService {
return
djdcInfoMapper
.
getLjjwList3
(
param
);
}
@Override
public
List
<
Djjc
>
getJhKcList
(
String
ljjh
)
{
return
djdcInfoMapper
.
getJhKcList
(
ljjh
);
}
/**
* 计算斜深
* @param a 层位垂深
...
...
src/main/resources/mybatis/zjsgfa/CommonFileMapper.xml
View file @
1ada7cfc
...
...
@@ -127,4 +127,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<delete
id=
"deleteCommonFileByICommonFile"
>
delete from common_file where business_id = #{businessId} and type=#{type}
</delete>
</mapper>
\ No newline at end of file
src/main/resources/mybatis/zjsgfa/SjFdsgcsDcylZjymdsjbMapper.xml
View file @
1ada7cfc
...
...
@@ -13,10 +13,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"dycs"
column=
"dycs"
/>
<result
property=
"dycw"
column=
"dycw"
/>
<result
property=
"createTime"
column=
"create_time"
/>
<result
property=
"kc"
column=
"kc"
/>
</resultMap>
<sql
id=
"selectSjFdsgcsDcylZjymdsjbVo"
>
select id, jh, ljjh, qyjs, md, dycs, dycw, create_time from sj_fdsgcs_dcyl_zjymdsjb
select id, jh, ljjh, qyjs, md, dycs, dycw, create_time
,kc
from sj_fdsgcs_dcyl_zjymdsjb
</sql>
<select
id=
"selectSjFdsgcsDcylZjymdsjbList"
parameterType=
"SjFdsgcsDcylZjymdsjb"
resultMap=
"SjFdsgcsDcylZjymdsjbResult"
>
...
...
@@ -28,7 +30,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"md != null "
>
and md = #{md}
</if>
<if
test=
"dycs != null "
>
and dycs = #{dycs}
</if>
<if
test=
"dycw != null and dycw != ''"
>
and dycw = #{dycw}
</if>
<if
test=
"kc != null and kc != ''"
>
and kc = #{kc}
</if>
</where>
order by qyjs
</select>
<select
id=
"selectSjFdsgcsDcylZjymdsjbById"
parameterType=
"Long"
resultMap=
"SjFdsgcsDcylZjymdsjbResult"
>
...
...
@@ -46,6 +50,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"dycs != null"
>
dycs,
</if>
<if
test=
"dycw != null and dycw != ''"
>
dycw,
</if>
<if
test=
"createTime != null"
>
create_time,
</if>
<if
test=
"kc != null"
>
kc,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"jh != null and jh != ''"
>
#{jh},
</if>
...
...
@@ -55,12 +60,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"dycs != null"
>
#{dycs},
</if>
<if
test=
"dycw != null and dycw != ''"
>
#{dycw},
</if>
<if
test=
"createTime != null"
>
#{createTime},
</if>
<if
test=
"kc != null"
>
#{kc},
</if>
</trim>
</insert>
<insert
id=
"insertSjFdsgcsDcylZjymdsjbBatch"
>
insert into sj_fdsgcs_dcyl_zjymdsjb (jh,ljjh,qyjs,md,dycs,dycw) values
insert into sj_fdsgcs_dcyl_zjymdsjb (jh,ljjh,qyjs,md,dycs,dycw
,kc
) values
<foreach
item=
"item"
index=
"index"
collection=
"list"
separator=
","
>
(#{item.jh},#{item.ljjh},#{item.qyjs},#{item.md},#{item.dycs},#{item.dycw})
(#{item.jh},#{item.ljjh},#{item.qyjs},#{item.md},#{item.dycs},#{item.dycw}
,#{item.kc}
)
</foreach>
</insert>
...
...
@@ -74,6 +80,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"dycs != null"
>
dycs = #{dycs},
</if>
<if
test=
"dycw != null and dycw != ''"
>
dycw = #{dycw},
</if>
<if
test=
"createTime != null"
>
create_time = #{createTime},
</if>
<if
test=
"kc != null"
>
kc = #{kc},
</if>
</trim>
where id = #{id}
</update>
...
...
src/main/resources/mybatis/zjsgfa/SjFdsgcsDcylZjymdtjbMapper.xml
View file @
1ada7cfc
...
...
@@ -14,10 +14,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result
property=
"qycsMin"
column=
"qycs_min"
/>
<result
property=
"qycsMax"
column=
"qycs_max"
/>
<result
property=
"updateTime"
column=
"update_time"
/>
<result
property=
"kc"
column=
"kc"
/>
</resultMap>
<sql
id=
"selectSjFdsgcsDcylZjymdtjbVo"
>
select id, jh, ljjh, cw, md_min, md_max, qycs_min, qycs_max, update_time from sj_fdsgcs_dcyl_zjymdtjb
select id, jh, ljjh, cw, md_min, md_max, qycs_min, qycs_max, update_time
,kc
from sj_fdsgcs_dcyl_zjymdtjb
</sql>
<select
id=
"selectSjFdsgcsDcylZjymdtjbList"
parameterType=
"SjFdsgcsDcylZjymdtjb"
resultMap=
"SjFdsgcsDcylZjymdtjbResult"
>
...
...
@@ -30,6 +31,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"mdMax != null "
>
and md_max = #{mdMax}
</if>
<if
test=
"qycsMin != null "
>
and qycs_min = #{qycsMin}
</if>
<if
test=
"qycsMax != null "
>
and qycs_max = #{qycsMax}
</if>
<if
test=
"kc != null "
>
and kc = #{kc}
</if>
</where>
</select>
...
...
@@ -49,6 +51,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"qycsMin != null"
>
qycs_min,
</if>
<if
test=
"qycsMax != null"
>
qycs_max,
</if>
<if
test=
"updateTime != null"
>
update_time,
</if>
<if
test=
"kc != null"
>
kc,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"jh != null and jh != ''"
>
#{jh},
</if>
...
...
@@ -59,12 +62,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"qycsMin != null"
>
#{qycsMin},
</if>
<if
test=
"qycsMax != null"
>
#{qycsMax},
</if>
<if
test=
"updateTime != null"
>
#{updateTime},
</if>
<if
test=
"kc != null"
>
#{kc},
</if>
</trim>
</insert>
<insert
id=
"insertSjFdsgcsDcylZjymdtjbBatch"
>
insert into sj_fdsgcs_dcyl_zjymdtjb (jh,ljjh,cw,md
Min,mdMax,qycsMin,qycsMax
) values
insert into sj_fdsgcs_dcyl_zjymdtjb (jh,ljjh,cw,md
_min,md_max,qycs_min,qycs_max,kc
) values
<foreach
item=
"item"
index=
"index"
collection=
"list"
separator=
","
>
(#{item.jh},#{item.ljjh},#{item.cw},#{item.mdMin},#{item.mdMax},#{item.qycsMin},#{item.qycsMax})
(#{item.jh},#{item.ljjh},#{item.cw},#{item.mdMin},#{item.mdMax},#{item.qycsMin},#{item.qycsMax}
,#{item.kc}
)
</foreach>
</insert>
...
...
@@ -79,6 +83,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if
test=
"qycsMin != null"
>
qycs_min = #{qycsMin},
</if>
<if
test=
"qycsMax != null"
>
qycs_max = #{qycsMax},
</if>
<if
test=
"updateTime != null"
>
update_time = #{updateTime},
</if>
<if
test=
"kc != null"
>
kc = #{kc},
</if>
</trim>
where id = #{id}
</update>
...
...
src/main/resources/mybatis/zjsgfa/SjFdsgcsDcyxtMapper.xml
0 → 100644
View file @
1ada7cfc
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper
namespace=
"com.zjsgfa.project.zjsgfa.mapper.SjFdsgcsDcyxtMapper"
>
<resultMap
type=
"SjFdsgcsDcyxt"
id=
"SjFdsgcsDcyxtResult"
>
<result
property=
"id"
column=
"id"
/>
<result
property=
"zbid"
column=
"zbid"
/>
<result
property=
"jsjgt"
column=
"jsjgt"
/>
</resultMap>
<sql
id=
"selectSjFdsgcsDcyxtVo"
>
select id, zbid, jsjgt from sj_fdsgcs_dcyxt
</sql>
<select
id=
"selectSjFdsgcsDcyxtList"
parameterType=
"SjFdsgcsDcyxt"
resultMap=
"SjFdsgcsDcyxtResult"
>
<include
refid=
"selectSjFdsgcsDcyxtVo"
/>
<where>
<if
test=
"zbid != null and zbid != ''"
>
and zbid = #{zbid}
</if>
<if
test=
"jsjgt != null and jsjgt != ''"
>
and jsjgt = #{jsjgt}
</if>
</where>
</select>
<select
id=
"selectSjFdsgcsDcyxtById"
parameterType=
"Long"
resultMap=
"SjFdsgcsDcyxtResult"
>
<include
refid=
"selectSjFdsgcsDcyxtVo"
/>
where id = #{id}
</select>
<insert
id=
"insertSjFdsgcsDcyxt"
parameterType=
"SjFdsgcsDcyxt"
useGeneratedKeys=
"true"
keyProperty=
"id"
>
insert into sj_fdsgcs_dcyxt
<trim
prefix=
"("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"zbid != null"
>
zbid,
</if>
<if
test=
"jsjgt != null"
>
jsjgt,
</if>
</trim>
<trim
prefix=
"values ("
suffix=
")"
suffixOverrides=
","
>
<if
test=
"zbid != null"
>
#{zbid},
</if>
<if
test=
"jsjgt != null"
>
#{jsjgt},
</if>
</trim>
</insert>
<update
id=
"updateSjFdsgcsDcyxt"
parameterType=
"SjFdsgcsDcyxt"
>
update sj_fdsgcs_dcyxt
<trim
prefix=
"SET"
suffixOverrides=
","
>
<if
test=
"zbid != null"
>
zbid = #{zbid},
</if>
<if
test=
"jsjgt != null"
>
jsjgt = #{jsjgt},
</if>
</trim>
where id = #{id}
</update>
<delete
id=
"deleteSjFdsgcsDcyxtById"
parameterType=
"Long"
>
delete from sj_fdsgcs_dcyxt where id = #{id}
</delete>
<delete
id=
"deleteSjFdsgcsDcyxtByIds"
parameterType=
"String"
>
delete from sj_fdsgcs_dcyxt where id in
<foreach
item=
"id"
collection=
"array"
open=
"("
separator=
","
close=
")"
>
#{id}
</foreach>
</delete>
<delete
id=
"deleteSjFdsgcsDcyxtByZbid"
>
delete from sj_fdsgcs_dcyxt where zbid = #{zbid}
</delete>
</mapper>
\ No newline at end of file
src/main/resources/mybatis/zt/DjdcInfoMapper.xml
View file @
1ada7cfc
...
...
@@ -1107,4 +1107,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
order by jkjl asc
</select>
<select
id=
"getJhKcList"
resultType=
"com.zjsgfa.project.zt.domain.Djjc"
>
select * from (
SELECT
jh,kc,(CASE WHEN kc = 1 THEN 0 ELSE LAG_JS END) ksjs,js, CONCAT( CASE WHEN kc = 1 THEN '0-' ELSE LAG_JS || '-'END,JS) AS jd
FROM (
SELECT
jh, ROW_NUMBER() OVER (PARTITION BY jh ORDER BY js) AS kc,
JS,
LAG(JS, 1, 0) OVER (PARTITION BY jh ORDER BY js) AS LAG_JS
FROM JSDB) ) a where jh=#{jh}
</select>
</mapper>
\ No newline at end of file
src/main/resources/static/excel/sgfamb.docx
View file @
1ada7cfc
No preview for this file type
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