diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenantbalance/vo/TenantBalanceTransferReqVO.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenantbalance/vo/TenantBalanceTransferReqVO.java index dae2424..5f0e939 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenantbalance/vo/TenantBalanceTransferReqVO.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/controller/admin/tenantbalance/vo/TenantBalanceTransferReqVO.java @@ -21,11 +21,11 @@ public class TenantBalanceTransferReqVO { @NotNull(message = "增加的余额不能为空") private Integer transferAmount; - @Schema(description = "变动描述", example = "充值") - @NotNull(message = "变动描述不能为空") - private String description; @Schema(description = "登录密码", requiredMode = Schema.RequiredMode.REQUIRED, example = "123456") @NotNull(message = "登录密码不能为空") private String password; + + @Schema(description = "备注", example = "转账") + private String remark; } diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/tenantpoints/TenantPointsDO.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/tenantpoints/TenantPointsDO.java index 25f7d66..04b6551 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/tenantpoints/TenantPointsDO.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/dal/dataobject/tenantpoints/TenantPointsDO.java @@ -64,4 +64,5 @@ public class TenantPointsDO { private Long tenantId; + private String remark; } \ No newline at end of file diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenantbalance/TenantBalanceServiceImpl.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenantbalance/TenantBalanceServiceImpl.java index 7000ede..2e9cae2 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenantbalance/TenantBalanceServiceImpl.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/service/tenantbalance/TenantBalanceServiceImpl.java @@ -237,8 +237,9 @@ public class TenantBalanceServiceImpl implements TenantBalanceService { tenantPointsDO.setBalance(tenantNewBalance); // 设置变动后的余额 tenantPointsDO.setOperatorId(loginUserId); // 设置操作人ID tenantPointsDO.setType(TRANSFER.getDesc()); // 设置交易类型为转账 - tenantPointsDO.setDescription(transferReqVO.getDescription()); // 设置交易描述 + tenantPointsDO.setDescription("转账给租户" + transferReqVO.getTargetTenantId() + ",金额:" + transferReqVO.getTransferAmount()); // 设置交易描述 tenantPointsDO.setBizNo(transfer); // 设置业务流水号 + tenantPointsDO.setRemark(transferReqVO.getRemark()); int tenantInsert = tenantPointsMapper.insert(tenantPointsDO); // 插入记录 // 创建转入方的积分变动记录 @@ -248,7 +249,7 @@ public class TenantBalanceServiceImpl implements TenantBalanceService { targetPointsDO.setBalance(targetTenantNewBalance); // 设置变动后的余额 targetPointsDO.setOperatorId(loginUserId); // 设置操作人ID targetPointsDO.setType(TRANSFER.getDesc()); // 设置交易类型为转账 - targetPointsDO.setDescription(transferReqVO.getDescription()); // 设置交易描述 + targetPointsDO.setDescription("转账来自租户" + tenantId + ",金额:" + transferReqVO.getTransferAmount()); // 设置交易描述 targetPointsDO.setBizNo(transfer); // 设置业务流水号(与转出方使用同一个流水号) int targetInsert = tenantPointsMapper.insert(targetPointsDO); // 插入记录 diff --git a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/util/BizNoGenerator.java b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/util/BizNoGenerator.java index 3e79919..32dd235 100644 --- a/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/util/BizNoGenerator.java +++ b/yudao-module-system/src/main/java/cn/iocoder/yudao/module/system/util/BizNoGenerator.java @@ -1,34 +1,9 @@ package cn.iocoder.yudao.module.system.util; -import java.text.SimpleDateFormat; -import java.util.Date; -import java.util.concurrent.atomic.AtomicInteger; +import cn.hutool.core.util.IdUtil; public class BizNoGenerator { - - private static final AtomicInteger SEQUENCE = new AtomicInteger(0); - private static final int MAX_SEQUENCE = 999999; - - private static final SimpleDateFormat DATE_FORMAT = new SimpleDateFormat("yyyyMMdd"); - - /** - * 生成通用业务流水号 - * 格式:PREFIX-yyyyMMdd-000001 - */ public static String generate(String prefix) { - String date = DATE_FORMAT.format(new Date()); - - // 自增序列(每天重置) - int seq = SEQUENCE.incrementAndGet(); - if (seq > MAX_SEQUENCE) { - synchronized (BizNoGenerator.class) { - if (SEQUENCE.get() > MAX_SEQUENCE) { - SEQUENCE.set(1); - seq = 1; - } - } - } - - return prefix + "-" + date + "-" + String.format("%06d", seq); + return prefix + "-" + IdUtil.getSnowflakeNextIdStr(); } }