Commit 6e040cc3 by jiang'yun

修改

parent c40b60ab
......@@ -303,6 +303,13 @@
<version>1.16</version>
</dependency>
<!-- spring security cas-->
<dependency>
<groupId>org.springframework.security</groupId>
<artifactId>spring-security-cas</artifactId>
<!-- <version>5.5.3</version>-->
</dependency>
</dependencies>
......@@ -315,7 +322,7 @@
<configuration>
<fork>true</fork> <!-- 如果没有该配置,devtools不会生效 -->
</configuration>
</plugin>
</plugin><plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>8</source><target>8</target></configuration></plugin>
</plugins>
</build>
......
......@@ -101,6 +101,16 @@ public class Constants
public static final String TOKEN = "token";
/**
* CAS登录成功后的后台标识
*/
public static final String CAS_TOKEN = "cas_token";
/**
* CAS登录成功后的前台Cookie的Key
*/
public static final String WEB_TOKEN_KEY = "Admin-Token";
/**
* 令牌前缀
*/
public static final String TOKEN_PREFIX = "Bearer ";
......
package com.zjsgfa.framework.config.properties;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Component;
/**
* CAS的配置参数
*/
@Component
public class CasProperties {
@Value("${cas.server.host.url}")
private String casServerUrl;
@Value("${cas.server.host.login_url}")
private String casServerLoginUrl;
@Value("${cas.server.host.logout_url}")
private String casServerLogoutUrl;
@Value("${app.casEnable}")
private boolean casEnable;
@Value("${app.server.host.url}")
private String appServerUrl;
@Value("${app.login_url}")
private String appLoginUrl;
@Value("${app.logout_url}")
private String appLogoutUrl;
@Value("${app.web_url}")
private String webUrl;
public String getWebUrl() {
return webUrl;
}
public String getCasServerUrl() {
return casServerUrl;
}
public void setCasServerUrl(String casServerUrl) {
this.casServerUrl = casServerUrl;
}
public String getCasServerLoginUrl() {
return casServerLoginUrl;
}
public void setCasServerLoginUrl(String casServerLoginUrl) {
this.casServerLoginUrl = casServerLoginUrl;
}
public String getCasServerLogoutUrl() {
return casServerLogoutUrl;
}
public void setCasServerLogoutUrl(String casServerLogoutUrl) {
this.casServerLogoutUrl = casServerLogoutUrl;
}
public boolean isCasEnable() {
return casEnable;
}
public void setCasEnable(boolean casEnable) {
this.casEnable = casEnable;
}
public String getAppServerUrl() {
return appServerUrl;
}
public void setAppServerUrl(String appServerUrl) {
this.appServerUrl = appServerUrl;
}
public String getAppLoginUrl() {
return appLoginUrl;
}
public void setAppLoginUrl(String appLoginUrl) {
this.appLoginUrl = appLoginUrl;
}
public String getAppLogoutUrl() {
return appLogoutUrl;
}
public void setAppLogoutUrl(String appLogoutUrl) {
this.appLogoutUrl = appLogoutUrl;
}
}
\ No newline at end of file
package com.zjsgfa.framework.security;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;
import org.springframework.security.core.GrantedAuthority;
import org.springframework.security.core.userdetails.UserDetails;
......@@ -258,9 +259,11 @@ public class LoginUser implements UserDetails
this.user = user;
}
@Override
public Collection<? extends GrantedAuthority> getAuthorities()
{
return null;
return new HashSet();
}
}
package com.zjsgfa.framework.security.handle;
import com.zjsgfa.common.constant.Constants;
import com.zjsgfa.framework.config.properties.CasProperties;
import com.zjsgfa.framework.security.LoginUser;
import com.zjsgfa.framework.security.service.TokenService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.security.core.Authentication;
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
import org.springframework.security.web.savedrequest.HttpSessionRequestCache;
import org.springframework.security.web.savedrequest.RequestCache;
import org.springframework.stereotype.Service;
import org.springframework.util.StringUtils;
import javax.servlet.ServletException;
import javax.servlet.http.Cookie;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;
@Service
public class CasAuthenticationSuccessHandler extends SavedRequestAwareAuthenticationSuccessHandler {
protected final Log logger = LogFactory.getLog(this.getClass());
private RequestCache requestCache = new HttpSessionRequestCache();
@Autowired
private TokenService tokenService;
@Autowired
private CasProperties casProperties;
/**
* 令牌有效期(默认30分钟)
*/
@Value("${token.expireTime}")
private int expireTime;
@Override
public void onAuthenticationSuccess(HttpServletRequest request, HttpServletResponse response,
Authentication authentication) throws ServletException, IOException {
String targetUrlParameter = getTargetUrlParameter();
if (isAlwaysUseDefaultTargetUrl()
|| (targetUrlParameter != null && StringUtils.hasText(request.getParameter(targetUrlParameter)))) {
requestCache.removeRequest(request, response);
super.onAuthenticationSuccess(request, response, authentication);
return;
}
clearAuthenticationAttributes(request);
LoginUser userDetails = (LoginUser) authentication.getPrincipal();
String token = tokenService.createToken(userDetails);
//往Cookie中设置token
Cookie casCookie = new Cookie(Constants.WEB_TOKEN_KEY, token);
casCookie.setMaxAge(expireTime * 60);
response.addCookie(casCookie);
//设置后端认证成功标识
HttpSession httpSession = request.getSession();
httpSession.setAttribute(Constants.CAS_TOKEN, token);
//登录成功后跳转到前端登录页面
getRedirectStrategy().sendRedirect(request, response, casProperties.getWebUrl());
}
}
\ No newline at end of file
package com.zjsgfa.framework.web.service;
import com.zjsgfa.common.enums.UserStatus;
import com.zjsgfa.common.exception.ServiceException;
import com.zjsgfa.common.utils.StringUtils;
import com.zjsgfa.framework.security.LoginUser;
import com.zjsgfa.framework.security.service.SysPermissionService;
import com.zjsgfa.framework.security.service.UserDetailsServiceImpl;
import com.zjsgfa.project.system.domain.SysUser;
import com.zjsgfa.project.system.service.ISysUserService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.cas.authentication.CasAssertionAuthenticationToken;
import org.springframework.security.core.userdetails.AuthenticationUserDetailsService;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.userdetails.UsernameNotFoundException;
import org.springframework.stereotype.Service;
/**
* 用于加载用户信息 实现UserDetailsService接口,或者实现AuthenticationUserDetailsService接口
*/
@Service
public class CasUserDetailsService implements AuthenticationUserDetailsService<CasAssertionAuthenticationToken> {
private static final Logger log = LoggerFactory.getLogger(UserDetailsServiceImpl.class);
@Autowired
private ISysUserService userService;
@Autowired
private SysPermissionService permissionService;
@Override
public UserDetails loadUserDetails(CasAssertionAuthenticationToken token) throws UsernameNotFoundException {
String username = token.getName();
SysUser user = userService.selectUserByUserName(username);
if (StringUtils.isNull(user)) {
log.info("登录用户:{} 不存在.", username);
throw new ServiceException("登录用户:" + username + " 不存在");
} else if (UserStatus.DELETED.getCode().equals(user.getDelFlag())) {
log.info("登录用户:{} 已被删除.", username);
throw new ServiceException("对不起,您的账号:" + username + " 已被删除");
} else if (UserStatus.DISABLE.getCode().equals(user.getStatus())) {
log.info("登录用户:{} 已被停用.", username);
throw new ServiceException("对不起,您的账号:" + username + " 已停用");
}
return createLoginUser(user);
}
public UserDetails createLoginUser(SysUser user) {
return new LoginUser(user.getUserId(), user.getDeptId(), user, permissionService.getMenuPermission(user));
}
}
\ No newline at end of file
......@@ -42,6 +42,7 @@ public class CommonFileController extends BaseController
public TableDataInfo list(CommonFile commonFile)
{
// startPage();
List<CommonFile> list = commonFileService.selectCommonFileList(commonFile);
return getDataTable(list);
}
......
......@@ -389,24 +389,9 @@ public class SjDjjcController extends BaseController
@ResponseBody
public AjaxResult importData(MultipartFile file, boolean updateSupport,SjDjjc sjDjjc) throws Exception
{
String name = file.getOriginalFilename();
String type = StringUtils.substringAfterLast(name, ".");
String fileNameYs = name.substring(0,name.lastIndexOf("."));
String filePath1 = RuoYiConfig.getUploadPath();
String fileName1 = FileUploadUtils.upload(filePath1, file);
CommonFile upFile = new CommonFile();
upFile.setFileName(fileNameYs);//文件名
upFile.setFilePath(fileName1);//文件路径
upFile.setFileSuffix(type);//后缀
upFile.setFileType(type);//文件类型
upFile.setTemplateName("模板数据导入");//文件类型
upFile.setType("施工方案设计");//文件类型
upFile.setBusinessId(sjDjjc.getId().toString());//文件类型
// upFile.setCreatedBy(SecurityUtils.getUsername());//创建人
upFile.setCreatedTime(new Date());//创建时间
commonFileService.insertCommonFile(upFile);
SjDjjc sjDjjc1 = sjDjjcService.selectSjDjjcById(sjDjjc.getId());
XSSFWorkbook workbook = null;
try {
......@@ -490,6 +475,7 @@ public class SjDjjcController extends BaseController
info.setZjgs(zjgs);
String zjd=new DataFormatter().formatCellValue(row.getCell(14));
info.setZjd(zjd);
info.setFaid(sjDjjc1.getFaid());
sjDjjcService.updateSjDjjc(info);
}
//地质分层---------------------------------------------------
......@@ -1855,6 +1841,22 @@ public class SjDjjcController extends BaseController
workbook.close();
}
String name = file.getOriginalFilename();
String type = StringUtils.substringAfterLast(name, ".");
String fileNameYs = name.substring(0,name.lastIndexOf("."));
String filePath1 = RuoYiConfig.getUploadPath();
String fileName1 = FileUploadUtils.upload(filePath1, file);
CommonFile upFile = new CommonFile();
upFile.setFileName(fileNameYs);//文件名
upFile.setFilePath(fileName1);//文件路径
upFile.setFileSuffix(type);//后缀
upFile.setFileType(type);//文件类型
upFile.setTemplateName("模板数据导入");//文件类型
upFile.setType("施工方案设计");//文件类型
upFile.setBusinessId(sjDjjc.getId().toString());//文件类型
// upFile.setCreatedBy(SecurityUtils.getUsername());//创建人
upFile.setCreatedTime(new Date());//创建时间
commonFileService.insertCommonFile(upFile);
return AjaxResult.success("导入成功");
}
......
......@@ -74,7 +74,7 @@ public interface SgfambMapper
* @param sgfambKcxxList 施工方案模板管理—开次信息列表
* @return 结果
*/
public int batchSgfambKcxx(List<SgfambKcxx> sgfambKcxxList);
// public int batchSgfambKcxx(List<SgfambKcxx> sgfambKcxxList);
/**
......
......@@ -59,6 +59,15 @@ public class SgfambKcSggyServiceImpl implements ISgfambKcSggyService
public int insertSgfambKcSggy(SgfambKcSggy sgfambKcSggy)
{
if(StringUtils.isNotEmpty(sgfambKcSggy.getZjzh())){
sgfambKcSggy.setZjzh(new String(Base64.decode(sgfambKcSggy.getZjzh()), StandardCharsets.UTF_8));
}
if(StringUtils.isNotEmpty(sgfambKcSggy.getZjzhzysx())){
sgfambKcSggy.setZjzhzysx(new String(Base64.decode(sgfambKcSggy.getZjzhzysx()), StandardCharsets.UTF_8));
}
if(StringUtils.isNotEmpty(sgfambKcSggy.getFxts())){
sgfambKcSggy.setFxts(new String(Base64.decode(sgfambKcSggy.getFxts()), StandardCharsets.UTF_8));
}
if(StringUtils.isNotEmpty(sgfambKcSggy.getZjgccs())){
sgfambKcSggy.setZjgccs(new String(Base64.decode(sgfambKcSggy.getZjgccs()), StandardCharsets.UTF_8));
}
......@@ -87,6 +96,15 @@ public class SgfambKcSggyServiceImpl implements ISgfambKcSggyService
@Override
public int updateSgfambKcSggy(SgfambKcSggy sgfambKcSggy)
{
if(StringUtils.isNotEmpty(sgfambKcSggy.getZjzh())){
sgfambKcSggy.setZjzh(new String(Base64.decode(sgfambKcSggy.getZjzh()), StandardCharsets.UTF_8));
}
if(StringUtils.isNotEmpty(sgfambKcSggy.getZjzhzysx())){
sgfambKcSggy.setZjzhzysx(new String(Base64.decode(sgfambKcSggy.getZjzhzysx()), StandardCharsets.UTF_8));
}
if(StringUtils.isNotEmpty(sgfambKcSggy.getFxts())){
sgfambKcSggy.setFxts(new String(Base64.decode(sgfambKcSggy.getFxts()), StandardCharsets.UTF_8));
}
if(StringUtils.isNotEmpty(sgfambKcSggy.getZjgccs())){
sgfambKcSggy.setZjgccs(new String(Base64.decode(sgfambKcSggy.getZjgccs()), StandardCharsets.UTF_8));
}
......
......@@ -105,7 +105,9 @@ public class SjJygjGdsjgdcsServiceImpl implements ISjJygjGdsjgdcsService
Map sptymap =new HashMap();
List spList = new ArrayList<>();
sptymap.put("data",spList);
if(gjlist.size()==0){
return back("数据不存在");
}
// 垂直投影
Map cztymap =new HashMap();
List czList = new ArrayList<>();
......@@ -179,6 +181,9 @@ public class SjJygjGdsjgdcsServiceImpl implements ISjJygjGdsjgdcsService
List swList = new ArrayList<>();
swmap.put("lineData",swList);
if(gjlist.size()==0){
return back("数据不存在");
}
Double maxcs =gjlist.stream().map(SjJygjGdsjgdcs::getCs).max(Double::compare).get();;
Double maxnb = 0.0;
......
......@@ -5,6 +5,7 @@ import java.util.*;
import java.util.stream.Collectors;
import com.zjsgfa.common.utils.DateUtils;
import com.zjsgfa.project.zjsgfa.domain.SjZjyFdxnb;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zjsgfa.project.zjsgfa.mapper.SjSggyZjyFdxnbMapper;
......@@ -35,6 +36,17 @@ public class SjSggyZjyFdxnbServiceImpl implements ISjSggyZjyFdxnbService
return sjSggyZjyFdxnbMapper.selectSjSggyZjyFdxnbById(id);
}
private static int extractStartNumber(String jd) {
if (jd == null || !jd.contains("~")) {
return 0; // 处理异常情况
}
String numberPart = jd.split("~")[0];
try {
return Integer.parseInt(numberPart.trim());
} catch (NumberFormatException e) {
return 0; // 处理转换失败情况
}
}
/**
* 查询设计信息-施工概要-分段钻井液性能设计列表
*
......@@ -62,9 +74,13 @@ public class SjSggyZjyFdxnbServiceImpl implements ISjSggyZjyFdxnbService
// 提取井段(去重,按顺序排列)
List<String> wellSegments = list.stream()
.map(SjSggyZjyFdxnb::getJd)
.distinct()
.distinct().sorted((s1, s2) -> {
// 提取第一个数值
int num1 = extractStartNumber(s1);
int num2 = extractStartNumber(s2);
return Integer.compare(num1, num2);
})
.collect(Collectors.toList());
// 表格数据:每行对应一个固定项目,每列对应一个井段
List<Map<String, String>> tableData = new ArrayList<>();
......
......@@ -5,6 +5,7 @@ import java.util.*;
import java.util.stream.Collectors;
import com.zjsgfa.common.utils.DateUtils;
import com.zjsgfa.project.zjsgfa.domain.SjFdsgcsZjyFdxnb;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.zjsgfa.project.zjsgfa.mapper.SjZjyFdxnbMapper;
......@@ -35,6 +36,17 @@ public class SjZjyFdxnbServiceImpl implements ISjZjyFdxnbService
return sjZjyFdxnbMapper.selectSjZjyFdxnbById(id);
}
private static int extractStartNumber(String jd) {
if (jd == null || !jd.contains("~")) {
return 0; // 处理异常情况
}
String numberPart = jd.split("~")[0];
try {
return Integer.parseInt(numberPart.trim());
} catch (NumberFormatException e) {
return 0; // 处理转换失败情况
}
}
/**
* 查询设计信息-分段钻井液性能设计列表
*
......@@ -62,7 +74,12 @@ public class SjZjyFdxnbServiceImpl implements ISjZjyFdxnbService
// 提取井段(去重,按顺序排列)
List<String> wellSegments = list.stream()
.map(SjZjyFdxnb::getJd)
.distinct()
.distinct().sorted((s1, s2) -> {
// 提取第一个数值
int num1 = extractStartNumber(s1);
int num2 = extractStartNumber(s2);
return Integer.compare(num1, num2);
})
.collect(Collectors.toList());
// 表格数据:每行对应一个固定项目,每列对应一个井段
......
......@@ -4,12 +4,14 @@ import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.google.gson.*;
import com.zjsgfa.common.utils.StringUtils;
import com.zjsgfa.common.utils.poi.ExcelUtil;
import com.zjsgfa.framework.web.domain.AjaxResult;
import com.zjsgfa.project.zjsgfa.domain.ClYxsj;
import com.zjsgfa.project.zt.domain.*;
import com.zjsgfa.project.zt.domain.vo.ApiResponse;
import com.zjsgfa.project.zt.domain.vo.JsgaVo;
import com.zjsgfa.project.zt.domain.vo.JswaVo;
import com.zjsgfa.project.zt.service.DjdcService;
......@@ -405,6 +407,46 @@ public class DjdcController {
}
/**
* 实钻分析结果长城大模型调用
* @param
* @return
*/
@PostMapping(value = "/zskwd")
public AjaxResult zskwd(@RequestBody LjSzfxjg ljSzfxjg,HttpServletResponse response) throws IOException {
Map<String, Object> map = new HashMap<>();
map.put("stream", false);
Map<String, Object> map2 = new HashMap<>();
map2.put("field_name","data");
map2.put("type","input");
String s =JSON.toJSONString (ljSzfxjg.getList());
map2.put("value",s);
// map2.put("value",commonParam.getDmxnr());
List<Map> listMap =new ArrayList<>();
listMap.add(map2);
map.put("content",listMap);
String url = "https://agent.ai.sinopec.com/aicoapi/gateway/v2/workflow/api_run/6d7d9423836f46f0862c62eb17bf56e2";
String key="c8hXPRzzhakAyTW8brMGkH4DPpUqw0zk";
Gson gson = new GsonBuilder().setPrettyPrinting().create();
String json = gson.toJson(map);
String result2 = HttpRequest.post(url).body(json).execute().body();
System.out.println(result2);
// // 解析API响应
String textPresentation ="由于您没有提供具体的各开次时效最大的前5口钻具组合分析统计结果数据,我无法进行实际的数据分析和推荐。不过,我可以为您提供一个通用的分析框架和示例输出,您可以根据实际数据填充具体内容。\\n\\n通用分析框架:\\n\\n1. 数据分析:\\n- 对于每个开次(如一开、二开、三开等),查看时效最高的5个钻具组合\\n- 比较它们的机械钻速、钻头寿命、稳定性等关键指标\\n- 分析地层特点与钻具组合的匹配程度\\n\\n2. 选择最优钻具组合:\\n- 优先选择时效最高的组合\\n- 在时效相近时,选择稳定性更好的组合\\n- 考虑钻头寿命与更换频率的平衡\\n\\n3. 理由阐明:\\n- 该组合在类似地层中表现最佳\\n- 机械钻速与钻压、转速等参数匹配最优\\n- 振动控制良好,减少非生产时间\\n\\n示例输出(请用实际数据替换):\\n\\n```json\\n{\\n \\\"bit_recommendations\\\": {\\n \\\"section_1\\\": {\\n \\\"recommended_bit\\\": \\\"Φ444.5mm PDC钻头 + Φ203.2mm钻铤×6根 + Φ177.8mm钻铤×9根 + 随钻震击器\\\",\\n \\\"rationale\\\": \\\"该组合在一开表层钻井中平均机械钻速达到35m/h,比第二名的28m/h高出25%,且振动幅度控制在安全范围内,起下钻次数最少。\\\"\\n },\\n \\\"section_2\\\": {\\n \\\"recommended_bit\\\": \\\"Φ311.2mm 混合钻头 + Φ228.6mm钻铤×9根 + Φ203.2mm钻铤×6根 + 螺杆钻具\\\",\\n \\\"rationale\\\": \\\"在二开井段硬夹层地层中,该组合时效达到22m/h,钻头寿命达180小时,无需中途更换,综合时效比使用牙轮钻头提高40%。\\\"\\n },\\n \\\"section_3\\\": {\\n \\\"recommended_bit\\\": \\\"Φ215.9mm 5刀翼PDC钻头 + Φ165.1mm钻铤×12根 + 随钻测斜仪 + 涡轮增压器\\\",\\n \\\"rationale\\\": \\\"针对三开深部复杂地层,该组合在保持18m/h钻速的同时,有效控制井斜在1°以内,减少纠斜时间,综合时效最优。\\\"\\n }\\n }\\n}\\n```\\n\\n请提供具体的各开次前5名钻具组合的详细统计数据(包括但不限于:钻头类型、钻具组合、机械钻速、钻头寿命、振动数据等),我可以为您做出更精确的分析和推荐。";
// try {
// // 创建ObjectMapper实例
// ObjectMapper objectMapper = new ObjectMapper();
// // 解析JSON为ApiResponse对象
// ApiResponse res = objectMapper.readValue(json, ApiResponse.class);
// // 提取"文本呈现"的内容
// textPresentation = res.getData().getInnerData().getTextPresentation();
// // 打印结果
// System.out.println("文本呈现内容:\n" + textPresentation);
// } catch (Exception e) {
// e.printStackTrace();
// }
return AjaxResult.success(textPresentation);
}
/**
* 实钻分析结果长城大模型调用
......@@ -412,21 +454,39 @@ public class DjdcController {
* @return
*/
@PostMapping(value = "/szfxjgccdy")
public void ccdmxdy(@RequestBody LjSzfxjg ljSzfxjg,HttpServletResponse response) throws IOException {
public AjaxResult ccdmxdy(@RequestBody LjSzfxjg ljSzfxjg,HttpServletResponse response) throws IOException {
Map<String, Object> map = new HashMap<>();
map.put("stream", true);
Map<String, Object> map2 = new HashMap<>();
map2.put("field_name","data");
map2.put("type","input");
String s =JSON.toJSONString (ljSzfxjg.getList());
// String s =JSON.toJSONString (ljSzfxjgs);
map2.put("value",s);
List<Map> listMap =new ArrayList<>();
listMap.add(map2);
map.put("content",listMap);
String url = "https://agent.ai.sinopec.com/aicoapi/gateway/v2/workflow/api_run/6d7d9423836f46f0862c62eb17bf56e2";
String key="c8hXPRzzhakAyTW8brMGkH4DPpUqw0zk";
dymxcom(map,url,key,response);
// dymxcom(map,url,key,response);
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 ="由于您没有提供具体的各开次时效最大的前5口钻具组合分析统计结果数据,我无法进行实际的数据分析和推荐。不过,我可以为您提供一个通用的分析框架和示例输出,您可以根据实际数据填充具体内容。\\n\\n通用分析框架:\\n\\n1. 数据分析:\\n- 对于每个开次(如一开、二开、三开等),查看时效最高的5个钻具组合\\n- 比较它们的机械钻速、钻头寿命、稳定性等关键指标\\n- 分析地层特点与钻具组合的匹配程度\\n\\n2. 选择最优钻具组合:\\n- 优先选择时效最高的组合\\n- 在时效相近时,选择稳定性更好的组合\\n- 考虑钻头寿命与更换频率的平衡\\n\\n3. 理由阐明:\\n- 该组合在类似地层中表现最佳\\n- 机械钻速与钻压、转速等参数匹配最优\\n- 振动控制良好,减少非生产时间\\n\\n示例输出(请用实际数据替换):\\n\\n```json\\n{\\n \\\"bit_recommendations\\\": {\\n \\\"section_1\\\": {\\n \\\"recommended_bit\\\": \\\"Φ444.5mm PDC钻头 + Φ203.2mm钻铤×6根 + Φ177.8mm钻铤×9根 + 随钻震击器\\\",\\n \\\"rationale\\\": \\\"该组合在一开表层钻井中平均机械钻速达到35m/h,比第二名的28m/h高出25%,且振动幅度控制在安全范围内,起下钻次数最少。\\\"\\n },\\n \\\"section_2\\\": {\\n \\\"recommended_bit\\\": \\\"Φ311.2mm 混合钻头 + Φ228.6mm钻铤×9根 + Φ203.2mm钻铤×6根 + 螺杆钻具\\\",\\n \\\"rationale\\\": \\\"在二开井段硬夹层地层中,该组合时效达到22m/h,钻头寿命达180小时,无需中途更换,综合时效比使用牙轮钻头提高40%。\\\"\\n },\\n \\\"section_3\\\": {\\n \\\"recommended_bit\\\": \\\"Φ215.9mm 5刀翼PDC钻头 + Φ165.1mm钻铤×12根 + 随钻测斜仪 + 涡轮增压器\\\",\\n \\\"rationale\\\": \\\"针对三开深部复杂地层,该组合在保持18m/h钻速的同时,有效控制井斜在1°以内,减少纠斜时间,综合时效最优。\\\"\\n }\\n }\\n}\\n```\\n\\n请提供具体的各开次前5名钻具组合的详细统计数据(包括但不限于:钻头类型、钻具组合、机械钻速、钻头寿命、振动数据等),我可以为您做出更精确的分析和推荐。";
// try {
// // 创建ObjectMapper实例
// ObjectMapper objectMapper = new ObjectMapper();
// // 解析JSON为ApiResponse对象
// ApiResponse res = objectMapper.readValue(json, ApiResponse.class);
// // 提取"文本呈现"的内容
// textPresentation = res.getData().getInnerData().getTextPresentation();
// // 打印结果
// System.out.println("文本呈现内容:\n" + textPresentation);
// } catch (Exception e) {
// e.printStackTrace();
// }
return AjaxResult.success(textPresentation);
}
......
......@@ -78,4 +78,6 @@ public class CommonParam {
private String dc;
private String dmxnr;
}
package com.zjsgfa.project.zt.domain.vo;
import lombok.Data;
@Data
public class ApiResponse {
private int code;
private String msg;
private DataWrapper data;
// getter和setter
public int getCode() { return code; }
public void setCode(int code) { this.code = code; }
public String getMsg() { return msg; }
public void setMsg(String msg) { this.msg = msg; }
public DataWrapper getData() { return data; }
public void setData(DataWrapper data) { this.data = data; }
}
package com.zjsgfa.project.zt.domain.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
public class DataWrapper {
private String event;
private String session_id;
@JsonProperty("data") // 内层的data字段
private InnerData innerData;
// getter和setter
public String getEvent() { return event; }
public void setEvent(String event) { this.event = event; }
public String getSession_id() { return session_id; }
public void setSession_id(String session_id) { this.session_id = session_id; }
public InnerData getInnerData() { return innerData; }
public void setInnerData(InnerData innerData) { this.innerData = innerData; }
}
package com.zjsgfa.project.zt.domain.vo;
import com.fasterxml.jackson.annotation.JsonProperty;
public class InnerData {
@JsonProperty("文本呈现") // 映射JSON中的"文本呈现"字段
private String textPresentation;
// getter和setter
public String getTextPresentation() { return textPresentation; }
public void setTextPresentation(String textPresentation) { this.textPresentation = textPresentation; }
}
......@@ -6,7 +6,8 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://192.168.31.167:3306/zjsgfa?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
# url: jdbc:mysql://192.168.31.167:3306/zjsgfa?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
url: jdbc:mysql://192.168.31.167:3306/zjsgfa-fwq?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
username: root
password: qianhe2024
# url: jdbc:mysql://127.0.0.1:3306/zjsgfa?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8&allowMultiQueries=true
......@@ -18,10 +19,10 @@ spring:
enabled: true
driverClassName: oracle.jdbc.driver.OracleDriver
url: jdbc:oracle:thin:@192.168.31.167:1521/qianhe
username: HHZJJS
password: HHZJJS
# username: DISUSER1
# password: dis#2022
# username: HHZJJS
# password: HHZJJS
username: DISUSER1
password: dis#2022
# slave:
# # 从数据源开关/默认关闭
# enabled: true
......
......@@ -78,8 +78,8 @@ spring:
port: 7789
# 密码
password: qianheRedis2021
#host: 192.168.31.167
# 端口,默认为6379
# host: 192.168.31.167
## 端口,默认为6379
# port: 6379
# password: qianhe2024
# host: 127.0.0.1
......@@ -152,4 +152,27 @@ gen:
# 表前缀(生成类名不会包含表前缀,多个用逗号分隔)
tablePrefix: sys_
# 是否允许生成文件覆盖到本地(自定义路径),默认不允许
allowOverwrite: false
\ No newline at end of file
allowOverwrite: false
#CAS
cas:
server:
host:
#CAS服务地址
url: http://10.68.224.14:8800/cas
#CAS服务登录地址
login_url: ${cas.server.host.url}/login
#CAS服务登出地址
logout_url: ${cas.server.host.url}/logout?service=${app.server.host.url}
# 应用访问地址
app:
#开启cas
casEnable: false
server:
host:
url: http://10.68.249.136:${server.port}
#应用登录地址
login_url: /dev-api
#应用登出地址
logout_url: /logout
#前端登录地址
web_url: http://localhost/login?redirect=/index
\ No newline at end of file
......@@ -95,4 +95,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id}
</foreach>
</delete>
<delete id="deleteSgfambKcxxByZbids">
delete from sgfamb_kcxx where zbid in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<delete id="deleteSgfambKcxxByZbid">
delete from sgfamb_kcxx where zbid = #{id}
</delete>
</mapper>
\ No newline at end of file
......@@ -74,6 +74,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="jhjdzt != null and jhjdzt != ''"> and jhjdzt = #{jhjdzt}</if>
<if test="flzt != null and flzt != ''"> and flzt = #{flzt}</if>
</where>
order by created_time desc
</select>
<select id="selectSjDjjcById" parameterType="Long" resultMap="SjDjjcResult">
......
......@@ -225,10 +225,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getZqshfxList" resultType="com.zjsgfa.project.zt.domain.DjZqsjfx">
select a.jh,c.kc,ksjs,c.js,d.zb,to_char((case when kc ='1' then b.KZRQ1 when kc ='2' then b.KZRQ2 when kc ='3' then b.KZRQ3 when kc ='4' then b.KZRQ4 when kc ='5' then b.KZRQ5 else null end ),'YYYY-MM-DD') || ' ' ||
TO_CHAR(TO_DATE((case when kc ='1' then b.KZSJ1 when kc ='2' then b.KZSJ2 when kc ='3' then b.KZSJ3 when kc ='4' then b.KZSJ4 when kc ='5' then b.KZSJ5 else null end ), 'HH24MI'), 'HH24:MI') || ':00' AS kssj
,to_char((case when kc ='1' then b.KZRQ2 when kc ='2' then (case when KZRQ3 is null or KZRQ3 ='' then WJRQ else KZRQ3 end ) when kc ='3' then (case when KZRQ4 is null or KZRQ4 ='' then WJRQ else KZRQ4 end ) when kc ='4' then (case when KZRQ5 is null or KZRQ5 ='' then WJRQ else KZRQ5 end ) when kc ='5' then b.WJRQ else null end ),'YYYY-MM-DD') || ' ' ||
TO_CHAR(TO_DATE((case when kc ='1' then b.KZSJ2 when kc ='2' then (case when KZRQ3 is null or KZRQ3 ='' then WJSJ else KZSJ3 end ) when kc ='3' then (case when KZRQ4 is null or KZRQ4 ='' then WJSJ else KZSJ4 end ) when kc ='4' then (case when KZRQ5 is null or KZRQ5 ='' then WJSJ else KZSJ5 end ) when kc ='5' then b.WJSJ else null end ), 'HH24MI'), 'HH24:MI') || ':00' AS JSSJ
select a.jh,c.kc,ksjs,c.js,d.zb,to_char((case when c.kc ='1' then b.KZRQ1 when c.kc ='2' then b.KZRQ2 when c.kc ='3' then b.KZRQ3 when c.kc ='4' then b.KZRQ4 when c.kc ='5' then b.KZRQ5 else null end ),'YYYY-MM-DD') || ' ' ||
TO_CHAR(TO_DATE((case when c.kc ='1' then b.KZSJ1 when c.kc ='2' then b.KZSJ2 when c.kc ='3' then b.KZSJ3 when c.kc ='4' then b.KZSJ4 when c.kc ='5' then b.KZSJ5 else null end ), 'HH24MI'), 'HH24:MI') || ':00' AS kssj
,to_char((case when c.kc ='1' then b.KZRQ2 when c.kc ='2' then (case when KZRQ3 is null or KZRQ3 ='' then WJRQ else KZRQ3 end ) when c.kc ='3' then (case when KZRQ4 is null or KZRQ4 ='' then WJRQ else KZRQ4 end ) when c.kc ='4' then (case when KZRQ5 is null or KZRQ5 ='' then WJRQ else KZRQ5 end ) when c.kc ='5' then b.WJRQ else null end ),'YYYY-MM-DD') || ' ' ||
TO_CHAR(TO_DATE((case when c.kc ='1' then b.KZSJ2 when c.kc ='2' then (case when KZRQ3 is null or KZRQ3 ='' then WJSJ else KZSJ3 end ) when c.kc ='3' then (case when KZRQ4 is null or KZRQ4 ='' then WJSJ else KZSJ4 end ) when c.kc ='4' then (case when KZRQ5 is null or KZRQ5 ='' then WJSJ else KZSJ5 end ) when c.kc ='5' then b.WJSJ else null end ), 'HH24MI'), 'HH24:MI') || ':00' AS JSSJ
from JSBA a
left join jsaa b on a.jh = b.jh
left join (
......@@ -239,12 +240,36 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
FROM JSDB jsdb
where jsdb.tgcc not like '%导管%'
order by jh) c on a.jh=c.jh
left join (select jh,
ZZJS,
ROUND(SUM(jc) / case when SUM(JCSJHJ) / 24 = 0 then 1 else SUM(JCSJHJ) / 24 end, 2) zb
from JSHA
group by jh, ZZJS -- 按 jh 和 ZZJS 分组,确保对应关系
order by ZZJS) d on a.JH = d.jh and d.zzjs > c.ksjs and d.zzjs &lt;= c.js
left join (
SELECT
a.jh,
ROUND(
SUM( jc ) /
CASE
WHEN SUM( JCSJHJ ) / 24 = 0 THEN
1 ELSE SUM( JCSJHJ ) / 24
END,
2
) zb,
b.kc
FROM
JSHA a
LEFT JOIN (
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 ksjs
FROM
JSDB
) b ON a.JH = b.jh and a.ZZJS>ksjs and a.ZZJS &lt;=js
GROUP BY
a.jh,
kc
ORDER BY
kc
) d on a.JH = d.jh
where 1=1
<if test="jdhzb!=null">
and ABS(#{jdhzb} - a.jdhzb) &lt; #{jl}
......@@ -420,7 +445,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{item}
</foreach>
</if>
order by jkjl asc) where ROWNUM &lt;= 8
order by jkjl asc) where ROWNUM &lt;= 5
union all
select *
from (
......@@ -476,6 +501,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="js!=null">
and b.wjjs &lt;= #{js}
</if>
<if test="ksjs!=null">
and b.wjjs >= #{ksjs}
</if>
<if test="jxs != null and jxs.size() > 0">
AND a.jx IN
<foreach item="item" collection="jxs" open="(" separator="," close=")">
......@@ -490,7 +518,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</if>
order by jdjl asc
) where ROWNUM &lt; =8
) where ROWNUM &lt; =5
) a order by jkjl
......@@ -731,35 +759,42 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</select>
<select id="getGzbjList" resultType="com.zjsgfa.project.zt.domain.LjGzbj">
select a.jh,
a.QK,
d.zb,
t.*,
ROUND(NVL(c.SJTS, 0) * 24, 2)sjts,
case when c.SJTS is not null then ROUND((nvl(JD2,0)-nvl(JD1,0)) / (ROUND(NVL(c.SJTS,0)*24,2)),2) else 0 end zs
select a.jh, a.qk, d.zb, d.kc, t.JS,
ROUND( NVL( c.SJTS, 0 ) , 2 ) sjts,
CASE WHEN c.SJTS IS NOT NULL THEN
ROUND(
( nvl( JD2, 0 ) - nvl( JD1, 0 ) ) / ( ROUND( NVL( c.SJTS, 0 ) , 2 ) ),
2
) ELSE 0
END zs
from JSaa a
LEFT JOIN (SELECT a.jh,
ROUND(SUM(jc) / CASE WHEN SUM(JCSJHJ) / 24 = 0 THEN 1 ELSE SUM(JCSJHJ) / 24 END, 2) zb,
b.kc
FROM JSHA a
LEFT JOIN (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 ksjs
FROM JSDB) b ON a.JH = b.jh and a.ZZJS > ksjs and a.ZZJS &lt;= js
GROUP BY a.jh,
kc
ORDER BY kc) d ON a.JH = d.jh
left join (SELECT jh,
ztzj,
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,
ZTZJ,
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) t) t on a.JH = t.JH
left join (select *
from JSTA
where NVL(JD1, 0) != NVL(JD2,0)) c on a.JH = c.JH and t.js = c.JD2
left join (
select jh,
ZZJS,
ROUND(SUM(jc) / case when SUM(JCSJHJ) / 24 = 0 then 1 else SUM(JCSJHJ) / 24 end, 2) zb
from JSHA
group by jh, ZZJS -- 按 jh 和 ZZJS 分组,确保对应关系
order by ZZJS
) d on a.JH=d.jh and d.zzjs>ksjs and d.zzjs &lt;=js
ROW_NUMBER() OVER ( PARTITION BY jh ORDER BY js ) AS kc,
JS,
LAG(JS, 1, 0) OVER ( PARTITION BY jh ORDER BY js ) AS ksjs
FROM JSDB) t on d.jh = t.JH and d.kc = t.kc
LEFT JOIN ( select a.*,b.kc 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 ksjs
FROM JSDB) b
LEFT JOIN jsta a on b.JH = a.jh and nvl(a.JD1, 0) >= ksjs and a.JD2 &lt;= js
and NVL(JD1, 0) != NVL(JD2, 0) ) c ON d.JH = c.JH and d.kc=c.kc
AND t.js = c.JD2
where
1=1
<if test="qk!=null and qk!=''">
......@@ -779,7 +814,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</foreach>
</if>
order by zb desc
order by kc,zb desc
</select>
<select id="getJsgaList" resultType="com.zjsgfa.project.zt.domain.vo.JsgaVo">
select distinct a.jh,a.QSJS,a.ZZJS,a.JC,a.JXZS,
......
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