poi版本降低.加入redis队列

This commit is contained in:
18326186802 2021-08-09 13:43:36 +08:00
parent a81ca0a5bb
commit ed9277506d
13 changed files with 92 additions and 31 deletions

View File

@ -115,6 +115,19 @@
<artifactId>jtds</artifactId> <artifactId>jtds</artifactId>
<version>1.2.4</version> <version>1.2.4</version>
</dependency> </dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>redis.clients</groupId>
<artifactId>jedis</artifactId>
</dependency>
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
</dependency>
<!-- <!--
<dependency> <dependency>
<groupId>org.apache.poi</groupId> <groupId>org.apache.poi</groupId>

View File

@ -72,10 +72,16 @@ public class KettleJob extends BaseEntity
/** */ /** */
@Excel(name = "") @Excel(name = "")
private String tplKey; private String tplKey;
@Excel(name = "最后一次成功时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lastSucceedTime;
public void setId(Long id) public Date getLastSucceedTime() {
{ return lastSucceedTime;
this.id = id; }
public void setLastSucceedTime(Date lastSucceedTime) {
this.lastSucceedTime = lastSucceedTime;
} }
public Long getId() public Long getId()

View File

@ -68,6 +68,17 @@ public class KettleTrans extends BaseEntity
@Excel(name = "可执行角色key") @Excel(name = "可执行角色key")
private String roleKey; private String roleKey;
@Excel(name = "最后一次成功时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date lastSucceedTime;
public Date getLastSucceedTime() {
return lastSucceedTime;
}
public void setLastSucceedTime(Date lastSucceedTime) {
this.lastSucceedTime = lastSucceedTime;
}
public void setId(Long id) public void setId(Long id)
{ {
this.id = id; this.id = id;
@ -217,4 +228,5 @@ public class KettleTrans extends BaseEntity
.append("remark", getRemark()) .append("remark", getRemark())
.toString(); .toString();
} }
} }

View File

@ -200,8 +200,7 @@ public class KettleJobServiceImpl implements IKettleJobService
log.error("资源库不存在!"); log.error("资源库不存在!");
return; return;
} }
//加入队列中,等待执行
redisStreamUtil.addKettleJob(kettleJob);
//更新一下状态 //更新一下状态
kettleJob.setJobStatus("运行中"); kettleJob.setJobStatus("运行中");
kettleJobMapper.updateKettleJob(kettleJob); kettleJobMapper.updateKettleJob(kettleJob);
@ -212,7 +211,8 @@ public class KettleJobServiceImpl implements IKettleJobService
kettleUtil.KETTLE_REPO_NAME=repository.getRepoName(); kettleUtil.KETTLE_REPO_NAME=repository.getRepoName();
kettleUtil.KETTLE_REPO_PATH=repository.getBaseDir(); kettleUtil.KETTLE_REPO_PATH=repository.getBaseDir();
kettleUtil.callJob(path,kettleJob.getJobName(),null,null); kettleUtil.callJob(path,kettleJob.getJobName(),null,null);
kettleJob.setJobStatus("已结束"); kettleJob.setJobStatus("成功");
kettleJob.setLastSucceedTime(DateUtils.getNowDate());
kettleJobMapper.updateKettleJob(kettleJob); kettleJobMapper.updateKettleJob(kettleJob);
} catch (Exception e) { } catch (Exception e) {
kettleJob.setJobStatus("异常"); kettleJob.setJobStatus("异常");

View File

@ -207,7 +207,8 @@ public class KettleTransServiceImpl implements IKettleTransService
kettleUtil.KETTLE_REPO_NAME=repository.getRepoName(); kettleUtil.KETTLE_REPO_NAME=repository.getRepoName();
kettleUtil.KETTLE_REPO_PATH=repository.getBaseDir(); kettleUtil.KETTLE_REPO_PATH=repository.getBaseDir();
kettleUtil.callTrans(path,kettleTrans.getTransName(),null,null); kettleUtil.callTrans(path,kettleTrans.getTransName(),null,null);
kettleTrans.setTransStatus("已结束"); kettleTrans.setTransStatus("成功");
kettleTrans.setLastSucceedTime(DateUtils.getNowDate());
kettleTransMapper.updateKettleTrans(kettleTrans); kettleTransMapper.updateKettleTrans(kettleTrans);
} catch (Exception e) { } catch (Exception e) {
kettleTrans.setTransStatus("异常"); kettleTrans.setTransStatus("异常");

View File

@ -1,6 +1,5 @@
package com.ruoyi.kettle.tools; package com.ruoyi.kettle.tools;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.kettle.domain.KettleJob; import com.ruoyi.kettle.domain.KettleJob;
import com.ruoyi.kettle.domain.KettleTrans; import com.ruoyi.kettle.domain.KettleTrans;
import com.ruoyi.kettle.service.IKettleJobService; import com.ruoyi.kettle.service.IKettleJobService;
@ -8,10 +7,7 @@ import com.ruoyi.kettle.service.IKettleTransService;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Component; import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import redis.clients.jedis.Jedis; import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool; import redis.clients.jedis.JedisPool;
import redis.clients.jedis.StreamEntry; import redis.clients.jedis.StreamEntry;
@ -59,7 +55,7 @@ public class RedisStreamUtil {
map.put("trans_"+trandId, transName); map.put("trans_"+trandId, transName);
Jedis jedis = jedisPool.getResource(); Jedis jedis = jedisPool.getResource();
jedis.xadd(koneStream, new StreamEntryID().NEW_ENTRY, map); StreamEntryID id =jedis.xadd(koneStream, new StreamEntryID().NEW_ENTRY, map);
} }
/** /**

View File

@ -21,10 +21,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="isMonitorEnabled" column="is_monitor_enabled" /> <result property="isMonitorEnabled" column="is_monitor_enabled" />
<result property="roleKey" column="role_key" /> <result property="roleKey" column="role_key" />
<result property="tplKey" column="tpl_key" /> <result property="tplKey" column="tpl_key" />
<result property="lastSucceedTime" column="last_succeed_time" />
</resultMap> </resultMap>
<sql id="selectKettleJobVo"> <sql id="selectKettleJobVo">
select id, created_time, update_time, created_by, update_by, job_name, job_description, job_type, job_path, job_repository_id, job_log_level, job_status, is_del, is_monitor_enabled, role_key, tpl_key from kettle_job select id, created_time, update_time, created_by, update_by, job_name, job_description, job_type, job_path, job_repository_id, job_log_level, job_status, is_del, is_monitor_enabled, role_key, tpl_key,last_succeed_time from kettle_job
</sql> </sql>
<select id="selectKettleJobList" parameterType="KettleJob" resultMap="KettleJobResult"> <select id="selectKettleJobList" parameterType="KettleJob" resultMap="KettleJobResult">
@ -123,6 +124,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="isMonitorEnabled != null">is_monitor_enabled = #{isMonitorEnabled},</if> <if test="isMonitorEnabled != null">is_monitor_enabled = #{isMonitorEnabled},</if>
<if test="roleKey != null">role_key = #{roleKey},</if> <if test="roleKey != null">role_key = #{roleKey},</if>
<if test="tplKey != null">tpl_key = #{tplKey},</if> <if test="tplKey != null">tpl_key = #{tplKey},</if>
<if test="lastSucceedTime != null">last_succeed_time = #{lastSucceedTime},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>

View File

@ -22,10 +22,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<result property="tplKey" column="tpl_key" /> <result property="tplKey" column="tpl_key" />
<result property="roleKey" column="role_key" /> <result property="roleKey" column="role_key" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="lastSucceedTime" column="last_succeed_time" />
</resultMap> </resultMap>
<sql id="selectKettleTransVo"> <sql id="selectKettleTransVo">
select id, trans_name, trans_description, created_time, update_time, created_by, update_by, trans_type, trans_path, trans_repository_id, trans_log_level, trans_status, is_del, is_monitor_enabled, tpl_key, role_key, remark from kettle_trans select id, trans_name, trans_description, created_time, update_time, created_by, update_by, trans_type, trans_path, trans_repository_id, trans_log_level, trans_status, is_del, is_monitor_enabled, tpl_key, role_key, remark,last_succeed_time from kettle_trans
</sql> </sql>
<select id="selectKettleTransList" parameterType="KettleTrans" resultMap="KettleTransResult"> <select id="selectKettleTransList" parameterType="KettleTrans" resultMap="KettleTransResult">
@ -126,6 +127,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="tplKey != null">tpl_key = #{tplKey},</if> <if test="tplKey != null">tpl_key = #{tplKey},</if>
<if test="roleKey != null">role_key = #{roleKey},</if> <if test="roleKey != null">role_key = #{roleKey},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="lastSucceedTime != null">last_succeed_time = #{lastSucceedTime},</if>
</trim> </trim>
where id = #{id} where id = #{id}
</update> </update>

View File

@ -53,13 +53,27 @@
$("#treeId").val(treeId); $("#treeId").val(treeId);
$("#treeName").val(treeName); $("#treeName").val(treeName);
$("#transPath").val(path); $("#transPath").val(path);
var pNodeId = treeId;
if(/^[0-9]+.?[0-9]*$/.test(treeId)){ if(/^[0-9]+.?[0-9]*$/.test(treeId)){
$("#transRepositoryId").val(treeId); $("#transRepositoryId").val(treeId);
} }
console.log("pathpathpathpath::"+path); console.log("pathpathpathpath::"+path+"_id:"+treeId);
var treeObj = $.fn.zTree.getZTreeObj( "tree"); var treeObj = $.fn.zTree.getZTreeObj( "tree");
var selectedNode = treeObj .getSelectedNodes(); var selectedNode = treeObj .getSelectedNodes();
var pNode = selectedNode[0].getParentNode();
while(!!pNode) {
var id = pNode.id;
pNode = pNode.getParentNode();
if(pNode == null){
pNodeId = id;
}
}
$("#transRepositoryId").val(pNodeId);
if(/^[0-9]+.?[0-9]*$/.test(treeId) && !selectedNode[0].isParent){ if(/^[0-9]+.?[0-9]*$/.test(treeId) && !selectedNode[0].isParent){
console.log("进来了"); console.log("进来了");
qryRepoSubTree(treeId); qryRepoSubTree(treeId);

View File

@ -67,7 +67,8 @@
var quartzFlag=[[${@permission.hasPermi('kettle:job:setquartz')}]]; var quartzFlag=[[${@permission.hasPermi('kettle:job:setquartz')}]];
var prefix = ctx + "kettle/job"; var prefix = ctx + "kettle/job";
var logLevel = [[${@dict.getType('kettle_log_level')}]];
var jobStatus = [[${@dict.getType('kettle_trans_status')}]];
$(function() { $(function() {
var options = { var options = {
url: prefix + "/list", url: prefix + "/list",
@ -110,11 +111,21 @@
},*/ },*/
{ {
field: 'jobLogLevel', field: 'jobLogLevel',
title: '日志级别' title: '日志级别',
formatter: function(value, row, index) {
return $.table.selectDictLabel(logLevel, value);
}
}, },
{ {
field: 'jobStatus', field: 'jobStatus',
title: '状态' title: '状态',
formatter: function(value, row, index) {
return $.table.selectDictLabel(jobStatus, value);
}
},
{
field: 'lastSucceedTime',
title: '最后成功时间',
}, },
/* { /* {
field: 'isDel', field: 'isDel',

View File

@ -109,17 +109,21 @@
return $.table.selectDictLabel(transStatus, value); return $.table.selectDictLabel(transStatus, value);
} }
}, },
{
field: 'lastSucceedTime',
title: '最后成功时间',
},
// { // {
// field: 'isDel', // field: 'isDel',
// title: '是否删除' // title: '是否删除'
// }, // },
{ // {
field: 'isMonitorEnabled', // field: 'isMonitorEnabled',
title: '是否启用', // title: '是否启用',
formatter: function(value, row, index) { // formatter: function(value, row, index) {
return value==1?"是":"否"; // return value==1?"是":"否";
} // }
}, // },
// { // {
// field: 'tplKey', // field: 'tplKey',
// title: '保留备用' // title: '保留备用'

View File

@ -30,7 +30,7 @@
<jna.version>5.8.0</jna.version> <jna.version>5.8.0</jna.version>
<commons.io.version>2.10.0</commons.io.version> <commons.io.version>2.10.0</commons.io.version>
<commons.fileupload.version>1.4</commons.fileupload.version> <commons.fileupload.version>1.4</commons.fileupload.version>
<poi.version>4.1.2</poi.version> <poi.version>3.17</poi.version>
<velocity.version>1.7</velocity.version> <velocity.version>1.7</velocity.version>
</properties> </properties>

View File

@ -1102,7 +1102,7 @@ public class ExcelUtil<T>
Cell cell = row.getCell(column); Cell cell = row.getCell(column);
if (StringUtils.isNotNull(cell)) if (StringUtils.isNotNull(cell))
{ {
if (cell.getCellType() == CellType.NUMERIC || cell.getCellType() == CellType.FORMULA) if (cell.getCellTypeEnum() == CellType.NUMERIC || cell.getCellTypeEnum() == CellType.FORMULA)
{ {
val = cell.getNumericCellValue(); val = cell.getNumericCellValue();
if (DateUtil.isCellDateFormatted(cell)) if (DateUtil.isCellDateFormatted(cell))
@ -1121,15 +1121,15 @@ public class ExcelUtil<T>
} }
} }
} }
else if (cell.getCellType() == CellType.STRING) else if (cell.getCellTypeEnum() == CellType.STRING)
{ {
val = cell.getStringCellValue(); val = cell.getStringCellValue();
} }
else if (cell.getCellType() == CellType.BOOLEAN) else if (cell.getCellTypeEnum() == CellType.BOOLEAN)
{ {
val = cell.getBooleanCellValue(); val = cell.getBooleanCellValue();
} }
else if (cell.getCellType() == CellType.ERROR) else if (cell.getCellTypeEnum() == CellType.ERROR)
{ {
val = cell.getErrorCellValue(); val = cell.getErrorCellValue();
} }
@ -1158,7 +1158,7 @@ public class ExcelUtil<T>
for (int i = row.getFirstCellNum(); i < row.getLastCellNum(); i++) for (int i = row.getFirstCellNum(); i < row.getLastCellNum(); i++)
{ {
Cell cell = row.getCell(i); Cell cell = row.getCell(i);
if (cell != null && cell.getCellType() != CellType.BLANK) if (cell != null && cell.getCellTypeEnum() != CellType.BLANK)
{ {
return false; return false;
} }