update 部分接口新增返回算力单位

This commit is contained in:
yyb
2026-01-28 15:02:09 +08:00
parent f8d1bdf819
commit 96a49c5813
7 changed files with 65 additions and 2 deletions

View File

@@ -118,6 +118,9 @@ public class OrderInfoDto {
private BigDecimal powerRatio;
@ApiModelProperty(value = "算力单位")
private String unit;
/**
* 订单详情
*/

View File

@@ -101,5 +101,7 @@ public class OrderItemDto {
@ApiModelProperty(value = "实际算力/理论算力 比值")
private BigDecimal powerRatio;
@ApiModelProperty(value = "算力单位")
private String unit;
}

View File

@@ -105,4 +105,15 @@ public interface LeaseOrderMiningMapper extends BaseMapper<LeaseOrderMining> {
*/
@MiningDB
List<RealHashrateInfoDto> getRealTimeHashrate(@Param("tableName") String tableName, @Param("datetime") String datetime, @Param("list") List<RealTimeHashrateQueryDto> list);
/**
* 获取指定时间范围内的算力数据
* @param tableName 表名2miners
* @param startTime 开始时间
* @param endTime 结束时间
* @param list 查询条件列表
* @return 实时算力信息列表
*/
@MiningDB
List<RealHashrateInfoDto> getHashrateInRange(@Param("tableName") String tableName, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("list") List<RealTimeHashrateQueryDto> list);
}

View File

@@ -310,7 +310,26 @@ public class RedisService {
*/
public <T> void deleteCacheMapValue7(final Map<String, String> keyFieldMap) {
keyFieldMap.forEach((key, hKey) -> {
redisTemplate7.opsForHash().delete(key, hKey);
try {
// 先判断 key 是否存在
if (redisTemplate7.hasKey(key)) {
// 检查 key 的类型是否为 Hash
org.springframework.data.redis.core.DataType dataType = redisTemplate7.type(key);
if (dataType == org.springframework.data.redis.core.DataType.HASH) {
// 再判断 hKey 是否存在
if (redisTemplate7.opsForHash().hasKey(key, hKey)) {
redisTemplate7.opsForHash().delete(key, hKey);
}
} else {
System.out.println(String.format("警告: key %s 存在但类型为 %s不是 Hash 类型,跳过删除 hKey %s",
key, dataType, hKey));
}
}
} catch (Exception e) {
System.err.println(String.format("删除 Redis Hash 数据时出错: key=%s, hKey=%s, error=%s",
key, hKey, e.getMessage()));
// 不抛出异常,继续处理下一个
}
});
}

View File

@@ -527,6 +527,8 @@ public class LeaseOrderInfoServiceImpl extends ServiceImpl<LeaseOrderInfoMapper,
.image(leaseOrderItem.getImage())
.numbers(leaseOrderItem.getNumbers())
.type(leaseOrderItem.getType() ? 1 : 0)
//TODO 先默认MH/S
.unit("MH/S")
.build());
// 累加支付金额
@@ -573,6 +575,8 @@ public class LeaseOrderInfoServiceImpl extends ServiceImpl<LeaseOrderInfoMapper,
.totalTheoryPower(BigDecimal.ZERO)
.totalPracticalPower(BigDecimal.ZERO)
.totalPayAmount(BigDecimal.ZERO)
//TODO 先默认MH/S
.unit("MH/S")
.build();
@@ -603,6 +607,8 @@ public class LeaseOrderInfoServiceImpl extends ServiceImpl<LeaseOrderInfoMapper,
.practicalPower(practicalPower)
.powerRatio(powerRatio)
.payAmount(alreadyPayRealAmount)
//TODO 先默认MH/S
.unit("MH/S")
.build());
}
orderInfoDto.setPayCoin(list.get(0).getPayCoin());