现金业绩拆分成可分红业绩, 总业绩.
升级看总业绩 , 分红看分红业绩
This commit is contained in:
4
doc/sql/pending/20260420_increase.sql
Normal file
4
doc/sql/pending/20260420_increase.sql
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
alter table market_cash_performance
|
||||||
|
add dividend_amount decimal(14, 2) default 0.00;
|
||||||
|
|
||||||
|
comment on column market_cash_performance.dividend_amount is '可分红业绩';
|
||||||
@@ -118,7 +118,7 @@ public class AccelUpgradeCashProcessor implements BasicProcessor {
|
|||||||
Wrappers.lambdaQuery(CommonOrderConfirmLogEntity.class)
|
Wrappers.lambdaQuery(CommonOrderConfirmLogEntity.class)
|
||||||
.eq(CommonOrderConfirmLogEntity::getIsAgencyDistributed, 0)
|
.eq(CommonOrderConfirmLogEntity::getIsAgencyDistributed, 0)
|
||||||
.func(queryWrapper -> queryWrapper.apply("UPPER(order_type) = {0}", orderType))
|
.func(queryWrapper -> queryWrapper.apply("UPPER(order_type) = {0}", orderType))
|
||||||
.in(CommonOrderConfirmLogEntity::getPaymentType, List.of(1, 2))
|
.in(CommonOrderConfirmLogEntity::getPaymentType, List.of(PaymentType.ALI.getCode() , PaymentType.WECHAT.getCode()))
|
||||||
.ge(CommonOrderConfirmLogEntity::getCreateTime, startDate)
|
.ge(CommonOrderConfirmLogEntity::getCreateTime, startDate)
|
||||||
.le(CommonOrderConfirmLogEntity::getCreateTime, endDate)
|
.le(CommonOrderConfirmLogEntity::getCreateTime, endDate)
|
||||||
.orderByAsc(CommonOrderConfirmLogEntity::getId)
|
.orderByAsc(CommonOrderConfirmLogEntity::getId)
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ import org.springblade.core.tool.sensitive.SensitiveUtil;
|
|||||||
import org.springblade.modules.common.eums.BusinessModule;
|
import org.springblade.modules.common.eums.BusinessModule;
|
||||||
import org.springblade.modules.common.eums.OrderStatus;
|
import org.springblade.modules.common.eums.OrderStatus;
|
||||||
import org.springblade.modules.common.eums.PaymentStatus;
|
import org.springblade.modules.common.eums.PaymentStatus;
|
||||||
|
import org.springblade.modules.common.eums.PaymentType;
|
||||||
import org.springblade.modules.common.pojo.entity.CommonOrderConfirmLogEntity;
|
import org.springblade.modules.common.pojo.entity.CommonOrderConfirmLogEntity;
|
||||||
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
import org.springblade.modules.common.pojo.entity.CommonUserOrderEntity;
|
||||||
import org.springblade.modules.common.service.ICommonOrderConfirmLogService;
|
import org.springblade.modules.common.service.ICommonOrderConfirmLogService;
|
||||||
@@ -63,7 +64,7 @@ public class StatsCalculatorCashProcessor implements BasicProcessor {
|
|||||||
|
|
||||||
List<CommonOrderConfirmLogEntity> orderPageList = orderConfirmLogService.list(
|
List<CommonOrderConfirmLogEntity> orderPageList = orderConfirmLogService.list(
|
||||||
Wrappers.lambdaQuery(CommonOrderConfirmLogEntity.class)
|
Wrappers.lambdaQuery(CommonOrderConfirmLogEntity.class)
|
||||||
.in(CommonOrderConfirmLogEntity::getPaymentType, List.of(1, 2))
|
.in(CommonOrderConfirmLogEntity::getPaymentType, List.of(PaymentType.ALI.getCode() , PaymentType.WECHAT.getCode() , PaymentType.OFFLINE.getCode()))
|
||||||
.func(queryWrapper -> queryWrapper.apply("UPPER(order_type) = {0}", orderType))
|
.func(queryWrapper -> queryWrapper.apply("UPPER(order_type) = {0}", orderType))
|
||||||
.ge(CommonOrderConfirmLogEntity::getCreateTime, startDate)
|
.ge(CommonOrderConfirmLogEntity::getCreateTime, startDate)
|
||||||
.le(CommonOrderConfirmLogEntity::getCreateTime, endDate)
|
.le(CommonOrderConfirmLogEntity::getCreateTime, endDate)
|
||||||
@@ -106,8 +107,8 @@ public class StatsCalculatorCashProcessor implements BasicProcessor {
|
|||||||
}
|
}
|
||||||
BigDecimal finalActualAmount = actualAmount;
|
BigDecimal finalActualAmount = actualAmount;
|
||||||
// 构建详情
|
// 构建详情
|
||||||
String sourceDetail = String.format("现金业绩详情:订单号:%d;商品:%s;实付金额:%s元",
|
String sourceDetail = String.format("现金业绩详情:订单号:%d;商品:%s;实付金额:%s元;支付渠道:%s",
|
||||||
order.getId(), order.getItemName(), actualAmount);
|
order.getId(), order.getItemName(), actualAmount , PaymentType.fromCode(order.getPaymentType()).getName());
|
||||||
|
|
||||||
// 获取用户账号 (用于脱敏)
|
// 获取用户账号 (用于脱敏)
|
||||||
User user = userMap.get(userId);
|
User user = userMap.get(userId);
|
||||||
@@ -138,12 +139,24 @@ public class StatsCalculatorCashProcessor implements BasicProcessor {
|
|||||||
MarketCashPerformanceEntity entity = new MarketCashPerformanceEntity();
|
MarketCashPerformanceEntity entity = new MarketCashPerformanceEntity();
|
||||||
entity.setId(ancestorId);
|
entity.setId(ancestorId);
|
||||||
entity.setTotalAmount(finalActualAmount);
|
entity.setTotalAmount(finalActualAmount);
|
||||||
|
if (order.getPaymentType() == PaymentType.ALI.getCode() || order.getPaymentType() == PaymentType.WECHAT.getCode()){
|
||||||
|
entity.setDividendAmount(finalActualAmount);
|
||||||
|
}else {
|
||||||
|
entity.setDividendAmount(BigDecimal.ZERO);
|
||||||
|
}
|
||||||
entity.setUpdateTime(new Date());
|
entity.setUpdateTime(new Date());
|
||||||
cashPerformanceMap.put(ancestorId, entity);
|
cashPerformanceMap.put(ancestorId, entity);
|
||||||
|
|
||||||
}else {
|
}else {
|
||||||
MarketCashPerformanceEntity entity = cashPerformanceMap.get(ancestorId);
|
MarketCashPerformanceEntity entity = cashPerformanceMap.get(ancestorId);
|
||||||
entity.setTotalAmount(entity.getTotalAmount().add(finalActualAmount));
|
entity.setTotalAmount(entity.getTotalAmount().add(finalActualAmount));
|
||||||
|
|
||||||
|
if (order.getPaymentType() == PaymentType.ALI.getCode() || order.getPaymentType() == PaymentType.WECHAT.getCode()){
|
||||||
|
entity.setDividendAmount(entity.getDividendAmount().add(finalActualAmount));
|
||||||
|
}else {
|
||||||
|
entity.setDividendAmount(entity.getDividendAmount().add(BigDecimal.ZERO));
|
||||||
|
}
|
||||||
|
|
||||||
cashPerformanceMap.put(ancestorId, entity);
|
cashPerformanceMap.put(ancestorId, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -160,7 +173,7 @@ public class StatsCalculatorCashProcessor implements BasicProcessor {
|
|||||||
|
|
||||||
}else {
|
}else {
|
||||||
MarketCashPerformanceEntity entity = owenCashPerformanceMap.get(userId);
|
MarketCashPerformanceEntity entity = owenCashPerformanceMap.get(userId);
|
||||||
entity.setOwenAmount(entity.getTotalAmount().add(finalActualAmount));
|
entity.setOwenAmount(entity.getOwenAmount().add(finalActualAmount));
|
||||||
owenCashPerformanceMap.put(userId, entity);
|
owenCashPerformanceMap.put(userId, entity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@
|
|||||||
INSERT INTO market_cash_performance (
|
INSERT INTO market_cash_performance (
|
||||||
id,
|
id,
|
||||||
total_amount,
|
total_amount,
|
||||||
|
dividend_amount,
|
||||||
update_time,
|
update_time,
|
||||||
version
|
version
|
||||||
) VALUES
|
) VALUES
|
||||||
@@ -35,12 +36,14 @@
|
|||||||
(
|
(
|
||||||
#{entity.id},
|
#{entity.id},
|
||||||
#{entity.totalAmount},
|
#{entity.totalAmount},
|
||||||
|
#{entity.dividendAmount},
|
||||||
#{entity.updateTime},
|
#{entity.updateTime},
|
||||||
1
|
1
|
||||||
)
|
)
|
||||||
</foreach>
|
</foreach>
|
||||||
ON CONFLICT (id) DO UPDATE SET
|
ON CONFLICT (id) DO UPDATE SET
|
||||||
total_amount = market_cash_performance.total_amount + EXCLUDED.total_amount,
|
total_amount = market_cash_performance.total_amount + EXCLUDED.total_amount,
|
||||||
|
dividend_amount = market_cash_performance.dividend_amount + EXCLUDED.dividend_amount,
|
||||||
update_time = EXCLUDED.update_time,
|
update_time = EXCLUDED.update_time,
|
||||||
version = market_cash_performance.version + 1
|
version = market_cash_performance.version + 1
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,13 @@ public class MarketCashPerformanceEntity extends BaseEntity {
|
|||||||
*/
|
*/
|
||||||
@Schema(description = "总业绩")
|
@Schema(description = "总业绩")
|
||||||
private BigDecimal totalAmount;
|
private BigDecimal totalAmount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 可分红业绩
|
||||||
|
*/
|
||||||
|
@Schema(description = "可分红业绩")
|
||||||
|
private BigDecimal dividendAmount;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 版本号
|
* 版本号
|
||||||
*/
|
*/
|
||||||
|
|||||||
Reference in New Issue
Block a user