update 租赁系统1.1.0 钱包地址参数加密,gpu矿机新增到订单流程测试修改等

This commit is contained in:
yyb
2025-12-22 09:43:40 +08:00
parent f1896bc1ae
commit 4e23775014
10 changed files with 83 additions and 21 deletions

View File

@@ -2,6 +2,7 @@ package com.m2pool.lease.controller;
import com.m2pool.common.security.annotation.RequiresLogin; import com.m2pool.common.security.annotation.RequiresLogin;
import com.m2pool.lease.annotation.Decrypt;
import com.m2pool.lease.dto.OrderInfoDto; import com.m2pool.lease.dto.OrderInfoDto;
import com.m2pool.lease.dto.PageResult; import com.m2pool.lease.dto.PageResult;
import com.m2pool.lease.dto.PaymentRecordDto; import com.m2pool.lease.dto.PaymentRecordDto;
@@ -38,6 +39,7 @@ public class LeaseOrderInfoController {
@ApiOperation("创建订单及订单详情 + 支付订单(返回二维码内容)") @ApiOperation("创建订单及订单详情 + 支付订单(返回二维码内容)")
@PostMapping("/addOrders") @PostMapping("/addOrders")
@Decrypt
public Result<String> addOrders(@RequestBody OrderAndCodeVo orderAndCodeVo) { public Result<String> addOrders(@RequestBody OrderAndCodeVo orderAndCodeVo) {
return leaseOrderInfoService.addOrders(orderAndCodeVo); return leaseOrderInfoService.addOrders(orderAndCodeVo);
} }

View File

@@ -1,18 +1,22 @@
package com.m2pool.lease.controller; package com.m2pool.lease.controller;
import com.m2pool.lease.dto.*; import com.m2pool.lease.annotation.Decrypt;
import com.m2pool.lease.dto.PageResult;
import com.m2pool.lease.dto.Result;
import com.m2pool.lease.dto.v2.PayWithdrawSellerRecordDto; import com.m2pool.lease.dto.v2.PayWithdrawSellerRecordDto;
import com.m2pool.lease.dto.v2.ShopWalletInfoDto; import com.m2pool.lease.dto.v2.ShopWalletInfoDto;
import com.m2pool.lease.service.LeaseShopService; import com.m2pool.lease.service.LeaseShopService;
import com.m2pool.lease.vo.BalancePageVo;
import com.m2pool.lease.vo.BalanceVo; import com.m2pool.lease.vo.BalanceVo;
import com.m2pool.lease.vo.BaseVo; import com.m2pool.lease.vo.BaseVo;
import com.m2pool.lease.vo.PageVo; import com.m2pool.lease.vo.PageVo;
import com.m2pool.lease.vo.v2.ShopWalletInfoVo; import com.m2pool.lease.vo.v2.ShopWalletInfoVo;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
@@ -46,12 +50,14 @@ public class LeaseShopV2Controller {
@PostMapping("/withdrawBalanceForSeller") @PostMapping("/withdrawBalanceForSeller")
@ApiOperation(value = "卖家店铺钱包余额提现") @ApiOperation(value = "卖家店铺钱包余额提现")
@Decrypt
public Result<String> withdrawBalanceForSeller(@RequestBody BalanceVo balanceVo){ public Result<String> withdrawBalanceForSeller(@RequestBody BalanceVo balanceVo){
return leaseShopService.withdrawBalanceForSeller(balanceVo); return leaseShopService.withdrawBalanceForSeller(balanceVo);
} }
@ApiOperation("钱包配置----根据配置id 修改商铺收款钱包配置") @ApiOperation("钱包配置----根据配置id 修改商铺收款钱包配置")
@PostMapping("/updateShopConfigV2") @PostMapping("/updateShopConfigV2")
@Decrypt
public Result<String> updateShopConfigV2(@RequestBody ShopWalletInfoVo shopWalletInfoVo) { public Result<String> updateShopConfigV2(@RequestBody ShopWalletInfoVo shopWalletInfoVo) {
return leaseShopService.updateShopConfigV2(shopWalletInfoVo); return leaseShopService.updateShopConfigV2(shopWalletInfoVo);
} }

View File

@@ -2,6 +2,7 @@ package com.m2pool.lease.controller;
import com.m2pool.common.security.annotation.RequiresLogin; import com.m2pool.common.security.annotation.RequiresLogin;
import com.m2pool.lease.annotation.Decrypt;
import com.m2pool.lease.dto.*; import com.m2pool.lease.dto.*;
import com.m2pool.lease.service.LeaseUserService; import com.m2pool.lease.service.LeaseUserService;
import com.m2pool.lease.vo.*; import com.m2pool.lease.vo.*;
@@ -52,6 +53,7 @@ public class LeaseUserController {
@PostMapping("/withdrawBalance") @PostMapping("/withdrawBalance")
@ApiOperation(value = "申请余额提现") @ApiOperation(value = "申请余额提现")
@Decrypt
public Result<String> withdrawBalance(@RequestBody BalanceVo balanceVo){ public Result<String> withdrawBalance(@RequestBody BalanceVo balanceVo){
return leaseUserService.withdrawBalance(balanceVo); return leaseUserService.withdrawBalance(balanceVo);
} }

View File

@@ -1,5 +1,6 @@
package com.m2pool.lease.dto.v2; package com.m2pool.lease.dto.v2;
import com.m2pool.lease.annotation.EncryptedField;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
@@ -33,6 +34,7 @@ public class OrderMiningInfoDto {
private Long machineId; private Long machineId;
@ApiModelProperty(value = "挖矿钱包(用户自己输入)") @ApiModelProperty(value = "挖矿钱包(用户自己输入)")
@EncryptedField
private String walletAddress; private String walletAddress;
@ApiModelProperty(value = "挖矿账号(用户自己输入)") @ApiModelProperty(value = "挖矿账号(用户自己输入)")

View File

@@ -155,4 +155,11 @@ public interface LeaseMachineMapper extends BaseMapper<LeaseMachine> {
* @return * @return
*/ */
boolean updateBatchSaleNumbers(@Param("list") List<LeaseMachine> list); boolean updateBatchSaleNumbers(@Param("list") List<LeaseMachine> list);
/**
* 检测店铺下是否有已出售的矿机
* @return
*/
int checkHasSaleMachineByShopId(@Param("shopId") Long shopId);
} }

View File

@@ -19,11 +19,6 @@ public class ChannelManager {
*/ */
private static final Map<String, Channel> channelMap = new ConcurrentHashMap<>(); private static final Map<String, Channel> channelMap = new ConcurrentHashMap<>();
/**
* key channel value mac
*/
public static final Map<Channel, String> macMap = new ConcurrentHashMap<>();
/** /**
* key channel value id * key channel value id
*/ */
@@ -49,9 +44,7 @@ public class ChannelManager {
Channel channel = channelMap.get(ip); Channel channel = channelMap.get(ip);
if (channel != null){ if (channel != null){
idMap.remove(channel); idMap.remove(channel);
macMap.remove(channel);
channelMap.remove(ip); channelMap.remove(ip);
} }
@@ -68,21 +61,20 @@ public class ChannelManager {
} }
/** /**
* 根据mac地址获取Channel * 根据id: 邮箱::mac地址获取Channel
* @param mac * @param id
* @return * @return
*/ */
public static Channel getChannelByMac(String mac) { public static Channel getChannelById(String id) {
Optional<Channel> key = macMap.entrySet() Optional<Channel> key = idMap.entrySet()
.stream() .stream()
.filter(entry -> mac.equals(entry.getValue())) .filter(entry -> id.equals(entry.getValue()))
.map(Map.Entry::getKey) .map(Map.Entry::getKey)
.findFirst(); .findFirst();
return key.orElse(null); return key.orElse(null);
} }
public static boolean sendToClient(String mac, Object message) { public static boolean sendToClient(String id, Object message) {
Channel channel = getChannelById(id);
Channel channel = getChannelByMac(mac);
if (channel != null && channel.isActive()) { if (channel != null && channel.isActive()) {
channel.writeAndFlush(message).syncUninterruptibly(); channel.writeAndFlush(message).syncUninterruptibly();
return false; return false;

View File

@@ -210,6 +210,9 @@ public class LeaseMachineServiceImpl extends ServiceImpl<LeaseMachineMapper, Lea
@Override @Override
public PageResult<SellerMachineInfoDto> getShopMachineListForSeller(SellerMachineVo sellerMachineVo) { public PageResult<SellerMachineInfoDto> getShopMachineListForSeller(SellerMachineVo sellerMachineVo) {
LeaseShop leaseShop = getShopById(); LeaseShop leaseShop = getShopById();
if (leaseShop == null){
return PageResult.fail(new ArrayList<>(), "暂无店铺");
}
PageHelper.startPage(sellerMachineVo.getPageNum(), sellerMachineVo.getPageSize()); PageHelper.startPage(sellerMachineVo.getPageNum(), sellerMachineVo.getPageSize());
List<SellerMachineInfoDto> machineInfoDtoList = leaseMachineMapper.getShopMachineListForSeller(sellerMachineVo,leaseShop.getId()); List<SellerMachineInfoDto> machineInfoDtoList = leaseMachineMapper.getShopMachineListForSeller(sellerMachineVo,leaseShop.getId());
PageInfo<SellerMachineInfoDto> pageInfo = new PageInfo<>(machineInfoDtoList); PageInfo<SellerMachineInfoDto> pageInfo = new PageInfo<>(machineInfoDtoList);

View File

@@ -0,0 +1,34 @@
package com.m2pool.lease.task.info;
import lombok.Data;
import java.math.BigDecimal;
/**
* @Description 算法信息类
* @Date 2025/12/16 15:43
* @Author yyb
*/
@Data
public class BlockInfo {
/**
* 币种
*/
private String coin;
/**
* 每日报块数
*/
private String blocks;
/**
* 报块间隔
*/
private BigDecimal blockInterval;
/**
* 报块奖励
*/
private BigDecimal blockReward;
}

View File

@@ -1,12 +1,12 @@
package com.m2pool.lease.vo; package com.m2pool.lease.vo;
import com.m2pool.lease.annotation.EncryptedField;
import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty; import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor; import lombok.AllArgsConstructor;
import lombok.Builder; import lombok.Builder;
import lombok.Data; import lombok.Data;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import org.apache.poi.openxml4j.opc.PackageRelationship;
import java.math.BigDecimal; import java.math.BigDecimal;
@@ -48,11 +48,13 @@ public class BalanceVo {
private BigDecimal serviceCharge; private BigDecimal serviceCharge;
@ApiModelProperty(value = "绑定的地址",required = true) @ApiModelProperty(value = "绑定的地址",required = true)
@EncryptedField
private String fromAddress; private String fromAddress;
/** /**
* 提现地址(用户自定义) * 提现地址(用户自定义)
*/ */
@ApiModelProperty(value = "提现地址(用户自定义)",required = true) @ApiModelProperty(value = "提现地址(用户自定义)",required = true)
@EncryptedField
private String toAddress; private String toAddress;
@ApiModelProperty(value = "谷歌双重验证验证码",required = true) @ApiModelProperty(value = "谷歌双重验证验证码",required = true)

View File

@@ -126,7 +126,7 @@
FROM FROM
lease_machine lm lease_machine lm
JOIN JOIN
lease_machine_config gpc ON lm.id = gpc.machine_id AND lm.type = #{shopMachineVo.type} AND lm.shop_id = #{shopMachineVo.shopId} AND lm.online_status = true AND lm.sale_state = 0 lease_machine_config gpc ON lm.id = gpc.machine_id AND lm.type = #{shopMachineVo.type} AND lm.shop_id = #{shopMachineVo.shopId} AND lm.online_status = true AND lm.sale_state = 0 AND lm.state = 0
GROUP BY lm.id,gpc.coin,gpc.algorithm GROUP BY lm.id,gpc.coin,gpc.algorithm
) sub ) sub
LEFT JOIN lease_machine_price mp LEFT JOIN lease_machine_price mp
@@ -139,7 +139,6 @@
<if test="shopMachineVo.keyword != null and shopMachineVo.keyword != ''"> <if test="shopMachineVo.keyword != null and shopMachineVo.keyword != ''">
AND (sub.coin LIKE CONCAT('%', #{shopMachineVo.keyword}, '%') OR sub.algorithm LIKE CONCAT('%', #{shopMachineVo.keyword}, '%')) AND (sub.coin LIKE CONCAT('%', #{shopMachineVo.keyword}, '%') OR sub.algorithm LIKE CONCAT('%', #{shopMachineVo.keyword}, '%'))
</if> </if>
</select> </select>
@@ -445,6 +444,8 @@
</foreach> </foreach>
</select> </select>
<update id="updateBatchSaleNumbers"> <update id="updateBatchSaleNumbers">
<foreach collection="list" item="item" separator=";"> <foreach collection="list" item="item" separator=";">
UPDATE lease_machine UPDATE lease_machine
@@ -456,4 +457,15 @@
</foreach> </foreach>
</update> </update>
<select id="checkHasSaleMachineByShopId" resultType="java.lang.Integer">
SELECT
COUNT(*)
FROM
lease_machine
WHERE
shop_id = #{shopId}
and `sale_state` = 1
and `del` = 0
</select>
</mapper> </mapper>