diff --git a/src/main/java/com/m2pool/lease/mapper/LeaseOrderItemMapper.java b/src/main/java/com/m2pool/lease/mapper/LeaseOrderItemMapper.java index 82ba0d5..38de5cc 100644 --- a/src/main/java/com/m2pool/lease/mapper/LeaseOrderItemMapper.java +++ b/src/main/java/com/m2pool/lease/mapper/LeaseOrderItemMapper.java @@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import com.m2pool.lease.dto.OrderStatusDto; import com.m2pool.lease.dto.v2.OrderTimeInfoDto; import com.m2pool.lease.entity.LeaseOrderItem; +import com.m2pool.lease.entity.LeasePayRecordMessage; import com.m2pool.lease.entity.LeasePaymentRecord; import com.m2pool.lease.entity.LeaseShopConfig; import com.m2pool.lease.mq.message.RabbitmqPayAutoReturnInfoMessage; @@ -88,4 +89,11 @@ public interface LeaseOrderItemMapper extends BaseMapper { */ long checkShopExistRunningOrderNumbers(@Param("list") List list); + + /** + * 批量更新订单详情的已实际支付金额 + * @param reocrdList + * @return + */ + int updateSettleAmount(@Param("list") List reocrdList); } diff --git a/src/main/resources/mapper/lease/LeaseMachineMapper.xml b/src/main/resources/mapper/lease/LeaseMachineMapper.xml index bd02705..f919d33 100644 --- a/src/main/resources/mapper/lease/LeaseMachineMapper.xml +++ b/src/main/resources/mapper/lease/LeaseMachineMapper.xml @@ -77,61 +77,152 @@ @@ -256,56 +431,81 @@ FROM ( SELECT - sub.id, - sub.shop_id AS shopId, - sub.type, - sub.`user`, - sub.miner, - sub.state, - sub.sale_state AS saleState, - sub.max_lease_days AS maxLeaseDays, - sub.del, - sub.power_dissipation AS powerDissipation, - sub.hashrate AS power, - sub.unit, - sub.coin, - sub.month_income AS monthIncome, - sub.NAME, - sub.online_status AS onlineStatus, - sub.can_sale_numbers as canSaleNumbers, - sub.algorithm, - ci.id AS cartInfoId, - ci.numbers, - ci.lease_time AS leaseTime, - ROW_NUMBER() OVER ( PARTITION BY sub.id ORDER BY sub.month_income DESC ) AS rn + t.id, + t.shop_id AS shopId, + t.type, + t.`user`, + t.miner, + t.state, + t.sale_state AS saleState, + t.max_lease_days AS maxLeaseDays, + t.del, + t.power_dissipation AS powerDissipation, + t.hashrate AS power, + t.unit, + t.coin, + t.month_income AS monthIncome, + t.NAME, + t.online_status AS onlineStatus, + t.can_sale_numbers as canSaleNumbers, + t.algorithm, + t.cartInfoId, + t.numbers, + t.lease_time AS leaseTime, + @rn := IF(@prev_id = t.id, @rn + 1, 1) AS rn, + @prev_id := t.id FROM ( SELECT - lm.id, - lm.shop_id, - lm.type, - lm.`user`, - lm.miner, - lm.state, - lm.sale_state, - lm.max_lease_days, - lm.del, - lm.online_status, - lm.can_sale_numbers, - gpc.power_dissipation AS power_dissipation, - gpc.hashrate, - gpc.month_income AS month_income, - gpc.unit, - gpc.coin, - gpc.NAME, - gpc.algorithm + sub.id, + sub.shop_id , + sub.type, + sub.`user`, + sub.miner, + sub.state, + sub.sale_state , + sub.max_lease_days , + sub.del, + sub.power_dissipation , + sub.hashrate , + sub.unit, + sub.coin, + sub.month_income, + sub.NAME, + sub.online_status , + sub.can_sale_numbers , + sub.algorithm, + ci.id AS cartInfoId, + ci.numbers, + ci.lease_time AS lease_time FROM - lease_machine lm - JOIN lease_machine_config gpc ON lm.id = gpc.machine_id AND gpc.status = 1 - GROUP BY - lm.id, - gpc.coin, - gpc.`algorithm` + ( + SELECT + lm.id, + lm.shop_id, + lm.type, + lm.`user`, + lm.miner, + lm.state, + lm.sale_state, + lm.max_lease_days, + lm.del, + lm.online_status, + lm.can_sale_numbers, + gpc.power_dissipation AS power_dissipation, + gpc.hashrate, + gpc.month_income AS month_income, + gpc.unit, + gpc.coin, + gpc.name, + gpc.algorithm + FROM + lease_machine lm + JOIN lease_machine_config gpc ON lm.id = gpc.machine_id AND gpc.status = 1 + GROUP BY + lm.id, + gpc.coin, + gpc.`algorithm`,gpc.power_dissipation,gpc.hashrate,gpc.month_income, gpc.unit, gpc.name ) sub JOIN lease_shopping_cart_info ci ON sub.id = ci.product_machine_id AND ci.user_id = #{userId} AND ci.version = 1 @@ -314,9 +514,80 @@ #{machineId} + ORDER BY sub.id, sub.month_income DESC + ) t, + (SELECT @rn := 0, @prev_id := 0) r ) t WHERE rn = 1 + +-- 开发环境 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + select product_machine_id AS productMachineId from lease_order_item where @@ -127,5 +128,14 @@ ) + + UPDATE lease_order_item + SET already_pay_real_amount = settle_pay_real_amount,settle_pay_real_amount = 0 + WHERE order_id IN ( + + #{item.orderId} + + ) + diff --git a/src/main/resources/mapper/lease/LeaseOrderMiningMapper.xml b/src/main/resources/mapper/lease/LeaseOrderMiningMapper.xml index a92219a..61c89eb 100644 --- a/src/main/resources/mapper/lease/LeaseOrderMiningMapper.xml +++ b/src/main/resources/mapper/lease/LeaseOrderMiningMapper.xml @@ -103,11 +103,17 @@ t.miner FROM ( SELECT - datetime, - hashrate, - miner, - ROW_NUMBER() OVER(PARTITION BY miner ORDER BY datetime DESC) as rn - FROM `${pool}` + sub.datetime, + sub.hashrate, + sub.miner, + @rn := IF(@prev_miner = sub.miner, @rn + 1, 1) AS rn, + @prev_miner := sub.miner + FROM ( + SELECT + datetime, + hashrate, + miner + FROM `${pool}` WHERE wallet = #{wallet} AND coin = #{coin} AND miner IN ( @@ -115,8 +121,33 @@ #{item.workerId} ) + ORDER BY miner, datetime DESC + ) sub, + (SELECT @rn := 0, @prev_miner := '') r ) t WHERE t.rn = 1 + +-- 开发环境 + + + + + + + + + + + + + + + + + + + +