去除最终到期时间,改用委托次数判断

pull/520/head
dorion 2024-04-18 01:07:10 +08:00
parent 3704b2183e
commit 166b5ef6ad
8 changed files with 155 additions and 83 deletions

View File

@ -135,7 +135,7 @@
</plugin> --> </plugin> -->
</plugins> </plugins>
<finalName>${project.artifactId}</finalName> <finalName>${project.artifactId}</finalName>
<!-- <resources> <!-- <resources>
<resource> <resource>
<directory>src/main/resources</directory> <directory>src/main/resources</directory>
<excludes> <excludes>

View File

@ -67,6 +67,14 @@
</select> </select>
</div> </div>
</div> </div>
<div class="form-group">
<label class="col-sm-3 control-label">状态:</label>
<div class="col-sm-8">
<select name="status" class="form-control m-b" th:with="type=${@dict.getType('sys_tenant_status')}">
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" th:field="*{status}"></option>
</select>
</div>
</div>
<input name="fcd" th:value="${#dates.format(tenantInfo.fcd, 'yyyy-MM-dd HH:mm:ss')}" type="hidden"> <input name="fcd" th:value="${#dates.format(tenantInfo.fcd, 'yyyy-MM-dd HH:mm:ss')}" type="hidden">
@ -86,11 +94,7 @@
} }
} }
$("input[name='finishTransferTime']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
$("input[name='fcd']").datetimepicker({ $("input[name='fcd']").datetimepicker({
format: "yyyy-mm-dd", format: "yyyy-mm-dd",
@ -98,11 +102,7 @@
autoclose: true autoclose: true
}); });
$("input[name='lcd']").datetimepicker({
format: "yyyy-mm-dd",
minView: "month",
autoclose: true
});
</script> </script>
</body> </body>
</html> </html>

View File

@ -61,6 +61,7 @@
var exchangeUnitDatas = [[${@dict.getType('sys_monitor_type')}]]; var exchangeUnitDatas = [[${@dict.getType('sys_monitor_type')}]];
var isPaidDatas = [[${@dict.getType('sys_is_paid')}]]; var isPaidDatas = [[${@dict.getType('sys_is_paid')}]];
var periodDatas = [[${@dict.getType('sys_lock_period_day')}]]; var periodDatas = [[${@dict.getType('sys_lock_period_day')}]];
var statusDatas = [[${@dict.getType('sys_tenant_status')}]];
var prefix = ctx + "account/tenant"; var prefix = ctx + "account/tenant";
$(function() { $(function() {
@ -124,9 +125,17 @@
return $.table.selectDictLabel(periodDatas, value); return $.table.selectDictLabel(periodDatas, value);
} }
}, },
{ {
field: 'finishTransferTime', field: 'status',
title: '最终到期日期' title: '状态',
formatter: function(value, row, index) {
return $.table.selectDictLabel(statusDatas, value);
}
},
{
field: 'delegatedDays',
title: '已经委托天数'
}, },
{ {
field: 'fcd', field: 'fcd',

View File

@ -18,16 +18,16 @@
<label>转入账户:</label> <label>转入账户:</label>
<input type="text" name="toAddress"/> <input type="text" name="toAddress"/>
</li> </li>
<li> <!-- <li>
<label>实际出账账户:</label> <label>实际出账账户:</label>
<input type="text" name="accountAddress"/> <input type="text" name="accountAddress"/>
</li> </li>-->
<li> <li>
<label>TRX订单</label> <label>TRX订单</label>
<input type="text" name="trxTxId"/> <input type="text" name="trxTxId"/>
</li> </li>
<br/> <br/> <br/>
<!-- <li> <!-- <li>
<label>能量交易订单:</label> <label>能量交易订单:</label>
<input type="text" name="delegateTxId"/> <input type="text" name="delegateTxId"/>
@ -39,6 +39,7 @@
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option> <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}" ></option>
</select> </select>
</li> </li>
<!-- <br/> <br/> <br/>-->
<!-- <!--
<li> <li>
<label>回收资源交易:</label> <label>回收资源交易:</label>
@ -85,6 +86,7 @@
var datas = [[${@dict.getType('sys_delegate_status')}]]; var datas = [[${@dict.getType('sys_delegate_status')}]];
var tranferCountDatas = [[${@dict.getType('sys_transfer_number')}]]; var tranferCountDatas = [[${@dict.getType('sys_transfer_number')}]];
var busiTypeDatas = [[${@dict.getType('sys_busi_type')}]]; var busiTypeDatas = [[${@dict.getType('sys_busi_type')}]];
var lockPeriodDatas = [[${@dict.getType('sys_lock_period')}]];
$(function() { $(function() {
var options = { var options = {
url: prefix + "/list", url: prefix + "/list",
@ -109,10 +111,10 @@
field: 'toAddress', field: 'toAddress',
title: '转入账户' title: '转入账户'
}, },
{ /* {
field: 'accountAddress', field: 'accountAddress',
title: '实际出账账户' title: '实际出账账户'
}, },*/
{ {
field: 'price', field: 'price',
title: '单价' title: '单价'
@ -149,7 +151,10 @@
}, },
{ {
field: 'lockPeriod', field: 'lockPeriod',
title: '锁定周期(*3s)' title: '锁定周期',
formatter: function(value, row, index) {
return $.table.selectDictLabel(lockPeriodDatas, value);
}
}, },
{ {
field: 'delegateStatus', field: 'delegateStatus',

View File

@ -3,8 +3,6 @@ package com.ruoyi.common.core.domain.entity;
import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.annotation.Excel; import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity; 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; import java.util.Date;
@ -57,10 +55,17 @@ public class TenantInfo extends BaseEntity
@Excel(name = "租期") @Excel(name = "租期")
private Long period; private Long period;
/** 最终到期日期 */ /** 用户id */
@JsonFormat(pattern = "yyyy-MM-dd") private String userId;
@Excel(name = "最终到期日期", width = 30, dateFormat = "yyyy-MM-dd")
private Date finishTransferTime; /** 状态 */
@Excel(name = "状态")
private String status;
/** 已经委托天数 */
@Excel(name = "已经委托天数")
private Long delegatedDays;
/** 创建时间 */ /** 创建时间 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd")
@ -80,6 +85,31 @@ public class TenantInfo extends BaseEntity
@Excel(name = "更新用户") @Excel(name = "更新用户")
private String lcu; private String lcu;
public String getUserId() {
return userId;
}
public void setUserId(String userId) {
this.userId = userId;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
public Long getDelegatedDays() {
return delegatedDays;
}
public void setDelegatedDays(Long delegatedDays) {
this.delegatedDays = delegatedDays;
}
public void setIdTenantInfo(Long idTenantInfo) public void setIdTenantInfo(Long idTenantInfo)
{ {
this.idTenantInfo = idTenantInfo; this.idTenantInfo = idTenantInfo;
@ -170,15 +200,7 @@ public class TenantInfo extends BaseEntity
{ {
return period; return period;
} }
public void setFinishTransferTime(Date finishTransferTime)
{
this.finishTransferTime = finishTransferTime;
}
public Date getFinishTransferTime()
{
return finishTransferTime;
}
public void setFcd(Date fcd) public void setFcd(Date fcd)
{ {
this.fcd = fcd; this.fcd = fcd;
@ -218,22 +240,24 @@ public class TenantInfo extends BaseEntity
@Override @Override
public String toString() { public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) return "TenantInfo{" +
.append("idTenantInfo", getIdTenantInfo()) "idTenantInfo=" + idTenantInfo +
.append("receiverAddress", getReceiverAddress()) ", receiverAddress='" + receiverAddress + '\'' +
.append("monitorAddress", getMonitorAddress()) ", monitorAddress='" + monitorAddress + '\'' +
.append("price", getPrice()) ", price=" + price +
.append("transferCount", getTransferCount()) ", transferCount=" + transferCount +
.append("exchangeUnit", getExchangeUnit()) ", exchangeUnit='" + exchangeUnit + '\'' +
.append("txId", getTxId()) ", txId='" + txId + '\'' +
.append("exchangeAmount", getExchangeAmount()) ", exchangeAmount=" + exchangeAmount +
.append("isPaid", getIsPaid()) ", isPaid='" + isPaid + '\'' +
.append("period", getPeriod()) ", period=" + period +
.append("finishTransferTime", getFinishTransferTime()) ", userId='" + userId + '\'' +
.append("fcd", getFcd()) ", status='" + status + '\'' +
.append("fcu", getFcu()) ", delegatedDays=" + delegatedDays +
.append("lcd", getLcd()) ", fcd=" + fcd +
.append("lcu", getLcu()) ", fcu='" + fcu + '\'' +
.toString(); ", lcd=" + lcd +
", lcu='" + lcu + '\'' +
'}';
} }
} }

View File

@ -1,10 +1,10 @@
package com.ruoyi.system.service.impl; package com.ruoyi.system.service.impl;
import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUnit; import cn.hutool.core.date.DateUnit;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import com.google.common.base.Preconditions; import com.google.common.base.Preconditions;
import com.ruoyi.common.annotation.DataScope;
import com.ruoyi.common.constant.UserConstants; import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.core.domain.entity.MonitorAddressInfo; import com.ruoyi.common.core.domain.entity.MonitorAddressInfo;
import com.ruoyi.common.core.domain.entity.TenantInfo; import com.ruoyi.common.core.domain.entity.TenantInfo;
@ -59,6 +59,7 @@ public class TenantInfoServiceImpl implements ITenantInfoService
* @return * @return
*/ */
@Override @Override
@DataScope(userAlias = "u")
public List<TenantInfo> selectTenantInfoList(TenantInfo tenantInfo) public List<TenantInfo> selectTenantInfoList(TenantInfo tenantInfo)
{ {
return tenantInfoMapper.selectTenantInfoList(tenantInfo); return tenantInfoMapper.selectTenantInfoList(tenantInfo);
@ -86,15 +87,18 @@ public class TenantInfoServiceImpl implements ITenantInfoService
long exchangeAmount = price * transferCount; long exchangeAmount = price * transferCount;
tenantInfo.setExchangeAmount(exchangeAmount); tenantInfo.setExchangeAmount(exchangeAmount);
tenantInfo.setIsPaid(UserConstants.NO); tenantInfo.setIsPaid(UserConstants.NO);
Long period = tenantInfo.getPeriod();
DateTime dateTime = DateUtil.offsetDay(DateUtil.date(), period.intValue() -1);
tenantInfo.setFinishTransferTime( DateUtil.endOfDay(dateTime)); tenantInfo.setDelegatedDays(0L);
Long userId = ShiroUtils.getUserId();
tenantInfo.setUserId(userId.toString());
String loginName = ShiroUtils.getLoginName(); String loginName = ShiroUtils.getLoginName();
tenantInfo.setFcd(new Date()); tenantInfo.setFcd(new Date());
tenantInfo.setFcu(loginName); tenantInfo.setFcu(loginName);
String status = DictUtils.getDictValue("sys_tenant_status", "生效中");
tenantInfo.setStatus(status);
tenantInfo.setLcd(new Date()); tenantInfo.setLcd(new Date());
tenantInfo.setLcu(loginName); tenantInfo.setLcu(loginName);
@ -117,10 +121,6 @@ public class TenantInfoServiceImpl implements ITenantInfoService
long exchangeAmount = price * transferCount; long exchangeAmount = price * transferCount;
tenantInfo.setExchangeAmount(exchangeAmount); tenantInfo.setExchangeAmount(exchangeAmount);
Long period = tenantInfo.getPeriod();
DateTime dateTime = DateUtil.offsetDay(tenantInfo.getFcd(), period.intValue());
tenantInfo.setFinishTransferTime( DateUtil.endOfDay(dateTime));
String loginName = ShiroUtils.getLoginName(); String loginName = ShiroUtils.getLoginName();
@ -160,6 +160,9 @@ public class TenantInfoServiceImpl implements ITenantInfoService
for (String id : idArray) { for (String id : idArray) {
TenantInfo tenantInfo = tenantInfoMapper.selectTenantInfoByIdTenantInfo(Long.valueOf(id)); TenantInfo tenantInfo = tenantInfoMapper.selectTenantInfoByIdTenantInfo(Long.valueOf(id));
String status = DictUtils.getDictValue("sys_tenant_status", "生效中");
Preconditions.checkState(status.equals(tenantInfo.getStatus()), "该租户不是生效中状态,不能发起委托任务");
String dictValue = DictUtils.getDictValue("sys_delegate_status", "已委托"); String dictValue = DictUtils.getDictValue("sys_delegate_status", "已委托");
String busiType = DictUtils.getDictValue("sys_busi_type", "天数套餐"); String busiType = DictUtils.getDictValue("sys_busi_type", "天数套餐");
TrxExchangeInfo trxExchangeInfo = TrxExchangeInfo.builder().fromAddress(tenantInfo.getReceiverAddress()) TrxExchangeInfo trxExchangeInfo = TrxExchangeInfo.builder().fromAddress(tenantInfo.getReceiverAddress())
@ -173,11 +176,6 @@ public class TenantInfoServiceImpl implements ITenantInfoService
Preconditions.checkState(CollectionUtil.isEmpty(trxExchangeInfos), "该接收能量地址已在任务中,请勿重复发起"); Preconditions.checkState(CollectionUtil.isEmpty(trxExchangeInfos), "该接收能量地址已在任务中,请勿重复发起");
Date finishTransferTime = tenantInfo.getFinishTransferTime();
int compare = DateUtil.compare(new Date(), finishTransferTime);
Preconditions.checkState(compare <= 0, "租户已过期,无法再次委托能量");
MonitorAddressInfo monitorAddressInfoExample = new MonitorAddressInfo(); MonitorAddressInfo monitorAddressInfoExample = new MonitorAddressInfo();
monitorAddressInfoExample.setMonitorAddress(tenantInfo.getMonitorAddress()); monitorAddressInfoExample.setMonitorAddress(tenantInfo.getMonitorAddress());
monitorAddressInfoExample.setIsValid(UserConstants.YES); monitorAddressInfoExample.setIsValid(UserConstants.YES);
@ -196,6 +194,9 @@ public class TenantInfoServiceImpl implements ITenantInfoService
trxExchange.setLockNum(between + 1); trxExchange.setLockNum(between + 1);
trxExchangeInfoService.delegate(trxExchange, true); trxExchangeInfoService.delegate(trxExchange, true);
tenantInfo.setDelegatedDays(tenantInfo.getDelegatedDays() + 1);
tenantInfoMapper.updateTenantInfo(tenantInfo);
} }
return 1; return 1;

View File

@ -38,6 +38,7 @@ import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.util.UriComponentsBuilder; import org.springframework.web.util.UriComponentsBuilder;
import org.tron.trident.core.ApiWrapper; import org.tron.trident.core.ApiWrapper;
import org.tron.trident.core.exceptions.IllegalException; import org.tron.trident.core.exceptions.IllegalException;
@ -382,6 +383,7 @@ public class TrxExchangeInfoServiceImpl implements ITrxExchangeInfoService {
* @param monitorAddressAccount * @param monitorAddressAccount
* @throws IllegalException * @throws IllegalException
*/ */
@Transactional
private void doDelegateResource(Contract contract, String txID, MonitorAddressAccount monitorAddressAccount) throws Exception { private void doDelegateResource(Contract contract, String txID, MonitorAddressAccount monitorAddressAccount) throws Exception {
@ -406,12 +408,12 @@ public class TrxExchangeInfoServiceImpl implements ITrxExchangeInfoService {
TenantInfo tenantInfoExample = new TenantInfo(); TenantInfo tenantInfoExample = new TenantInfo();
tenantInfoExample.setReceiverAddress(ownerAddress); tenantInfoExample.setReceiverAddress(ownerAddress);
// tenantInfoExample.setMonitorAddress(monitorAddressAccount.getMonitorAddress()); // tenantInfoExample.setMonitorAddress(monitorAddressAccount.getMonitorAddress());
tenantInfoExample.setFinishTransferTime(new Date());
tenantInfoExample.setIsPaid(UserConstants.NO); tenantInfoExample.setIsPaid(UserConstants.NO);
tenantInfoExample.setStatus(DictUtils.getDictValue("sys_tenant_status", "生效中"));
List<TenantInfo> tenantInfoList = tenantInfoMapper.selectTenantInfoList(tenantInfoExample); List<TenantInfo> tenantInfoList = tenantInfoMapper.selectTenantInfoList(tenantInfoExample);
TenantInfo tenantInfo = null;
if (tenantInfoList.size() > 0) { if (tenantInfoList.size() > 0) {
TenantInfo tenantInfo = tenantInfoList.get(0); tenantInfo = tenantInfoList.get(0);
Long exchangeAmount = tenantInfo.getExchangeAmount(); Long exchangeAmount = tenantInfo.getExchangeAmount();
//判断入账金额是否与转入金额相等,如果相等则设置为已支付 //判断入账金额是否与转入金额相等,如果相等则设置为已支付
if (amount != exchangeAmount) { if (amount != exchangeAmount) {
@ -429,7 +431,8 @@ public class TrxExchangeInfoServiceImpl implements ITrxExchangeInfoService {
tenantInfo.setIsPaid("Y"); tenantInfo.setIsPaid("Y");
tenantInfo.setLcu("system"); tenantInfo.setLcu("system");
tenantInfo.setTxId(txID); tenantInfo.setTxId(txID);
tenantInfoMapper.updateTenantInfo(tenantInfo); tenantInfo.setDelegatedDays(tenantInfo.getDelegatedDays() + 1);
//取包天的套餐锁定时间和交易笔数 //取包天的套餐锁定时间和交易笔数
lockPeriod = 1200L * 24; lockPeriod = 1200L * 24;
busiType = DictUtils.getDictValue("sys_busi_type", "天数套餐"); busiType = DictUtils.getDictValue("sys_busi_type", "天数套餐");
@ -458,6 +461,10 @@ public class TrxExchangeInfoServiceImpl implements ITrxExchangeInfoService {
calcBalanceAndDelegate(txID, apiWrapper, accountAddress, transferCount, ownerAddress, lockPeriod, toAddress, price, busiType, amount, "system"); calcBalanceAndDelegate(txID, apiWrapper, accountAddress, transferCount, ownerAddress, lockPeriod, toAddress, price, busiType, amount, "system");
//持久化之后放redis //持久化之后放redis
redisTemplate.opsForValue().set("transfer_trx_" + txID, txID, 1, TimeUnit.DAYS); redisTemplate.opsForValue().set("transfer_trx_" + txID, txID, 1, TimeUnit.DAYS);
if (tenantInfo !=null){
tenantInfoMapper.updateTenantInfo(tenantInfo);
}
} }
/** /**
@ -577,23 +584,32 @@ public class TrxExchangeInfoServiceImpl implements ITrxExchangeInfoService {
//查询是否是按天支付的租户,是的话需要回收完再次赠送 //查询是否是按天支付的租户,是的话需要回收完再次赠送
TenantInfo tenantInfoExample = new TenantInfo(); TenantInfo tenantInfoExample = new TenantInfo();
tenantInfoExample.setReceiverAddress(trxExchangeInfo.getFromAddress()); tenantInfoExample.setReceiverAddress(trxExchangeInfo.getFromAddress());
tenantInfoExample.setStatus(DictUtils.getDictValue("sys_tenant_status", "生效中"));
// tenantInfoExample.setMonitorAddress(trxExchangeInfo.getToAddress()); // tenantInfoExample.setMonitorAddress(trxExchangeInfo.getToAddress());
tenantInfoExample.setFinishTransferTime(new Date());
List<TenantInfo> tenantInfoList = tenantInfoMapper.selectTenantInfoList(tenantInfoExample); List<TenantInfo> tenantInfoList = tenantInfoMapper.selectTenantInfoList(tenantInfoExample);
TenantInfo tenantInfo = null;
if (tenantInfoList.size() > 0) { if (tenantInfoList.size() > 0) {
Response.AccountResourceMessage accountResource = apiWrapper.getAccountResource(accountAddress); Response.AccountResourceMessage accountResource = apiWrapper.getAccountResource(accountAddress);
TenantInfo tenantInfo = tenantInfoList.get(0); tenantInfo = tenantInfoList.get(0);
if (UserConstants.NO.equals(tenantInfo.getIsPaid())) { if (UserConstants.NO.equals(tenantInfo.getIsPaid())) {
return; return;
} }
/* String status = DictUtils.getDictValue("sys_tenant_status", "生效中");
if (!status.equals(tenantInfo.getStatus())){
return;//不是生效中状态不处理
}*/
Long period = tenantInfo.getPeriod(); Long period = tenantInfo.getPeriod();
Date tenantInfoFcd = tenantInfo.getFcd(); // long between = DateUtil.between(tenantInfoFcd, new Date(), DateUnit.DAY);
long between = DateUtil.between(tenantInfoFcd, new Date(), DateUnit.DAY); Long delegatedDays = tenantInfo.getDelegatedDays();
if (between > period) {
//已到期不处理 if (delegatedDays == period) {
//委托天数已用完不再处理,更改状态为已满期
String expire = DictUtils.getDictValue("sys_tenant_status", "已满期");
tenantInfo.setStatus(expire);
tenantInfoMapper.updateTenantInfo(tenantInfo);
return; return;
} }
@ -603,6 +619,8 @@ public class TrxExchangeInfoServiceImpl implements ITrxExchangeInfoService {
return; return;
} }
tenantInfo.setDelegatedDays(delegatedDays + 1);
String receiverAddress = tenantInfo.getReceiverAddress(); String receiverAddress = tenantInfo.getReceiverAddress();
Long transferCount = tenantInfo.getTransferCount(); Long transferCount = tenantInfo.getTransferCount();
long newLockPeriod = 24 * 1200L; long newLockPeriod = 24 * 1200L;
@ -647,6 +665,11 @@ public class TrxExchangeInfoServiceImpl implements ITrxExchangeInfoService {
trxExchangeInfoMapper.insertTrxExchangeInfo(trxExchangeInfoNew);*/ trxExchangeInfoMapper.insertTrxExchangeInfo(trxExchangeInfoNew);*/
} }
if (tenantInfo != null){
tenantInfoMapper.updateTenantInfo(tenantInfo);
}
} catch (Exception e) { } catch (Exception e) {
log.error("回收能量业务处理异常{}", trxExchangeInfo.getIdTrxExchangeInfo(), e); log.error("回收能量业务处理异常{}", trxExchangeInfo.getIdTrxExchangeInfo(), e);
ErrorLog errorLog = ErrorLog.builder() ErrorLog errorLog = ErrorLog.builder()

View File

@ -15,7 +15,9 @@
<result property="exchangeAmount" column="exchange_amount" /> <result property="exchangeAmount" column="exchange_amount" />
<result property="isPaid" column="is_paid" /> <result property="isPaid" column="is_paid" />
<result property="period" column="period" /> <result property="period" column="period" />
<result property="finishTransferTime" column="finish_transfer_time" /> <result property="userId" column="user_id" />
<result property="status" column="status" />
<result property="delegatedDays" column="delegated_days" />
<result property="fcd" column="fcd" /> <result property="fcd" column="fcd" />
<result property="fcu" column="fcu" /> <result property="fcu" column="fcu" />
<result property="lcd" column="lcd" /> <result property="lcd" column="lcd" />
@ -23,12 +25,13 @@
</resultMap> </resultMap>
<sql id="selectTenantInfoVo"> <sql id="selectTenantInfoVo">
select id_tenant_info, receiver_address, monitor_address, price, transfer_count, exchange_unit, tx_id, exchange_amount, is_paid, period, finish_transfer_time, fcd, fcu, lcd, lcu from tenant_info select id_tenant_info, receiver_address, monitor_address, price, transfer_count, exchange_unit, tx_id, exchange_amount, is_paid, period, t.status, delegated_days, fcd, fcu, lcd, lcu from tenant_info t
</sql> </sql>
<select id="selectTenantInfoList" parameterType="TenantInfo" resultMap="TenantInfoResult"> <select id="selectTenantInfoList" parameterType="TenantInfo" resultMap="TenantInfoResult">
<include refid="selectTenantInfoVo"/> <include refid="selectTenantInfoVo"/>
<where> left join sys_user u on t.user_id = u.user_id
<where> 1 = 1
<if test="receiverAddress != null and receiverAddress != ''"> and receiver_address = #{receiverAddress}</if> <if test="receiverAddress != null and receiverAddress != ''"> and receiver_address = #{receiverAddress}</if>
<if test="monitorAddress != null and monitorAddress != ''"> and monitor_address = #{monitorAddress}</if> <if test="monitorAddress != null and monitorAddress != ''"> and monitor_address = #{monitorAddress}</if>
<if test="price != null "> and price = #{price}</if> <if test="price != null "> and price = #{price}</if>
@ -38,12 +41,13 @@
<if test="exchangeAmount != null "> and exchange_amount = #{exchangeAmount}</if> <if test="exchangeAmount != null "> and exchange_amount = #{exchangeAmount}</if>
<if test="isPaid != null and isPaid != ''"> and is_paid = #{isPaid}</if> <if test="isPaid != null and isPaid != ''"> and is_paid = #{isPaid}</if>
<if test="period != null "> and period = #{period}</if> <if test="period != null "> and period = #{period}</if>
<if test="finishTransferTime != null "> and finish_transfer_time &gt;= #{finishTransferTime}</if> <if test="fcd != null "> and fcd = #{fcd}</if>
<if test="fcd != null "> and fcd &gt;= #{fcd}</if>
<if test="fcu != null and fcu != ''"> and fcu = #{fcu}</if> <if test="fcu != null and fcu != ''"> and fcu = #{fcu}</if>
<if test="lcd != null "> and lcd &lt;= #{lcd}</if> <if test="lcd != null "> and lcd = #{lcd}</if>
<if test="lcu != null and lcu != ''"> and lcu = #{lcu}</if> <if test="lcu != null and lcu != ''"> and lcu = #{lcu}</if>
</where> </where>
<!-- 数据范围过滤 -->
${params.dataScope}
</select> </select>
<select id="selectTenantInfoByIdTenantInfo" parameterType="Long" resultMap="TenantInfoResult"> <select id="selectTenantInfoByIdTenantInfo" parameterType="Long" resultMap="TenantInfoResult">
@ -63,7 +67,9 @@
<if test="exchangeAmount != null">exchange_amount,</if> <if test="exchangeAmount != null">exchange_amount,</if>
<if test="isPaid != null">is_paid,</if> <if test="isPaid != null">is_paid,</if>
<if test="period != null">period,</if> <if test="period != null">period,</if>
<if test="finishTransferTime != null">finish_transfer_time,</if> <if test="userId != null">user_id,</if>
<if test="status != null">status,</if>
<if test="delegatedDays != null">delegated_days,</if>
<if test="fcd != null">fcd,</if> <if test="fcd != null">fcd,</if>
<if test="fcu != null">fcu,</if> <if test="fcu != null">fcu,</if>
<if test="lcd != null">lcd,</if> <if test="lcd != null">lcd,</if>
@ -79,7 +85,9 @@
<if test="exchangeAmount != null">#{exchangeAmount},</if> <if test="exchangeAmount != null">#{exchangeAmount},</if>
<if test="isPaid != null">#{isPaid},</if> <if test="isPaid != null">#{isPaid},</if>
<if test="period != null">#{period},</if> <if test="period != null">#{period},</if>
<if test="finishTransferTime != null">#{finishTransferTime},</if> <if test="userId != null">#{userId},</if>
<if test="status != null">#{status},</if>
<if test="delegatedDays != null">#{delegatedDays},</if>
<if test="fcd != null">#{fcd},</if> <if test="fcd != null">#{fcd},</if>
<if test="fcu != null">#{fcu},</if> <if test="fcu != null">#{fcu},</if>
<if test="lcd != null">#{lcd},</if> <if test="lcd != null">#{lcd},</if>
@ -99,7 +107,9 @@
<if test="exchangeAmount != null">exchange_amount = #{exchangeAmount},</if> <if test="exchangeAmount != null">exchange_amount = #{exchangeAmount},</if>
<if test="isPaid != null">is_paid = #{isPaid},</if> <if test="isPaid != null">is_paid = #{isPaid},</if>
<if test="period != null">period = #{period},</if> <if test="period != null">period = #{period},</if>
<if test="finishTransferTime != null">finish_transfer_time = #{finishTransferTime},</if> <if test="userId != null">user_id = #{userId},</if>
<if test="status != null">status = #{status},</if>
<if test="delegatedDays != null">delegated_days = #{delegatedDays},</if>
<if test="fcd != null">fcd = #{fcd},</if> <if test="fcd != null">fcd = #{fcd},</if>
<if test="fcu != null">fcu = #{fcu},</if> <if test="fcu != null">fcu = #{fcu},</if>
<if test="lcd != null">lcd = #{lcd},</if> <if test="lcd != null">lcd = #{lcd},</if>