feat:平台流水抽成

This commit is contained in:
dzc committed 2026-07-14 16:06:10 +08:00
1 parent 77d7700709
commit dbf20d66d4
6 files changed
+41

No files matched your search

@@ -61,6 +61,12 @@ public class HardOrderCsVo implements BaseMchInterface, BaseHardInterface {
@Schema(description = "日期")
private String day;
@Schema(description = "平台抽成比例")
private Double mchPlatformRanke;
@Schema(description = "平台抽成(元)")
private BigDecimal mchPlatformRankePrice;
/**
* 导出相关
*/
@@ -376,6 +376,8 @@ public class HardOrderTotalController {
// 总盈利
BigDecimal totalProfitPrice = BigDecimal.ZERO;
BigDecimal totalProfitCount = BigDecimal.ZERO;
// 总抽成
BigDecimal mchPlatformRankeTotalPrice = BigDecimal.ZERO;
Long lineNumber = 1L;
for (HardOrderCsVo v : list) {
v.setLineNumber(lineNumber);
@@ -407,6 +409,11 @@ public class HardOrderTotalController {
if (ObjectUtil.isNotEmpty(v.getTotalProfitCount())) {
totalProfitCount = totalProfitCount.add(v.getTotalProfitCount());
}
// 平台抽成
if (ObjectUtil.isNotEmpty(v.getMchPlatformRankePrice())) {
mchPlatformRankeTotalPrice = mchPlatformRankeTotalPrice.add(v.getMchPlatformRankePrice());
v.setMchPlatformRankePrice(v.getMchPlatformRankePrice().divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP));
}
}
// 总消费
map.put("computeTotalPayPrice", totalPayPrice.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
@@ -417,6 +424,8 @@ public class HardOrderTotalController {
// 总盈利
map.put("computeTotalProfitPrice", totalProfitPrice.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
map.put("computeTotalProfitCount", totalProfitCount.toString());
// 总抽成
map.put("mchPlatformRankeTotalPrice", mchPlatformRankeTotalPrice.divide(BigDecimal.valueOf(100)).setScale(2, RoundingMode.HALF_UP).toString());
}
excelWriter.fill(map, writeSheet);
excelWriter.fill(list, fillConfig, writeSheet);
@@ -224,6 +224,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
List<MchManageVo> mchList = getMchListByIds(mchIds);
if (ObjectUtil.isNotEmpty(mchList)) {
WalletDataUtil.convertMchList(totalList, CollectionUtils.convertMap(mchList, MchManageVo::getId));
computeMchPlatformRanke(totalList, mchList);
}
}
// 商户部门
@@ -323,6 +324,7 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
List<MchManageVo> mchList = getMchListByIds(mchIds);
if (ObjectUtil.isNotEmpty(mchList)) {
WalletDataUtil.convertMchList(totalList, CollectionUtils.convertMap(mchList, MchManageVo::getId));
computeMchPlatformRanke(totalList, mchList);
}
}
// 商户部门
@@ -971,6 +973,23 @@ public class HardOrderTotalServiceImpl implements HardOrderTotalService {
return listMap;
}
private void computeMchPlatformRanke(List<HardOrderCsVo> totalList, List<MchManageVo> mchList) {
// 平台抽成计算
for (HardOrderCsVo item : totalList) {
MchManageVo targetMch = mchList.stream().filter(v -> ObjectUtil.equals(v.getId(), item.getMerchantId())).findFirst().orElse(null);
if (ObjectUtil.isEmpty(targetMch)) continue;
Double mchPlatformRanke = targetMch.getPlatformRanke();
if (ObjectUtil.isNotEmpty(mchPlatformRanke) && ObjectUtil.isNotEmpty(item.getTotalProfitPrice())) {
BigDecimal mchPlatformRankePrice = BigDecimal.valueOf(mchPlatformRanke).divide(BigDecimal.valueOf(100)).multiply(item.getTotalProfitPrice()).setScale(2, RoundingMode.HALF_UP);
item.setMchPlatformRankePrice(mchPlatformRankePrice);
item.setMchPlatformRanke(mchPlatformRanke);
}
if (ObjectUtil.isEmpty(mchPlatformRanke)) {
item.setMchPlatformRanke((double) 0);
}
}
}
private List<MchManageVo> getMchListByIds(List<Long> mchIds) {
return RemoteBatchQueryUtil.queryByIds(mchIds, ids -> remoteMchService.getByIds(ids).getData());
}
@@ -159,6 +159,12 @@ public class MchManageEntity extends Model<MchManageEntity> {
@Schema(description = "分店数量")
private Long mchCount;
/**
* 平台抽成
*/
@Schema(description = "平台抽成")
private Double platformRanke;
/**
* 创建人
*/
@@ -49,6 +49,7 @@
a.discounts_price,
a.cooperation_status,
a.mch_count,
a.platform_ranke,
a.create_by,
a.create_time,
a.update_by,