+ * 规则 + * 127.xxx.xxx.xxx 属于 “loopback” 地址,即只能你自己的本机可见,就是本机地址,比较常见的有 127.0.0.1 + * 192.168.xxx.xxx 属于 private 私有地址 (site local address),属于本地组织内部访问,只能在本地局域网可见 + * 同样 10.xxx.xxx.xxx、从 172.16.xxx.xxx 到172.31.xxx.xxx 都是私有地址,也是属于组织内部访问 + * 169.254.xxx.xxx 属于连接本地地址(link local IP),在单独网段可用 + * 从 224.xxx.xxx.xxx 到 239.xxx.xxx.xxx 属于组播地址 + * 比较特殊的 255.255.255.255 属于广播地址 + * 除此之外的地址就是点对点的可用的公开 IPv4 地址 + *
+ */ + public static String getRandomIp() { + // 指定 IP 范围 + int[][] range = { + {607649792, 608174079}, // 36.56.0.0-36.63.255.255 + {1038614528, 1039007743}, // 61.232.0.0-61.237.255.255 + {1783627776, 1784676351}, // 106.80.0.0-106.95.255.255 + {2035023872, 2035154943}, // 121.76.0.0-121.77.255.255 + {2078801920, 2079064063}, // 123.232.0.0-123.235.255.255 + {-1950089216, -1948778497}, // 139.196.0.0-139.215.255.255 + {-1425539072, -1425014785}, // 171.8.0.0-171.15.255.255 + {-1236271104, -1235419137}, // 182.80.0.0-182.92.255.255 + {-770113536, -768606209}, // 210.25.0.0-210.47.255.255 + {-569376768, -564133889}, // 222.16.0.0-222.95.255.255 + }; + + Random random = new Random(); + int index = random.nextInt(10); + String ip = num2ip(range[index][0] + random.nextInt(range[index][1] - range[index][0])); + return ip; + } + + /** + * 将十进制转换成IP地址 + */ + public static String num2ip(int ip) { + int[] b = new int[4]; + b[0] = (ip >> 24) & 0xff; + b[1] = (ip >> 16) & 0xff; + b[2] = (ip >> 8) & 0xff; + b[3] = ip & 0xff; + // 拼接 IP + String result = b[0] + "." + b[1] + "." + b[2] + "." + b[3]; + return result; + } + + public static void main(String[] args) { + for (int i = 0; i < 10; i++) { + String randomIp = getRandomIp(); + System.out.println(randomIp); + } + } +} diff --git a/ruoyi-admin/src/test/java/vo/MyHttpCookie.java b/ruoyi-admin/src/test/java/vo/MyHttpCookie.java new file mode 100644 index 000000000..c9f78203b --- /dev/null +++ b/ruoyi-admin/src/test/java/vo/MyHttpCookie.java @@ -0,0 +1,7 @@ +package vo; + +import java.net.HttpCookie; + +public class MyHttpCookie { + +} diff --git a/ruoyi-xnlmp/src/main/java/com/ruoyi/xnlmp/domain/MpRechargeConsumptionRecord.java b/ruoyi-xnlmp/src/main/java/com/ruoyi/xnlmp/domain/MpRechargeConsumptionRecord.java index d870750e7..f589cbe4b 100644 --- a/ruoyi-xnlmp/src/main/java/com/ruoyi/xnlmp/domain/MpRechargeConsumptionRecord.java +++ b/ruoyi-xnlmp/src/main/java/com/ruoyi/xnlmp/domain/MpRechargeConsumptionRecord.java @@ -1,9 +1,13 @@ package com.ruoyi.xnlmp.domain; import java.math.BigDecimal; +import java.util.Date; +import com.fasterxml.jackson.annotation.JsonFormat; import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; import org.apache.commons.lang3.builder.ToStringBuilder; import org.apache.commons.lang3.builder.ToStringStyle; import com.ruoyi.common.annotation.Excel; @@ -11,113 +15,60 @@ import com.ruoyi.common.core.domain.BaseEntity; /** * 充值、消费记录对象 mp_recharge_consumption_record - * + * * @author ruoyi * @date 2024-12-14 */ +@Data +@ToString @ApiModel(value = "充值、消费记录对象") -public class MpRechargeConsumptionRecord extends BaseEntity -{ +public class MpRechargeConsumptionRecord extends BaseEntity { private static final long serialVersionUID = 1L; - /** $column.columnComment */ + /** + * $column.columnComment + */ private Long id; - /** 金额 */ + /** + * 金额 + */ @Excel(name = "金额") @ApiModelProperty("金额") private BigDecimal amount; - /** 1:充值2:消费 */ + + @ApiModelProperty("产品id") + private Long productInfoId; + + @ApiModelProperty("产品名称") + private String productInfoName; + + /** + * 1:充值2:消费 + */ @Excel(name = "1:充值2:消费") @ApiModelProperty("1:充值2:消费") private Integer type; - /** 用户id */ + /** + * 用户id + */ @Excel(name = "用户id") @ApiModelProperty("用户id") private Long userId; - /** 当前余额 */ + /** + * 当前余额 + */ @Excel(name = "当前余额") @ApiModelProperty("当前余额") private BigDecimal balance; - /** 版本号 */ + /** + * 版本号 + */ @Excel(name = "版本号") private Long version; - public void setId(Long id) - { - this.id = id; - } - - public Long getId() - { - return id; - } - - public void setAmount(BigDecimal amount) - { - this.amount = amount; - } - - public BigDecimal getAmount() - { - return amount; - } - - public void setType(Integer type) - { - this.type = type; - } - - public Integer getType() - { - return type; - } - - public void setUserId(Long userId) - { - this.userId = userId; - } - - public Long getUserId() - { - return userId; - } - - public void setBalance(BigDecimal balance) - { - this.balance = balance; - } - - public BigDecimal getBalance() - { - return balance; - } - - public void setVersion(Long version) - { - this.version = version; - } - - public Long getVersion() - { - return version; - } - - @Override - public String toString() { - return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) - .append("id", getId()) - .append("amount", getAmount()) - .append("type", getType()) - .append("userId", getUserId()) - .append("balance", getBalance()) - .append("createTime", getCreateTime()) - .append("updateTime", getUpdateTime()) - .append("version", getVersion()) - .toString(); - } } diff --git a/ruoyi-xnlmp/src/main/java/com/ruoyi/xnlmp/domain/vo/MpRechargeConsumptionRecordVO.java b/ruoyi-xnlmp/src/main/java/com/ruoyi/xnlmp/domain/vo/MpRechargeConsumptionRecordVO.java new file mode 100644 index 000000000..e220d14b4 --- /dev/null +++ b/ruoyi-xnlmp/src/main/java/com/ruoyi/xnlmp/domain/vo/MpRechargeConsumptionRecordVO.java @@ -0,0 +1,69 @@ +package com.ruoyi.xnlmp.domain.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import com.ruoyi.common.annotation.Excel; +import com.ruoyi.common.core.domain.BaseEntity; +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.ToString; +import org.apache.commons.lang3.builder.ToStringBuilder; +import org.apache.commons.lang3.builder.ToStringStyle; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * 充值、消费记录对象 mp_recharge_consumption_record + * + * @author ruoyi + * @date 2024-12-14 + */ +@Data +@ToString +@ApiModel(value = "充值、消费记录对象") +public class MpRechargeConsumptionRecordVO { + private static final long serialVersionUID = 1L; + + /** + * $column.columnComment + */ + private Long id; + + /** + * 金额 + */ + @Excel(name = "金额") + @ApiModelProperty("金额") + private BigDecimal amount; + + @ApiModelProperty("产品id") + private Long productInfoId; + + @ApiModelProperty("产品名称") + private String productInfoName; + /** + * 1:充值2:消费 + */ + @Excel(name = "1:充值2:消费") + @ApiModelProperty("1:充值2:消费") + private Integer type; + + /** + * 用户id + */ + @Excel(name = "用户id") + @ApiModelProperty("用户id") + private Long userId; + + /** + * 当前余额 + */ + @Excel(name = "当前余额") + @ApiModelProperty("当前余额") + private BigDecimal balance; + + /** 创建时间 */ + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") + private Date createTime; +} diff --git a/ruoyi-xnlmp/src/main/java/com/ruoyi/xnlmp/domain/vo/SysUserVO.java b/ruoyi-xnlmp/src/main/java/com/ruoyi/xnlmp/domain/vo/SysUserVO.java index 6383cda2f..1dda886b3 100644 --- a/ruoyi-xnlmp/src/main/java/com/ruoyi/xnlmp/domain/vo/SysUserVO.java +++ b/ruoyi-xnlmp/src/main/java/com/ruoyi/xnlmp/domain/vo/SysUserVO.java @@ -9,6 +9,8 @@ import io.swagger.annotations.ApiModel; import io.swagger.annotations.ApiModelProperty; import lombok.ToString; +import java.math.BigDecimal; + /** * 用户对象 sys_user * @@ -52,6 +54,10 @@ public class SysUserVO extends BaseEntity { @ApiModelProperty("身份证号") private String iDNumber; + + @ApiModelProperty("账号余额") + private BigDecimal accountBalance; + /** * 会员等级 */ @@ -245,4 +251,12 @@ public class SysUserVO extends BaseEntity { public void setMpMembershipLevel(MpMembershipLevel mpMembershipLevel) { this.mpMembershipLevel = mpMembershipLevel; } + + public BigDecimal getAccountBalance() { + return accountBalance; + } + + public void setAccountBalance(BigDecimal accountBalance) { + this.accountBalance = accountBalance; + } } diff --git a/ruoyi-xnlmp/src/main/java/com/ruoyi/xnlmp/mapper/MpRechargeConsumptionRecordMapper.java b/ruoyi-xnlmp/src/main/java/com/ruoyi/xnlmp/mapper/MpRechargeConsumptionRecordMapper.java index d0adc0582..22a45d1ae 100644 --- a/ruoyi-xnlmp/src/main/java/com/ruoyi/xnlmp/mapper/MpRechargeConsumptionRecordMapper.java +++ b/ruoyi-xnlmp/src/main/java/com/ruoyi/xnlmp/mapper/MpRechargeConsumptionRecordMapper.java @@ -27,6 +27,8 @@ public interface MpRechargeConsumptionRecordMapper */ public List