mirror of https://gitee.com/y_project/RuoYi.git
TG消息管理并与监听地址群组绑定功能上线
parent
36a87cb4c7
commit
0d9da75a26
|
@ -154,7 +154,7 @@
|
|||
</plugin> -->
|
||||
</plugins>
|
||||
<finalName>${project.artifactId}</finalName>
|
||||
<!-- <resources>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<excludes>
|
||||
|
@ -162,7 +162,7 @@
|
|||
<exclude>*.xml</exclude>
|
||||
</excludes>
|
||||
</resource>
|
||||
</resources>-->
|
||||
</resources>
|
||||
</build>
|
||||
|
||||
|
||||
|
|
|
@ -0,0 +1,131 @@
|
|||
package com.ruoyi.web.controller.tg;
|
||||
|
||||
import com.ruoyi.common.annotation.Log;
|
||||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.TgMessageInfo;
|
||||
import com.ruoyi.common.core.domain.entity.TgMessageTask;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||
import com.ruoyi.system.service.ITgMessageInfoService;
|
||||
import com.ruoyi.system.service.ITgMessageTaskService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.ui.ModelMap;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TG消息任务管理Controller
|
||||
*
|
||||
* @author dorion
|
||||
* @date 2024-07-14
|
||||
*/
|
||||
@Controller
|
||||
@RequestMapping("/tg/task")
|
||||
public class TgMessageTaskController extends BaseController
|
||||
{
|
||||
private String prefix = "tg/task";
|
||||
|
||||
@Autowired
|
||||
private ITgMessageInfoService iTgMessageInfoService;
|
||||
|
||||
@Autowired
|
||||
private ITgMessageTaskService tgMessageTaskService;
|
||||
|
||||
@RequiresPermissions("tg:task:view")
|
||||
@GetMapping()
|
||||
public String task(ModelMap mmap)
|
||||
{ mmap.put("topicTgmessageInfoList", iTgMessageInfoService.selectTgMessageInfoList(new TgMessageInfo()));
|
||||
return prefix + "/task";
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询TG消息任务管理列表
|
||||
*/
|
||||
@RequiresPermissions("tg:task:list")
|
||||
@PostMapping("/list")
|
||||
@ResponseBody
|
||||
public TableDataInfo list(TgMessageTask tgMessageTask)
|
||||
{
|
||||
startPage();
|
||||
List<TgMessageTask> list = tgMessageTaskService.selectTgMessageTaskList(tgMessageTask);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 导出TG消息任务管理列表
|
||||
*/
|
||||
@RequiresPermissions("tg:task:export")
|
||||
@Log(title = "TG消息任务管理", businessType = BusinessType.EXPORT)
|
||||
@PostMapping("/export")
|
||||
@ResponseBody
|
||||
public AjaxResult export(TgMessageTask tgMessageTask)
|
||||
{
|
||||
List<TgMessageTask> list = tgMessageTaskService.selectTgMessageTaskList(tgMessageTask);
|
||||
ExcelUtil<TgMessageTask> util = new ExcelUtil<TgMessageTask>(TgMessageTask.class);
|
||||
return util.exportExcel(list, "TG消息任务管理数据");
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增TG消息任务管理
|
||||
*/
|
||||
@GetMapping("/add")
|
||||
public String add(ModelMap mmap)
|
||||
{
|
||||
mmap.put("topicTgmessageInfoList", iTgMessageInfoService.selectTopicTgMessageInfoList());
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增保存TG消息任务管理
|
||||
*/
|
||||
@RequiresPermissions("tg:task:add")
|
||||
@Log(title = "TG消息任务管理", businessType = BusinessType.INSERT)
|
||||
@PostMapping("/add")
|
||||
@ResponseBody
|
||||
public AjaxResult addSave(TgMessageTask tgMessageTask)
|
||||
{
|
||||
return toAjax(tgMessageTaskService.insertTgMessageTask(tgMessageTask));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改TG消息任务管理
|
||||
*/
|
||||
@RequiresPermissions("tg:task:edit")
|
||||
@GetMapping("/edit/{idTgMessageTask}")
|
||||
public String edit(@PathVariable("idTgMessageTask") Long idTgMessageTask, ModelMap mmap)
|
||||
{
|
||||
TgMessageTask tgMessageTask = tgMessageTaskService.selectTgMessageTaskByIdTgMessageTask(idTgMessageTask);
|
||||
mmap.put("topicTgmessageInfoList", iTgMessageInfoService.selectTopicTgMessageInfoList());
|
||||
mmap.put("tgMessageTask", tgMessageTask);
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改保存TG消息任务管理
|
||||
*/
|
||||
@RequiresPermissions("tg:task:edit")
|
||||
@Log(title = "TG消息任务管理", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/edit")
|
||||
@ResponseBody
|
||||
public AjaxResult editSave(TgMessageTask tgMessageTask)
|
||||
{
|
||||
return toAjax(tgMessageTaskService.updateTgMessageTask(tgMessageTask));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除TG消息任务管理
|
||||
*/
|
||||
@RequiresPermissions("tg:task:remove")
|
||||
@Log(title = "TG消息任务管理", businessType = BusinessType.DELETE)
|
||||
@PostMapping( "/remove")
|
||||
@ResponseBody
|
||||
public AjaxResult remove(String ids)
|
||||
{
|
||||
return toAjax(tgMessageTaskService.deleteTgMessageTaskByIdTgMessageTasks(ids));
|
||||
}
|
||||
}
|
|
@ -4,6 +4,7 @@ import com.ruoyi.common.annotation.Log;
|
|||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.MonitorAddressInfo;
|
||||
import com.ruoyi.common.core.domain.entity.TgMessageInfo;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.DictUtils;
|
||||
|
@ -11,6 +12,7 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
|
|||
import com.ruoyi.system.domain.vo.MonitorAddressInfoVO;
|
||||
import com.ruoyi.system.service.IAccountAddressInfoService;
|
||||
import com.ruoyi.system.service.IMonitorAddressInfoService;
|
||||
import com.ruoyi.system.service.ITgMessageInfoService;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
@ -35,11 +37,16 @@ public class Trx2EnergyMonitorAddressInfoController extends BaseController
|
|||
private IMonitorAddressInfoService monitorAddressInfoService;
|
||||
@Autowired
|
||||
private IAccountAddressInfoService accountAddressInfoService;
|
||||
@Autowired
|
||||
private ITgMessageInfoService tgMessageInfoService;
|
||||
|
||||
@RequiresPermissions("trx2Energy:monitor:view")
|
||||
@GetMapping()
|
||||
public String monitor()
|
||||
public String monitor(ModelMap mmap)
|
||||
{
|
||||
TgMessageInfo tgMessageInfo = new TgMessageInfo();
|
||||
tgMessageInfo.setMessageType(4L);
|
||||
mmap.put("topicTgmessageInfoList", tgMessageInfoService.selectTgMessageInfoList(tgMessageInfo));
|
||||
return prefix + "/monitor";
|
||||
}
|
||||
|
||||
|
@ -80,6 +87,9 @@ public class Trx2EnergyMonitorAddressInfoController extends BaseController
|
|||
{
|
||||
String busiType = DictUtils.getDictValue("sys_busi_type", "TRX兑能量");
|
||||
mmap.put("accountAddressList", accountAddressInfoService.selectAccountAddressInfoAll(busiType));
|
||||
TgMessageInfo tgMessageInfo = new TgMessageInfo();
|
||||
tgMessageInfo.setMessageType(4L);
|
||||
mmap.put("topicTgmessageInfoList", tgMessageInfoService.selectTgMessageInfoList(tgMessageInfo));
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
|
@ -106,6 +116,9 @@ public class Trx2EnergyMonitorAddressInfoController extends BaseController
|
|||
MonitorAddressInfo monitorAddressInfo = monitorAddressInfoService.selectMonitorAddressInfoByIdMonitorAddress(idMonitorAddress);
|
||||
mmap.put("monitorAddressInfo", monitorAddressInfo);
|
||||
String busiType = DictUtils.getDictValue("sys_busi_type", "TRX兑能量");
|
||||
TgMessageInfo tgMessageInfo = new TgMessageInfo();
|
||||
tgMessageInfo.setMessageType(4L);
|
||||
mmap.put("topicTgmessageInfoList", tgMessageInfoService.selectTgMessageInfoList(tgMessageInfo));
|
||||
mmap.put("accountAddressList", accountAddressInfoService.selectAccountAddressInfoAll(busiType));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
|
|
@ -4,6 +4,7 @@ import com.ruoyi.common.annotation.Log;
|
|||
import com.ruoyi.common.core.controller.BaseController;
|
||||
import com.ruoyi.common.core.domain.AjaxResult;
|
||||
import com.ruoyi.common.core.domain.entity.MonitorAddressInfo;
|
||||
import com.ruoyi.common.core.domain.entity.TgMessageInfo;
|
||||
import com.ruoyi.common.core.page.TableDataInfo;
|
||||
import com.ruoyi.common.enums.BusinessType;
|
||||
import com.ruoyi.common.utils.DictUtils;
|
||||
|
@ -11,6 +12,7 @@ import com.ruoyi.common.utils.poi.ExcelUtil;
|
|||
import com.ruoyi.system.domain.vo.MonitorAddressInfoVO;
|
||||
import com.ruoyi.system.service.IAccountAddressInfoService;
|
||||
import com.ruoyi.system.service.IMonitorAddressInfoService;
|
||||
import com.ruoyi.system.service.impl.TgMessageInfoServiceImpl;
|
||||
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Controller;
|
||||
|
@ -35,11 +37,16 @@ public class Usdt2TrxMonitorAddressInfoController extends BaseController
|
|||
private IMonitorAddressInfoService monitorAddressInfoService;
|
||||
@Autowired
|
||||
private IAccountAddressInfoService accountAddressInfoService;
|
||||
@Autowired
|
||||
private TgMessageInfoServiceImpl tgMessageInfoService;
|
||||
|
||||
@RequiresPermissions("usdt2Trx:monitor:view")
|
||||
@GetMapping()
|
||||
public String monitor()
|
||||
public String monitor(ModelMap mmap)
|
||||
{
|
||||
TgMessageInfo tgMessageInfo = new TgMessageInfo();
|
||||
tgMessageInfo.setMessageType(5L);
|
||||
mmap.put("topicTgmessageInfoList", tgMessageInfoService.selectTgMessageInfoList(tgMessageInfo));
|
||||
return prefix + "/monitor";
|
||||
}
|
||||
|
||||
|
@ -80,6 +87,9 @@ public class Usdt2TrxMonitorAddressInfoController extends BaseController
|
|||
{
|
||||
String busiType = DictUtils.getDictValue("sys_busi_type", "USDT兑TRX");
|
||||
mmap.put("accountAddressList", accountAddressInfoService.selectAccountAddressInfoAll(busiType));
|
||||
TgMessageInfo tgMessageInfo = new TgMessageInfo();
|
||||
tgMessageInfo.setMessageType(5L);
|
||||
mmap.put("topicTgmessageInfoList", tgMessageInfoService.selectTgMessageInfoList(tgMessageInfo));
|
||||
return prefix + "/add";
|
||||
}
|
||||
|
||||
|
@ -107,6 +117,9 @@ public class Usdt2TrxMonitorAddressInfoController extends BaseController
|
|||
mmap.put("monitorAddressInfo", monitorAddressInfo);
|
||||
String busiType = DictUtils.getDictValue("sys_busi_type", "USDT兑TRX");
|
||||
mmap.put("accountAddressList", accountAddressInfoService.selectAccountAddressInfoAll(busiType));
|
||||
TgMessageInfo tgMessageInfo = new TgMessageInfo();
|
||||
tgMessageInfo.setMessageType(5L);
|
||||
mmap.put("topicTgmessageInfoList", tgMessageInfoService.selectTgMessageInfoList(tgMessageInfo));
|
||||
return prefix + "/edit";
|
||||
}
|
||||
|
||||
|
|
|
@ -3,65 +3,33 @@
|
|||
<head>
|
||||
<th:block th:include="include :: header('新增TG消息管理')" />
|
||||
<th:block th:include="include :: datetimepicker-css" />
|
||||
<th:block th:include="include :: select2-css" />
|
||||
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-msg-add">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">消息内容:</label>
|
||||
<label class="col-sm-3 control-label">消息别名:</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea name="messageInfo" class="form-control" style="height: 100px;"></textarea>
|
||||
<input name="messageAbbrName" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">消息类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<select name="messageType" class="form-control m-b" th:with="type=${@dict.getType('sys_tg_sms_msg_type')}">
|
||||
<select name="messageType" class="form-control m-b" th:with="type=${@dict.getType('sys_tg_sms_msg_type')}" required>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">发送群组:</label>
|
||||
<div class="col-sm-8" th:with="type=${@dict.getType('sys_tg_chat_group_info')}">
|
||||
<!-- <label th:each="dict : ${type}" class="check-box">
|
||||
<input name="chatId" type="checkbox" th:value="${dict.dictValue}" th:text="${dict.dictLabel}">
|
||||
</label>-->
|
||||
<select id="chatId" name="chatId" class="form-control select2-multiple" multiple required>
|
||||
<option th:each="dict : ${type}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">执行策略:</label>
|
||||
<label class="col-sm-3 control-label">消息内容:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="radio-box" th:each="dict : ${@dict.getType('sys_tg_msg_exe_stragy')}">
|
||||
<input type="radio" th:id="${'executionStragy_' + dict.dictCode}" name="executionStragy" th:value="${dict.dictValue}" th:checked="${dict.default}" >
|
||||
<label th:for="${'executionStragy_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">执行周期:</label>
|
||||
<div class="col-sm-8">
|
||||
<span style="color: red">时分秒/H/M/S</span>
|
||||
<input name="intervalTime" class="form-control" placeholder="1H代表1小时执行一次" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">开始时间:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group date">
|
||||
<input name="beginTime" class="form-control" placeholder="yyyy-MM-dd HH:mm:ss" type="text">
|
||||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
||||
</div>
|
||||
<textarea name="messageInfo" class="form-control" style="height: 100px;" required></textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">备注信息:</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea name="remark" class="form-control"></textarea>
|
||||
|
@ -71,7 +39,7 @@
|
|||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<th:block th:include="include :: datetimepicker-js" />
|
||||
<th:block th:include="include :: select2-js" />
|
||||
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "tg/msg"
|
||||
$("#form-msg-add").validate({
|
||||
|
@ -84,11 +52,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
$("input[name='beginTime']").datetimepicker({
|
||||
format: "yyyy-mm-dd hh:ii:ss",
|
||||
// minView: "month",
|
||||
autoclose: true
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
|
|
@ -3,18 +3,19 @@
|
|||
<head>
|
||||
<th:block th:include="include :: header('修改TG消息管理')" />
|
||||
<th:block th:include="include :: datetimepicker-css" />
|
||||
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-msg-edit" th:object="${tgMessageInfo}">
|
||||
<input name="idTgMessageInfo" th:field="*{idTgMessageInfo}" type="hidden">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">消息内容:</label>
|
||||
<label class="col-sm-3 control-label">消息别名:</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea name="messageInfo" class="form-control">[[*{messageInfo}]]</textarea>
|
||||
<input name="messageAbbrName" th:field="*{messageAbbrName}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">消息类型:</label>
|
||||
<div class="col-sm-8">
|
||||
<select name="messageType" class="form-control m-b" th:with="type=${@dict.getType('sys_tg_sms_msg_type')}">
|
||||
|
@ -22,54 +23,13 @@
|
|||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">tg会话id:</label>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">消息内容:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="chatId" th:field="*{chatId}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">执行周期:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="interval" th:field="*{interval}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">开始时间:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group date">
|
||||
<input name="beginTime" th:value="${#dates.format(tgMessageInfo.beginTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
||||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">下次执行时间:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group date">
|
||||
<input name="nextRunTime" th:value="${#dates.format(tgMessageInfo.nextRunTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
||||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">执行策略:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="radio-box" th:each="dict : ${@dict.getType('sys_tg_msg_exe_stragy')}">
|
||||
<input type="radio" th:id="${'executionStragy_' + dict.dictCode}" name="executionStragy" th:value="${dict.dictValue}" th:field="*{executionStragy}">
|
||||
<label th:for="${'executionStragy_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">任务状态:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="radio-box" th:each="dict : ${@dict.getType('sys_tg_sms_msg_status')}">
|
||||
<input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}">
|
||||
<label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||||
</div>
|
||||
<textarea name="messageInfo" class="form-control" style="height: 100px;" required>[[*{messageInfo}]]</textarea>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">备注信息:</label>
|
||||
<div class="col-sm-8">
|
||||
|
@ -80,6 +40,7 @@
|
|||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<th:block th:include="include :: datetimepicker-js" />
|
||||
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "tg/msg";
|
||||
$("#form-msg-edit").validate({
|
||||
|
@ -92,17 +53,6 @@
|
|||
}
|
||||
}
|
||||
|
||||
$("input[name='beginTime']").datetimepicker({
|
||||
format: "yyyy-mm-dd",
|
||||
minView: "month",
|
||||
autoclose: true
|
||||
});
|
||||
|
||||
$("input[name='nextRunTime']").datetimepicker({
|
||||
format: "yyyy-mm-dd",
|
||||
minView: "month",
|
||||
autoclose: true
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -17,13 +17,13 @@
|
|||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</li>
|
||||
<li>
|
||||
<!-- <li>
|
||||
<label>任务状态:</label>
|
||||
<select name="status" th:with="type=${@dict.getType('sys_tg_sms_msg_status')}">
|
||||
<option value="">所有</option>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</li>
|
||||
</li>-->
|
||||
<li class="select-time">
|
||||
<label>创建时间:</label>
|
||||
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginCreateTime]"/>
|
||||
|
@ -63,9 +63,9 @@
|
|||
var editFlag = [[${@permission.hasPermi('tg:msg:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('tg:msg:remove')}]];
|
||||
var messageTypeDatas = [[${@dict.getType('sys_tg_sms_msg_type')}]];
|
||||
var chatIdDatas = [[${@dict.getType('sys_tg_chat_group_info')}]];
|
||||
/* var chatIdDatas = [[${@dict.getType('sys_tg_chat_group_info')}]];
|
||||
var executionStragyDatas = [[${@dict.getType('sys_tg_msg_exe_stragy')}]];
|
||||
var statusDatas = [[${@dict.getType('sys_tg_sms_msg_status')}]];
|
||||
var statusDatas = [[${@dict.getType('sys_tg_sms_msg_status')}]];*/
|
||||
var prefix = ctx + "tg/msg";
|
||||
|
||||
$(function() {
|
||||
|
@ -83,10 +83,28 @@
|
|||
field: 'idTgMessageInfo',
|
||||
title: '主键',
|
||||
visible: false
|
||||
}, {
|
||||
field: 'messageAbbrName',
|
||||
title: '消息别名'
|
||||
},
|
||||
{
|
||||
field: 'messageInfo',
|
||||
title: '消息内容'
|
||||
title: '消息内容',
|
||||
formatter: function(value, row, index) {
|
||||
// 截取前10个字符
|
||||
let shortMessage = value.length > 10 ? value.substring(0, 10) + '...' : value;
|
||||
|
||||
return shortMessage;
|
||||
/* // 添加超链接
|
||||
// 使用JSON.stringify来转义消息内容
|
||||
let escapedValue = JSON.stringify(value);
|
||||
|
||||
// 去掉字符串开头和结尾的引号
|
||||
escapedValue = escapedValue.slice(1, -1);
|
||||
|
||||
// 添加超链接,并在点击时调用$.modal.msg()
|
||||
return `<a href="javascript:void(0)" onclick="$.modal.msg('${escapedValue}')">${shortMessage}</a>`;*/
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'messageType',
|
||||
|
@ -96,42 +114,28 @@
|
|||
}
|
||||
},
|
||||
{
|
||||
field: 'chatId',
|
||||
title: 'tg会话id',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabels(chatIdDatas, value);
|
||||
}
|
||||
field: 'remark',
|
||||
title: '备注信息'
|
||||
},
|
||||
{
|
||||
field: 'intervalTime',
|
||||
title: '执行周期'
|
||||
},
|
||||
{
|
||||
field: 'beginTime',
|
||||
title: '开始时间'
|
||||
},
|
||||
{
|
||||
field: 'nextRunTime',
|
||||
title: '下次执行时间',
|
||||
field: 'createBy',
|
||||
title: '创建者',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'executionStragy',
|
||||
title: '执行策略',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(executionStragyDatas, value);
|
||||
}
|
||||
field: 'createTime',
|
||||
title: '创建时间',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '任务状态',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(statusDatas, value);
|
||||
}
|
||||
field: 'updateBy',
|
||||
title: '更新者',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'remark',
|
||||
title: '备注信息'
|
||||
field: 'updateTime',
|
||||
title: '更新时间',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
|
@ -146,6 +150,8 @@
|
|||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,84 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<head>
|
||||
<th:block th:include="include :: header('新增TG消息任务管理')" />
|
||||
<th:block th:include="include :: datetimepicker-css" />
|
||||
<th:block th:include="include :: select2-css" />
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-task-add">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label is-required">消息模版:</label>
|
||||
<div class="col-sm-8">
|
||||
<select id="idTgMessageInfo" name="idTgMessageInfo" class="form-control " >
|
||||
<option th:each="topicTgmessageInfo:${topicTgmessageInfoList}" th:value="${topicTgmessageInfo.idTgMessageInfo}" th:text="${topicTgmessageInfo.messageAbbrName}" ></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">发送群组:</label>
|
||||
<div class="col-sm-8" th:with="type=${@dict.getType('sys_tg_chat_group_info')}">
|
||||
|
||||
<select id="chatIds" name="chatIds" class="form-control select2-multiple" multiple required>
|
||||
<option th:each="dict : ${type}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">执行策略:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="radio-box" th:each="dict : ${@dict.getType('sys_tg_msg_exe_stragy')}">
|
||||
<input type="radio" th:id="${'executionStragy_' + dict.dictCode}" name="executionStragy" th:value="${dict.dictValue}" th:checked="${dict.default}" required>
|
||||
<label th:for="${'executionStragy_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">执行周期:</label>
|
||||
<div class="col-sm-8">
|
||||
<span style="color: red">时分秒/H/M/S</span>
|
||||
<input name="intervalTime" class="form-control" placeholder="1H代表1小时执行一次" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">开始时间:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group date">
|
||||
<input name="beginTime" class="form-control" placeholder="yyyy-MM-dd HH:mm:ss" type="text" required>
|
||||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">备注信息:</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea name="remark" class="form-control"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<th:block th:include="include :: datetimepicker-js" />
|
||||
<th:block th:include="include :: select2-js" />
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "tg/task"
|
||||
$("#form-task-add").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/add", $('#form-task-add').serialize());
|
||||
}
|
||||
}
|
||||
|
||||
$("input[name='beginTime']").datetimepicker({
|
||||
format: "yyyy-mm-dd hh:ii:ss",
|
||||
// minView: "month",
|
||||
autoclose: true
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,93 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
|
||||
<head>
|
||||
<th:block th:include="include :: header('修改TG消息任务管理')" />
|
||||
<th:block th:include="include :: datetimepicker-css" />
|
||||
<th:block th:include="include :: select2-css" />
|
||||
</head>
|
||||
<body class="white-bg">
|
||||
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
|
||||
<form class="form-horizontal m" id="form-task-edit" th:object="${tgMessageTask}">
|
||||
<input name="idTgMessageTask" th:field="*{idTgMessageTask}" type="hidden">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label ">消息模版:</label>
|
||||
<div class="col-sm-8">
|
||||
<select id="idTgMessageInfo" name="idTgMessageInfo" class="form-control " >
|
||||
<option th:each="topicTgmessageInfo:${topicTgmessageInfoList}" th:value="${topicTgmessageInfo.idTgMessageInfo}" th:text="${topicTgmessageInfo.messageAbbrName}" th:field="*{idTgMessageInfo}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">发送群组:</label>
|
||||
<div class="col-sm-8" th:with="type=${@dict.getType('sys_tg_chat_group_info')}">
|
||||
<select id="chatIds" name="chatIds" class="form-control select2-multiple" multiple required>
|
||||
<option th:each="dict : ${type}" th:value="${dict.dictValue}" th:text="${dict.dictLabel}" th:selected="*{chatIds}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">执行周期:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="interval" th:field="*{intervalTime}" class="form-control" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">开始时间:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="input-group date">
|
||||
<input name="beginTime" th:value="${#dates.format(tgMessageTask.beginTime, 'yyyy-MM-dd HH:mm:ss')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
|
||||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">执行策略:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="radio-box" th:each="dict : ${@dict.getType('sys_tg_msg_exe_stragy')}">
|
||||
<input type="radio" th:id="${'executionStragy_' + dict.dictCode}" name="executionStragy" th:value="${dict.dictValue}" th:field="*{executionStragy}">
|
||||
<label th:for="${'executionStragy_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">任务状态:</label>
|
||||
<div class="col-sm-8">
|
||||
<div class="radio-box" th:each="dict : ${@dict.getType('sys_tg_sms_msg_status')}">
|
||||
<input type="radio" th:id="${'status_' + dict.dictCode}" name="status" th:value="${dict.dictValue}" th:field="*{status}">
|
||||
<label th:for="${'status_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">备注信息:</label>
|
||||
<div class="col-sm-8">
|
||||
<textarea name="remark" class="form-control">[[*{remark}]]</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<th:block th:include="include :: datetimepicker-js" />
|
||||
<th:block th:include="include :: select2-js" />
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "tg/task";
|
||||
$("#form-task-edit").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
$.operate.save(prefix + "/edit", $('#form-task-edit').serialize());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
$("input[name='beginTime']").datetimepicker({
|
||||
format: "yyyy-mm-dd hh:ii:ss",
|
||||
// minView: "month",
|
||||
autoclose: true
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -0,0 +1,161 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
|
||||
<head>
|
||||
<th:block th:include="include :: header('TG消息任务管理列表')" />
|
||||
</head>
|
||||
<body class="gray-bg">
|
||||
<div class="container-div">
|
||||
<div class="row">
|
||||
<div class="col-sm-12 search-collapse">
|
||||
<form id="formId">
|
||||
<div class="select-list">
|
||||
<ul>
|
||||
<li>
|
||||
<label>tg会话id:</label>
|
||||
<input type="text" name="chatIds"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>执行周期:</label>
|
||||
<input type="text" name="intervalTime"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>开始时间:</label>
|
||||
<input type="text" class="time-input" placeholder="请选择开始时间" name="beginTime"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>下次执行时间:</label>
|
||||
<input type="text" class="time-input" placeholder="请选择下次执行时间" name="nextRunTime"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>执行策略:</label>
|
||||
<input type="text" name="executionStragy"/>
|
||||
</li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
<div class="btn-group-sm" id="toolbar" role="group">
|
||||
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="tg:task:add">
|
||||
<i class="fa fa-plus"></i> 添加
|
||||
</a>
|
||||
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="tg:task:edit">
|
||||
<i class="fa fa-edit"></i> 修改
|
||||
</a>
|
||||
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="tg:task:remove">
|
||||
<i class="fa fa-remove"></i> 删除
|
||||
</a>
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="tg:task:export">
|
||||
<i class="fa fa-download"></i> 导出
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
var editFlag = [[${@permission.hasPermi('tg:task:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('tg:task:remove')}]];
|
||||
var chatIdsDatas = [[${@dict.getType('sys_tg_chat_group_info')}]];
|
||||
var executionStragyDatas = [[${@dict.getType('sys_tg_msg_exe_stragy')}]];
|
||||
var statusDatas = [[${@dict.getType('sys_tg_sms_msg_status')}]];
|
||||
var topicTgmessageInfoList = [[${topicTgmessageInfoList}]];
|
||||
var prefix = ctx + "tg/task";
|
||||
console.log(topicTgmessageInfoList);
|
||||
$(function() {
|
||||
var options = {
|
||||
url: prefix + "/list",
|
||||
createUrl: prefix + "/add",
|
||||
updateUrl: prefix + "/edit/{id}",
|
||||
removeUrl: prefix + "/remove",
|
||||
exportUrl: prefix + "/export",
|
||||
modalName: "TG消息任务管理",
|
||||
columns: [{
|
||||
checkbox: true
|
||||
},
|
||||
{
|
||||
field: 'idTgMessageTask',
|
||||
title: '主键',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'idTgMessageInfo',
|
||||
title: '消息模版',
|
||||
formatter: function(value, row, index) {
|
||||
if ($.common.isEmpty(topicTgmessageInfoList) || $.common.isEmpty(value)) {
|
||||
return '';
|
||||
}
|
||||
var actions = [];
|
||||
$.each(topicTgmessageInfoList, function(index, dict) {
|
||||
if (dict.idTgMessageInfo == ('' + value)) {
|
||||
var listClass = $.common.equals("default", dict.listClass) || $.common.isEmpty(dict.listClass) ? "" : "badge badge-" + dict.listClass;
|
||||
var cssClass = $.common.isNotEmpty(dict.cssClass) ? dict.cssClass : listClass;
|
||||
actions.push($.common.sprintf("<span class='%s'>%s</span>", cssClass, dict.messageAbbrName));
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (actions.length === 0) {
|
||||
actions.push($.common.sprintf("<span>%s</span>", value))
|
||||
}
|
||||
return actions.join('');
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'chatIds',
|
||||
title: '发送群组',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabels(chatIdsDatas, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'intervalTime',
|
||||
title: '执行周期'
|
||||
},
|
||||
{
|
||||
field: 'beginTime',
|
||||
title: '开始时间'
|
||||
},
|
||||
{
|
||||
field: 'nextRunTime',
|
||||
title: '下次执行时间'
|
||||
},
|
||||
{
|
||||
field: 'executionStragy',
|
||||
title: '执行策略',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(executionStragyDatas, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'status',
|
||||
title: '任务状态',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(statusDatas, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'remark',
|
||||
title: '备注信息'
|
||||
},
|
||||
{
|
||||
title: '操作',
|
||||
align: 'center',
|
||||
formatter: function(value, row, index) {
|
||||
var actions = [];
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.idTgMessageTask + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.idTgMessageTask + '\')"><i class="fa fa-remove"></i>删除</a>');
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
|
@ -59,13 +59,30 @@
|
|||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">通知消息模版:</label>
|
||||
<div class="col-sm-8">
|
||||
<select id="idTgMessageInfo" name="idTgMessageInfo" class="form-control " >
|
||||
<option th:each="topicTgmessageInfo:${topicTgmessageInfoList}" th:value="${topicTgmessageInfo.idTgMessageInfo}" th:text="${topicTgmessageInfo.messageAbbrName}" ></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">绑定群组:</label>
|
||||
<div class="col-sm-8">
|
||||
<select name="groupChatId" class="form-control m-b" th:with="type=${@dict.getType('sys_tg_chat_group_info')}">
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="form-group">
|
||||
<label class="col-sm-3 control-label">API_KEY:</label>
|
||||
<div class="col-sm-8">
|
||||
<select name="apiKey" class="form-control m-b" th:with="type=${@dict.getType('sys_tron_api_key')}">
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">备注:</label>
|
||||
<div class="col-sm-8">
|
||||
|
|
|
@ -63,13 +63,30 @@
|
|||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">通知消息模版:</label>
|
||||
<div class="col-sm-8">
|
||||
<select id="idTgMessageInfo" name="idTgMessageInfo" class="form-control " >
|
||||
<option th:each="topicTgmessageInfo:${topicTgmessageInfoList}" th:value="${topicTgmessageInfo.idTgMessageInfo}" th:text="${topicTgmessageInfo.messageAbbrName}" th:field="*{idTgMessageInfo}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">绑定群组:</label>
|
||||
<div class="col-sm-8">
|
||||
<select name="groupChatId" class="form-control m-b" th:with="type=${@dict.getType('sys_tg_chat_group_info')}">
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{groupChatId}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class="form-group">
|
||||
<label class="col-sm-3 control-label">API_KEY:</label>
|
||||
<div class="col-sm-8">
|
||||
<select name="apiKey" class="form-control m-b" th:with="type=${@dict.getType('sys_tron_api_key')}">
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{apiKey}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>-->
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">备注:</label>
|
||||
<div class="col-sm-8">
|
||||
|
|
|
@ -85,9 +85,10 @@
|
|||
var removeFlag = [[${@permission.hasPermi('trx2Energy:monitor:remove')}]];
|
||||
var prefix = ctx + "trx2Energy/monitor";
|
||||
var datas = [[${@dict.getType('sys_yes_no')}]];
|
||||
var apiKeyDatas = [[${@dict.getType('sys_tron_api_key')}]];
|
||||
var busiTypeDatas = [[${@dict.getType('sys_busi_type')}]];
|
||||
var bindPeriodDatas = [[${@dict.getType('sys_lock_period')}]];
|
||||
var groupChatIdDatas = [[${@dict.getType('sys_tg_chat_group_info')}]];
|
||||
var topicTgmessageInfoList = [[${topicTgmessageInfoList}]];
|
||||
$(function () {
|
||||
var options = {
|
||||
url: prefix + "/list",
|
||||
|
@ -164,13 +165,7 @@
|
|||
},
|
||||
},
|
||||
|
||||
{
|
||||
field: 'apiKey',
|
||||
title: 'API_KEY',
|
||||
formatter: function (value, row, index) {
|
||||
return $.table.selectDictLabel(apiKeyDatas, value);
|
||||
}
|
||||
}, {
|
||||
{
|
||||
field: 'bindPeriod',
|
||||
title: '绑定时长',
|
||||
formatter: function (value, row, index) {
|
||||
|
@ -183,6 +178,34 @@
|
|||
formatter: function (value, item, index) {
|
||||
return $.table.selectDictLabel(datas, item.isValid);
|
||||
}
|
||||
},{
|
||||
field: 'idTgMessageInfo',
|
||||
title: '通知消息模版',
|
||||
formatter: function(value, row, index) {
|
||||
if ($.common.isEmpty(topicTgmessageInfoList) || $.common.isEmpty(value)) {
|
||||
return '';
|
||||
}
|
||||
var actions = [];
|
||||
$.each(topicTgmessageInfoList, function(index, dict) {
|
||||
if (dict.idTgMessageInfo == ('' + value)) {
|
||||
var listClass = $.common.equals("default", dict.listClass) || $.common.isEmpty(dict.listClass) ? "" : "badge badge-" + dict.listClass;
|
||||
var cssClass = $.common.isNotEmpty(dict.cssClass) ? dict.cssClass : listClass;
|
||||
actions.push($.common.sprintf("<span class='%s'>%s</span>", cssClass, dict.messageAbbrName));
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (actions.length === 0) {
|
||||
actions.push($.common.sprintf("<span>%s</span>", value))
|
||||
}
|
||||
return actions.join('');
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'groupChatId',
|
||||
title: '绑定群组',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(groupChatIdDatas, value);
|
||||
}
|
||||
}, {
|
||||
field: 'comment',
|
||||
title: '备注'
|
||||
|
|
|
@ -37,15 +37,24 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">API_KEY:</label>
|
||||
<label class="col-sm-3 control-label">通知消息模版:</label>
|
||||
<div class="col-sm-8">
|
||||
<select name="apiKey" class="form-control m-b" th:with="type=${@dict.getType('sys_tron_api_key')}">
|
||||
<select id="idTgMessageInfo" name="idTgMessageInfo" class="form-control " >
|
||||
<option th:each="topicTgmessageInfo:${topicTgmessageInfoList}" th:value="${topicTgmessageInfo.idTgMessageInfo}" th:text="${topicTgmessageInfo.messageAbbrName}" ></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">绑定群组:</label>
|
||||
<div class="col-sm-8">
|
||||
<select name="groupChatId" class="form-control m-b" th:with="type=${@dict.getType('sys_tg_chat_group_info')}">
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">备注:</label>
|
||||
<div class="col-sm-8">
|
||||
|
|
|
@ -49,10 +49,18 @@
|
|||
|
||||
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">API_KEY:</label>
|
||||
<label class="col-sm-3 control-label">通知消息模版:</label>
|
||||
<div class="col-sm-8">
|
||||
<select name="apiKey" class="form-control m-b" th:with="type=${@dict.getType('sys_tron_api_key')}">
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{apiKey}"></option>
|
||||
<select id="idTgMessageInfo" name="idTgMessageInfo" class="form-control " >
|
||||
<option th:each="topicTgmessageInfo:${topicTgmessageInfoList}" th:value="${topicTgmessageInfo.idTgMessageInfo}" th:text="${topicTgmessageInfo.messageAbbrName}" th:field="*{idTgMessageInfo}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="col-sm-3 control-label">绑定群组:</label>
|
||||
<div class="col-sm-8">
|
||||
<select name="groupChatId" class="form-control m-b" th:with="type=${@dict.getType('sys_tg_chat_group_info')}">
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{groupChatId}"></option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
@ -76,9 +76,9 @@
|
|||
var removeFlag = [[${@permission.hasPermi('usdt2Trx:monitor:remove')}]];
|
||||
var prefix = ctx + "usdt2Trx/monitor";
|
||||
var datas = [[${@dict.getType('sys_yes_no')}]];
|
||||
var bindPeriodDatas = [[${@dict.getType('sys_lock_period')}]];
|
||||
var apiKeyDatas = [[${@dict.getType('sys_tron_api_key')}]];
|
||||
var busiTypeDatas = [[${@dict.getType('sys_busi_type')}]];
|
||||
var groupChatIdDatas = [[${@dict.getType('sys_tg_chat_group_info')}]];
|
||||
var topicTgmessageInfoList = [[${topicTgmessageInfoList}]];
|
||||
$(function() {
|
||||
var options = {
|
||||
url: prefix + "/list",
|
||||
|
@ -133,14 +133,6 @@
|
|||
return "<a href='https://www.oklink.com/zh-hans/trx/address/" + value + "' target='_blank'>" + value + "</a>";
|
||||
}
|
||||
},
|
||||
|
||||
{
|
||||
field: 'apiKey',
|
||||
title: 'API_KEY',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(apiKeyDatas, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'isValid',
|
||||
title: '是否有效',
|
||||
|
@ -148,6 +140,34 @@
|
|||
return $.table.selectDictLabel(datas, item.isValid);
|
||||
}
|
||||
},{
|
||||
field: 'idTgMessageInfo',
|
||||
title: '通知消息模版',
|
||||
formatter: function(value, row, index) {
|
||||
if ($.common.isEmpty(topicTgmessageInfoList) || $.common.isEmpty(value)) {
|
||||
return '';
|
||||
}
|
||||
var actions = [];
|
||||
$.each(topicTgmessageInfoList, function(index, dict) {
|
||||
if (dict.idTgMessageInfo == ('' + value)) {
|
||||
var listClass = $.common.equals("default", dict.listClass) || $.common.isEmpty(dict.listClass) ? "" : "badge badge-" + dict.listClass;
|
||||
var cssClass = $.common.isNotEmpty(dict.cssClass) ? dict.cssClass : listClass;
|
||||
actions.push($.common.sprintf("<span class='%s'>%s</span>", cssClass, dict.messageAbbrName));
|
||||
return false;
|
||||
}
|
||||
});
|
||||
if (actions.length === 0) {
|
||||
actions.push($.common.sprintf("<span>%s</span>", value))
|
||||
}
|
||||
return actions.join('');
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'groupChatId',
|
||||
title: '绑定群组',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(groupChatIdDatas, value);
|
||||
}
|
||||
},{
|
||||
field: 'comment',
|
||||
title: '备注'
|
||||
},
|
||||
|
|
|
@ -53,9 +53,16 @@ public class MonitorAddressInfo extends BaseEntity
|
|||
@Excel(name = "trx或者usdt")
|
||||
private String monitorType;
|
||||
|
||||
/** API_KEY */
|
||||
/* *//** API_KEY *//*
|
||||
@Excel(name = "API_KEY")
|
||||
private String apiKey;
|
||||
private String apiKey;*/
|
||||
/** 消息模版 */
|
||||
@Excel(name = "消息模版")
|
||||
private String idTgMessageInfo;
|
||||
|
||||
/** 绑定群组 */
|
||||
@Excel(name = "绑定群组")
|
||||
private String groupChatId;
|
||||
|
||||
/** 是否有效 */
|
||||
@Excel(name = "是否有效")
|
||||
|
|
|
@ -1,13 +1,10 @@
|
|||
package com.ruoyi.common.core.domain.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* TG消息管理对象 tg_message_info
|
||||
*
|
||||
|
@ -29,31 +26,19 @@ public class TgMessageInfo extends BaseEntity
|
|||
@Excel(name = "消息类型")
|
||||
private Long messageType;
|
||||
|
||||
/** tg会话id */
|
||||
@Excel(name = "tg会话id")
|
||||
private String chatId;
|
||||
|
||||
/** 执行周期 */
|
||||
@Excel(name = "执行周期")
|
||||
private String intervalTime;
|
||||
@Excel(name = "消息别名")
|
||||
private String messageAbbrName;
|
||||
|
||||
/** 开始时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date beginTime;
|
||||
|
||||
/** 下次执行时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@Excel(name = "下次执行时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||
private Date nextRunTime;
|
||||
|
||||
/** 执行策略 */
|
||||
@Excel(name = "执行策略")
|
||||
private Long executionStragy;
|
||||
public String getMessageAbbrName() {
|
||||
return messageAbbrName;
|
||||
}
|
||||
|
||||
/** 任务状态 */
|
||||
@Excel(name = "任务状态")
|
||||
private Long status;
|
||||
public void setMessageAbbrName(String messageAbbrName) {
|
||||
this.messageAbbrName = messageAbbrName;
|
||||
}
|
||||
|
||||
public void setIdTgMessageInfo(Long idTgMessageInfo)
|
||||
{
|
||||
|
@ -82,60 +67,6 @@ public class TgMessageInfo extends BaseEntity
|
|||
{
|
||||
return messageType;
|
||||
}
|
||||
public void setChatId(String chatId)
|
||||
{
|
||||
this.chatId = chatId;
|
||||
}
|
||||
|
||||
public String getChatId()
|
||||
{
|
||||
return chatId;
|
||||
}
|
||||
|
||||
public String getIntervalTime() {
|
||||
return intervalTime;
|
||||
}
|
||||
|
||||
public void setIntervalTime(String intervalTime) {
|
||||
this.intervalTime = intervalTime;
|
||||
}
|
||||
|
||||
public void setBeginTime(Date beginTime)
|
||||
{
|
||||
this.beginTime = beginTime;
|
||||
}
|
||||
|
||||
public Date getBeginTime()
|
||||
{
|
||||
return beginTime;
|
||||
}
|
||||
public void setNextRunTime(Date nextRunTime)
|
||||
{
|
||||
this.nextRunTime = nextRunTime;
|
||||
}
|
||||
|
||||
public Date getNextRunTime()
|
||||
{
|
||||
return nextRunTime;
|
||||
}
|
||||
public void setExecutionStragy(Long executionStragy)
|
||||
{
|
||||
this.executionStragy = executionStragy;
|
||||
}
|
||||
|
||||
public Long getExecutionStragy()
|
||||
{
|
||||
return executionStragy;
|
||||
}
|
||||
public void setStatus(Long status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Long getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
@ -143,12 +74,6 @@ public class TgMessageInfo extends BaseEntity
|
|||
.append("idTgMessageInfo", getIdTgMessageInfo())
|
||||
.append("messageInfo", getMessageInfo())
|
||||
.append("messageType", getMessageType())
|
||||
.append("chatId", getChatId())
|
||||
.append("interval", getIntervalTime())
|
||||
.append("beginTime", getBeginTime())
|
||||
.append("nextRunTime", getNextRunTime())
|
||||
.append("executionStragy", getExecutionStragy())
|
||||
.append("status", getStatus())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
|
|
|
@ -0,0 +1,145 @@
|
|||
package com.ruoyi.common.core.domain.entity;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.ruoyi.common.annotation.Excel;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* TG消息任务管理对象 tg_message_task
|
||||
*
|
||||
* @author dorion
|
||||
* @date 2024-07-14
|
||||
*/
|
||||
public class TgMessageTask extends BaseEntity
|
||||
{
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/** 主键 */
|
||||
private Long idTgMessageTask;
|
||||
|
||||
/** 消息信息 */
|
||||
@Excel(name = "消息信息")
|
||||
private Long idTgMessageInfo;
|
||||
|
||||
/** tg会话id */
|
||||
@Excel(name = "tg会话id")
|
||||
private String chatIds;
|
||||
|
||||
/** 执行周期 */
|
||||
@Excel(name = "执行周期")
|
||||
private String intervalTime;
|
||||
|
||||
/** 开始时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "开始时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date beginTime;
|
||||
|
||||
/** 下次执行时间 */
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Excel(name = "下次执行时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||
private Date nextRunTime;
|
||||
|
||||
/** 执行策略 */
|
||||
@Excel(name = "执行策略")
|
||||
private Long executionStragy;
|
||||
|
||||
/** 任务状态 */
|
||||
@Excel(name = "任务状态")
|
||||
private Long status;
|
||||
|
||||
public void setIdTgMessageTask(Long idTgMessageTask)
|
||||
{
|
||||
this.idTgMessageTask = idTgMessageTask;
|
||||
}
|
||||
|
||||
public Long getIdTgMessageTask()
|
||||
{
|
||||
return idTgMessageTask;
|
||||
}
|
||||
public void setIdTgMessageInfo(Long idTgMessageInfo)
|
||||
{
|
||||
this.idTgMessageInfo = idTgMessageInfo;
|
||||
}
|
||||
|
||||
public Long getIdTgMessageInfo()
|
||||
{
|
||||
return idTgMessageInfo;
|
||||
}
|
||||
public void setChatIds(String chatIds)
|
||||
{
|
||||
this.chatIds = chatIds;
|
||||
}
|
||||
|
||||
public String getChatIds()
|
||||
{
|
||||
return chatIds;
|
||||
}
|
||||
public void setIntervalTime(String intervalTime)
|
||||
{
|
||||
this.intervalTime = intervalTime;
|
||||
}
|
||||
|
||||
public String getIntervalTime()
|
||||
{
|
||||
return intervalTime;
|
||||
}
|
||||
public void setBeginTime(Date beginTime)
|
||||
{
|
||||
this.beginTime = beginTime;
|
||||
}
|
||||
|
||||
public Date getBeginTime()
|
||||
{
|
||||
return beginTime;
|
||||
}
|
||||
public void setNextRunTime(Date nextRunTime)
|
||||
{
|
||||
this.nextRunTime = nextRunTime;
|
||||
}
|
||||
|
||||
public Date getNextRunTime()
|
||||
{
|
||||
return nextRunTime;
|
||||
}
|
||||
public void setExecutionStragy(Long executionStragy)
|
||||
{
|
||||
this.executionStragy = executionStragy;
|
||||
}
|
||||
|
||||
public Long getExecutionStragy()
|
||||
{
|
||||
return executionStragy;
|
||||
}
|
||||
public void setStatus(Long status)
|
||||
{
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Long getStatus()
|
||||
{
|
||||
return status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
.append("idTgMessageTask", getIdTgMessageTask())
|
||||
.append("idTgMessageInfo", getIdTgMessageInfo())
|
||||
.append("chatIds", getChatIds())
|
||||
.append("intervalTime", getIntervalTime())
|
||||
.append("beginTime", getBeginTime())
|
||||
.append("nextRunTime", getNextRunTime())
|
||||
.append("executionStragy", getExecutionStragy())
|
||||
.append("status", getStatus())
|
||||
.append("createBy", getCreateBy())
|
||||
.append("createTime", getCreateTime())
|
||||
.append("updateBy", getUpdateBy())
|
||||
.append("updateTime", getUpdateTime())
|
||||
.append("remark", getRemark())
|
||||
.toString();
|
||||
}
|
||||
}
|
|
@ -1,5 +1,6 @@
|
|||
package com.ruoyi.quartz.task;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.ruoyi.common.core.domain.entity.SmsTaskTbl;
|
||||
import com.ruoyi.system.handler.GetSmsDetailTaskHandler;
|
||||
import com.ruoyi.system.mapper.SmsTaskTblMapper;
|
||||
|
|
|
@ -0,0 +1,134 @@
|
|||
package com.ruoyi.quartz.task;
|
||||
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.ruoyi.common.core.domain.entity.TgMessageTask;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.system.bot.TgLongPollingBot;
|
||||
import com.ruoyi.system.bot.utils.SendContent;
|
||||
import com.ruoyi.system.domain.TgMessageInfoTask;
|
||||
import com.ruoyi.system.handler.TRX2EneryTransferHandler;
|
||||
import com.ruoyi.system.handler.Usdt2TrxTransferHandler;
|
||||
import com.ruoyi.system.mapper.TgMessageTaskMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.telegram.telegrambots.meta.api.methods.ParseMode;
|
||||
import org.telegram.telegrambots.meta.api.methods.send.SendMessage;
|
||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
|
||||
@Component("groupTopicMessageTask")
|
||||
public class GroupTopicMessageTask {
|
||||
@Autowired
|
||||
private Usdt2TrxTransferHandler usdt2TrxTransferHandler;
|
||||
@Autowired
|
||||
private TRX2EneryTransferHandler trx2EneryTransferHandler;
|
||||
|
||||
@Autowired
|
||||
private TgMessageTaskMapper tgMessageTaskMapper;
|
||||
|
||||
@Autowired(required = false)
|
||||
private TgLongPollingBot longPollingBot;
|
||||
@Autowired
|
||||
private SendContent sendContent;
|
||||
|
||||
public void doGroupTopicMessageTask() {
|
||||
|
||||
TgMessageTask tgMessageTask = new TgMessageTask();
|
||||
tgMessageTask.setStatus(1L);
|
||||
tgMessageTask.setNextRunTime(DateUtils.getNowDate());
|
||||
List<TgMessageInfoTask> tgMessageInfoTaskList = tgMessageTaskMapper.selectTgMessageTaskAndInfoList(tgMessageTask);
|
||||
|
||||
List<CompletableFuture> completableFutureList = new ArrayList<>();
|
||||
|
||||
for (TgMessageInfoTask tgMessageInfoTask : tgMessageInfoTaskList) {
|
||||
|
||||
CompletableFuture<Void> completableFuture = CompletableFuture.runAsync(() -> {
|
||||
try {
|
||||
doSendTgMessageInfo(tgMessageInfoTask);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
}).exceptionally(e -> {
|
||||
throw new RuntimeException("广播TG消息异常", e);
|
||||
});
|
||||
completableFutureList.add(completableFuture);
|
||||
}
|
||||
|
||||
CompletableFuture.allOf(completableFutureList.stream().toArray(CompletableFuture[]::new)).join();
|
||||
}
|
||||
|
||||
private void doSendTgMessageInfo(TgMessageInfoTask tgMessageInfoTask) throws TelegramApiException, NoSuchAlgorithmException, IOException, InvalidKeyException {
|
||||
Integer executionStragy = tgMessageInfoTask.getExecutionStragy();
|
||||
Integer messageType = tgMessageInfoTask.getMessageType();
|
||||
TgMessageTask tgMessageTask = new TgMessageTask();
|
||||
tgMessageTask.setIdTgMessageTask(tgMessageInfoTask.getIdTgMessageTask());
|
||||
if (0 == executionStragy) {
|
||||
//周期执行
|
||||
doSendTgMessageInfo(tgMessageInfoTask, messageType);
|
||||
|
||||
DateTime nextRuntime = getNextRuntime(tgMessageInfoTask);
|
||||
tgMessageTask.setNextRunTime(nextRuntime);
|
||||
} else {
|
||||
//执行一次的
|
||||
// sendCommonTgMessage(tgMessageInfoTask);
|
||||
doSendTgMessageInfo(tgMessageInfoTask, messageType);
|
||||
tgMessageTask.setStatus(3L);
|
||||
}
|
||||
tgMessageTaskMapper.updateTgMessageTask(tgMessageTask);
|
||||
}
|
||||
|
||||
private void doSendTgMessageInfo(TgMessageInfoTask tgMessageInfoTask, Integer messageType) throws TelegramApiException, NoSuchAlgorithmException, IOException, InvalidKeyException {
|
||||
if (1 == messageType) {
|
||||
//trx兑换消息
|
||||
trx2EneryTransferHandler.topicGroupMessage(tgMessageInfoTask);
|
||||
} else if (2 == messageType) {
|
||||
//usdt兑换消息
|
||||
usdt2TrxTransferHandler.topicGroupMessage(tgMessageInfoTask);
|
||||
} else {
|
||||
//普通消息
|
||||
sendCommonTgMessage(tgMessageInfoTask);
|
||||
}
|
||||
}
|
||||
|
||||
private DateTime getNextRuntime(TgMessageInfoTask tgMessageInfoTask) {
|
||||
String intervalTime = tgMessageInfoTask.getIntervalTime();
|
||||
int length = intervalTime.length();
|
||||
String intervalTimeNumber = intervalTime.substring(0, length - 1);
|
||||
String intervalTimeUnit = intervalTime.substring(length - 1, length);
|
||||
DateField dateField = null;
|
||||
if ("h".equalsIgnoreCase(intervalTimeUnit)) {
|
||||
dateField = DateField.HOUR;
|
||||
}else if ("m".equalsIgnoreCase(intervalTimeUnit)){
|
||||
dateField = DateField.MINUTE;
|
||||
}else if ("s".equalsIgnoreCase(intervalTimeUnit)){
|
||||
dateField = DateField.SECOND;
|
||||
}
|
||||
DateTime nextRuntime = DateUtil.offset(DateUtil.date(), dateField, NumberUtil.parseInt(intervalTimeNumber));
|
||||
return nextRuntime;
|
||||
}
|
||||
|
||||
private void sendCommonTgMessage(TgMessageInfoTask tgMessageInfoTask) throws TelegramApiException {
|
||||
if (longPollingBot == null) {
|
||||
return;
|
||||
}
|
||||
String message = tgMessageInfoTask.getMessageInfo();
|
||||
String chatId = tgMessageInfoTask.getChatIds();
|
||||
List<String> chatIdList = Arrays.asList(chatId.split(","));
|
||||
for (String groupChatId : chatIdList) {
|
||||
SendMessage sendMessage = sendContent.messageText(groupChatId, message, ParseMode.MARKDOWN);
|
||||
longPollingBot.execute(sendMessage);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
|
@ -1,17 +0,0 @@
|
|||
package com.ruoyi.quartz.task;
|
||||
|
||||
import com.ruoyi.system.handler.Usdt2TrxTransferHandler;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component("usdt2TrxxGroupTopicMessageTask")
|
||||
public class Usdt2TrxxGroupTopicMessageTask {
|
||||
@Autowired
|
||||
private Usdt2TrxTransferHandler usdt2TrxTransferHandler;
|
||||
|
||||
public void doUsdt2TrxxGroupTopicMessageTask(){
|
||||
|
||||
|
||||
usdt2TrxTransferHandler.topicGroupMessage();
|
||||
}
|
||||
}
|
|
@ -4,11 +4,12 @@ import lombok.SneakyThrows;
|
|||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.telegram.telegrambots.bots.TelegramLongPollingBot;
|
||||
import org.telegram.telegrambots.meta.api.objects.Update;
|
||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
|
||||
|
||||
//@Component
|
||||
@Component
|
||||
@Slf4j
|
||||
public class TgLongPollingBot extends TelegramLongPollingBot {
|
||||
|
||||
|
|
|
@ -37,8 +37,13 @@ public class MonitorAddressAccount implements Serializable {
|
|||
*/
|
||||
private String encryptKey;
|
||||
|
||||
private String apiKey;
|
||||
|
||||
private String bindPeriod;
|
||||
|
||||
|
||||
private String idTgMessageInfo;
|
||||
|
||||
private String groupChatId;
|
||||
|
||||
private String messageInfo;
|
||||
}
|
||||
|
|
|
@ -0,0 +1,135 @@
|
|||
package com.ruoyi.system.domain;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
public class TgMessageInfoTask implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long idTgMessageTask;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Long idTgMessageInfo;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String chatIds;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String intervalTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date beginTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Date nextRunTime;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer executionStragy;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private String messageInfo;
|
||||
private Integer messageType;
|
||||
|
||||
|
||||
public Integer getMessageType() {
|
||||
return messageType;
|
||||
}
|
||||
|
||||
public void setMessageType(Integer messageType) {
|
||||
this.messageType = messageType;
|
||||
}
|
||||
|
||||
public Long getIdTgMessageTask() {
|
||||
return idTgMessageTask;
|
||||
}
|
||||
|
||||
public void setIdTgMessageTask(Long idTgMessageTask) {
|
||||
this.idTgMessageTask = idTgMessageTask;
|
||||
}
|
||||
|
||||
public Long getIdTgMessageInfo() {
|
||||
return idTgMessageInfo;
|
||||
}
|
||||
|
||||
public void setIdTgMessageInfo(Long idTgMessageInfo) {
|
||||
this.idTgMessageInfo = idTgMessageInfo;
|
||||
}
|
||||
|
||||
public String getChatIds() {
|
||||
return chatIds;
|
||||
}
|
||||
|
||||
public void setChatIds(String chatIds) {
|
||||
this.chatIds = chatIds;
|
||||
}
|
||||
|
||||
public String getIntervalTime() {
|
||||
return intervalTime;
|
||||
}
|
||||
|
||||
public void setIntervalTime(String intervalTime) {
|
||||
this.intervalTime = intervalTime;
|
||||
}
|
||||
|
||||
public Date getBeginTime() {
|
||||
return beginTime;
|
||||
}
|
||||
|
||||
public void setBeginTime(Date beginTime) {
|
||||
this.beginTime = beginTime;
|
||||
}
|
||||
|
||||
public Date getNextRunTime() {
|
||||
return nextRunTime;
|
||||
}
|
||||
|
||||
public void setNextRunTime(Date nextRunTime) {
|
||||
this.nextRunTime = nextRunTime;
|
||||
}
|
||||
|
||||
public Integer getExecutionStragy() {
|
||||
return executionStragy;
|
||||
}
|
||||
|
||||
public void setExecutionStragy(Integer executionStragy) {
|
||||
this.executionStragy = executionStragy;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getMessageInfo() {
|
||||
return messageInfo;
|
||||
}
|
||||
|
||||
public void setMessageInfo(String messageInfo) {
|
||||
this.messageInfo = messageInfo;
|
||||
}
|
||||
}
|
|
@ -63,7 +63,7 @@ public class TrxExchangeMonitorAccountInfo implements Serializable {
|
|||
/**
|
||||
*
|
||||
*/
|
||||
private String apiKey;
|
||||
/* private String apiKey;*/
|
||||
|
||||
/**
|
||||
*
|
||||
|
|
|
@ -59,9 +59,7 @@ public class MonitorAddressInfoVO
|
|||
@Excel(name = "trx或者usdt")
|
||||
private String monitorType;
|
||||
|
||||
/** API_KEY */
|
||||
@Excel(name = "API_KEY")
|
||||
private String apiKey;
|
||||
|
||||
|
||||
/** 是否有效 */
|
||||
@Excel(name = "是否有效")
|
||||
|
@ -70,6 +68,13 @@ public class MonitorAddressInfoVO
|
|||
/** 绑定时长 */
|
||||
@Excel(name = "绑定时长")
|
||||
private String bindPeriod;
|
||||
|
||||
@Excel(name = "消息模版")
|
||||
private String idTgMessageInfo;
|
||||
|
||||
/** 绑定群组 */
|
||||
@Excel(name = "绑定群组")
|
||||
private String groupChatId;
|
||||
/** 备注 */
|
||||
@Excel(name = "备注")
|
||||
private String comment;
|
||||
|
|
|
@ -18,6 +18,7 @@ import com.ruoyi.common.utils.http.RestTemplateUtils;
|
|||
import com.ruoyi.system.bot.TgLongPollingBot;
|
||||
import com.ruoyi.system.bot.utils.SendContent;
|
||||
import com.ruoyi.system.domain.MonitorAddressAccount;
|
||||
import com.ruoyi.system.domain.TgMessageInfoTask;
|
||||
import com.ruoyi.system.dto.Contract;
|
||||
import com.ruoyi.system.dto.Data;
|
||||
import com.ruoyi.system.dto.TronGridResponse;
|
||||
|
@ -42,6 +43,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|||
import org.springframework.web.util.UriComponentsBuilder;
|
||||
import org.telegram.telegrambots.meta.api.methods.ParseMode;
|
||||
import org.telegram.telegrambots.meta.api.methods.send.SendMessage;
|
||||
import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
|
||||
import org.tron.trident.core.ApiWrapper;
|
||||
import org.tron.trident.core.exceptions.IllegalException;
|
||||
import org.tron.trident.proto.Chain;
|
||||
|
@ -49,10 +51,8 @@ import org.tron.trident.proto.Common;
|
|||
import org.tron.trident.proto.Response;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Component
|
||||
|
@ -83,7 +83,8 @@ public class TRX2EneryTransferHandler {
|
|||
public void doMonitorTrxTransferByMonitorAddressInfo(MonitorAddressAccount monitorAddressAccount) {
|
||||
|
||||
String monitorAddress = monitorAddressAccount.getMonitorAddress();
|
||||
String apiKey = monitorAddressAccount.getApiKey();
|
||||
/* String apiKey = monitorAddressAccount.getApiKey();*/
|
||||
String apiKey = DictUtils.getRandomDictValue("sys_tron_api_key");
|
||||
|
||||
ResponseEntity responseEntity = null;
|
||||
try {
|
||||
|
@ -293,7 +294,8 @@ public class TRX2EneryTransferHandler {
|
|||
String accountAddress = monitorAddressAccount.getAccountAddress();
|
||||
String encryptPrivateKey = monitorAddressAccount.getEncryptPrivateKey();
|
||||
String encryptKey = monitorAddressAccount.getEncryptKey();
|
||||
String apiKey = monitorAddressAccount.getApiKey();
|
||||
/* String apiKey = monitorAddressAccount.getApiKey();*/
|
||||
String apiKey = DictUtils.getRandomDictValue("sys_tron_api_key");
|
||||
|
||||
String decryptPrivateKey = Dt.decrypt(encryptPrivateKey, encryptKey);
|
||||
|
||||
|
@ -319,7 +321,7 @@ public class TRX2EneryTransferHandler {
|
|||
}
|
||||
|
||||
|
||||
calcBalanceAndDelegate(txID, apiWrapper, accountAddress, transferCount, ownerAddress, lockPeriod, toAddress, price, sysEnergyBusiType, amount,"TRX","system",Common.ResourceCode.ENERGY.name(),"energy_used");
|
||||
calcBalanceAndDelegate(txID, apiWrapper, accountAddress, transferCount, ownerAddress, lockPeriod, toAddress, price, sysEnergyBusiType, amount,"TRX","system",Common.ResourceCode.ENERGY.name(),"energy_used",monitorAddressAccount);
|
||||
//持久化之后放redis
|
||||
redisTemplate.opsForValue().set("transfer_trx_" + txID, txID, 1, TimeUnit.DAYS);
|
||||
if (tenantInfo != null) {
|
||||
|
@ -330,18 +332,19 @@ public class TRX2EneryTransferHandler {
|
|||
|
||||
|
||||
/**
|
||||
* @param txID 转账交易订单号
|
||||
* @param apiWrapper apiWrapper
|
||||
* @param accountAddress 出账地址
|
||||
* @param transferCount 转账笔数
|
||||
* @param ownerAddress 转入地址
|
||||
* @param lockPeriod 锁定周期
|
||||
* @param toAddress 监听地址
|
||||
* @param price 单价
|
||||
* @param sysEnergyBusiType 业务类型
|
||||
* @param amount 转入金额
|
||||
* @param currentUser 当前处理人
|
||||
* @param txID 转账交易订单号
|
||||
* @param apiWrapper apiWrapper
|
||||
* @param accountAddress 出账地址
|
||||
* @param transferCount 转账笔数
|
||||
* @param ownerAddress 转入地址
|
||||
* @param lockPeriod 锁定周期
|
||||
* @param toAddress 监听地址
|
||||
* @param price 单价
|
||||
* @param sysEnergyBusiType 业务类型
|
||||
* @param amount 转入金额
|
||||
* @param currentUser 当前处理人
|
||||
* @param calcRule
|
||||
* @param monitorAddressAccount
|
||||
* @throws Exception 异常
|
||||
*/
|
||||
public void calcBalanceAndDelegate(String txID,
|
||||
|
@ -356,7 +359,7 @@ public class TRX2EneryTransferHandler {
|
|||
Long amount,
|
||||
String trxAmountUnit,
|
||||
String currentUser,
|
||||
String resourceCode, String calcRule) throws Exception {
|
||||
String resourceCode, String calcRule, MonitorAddressAccount monitorAddressAccount) throws Exception {
|
||||
|
||||
String systronApiSwitch = configService.selectConfigByKey("sys.tron.api");
|
||||
Long balance = null;
|
||||
|
@ -424,15 +427,28 @@ public class TRX2EneryTransferHandler {
|
|||
|
||||
TrxExchangeFail trxExchangeFail = new TrxExchangeFail();
|
||||
trxExchangeFail.setIdTrxExchangeFail(Long.valueOf(cacheidTrxExchangeFail.toString()));
|
||||
trxExchangeFail.setDelegateStatus("1");
|
||||
trxExchangeFail.setDelegateStatus("0");
|
||||
trxExchangeFail.setUpdateTime(new Date());
|
||||
trxExchangeFailMapper.updateTrxExchangeFail(trxExchangeFail);
|
||||
redisTemplate.delete("transfer_trx_fail_" + txID);
|
||||
}
|
||||
|
||||
String sysenTrxTransferNotice = configService.selectConfigByKey("sys.energy.transaction.notice");
|
||||
String sysTgGroupChatId = configService.selectConfigByKey("sys.tg.group.chat.id");
|
||||
if (longPollingBot != null && StringUtils.isNotEmpty(sysenTrxTransferNotice) && StringUtils.isNotEmpty(sysTgGroupChatId)) {
|
||||
|
||||
if (longPollingBot != null) {
|
||||
|
||||
CompletableFuture.runAsync(() -> {
|
||||
String sysenTrxTransferNotice = configService.selectConfigByKey("sys.energy.transaction.notice");
|
||||
String sysTgGroupChatId = configService.selectConfigByKey("sys.tg.group.chat.id");
|
||||
if (monitorAddressAccount != null){
|
||||
String messageInfo = monitorAddressAccount.getMessageInfo();
|
||||
if (StringUtils.isNotEmpty(messageInfo)){
|
||||
sysenTrxTransferNotice = messageInfo;
|
||||
}
|
||||
String groupChatId = monitorAddressAccount.getGroupChatId();
|
||||
if (StringUtils.isNotEmpty(groupChatId)){
|
||||
sysTgGroupChatId = groupChatId;
|
||||
}
|
||||
}
|
||||
/*
|
||||
* 转账TRX:{trxAmount}
|
||||
单价: {price}
|
||||
|
@ -441,18 +457,25 @@ public class TRX2EneryTransferHandler {
|
|||
交易哈希:{txId}
|
||||
订单时间:{txTime}
|
||||
* */
|
||||
Map<String, Object> arguments = new HashMap<>();
|
||||
arguments.put("trxAmount", amount == null ? "" : amount.toString());
|
||||
arguments.put("price", price == null ? "" : price.toString());
|
||||
arguments.put("transferCount", transferCount);
|
||||
arguments.put("FromAddress", fromAddress.replaceAll("(.{6})(.*)(.{8})", "$1********$3"));
|
||||
arguments.put("txId", StringUtils.isEmpty(txID) ? "" : txID.replaceAll("(.{6})(.*)(.{8})", "$1*******************$3"));
|
||||
arguments.put("txTime", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
||||
Map<String, Object> arguments = new HashMap<>();
|
||||
arguments.put("trxAmount", amount == null ? "" : amount.toString());
|
||||
arguments.put("price", price == null ? "" : price.toString());
|
||||
arguments.put("transferCount", transferCount);
|
||||
arguments.put("FromAddress", fromAddress.replaceAll("(.{6})(.*)(.{8})", "$1********$3"));
|
||||
arguments.put("txId", StringUtils.isEmpty(txID) ? "" : txID.replaceAll("(.{6})(.*)(.{8})", "$1*******************$3"));
|
||||
arguments.put("txTime", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
|
||||
// String message = MessageFormat.format(sysUsdtTranferNotice, arguments);
|
||||
StrSubstitutor substitutor = new StrSubstitutor(arguments, "{", "}");
|
||||
String message = substitutor.replace(sysenTrxTransferNotice);
|
||||
SendMessage sendMessage = sendContent.messageText(sysTgGroupChatId, message, ParseMode.HTML);
|
||||
longPollingBot.execute(sendMessage);
|
||||
StrSubstitutor substitutor = new StrSubstitutor(arguments, "{", "}");
|
||||
String message = substitutor.replace(sysenTrxTransferNotice);
|
||||
SendMessage sendMessage = sendContent.messageText(sysTgGroupChatId, message, ParseMode.HTML);
|
||||
try {
|
||||
longPollingBot.execute(sendMessage);
|
||||
} catch (TelegramApiException e) {
|
||||
log.error("longPollingBot execute is null");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
} else {
|
||||
log.warn("longPollingBot OR sysUsdtTranferNotice OR sysTgGroupChatId is null");
|
||||
}
|
||||
|
@ -492,4 +515,17 @@ public class TRX2EneryTransferHandler {
|
|||
return delegateResourceTxid;
|
||||
}
|
||||
|
||||
public void topicGroupMessage(TgMessageInfoTask tgMessageInfoTask) throws TelegramApiException {
|
||||
if (longPollingBot == null){
|
||||
return;
|
||||
}
|
||||
|
||||
String message = tgMessageInfoTask.getMessageInfo();
|
||||
String chatId = tgMessageInfoTask.getChatIds();
|
||||
List<String> chatIdList = Arrays.asList(chatId.split(","));
|
||||
for (String groupChatId : chatIdList) {
|
||||
SendMessage sendMessage = sendContent.messageText(groupChatId, message, ParseMode.MARKDOWN);
|
||||
longPollingBot.execute(sendMessage);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -223,7 +223,7 @@ public class UndelegateEnergyHandler {
|
|||
null,
|
||||
null,
|
||||
"system",
|
||||
Common.ResourceCode.ENERGY.name(), tenantInfo.getCalcRule());
|
||||
Common.ResourceCode.ENERGY.name(), tenantInfo.getCalcRule(), null);
|
||||
|
||||
} else {
|
||||
Long period = tenantInfo.getPeriod();
|
||||
|
|
|
@ -9,6 +9,7 @@ import com.google.common.base.Preconditions;
|
|||
import com.ruoyi.common.constant.UserConstants;
|
||||
import com.ruoyi.common.core.domain.entity.ErrorLog;
|
||||
import com.ruoyi.common.core.domain.entity.UsdtExchangeInfo;
|
||||
import com.ruoyi.common.utils.DictUtils;
|
||||
import com.ruoyi.common.utils.ForwardCounter;
|
||||
import com.ruoyi.common.utils.LogUtils;
|
||||
import com.ruoyi.common.utils.StringUtils;
|
||||
|
@ -21,6 +22,7 @@ import com.ruoyi.system.api.enums.Symbol;
|
|||
import com.ruoyi.system.bot.TgLongPollingBot;
|
||||
import com.ruoyi.system.bot.utils.SendContent;
|
||||
import com.ruoyi.system.domain.MonitorAddressAccount;
|
||||
import com.ruoyi.system.domain.TgMessageInfoTask;
|
||||
import com.ruoyi.system.dto.Data;
|
||||
import com.ruoyi.system.dto.Token_info;
|
||||
import com.ruoyi.system.dto.TronGridResponse;
|
||||
|
@ -49,10 +51,7 @@ import java.io.IOException;
|
|||
import java.math.BigDecimal;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
@Component
|
||||
|
@ -88,7 +87,8 @@ public class Usdt2TrxTransferHandler {
|
|||
|
||||
try {
|
||||
String monitorAddress = monitorAddressAccount.getMonitorAddress();
|
||||
String apiKey = monitorAddressAccount.getApiKey();
|
||||
/* String apiKey = monitorAddressAccount.getApiKey();*/
|
||||
String apiKey = DictUtils.getRandomDictValue("sys_tron_api_key");
|
||||
String sysTransferBetween = configService.selectConfigByKey("sys.transfer.between");
|
||||
//
|
||||
DateTime min_timestamp = DateUtil.offset(new Date(), DateField.MINUTE, Integer.valueOf(sysTransferBetween));
|
||||
|
@ -156,7 +156,7 @@ public class Usdt2TrxTransferHandler {
|
|||
return;
|
||||
}
|
||||
|
||||
doTransferUsdtAndStore(oneUsdtToTrxPair, apiKey, decryptPrivateKey, accountAddress, from, trxValue, dataTo, transactionId, transferValue);
|
||||
doTransferUsdtAndStore(oneUsdtToTrxPair, apiKey, decryptPrivateKey, accountAddress, from, trxValue, dataTo, transactionId, transferValue,monitorAddressAccount);
|
||||
|
||||
redisTemplate.opsForValue().set("transfer_USDT_" + transactionId, transactionId, 1, TimeUnit.DAYS);
|
||||
} finally {
|
||||
|
@ -168,7 +168,7 @@ public class Usdt2TrxTransferHandler {
|
|||
}
|
||||
}
|
||||
|
||||
public void doTransferUsdtAndStore(Pair<BigDecimal, BigDecimal> oneUsdtToTrxPair, String apiKey, String decryptPrivateKey, String accountAddress, String from, BigDecimal trxValue, String dataTo, String transactionId, BigDecimal transferValue) throws IllegalException, TelegramApiException {
|
||||
public void doTransferUsdtAndStore(Pair<BigDecimal, BigDecimal> oneUsdtToTrxPair, String apiKey, String decryptPrivateKey, String accountAddress, String from, BigDecimal trxValue, String dataTo, String transactionId, BigDecimal transferValue, MonitorAddressAccount monitorAddressAccount) throws IllegalException, TelegramApiException {
|
||||
|
||||
String systronApiSwitch = configService.selectConfigByKey("sys.tron.api");
|
||||
|
||||
|
@ -194,7 +194,7 @@ public class Usdt2TrxTransferHandler {
|
|||
.setUsdtAmount(transferValue)
|
||||
.setTrxAmount(trxValue)
|
||||
.setExchangeRate(oneUsdtToTrxPair == null ? null : oneUsdtToTrxPair.getFirst())
|
||||
.setOrginalExchangeRate(oneUsdtToTrxPair == null ? null :oneUsdtToTrxPair.getSecond())
|
||||
.setOrginalExchangeRate(oneUsdtToTrxPair == null ? null : oneUsdtToTrxPair.getSecond())
|
||||
.setTrxTxId(txId)
|
||||
.setFcu("system")
|
||||
.setLcu("system");
|
||||
|
@ -202,15 +202,28 @@ public class Usdt2TrxTransferHandler {
|
|||
|
||||
usdtExchangeInfoMapper.insertUsdtExchangeInfo(usdtExchangeInfo);
|
||||
|
||||
if (oneUsdtToTrxPair != null){
|
||||
doSendTgNotice(oneUsdtToTrxPair.getFirst(), from, trxValue, transferValue, txId);
|
||||
if (oneUsdtToTrxPair != null) {
|
||||
doSendTgNotice(oneUsdtToTrxPair.getFirst(), from, trxValue, transferValue, txId,monitorAddressAccount);
|
||||
}
|
||||
}
|
||||
|
||||
private void doSendTgNotice(BigDecimal oneUsdtToTrx, String from, BigDecimal trxValue, BigDecimal transferValue, String txId) throws TelegramApiException {
|
||||
String sysUsdtTranferNotice = configService.selectConfigByKey("sys.usdt.tranfer.notice");
|
||||
String sysTgGroupChatId = configService.selectConfigByKey("sys.tg.group.chat.id");
|
||||
if (longPollingBot != null && StringUtils.isNotEmpty(sysUsdtTranferNotice) && StringUtils.isNotEmpty(sysTgGroupChatId)) {
|
||||
private void doSendTgNotice(BigDecimal oneUsdtToTrx, String from, BigDecimal trxValue, BigDecimal transferValue, String txId, MonitorAddressAccount monitorAddressAccount) throws TelegramApiException {
|
||||
|
||||
if (longPollingBot != null ) {
|
||||
String sysUsdtTranferNotice = configService.selectConfigByKey("sys.usdt.tranfer.notice");
|
||||
String sysTgGroupChatId = configService.selectConfigByKey("sys.tg.group.chat.id");
|
||||
if (monitorAddressAccount != null){
|
||||
String messageInfo = monitorAddressAccount.getMessageInfo();
|
||||
if (StringUtils.isNotEmpty(messageInfo)){
|
||||
sysUsdtTranferNotice = messageInfo;
|
||||
}
|
||||
String groupChatId = monitorAddressAccount.getGroupChatId();
|
||||
if (StringUtils.isNotEmpty(groupChatId)){
|
||||
sysTgGroupChatId = groupChatId;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Map<String, Object> arguments = new HashMap<>();
|
||||
arguments.put("usdtAmount", transferValue.setScale(2, BigDecimal.ROUND_HALF_DOWN));
|
||||
arguments.put("exchangeRate", oneUsdtToTrx);
|
||||
|
@ -224,7 +237,7 @@ public class Usdt2TrxTransferHandler {
|
|||
SendMessage sendMessage = sendContent.messageText(sysTgGroupChatId, message, ParseMode.HTML);
|
||||
longPollingBot.execute(sendMessage);
|
||||
} else {
|
||||
log.warn("longPollingBot OR sysUsdtTranferNotice OR sysTgGroupChatId is null");
|
||||
log.warn("longPollingBot is null");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -296,34 +309,39 @@ public class Usdt2TrxTransferHandler {
|
|||
}
|
||||
|
||||
|
||||
public void topicGroupMessage() {
|
||||
public void topicGroupMessage(TgMessageInfoTask tgMessageInfoTask) throws TelegramApiException, NoSuchAlgorithmException, IOException, InvalidKeyException {
|
||||
|
||||
|
||||
String sysUsdtGroupTopic = configService.selectConfigByKey("sys.usdt.group.topic");
|
||||
String sysTgGroupChatId = configService.selectConfigByKey("sys.tg.group.chat.id");
|
||||
|
||||
log.info("longPollingBot:{},sysUsdtGroupTopic:{},sysTgGroupChatId:{}", longPollingBot, sysUsdtGroupTopic, sysTgGroupChatId);
|
||||
|
||||
if (longPollingBot != null && StringUtils.isNotEmpty(sysUsdtGroupTopic) && StringUtils.isNotEmpty(sysTgGroupChatId)) {
|
||||
log.info("进入这里1");
|
||||
try {
|
||||
BigDecimal oneUsdtToTrx = getOneUsdtToTrx().getFirst();
|
||||
BigDecimal tenUsdtToTrx = oneUsdtToTrx.multiply(BigDecimal.TEN);
|
||||
Map<String, Object> arguments = new HashMap<>();
|
||||
arguments.put("tenUsdtToTrx", tenUsdtToTrx);
|
||||
StrSubstitutor substitutor = new StrSubstitutor(arguments, "{", "}");
|
||||
String message = substitutor.replace(sysUsdtGroupTopic);
|
||||
SendMessage sendMessage = sendContent.messageText(sysTgGroupChatId, message, ParseMode.MARKDOWN);
|
||||
|
||||
longPollingBot.execute(sendMessage);
|
||||
} catch (Exception e) {
|
||||
|
||||
log.error("广播消息异常", e);
|
||||
}
|
||||
} else {
|
||||
log.info("进入这里2");
|
||||
log.warn("sysUsdtTranferNotice OR sysTgGroupChatId is null");
|
||||
if (longPollingBot == null) {
|
||||
return;
|
||||
}
|
||||
/* String sysUsdtGroupTopic = configService.selectConfigByKey("sys.usdt.group.topic");
|
||||
String sysTgGroupChatId = configService.selectConfigByKey("sys.tg.group.chat.id");*/
|
||||
|
||||
String messageContent = tgMessageInfoTask.getMessageInfo();
|
||||
|
||||
String chatId = tgMessageInfoTask.getChatIds();
|
||||
List<String> chatIdList = Arrays.asList(chatId.split(","));
|
||||
|
||||
log.info("longPollingBot:{},sysUsdtGroupTopic:{},sysTgGroupChatId:{}", longPollingBot, messageContent, chatId);
|
||||
|
||||
|
||||
for (String groupChatId : chatIdList) {
|
||||
sendGroupMessage(messageContent, groupChatId);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void sendGroupMessage(String sysUsdtGroupTopic, String sysTgGroupChatId) throws NoSuchAlgorithmException, InvalidKeyException, IOException, TelegramApiException {
|
||||
BigDecimal oneUsdtToTrx = getOneUsdtToTrx().getFirst();
|
||||
BigDecimal tenUsdtToTrx = oneUsdtToTrx.multiply(BigDecimal.TEN);
|
||||
Map<String, Object> arguments = new HashMap<>();
|
||||
arguments.put("tenUsdtToTrx", tenUsdtToTrx);
|
||||
StrSubstitutor substitutor = new StrSubstitutor(arguments, "{", "}");
|
||||
String message = substitutor.replace(sysUsdtGroupTopic);
|
||||
SendMessage sendMessage = sendContent.messageText(sysTgGroupChatId, message, ParseMode.MARKDOWN);
|
||||
|
||||
longPollingBot.execute(sendMessage);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -60,4 +60,7 @@ public interface TgMessageInfoMapper
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteTgMessageInfoByIdTgMessageInfos(String[] idTgMessageInfos);
|
||||
|
||||
List<TgMessageInfo> selectTopicTgMessageInfoList();
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,66 @@
|
|||
package com.ruoyi.system.mapper;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.TgMessageTask;
|
||||
import com.ruoyi.system.domain.TgMessageInfoTask;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* TG消息任务管理Mapper接口
|
||||
*
|
||||
* @author dorion
|
||||
* @date 2024-07-14
|
||||
*/
|
||||
public interface TgMessageTaskMapper
|
||||
{
|
||||
/**
|
||||
* 查询TG消息任务管理
|
||||
*
|
||||
* @param idTgMessageTask TG消息任务管理主键
|
||||
* @return TG消息任务管理
|
||||
*/
|
||||
public TgMessageTask selectTgMessageTaskByIdTgMessageTask(Long idTgMessageTask);
|
||||
|
||||
/**
|
||||
* 查询TG消息任务管理列表
|
||||
*
|
||||
* @param tgMessageTask TG消息任务管理
|
||||
* @return TG消息任务管理集合
|
||||
*/
|
||||
public List<TgMessageTask> selectTgMessageTaskList(TgMessageTask tgMessageTask);
|
||||
|
||||
/**
|
||||
* 新增TG消息任务管理
|
||||
*
|
||||
* @param tgMessageTask TG消息任务管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTgMessageTask(TgMessageTask tgMessageTask);
|
||||
|
||||
/**
|
||||
* 修改TG消息任务管理
|
||||
*
|
||||
* @param tgMessageTask TG消息任务管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTgMessageTask(TgMessageTask tgMessageTask);
|
||||
|
||||
/**
|
||||
* 删除TG消息任务管理
|
||||
*
|
||||
* @param idTgMessageTask TG消息任务管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTgMessageTaskByIdTgMessageTask(Long idTgMessageTask);
|
||||
|
||||
/**
|
||||
* 批量删除TG消息任务管理
|
||||
*
|
||||
* @param idTgMessageTasks 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTgMessageTaskByIdTgMessageTasks(String[] idTgMessageTasks);
|
||||
|
||||
List<TgMessageInfoTask> selectTgMessageTaskAndInfoList(TgMessageTask tgMessageTask);
|
||||
}
|
|
@ -60,4 +60,6 @@ public interface ITgMessageInfoService
|
|||
* @return 结果
|
||||
*/
|
||||
public int deleteTgMessageInfoByIdTgMessageInfo(Long idTgMessageInfo);
|
||||
|
||||
List<TgMessageInfo> selectTopicTgMessageInfoList();
|
||||
}
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
package com.ruoyi.system.service;
|
||||
|
||||
import com.ruoyi.common.core.domain.entity.TgMessageTask;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
/**
|
||||
* TG消息任务管理Service接口
|
||||
*
|
||||
* @author dorion
|
||||
* @date 2024-07-14
|
||||
*/
|
||||
public interface ITgMessageTaskService
|
||||
{
|
||||
/**
|
||||
* 查询TG消息任务管理
|
||||
*
|
||||
* @param idTgMessageTask TG消息任务管理主键
|
||||
* @return TG消息任务管理
|
||||
*/
|
||||
public TgMessageTask selectTgMessageTaskByIdTgMessageTask(Long idTgMessageTask);
|
||||
|
||||
/**
|
||||
* 查询TG消息任务管理列表
|
||||
*
|
||||
* @param tgMessageTask TG消息任务管理
|
||||
* @return TG消息任务管理集合
|
||||
*/
|
||||
public List<TgMessageTask> selectTgMessageTaskList(TgMessageTask tgMessageTask);
|
||||
|
||||
/**
|
||||
* 新增TG消息任务管理
|
||||
*
|
||||
* @param tgMessageTask TG消息任务管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertTgMessageTask(TgMessageTask tgMessageTask);
|
||||
|
||||
/**
|
||||
* 修改TG消息任务管理
|
||||
*
|
||||
* @param tgMessageTask TG消息任务管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateTgMessageTask(TgMessageTask tgMessageTask);
|
||||
|
||||
/**
|
||||
* 批量删除TG消息任务管理
|
||||
*
|
||||
* @param idTgMessageTasks 需要删除的TG消息任务管理主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTgMessageTaskByIdTgMessageTasks(String idTgMessageTasks);
|
||||
|
||||
/**
|
||||
* 删除TG消息任务管理信息
|
||||
*
|
||||
* @param idTgMessageTask TG消息任务管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteTgMessageTaskByIdTgMessageTask(Long idTgMessageTask);
|
||||
}
|
|
@ -82,6 +82,10 @@ public class MonitorAddressInfoServiceImpl implements IMonitorAddressInfoService
|
|||
});
|
||||
monitorAddressInfoVOList.add(monitorAddressInfoVO);
|
||||
});
|
||||
|
||||
/* MonitorAddressInfoVO monitorAddressInfoVO = new MonitorAddressInfoVO();
|
||||
BeanUtils.copyProperties(monitorAddressInfo1,monitorAddressInfoVO);
|
||||
monitorAddressInfoVOList.add(monitorAddressInfoVO);*/
|
||||
});
|
||||
|
||||
List<MonitorAddressInfoVO> sortedMonitorAddressInfoVOList = monitorAddressInfoVOList.stream().sorted(Comparator.comparingLong(MonitorAddressInfoVO::getIdMonitorAddress))
|
||||
|
|
|
@ -2,7 +2,7 @@ package com.ruoyi.system.service.impl;
|
|||
|
||||
import com.ruoyi.common.core.domain.entity.TgMessageInfo;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.utils.DateUtils;
|
||||
import com.ruoyi.common.utils.ShiroUtils;
|
||||
import com.ruoyi.system.mapper.TgMessageInfoMapper;
|
||||
import com.ruoyi.system.service.ITgMessageInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
@ -12,87 +12,93 @@ import java.util.List;
|
|||
|
||||
/**
|
||||
* TG消息管理Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author dorion
|
||||
* @date 2024-07-12
|
||||
*/
|
||||
@Service
|
||||
public class TgMessageInfoServiceImpl implements ITgMessageInfoService
|
||||
{
|
||||
public class TgMessageInfoServiceImpl implements ITgMessageInfoService {
|
||||
@Autowired
|
||||
private TgMessageInfoMapper tgMessageInfoMapper;
|
||||
|
||||
/**
|
||||
* 查询TG消息管理
|
||||
*
|
||||
*
|
||||
* @param idTgMessageInfo TG消息管理主键
|
||||
* @return TG消息管理
|
||||
*/
|
||||
@Override
|
||||
public TgMessageInfo selectTgMessageInfoByIdTgMessageInfo(Long idTgMessageInfo)
|
||||
{
|
||||
public TgMessageInfo selectTgMessageInfoByIdTgMessageInfo(Long idTgMessageInfo) {
|
||||
return tgMessageInfoMapper.selectTgMessageInfoByIdTgMessageInfo(idTgMessageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询TG消息管理列表
|
||||
*
|
||||
*
|
||||
* @param tgMessageInfo TG消息管理
|
||||
* @return TG消息管理
|
||||
*/
|
||||
@Override
|
||||
public List<TgMessageInfo> selectTgMessageInfoList(TgMessageInfo tgMessageInfo)
|
||||
{
|
||||
public List<TgMessageInfo> selectTgMessageInfoList(TgMessageInfo tgMessageInfo) {
|
||||
return tgMessageInfoMapper.selectTgMessageInfoList(tgMessageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增TG消息管理
|
||||
*
|
||||
*
|
||||
* @param tgMessageInfo TG消息管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertTgMessageInfo(TgMessageInfo tgMessageInfo)
|
||||
{
|
||||
tgMessageInfo.setCreateTime(DateUtils.getNowDate());
|
||||
public int insertTgMessageInfo(TgMessageInfo tgMessageInfo) {
|
||||
|
||||
String loginName = ShiroUtils.getSysUser().getLoginName();
|
||||
tgMessageInfo.setCreateBy(loginName);
|
||||
tgMessageInfo.setUpdateBy(loginName);
|
||||
|
||||
return tgMessageInfoMapper.insertTgMessageInfo(tgMessageInfo);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 修改TG消息管理
|
||||
*
|
||||
*
|
||||
* @param tgMessageInfo TG消息管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateTgMessageInfo(TgMessageInfo tgMessageInfo)
|
||||
{
|
||||
tgMessageInfo.setUpdateTime(DateUtils.getNowDate());
|
||||
public int updateTgMessageInfo(TgMessageInfo tgMessageInfo) {
|
||||
String loginName = ShiroUtils.getSysUser().getLoginName();
|
||||
tgMessageInfo.setUpdateBy(loginName);
|
||||
return tgMessageInfoMapper.updateTgMessageInfo(tgMessageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除TG消息管理
|
||||
*
|
||||
*
|
||||
* @param idTgMessageInfos 需要删除的TG消息管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTgMessageInfoByIdTgMessageInfos(String idTgMessageInfos)
|
||||
{
|
||||
public int deleteTgMessageInfoByIdTgMessageInfos(String idTgMessageInfos) {
|
||||
return tgMessageInfoMapper.deleteTgMessageInfoByIdTgMessageInfos(Convert.toStrArray(idTgMessageInfos));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除TG消息管理信息
|
||||
*
|
||||
*
|
||||
* @param idTgMessageInfo TG消息管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTgMessageInfoByIdTgMessageInfo(Long idTgMessageInfo)
|
||||
{
|
||||
public int deleteTgMessageInfoByIdTgMessageInfo(Long idTgMessageInfo) {
|
||||
return tgMessageInfoMapper.deleteTgMessageInfoByIdTgMessageInfo(idTgMessageInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<TgMessageInfo> selectTopicTgMessageInfoList() {
|
||||
return tgMessageInfoMapper.selectTopicTgMessageInfoList();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,139 @@
|
|||
package com.ruoyi.system.service.impl;
|
||||
|
||||
import cn.hutool.core.util.NumberUtil;
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.ruoyi.common.core.domain.entity.TgMessageTask;
|
||||
import com.ruoyi.common.core.text.Convert;
|
||||
import com.ruoyi.common.utils.ShiroUtils;
|
||||
import com.ruoyi.system.mapper.TgMessageTaskMapper;
|
||||
import com.ruoyi.system.service.ITgMessageTaskService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TG消息任务管理Service业务层处理
|
||||
*
|
||||
* @author dorion
|
||||
* @date 2024-07-14
|
||||
*/
|
||||
@Service
|
||||
public class TgMessageTaskServiceImpl implements ITgMessageTaskService
|
||||
{
|
||||
@Autowired
|
||||
private TgMessageTaskMapper tgMessageTaskMapper;
|
||||
|
||||
/**
|
||||
* 查询TG消息任务管理
|
||||
*
|
||||
* @param idTgMessageTask TG消息任务管理主键
|
||||
* @return TG消息任务管理
|
||||
*/
|
||||
@Override
|
||||
public TgMessageTask selectTgMessageTaskByIdTgMessageTask(Long idTgMessageTask)
|
||||
{
|
||||
return tgMessageTaskMapper.selectTgMessageTaskByIdTgMessageTask(idTgMessageTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询TG消息任务管理列表
|
||||
*
|
||||
* @param tgMessageTask TG消息任务管理
|
||||
* @return TG消息任务管理
|
||||
*/
|
||||
@Override
|
||||
public List<TgMessageTask> selectTgMessageTaskList(TgMessageTask tgMessageTask)
|
||||
{
|
||||
return tgMessageTaskMapper.selectTgMessageTaskList(tgMessageTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增TG消息任务管理
|
||||
*
|
||||
* @param tgMessageTask TG消息任务管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int insertTgMessageTask(TgMessageTask tgMessageTask)
|
||||
{
|
||||
Long executionStragy = tgMessageTask.getExecutionStragy();
|
||||
if (0 == executionStragy) {
|
||||
String intervalTime = tgMessageTask.getIntervalTime();
|
||||
Preconditions.checkNotNull(intervalTime, "周期执行时间间隔不能为空");
|
||||
checkIntervalTime(intervalTime);
|
||||
tgMessageTask.setNextRunTime(tgMessageTask.getBeginTime());
|
||||
} else {
|
||||
tgMessageTask.setIntervalTime(null);
|
||||
}
|
||||
|
||||
String loginName = ShiroUtils.getSysUser().getLoginName();
|
||||
tgMessageTask.setCreateBy(loginName);
|
||||
tgMessageTask.setUpdateBy(loginName);
|
||||
tgMessageTask.setStatus(1L);
|
||||
return tgMessageTaskMapper.insertTgMessageTask(tgMessageTask);
|
||||
}
|
||||
|
||||
|
||||
private void checkIntervalTime(String intervalTime) {
|
||||
int length = intervalTime.length();
|
||||
String intervalTimeNumber = intervalTime.substring(0, length - 1);
|
||||
boolean number = NumberUtil.isNumber(intervalTimeNumber);
|
||||
Preconditions.checkState(number, "时间间隔时间必须全部为数字");
|
||||
|
||||
String intervalTimeUnit = intervalTime.substring(length - 1, length);
|
||||
boolean expression = intervalTimeUnit.equalsIgnoreCase("s")
|
||||
|| intervalTimeUnit.equalsIgnoreCase("m")
|
||||
|| intervalTimeUnit.equalsIgnoreCase("h") ;
|
||||
Preconditions.checkState(expression, "时间间隔单位只能为S、M、H");
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改TG消息任务管理
|
||||
*
|
||||
* @param tgMessageTask TG消息任务管理
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int updateTgMessageTask(TgMessageTask tgMessageTask)
|
||||
{
|
||||
Long executionStragy = tgMessageTask.getExecutionStragy();
|
||||
if (0 == executionStragy) {
|
||||
String intervalTime = tgMessageTask.getIntervalTime();
|
||||
checkIntervalTime(intervalTime);
|
||||
tgMessageTask.setNextRunTime(tgMessageTask.getBeginTime());
|
||||
} else {
|
||||
tgMessageTask.setIntervalTime(null);
|
||||
tgMessageTask.setNextRunTime(null);
|
||||
}
|
||||
String loginName = ShiroUtils.getSysUser().getLoginName();
|
||||
tgMessageTask.setUpdateBy(loginName);
|
||||
tgMessageTask.setUpdateTime(new Date());
|
||||
return tgMessageTaskMapper.updateTgMessageTask(tgMessageTask);
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除TG消息任务管理
|
||||
*
|
||||
* @param idTgMessageTasks 需要删除的TG消息任务管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTgMessageTaskByIdTgMessageTasks(String idTgMessageTasks)
|
||||
{
|
||||
return tgMessageTaskMapper.deleteTgMessageTaskByIdTgMessageTasks(Convert.toStrArray(idTgMessageTasks));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除TG消息任务管理信息
|
||||
*
|
||||
* @param idTgMessageTask TG消息任务管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public int deleteTgMessageTaskByIdTgMessageTask(Long idTgMessageTask)
|
||||
{
|
||||
return tgMessageTaskMapper.deleteTgMessageTaskByIdTgMessageTask(idTgMessageTask);
|
||||
}
|
||||
}
|
|
@ -159,7 +159,7 @@ public class TrxExchangeFailServiceImpl implements ITrxExchangeFailService
|
|||
trxExchangeFail.getTrxAmount(),
|
||||
trxExchangeFail.getTrxAmountUnit(),
|
||||
ShiroUtils.getLoginName(),
|
||||
trxExchangeFail.getResourceCode(), trxExchangeFail.getCalcRule());
|
||||
trxExchangeFail.getResourceCode(), trxExchangeFail.getCalcRule(), null);
|
||||
|
||||
|
||||
}catch (Exception e){
|
||||
|
|
|
@ -163,7 +163,7 @@ public class TrxExchangeInfoServiceImpl implements ITrxExchangeInfoService {
|
|||
null,
|
||||
null,
|
||||
userName,
|
||||
trxExchange.getResourceCode(), calcRule);
|
||||
trxExchange.getResourceCode(), calcRule, null);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
|
|
@ -107,7 +107,7 @@ public class UsdtExchangeInfoServiceImpl implements IUsdtExchangeInfoService {
|
|||
|
||||
String fromAddress = usdtExchangeInfo.getFromAddress();
|
||||
usdt2TrxTransferHandler.
|
||||
doTransferUsdtAndStore(oneUsdtToTrxPair, apiKey, decryptPrivateKey, accountAddress, fromAddress, trxValue, null, null, usdtAmount);
|
||||
doTransferUsdtAndStore(oneUsdtToTrxPair, apiKey, decryptPrivateKey, accountAddress, fromAddress, trxValue, null, null, usdtAmount, null);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,6 @@
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.ruoyi.system.mapper.MonitorAddressInfoMapper">
|
||||
|
||||
|
||||
<resultMap type="MonitorAddressInfo" id="MonitorAddressInfoResult">
|
||||
<result property="idMonitorAddress" column="id_monitor_address" />
|
||||
<result property="busiType" column="busi_type" />
|
||||
|
@ -14,7 +13,8 @@
|
|||
<result property="trxPrice" column="trx_price" />
|
||||
<result property="usdtPrice" column="usdt_price" />
|
||||
<result property="monitorType" column="monitor_type" />
|
||||
<result property="apiKey" column="api_key" />
|
||||
<result property="idTgMessageInfo" column="id_tg_message_info" />
|
||||
<result property="groupChatId" column="group_chat_id" />
|
||||
<result property="bindPeriod" column="bind_period" />
|
||||
<result property="isValid" column="is_valid" />
|
||||
<result property="comment" column="comment" />
|
||||
|
@ -25,7 +25,7 @@
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectMonitorAddressInfoVo">
|
||||
select id_monitor_address, busi_type, monitor_address_name, monitor_address, account_address, trx_price, usdt_price, monitor_type, api_key, bind_period, is_valid, comment, fcd, fcu, lcd, lcu from monitor_address_info
|
||||
select id_monitor_address, busi_type, monitor_address_name, monitor_address, account_address, trx_price, usdt_price, monitor_type, id_tg_message_info, group_chat_id, bind_period, is_valid, comment, fcd, fcu, lcd, lcu from monitor_address_info
|
||||
</sql>
|
||||
|
||||
<select id="selectMonitorAddressInfoList" parameterType="MonitorAddressInfo" resultMap="MonitorAddressInfoResult">
|
||||
|
@ -38,7 +38,7 @@
|
|||
<if test="trxPrice != null "> and trx_price = #{trxPrice}</if>
|
||||
<if test="usdtPrice != null "> and usdt_price = #{usdtPrice}</if>
|
||||
<if test="monitorType != null and monitorType != ''"> and monitor_type = #{monitorType}</if>
|
||||
<if test="apiKey != null and apiKey != ''"> and api_key = #{apiKey}</if>
|
||||
<!-- <if test="apiKey != null and apiKey != ''"> and api_key = #{apiKey}</if>-->
|
||||
<if test="bindPeriod != null and bindPeriod != ''"> and bind_period = #{bindPeriod}</if>
|
||||
<if test="isValid != null and isValid != ''"> and is_valid = #{isValid}</if>
|
||||
<if test="comment != null and comment != ''"> and comment = #{comment}</if>
|
||||
|
@ -64,9 +64,11 @@
|
|||
<if test="trxPrice != null">trx_price,</if>
|
||||
<if test="usdtPrice != null">usdt_price,</if>
|
||||
<if test="monitorType != null">monitor_type,</if>
|
||||
<if test="apiKey != null">api_key,</if>
|
||||
<!-- <if test="apiKey != null">api_key,</if>-->
|
||||
<if test="bindPeriod != null">bind_period,</if>
|
||||
<if test="isValid != null">is_valid,</if>
|
||||
<if test="idTgMessageInfo != null">id_tg_message_info,</if>
|
||||
<if test="groupChatId != null">group_chat_id,</if>
|
||||
<if test="comment != null">comment,</if>
|
||||
<if test="fcd != null">fcd,</if>
|
||||
<if test="fcu != null">fcu,</if>
|
||||
|
@ -81,9 +83,11 @@
|
|||
<if test="trxPrice != null">#{trxPrice},</if>
|
||||
<if test="usdtPrice != null">#{usdtPrice},</if>
|
||||
<if test="monitorType != null">#{monitorType},</if>
|
||||
<if test="apiKey != null">#{apiKey},</if>
|
||||
<!-- <if test="apiKey != null">#{apiKey},</if>-->
|
||||
<if test="bindPeriod != null">#{bindPeriod},</if>
|
||||
<if test="isValid != null">#{isValid},</if>
|
||||
<if test="idTgMessageInfo != null">#{idTgMessageInfo},</if>
|
||||
<if test="groupChatId != null">#{groupChatId},</if>
|
||||
<if test="comment != null">#{comment},</if>
|
||||
<if test="fcd != null">#{fcd},</if>
|
||||
<if test="fcu != null">#{fcu},</if>
|
||||
|
@ -102,9 +106,11 @@
|
|||
<if test="trxPrice != null">trx_price = #{trxPrice},</if>
|
||||
<if test="usdtPrice != null">usdt_price = #{usdtPrice},</if>
|
||||
<if test="monitorType != null">monitor_type = #{monitorType},</if>
|
||||
<if test="apiKey != null">api_key = #{apiKey},</if>
|
||||
<!-- <if test="apiKey != null">api_key = #{apiKey},</if>-->
|
||||
<if test="bindPeriod != null">bind_period = #{bindPeriod},</if>
|
||||
<if test="isValid != null">is_valid = #{isValid},</if>
|
||||
<if test="idTgMessageInfo != null">id_tg_message_info = #{idTgMessageInfo},</if>
|
||||
<if test="groupChatId != null">group_chat_id = #{groupChatId},</if>
|
||||
<if test="comment != null">comment = #{comment},</if>
|
||||
<if test="fcd != null">fcd = #{fcd},</if>
|
||||
<if test="fcu != null">fcu = #{fcu},</if>
|
||||
|
@ -114,6 +120,7 @@
|
|||
where id_monitor_address = #{idMonitorAddress}
|
||||
</update>
|
||||
|
||||
|
||||
<delete id="deleteMonitorAddressInfoByIdMonitorAddress" parameterType="Long">
|
||||
delete from monitor_address_info where id_monitor_address = #{idMonitorAddress}
|
||||
</delete>
|
||||
|
@ -125,22 +132,39 @@
|
|||
</foreach>
|
||||
</delete>
|
||||
|
||||
|
||||
<select id="selectMonitorAddressAccount" resultType="com.ruoyi.system.domain.MonitorAddressAccount" parameterType="MonitorAddressInfo">
|
||||
select m.monitor_address,
|
||||
m.account_address,
|
||||
m.trx_price,
|
||||
m.usdt_price,
|
||||
a.encrypt_private_key,
|
||||
a.encrypt_key,
|
||||
m.api_key,
|
||||
m.bind_period
|
||||
from monitor_address_info m,
|
||||
account_address_info a
|
||||
where m.account_address = a.address
|
||||
and m.is_valid = a.is_valid
|
||||
and m.busi_type = a.busi_type
|
||||
and m.busi_type = #{busiType}
|
||||
<resultMap id="selectMonitorAddressAccountResultMap" type="com.ruoyi.system.domain.MonitorAddressAccount">
|
||||
<result column="monitor_address" property="monitorAddress"/>
|
||||
<result column="account_address" property="accountAddress"/>
|
||||
<result column="trx_price" property="trxPrice"/>
|
||||
<result column="usdt_price" property="usdtPrice"/>
|
||||
<result column="encrypt_private_key" property="encryptPrivateKey"/>
|
||||
<result column="encrypt_key" property="encryptKey"/>
|
||||
<result column="bind_period" property="bindPeriod"/>
|
||||
<result column="id_tg_message_info" property="idTgMessageInfo"/>
|
||||
<result column="message_info" property="messageInfo"/>
|
||||
<result column="group_chat_id" property="groupChatId"/>
|
||||
</resultMap>
|
||||
<select id="selectMonitorAddressAccount" parameterType="MonitorAddressInfo"
|
||||
resultMap="selectMonitorAddressAccountResultMap">
|
||||
SELECT
|
||||
m.monitor_address,
|
||||
m.account_address,
|
||||
m.trx_price,
|
||||
m.usdt_price,
|
||||
a.encrypt_private_key,
|
||||
a.encrypt_key,
|
||||
m.bind_period,
|
||||
m.id_tg_message_info,
|
||||
t.message_info,
|
||||
m.group_chat_id
|
||||
FROM
|
||||
monitor_address_info m
|
||||
LEFT JOIN account_address_info a ON m.account_address = a.address
|
||||
AND m.is_valid = a.is_valid
|
||||
AND m.busi_type = a.busi_type
|
||||
LEFT JOIN tg_message_info t ON m.id_tg_message_info = t.id_tg_message_info
|
||||
where
|
||||
m.busi_type = #{busiType}
|
||||
and m.is_valid = #{isValid}
|
||||
</select>
|
||||
|
||||
|
|
|
@ -210,7 +210,7 @@
|
|||
t.delegate_tx_id,
|
||||
t.un_delegate_tx_id,
|
||||
t.fcd,
|
||||
m.api_key,
|
||||
<!-- m.api_key,-->
|
||||
a.encrypt_key,
|
||||
a.encrypt_private_key
|
||||
FROM
|
||||
|
|
|
@ -6,14 +6,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
|
||||
<resultMap type="TgMessageInfo" id="TgMessageInfoResult">
|
||||
<result property="idTgMessageInfo" column="id_tg_message_info" />
|
||||
<result property="messageAbbrName" column="message_abbr_name" />
|
||||
<result property="messageInfo" column="message_info" />
|
||||
<result property="messageType" column="message_type" />
|
||||
<result property="chatId" column="chat_id" />
|
||||
<result property="intervalTime" column="interval_time" />
|
||||
<result property="beginTime" column="begin_time" />
|
||||
<result property="nextRunTime" column="next_run_time" />
|
||||
<result property="executionStragy" column="execution_stragy" />
|
||||
<result property="status" column="status" />
|
||||
<result property="createBy" column="create_by" />
|
||||
<result property="createTime" column="create_time" />
|
||||
<result property="updateBy" column="update_by" />
|
||||
|
@ -22,14 +17,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</resultMap>
|
||||
|
||||
<sql id="selectTgMessageInfoVo">
|
||||
select id_tg_message_info, message_info, message_type, chat_id, interval_time, begin_time, next_run_time, execution_stragy, status, create_by, create_time, update_by, update_time, remark from tg_message_info
|
||||
select id_tg_message_info,message_abbr_name, message_info, message_type,create_by, create_time, update_by, update_time, remark from tg_message_info t1
|
||||
</sql>
|
||||
|
||||
<select id="selectTgMessageInfoList" parameterType="TgMessageInfo" resultMap="TgMessageInfoResult">
|
||||
<include refid="selectTgMessageInfoVo"/>
|
||||
<where>
|
||||
<if test="messageType != null "> and message_type = #{messageType}</if>
|
||||
<if test="status != null "> and status = #{status}</if>
|
||||
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
|
||||
</where>
|
||||
</select>
|
||||
|
@ -38,52 +32,41 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
<include refid="selectTgMessageInfoVo"/>
|
||||
where id_tg_message_info = #{idTgMessageInfo}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<insert id="insertTgMessageInfo" parameterType="TgMessageInfo" useGeneratedKeys="true" keyProperty="idTgMessageInfo">
|
||||
insert into tg_message_info
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="messageAbbrName != null">message_abbr_name,</if>
|
||||
<if test="messageInfo != null">message_info,</if>
|
||||
<if test="messageType != null">message_type,</if>
|
||||
<if test="chatId != null">chat_id,</if>
|
||||
<if test="intervalTime != null">interval_time,</if>
|
||||
<if test="beginTime != null">begin_time,</if>
|
||||
<if test="nextRunTime != null">next_run_time,</if>
|
||||
<if test="executionStragy != null">execution_stragy,</if>
|
||||
<if test="status != null">status,</if>
|
||||
|
||||
<if test="createBy != null">create_by,</if>
|
||||
<if test="createTime != null">create_time,</if>
|
||||
<if test="updateBy != null">update_by,</if>
|
||||
<if test="updateTime != null">update_time,</if>
|
||||
<if test="remark != null">remark,</if>
|
||||
</trim>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="messageAbbrName != null">#{messageAbbrName},</if>
|
||||
<if test="messageInfo != null">#{messageInfo},</if>
|
||||
<if test="messageType != null">#{messageType},</if>
|
||||
<if test="chatId != null">#{chatId},</if>
|
||||
<if test="intervalTime != null">#{intervalTime},</if>
|
||||
<if test="beginTime != null">#{beginTime},</if>
|
||||
<if test="nextRunTime != null">#{nextRunTime},</if>
|
||||
<if test="executionStragy != null">#{executionStragy},</if>
|
||||
<if test="status != null">#{status},</if>
|
||||
|
||||
<if test="createBy != null">#{createBy},</if>
|
||||
<if test="createTime != null">#{createTime},</if>
|
||||
<if test="updateBy != null">#{updateBy},</if>
|
||||
<if test="updateTime != null">#{updateTime},</if>
|
||||
<if test="remark != null">#{remark},</if>
|
||||
</trim>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateTgMessageInfo" parameterType="TgMessageInfo">
|
||||
update tg_message_info
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="messageAbbrName != null">message_abbr_name = #{messageAbbrName},</if>
|
||||
<if test="messageInfo != null">message_info = #{messageInfo},</if>
|
||||
<if test="messageType != null">message_type = #{messageType},</if>
|
||||
<if test="chatId != null">chat_id = #{chatId},</if>
|
||||
<if test="intervalTime != null">interval_time = #{intervalTime},</if>
|
||||
<if test="beginTime != null">begin_time = #{beginTime},</if>
|
||||
<if test="nextRunTime != null">next_run_time = #{nextRunTime},</if>
|
||||
<if test="executionStragy != null">execution_stragy = #{executionStragy},</if>
|
||||
<if test="status != null">status = #{status},</if>
|
||||
|
||||
<if test="createBy != null">create_by = #{createBy},</if>
|
||||
<if test="createTime != null">create_time = #{createTime},</if>
|
||||
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||
|
@ -104,4 +87,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
</foreach>
|
||||
</delete>
|
||||
|
||||
<select id="selectTopicTgMessageInfoList" resultMap="TgMessageInfoResult">
|
||||
<include refid="selectTgMessageInfoVo"/>
|
||||
where message_type in ('1','2','3')
|
||||
<!-- and not exists (select 1 from tg_message_task t where t.id_tg_message_info = t1.id_tg_message_info)-->
|
||||
</select>
|
||||
</mapper>
|
|
@ -0,0 +1,240 @@
|
|||
<?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.ruoyi.system.mapper.TgMessageTaskMapper">
|
||||
|
||||
<resultMap type="TgMessageTask" id="TgMessageTaskResult">
|
||||
<result property="idTgMessageTask" column="id_tg_message_task"/>
|
||||
<result property="idTgMessageInfo" column="id_tg_message_info"/>
|
||||
<result property="chatIds" column="chat_ids"/>
|
||||
<result property="intervalTime" column="interval_time"/>
|
||||
<result property="beginTime" column="begin_time"/>
|
||||
<result property="nextRunTime" column="next_run_time"/>
|
||||
<result property="executionStragy" column="execution_stragy"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="remark" column="remark"/>
|
||||
</resultMap>
|
||||
|
||||
<sql id="selectTgMessageTaskVo">
|
||||
select id_tg_message_task,
|
||||
id_tg_message_info,
|
||||
chat_ids,
|
||||
interval_time,
|
||||
begin_time,
|
||||
next_run_time,
|
||||
execution_stragy,
|
||||
status,
|
||||
create_by,
|
||||
create_time,
|
||||
update_by,
|
||||
update_time,
|
||||
remark
|
||||
from tg_message_task
|
||||
</sql>
|
||||
|
||||
<select id="selectTgMessageTaskList" parameterType="TgMessageTask" resultMap="TgMessageTaskResult">
|
||||
<include refid="selectTgMessageTaskVo"/>
|
||||
<where>
|
||||
<if test="idTgMessageInfo != null">
|
||||
and id_tg_message_info = #{idTgMessageInfo}
|
||||
</if>
|
||||
<if test="chatIds != null and chatIds != ''">
|
||||
and chat_ids = #{chatIds}
|
||||
</if>
|
||||
<if test="intervalTime != null and intervalTime != ''">
|
||||
and interval_time = #{intervalTime}
|
||||
</if>
|
||||
<if test="beginTime != null">
|
||||
and begin_time = #{beginTime}
|
||||
</if>
|
||||
<if test="nextRunTime != null">
|
||||
and next_run_time = #{nextRunTime}
|
||||
</if>
|
||||
<if test="executionStragy != null">
|
||||
and execution_stragy = #{executionStragy}
|
||||
</if>
|
||||
<if test="status != null">
|
||||
and status = #{status}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="selectTgMessageTaskByIdTgMessageTask" parameterType="Long" resultMap="TgMessageTaskResult">
|
||||
<include refid="selectTgMessageTaskVo"/>
|
||||
where id_tg_message_task = #{idTgMessageTask}
|
||||
</select>
|
||||
|
||||
<insert id="insertTgMessageTask" parameterType="TgMessageTask" useGeneratedKeys="true"
|
||||
keyProperty="idTgMessageTask">
|
||||
insert into tg_message_task
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="idTgMessageInfo != null">
|
||||
id_tg_message_info,
|
||||
</if>
|
||||
<if test="chatIds != null">
|
||||
chat_ids,
|
||||
</if>
|
||||
<if test="intervalTime != null">
|
||||
interval_time,
|
||||
</if>
|
||||
<if test="beginTime != null">
|
||||
begin_time,
|
||||
</if>
|
||||
<if test="nextRunTime != null">
|
||||
next_run_time,
|
||||
</if>
|
||||
<if test="executionStragy != null">
|
||||
execution_stragy,
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status,
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
create_by,
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
update_by,
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="idTgMessageInfo != null">
|
||||
#{idTgMessageInfo},
|
||||
</if>
|
||||
<if test="chatIds != null">
|
||||
#{chatIds},
|
||||
</if>
|
||||
<if test="intervalTime != null">
|
||||
#{intervalTime},
|
||||
</if>
|
||||
<if test="beginTime != null">
|
||||
#{beginTime},
|
||||
</if>
|
||||
<if test="nextRunTime != null">
|
||||
#{nextRunTime},
|
||||
</if>
|
||||
<if test="executionStragy != null">
|
||||
#{executionStragy},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
#{status},
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
#{remark},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<update id="updateTgMessageTask" parameterType="TgMessageTask">
|
||||
update tg_message_task
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="idTgMessageInfo != null">
|
||||
id_tg_message_info = #{idTgMessageInfo},
|
||||
</if>
|
||||
<if test="chatIds != null">
|
||||
chat_ids = #{chatIds},
|
||||
</if>
|
||||
<if test="intervalTime != null">
|
||||
interval_time = #{intervalTime},
|
||||
</if>
|
||||
<if test="beginTime != null">
|
||||
begin_time = #{beginTime},
|
||||
</if>
|
||||
<if test="nextRunTime != null">
|
||||
next_run_time = #{nextRunTime},
|
||||
</if>
|
||||
<if test="executionStragy != null">
|
||||
execution_stragy = #{executionStragy},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="createBy != null">
|
||||
create_by = #{createBy},
|
||||
</if>
|
||||
<if test="createTime != null">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="updateBy != null">
|
||||
update_by = #{updateBy},
|
||||
</if>
|
||||
<if test="updateTime != null">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="remark != null">
|
||||
remark = #{remark},
|
||||
</if>
|
||||
</trim>
|
||||
where id_tg_message_task = #{idTgMessageTask}
|
||||
</update>
|
||||
|
||||
<delete id="deleteTgMessageTaskByIdTgMessageTask" parameterType="Long">
|
||||
delete
|
||||
from tg_message_task
|
||||
where id_tg_message_task = #{idTgMessageTask}
|
||||
</delete>
|
||||
|
||||
<delete id="deleteTgMessageTaskByIdTgMessageTasks" parameterType="String">
|
||||
delete
|
||||
from tg_message_task where id_tg_message_task in
|
||||
<foreach item="idTgMessageTask" collection="array" open="(" separator="," close=")">
|
||||
#{idTgMessageTask}
|
||||
</foreach>
|
||||
</delete>
|
||||
|
||||
<resultMap id="selectTgMessageTaskAndInfoListResultMap" type="com.ruoyi.system.domain.TgMessageInfoTask">
|
||||
<result column="id_tg_message_task" property="idTgMessageTask"/>
|
||||
<result column="id_tg_message_info" property="idTgMessageInfo"/>
|
||||
<result column="chat_ids" property="chatIds"/>
|
||||
<result column="interval_time" property="intervalTime"/>
|
||||
<result column="begin_time" property="beginTime"/>
|
||||
<result column="next_run_time" property="nextRunTime"/>
|
||||
<result column="execution_stragy" property="executionStragy"/>
|
||||
<result column="status" property="status"/>
|
||||
<result column="message_info" property="messageInfo"/>
|
||||
<result column="message_type" property="messageType"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectTgMessageTaskAndInfoList" resultMap="selectTgMessageTaskAndInfoListResultMap">
|
||||
select tt.id_tg_message_task ,
|
||||
tt.id_tg_message_info,
|
||||
tt.chat_ids,
|
||||
tt.interval_time,
|
||||
tt.begin_time,
|
||||
tt.next_run_time,
|
||||
tt.execution_stragy,
|
||||
tt.status,
|
||||
tmi.message_info,
|
||||
tmi.message_type
|
||||
from tg_message_task tt,
|
||||
tg_message_info tmi
|
||||
where tt.id_tg_message_info = tmi.id_tg_message_info
|
||||
and tt.status = #{status}
|
||||
and (next_run_time <= #{nextRunTime} or (begin_time <= #{nextRunTime} and execution_stragy = 1))
|
||||
</select>
|
||||
</mapper>
|
Loading…
Reference in New Issue