兼容时间字段

This commit is contained in:
bwcx_jzy 2021-12-27 10:48:18 +08:00
parent c88a3169fa
commit f32f2aae67
No known key found for this signature in database
GPG Key ID: 5E48E9372088B9E5
4 changed files with 44 additions and 1 deletions

View File

@ -6,6 +6,7 @@
1. 脚本模版新增日志管理 1. 脚本模版新增日志管理
2. 【server】ssh 文件管理新增导入压缩包自动解压(感谢@刘志远) 2. 【server】ssh 文件管理新增导入压缩包自动解压(感谢@刘志远)
3. 脚本模版新增定时执行(感谢@大土豆)
### 解决BUG、优化功能 ### 解决BUG、优化功能

View File

@ -47,6 +47,7 @@ import io.jpom.system.ServerExtConfigBean;
import org.springframework.util.Assert; import org.springframework.util.Assert;
import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletRequest;
import java.util.ArrayList;
import java.util.Collection; import java.util.Collection;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -228,6 +229,7 @@ public abstract class BaseDbService<T extends BaseDbModel> extends BaseDbCommonS
// //
Page pageReq = this.parsePage(paramMap); Page pageReq = this.parsePage(paramMap);
Entity where = Entity.create(); Entity where = Entity.create();
List<String> ignoreField = new ArrayList<>(10);
// 查询条件 // 查询条件
for (Map.Entry<String, String> stringStringEntry : paramMap.entrySet()) { for (Map.Entry<String, String> stringStringEntry : paramMap.entrySet()) {
String key = stringStringEntry.getKey(); String key = stringStringEntry.getKey();
@ -255,6 +257,25 @@ public abstract class BaseDbService<T extends BaseDbModel> extends BaseDbCommonS
// 防止字段重复 // 防止字段重复
where.set(key + " ", "<= " + endDateTime.getTime()); where.set(key + " ", "<= " + endDateTime.getTime());
} }
} else if (StrUtil.containsIgnoreCase(key, "time")) {
String timeKey = StrUtil.removeAny(key, "[0]", "[1]");
if (ignoreField.contains(timeKey)) {
continue;
}
String startTime = paramMap.get(timeKey + "[0]");
String endTime = paramMap.get(timeKey + "[1]");
if (StrUtil.isAllNotEmpty(startTime, endTime)) {
DateTime startDateTime = DateUtil.parse(startTime, DatePattern.NORM_DATETIME_FORMAT);
where.set(timeKey, ">= " + startDateTime.getTime());
DateTime endDateTime = DateUtil.parse(endTime, DatePattern.NORM_DATETIME_FORMAT);
if (startDateTime.equals(endDateTime)) {
endDateTime = DateUtil.endOfDay(endDateTime);
}
// 防止字段重复
where.set(timeKey + " ", "<= " + endDateTime.getTime());
}
ignoreField.add(timeKey);
} else { } else {
where.set(StrUtil.format("`{}`", key), value); where.set(StrUtil.format("`{}`", key), value);
} }

View File

@ -109,7 +109,7 @@ export default {
columns: [ columns: [
// { title: "Script ID", dataIndex: "id", width: 200, ellipsis: true, scopedSlots: { customRender: "id" } }, // { title: "Script ID", dataIndex: "id", width: 200, ellipsis: true, scopedSlots: { customRender: "id" } },
{ title: "名称", dataIndex: "name", ellipsis: true, scopedSlots: { customRender: "name" } }, { title: "名称", dataIndex: "name", ellipsis: true, scopedSlots: { customRender: "name" } },
{ title: "修改时间", dataIndex: "modifyTimeMillis", width: 170, ellipsis: true, scopedSlots: { customRender: "modifyTimeMillis" } }, { title: "修改时间", dataIndex: "modifyTimeMillis", width: 180, ellipsis: true, scopedSlots: { customRender: "modifyTimeMillis" } },
{ title: "修改人", dataIndex: "modifyUser", ellipsis: true, scopedSlots: { customRender: "modifyUser" }, width: 120 }, { title: "修改人", dataIndex: "modifyUser", ellipsis: true, scopedSlots: { customRender: "modifyUser" }, width: 120 },
{ title: "最后操作人", dataIndex: "lastRunUser", ellipsis: true, scopedSlots: { customRender: "lastRunUser" } }, { title: "最后操作人", dataIndex: "lastRunUser", ellipsis: true, scopedSlots: { customRender: "lastRunUser" } },
{ title: "操作", dataIndex: "operation", scopedSlots: { customRender: "operation" }, width: 260 }, { title: "操作", dataIndex: "operation", scopedSlots: { customRender: "operation" }, width: 260 },

View File

@ -5,9 +5,30 @@
<a-select show-search option-filter-prop="children" v-model="listQuery.triggerExecType" allowClear placeholder="触发类型" class="search-input-item"> <a-select show-search option-filter-prop="children" v-model="listQuery.triggerExecType" allowClear placeholder="触发类型" class="search-input-item">
<a-select-option v-for="(val, key) in triggerExecTypeMap" :key="key">{{ val }}</a-select-option> <a-select-option v-for="(val, key) in triggerExecTypeMap" :key="key">{{ val }}</a-select-option>
</a-select> </a-select>
<a-range-picker
v-model="listQuery['createTimeMillis']"
allowClear
inputReadOnly
class="search-input-item"
:show-time="{ format: 'HH:mm:ss' }"
:placeholder="['执行时间开始', '执行时间结束']"
format="YYYY-MM-DD HH:mm:ss"
valueFormat="YYYY-MM-DD HH:mm:ss"
/>
<a-tooltip title="按住 Ctr 或者 Alt 键点击按钮快速回到第一页"> <a-tooltip title="按住 Ctr 或者 Alt 键点击按钮快速回到第一页">
<a-button type="primary" @click="loadData">搜索</a-button> <a-button type="primary" @click="loadData">搜索</a-button>
</a-tooltip> </a-tooltip>
<a-tooltip>
<template slot="title">
<div>脚本模版是存储在节点(插件端),执行也都将在节点里面执行,服务端会定时去拉取执行日志,拉取频率为 100 /分钟</div>
<div>
<ul>
<li>数据可能出现一定时间延迟</li>
</ul>
</div>
</template>
<a-icon type="question-circle" theme="filled" />
</a-tooltip>
</div> </div>
<!-- 数据表格 --> <!-- 数据表格 -->
<a-table :data-source="list" :loading="loading" :columns="columns" @change="changePage" :pagination="pagination" bordered rowKey="id"> <a-table :data-source="list" :loading="loading" :columns="columns" @change="changePage" :pagination="pagination" bordered rowKey="id">