扣点调整
This commit is contained in:
parent
a5f274652f
commit
dcbafae954
|
|
@ -352,8 +352,11 @@ public class OrderController extends BaseController {
|
||||||
financialMasterService.insertFinancialMaster(financialMaster);
|
financialMasterService.insertFinancialMaster(financialMaster);
|
||||||
Assert.notNull(financialMaster.getId(), "FinancialMaster.id is null!");
|
Assert.notNull(financialMaster.getId(), "FinancialMaster.id is null!");
|
||||||
|
|
||||||
|
|
||||||
|
// createFinancialDetail(goodsList.get(0).getDeptGoodsCategoryId(), deptId, customer, payMoney, financialMaster);
|
||||||
|
|
||||||
//生成财务子单
|
//生成财务子单
|
||||||
createFinancialDetail(goodsList.get(0).getDeptGoodsCategoryId(), deptId, customer, payMoney, financialMaster);
|
createFinancialDetail(appGoodsList,deptId, customer, payMoney, financialMaster);
|
||||||
|
|
||||||
// 生成商品订单
|
// 生成商品订单
|
||||||
Map<Long, GoodsStandard> goodsMap = goodsList.stream().filter(Objects::nonNull)
|
Map<Long, GoodsStandard> goodsMap = goodsList.stream().filter(Objects::nonNull)
|
||||||
|
|
@ -368,6 +371,76 @@ public class OrderController extends BaseController {
|
||||||
return AjaxResult.success(orderMaster);
|
return AjaxResult.success(orderMaster);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void createFinancialDetail(List<AppGoodsRequest> appGoodsList, Long deptId, Customer customer, BigDecimal payMoney, FinancialMaster financialMaster){
|
||||||
|
// 平台
|
||||||
|
BigDecimal deptMoney = BigDecimal.ZERO;
|
||||||
|
// 一级分销
|
||||||
|
BigDecimal oneMoney = BigDecimal.ZERO;
|
||||||
|
// 二级分销
|
||||||
|
BigDecimal twoMoney = BigDecimal.ZERO;
|
||||||
|
// 三级分销
|
||||||
|
BigDecimal threeMoney = BigDecimal.ZERO;
|
||||||
|
// 截流扣点
|
||||||
|
BigDecimal specialMoney = BigDecimal.ZERO;
|
||||||
|
for(AppGoodsRequest goodsRequest : appGoodsList){
|
||||||
|
// 商品规格-提成额
|
||||||
|
GoodsStandard goodsStandard = goodsStandardService.selectById(goodsRequest.getGoodsStandardId());
|
||||||
|
// 扣点设置类目
|
||||||
|
DeptGoodsCategory deptGoodsCategory = deptGoodsCategoryService.get(goodsStandard.getDeptGoodsCategoryId());
|
||||||
|
for (int index = 0; index < goodsRequest.getNum(); index++){
|
||||||
|
// 一级分销 = 商品单价 * 扣点比例
|
||||||
|
oneMoney = oneMoney
|
||||||
|
.add(goodsStandard.getGoodsPrice().multiply(BigDecimal.valueOf(Double.parseDouble(deptGoodsCategory.getOneRate()))));
|
||||||
|
// 二级分销 = 商品单价 * 扣点比例
|
||||||
|
twoMoney = twoMoney.add(goodsStandard.getGoodsPrice().multiply(BigDecimal.valueOf(Double.parseDouble(deptGoodsCategory.getTwoRate()))));
|
||||||
|
// 三级分销 = 提成额 + 商品单价 * 扣点比例
|
||||||
|
threeMoney = threeMoney.add(goodsStandard.getExtMoney())
|
||||||
|
.add(goodsStandard.getGoodsPrice().multiply(BigDecimal.valueOf(Double.parseDouble(deptGoodsCategory.getThreeRate()))));
|
||||||
|
// 平台扣点 = 平台金额 + 商品单价 * 扣点比例
|
||||||
|
deptMoney = deptMoney.add(deptGoodsCategory.getDeptMoney())
|
||||||
|
.add(goodsStandard.getGoodsPrice().multiply(BigDecimal.valueOf(Double.parseDouble(deptGoodsCategory.getDeptRate()))));
|
||||||
|
// 截流扣点 = 截流金额 + 商品单价 * 扣点比例
|
||||||
|
specialMoney = specialMoney.add(deptGoodsCategory.getRetainMoney())
|
||||||
|
.add(goodsStandard.getGoodsPrice().multiply(BigDecimal.valueOf(Double.parseDouble(deptGoodsCategory.getRetainRate()))));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 平台扣点记录
|
||||||
|
FinancialDetail deptDetail = new FinancialDetail(deptId, financialDetailService.createCode(),
|
||||||
|
financialMaster.getId(), financialMaster.getCode(), deptMoney, FinancialDetailType.PLATFORM_FEE.getCode(), null);
|
||||||
|
financialDetailService.insertFinancialDetail(deptDetail);
|
||||||
|
|
||||||
|
// 截流扣点记录
|
||||||
|
FinancialDetail retainDetail = new FinancialDetail(deptId, financialDetailService.createCode(),
|
||||||
|
financialMaster.getId(), financialMaster.getCode(), specialMoney, FinancialDetailType.PLATFORM_FEE.getCode(), null);
|
||||||
|
financialDetailService.insertFinancialDetail(retainDetail);
|
||||||
|
|
||||||
|
// 分销扣点记录
|
||||||
|
Long customerPlaceId = customer.getCustomerPlace();
|
||||||
|
// 一级分销
|
||||||
|
if (customerPlaceId != null) {
|
||||||
|
FinancialDetail financialDetail = new FinancialDetail(deptId, financialDetailService.createCode(),
|
||||||
|
financialMaster.getId(), financialMaster.getCode(), threeMoney, FinancialDetailType.PLACE_FEE.getCode(), customerPlaceId);
|
||||||
|
financialDetailService.insertFinancialDetail(financialDetail);
|
||||||
|
} else {
|
||||||
|
oneMoney = oneMoney.add(threeMoney);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 二级分销
|
||||||
|
Long parentCustomerPlaceId = customer.getParentCustomerPlace();
|
||||||
|
if (parentCustomerPlaceId != null) {
|
||||||
|
FinancialDetail financialDetail = new FinancialDetail(deptId, financialDetailService.createCode(),
|
||||||
|
financialMaster.getId(), financialMaster.getCode(), twoMoney, FinancialDetailType.PLACE_FEE.getCode(), parentCustomerPlaceId);
|
||||||
|
financialDetailService.insertFinancialDetail(financialDetail);
|
||||||
|
} else {
|
||||||
|
oneMoney = oneMoney.add(twoMoney);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 平台分销
|
||||||
|
FinancialDetail financialDetail = new FinancialDetail(deptId, financialDetailService.createCode(),
|
||||||
|
financialMaster.getId(), financialMaster.getCode(), oneMoney, FinancialDetailType.PLACE_FEE.getCode(), null);
|
||||||
|
financialDetailService.insertFinancialDetail(financialDetail);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 生成财务子单
|
* 生成财务子单
|
||||||
*
|
*
|
||||||
|
|
@ -973,7 +1046,9 @@ public class OrderController extends BaseController {
|
||||||
List<AfterServiceRecord> records = afterServiceRecordService.selectAfterServiceRecordList(afterServiceRecordQry);
|
List<AfterServiceRecord> records = afterServiceRecordService.selectAfterServiceRecordList(afterServiceRecordQry);
|
||||||
afterServiceRecords.addAll(records);
|
afterServiceRecords.addAll(records);
|
||||||
});
|
});
|
||||||
if (Boolean.TRUE.equals(orderMaster.getIsOverTime()) && timeoutRecords.size() == 0) continue;
|
if (Boolean.TRUE.equals(orderMaster.getIsOverTime()) && timeoutRecords.size() == 0) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
for (OrderGoods orderGoods : orderStandardList) {
|
for (OrderGoods orderGoods : orderStandardList) {
|
||||||
OrderStandard orderStandard = new OrderStandard();
|
OrderStandard orderStandard = new OrderStandard();
|
||||||
|
|
|
||||||
|
|
@ -110,8 +110,8 @@
|
||||||
<label class="col-sm-6 control-label">是否热门类目:</label>
|
<label class="col-sm-6 control-label">是否热门类目:</label>
|
||||||
<div class="col-sm-6">
|
<div class="col-sm-6">
|
||||||
<select name="isHot" class="form-control m-b" th:with="type=${@dict.getType('sys_user_sex')}">
|
<select name="isHot" class="form-control m-b" th:with="type=${@dict.getType('sys_user_sex')}">
|
||||||
<option th:text="是" th:value="1"/>
|
|
||||||
<option th:text="否" th:value="0"/>
|
<option th:text="否" th:value="0"/>
|
||||||
|
<option th:text="是" th:value="1"/>
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue