Commit 7fe6c4f7 by jiang'yun

修改

parent 018e522b
package com.zjsgfa.framework.task;
import cn.hutool.http.HttpRequest;
import com.alibaba.fastjson2.JSON;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.JsonObject;
import com.zjsgfa.project.zjsgfa.domain.Mxfxjgb;
import com.zjsgfa.project.zjsgfa.mapper.MxfxjgbMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Component("mxdyTask")
public class MxdyTask {
@Autowired
private MxfxjgbMapper mxfxjgbMapper;
public void ryParams(Long mxid)
{
Mxfxjgb mxfxjgb = mxfxjgbMapper.selectMxfxjgbById(mxid);
System.out.println(mxfxjgb);
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");
map2.put("value",mxfxjgb.getRwnr());
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/53f4afd436d2417180cb27d6dc0a3e17";
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);
mxfxjgb.setFhjg(textPresentation);
mxfxjgb.setJxzt("解析完成");
mxfxjgbMapper.updateMxfxjgb(mxfxjgb);
}
}
...@@ -2,6 +2,12 @@ package com.zjsgfa.project.zjsgfa.controller; ...@@ -2,6 +2,12 @@ package com.zjsgfa.project.zjsgfa.controller;
import java.util.List; import java.util.List;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import com.zjsgfa.common.exception.job.TaskException;
import com.zjsgfa.project.monitor.domain.SysJob;
import com.zjsgfa.project.monitor.service.ISysJobService;
import oracle.jdbc.proxy.annotation.Post;
import org.quartz.SchedulerException;
import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
...@@ -34,6 +40,9 @@ public class MxfxjgbController extends BaseController ...@@ -34,6 +40,9 @@ public class MxfxjgbController extends BaseController
@Autowired @Autowired
private IMxfxjgbService mxfxjgbService; private IMxfxjgbService mxfxjgbService;
@Autowired
private ISysJobService jobService;
/** /**
* 查询大模型分析列表 * 查询大模型分析列表
*/ */
...@@ -75,8 +84,7 @@ public class MxfxjgbController extends BaseController ...@@ -75,8 +84,7 @@ public class MxfxjgbController extends BaseController
//@PreAuthorize("@ss.hasPermi('system:mxfxjgb:add')") //@PreAuthorize("@ss.hasPermi('system:mxfxjgb:add')")
@Log(title = "大模型分析", businessType = BusinessType.INSERT) @Log(title = "大模型分析", businessType = BusinessType.INSERT)
@PostMapping @PostMapping
public AjaxResult add(@RequestBody Mxfxjgb mxfxjgb) public AjaxResult add(@RequestBody Mxfxjgb mxfxjgb) throws SchedulerException, TaskException {
{
return toAjax(mxfxjgbService.insertMxfxjgb(mxfxjgb)); return toAjax(mxfxjgbService.insertMxfxjgb(mxfxjgb));
} }
...@@ -101,4 +109,29 @@ public class MxfxjgbController extends BaseController ...@@ -101,4 +109,29 @@ public class MxfxjgbController extends BaseController
{ {
return toAjax(mxfxjgbService.deleteMxfxjgbByIds(ids)); return toAjax(mxfxjgbService.deleteMxfxjgbByIds(ids));
} }
@GetMapping("/run/{id}")
public AjaxResult run(@PathVariable("id") Long id) throws SchedulerException
{
boolean result=false;
Mxfxjgb mxfxjgb1 = mxfxjgbService.selectMxfxjgbById(id);
if(mxfxjgb1!=null){
if(mxfxjgb1.getJobid()!=null){
SysJob job = jobService.selectJobById(mxfxjgb1.getJobid());
result = jobService.run(job);
if(result){
mxfxjgb1.setJxzt("解析中");
}else {
mxfxjgb1.setJxzt("解析失败");
}
mxfxjgbService.updateMxfxjgb(mxfxjgb1);
}
}
return result ? success() : error("任务不存在或已过期!");
}
} }
...@@ -38,6 +38,8 @@ public class Mxfxjgb extends BaseEntity ...@@ -38,6 +38,8 @@ public class Mxfxjgb extends BaseEntity
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") @DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date rwsj; private Date rwsj;
//任务内容
private String rwnr;
/** 解析状态 */ /** 解析状态 */
@Excel(name = "解析状态") @Excel(name = "解析状态")
...@@ -64,4 +66,6 @@ public class Mxfxjgb extends BaseEntity ...@@ -64,4 +66,6 @@ public class Mxfxjgb extends BaseEntity
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date createdTime; private Date createdTime;
private Long jobid;
} }
...@@ -83,8 +83,10 @@ public class SjDjjc extends BaseEntity ...@@ -83,8 +83,10 @@ public class SjDjjc extends BaseEntity
private String zjgs; private String zjgs;
/** 钻井队 */ /** 钻井队 */
@Excel(name = "钻井队")
private String zjd; private String zjd;
@Excel(name = "钻井队")
private String zjdmc;
/** 井底横坐标 */ /** 井底横坐标 */
@Excel(name = "井底横坐标") @Excel(name = "井底横坐标")
......
package com.zjsgfa.project.zjsgfa.service; package com.zjsgfa.project.zjsgfa.service;
import java.util.List; import java.util.List;
import com.zjsgfa.common.exception.job.TaskException;
import com.zjsgfa.project.zjsgfa.domain.Mxfxjgb; import com.zjsgfa.project.zjsgfa.domain.Mxfxjgb;
import org.quartz.SchedulerException;
/** /**
* 大模型分析Service接口 * 大模型分析Service接口
...@@ -33,7 +36,7 @@ public interface IMxfxjgbService ...@@ -33,7 +36,7 @@ public interface IMxfxjgbService
* @param mxfxjgb 大模型分析 * @param mxfxjgb 大模型分析
* @return 结果 * @return 结果
*/ */
public int insertMxfxjgb(Mxfxjgb mxfxjgb); public int insertMxfxjgb(Mxfxjgb mxfxjgb) throws SchedulerException, TaskException;
/** /**
* 修改大模型分析 * 修改大模型分析
......
package com.zjsgfa.project.zjsgfa.service.impl; package com.zjsgfa.project.zjsgfa.service.impl;
import java.util.List; import java.util.List;
import com.zjsgfa.common.exception.job.TaskException;
import com.zjsgfa.common.utils.DateUtils; import com.zjsgfa.common.utils.DateUtils;
import com.zjsgfa.project.monitor.domain.SysJob;
import com.zjsgfa.project.monitor.service.ISysJobService;
import org.quartz.SchedulerException;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import com.zjsgfa.project.zjsgfa.mapper.MxfxjgbMapper; import com.zjsgfa.project.zjsgfa.mapper.MxfxjgbMapper;
import com.zjsgfa.project.zjsgfa.domain.Mxfxjgb; import com.zjsgfa.project.zjsgfa.domain.Mxfxjgb;
import com.zjsgfa.project.zjsgfa.service.IMxfxjgbService; import com.zjsgfa.project.zjsgfa.service.IMxfxjgbService;
import org.springframework.transaction.annotation.Transactional;
/** /**
* 大模型分析Service业务层处理 * 大模型分析Service业务层处理
...@@ -20,6 +26,9 @@ public class MxfxjgbServiceImpl implements IMxfxjgbService ...@@ -20,6 +26,9 @@ public class MxfxjgbServiceImpl implements IMxfxjgbService
@Autowired @Autowired
private MxfxjgbMapper mxfxjgbMapper; private MxfxjgbMapper mxfxjgbMapper;
@Autowired
private ISysJobService jobService;
/** /**
* 查询大模型分析 * 查询大模型分析
* *
...@@ -51,9 +60,22 @@ public class MxfxjgbServiceImpl implements IMxfxjgbService ...@@ -51,9 +60,22 @@ public class MxfxjgbServiceImpl implements IMxfxjgbService
* @return 结果 * @return 结果
*/ */
@Override @Override
public int insertMxfxjgb(Mxfxjgb mxfxjgb) @Transactional(rollbackFor = Exception.class)
{ public int insertMxfxjgb(Mxfxjgb mxfxjgb) throws SchedulerException, TaskException {
return mxfxjgbMapper.insertMxfxjgb(mxfxjgb); int i = mxfxjgbMapper.insertMxfxjgb(mxfxjgb);
if (i > 0) {
SysJob sysJob =new SysJob();
sysJob.setJobName(mxfxjgb.getRwmc());
sysJob.setJobGroup("DEFAULT");
sysJob.setInvokeTarget("mxdyTask.ryParams("+mxfxjgb.getId()+"L)");
sysJob.setCronExpression("0 0 * * * ?");
sysJob.setMisfirePolicy("2");
sysJob.setConcurrent("0");
sysJob.setStatus("0");
jobService.insertJob(sysJob);
mxfxjgb.setJobid(sysJob.getJobId());
}
return i;
} }
/** /**
......
...@@ -396,8 +396,8 @@ public class SjFdsgcsServiceImpl implements ISjFdsgcsService ...@@ -396,8 +396,8 @@ public class SjFdsgcsServiceImpl implements ISjFdsgcsService
} }
} }
} }
sjFdsgcs.setZjgccs(zjgccs); // sjFdsgcs.setZjgccs(zjgccs);
sjFdsgcs.setZjycs(zjycs); // sjFdsgcs.setZjycs(zjycs);
if (zyfx.endsWith("<p>邻井风险<p>")){ if (zyfx.endsWith("<p>邻井风险<p>")){
zyfx=zyfx.replace("<p>邻井风险<p>",""); zyfx=zyfx.replace("<p>邻井风险<p>","");
} }
...@@ -491,8 +491,8 @@ public class SjFdsgcsServiceImpl implements ISjFdsgcsService ...@@ -491,8 +491,8 @@ public class SjFdsgcsServiceImpl implements ISjFdsgcsService
} }
} }
} }
sjFdsgcs1.setZjgccs(zjgccs); // sjFdsgcs1.setZjgccs(zjgccs);
sjFdsgcs1.setZjycs(zjycs); // sjFdsgcs1.setZjycs(zjycs);
sjFdsgcs1.setFxgkcs(fxgkcs); sjFdsgcs1.setFxgkcs(fxgkcs);
sjFdsgcs1.setZyfx(zyfx); sjFdsgcs1.setZyfx(zyfx);
String join = ""; String join = "";
......
...@@ -18,10 +18,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -18,10 +18,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="createdTime" column="created_time" /> <result property="createdTime" column="created_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="rwnr" column="rwnr" />
<result property="jobid" column="jobid" />
</resultMap> </resultMap>
<sql id="selectMxfxjgbVo"> <sql id="selectMxfxjgbVo">
select id, mklx, rwlx, rwmc, rwsj, jxzt, fhjg, url, bz, created_by, created_time, update_by, update_time from mxfxjgb select id, mklx, rwlx, rwmc, rwsj, jxzt, fhjg, url, bz, created_by, created_time, update_by, update_time,rwnr,jobid from mxfxjgb
</sql> </sql>
<select id="selectMxfxjgbList" parameterType="Mxfxjgb" resultMap="MxfxjgbResult"> <select id="selectMxfxjgbList" parameterType="Mxfxjgb" resultMap="MxfxjgbResult">
...@@ -37,7 +39,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -37,7 +39,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="bz != null and bz != ''"> and bz = #{bz}</if> <if test="bz != null and bz != ''"> and bz = #{bz}</if>
<if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if> <if test="createdBy != null and createdBy != ''"> and created_by = #{createdBy}</if>
<if test="createdTime != null "> and created_time = #{createdTime}</if> <if test="createdTime != null "> and created_time = #{createdTime}</if>
<if test="jobid != null "> and jobid = #{jobid}</if>
</where> </where>
order by created_time desc
</select> </select>
<select id="selectMxfxjgbById" parameterType="Long" resultMap="MxfxjgbResult"> <select id="selectMxfxjgbById" parameterType="Long" resultMap="MxfxjgbResult">
...@@ -60,6 +64,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -60,6 +64,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createdTime != null">created_time,</if> <if test="createdTime != null">created_time,</if>
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="rwnr != null">rwnr,</if>
<if test="jobid != null">jobid,</if>
</trim> </trim>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="mklx != null">#{mklx},</if> <if test="mklx != null">#{mklx},</if>
...@@ -74,6 +80,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -74,6 +80,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createdTime != null">#{createdTime},</if> <if test="createdTime != null">#{createdTime},</if>
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="rwnr != null">#{rwnr},</if>
<if test="jobid != null">#{jobid},</if>
</trim> </trim>
</insert> </insert>
...@@ -92,6 +100,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -92,6 +100,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="createdTime != null">created_time = #{createdTime},</if> <if test="createdTime != null">created_time = #{createdTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if>
<if test="rwnr != null">rwnr = #{rwnr},</if>
<if test="jobid != null">jobid = #{jobid},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>
......
...@@ -40,7 +40,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -40,7 +40,40 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
</resultMap> </resultMap>
<sql id="selectSjDjjcVo"> <sql id="selectSjDjjcVo">
select id, jh, jb, jx, jkhzb, jkzzb, gzwz, wzcw, ztmd, wzyz, wjfa, created_by, created_time, update_by, update_time, zjgs, zjd, jdhzb, jdzzb, zt, qk, sjzt, ljzlzt, dzfxzt, fxtszt, sggyzt, fdsgzt, jkzt, hsezt, jhjdzt, flzt, faid from sj_djjc select a.id,
jh,
jb,
jx,
jkhzb,
jkzzb,
gzwz,
wzcw,
ztmd,
wzyz,
wjfa,
a.created_by,
a.created_time,
a.update_by,
a.update_time,
a.zjgs,
a.zjd,
b.zjjd zjdmc,
jdhzb,
jdzzb,
zt,
qk,
sjzt,
ljzlzt,
dzfxzt,
fxtszt,
sggyzt,
fdsgzt,
jkzt,
hsezt,
jhjdzt,
flzt,
faid
from sj_djjc a left join jcxx_jdxx b on a.zjd=b.id
</sql> </sql>
<select id="selectSjDjjcList" parameterType="SjDjjc" resultMap="SjDjjcResult"> <select id="selectSjDjjcList" parameterType="SjDjjc" resultMap="SjDjjcResult">
...@@ -75,16 +108,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -75,16 +108,16 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="jhjdzt != null and jhjdzt != ''"> and jhjdzt = #{jhjdzt}</if> <if test="jhjdzt != null and jhjdzt != ''"> and jhjdzt = #{jhjdzt}</if>
<if test="flzt != null and flzt != ''"> and flzt = #{flzt}</if> <if test="flzt != null and flzt != ''"> and flzt = #{flzt}</if>
</where> </where>
order by created_time desc order by a.created_time desc
</select> </select>
<select id="selectSjDjjcById" parameterType="Long" resultMap="SjDjjcResult"> <select id="selectSjDjjcById" parameterType="Long" resultMap="SjDjjcResult">
<include refid="selectSjDjjcVo"/> <include refid="selectSjDjjcVo"/>
where id = #{id} where a.id = #{id}
</select> </select>
<select id="selectSjDjjcByJh" resultType="com.zjsgfa.project.zjsgfa.domain.SjDjjc"> <select id="selectSjDjjcByJh" resultType="com.zjsgfa.project.zjsgfa.domain.SjDjjc">
<include refid="selectSjDjjcVo"/> <include refid="selectSjDjjcVo"/>
where jh = #{jh} where a.jh = #{jh}
</select> </select>
<insert id="insertSjDjjc" parameterType="SjDjjc" useGeneratedKeys="true" keyProperty="id"> <insert id="insertSjDjjc" parameterType="SjDjjc" useGeneratedKeys="true" keyProperty="id">
......
...@@ -134,7 +134,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -134,7 +134,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getDjjcList" resultType="com.zjsgfa.project.zt.domain.Djjc"> <select id="getDjjcList" resultType="com.zjsgfa.project.zt.domain.Djjc">
select a.jh,a.jdhzb,a.jdzzb,to_char(b.WJRQ,'YYYY-MM-DD') wjrq,c.kc,c.jd,ksjs,c.JS,xh, select a.jh,a.jdhzb,a.jdzzb,to_char(b.WJRQ,'YYYY-MM-DD') wjrq,c.kc,d.QSJS ||'-' || d.ZZJS jd,ksjs,c.JS,xh,
SZDC cw, SZDC cw,
JC, JC,
jxzs, jxzs,
...@@ -192,7 +192,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" ...@@ -192,7 +192,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
Qzyy, Qzyy,
zzjs, zzjs,
ROUND(jc / case when (JCSJHJ / 24) =0 then 1 else (JCSJHJ / 24) end , 2) zb ROUND(jc / case when (JCSJHJ / 24) =0 then 1 else (JCSJHJ / 24) end , 2) zb
,pl,LGBY,cc ,pl,LGBY,cc,QSJS
from JSHA from JSHA
order by xh order by xh
......
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