mirror of
https://gitee.com/hhyykk/ipms-sjy.git
synced 2025-08-18 04:01:54 +08:00
trade: 优化分销用户佣金字段名称
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
@@ -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"
|
||||
|
Reference in New Issue
Block a user