实现tg会员批量充值代码

pull/520/head
dorion 2024-05-11 13:14:36 +08:00
parent f6d6b7b198
commit b5737a75c4
46 changed files with 2112 additions and 161 deletions

View File

@ -0,0 +1,152 @@
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.TgPremiumOrderInfo;
import com.ruoyi.common.core.domain.vo.TgPremiumOrderInfoMultiVO;
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.ITgPremiumOrderInfoService;
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;
/**
* TGController
*
* @author dorion
* @date 2024-05-04
*/
@Controller
@RequestMapping("/tg/recharge")
public class TgPremiumOrderInfoController extends BaseController
{
private String prefix = "tg/recharge";
@Autowired
private ITgPremiumOrderInfoService tgPremiumOrderInfoService;
@RequiresPermissions("tg:recharge:view")
@GetMapping()
public String recharge()
{
return prefix + "/recharge";
}
/**
* TG
*/
@RequiresPermissions("tg:recharge:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(TgPremiumOrderInfo tgPremiumOrderInfo)
{
startPage();
List<TgPremiumOrderInfo> list = tgPremiumOrderInfoService.selectTgPremiumOrderInfoList(tgPremiumOrderInfo);
return getDataTable(list);
}
/**
* TG
*/
@RequiresPermissions("tg:recharge:export")
@Log(title = "TG会员充值", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(TgPremiumOrderInfo tgPremiumOrderInfo)
{
List<TgPremiumOrderInfo> list = tgPremiumOrderInfoService.selectTgPremiumOrderInfoList(tgPremiumOrderInfo);
ExcelUtil<TgPremiumOrderInfo> util = new ExcelUtil<TgPremiumOrderInfo>(TgPremiumOrderInfo.class);
return util.exportExcel(list, "TG会员充值数据");
}
/**
* TG
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* TG
*/
@RequiresPermissions("tg:recharge:add")
@Log(title = "TG会员充值", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(TgPremiumOrderInfo tgPremiumOrderInfo)
{
return toAjax(tgPremiumOrderInfoService.insertTgPremiumOrderInfo(tgPremiumOrderInfo));
}
/**
* TG
*/
@RequiresPermissions("tg:recharge:add")
@Log(title = "TG会员批量充值", businessType = BusinessType.INSERT)
@PostMapping("/addMultiple")
@ResponseBody
public AjaxResult addSaveMultiple(TgPremiumOrderInfoMultiVO tgPremiumOrderInfoMultiVO)
{
return toAjax(tgPremiumOrderInfoService.insertTgPremiumOrderInfoMultiVO(tgPremiumOrderInfoMultiVO));
}
/**
* TG
*/
@RequiresPermissions("tg:recharge:edit")
@GetMapping("/edit/{idTgPremiumOrderInfo}")
public String edit(@PathVariable("idTgPremiumOrderInfo") Long idTgPremiumOrderInfo, ModelMap mmap)
{
TgPremiumOrderInfo tgPremiumOrderInfo = tgPremiumOrderInfoService.selectTgPremiumOrderInfoByIdTgPremiumOrderInfo(idTgPremiumOrderInfo);
mmap.put("tgPremiumOrderInfo", tgPremiumOrderInfo);
return prefix + "/edit";
}
/**
* TG
*/
@RequiresPermissions("tg:recharge:edit")
@Log(title = "TG会员充值", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(TgPremiumOrderInfo tgPremiumOrderInfo)
{
return toAjax(tgPremiumOrderInfoService.updateTgPremiumOrderInfo(tgPremiumOrderInfo));
}
/**
* TG
*/
@RequiresPermissions("tg:recharge:remove")
@Log(title = "TG会员充值", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(tgPremiumOrderInfoService.deleteTgPremiumOrderInfoByIdTgPremiumOrderInfos(ids));
}
/**
* TG
*/
@RequiresPermissions("tg:recharge:add")
@Log(title = "TG会员充值", businessType = BusinessType.ACTIVE_DATA)
@PostMapping( "/activeData")
@ResponseBody
public AjaxResult activeData(String ids)
{
return toAjax(tgPremiumOrderInfoService.activeDataByIdTgPremiumOrderInfos(ids));
}
}

View File

@ -34,7 +34,7 @@ server:
# 日志配置
logging:
level:
com.ruoyi: debug
com.ruoyi: info
org.springframework: warn
# 用户配置

View File

@ -1115,6 +1115,18 @@ var table = {
$.operate.submit(url, "post", "json", data);
}
});
}, activeDataAll: function() {
table.set();
var rows = $.common.isEmpty(table.options.uniqueId) ? $.table.selectFirstColumns() : $.table.selectColumns(table.options.uniqueId);
if (rows.length == 0) {
$.modal.alertWarning("请至少选择一条记录");
return;
}
$.modal.confirm("确认要开通/激活选中的" + rows.length + "条数据吗?", function() {
var url = table.options.activeDataUrl;
var data = { "ids": rows.join() };
$.operate.submit(url, "post", "json", data);
});
},
// 删除信息
remove: function(id) {

View File

@ -0,0 +1,53 @@
<!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" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-recharge-add">
<div class="form-group">
<label class="col-sm-3 control-label">tg用户列表</label>
<div class="col-sm-8" >
<textarea name="tgPremiumOrderInfo" class="form-control" style="height: 200px"></textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否立刻开通:</label>
<div class="col-sm-8">
<select name="isJoindNow" class="form-control m-b" th:with="type=${@dict.getType('sys_yes_no')}">
<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">售出金额(USDT)</label>
<div class="col-sm-8">
<input name="orderAmount" class="form-control" type="text">
</div>
</div>-->
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "tg/recharge"
$("#form-recharge-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/addMultiple", $('#form-recharge-add').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,54 @@
<!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" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-recharge-edit" th:object="${tgPremiumOrderInfo}">
<input name="idTgPremiumOrderInfo" th:field="*{idTgPremiumOrderInfo}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">tg用户名</label>
<div class="col-sm-8">
<input name="rechargeTgUserName" th:field="*{rechargeTgUserName}" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">开通时长:</label>
<div class="col-sm-8">
<select name="months" class="form-control m-b" th:with="type=${@dict.getType('sys_tg_recharge_moths')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{months}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">是否到账:</label>
<div class="col-sm-8">
<select name="isPaid" class="form-control m-b" th:with="type=${@dict.getType('sys_is_paid')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{isPaid}"></option>
</select>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: datetimepicker-js" />
<script th:inline="javascript">
var prefix = ctx + "tg/recharge";
$("#form-recharge-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-recharge-edit').serialize());
}
}
</script>
</body>
</html>

View File

@ -0,0 +1,188 @@
<!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用户名</label>
<input type="text" name="rechargeTgUserName"/>
</li>
<li>
<label>是否到账:</label>
<select name="isPaid" th:with="type=${@dict.getType('sys_yes_no')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>交易账户:</label>
<input type="text" name="fromAddress"/>
</li>
<li>
<label>创建时间:</label>
<input type="text" class="time-input" placeholder="请选择创建时间" name="fcd"/>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</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:recharge:add">
<i class="fa fa-plus"></i> 添加
</a>
<!-- <a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="tg:recharge:edit">
<i class="fa fa-edit"></i> 修改
</a>-->
<a class="btn btn-primary multiple disabled" onclick="$.operate.activeDataAll()" shiro:hasPermission="tg:recharge:edit">
<i class="fa fa-edit"></i> 开通
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="tg:recharge:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="tg:recharge: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:recharge:edit')}]];
var removeFlag = [[${@permission.hasPermi('tg:recharge:remove')}]];
var monthsDatas = [[${@dict.getType('sys_tg_recharge_moths')}]];
var isPaidDatas = [[${@dict.getType('sys_is_paid')}]];
var sysTgPaymentStatusDatas = [[${@dict.getType('sys_tg_payment_status')}]];
var prefix = ctx + "tg/recharge";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
activeDataUrl: prefix + "/activeData",
modalName: "TG会员充值",
columns: [{
checkbox: true
},
{
field: 'idTgPremiumOrderInfo',
title: '主键',
visible: false
},
{
field: 'rechargeTgUserName',
title: 'TG用户名'
},
{
field: 'months',
title: '开通时长', formatter: function(value, row, index) {
return $.table.selectDictLabel(monthsDatas, value);
}
},
{
field: 'actualAmount',
title: '支付金额',
formatter: function(value, row, index) {
if (value == null) {
return value;
}
return value + ' TON';
}
},
{
field: 'idTg',
title: 'tg订单id',
visible: false
},
{
field: 'tgPaymentStatus',
title: 'tg支付状态',
formatter: function(value, row, index) {
return $.table.selectDictLabel(sysTgPaymentStatusDatas, value);
},
},
{
field: 'orderAmount',
title: '售出金额',
formatter: function(value, row, index) {
if (value == null) {
return value;
}
return value + ' USDT';
},
visible: false
},
{
field: 'isPaid',
title: '是否到账',
formatter: function(value, row, index) {
return $.table.selectDictLabel(isPaidDatas, value);
},
visible: false
},
{
field: 'fromAddress',
title: '交易账户',
visible: false
},
{
field: 'txId',
title: '交易id',
visible: false
},
{
field: 'fcd',
title: '创建时间'
},
{
field: 'fcu',
title: '创建用户',
visible: false
},
{
field: 'lcd',
title: '更新时间',
visible: false
},
{
field: 'lcu',
title: '更新用户',
visible: false
},
{
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.idTgPremiumOrderInfo + '\')"><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.idTgPremiumOrderInfo + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

View File

@ -143,11 +143,11 @@
},
{
field: 'trxAmount',
title: '转入金额TRX'
title: '转入TRX'
},
{
field: 'delegateAmountTrx',
title: '兑换支出TRX'
title: '支出TRX'
},
{
field: 'delegateTxId',
@ -163,7 +163,7 @@
},
{
field: 'delegateStatus',
title: '资源委托状态',
title: '资源状态',
formatter: function(value, item, index) {
return $.table.selectDictLabel(datas, item.delegateStatus);
}
@ -175,8 +175,7 @@
},
{
field: 'fcd',
title: '创建时间',
visible: false
title: '创建时间'
},
/* {
field: 'fcu',

View File

@ -115,8 +115,7 @@
},
{
field: 'fcd',
title: '创建时间',
visible: false
title: '创建时间'
},
{
field: 'fcu',
@ -125,8 +124,7 @@
},
{
field: 'lcd',
title: '更新时间',
visible: false
title: '更新时间'
},
{
field: 'lcu',

View File

@ -1,5 +1,8 @@
package com.ruoyi.common.constant;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
/**
@ -119,4 +122,7 @@ public class Constants
*/
public static final String[] JOB_ERROR_STR = { "java.net.URL", "javax.naming.InitialContext", "org.yaml.snakeyaml",
"org.springframework", "org.apache", "com.ruoyi.common.utils.file", "com.ruoyi.common.config", "com.ruoyi.generator" };
public static final List<String> MONTHS = Arrays.asList("3", "6", "12");
}

View File

@ -0,0 +1,87 @@
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 lombok.Data;
import lombok.experimental.Accessors;
import java.math.BigDecimal;
import java.util.Date;
/**
* TG tg_premium_order_info
*
* @author dorion
* @date 2024-05-04
*/
@Data
@Accessors(chain = true)
public class TgPremiumOrderInfo extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键 */
private Long idTgPremiumOrderInfo;
/** tg用户名 */
@Excel(name = "tg用户名")
private String rechargeTgUserName;
/** 开通时长 */
@Excel(name = "开通时长")
private Long months;
/** 支付金额(TON) */
@Excel(name = "支付金额(TON)")
private BigDecimal actualAmount;
/** tg订单id */
@Excel(name = "tg订单id")
private String idTg;
/** tg支付状态 */
@Excel(name = "tg支付状态")
private String tgPaymentStatus;
/** 售出金额(USDT) */
@Excel(name = "售出金额(USDT)")
private String orderAmount;
/** 是否到账 */
@Excel(name = "是否到账")
private String isPaid;
/** 交易账户 */
@Excel(name = "交易账户")
private String fromAddress;
/** 转入账户 */
@Excel(name = "转入账户")
private String toAddress;
/** 交易id */
@Excel(name = "交易id")
private Long txId;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date fcd;
/** 创建用户 */
@Excel(name = "创建用户")
private String fcu;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date lcd;
/** 更新用户 */
@Excel(name = "更新用户")
private String lcu;
}

View File

@ -62,8 +62,8 @@ public class UsdtExchangeInfo extends BaseEntity
private BigDecimal orginalExchangeRate;
/** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date fcd;
/** 创建用户 */
@ -71,8 +71,8 @@ public class UsdtExchangeInfo extends BaseEntity
private String fcu;
/** 更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date lcd;
/** 更新用户 */

View File

@ -0,0 +1,12 @@
package com.ruoyi.common.core.domain.vo;
import lombok.Data;
@Data
public class TgPremiumOrderInfoMultiVO {
private String tgPremiumOrderInfo;
private String isJoindNow;
}

View File

@ -0,0 +1,33 @@
package com.ruoyi.quartz.task;
import com.ruoyi.common.core.domain.entity.TgPremiumOrderInfo;
import com.ruoyi.system.handler.TgPremiumTransferHandler;
import com.ruoyi.system.mapper.TgPremiumOrderInfoMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.util.List;
@Component("checkFragmentPaymentStatusTask")
public class CheckFragmentPaymentStatusTask {
@Autowired
private TgPremiumOrderInfoMapper tgPremiumOrderInfoMapper;
@Autowired
private TgPremiumTransferHandler tgPremiumTransferHandler;
public void doCheckFragmentPaymentStatus() {
TgPremiumOrderInfo tgPremiumOrderInfoExample = new TgPremiumOrderInfo();
tgPremiumOrderInfoExample.setTgPaymentStatus("P");
List<TgPremiumOrderInfo> tgPremiumOrderInfos = tgPremiumOrderInfoMapper.selectTgPremiumOrderInfoList(tgPremiumOrderInfoExample);
for (TgPremiumOrderInfo tgPremiumOrderInfo : tgPremiumOrderInfos) {
tgPremiumTransferHandler.checkFragmentPaymentStatus(tgPremiumOrderInfo);
}
}
}

View File

@ -0,0 +1,21 @@
package com.ruoyi.system.api;
import com.ruoyi.common.core.domain.entity.TgPremiumOrderInfo;
import com.ruoyi.system.api.entity.fragment.*;
import java.io.IOException;
import java.math.BigDecimal;
public interface IFragmentApi {
SearchPremiumGiftRecipientResponse searchPremiumGiftRecipient(TgPremiumOrderInfo tgPremiumOrderInfo) throws IOException;
InitGiftPremiumResponse initGiftPremium(String recipient, Long months) throws IOException;
GetGiftPremiumLinkResponse getGiftPremiumLink(String reqId) throws IOException;
RawResponse rawRequest(String reqId) throws IOException;
void sendTransactions(String address, BigDecimal amount, String comment) throws IOException;
CheckReqRespose checkReq(String reqId) throws IOException;
}

View File

@ -0,0 +1,16 @@
package com.ruoyi.system.api.entity;
import com.ruoyi.system.api.entity.fragment.Messages;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class Params implements Serializable {
private static final long serialVersionUID = 1L;
private long valid_until;
private List<Messages> messages;
private String source;
}

View File

@ -0,0 +1,15 @@
package com.ruoyi.system.api.entity.fragment;
import com.ruoyi.system.api.entity.Params;
import lombok.Data;
import java.io.Serializable;
@Data
public class Body implements Serializable {
private static final long serialVersionUID = 1L;
private String type;
private Params params;
private Response_options response_options;
private long expires_sec;
}

View File

@ -0,0 +1,14 @@
package com.ruoyi.system.api.entity.fragment;
import lombok.Data;
import java.io.Serializable;
@Data
public class CheckReqRespose implements Serializable {
private static final long serialVersionUID = 1L;
private Boolean confirmed;
private String error;
}

View File

@ -0,0 +1,12 @@
package com.ruoyi.system.api.entity.fragment;
import lombok.Data;
import java.io.Serializable;
@Data
public class Check_params implements Serializable {
private static final long serialVersionUID = 1L;
private String id;
}

View File

@ -0,0 +1,11 @@
package com.ruoyi.system.api.entity.fragment;
import lombok.Data;
import java.io.Serializable;
@Data
public class Confirm_params implements Serializable {
private final static long serialVersionUID = 1L;
private String id;
}

View File

@ -0,0 +1,14 @@
package com.ruoyi.system.api.entity.fragment;
import lombok.Data;
import java.io.Serializable;
@Data
public class Found implements Serializable {
private static final long serialVersionUID = 1L;
private boolean myself;
private String recipient;
private String photo;
private String name;
}

View File

@ -0,0 +1,16 @@
package com.ruoyi.system.api.entity.fragment;
import lombok.Data;
import java.io.Serializable;
@Data
public class GetGiftPremiumLinkResponse implements Serializable {
private final static long serialVersionUID = 1L;
private boolean ok;
private String link;
private String qr_link;
private String check_method;
private Check_params check_params;
private int expire_after;
}

View File

@ -0,0 +1,17 @@
package com.ruoyi.system.api.entity.fragment;
import lombok.Data;
import java.io.Serializable;
@Data
public class InitGiftPremiumResponse implements Serializable {
private static final long serialVersionUID = 1L;
private String req_id;
private boolean myself;
private String amount;
private String item_title;
private String content;
private String button;
}

View File

@ -0,0 +1,13 @@
package com.ruoyi.system.api.entity.fragment;
import lombok.Data;
import java.io.Serializable;
@Data
public class Messages implements Serializable {
private final static long serialVersionUID = 1L;
private String address;
private long amount;
private String payload;
}

View File

@ -0,0 +1,12 @@
package com.ruoyi.system.api.entity.fragment;
import lombok.Data;
import java.io.Serializable;
@Data
public class RawResponse implements Serializable {
private static final long serialVersionUID = 1L;
private String version;
private Body body;
}

View File

@ -0,0 +1,12 @@
package com.ruoyi.system.api.entity.fragment;
import lombok.Data;
import java.io.Serializable;
@Data
public class Response_options implements Serializable {
private static final long serialVersionUID = 1L;
private String callback_url;
private boolean broadcast;
}

View File

@ -0,0 +1,13 @@
package com.ruoyi.system.api.entity.fragment;
import lombok.Data;
import java.io.Serializable;
@Data
public class SearchPremiumGiftRecipientResponse implements Serializable {
private static final long serialVersionUID = 1L;
private boolean ok;
private Found found;
}

View File

@ -0,0 +1,12 @@
package com.ruoyi.system.api.entity.fragment;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@Data
public class Transaction implements Serializable {
private final static long serialVersionUID = 1L;
private long validUntil;
private List<Messages> messages;
}

View File

@ -0,0 +1,265 @@
package com.ruoyi.system.api.impl;
import cn.hutool.json.JSONUtil;
import com.ruoyi.common.core.domain.entity.TgPremiumOrderInfo;
import com.ruoyi.system.api.IFragmentApi;
import com.ruoyi.system.api.entity.fragment.*;
import com.ruoyi.system.service.ISysConfigService;
import lombok.extern.slf4j.Slf4j;
import org.apache.http.HttpEntity;
import org.apache.http.HttpResponse;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
import org.apache.http.entity.StringEntity;
import org.apache.http.impl.client.HttpClients;
import org.apache.http.util.EntityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.math.BigDecimal;
import java.net.URLEncoder;
@Component
@Slf4j
public class FragmentApiImpl implements IFragmentApi {
@Autowired
private ISysConfigService configService;
@Override
public SearchPremiumGiftRecipientResponse searchPremiumGiftRecipient(TgPremiumOrderInfo tgPremiumOrderInfo) throws IOException {
String hash = configService.selectConfigByKey("sys.fragment.hash");
String cookie = configService.selectConfigByKey("sys.fragment.cookie");
// 设置请求URL
String url = "https://fragment.com/api?hash=" + hash;
// 创建 HttpClient 实例
HttpClient httpClient = HttpClients.createDefault();
// 创建 HttpPost 请求对象
HttpPost httpPost = new HttpPost(url);
// 设置请求头
httpPost.setHeader("Cookie", cookie);
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
// 构建请求体参数
String formBody = "query=" + tgPremiumOrderInfo.getRechargeTgUserName() + "&months=" + tgPremiumOrderInfo.getMonths() + "&method=searchPremiumGiftRecipient";
StringEntity requestEntity = new StringEntity(formBody, ContentType.APPLICATION_FORM_URLENCODED);
httpPost.setEntity(requestEntity);
// 发送请求并获取响应
HttpResponse response = httpClient.execute(httpPost);
if (response.getStatusLine().getStatusCode() != 200) {
throw new RuntimeException("searchPremiumGiftRecipient 响应码错误:" + response.getStatusLine().getStatusCode());
}
// 处理响应
HttpEntity entity = response.getEntity();
if (entity != null) {
// 将响应内容转换为字符串
String responseString = EntityUtils.toString(entity);
SearchPremiumGiftRecipientResponse searchPremiumGiftRecipientResponse = JSONUtil.toBean(responseString, SearchPremiumGiftRecipientResponse.class);
return searchPremiumGiftRecipientResponse;
}
return null;
}
@Override
public InitGiftPremiumResponse initGiftPremium(String recipient, Long months) throws IOException {
String hash = configService.selectConfigByKey("sys.fragment.hash");
String cookie = configService.selectConfigByKey("sys.fragment.cookie");
// 设置请求URL
String url = "https://fragment.com/api?hash=" + hash;
// 创建 HttpClient 实例
HttpClient httpClient = HttpClients.createDefault();
// 创建 HttpPost 请求对象
HttpPost httpPost = new HttpPost(url);
// 设置请求头
httpPost.setHeader("Cookie", cookie);
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
// 构建请求体参数
String formBody = "recipient=" + recipient + "&months=" + months + "&method=initGiftPremiumRequest";
StringEntity requestEntity = new StringEntity(formBody, ContentType.APPLICATION_FORM_URLENCODED);
httpPost.setEntity(requestEntity);
// 发送请求并获取响应
HttpResponse response = httpClient.execute(httpPost);
if (response.getStatusLine().getStatusCode() != 200) {
throw new RuntimeException("initGiftPremium 响应码错误:" + response.getStatusLine().getStatusCode());
}
// 处理响应
HttpEntity entity = response.getEntity();
if (entity != null) {
// 将响应内容转换为字符串
String responseString = EntityUtils.toString(entity);
InitGiftPremiumResponse initGiftPremiumResponse = JSONUtil.toBean(responseString, InitGiftPremiumResponse.class);
return initGiftPremiumResponse;
}
return null;
}
@Override
public GetGiftPremiumLinkResponse getGiftPremiumLink(String reqId) throws IOException {
String hash = configService.selectConfigByKey("sys.fragment.hash");
String cookie = configService.selectConfigByKey("sys.fragment.cookie");
// 设置请求URL
String url = "https://fragment.com/api?hash=" + hash;
// 创建 HttpClient 实例
HttpClient httpClient = HttpClients.createDefault();
// 创建 HttpPost 请求对象
HttpPost httpPost = new HttpPost(url);
// 设置请求头
httpPost.setHeader("Cookie", cookie);
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
// 构建请求体参数
String formBody = "id=" + reqId + "&show_sender=0&method=getGiftPremiumLink";
StringEntity requestEntity = new StringEntity(formBody, ContentType.APPLICATION_FORM_URLENCODED);
httpPost.setEntity(requestEntity);
// 发送请求并获取响应
HttpResponse response = httpClient.execute(httpPost);
if (response.getStatusLine().getStatusCode() != 200) {
throw new RuntimeException("getGiftPremiumLink 响应码错误:" + response.getStatusLine().getStatusCode());
}
// 处理响应
HttpEntity entity = response.getEntity();
if (entity != null) {
// 将响应内容转换为字符串
String responseString = EntityUtils.toString(entity);
GetGiftPremiumLinkResponse getGiftPremiumLinkResponse = JSONUtil.toBean(responseString, GetGiftPremiumLinkResponse.class);
return getGiftPremiumLinkResponse;
}
return null;
}
@Override
public RawResponse rawRequest(String reqId) throws IOException {
String cookie = configService.selectConfigByKey("sys.fragment.cookie");
// 设置请求URL
String url = "https://fragment.com/tonkeeper/rawRequest?id=" + reqId + "&qr=1";
// 创建 HttpClient 实例
HttpClient httpClient = HttpClients.createDefault();
// 创建 HttpPost 请求对象
HttpPost httpPost = new HttpPost(url);
// 设置请求头
httpPost.setHeader("Cookie", cookie);
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
// 构建请求体参数
String formBody = "id=" + reqId + "&show_sender=1&method=getGiftPremiumLink";
StringEntity requestEntity = new StringEntity(formBody, ContentType.APPLICATION_FORM_URLENCODED);
httpPost.setEntity(requestEntity);
// 发送请求并获取响应
HttpResponse response = httpClient.execute(httpPost);
if (response.getStatusLine().getStatusCode() != 200) {
throw new RuntimeException("rawRequest 响应码错误:" + response.getStatusLine().getStatusCode());
}
// 处理响应
HttpEntity entity = response.getEntity();
if (entity != null) {
// 将响应内容转换为字符串
String responseString = EntityUtils.toString(entity);
RawResponse rawResponse = JSONUtil.toBean(responseString, RawResponse.class);
return rawResponse;
}
return null;
}
@Override
public void sendTransactions(String address, BigDecimal amount, String comment) throws IOException {
// 设置请求URL
String url = "http://127.0.0.1:8888/sendTransactions?send_mode=3&comment=" + URLEncoder.encode(comment);
// 创建 HttpClient 实例
HttpClient httpClient = HttpClients.createDefault();
// 创建 HttpPost 请求对象
HttpPost httpPost = new HttpPost(url);
// 设置请求头
httpPost.setHeader("Content-Type", "application/json");
// 构建请求体参数
String formBody = "{\"" + address + "\":\"" + amount + "\"}";
StringEntity requestEntity = new StringEntity(formBody, ContentType.APPLICATION_FORM_URLENCODED);
httpPost.setEntity(requestEntity);
// 发送请求并获取响应
HttpResponse response = httpClient.execute(httpPost);
if (response.getStatusLine().getStatusCode() != 200) {
HttpEntity entity = response.getEntity();
String responseString = null;
if (entity != null) {
responseString = EntityUtils.toString(entity);
log.error("responseString:{}", responseString);
}
throw new RuntimeException("sendTransactions 响应码错误:" + response.getStatusLine().getStatusCode()+"responseString:"+responseString);
}
}
@Override
public CheckReqRespose checkReq(String reqId) throws IOException {
String hash = configService.selectConfigByKey("sys.fragment.hash");
String cookie = configService.selectConfigByKey("sys.fragment.cookie");
// 设置请求URL
String url = "https://fragment.com/api?hash=" + hash;
// 创建 HttpClient 实例
HttpClient httpClient = HttpClients.createDefault();
// 创建 HttpPost 请求对象
HttpPost httpPost = new HttpPost(url);
// 设置请求头
httpPost.setHeader("Cookie", cookie);
httpPost.setHeader("Content-Type", "application/x-www-form-urlencoded");
// 构建请求体参数
String formBody = "id=" + reqId + "&method=checkReq";
StringEntity requestEntity = new StringEntity(formBody, ContentType.APPLICATION_FORM_URLENCODED);
httpPost.setEntity(requestEntity);
// 发送请求并获取响应
HttpResponse response = httpClient.execute(httpPost);
if (response.getStatusLine().getStatusCode() != 200) {
throw new RuntimeException("checkReq 响应码错误:" + response.getStatusLine().getStatusCode());
}
// 处理响应
HttpEntity entity = response.getEntity();
if (entity != null) {
// 将响应内容转换为字符串
String responseString = EntityUtils.toString(entity);
CheckReqRespose checkReqRespose = JSONUtil.toBean(responseString, CheckReqRespose.class);
return checkReqRespose;
}
return null;
}
}

View File

@ -1,6 +1,5 @@
package com.ruoyi.system.bot;
import com.ruoyi.system.bot.handle.NewMemberIntoGroup;
import com.ruoyi.system.bot.handle.UserChatHandle;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -18,8 +17,6 @@ import java.security.NoSuchAlgorithmException;
@Slf4j
public class CustomBotFunction {
@Autowired
private NewMemberIntoGroup newMemberIntoGroup;
@Autowired
private UserChatHandle userChatHandle;

View File

@ -1,67 +1,67 @@
package com.ruoyi.system.bot.handle;
import com.ruoyi.system.bot.utils.SendContent;
import com.ruoyi.system.handler.Usdt2TrxTransferHandler;
import com.ruoyi.system.service.ISysConfigService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.text.StrSubstitutor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.ClassPathResource;
import org.springframework.stereotype.Component;
import org.telegram.telegrambots.meta.api.methods.send.SendPhoto;
import org.telegram.telegrambots.meta.api.objects.InputFile;
import org.telegram.telegrambots.meta.api.objects.Update;
import org.telegram.telegrambots.meta.bots.AbsSender;
import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
import java.io.IOException;
import java.io.InputStream;
import java.math.BigDecimal;
import java.security.InvalidKeyException;
import java.security.NoSuchAlgorithmException;
import java.util.HashMap;
import java.util.Map;
@Component
@Slf4j
public class NewMemberIntoGroup {
@Autowired
private SendContent sendContent;
@Autowired
private ISysConfigService configService;
@Autowired
private Usdt2TrxTransferHandler usdt2TrxTransferHandlerl;
public void handleMessage(AbsSender sender, Update update) throws TelegramApiException, IOException, NoSuchAlgorithmException, InvalidKeyException {
InputStream inputStream =
new ClassPathResource("pbottleRPA_1681804582722.png").getInputStream();
Long chatId = update.getChatMember().getChat().getId();
String sysUsdtGroupWelcomTopic = configService.selectConfigByKey("sys.usdt.group.welcom.topic");
String sysTgGroupChatId = configService.selectConfigByKey("sys.tg.group.chat.id");
if (StringUtils.isNotEmpty(sysUsdtGroupWelcomTopic) && StringUtils.isNotEmpty(sysTgGroupChatId)){
BigDecimal oneUsdtToTrx = usdt2TrxTransferHandlerl.getOneUsdtToTrx();
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(sysUsdtGroupWelcomTopic);
SendPhoto sendPhoto = SendPhoto.builder()
.chatId(chatId.toString())
.photo(new InputFile(inputStream, "aaa.png"))
.caption(message).build();
sender.execute(sendPhoto);
}else {
log.info("sysUsdtGroupWelcomTopic or sysTgGroupChatId is empty");
}
}
}
//package com.ruoyi.system.bot.handle;
//
//import com.ruoyi.system.bot.utils.SendContent;
//import com.ruoyi.system.handler.Usdt2TrxTransferHandler;
//import com.ruoyi.system.service.ISysConfigService;
//import lombok.extern.slf4j.Slf4j;
//import org.apache.commons.lang3.StringUtils;
//import org.apache.commons.lang3.text.StrSubstitutor;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.core.io.ClassPathResource;
//import org.springframework.stereotype.Component;
//import org.telegram.telegrambots.meta.api.methods.send.SendPhoto;
//import org.telegram.telegrambots.meta.api.objects.InputFile;
//import org.telegram.telegrambots.meta.api.objects.Update;
//import org.telegram.telegrambots.meta.bots.AbsSender;
//import org.telegram.telegrambots.meta.exceptions.TelegramApiException;
//
//import java.io.IOException;
//import java.io.InputStream;
//import java.math.BigDecimal;
//import java.security.InvalidKeyException;
//import java.security.NoSuchAlgorithmException;
//import java.util.HashMap;
//import java.util.Map;
//
//@Component
//@Slf4j
//public class NewMemberIntoGroup {
//
// @Autowired
// private SendContent sendContent;
// @Autowired
// private ISysConfigService configService;
// @Autowired
// private Usdt2TrxTransferHandler usdt2TrxTransferHandlerl;
//
//
// public void handleMessage(AbsSender sender, Update update) throws TelegramApiException, IOException, NoSuchAlgorithmException, InvalidKeyException {
// InputStream inputStream =
// new ClassPathResource("pbottleRPA_1681804582722.png").getInputStream();
//
// Long chatId = update.getChatMember().getChat().getId();
// String sysUsdtGroupWelcomTopic = configService.selectConfigByKey("sys.usdt.group.welcom.topic");
// String sysTgGroupChatId = configService.selectConfigByKey("sys.tg.group.chat.id");
//
//
//
// if (StringUtils.isNotEmpty(sysUsdtGroupWelcomTopic) && StringUtils.isNotEmpty(sysTgGroupChatId)){
// BigDecimal oneUsdtToTrx = usdt2TrxTransferHandlerl.getOneUsdtToTrx();
//
// 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(sysUsdtGroupWelcomTopic);
// SendPhoto sendPhoto = SendPhoto.builder()
// .chatId(chatId.toString())
// .photo(new InputFile(inputStream, "aaa.png"))
// .caption(message).build();
//
// sender.execute(sendPhoto);
// }else {
// log.info("sysUsdtGroupWelcomTopic or sysTgGroupChatId is empty");
// }
//
// }
//}

View File

@ -48,7 +48,7 @@ public class UserChatHandle {
configValue = StringUtils.isEmpty(configValue) ? "configKey is null" : configValue;
String message = "";
if (StringUtils.isNotEmpty(configValue)){
BigDecimal tenUsdtToTrx = usdt2TrxTransferHandler.getOneUsdtToTrx().multiply(BigDecimal.TEN);
BigDecimal tenUsdtToTrx = usdt2TrxTransferHandler.getOneUsdtToTrx().getFirst().multiply(BigDecimal.TEN);
Map<String, Object> arguments = new HashMap<>();
arguments.put("tenUsdtToTrx", tenUsdtToTrx);
StrSubstitutor substitutor = new StrSubstitutor(arguments, "{", "}");

View File

@ -8,8 +8,8 @@ import com.ruoyi.common.utils.DictUtils;
import com.ruoyi.common.utils.ForwardCounter;
import com.ruoyi.common.utils.LogUtils;
import com.ruoyi.system.domain.TrxExchangeMonitorAccountInfo;
import com.ruoyi.system.mapper.ErrorLogMapper;
import com.ruoyi.system.mapper.TrxExchangeInfoMapper;
import com.ruoyi.system.service.IErrorLogService;
import com.ruoyi.system.service.ITenantInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@ -29,8 +29,9 @@ public class EnergyTenantTransferHandler {
private UndelegateEnergyHandler undelegateEnergyHandler;
@Autowired
private ITenantInfoService tenantInfoService;
@Autowired
private ErrorLogMapper errorLogMapper;
private IErrorLogService errorLogService;
/**
*
@ -65,7 +66,7 @@ public class EnergyTenantTransferHandler {
.errorMsg(exceptionString.length() > 2000 ? exceptionString.substring(0, 2000) : exceptionString)
.fcu("system")
.lcu("system").build();
errorLogMapper.insertErrorLog(errorLog);
errorLogService.insertErrorLog(errorLog);
throw new RuntimeException(e);
}

View File

@ -21,9 +21,9 @@ import com.ruoyi.system.dto.Contract;
import com.ruoyi.system.dto.Data;
import com.ruoyi.system.dto.TronGridResponse;
import com.ruoyi.system.dto.Value;
import com.ruoyi.system.mapper.ErrorLogMapper;
import com.ruoyi.system.mapper.TenantInfoMapper;
import com.ruoyi.system.mapper.TrxExchangeInfoMapper;
import com.ruoyi.system.service.IErrorLogService;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.util.AddressUtil;
import lombok.extern.slf4j.Slf4j;
@ -65,14 +65,15 @@ public class TRX2EneryTransferHandler {
private RedisTemplate redisTemplate;
@Autowired
private RedissonClient redissonClient;
@Autowired
private ErrorLogMapper errorLogMapper;
@Autowired
private TenantInfoMapper tenantInfoMapper;
@Autowired
private TrxExchangeInfoMapper trxExchangeInfoMapper;
@Autowired
private SendContent sendContent;
@Autowired
private IErrorLogService errorLogService;
public void doMonitorTrxTransferByMonitorAddressInfo(MonitorAddressAccount monitorAddressAccount) {
@ -94,8 +95,7 @@ public class TRX2EneryTransferHandler {
.errorMsg(exceptionString.length() > 2000 ? exceptionString.substring(0, 2000) : exceptionString)
.fcu("system")
.lcu("system").build();
errorLogMapper.insertErrorLog(errorLog);
errorLogService.insertErrorLog(errorLog);
}
Object responseEntityBody = getResponseEntityBody(responseEntity, monitorAddress);
@ -147,7 +147,7 @@ public class TRX2EneryTransferHandler {
.fcu("system")
.lcu("system").build();
errorLogMapper.insertErrorLog(errorLog);
errorLogService.insertErrorLog(errorLog);
// throw new RuntimeException("doDelegateResource业务处理异常", e);
} finally {
if (lock.isLocked()) {
@ -262,7 +262,7 @@ public class TRX2EneryTransferHandler {
.trxId(txID)
.fcu("system")
.lcu("system").build();
errorLogMapper.insertErrorLog(errorLog);
errorLogService.insertErrorLog(errorLog);
return;
}
tenantInfo.setIsPaid("Y");

View File

@ -0,0 +1,323 @@
package com.ruoyi.system.handler;
import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil;
import com.ruoyi.common.core.domain.entity.ErrorLog;
import com.ruoyi.common.core.domain.entity.TgPremiumOrderInfo;
import com.ruoyi.common.utils.ForwardCounter;
import com.ruoyi.common.utils.LogUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.api.IFragmentApi;
import com.ruoyi.system.api.entity.Params;
import com.ruoyi.system.api.entity.fragment.*;
import com.ruoyi.system.mapper.TgPremiumOrderInfoMapper;
import com.ruoyi.system.service.IErrorLogService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.Base64;
import java.util.Date;
import java.util.List;
@Component
@Slf4j
public class TgPremiumTransferHandler {
@Autowired
private IFragmentApi fragmentApi;
@Autowired
private IErrorLogService errorLogService;
@Autowired
private TgPremiumOrderInfoMapper tgPremiumOrderInfoMapper;
public void doRechargeAndUpdate(TgPremiumOrderInfo tgPremiumOrderInfo) {
doRecharge(tgPremiumOrderInfo);
tgPremiumOrderInfo.setLcu("syste");
tgPremiumOrderInfoMapper.updateTgPremiumOrderInfo(tgPremiumOrderInfo);
}
private void doRecharge(TgPremiumOrderInfo tgPremiumOrderInfo) {
String comment = null;
String address = null;
Long amount = null;
Integer count = 0;
do {
try {
SearchPremiumGiftRecipientResponse searchPremiumGiftRecipientResponse = fragmentApi.searchPremiumGiftRecipient(tgPremiumOrderInfo);
String recipient = recipient(searchPremiumGiftRecipientResponse);
//创建订单
InitGiftPremiumResponse initGiftPremiumResponse = fragmentApi.initGiftPremium(recipient, tgPremiumOrderInfo.getMonths());
String reqId = reqId(initGiftPremiumResponse);
//确认订单
GetGiftPremiumLinkResponse getGiftPremiumLinkResponse = fragmentApi.getGiftPremiumLink(reqId);
//获取收款地址和payload参数
RawResponse response = fragmentApi.rawRequest(reqId);
Messages message = messages(response);
address = message.getAddress();
String payload = message.getPayload();
// comment = extractRefFromPayload(payload, tgPremiumOrderInfo.getMonths());
//
comment = constructComment(payload, tgPremiumOrderInfo.getMonths());
amount = message.getAmount();
BigDecimal actualAmount = BigDecimal.valueOf(amount).movePointLeft(9);
tgPremiumOrderInfo.setActualAmount(actualAmount);
tgPremiumOrderInfo.setIdTg(reqId);
} catch (Exception e) {
String exceptionString = LogUtils.doRecursiveReversePrintStackCause(e, 5, ForwardCounter.builder().count(0).build(), 5);
log.error("fragment_error:{}", exceptionString);
ErrorLog errorLog = ErrorLog.builder()
.address(tgPremiumOrderInfo.getRechargeTgUserName())
.otherId(String.valueOf(tgPremiumOrderInfo.getIdTgPremiumOrderInfo()))
.errorCode("fragment_error")
.errorMsg(exceptionString.length() > 2000 ? exceptionString.substring(0, 2000) : exceptionString)
.fcu("system")
.lcu("system").build();
errorLogService.insertErrorLog(errorLog);
if (count >= 5) {
break;
}
count++;
}
} while (comment == null);
if (count < 5) {
count = 0;
do {
try {
// BigDecimal actualAmount = BigDecimal.valueOf(amount).movePointLeft(9);
fragmentApi.sendTransactions(address, tgPremiumOrderInfo.getActualAmount(), comment);
tgPremiumOrderInfo.setTgPaymentStatus("P");
// tgPremiumOrderInfo.setActualAmount(actualAmount);
break;
} catch (Exception e) {
String exceptionString = LogUtils.doRecursiveReversePrintStackCause(e, 5, ForwardCounter.builder().count(0).build(), 5);
log.error("go_sendTransactions_error:{}", exceptionString);
ErrorLog errorLog = ErrorLog.builder()
.address(tgPremiumOrderInfo.getRechargeTgUserName())
.otherId(String.valueOf(tgPremiumOrderInfo.getIdTgPremiumOrderInfo()))
.errorCode("go_sendTransactions_error")
.errorMsg(exceptionString.length() > 2000 ? exceptionString.substring(0, 2000) : exceptionString)
.fcu("system")
.lcu("system").build();
errorLogService.insertErrorLog(errorLog);
count++;
}
} while (count < 5);
}
tgPremiumOrderInfo.setTgPaymentStatus("E");
}
private static Messages messages(RawResponse response) {
if (response == null) {
throw new RuntimeException("response is null");
}
Body body = response.getBody();
if (body == null) {
throw new RuntimeException("body is null");
}
Params params = body.getParams();
if (params == null) {
throw new RuntimeException("params is null");
}
List<Messages> messages = params.getMessages();
if (messages == null || messages.size() == 0) {
throw new RuntimeException("params.getMessages() is null");
}
Messages message = messages.get(0);
return message;
}
private static String reqId(InitGiftPremiumResponse initGiftPremiumResponse) {
if (initGiftPremiumResponse == null) {
throw new RuntimeException("initGiftPremiumResponse is null");
}
String reqId = initGiftPremiumResponse.getReq_id();
if (StringUtils.isBlank(reqId)) {
throw new RuntimeException("reqId is null");
}
return reqId;
}
private static String recipient(SearchPremiumGiftRecipientResponse searchPremiumGiftRecipientResponse) {
if (searchPremiumGiftRecipientResponse == null) {
throw new RuntimeException("searchPremiumGiftRecipientResponse is null");
}
if (!searchPremiumGiftRecipientResponse.isOk()) {
throw new RuntimeException("searchPremiumGiftRecipientResponse is not ok,请检查用户信息");
}
Found found = searchPremiumGiftRecipientResponse.getFound();
if (found == null) {
throw new RuntimeException("found is null");
}
//获取用户信息
String recipient = found.getRecipient();
return recipient;
}
public static String constructComment(String payload, Long premium_package_month) {
byte[] decodedBytes = Base64.getDecoder().decode(payload);
String decodedString = new String(decodedBytes);
log.info("decodedString:{}", decodedString);
// 使用 "#" 分割字符串
String[] parts = decodedString.split("#");
String base32_1 = parts.length > 1 ? parts[1] : "";
// 移除 base32_1 中的非字母数字字符
base32_1 = base32_1.replaceAll("[^A-Za-z0-9]", "");
// 如果 base32_1 长度不是 8则重试
if (base32_1.length() != 9) {
// 在这里添加重试逻辑
log.error("长度不是 9");
return null;
}
// 构造最终订单数据
// Integer premium_package_month = 3;
// String orderData = "Telegram Premium for " + (premium_package_month == 12 ? "1 year" : premium_package_month + " months") + " Ref#" + base32_1;
String orderData = "Telegram Premium for " + (premium_package_month == 12 ? "1 year" : premium_package_month + " months") + " \n" +
"\n" +
"Ref#" + base32_1;
return orderData;
}
/* public static void main(String[] args) {
String comment = constructComment("te6ccgEBAgEANgABTgAAAABUZWxlZ3JhbSBQcmVtaXVtIGZvciAzIG1vbnRocyAKClJlZgEAFCNMa2M1MWhvZkw");
String s = extractRefFromPayload("te6ccgEBAgEANgABTgAAAABUZWxlZ3JhbSBQcmVtaXVtIGZvciAzIG1vbnRocyAKClJlZgEAFCNMa2M1MWhvZkw", tgPremiumOrderInfo.getMonths());
System.out.println(s);
}*/
public static String extractRefFromPayload(String payload, Long months) {
byte[] decodedBytes = Base64.getDecoder().decode(payload);
String decodedPayloadStr = new String(decodedBytes);
log.info("decodedPayloadStr:{}", decodedPayloadStr);
// String decodedPayloadStr = payload;
String refStr = null;
int index = decodedPayloadStr.indexOf("#");
if (index != -1) {
StringBuilder sb = new StringBuilder();
// 开始从 "#" 之后的位置提取字符最多提取8个字符
for (int i = index + 1; i < decodedPayloadStr.length() && sb.length() < 9; i++) {
char c = decodedPayloadStr.charAt(i);
if (Character.isLetterOrDigit(c)) {
sb.append(c);
}
}
refStr = sb.toString();
// String orderData = "Telegram Premium for " + (months == 12 ? "1 year" : months + " months") + " Ref#" + refStr;
String orderData = "Telegram Premium for " + (months == 12 ? "1 year" : months + " months") + " \n" +
"\n" +
"Ref#" + refStr;
return orderData;
}
return refStr;
}
public void checkFragmentPaymentStatus(TgPremiumOrderInfo tgPremiumOrderInfo) {
try {
CheckReqRespose checkReqRespose = fragmentApi.checkReq(tgPremiumOrderInfo.getIdTg());
if (checkReqRespose == null){
log.error("checkReqRespose is null");
return;
}
Boolean confirmed = checkReqRespose.getConfirmed();
if (confirmed != null && confirmed){
log.error("confirmed is null");
tgPremiumOrderInfo.setTgPaymentStatus("Y");
tgPremiumOrderInfo.setLcu("system");
tgPremiumOrderInfoMapper.updateTgPremiumOrderInfo(tgPremiumOrderInfo);
}else {
String error = checkReqRespose.getError();
if (StringUtils.isNotBlank(error)){
log.error("checkFragmentPaymentStatus_error_return:{}", error);
tgPremiumOrderInfo.setTgPaymentStatus("E");
tgPremiumOrderInfoMapper.updateTgPremiumOrderInfo(tgPremiumOrderInfo);
ErrorLog errorLog = ErrorLog.builder()
.address(tgPremiumOrderInfo.getRechargeTgUserName())
.otherId(String.valueOf(tgPremiumOrderInfo.getIdTgPremiumOrderInfo()))
.errorCode("checkFragmentPaymentStatus_error_return")
.errorMsg(error)
.fcu("system")
.lcu("system").build();
errorLogService.insertErrorLog(errorLog);
}else {
Date fcd = tgPremiumOrderInfo.getFcd();
long betweenMinutes = DateUtil.between(fcd, new Date(), DateUnit.MINUTE);
if (betweenMinutes >= 10){
log.error("checkFragmentPaymentStatus_error_timeout:");
tgPremiumOrderInfo.setTgPaymentStatus("E");
tgPremiumOrderInfoMapper.updateTgPremiumOrderInfo(tgPremiumOrderInfo);
ErrorLog errorLog = ErrorLog.builder()
.address(tgPremiumOrderInfo.getRechargeTgUserName())
.otherId(String.valueOf(tgPremiumOrderInfo.getIdTgPremiumOrderInfo()))
.errorCode("checkFragmentPaymentStatus_error_timeout")
.errorMsg("systemScanTimeOut")
.fcu("system")
.lcu("system").build();
errorLogService.insertErrorLog(errorLog);
}
}
}
} catch (IOException e) {
String exceptionString = LogUtils.doRecursiveReversePrintStackCause(e, 5, ForwardCounter.builder().count(0).build(), 5);
log.error("checkFragmentPaymentStatus_error:{}", exceptionString);
ErrorLog errorLog = ErrorLog.builder()
.address(tgPremiumOrderInfo.getRechargeTgUserName())
.otherId(String.valueOf(tgPremiumOrderInfo.getIdTgPremiumOrderInfo()))
.errorCode("checkFragmentPaymentStatus_error")
.errorMsg(exceptionString.length() > 2000 ? exceptionString.substring(0, 2000) : exceptionString)
.fcu("system")
.lcu("system").build();
errorLogService.insertErrorLog(errorLog);
}
}
}

View File

@ -12,9 +12,9 @@ import com.ruoyi.common.utils.encrpt.Dt;
import com.ruoyi.system.api.ITronApi;
import com.ruoyi.system.domain.TrxExchangeMonitorAccountInfo;
import com.ruoyi.system.dto.AccountResourceResponse;
import com.ruoyi.system.mapper.ErrorLogMapper;
import com.ruoyi.system.mapper.TenantInfoMapper;
import com.ruoyi.system.mapper.TrxExchangeInfoMapper;
import com.ruoyi.system.service.IErrorLogService;
import lombok.extern.slf4j.Slf4j;
import org.redisson.Redisson;
import org.redisson.api.RLock;
@ -41,14 +41,17 @@ public class UndelegateEnergyHandler {
private TenantInfoMapper tenantInfoMapper;
@Autowired
private TRX2EneryTransferHandler trx2EneryTransferHandler;
@Autowired
private ErrorLogMapper errorLogMapper;
@Autowired
private TrxExchangeInfoMapper trxExchangeInfoMapper;
@Autowired
private ITronApi tronApi;
@Autowired
private IErrorLogService errorLogService;
public void doUndelegateEnergyByTrxExchangeInfo(TrxExchangeMonitorAccountInfo trxExchangeMonitorAccountInfo) {
Long lockPeriod = trxExchangeMonitorAccountInfo.getLockPeriod();
Date fcd = trxExchangeMonitorAccountInfo.getFcd();
@ -193,8 +196,8 @@ public class UndelegateEnergyHandler {
.otherId(trxExchangeMonitorAccountInfo.getIdTrxExchangeInfo().toString())
.fcu("system")
.lcu("system").build();
errorLogMapper.insertErrorLog(errorLog);
throw new RuntimeException("回收能量业务处理异常", e);
errorLogService.insertErrorLog(errorLog);
// throw new RuntimeException("回收能量业务处理异常", e);
} finally {
if (lock.isLocked()) {
if (lock.isHeldByCurrentThread()) {
@ -238,4 +241,6 @@ public class UndelegateEnergyHandler {
.build();
trxExchangeInfoMapper.updateTrxExchangeInfo(trxExchangeInfo);
}
}

View File

@ -24,9 +24,9 @@ import com.ruoyi.system.domain.MonitorAddressAccount;
import com.ruoyi.system.dto.Data;
import com.ruoyi.system.dto.Token_info;
import com.ruoyi.system.dto.TronGridResponse;
import com.ruoyi.system.mapper.ErrorLogMapper;
import com.ruoyi.system.mapper.UsdtExchangeInfoMapper;
import com.ruoyi.system.service.IAccountAddressInfoService;
import com.ruoyi.system.service.IErrorLogService;
import com.ruoyi.system.service.ISysConfigService;
import com.ruoyi.system.util.AddressUtil;
import lombok.extern.slf4j.Slf4j;
@ -35,6 +35,7 @@ import org.redisson.api.RLock;
import org.redisson.api.RedissonClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.util.Pair;
import org.springframework.stereotype.Component;
import org.telegram.telegrambots.meta.api.methods.ParseMode;
import org.telegram.telegrambots.meta.api.methods.send.SendMessage;
@ -79,10 +80,11 @@ public class Usdt2TrxTransferHandler {
private TgLongPollingBot longPollingBot;
@Autowired
private SendContent sendContent;
@Autowired
private ErrorLogMapper errorLogMapper;
public void doMonitorUsdtTransfer(MonitorAddressAccount monitorAddressAccount) {
@Autowired
private IErrorLogService errorLogService;
public void doMonitorUsdtTransfer(MonitorAddressAccount monitorAddressAccount) {
try {
String monitorAddress = monitorAddressAccount.getMonitorAddress();
@ -91,7 +93,7 @@ public class Usdt2TrxTransferHandler {
//
DateTime min_timestamp = DateUtil.offset(new Date(), DateField.MINUTE, Integer.valueOf(sysTransferBetween));
TronGridResponse tronGridResponse = tronApi.getTronGridTrc20Response(monitorAddress,true,false, apiKey,min_timestamp.getTime());
TronGridResponse tronGridResponse = tronApi.getTronGridTrc20Response(monitorAddress, true, false, apiKey, min_timestamp.getTime());
List<Data> dataList = tronGridResponse.getData();
if (CollectionUtil.isEmpty(dataList)) {
@ -100,11 +102,13 @@ public class Usdt2TrxTransferHandler {
//获取欧易费率
BigDecimal oneUsdtToTrx = getOneUsdtToTrx();
// BigDecimal oneUsdtToTrx = getOneUsdtToTrx();
Pair<BigDecimal, BigDecimal> oneUsdtToTrxPair = getOneUsdtToTrx();
for (Data data : dataList) {
doMonitorUsdtTransferByData(monitorAddressAccount, data, oneUsdtToTrx, apiKey);
doMonitorUsdtTransferByData(monitorAddressAccount, data, oneUsdtToTrxPair, apiKey);
}
} catch (Exception e) {
String exceptionString = LogUtils.doRecursiveReversePrintStackCause(e, 5, ForwardCounter.builder().count(0).build(), 5);
@ -115,18 +119,18 @@ public class Usdt2TrxTransferHandler {
.errorMsg(exceptionString.length() > 2000 ? exceptionString.substring(0, 2000) : exceptionString)
.fcu("system")
.lcu("system").build();
errorLogMapper.insertErrorLog(errorLog);
errorLogService.insertErrorLog(errorLog);
throw new RuntimeException("获取trx20交易列表异常",e);
throw new RuntimeException("获取trx20交易列表异常", e);
}
}
private void doMonitorUsdtTransferByData(MonitorAddressAccount monitorAddressAccount, Data data, BigDecimal oneUsdtToTrx, String apiKey) throws Exception {
private void doMonitorUsdtTransferByData(MonitorAddressAccount monitorAddressAccount, Data data, Pair<BigDecimal, BigDecimal> oneUsdtToTrxPair, String apiKey) throws Exception {
BigDecimal transferValue = getTransferValue(data);
if (transferValue == null) return;
BigDecimal trxValue = transferValue.multiply(oneUsdtToTrx).setScale(6, BigDecimal.ROUND_HALF_DOWN);
BigDecimal trxValue = transferValue.multiply(oneUsdtToTrxPair.getFirst()).setScale(6, BigDecimal.ROUND_HALF_DOWN);
String accountAddress = monitorAddressAccount.getAccountAddress();
String encryptPrivateKey = monitorAddressAccount.getEncryptPrivateKey();
@ -152,7 +156,7 @@ public class Usdt2TrxTransferHandler {
return;
}
doTransferUsdtAndStore(oneUsdtToTrx, apiKey, decryptPrivateKey, accountAddress, from, trxValue, dataTo, transactionId, transferValue);
doTransferUsdtAndStore(oneUsdtToTrxPair, apiKey, decryptPrivateKey, accountAddress, from, trxValue, dataTo, transactionId, transferValue);
redisTemplate.opsForValue().set("transfer_USDT_" + transactionId, transactionId, 1, TimeUnit.DAYS);
} finally {
@ -164,7 +168,7 @@ public class Usdt2TrxTransferHandler {
}
}
public void doTransferUsdtAndStore(BigDecimal oneUsdtToTrx, 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) throws IllegalException, TelegramApiException {
String systronApiSwitch = configService.selectConfigByKey("sys.tron.api");
@ -173,7 +177,7 @@ public class Usdt2TrxTransferHandler {
ApiWrapper apiWrapper = ApiWrapper.ofMainnet(decryptPrivateKey, apiKey);
//转账
//转账
Response.TransactionExtention transfer = apiWrapper.transfer(accountAddress, from, trxValue.movePointRight(6).longValue());
//签名
Chain.Transaction transaction = apiWrapper.signTransaction(transfer);
@ -189,14 +193,16 @@ public class Usdt2TrxTransferHandler {
.setUsdtTxId(transactionId)
.setUsdtAmount(transferValue)
.setTrxAmount(trxValue)
.setExchangeRate(oneUsdtToTrx)
.setOrginalExchangeRate(oneUsdtToTrx)
.setTrxTxId(txId);
.setExchangeRate(oneUsdtToTrxPair.getFirst())
.setOrginalExchangeRate(oneUsdtToTrxPair.getSecond())
.setTrxTxId(txId)
.setFcu("system")
.setLcu("system");
usdtExchangeInfoMapper.insertUsdtExchangeInfo(usdtExchangeInfo);
doSendTgNotice(oneUsdtToTrx, from, trxValue, transferValue, txId);
doSendTgNotice(oneUsdtToTrxPair.getFirst(), from, trxValue, transferValue, txId);
}
private void doSendTgNotice(BigDecimal oneUsdtToTrx, String from, BigDecimal trxValue, BigDecimal transferValue, String txId) throws TelegramApiException {
@ -209,7 +215,7 @@ public class Usdt2TrxTransferHandler {
arguments.put("trxAmount", trxValue);
arguments.put("FromAddress", from.replaceAll("(.{6})(.*)(.{8})", "$1********$3"));
arguments.put("txId", txId.replaceAll("(.{6})(.*)(.{8})", "$1*******************$3"));
arguments.put("txTime", DateUtil.format(new Date(),"yyyy-MM-dd HH:mm:ss"));
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(sysUsdtTranferNotice);
@ -260,7 +266,7 @@ public class Usdt2TrxTransferHandler {
* @throws NoSuchAlgorithmException
* @throws InvalidKeyException
*/
public BigDecimal getOneUsdtToTrx() throws NoSuchAlgorithmException, InvalidKeyException, IOException {
public Pair<BigDecimal, BigDecimal> getOneUsdtToTrx() throws NoSuchAlgorithmException, InvalidKeyException, IOException {
OkxResponse oksResponse = okxApi.getSingleTickerOkxResponse2();
Preconditions.checkNotNull(oksResponse, "查询费率失败无法兑换");
String code = oksResponse.getCode();
@ -278,13 +284,13 @@ public class Usdt2TrxTransferHandler {
double oneUsdtToTrxDouble = 1 / new Double(last);
BigDecimal oneUsdtToTrx = BigDecimal.valueOf(oneUsdtToTrxDouble).setScale(6, BigDecimal.ROUND_HALF_DOWN);
log.info("实时汇率:{}",oneUsdtToTrx);
log.info("实时汇率:{}", oneUsdtToTrx);
String sysUsdtProportionRate = configService.selectConfigByKey("sys.usdt.proportion.rate");
BigDecimal discountOneUsdtToTrx = oneUsdtToTrx;
if (StringUtils.isNotEmpty(sysUsdtProportionRate)) {
oneUsdtToTrx = oneUsdtToTrx.multiply(BigDecimal.ONE.subtract(new BigDecimal(sysUsdtProportionRate))).setScale(6, BigDecimal.ROUND_HALF_DOWN);
discountOneUsdtToTrx = oneUsdtToTrx.multiply(BigDecimal.ONE.subtract(new BigDecimal(sysUsdtProportionRate))).setScale(6, BigDecimal.ROUND_HALF_DOWN);
}
return oneUsdtToTrx;
return Pair.of(discountOneUsdtToTrx, oneUsdtToTrx);
}
@ -299,7 +305,8 @@ public class Usdt2TrxTransferHandler {
if (longPollingBot != null && StringUtils.isNotEmpty(sysUsdtGroupTopic) && StringUtils.isNotEmpty(sysTgGroupChatId)) {
log.info("进入这里1");
try {
BigDecimal tenUsdtToTrx = getOneUsdtToTrx().multiply(BigDecimal.TEN);
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, "{", "}");
@ -309,9 +316,9 @@ public class Usdt2TrxTransferHandler {
longPollingBot.execute(sendMessage);
} catch (Exception e) {
log.error("广播消息异常",e);
log.error("广播消息异常", e);
}
}else {
} else {
log.info("进入这里2");
log.warn("sysUsdtTranferNotice OR sysTgGroupChatId is null");
}

View File

@ -0,0 +1,31 @@
package com.ruoyi.system.interceptor;
import org.springframework.aop.aspectj.AspectJExpressionPointcut;
import org.springframework.aop.support.DefaultPointcutAdvisor;
import org.springframework.context.annotation.Bean;
import org.springframework.stereotype.Component;
@Component
public class MiddlegenSystemBean {
public static final String DIGEST_EXECUTION = "execution( * com.ruoyi.system.api.*.*(..))";
/**
*
* @return
*/
@Bean(name = "systemPointcutAdvisor")
public DefaultPointcutAdvisor defaultPointcutAdvisor(){
AspectJExpressionPointcut aspectJExpressionPointcut = new AspectJExpressionPointcut();
aspectJExpressionPointcut.setExpression(DIGEST_EXECUTION);
SystemDigestInterceptor systemDigestInterceptor = new SystemDigestInterceptor();
DefaultPointcutAdvisor defaultPointcutAdvisor = new DefaultPointcutAdvisor();
defaultPointcutAdvisor.setAdvice(systemDigestInterceptor);
defaultPointcutAdvisor.setPointcut(aspectJExpressionPointcut);
return defaultPointcutAdvisor;
}
}

View File

@ -0,0 +1,77 @@
package com.ruoyi.system.interceptor;
import cn.hutool.json.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.aopalliance.intercept.MethodInterceptor;
import org.aopalliance.intercept.MethodInvocation;
import javax.annotation.Nonnull;
import javax.annotation.Nullable;
import java.lang.reflect.Method;
@Slf4j
public class SystemDigestInterceptor implements MethodInterceptor {
private static final String SEP = ",";
private static final String NULL_REPLACEMENT = "null";
@Nullable
@Override
public Object invoke(@Nonnull MethodInvocation invocation) throws Throwable {
//被拦截的方法
Method method = invocation.getMethod();
//方法签名
String invocationSignature = method.getDeclaringClass().getSimpleName() + SEP + method.getName();
boolean isSuccess = true;
long start = System.currentTimeMillis();
Object proceed = null;
try {
proceed = invocation.proceed();
return proceed;
} catch (Exception e) {
isSuccess = false;
throw e;
} finally {
long elapseTime = System.currentTimeMillis() - start;
if (log.isInfoEnabled()) {
log.info(buildDigestLog(invocationSignature, isSuccess, elapseTime, invocation.getArguments(),proceed));
}
}
}
/**
*
*
* @param invocationSignature
* @param isSuccess
* @param elapseTime
* @param arguments
* @return
*/
private String buildDigestLog(String invocationSignature, boolean isSuccess, long elapseTime, Object[] arguments,Object proceed) {
StringBuilder sb = new StringBuilder();
sb.append("[");
{
sb.append("(");
sb.append(invocationSignature).append(SEP);
sb.append(isSuccess ? "Y" : "N").append(SEP);
sb.append(arguments == null ? NULL_REPLACEMENT : JSONUtil.toJsonStr(arguments)).append(SEP);
sb.append(proceed == null ? NULL_REPLACEMENT : JSONUtil.toJsonStr(proceed)).append(SEP);
sb.append(elapseTime).append("ms");
sb.append(")");
}
sb.append("]");
return sb.toString();
}
}

View File

@ -0,0 +1,63 @@
package com.ruoyi.system.mapper;
import com.ruoyi.common.core.domain.entity.TgPremiumOrderInfo;
import java.util.List;
/**
* TGMapper
*
* @author dorion
* @date 2024-05-04
*/
public interface TgPremiumOrderInfoMapper
{
/**
* TG
*
* @param idTgPremiumOrderInfo TG
* @return TG
*/
public TgPremiumOrderInfo selectTgPremiumOrderInfoByIdTgPremiumOrderInfo(Long idTgPremiumOrderInfo);
/**
* TG
*
* @param tgPremiumOrderInfo TG
* @return TG
*/
public List<TgPremiumOrderInfo> selectTgPremiumOrderInfoList(TgPremiumOrderInfo tgPremiumOrderInfo);
/**
* TG
*
* @param tgPremiumOrderInfo TG
* @return
*/
public int insertTgPremiumOrderInfo(TgPremiumOrderInfo tgPremiumOrderInfo);
/**
* TG
*
* @param tgPremiumOrderInfo TG
* @return
*/
public int updateTgPremiumOrderInfo(TgPremiumOrderInfo tgPremiumOrderInfo);
/**
* TG
*
* @param idTgPremiumOrderInfo TG
* @return
*/
public int deleteTgPremiumOrderInfoByIdTgPremiumOrderInfo(Long idTgPremiumOrderInfo);
/**
* TG
*
* @param idTgPremiumOrderInfos
* @return
*/
public int deleteTgPremiumOrderInfoByIdTgPremiumOrderInfos(String[] idTgPremiumOrderInfos);
}

View File

@ -35,7 +35,7 @@ public interface IErrorLogService
* @param errorLog
* @return
*/
public int insertErrorLog(ErrorLog errorLog);
public int insertErrorLog(ErrorLog errorLog) ;
/**
*

View File

@ -0,0 +1,68 @@
package com.ruoyi.system.service;
import com.ruoyi.common.core.domain.entity.TgPremiumOrderInfo;
import com.ruoyi.common.core.domain.vo.TgPremiumOrderInfoMultiVO;
import java.util.List;
/**
* TGService
*
* @author dorion
* @date 2024-05-04
*/
public interface ITgPremiumOrderInfoService
{
/**
* TG
*
* @param idTgPremiumOrderInfo TG
* @return TG
*/
public TgPremiumOrderInfo selectTgPremiumOrderInfoByIdTgPremiumOrderInfo(Long idTgPremiumOrderInfo);
/**
* TG
*
* @param tgPremiumOrderInfo TG
* @return TG
*/
public List<TgPremiumOrderInfo> selectTgPremiumOrderInfoList(TgPremiumOrderInfo tgPremiumOrderInfo);
/**
* TG
*
* @param tgPremiumOrderInfo TG
* @return
*/
public int insertTgPremiumOrderInfo(TgPremiumOrderInfo tgPremiumOrderInfo);
/**
* TG
*
* @param tgPremiumOrderInfo TG
* @return
*/
public int updateTgPremiumOrderInfo(TgPremiumOrderInfo tgPremiumOrderInfo);
/**
* TG
*
* @param idTgPremiumOrderInfos TG
* @return
*/
public int deleteTgPremiumOrderInfoByIdTgPremiumOrderInfos(String idTgPremiumOrderInfos);
/**
* TG
*
* @param idTgPremiumOrderInfo TG
* @return
*/
public int deleteTgPremiumOrderInfoByIdTgPremiumOrderInfo(Long idTgPremiumOrderInfo);
int insertTgPremiumOrderInfoMultiVO(TgPremiumOrderInfoMultiVO tgPremiumOrderInfoMultiVO);
int activeDataByIdTgPremiumOrderInfos(String ids);
}

View File

@ -54,7 +54,7 @@ public class ApiServiceImpl implements IApiService {
CompletableFuture<Void> queryOkxFuture = CompletableFuture.runAsync(() -> {
BigDecimal oneUsdtToTrx = null;
try {
oneUsdtToTrx = usdt2TrxTransferHandler.getOneUsdtToTrx();
oneUsdtToTrx = usdt2TrxTransferHandler.getOneUsdtToTrx().getFirst();
// oneUsdtToTrx = BigDecimal.valueOf(7.53);
} catch (Exception e) {
throw new RuntimeException(e);

View File

@ -1,101 +1,133 @@
package com.ruoyi.system.service.impl;
import cn.hutool.core.date.DateUtil;
import com.ruoyi.common.core.domain.entity.ErrorLog;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.common.utils.ForwardCounter;
import com.ruoyi.common.utils.LogUtils;
import com.ruoyi.common.utils.StringUtils;
import com.ruoyi.system.bot.TgLongPollingBot;
import com.ruoyi.system.bot.utils.SendContent;
import com.ruoyi.system.mapper.ErrorLogMapper;
import com.ruoyi.system.service.IErrorLogService;
import com.ruoyi.system.service.ISysConfigService;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.text.StrSubstitutor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
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.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
/**
* Service
*
*
* @author dorion
* @date 2024-04-13
*/
@Service
public class ErrorLogServiceImpl implements IErrorLogService
{
@Slf4j
public class ErrorLogServiceImpl implements IErrorLogService {
@Autowired(required = false)
private TgLongPollingBot tgLongPollingBot;
@Autowired
private ErrorLogMapper errorLogMapper;
@Autowired
private SendContent sendContent;
@Autowired
private ISysConfigService configService;
/**
*
*
*
* @param idErrorLog
* @return
*/
@Override
public ErrorLog selectErrorLogByIdErrorLog(Long idErrorLog)
{
public ErrorLog selectErrorLogByIdErrorLog(Long idErrorLog) {
return errorLogMapper.selectErrorLogByIdErrorLog(idErrorLog);
}
/**
*
*
*
* @param errorLog
* @return
*/
@Override
public List<ErrorLog> selectErrorLogList(ErrorLog errorLog)
{
public List<ErrorLog> selectErrorLogList(ErrorLog errorLog) {
return errorLogMapper.selectErrorLogList(errorLog);
}
/**
*
*
*
* @param errorLog
* @return
*/
@Override
public int insertErrorLog(ErrorLog errorLog)
{
String userName = ShiroUtils.getLoginName();
errorLog.setFcu(userName);
errorLog.setLcu(userName);
@Async
public int insertErrorLog(ErrorLog errorLog){
String sysErrorLogTemplate = configService.selectConfigByKey("sys.error.log.template");
String sysErrorLogChatId = configService.selectConfigByKey("sys.error.log.chatid");
if (tgLongPollingBot != null && StringUtils.isNotEmpty(sysErrorLogChatId) && StringUtils.isNotEmpty(sysErrorLogTemplate)) {
Map<String, Object> arguments = new HashMap<>();
arguments.put("errorCode", errorLog.getErrorCode());
arguments.put("address", errorLog.getAddress());
arguments.put("txTime", DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss"));
StrSubstitutor substitutor = new StrSubstitutor(arguments, "{", "}");
String message = substitutor.replace(sysErrorLogTemplate);
SendMessage sendMessage = sendContent.messageText(sysErrorLogChatId, message, ParseMode.HTML);
try {
tgLongPollingBot.execute(sendMessage);
} catch (TelegramApiException e) {
String exceptionString = LogUtils.doRecursiveReversePrintStackCause(e, 5, ForwardCounter.builder().count(0).build(), 5);
log.error("TelegramApiException异常:{}", exceptionString);
}
}
return errorLogMapper.insertErrorLog(errorLog);
}
/**
*
*
*
* @param errorLog
* @return
*/
@Override
public int updateErrorLog(ErrorLog errorLog)
{
String userName = ShiroUtils.getLoginName();
errorLog.setLcu(userName);
public int updateErrorLog(ErrorLog errorLog) {
return errorLogMapper.updateErrorLog(errorLog);
}
/**
*
*
*
* @param idErrorLogs
* @return
*/
@Override
public int deleteErrorLogByIdErrorLogs(String idErrorLogs)
{
public int deleteErrorLogByIdErrorLogs(String idErrorLogs) {
return errorLogMapper.deleteErrorLogByIdErrorLogs(Convert.toStrArray(idErrorLogs));
}
/**
*
*
*
* @param idErrorLog
* @return
*/
@Override
public int deleteErrorLogByIdErrorLog(Long idErrorLog)
{
public int deleteErrorLogByIdErrorLog(Long idErrorLog) {
return errorLogMapper.deleteErrorLogByIdErrorLog(idErrorLog);
}
}

View File

@ -0,0 +1,166 @@
package com.ruoyi.system.service.impl;
import com.google.common.base.Preconditions;
import com.ruoyi.common.core.domain.entity.TgPremiumOrderInfo;
import com.ruoyi.common.core.domain.vo.TgPremiumOrderInfoMultiVO;
import com.ruoyi.common.core.text.Convert;
import com.ruoyi.common.utils.ShiroUtils;
import com.ruoyi.system.handler.TgPremiumTransferHandler;
import com.ruoyi.system.mapper.TgPremiumOrderInfoMapper;
import com.ruoyi.system.service.ITgPremiumOrderInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
import static com.ruoyi.common.constant.Constants.MONTHS;
/**
* TGService
*
* @author dorion
* @date 2024-05-04
*/
@Service
@Slf4j
public class TgPremiumOrderInfoServiceImpl implements ITgPremiumOrderInfoService {
@Autowired
private TgPremiumOrderInfoMapper tgPremiumOrderInfoMapper;
@Autowired
private TgPremiumTransferHandler tgPremiumTransferHandler;
/**
* TG
*
* @param idTgPremiumOrderInfo TG
* @return TG
*/
@Override
public TgPremiumOrderInfo selectTgPremiumOrderInfoByIdTgPremiumOrderInfo(Long idTgPremiumOrderInfo) {
return tgPremiumOrderInfoMapper.selectTgPremiumOrderInfoByIdTgPremiumOrderInfo(idTgPremiumOrderInfo);
}
/**
* TG
*
* @param tgPremiumOrderInfo TG
* @return TG
*/
@Override
public List<TgPremiumOrderInfo> selectTgPremiumOrderInfoList(TgPremiumOrderInfo tgPremiumOrderInfo) {
return tgPremiumOrderInfoMapper.selectTgPremiumOrderInfoList(tgPremiumOrderInfo);
}
/**
* TG
*
* @param tgPremiumOrderInfo TG
* @return
*/
@Override
public int insertTgPremiumOrderInfo(TgPremiumOrderInfo tgPremiumOrderInfo) {
return tgPremiumOrderInfoMapper.insertTgPremiumOrderInfo(tgPremiumOrderInfo);
}
/**
* TG
*
* @param tgPremiumOrderInfo TG
* @return
*/
@Override
public int updateTgPremiumOrderInfo(TgPremiumOrderInfo tgPremiumOrderInfo) {
Long userId = ShiroUtils.getUserId();
tgPremiumOrderInfo.setLcu(userId.toString());
return tgPremiumOrderInfoMapper.updateTgPremiumOrderInfo(tgPremiumOrderInfo);
}
/**
* TG
*
* @param idTgPremiumOrderInfos TG
* @return
*/
@Override
public int deleteTgPremiumOrderInfoByIdTgPremiumOrderInfos(String idTgPremiumOrderInfos) {
return tgPremiumOrderInfoMapper.deleteTgPremiumOrderInfoByIdTgPremiumOrderInfos(Convert.toStrArray(idTgPremiumOrderInfos));
}
/**
* TG
*
* @param idTgPremiumOrderInfo TG
* @return
*/
@Override
public int deleteTgPremiumOrderInfoByIdTgPremiumOrderInfo(Long idTgPremiumOrderInfo) {
return tgPremiumOrderInfoMapper.deleteTgPremiumOrderInfoByIdTgPremiumOrderInfo(idTgPremiumOrderInfo);
}
@Override
public int insertTgPremiumOrderInfoMultiVO(TgPremiumOrderInfoMultiVO tgPremiumOrderInfoMultiVO) {
log.info("tgPremiumOrderInfoMultiVO:{}", tgPremiumOrderInfoMultiVO);
String[] tgPremiumOrderInfoArray = tgPremiumOrderInfoMultiVO.getTgPremiumOrderInfo().split("\r\n");
int count = 1;
String loginName = ShiroUtils.getLoginName();
List<TgPremiumOrderInfo> tgPremiumOrderInfoList = new ArrayList<>();
for (String tgPremiumOrderInfoString : tgPremiumOrderInfoArray) {
String[] split = tgPremiumOrderInfoString.split(",");
Preconditions.checkState(split.length == 2, "第" + count + "行,请输入正确的格式[tgUserName],[months]");
TgPremiumOrderInfo tgPremiumOrderInfo = new TgPremiumOrderInfo();
tgPremiumOrderInfo.setRechargeTgUserName(split[0]);
Preconditions.checkState(MONTHS.contains(split[1]), "第" + count + "行,请输入正确的月数[3,6,12]");
tgPremiumOrderInfo.setMonths(Long.valueOf(split[1]));
tgPremiumOrderInfo.setFcd(new Date());
tgPremiumOrderInfo.setLcd(new Date());
tgPremiumOrderInfo.setFcu(loginName);
tgPremiumOrderInfo.setLcu(loginName);
tgPremiumOrderInfo.setTgPaymentStatus("N");
tgPremiumOrderInfoList.add(tgPremiumOrderInfo);
count++;
}
if (tgPremiumOrderInfoList.size() > 0) {
for (TgPremiumOrderInfo tgPremiumOrderInfo : tgPremiumOrderInfoList) {
tgPremiumOrderInfoMapper.insertTgPremiumOrderInfo(tgPremiumOrderInfo);
}
if ("Y".equals(tgPremiumOrderInfoMultiVO.getIsJoindNow())) {
for (TgPremiumOrderInfo tgPremiumOrderInfo : tgPremiumOrderInfoList) {
tgPremiumTransferHandler.doRechargeAndUpdate(tgPremiumOrderInfo);
/* tgPremiumOrderInfo.setTgPaymentStatus("N");
if (amount != null){
tgPremiumOrderInfo.setTgPaymentStatus("Y");
tgPremiumOrderInfo.setActualAmount(BigDecimal.valueOf(amount).movePointLeft(9));
}
tgPremiumOrderInfoMapper.updateTgPremiumOrderInfo(tgPremiumOrderInfo);*/
}
}
}
return 1;
}
@Override
public int activeDataByIdTgPremiumOrderInfos(String ids) {
String[] idsArray = Convert.toStrArray(ids);
for (String id : idsArray) {
TgPremiumOrderInfo tgPremiumOrderInfo = tgPremiumOrderInfoMapper.selectTgPremiumOrderInfoByIdTgPremiumOrderInfo(Long.valueOf(id));
Preconditions.checkState(!"Y".equals(tgPremiumOrderInfo.getTgPaymentStatus()), tgPremiumOrderInfo.getRechargeTgUserName() + "该用户已经开通,请勿重复开通");
tgPremiumTransferHandler.doRechargeAndUpdate(tgPremiumOrderInfo);
}
return 1;
}
}

View File

@ -13,6 +13,7 @@ import com.ruoyi.system.mapper.UsdtExchangeInfoMapper;
import com.ruoyi.system.service.IUsdtExchangeInfoService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.util.Pair;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
@ -70,17 +71,18 @@ public class UsdtExchangeInfoServiceImpl implements IUsdtExchangeInfoService {
public int insertUsdtExchangeInfo(UsdtExchangeInfo usdtExchangeInfo) throws Exception {
BigDecimal oneUsdtToTrx;
String systronApiSwitch = configService.selectConfigByKey("sys.tron.api");
Pair<BigDecimal, BigDecimal> oneUsdtToTrxPair = null;
if (UserConstants.YES.equals(systronApiSwitch)) {
oneUsdtToTrx = usdt2TrxTransferHandler.getOneUsdtToTrx();
// oneUsdtToTrx = usdt2TrxTransferHandler.getOneUsdtToTrx().getFirst();
oneUsdtToTrxPair = usdt2TrxTransferHandler.getOneUsdtToTrx();
} else {
oneUsdtToTrx = new BigDecimal("7.565113");
oneUsdtToTrxPair=Pair.of(BigDecimal.TEN,BigDecimal.TEN);
}
BigDecimal usdtAmount = usdtExchangeInfo.getUsdtAmount();
BigDecimal trxValue = usdtAmount.multiply(oneUsdtToTrx);
BigDecimal trxValue = usdtAmount.multiply(oneUsdtToTrxPair.getFirst());
String accountAddress = usdtExchangeInfo.getAccountAddress();
if (StringUtils.isEmpty(accountAddress)) {
AccountAddressInfo accountAddressInfoExample = new AccountAddressInfo();
@ -96,7 +98,7 @@ public class UsdtExchangeInfoServiceImpl implements IUsdtExchangeInfoService {
String fromAddress = usdtExchangeInfo.getFromAddress();
usdt2TrxTransferHandler.
doTransferUsdtAndStore(oneUsdtToTrx, tronApiKey, decryptPrivateKey, accountAddress, fromAddress, trxValue, null, null, usdtAmount);
doTransferUsdtAndStore(oneUsdtToTrxPair, tronApiKey, decryptPrivateKey, accountAddress, fromAddress, trxValue, null, null, usdtAmount);
return 1;
}

View File

@ -0,0 +1,122 @@
<?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.TgPremiumOrderInfoMapper">
<resultMap type="TgPremiumOrderInfo" id="TgPremiumOrderInfoResult">
<result property="idTgPremiumOrderInfo" column="id_tg_premium_order_info" />
<result property="rechargeTgUserName" column="recharge_tg_user_name" />
<result property="months" column="months" />
<result property="actualAmount" column="actual_amount" />
<result property="idTg" column="id_tg" />
<result property="tgPaymentStatus" column="tg_payment_status" />
<result property="orderAmount" column="order_amount" />
<result property="isPaid" column="is_paid" />
<result property="fromAddress" column="from_address" />
<result property="toAddress" column="to_address" />
<result property="txId" column="tx_id" />
<result property="fcd" column="fcd" />
<result property="fcu" column="fcu" />
<result property="lcd" column="lcd" />
<result property="lcu" column="lcu" />
</resultMap>
<sql id="selectTgPremiumOrderInfoVo">
select id_tg_premium_order_info, recharge_tg_user_name, months, actual_amount, id_tg, tg_payment_status, order_amount, is_paid, from_address, to_address, tx_id, fcd, fcu, lcd, lcu from tg_premium_order_info
</sql>
<select id="selectTgPremiumOrderInfoList" parameterType="TgPremiumOrderInfo" resultMap="TgPremiumOrderInfoResult">
<include refid="selectTgPremiumOrderInfoVo"/>
<where>
<if test="rechargeTgUserName != null and rechargeTgUserName != ''"> and recharge_tg_user_name like concat('%', #{rechargeTgUserName}, '%')</if>
<if test="months != null "> and months = #{months}</if>
<if test="actualAmount != null "> and actual_amount = #{actualAmount}</if>
<if test="idTg != null and idTg != ''"> and id_tg = #{idTg}</if>
<if test="tgPaymentStatus != null and tgPaymentStatus != ''"> and tg_payment_status = #{tgPaymentStatus}</if>
<if test="orderAmount != null and orderAmount != ''"> and order_amount = #{orderAmount}</if>
<if test="isPaid != null and isPaid != ''"> and is_paid = #{isPaid}</if>
<if test="fromAddress != null and fromAddress != ''"> and from_address = #{fromAddress}</if>
<if test="toAddress != null and toAddress != ''"> and to_address = #{toAddress}</if>
<if test="txId != null "> and tx_id = #{txId}</if>
<if test="fcd != null "> and fcd &gt;= #{fcd}</if>
<if test="fcu != null and fcu != ''"> and fcu = #{fcu}</if>
<if test="lcd != null "> and lcd = #{lcd}</if>
<if test="lcu != null and lcu != ''"> and lcu = #{lcu}</if>
</where>
</select>
<select id="selectTgPremiumOrderInfoByIdTgPremiumOrderInfo" parameterType="Long" resultMap="TgPremiumOrderInfoResult">
<include refid="selectTgPremiumOrderInfoVo"/>
where id_tg_premium_order_info = #{idTgPremiumOrderInfo}
</select>
<insert id="insertTgPremiumOrderInfo" parameterType="TgPremiumOrderInfo" useGeneratedKeys="true" keyProperty="idTgPremiumOrderInfo">
insert into tg_premium_order_info
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="rechargeTgUserName != null">recharge_tg_user_name,</if>
<if test="months != null">months,</if>
<if test="actualAmount != null">actual_amount,</if>
<if test="idTg != null">id_tg,</if>
<if test="tgPaymentStatus != null">tg_payment_status,</if>
<if test="orderAmount != null">order_amount,</if>
<if test="isPaid != null">is_paid,</if>
<if test="fromAddress != null">from_address,</if>
<if test="toAddress != null">to_address,</if>
<if test="txId != null">tx_id,</if>
<if test="fcd != null">fcd,</if>
<if test="fcu != null">fcu,</if>
<if test="lcd != null">lcd,</if>
<if test="lcu != null">lcu,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="rechargeTgUserName != null">#{rechargeTgUserName},</if>
<if test="months != null">#{months},</if>
<if test="actualAmount != null">#{actualAmount},</if>
<if test="idTg != null">#{idTg},</if>
<if test="tgPaymentStatus != null">#{tgPaymentStatus},</if>
<if test="orderAmount != null">#{orderAmount},</if>
<if test="isPaid != null">#{isPaid},</if>
<if test="fromAddress != null">#{fromAddress},</if>
<if test="toAddress != null">#{toAddress},</if>
<if test="txId != null">#{txId},</if>
<if test="fcd != null">#{fcd},</if>
<if test="fcu != null">#{fcu},</if>
<if test="lcd != null">#{lcd},</if>
<if test="lcu != null">#{lcu},</if>
</trim>
</insert>
<update id="updateTgPremiumOrderInfo" parameterType="TgPremiumOrderInfo">
update tg_premium_order_info
<trim prefix="SET" suffixOverrides=",">
<if test="rechargeTgUserName != null">recharge_tg_user_name = #{rechargeTgUserName},</if>
<if test="months != null">months = #{months},</if>
<if test="actualAmount != null">actual_amount = #{actualAmount},</if>
<if test="idTg != null">id_tg = #{idTg},</if>
<if test="tgPaymentStatus != null">tg_payment_status = #{tgPaymentStatus},</if>
<if test="orderAmount != null">order_amount = #{orderAmount},</if>
<if test="isPaid != null">is_paid = #{isPaid},</if>
<if test="fromAddress != null">from_address = #{fromAddress},</if>
<if test="toAddress != null">to_address = #{toAddress},</if>
<if test="txId != null">tx_id = #{txId},</if>
<if test="fcd != null">fcd = #{fcd},</if>
<if test="fcu != null">fcu = #{fcu},</if>
<if test="lcd != null">lcd = #{lcd},</if>
<if test="lcu != null">lcu = #{lcu},</if>
</trim>
where id_tg_premium_order_info = #{idTgPremiumOrderInfo}
</update>
<delete id="deleteTgPremiumOrderInfoByIdTgPremiumOrderInfo" parameterType="Long">
delete from tg_premium_order_info where id_tg_premium_order_info = #{idTgPremiumOrderInfo}
</delete>
<delete id="deleteTgPremiumOrderInfoByIdTgPremiumOrderInfos" parameterType="String">
delete from tg_premium_order_info where id_tg_premium_order_info in
<foreach item="idTgPremiumOrderInfo" collection="array" open="(" separator="," close=")">
#{idTgPremiumOrderInfo}
</foreach>
</delete>
</mapper>