trade: 优化分销用户佣金字段名称

This commit is contained in:
owen
2023-09-08 23:10:04 +08:00
parent 4b43304c76
commit 1ead368595
18 changed files with 124 additions and 125 deletions

View File

@@ -79,38 +79,38 @@ public class BrokerageRecordServiceImplTest extends BaseDbUnitTest {
}
@Test
public void testCalculateBrokeragePrice_useFixedBrokeragePrice() {
public void testCalculatePrice_useFixedPrice() {
// mock 数据
Integer payPrice = randomInteger();
Integer percent = randomInt(1, 101);
Integer fixedBrokeragePrice = randomInt();
Integer fixedPrice = randomInt();
// 调用
int brokerage = brokerageRecordService.calculateBrokeragePrice(payPrice, percent, fixedBrokeragePrice);
int brokerage = brokerageRecordService.calculatePrice(payPrice, percent, fixedPrice);
// 断言
assertEquals(brokerage, fixedBrokeragePrice);
assertEquals(brokerage, fixedPrice);
}
@Test
public void testCalculateBrokeragePrice_usePercent() {
public void testCalculatePrice_usePercent() {
// mock 数据
Integer payPrice = randomInteger();
Integer percent = randomInt(1, 101);
Integer skuBrokeragePrice = randomEle(new Integer[]{0, null});
System.out.println("skuBrokeragePrice=" + skuBrokeragePrice);
Integer fixedPrice = randomEle(new Integer[]{0, null});
System.out.println("fixedPrice=" + fixedPrice);
// 调用
int brokerage = brokerageRecordService.calculateBrokeragePrice(payPrice, percent, skuBrokeragePrice);
int brokerage = brokerageRecordService.calculatePrice(payPrice, percent, fixedPrice);
// 断言
assertEquals(brokerage, NumberUtil.div(NumberUtil.mul(payPrice, percent), 100, 0, RoundingMode.DOWN).intValue());
}
@Test
public void testCalculateBrokeragePrice_equalsZero() {
public void testCalculatePrice_equalsZero() {
// mock 数据
Integer payPrice = null;
Integer percent = null;
Integer skuBrokeragePrice = null;
Integer fixedPrice = null;
// 调用
int brokerage = brokerageRecordService.calculateBrokeragePrice(payPrice, percent, skuBrokeragePrice);
int brokerage = brokerageRecordService.calculatePrice(payPrice, percent, fixedPrice);
// 断言
assertEquals(brokerage, 0);
}

View File

@@ -128,19 +128,19 @@ CREATE TABLE IF NOT EXISTS "trade_after_sale_log" (
CREATE TABLE IF NOT EXISTS "trade_brokerage_user"
(
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"bind_user_id" bigint NOT NULL,
"bind_user_time" varchar,
"brokerage_enabled" bit NOT NULL,
"brokerage_time" varchar,
"brokerage_price" int NOT NULL,
"frozen_brokerage_price" int NOT NULL,
"creator" varchar DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
"tenant_id" bigint NOT NULL DEFAULT '0',
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"bind_user_id" bigint NOT NULL,
"bind_user_time" varchar,
"brokerage_enabled" bit NOT NULL,
"brokerage_time" varchar,
"price" int NOT NULL,
"frozen_price" int NOT NULL,
"creator" varchar DEFAULT '',
"create_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updater" varchar DEFAULT '',
"update_time" datetime NOT NULL DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP,
"deleted" bit NOT NULL DEFAULT FALSE,
"tenant_id" bigint NOT NULL DEFAULT '0',
PRIMARY KEY ("id")
) COMMENT '分销用户';
CREATE TABLE IF NOT EXISTS "trade_brokerage_record"