Commit 1ada7cfc by jiang'yun

修改

parent 544c564e
......@@ -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
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);
}
}
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);
}
}
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));
}
}
......@@ -22,6 +22,8 @@ public class SjFdsgcsDcylZjymdsjb extends BaseEntity
@Excel(name = "井号")
private String jh;
private String kc;
/** 邻井井号 */
@Excel(name = "邻井井号")
private String ljjh;
......
......@@ -23,6 +23,7 @@ public class SjFdsgcsDcylZjymdtjb extends BaseEntity
@Excel(name = "井号")
private String jh;
private String kc;
/** 邻井井号 */
@Excel(name = "邻井井号")
private String ljjh;
......
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;
}
......@@ -58,4 +58,7 @@ public interface CommonFileMapper
* @return 结果
*/
public int deleteCommonFileByIds(Long[] ids);
int deleteCommonFileByICommonFile(CommonFile upFile);
}
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);
}
......@@ -58,4 +58,6 @@ public interface ICommonFileService
* @return 结果
*/
public int deleteCommonFileById(Long id);
int deleteCommonFileByICommonFile(CommonFile upFile);
}
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);
}
......@@ -92,4 +92,9 @@ public class CommonFileServiceImpl implements ICommonFileService
{
return commonFileMapper.deleteCommonFileById(id);
}
@Override
public int deleteCommonFileByICommonFile(CommonFile upFile) {
return commonFileMapper.deleteCommonFileByICommonFile(upFile);
}
}
......@@ -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;
}
}
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);
}
}
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
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");
}
}
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();
}
}
}
......@@ -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
......@@ -10,6 +10,9 @@ import java.util.List;
public class CommonParam {
private String lb;
private String zskwd;
//接口路径
private String path;
......
......@@ -83,4 +83,6 @@ public interface DjdcInfoMapper {
List<Ljjw> getLjjwList3(CommonParam param);
List<Djjc> getJhKcList(String jh);
}
......@@ -90,4 +90,7 @@ public interface DjdcService {
List<Ljjw> getLjjwList3(CommonParam param);
List<Djjc> getJhKcList(String ljjh);
}
......@@ -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 层位垂深
......
......@@ -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
......@@ -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>
......
......@@ -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,mdMin,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>
......
<?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
......@@ -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
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment