update 订单不在计算手续费(内部转账),订单相关列表新增支付币种返回

This commit is contained in:
yyb
2026-01-19 16:17:44 +08:00
parent 748d35063c
commit 2abc34fdf5
3 changed files with 27 additions and 19 deletions

View File

@@ -81,6 +81,11 @@ public class LeaseOrderInfo implements Serializable {
*/ */
private String shopName; private String shopName;
/**
* 金额单位(币种)
*/
private String coin;
@TableField(exist = false) @TableField(exist = false)
private String chainAndCoinAndShopIdKey; private String chainAndCoinAndShopIdKey;

View File

@@ -707,13 +707,13 @@ public class LeaseOrderInfoServiceImpl extends ServiceImpl<LeaseOrderInfoMapper,
} }
Map<Long, OrderMiningInfoDto> userAndMinerMap = orderMiningInfoDtoList.stream().collect(Collectors.toMap(OrderMiningInfoDto::getMachineId, Function.identity())); Map<Long, OrderMiningInfoDto> userAndMinerMap = orderMiningInfoDtoList.stream().collect(Collectors.toMap(OrderMiningInfoDto::getMachineId, Function.identity()));
GoogleInfo googleInfo = leaseUserMapper.getGoogleInfoByEmail(userEmail); GoogleInfo googleInfo = leaseUserMapper.getGoogleInfoByEmail(userEmail);
//if(googleInfo == null || StringUtils.isBlank(googleInfo.getSecret())){ if(googleInfo == null || StringUtils.isBlank(googleInfo.getSecret())){
// //未绑定定谷歌验证器 //未绑定定谷歌验证器
// return Result.fail("您的账号未开启双重验证,请先开启验证!"); return Result.fail("您的账号未开启双重验证,请先开启验证!");
//} }
//if(!GoogleAuthenticator.checkCode(googleInfo.getSecret(), orderAndCodeVo.getCode(), System.currentTimeMillis())){ if(!GoogleAuthenticator.checkCode(googleInfo.getSecret(), orderAndCodeVo.getCode(), System.currentTimeMillis())){
// return Result.fail("谷歌验证码错误"); return Result.fail("谷歌验证码错误");
//} }
Map<Long, OrderInfoVo> collect1 = orderInfoVoList.stream() Map<Long, OrderInfoVo> collect1 = orderInfoVoList.stream()
.collect(Collectors.toMap(OrderInfoVo::getMachineId,Function.identity())); .collect(Collectors.toMap(OrderInfoVo::getMachineId,Function.identity()));
List<LeaseMachine> machineList = leaseMachineMapper.selectBatchIds(collect1.keySet()); List<LeaseMachine> machineList = leaseMachineMapper.selectBatchIds(collect1.keySet());
@@ -726,10 +726,9 @@ public class LeaseOrderInfoServiceImpl extends ServiceImpl<LeaseOrderInfoMapper,
return Result.fail("购买的ASIC商品中,存在可售数量不足的商品!"); return Result.fail("购买的ASIC商品中,存在可售数量不足的商品!");
} }
boolean isGpuPass = checkGpuMachine(gpuMachines); boolean isGpuPass = checkGpuMachine(gpuMachines);
//TODO 开发环境 if (!isGpuPass){
//if (!isGpuPass){ return Result.fail("购买的GPU商品中,存在客户端不在线的矿机!");
// return Result.fail("购买的GPU商品中,存在客户端不在线的矿机!"); }
//}
//存储相同链和币种的map集合 //存储相同链和币种的map集合
Map<String, Map<String, List<OrderInfoVo>>> chainAndCoinMap = new HashMap<>(); Map<String, Map<String, List<OrderInfoVo>>> chainAndCoinMap = new HashMap<>();
Map<Long, LeaseMachinePrice> orderTotalPriceGroupByChainAndCoin = leaseMachinePriceMapper.getOrderTotalPriceGroupByChainAndCoin(orderInfoVoList); Map<Long, LeaseMachinePrice> orderTotalPriceGroupByChainAndCoin = leaseMachinePriceMapper.getOrderTotalPriceGroupByChainAndCoin(orderInfoVoList);
@@ -784,15 +783,17 @@ public class LeaseOrderInfoServiceImpl extends ServiceImpl<LeaseOrderInfoMapper,
String[] split = key.split("-"); String[] split = key.split("-");
String coin = split[1]; String coin = split[1];
String chain = split[0]; String chain = split[0];
BigDecimal fee = CoinCharge.getFee(chain, coin, totalPrice); // 支付现在是运算力平台内部转账,实际并未转账不在需要手续费
//BigDecimal fee = CoinCharge.getFee(chain, coin, totalPrice);
leaseOrderInfoList.add(LeaseOrderInfo.builder() leaseOrderInfoList.add(LeaseOrderInfo.builder()
.coin(coin)
.chainAndCoinAndShopIdKey(key) .chainAndCoinAndShopIdKey(key)
.chainAndCoinKey(chain+"-"+coin) .chainAndCoinKey(chain+"-"+coin)
.orderNumber(UuidGeneratorUtil.generateUuidWithoutHyphen()) .orderNumber(UuidGeneratorUtil.generateUuidWithoutHyphen())
.userId(userEmail) .userId(userEmail)
.authId(SecurityUtils.getUserId()) .authId(SecurityUtils.getUserId())
.shopName(shopNameMapByIds.get(Long.parseLong(split[2])).getName()) .shopName(shopNameMapByIds.get(Long.parseLong(split[2])).getName())
.fee(fee) .fee(BigDecimal.ZERO)
.totalPrice(totalPrice) .totalPrice(totalPrice)
.createTime(now) .createTime(now)
.build()); .build());
@@ -883,7 +884,9 @@ public class LeaseOrderInfoServiceImpl extends ServiceImpl<LeaseOrderInfoMapper,
.type(leaseMachine.getType()) .type(leaseMachine.getType())
.theoryPower(theoryHashRate) .theoryPower(theoryHashRate)
.build(); .build();
Long timestamp = startTime + orderInfoVo.getLeaseTime() * 24 * 60 * 60 * 1000L; //Long timestamp = startTime + orderInfoVo.getLeaseTime() * 24 * 60 * 60 * 1000L;
//开发环境
Long timestamp = startTime + orderInfoVo.getLeaseTime() * 30 * 60 * 1000L;
endMiningMap.put(machineId,timestamp); endMiningMap.put(machineId,timestamp);
machineOrderIdMap.put(machineId,leaseOrderInfo.getId()); machineOrderIdMap.put(machineId,leaseOrderInfo.getId());
@@ -913,10 +916,9 @@ public class LeaseOrderInfoServiceImpl extends ServiceImpl<LeaseOrderInfoMapper,
if (i != machineIds.size()){ if (i != machineIds.size()){
throw new OrderException("订单中已有商品售出,请刷新购物车删除已售出商品,重新结算生成订单"); throw new OrderException("订单中已有商品售出,请刷新购物车删除已售出商品,重新结算生成订单");
} }
//TODO 开发环境 不添加 if(!checkGpuMachine(gpuMachines)){
//if(!checkGpuMachine(gpuMachines)){ throw new OrderException("购买的GPU商品中,存在客户端不在线的矿机!");
// throw new OrderException("购买的GPU商品中,存在客户端不在线的矿机!"); }
//}
//gpu矿机处理 发送消息 //gpu矿机处理 发送消息
sendMessageToClientAndInsertPurchasedMachine(SecurityUtils.getUserId(),userEmail,gpuMachines,orderMiningInfoDtoList,endMiningMap,machineOrderIdMap,machineOrderItemIdMap); sendMessageToClientAndInsertPurchasedMachine(SecurityUtils.getUserId(),userEmail,gpuMachines,orderMiningInfoDtoList,endMiningMap,machineOrderIdMap,machineOrderItemIdMap);

View File

@@ -28,7 +28,8 @@
loo.status, loo.status,
loo.create_time as createTime, loo.create_time as createTime,
loo.update_time as endTime, loo.update_time as endTime,
loo.shop_name as shopName loo.shop_name as shopName,
loo.coin as payCoin
from lease_order_info loo from lease_order_info loo
<where> <where>
del = 0 and auth_id = #{authId} del = 0 and auth_id = #{authId}