no message
This commit is contained in:
parent
2379de2ca8
commit
66eabfee3f
|
|
@ -542,15 +542,15 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||||
// 一级分销追加扣点
|
// 一级分销追加扣点
|
||||||
BigDecimal saleRateOne = new BigDecimal(deptGoodsCategory.getOneRate());
|
BigDecimal saleRateOne = new BigDecimal(deptGoodsCategory.getOneRate());
|
||||||
saleRateOne = MoneyUtil.lt0(saleRateOne) ? BigDecimal.ZERO : saleRateOne;
|
saleRateOne = MoneyUtil.lt0(saleRateOne) ? BigDecimal.ZERO : saleRateOne;
|
||||||
|
logger.info("一级分销扣点{}",saleRateOne);
|
||||||
// 二级分销追加扣点
|
// 二级分销追加扣点
|
||||||
BigDecimal saleRateTwo = new BigDecimal(deptGoodsCategory.getTwoRate());
|
BigDecimal saleRateTwo = new BigDecimal(deptGoodsCategory.getTwoRate());
|
||||||
saleRateTwo = MoneyUtil.lt0(saleRateTwo) ? BigDecimal.ZERO : saleRateTwo;
|
saleRateTwo = MoneyUtil.lt0(saleRateTwo) ? BigDecimal.ZERO : saleRateTwo;
|
||||||
|
logger.info("二级分销扣点{}",saleRateTwo);
|
||||||
// 三级分销追加扣点
|
// 三级分销追加扣点
|
||||||
BigDecimal saleRateThree = new BigDecimal(deptGoodsCategory.getThreeRate());
|
BigDecimal saleRateThree = new BigDecimal(deptGoodsCategory.getThreeRate());
|
||||||
saleRateThree = MoneyUtil.lt0(saleRateThree) ? BigDecimal.ZERO : saleRateThree;
|
saleRateThree = MoneyUtil.lt0(saleRateThree) ? BigDecimal.ZERO : saleRateThree;
|
||||||
|
logger.info("三级分销扣点{}",saleRateThree);
|
||||||
Customer customer = customerService.selectByCustomerId(orderMaster.getCustomerId());
|
Customer customer = customerService.selectByCustomerId(orderMaster.getCustomerId());
|
||||||
// 一级分销售
|
// 一级分销售
|
||||||
if(customer.getCustomerPlace() != null && customer.getParentCustomerPlace() == null){
|
if(customer.getCustomerPlace() != null && customer.getParentCustomerPlace() == null){
|
||||||
|
|
@ -573,18 +573,18 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||||
BigDecimal deptRate = new BigDecimal(deptGoodsCategory.getDeptRate());
|
BigDecimal deptRate = new BigDecimal(deptGoodsCategory.getDeptRate());
|
||||||
deptRate = MoneyUtil.lt0(deptRate) ? BigDecimal.ZERO : deptRate;
|
deptRate = MoneyUtil.lt0(deptRate) ? BigDecimal.ZERO : deptRate;
|
||||||
BigDecimal deptMoney = MoneyUtil.lt0(deptGoodsCategory.getDeptMoney()) ? BigDecimal.ZERO : deptGoodsCategory.getDeptMoney();
|
BigDecimal deptMoney = MoneyUtil.lt0(deptGoodsCategory.getDeptMoney()) ? BigDecimal.ZERO : deptGoodsCategory.getDeptMoney();
|
||||||
|
logger.info("平台加价抽成{},费率{}",deptMoney,deptRate);
|
||||||
// 平台追加抽成
|
// 平台追加抽成
|
||||||
BigDecimal pcDeptRate = new BigDecimal(deptGoodsCategory.getPcDeptRate());
|
BigDecimal pcDeptRate = new BigDecimal(deptGoodsCategory.getPcDeptRate());
|
||||||
pcDeptRate = MoneyUtil.lt0(pcDeptRate) ? BigDecimal.ZERO : pcDeptRate;
|
pcDeptRate = MoneyUtil.lt0(pcDeptRate) ? BigDecimal.ZERO : pcDeptRate;
|
||||||
BigDecimal pcDeptMoney = MoneyUtil.lt0(deptGoodsCategory.getPcDeptMoney()) ? BigDecimal.ZERO : deptGoodsCategory.getPcDeptMoney();
|
BigDecimal pcDeptMoney = MoneyUtil.lt0(deptGoodsCategory.getPcDeptMoney()) ? BigDecimal.ZERO : deptGoodsCategory.getPcDeptMoney();
|
||||||
|
logger.info("平台追加抽成{},费率{}",pcDeptMoney,pcDeptRate);
|
||||||
BigDecimal dtx = BigDecimal.ZERO;
|
BigDecimal dtx = BigDecimal.ZERO;
|
||||||
|
|
||||||
// 追加金额分账
|
// 追加金额分账
|
||||||
BigDecimal dtx1 = this.addPaymentConfirm(orderDetailId, deptId, memberId, masterMemberId, teamRete, teamMoney, pcDeptRate, pcDeptMoney, saleRateOne, placeId, saleRateTwo, parentPlaceId);
|
BigDecimal dtx1 = this.addPaymentConfirm(orderDetailId, deptId, memberId, masterMemberId, teamRete, teamMoney, pcDeptRate, pcDeptMoney, saleRateOne, placeId, saleRateTwo, parentPlaceId);
|
||||||
dtx = dtx.add(dtx1);
|
dtx = dtx.add(dtx1);
|
||||||
|
logger.info("追加金额分账{}",dtx);
|
||||||
// 改价单分账
|
// 改价单分账
|
||||||
BigDecimal changeMoney = BigDecimal.ZERO;
|
BigDecimal changeMoney = BigDecimal.ZERO;
|
||||||
// 查询子订单的加价记录
|
// 查询子订单的加价记录
|
||||||
|
|
@ -599,6 +599,7 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||||
BigDecimal dtx2 = changePaymentConfirm(fcRecord, orderDetailId, orderDetail.getWorkerId(), deptId, memberId,
|
BigDecimal dtx2 = changePaymentConfirm(fcRecord, orderDetailId, orderDetail.getWorkerId(), deptId, memberId,
|
||||||
masterMemberId, teamRete, teamMoney, deptRate, deptMoney, saleRateThree, placeId, saleRateTwo, parentPlaceId);
|
masterMemberId, teamRete, teamMoney, deptRate, deptMoney, saleRateThree, placeId, saleRateTwo, parentPlaceId);
|
||||||
dtx = dtx.add(dtx2);
|
dtx = dtx.add(dtx2);
|
||||||
|
logger.info("子订单加价记录{}",dtx1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -606,6 +607,7 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||||
OrderAttachmentRecord param = new OrderAttachmentRecord();
|
OrderAttachmentRecord param = new OrderAttachmentRecord();
|
||||||
param.setOrderDetailId(orderDetailId);
|
param.setOrderDetailId(orderDetailId);
|
||||||
List<OrderAttachmentRecord> orderAttachmentRecordList = orderAttachmentRecordService.selectOrderAttachmentRecordList(param);
|
List<OrderAttachmentRecord> orderAttachmentRecordList = orderAttachmentRecordService.selectOrderAttachmentRecordList(param);
|
||||||
|
logger.info("附件费分账金额{}",dtx1);
|
||||||
if(CollectionUtils.isNotEmpty(orderAttachmentRecordList)){
|
if(CollectionUtils.isNotEmpty(orderAttachmentRecordList)){
|
||||||
// 附件费分账.
|
// 附件费分账.
|
||||||
attachPaymentConfirm(orderAttachmentRecordList.get(0), orderDetailId, orderDetail.getWorkerId(), deptId);
|
attachPaymentConfirm(orderAttachmentRecordList.get(0), orderDetailId, orderDetail.getWorkerId(), deptId);
|
||||||
|
|
@ -613,6 +615,7 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||||
// --------------------- 子财务单分账部分 start ---------------------
|
// --------------------- 子财务单分账部分 start ---------------------
|
||||||
// 子单的实际金额
|
// 子单的实际金额
|
||||||
BigDecimal odMoney = financialDetail.getPayMoney().subtract(changeMoney);
|
BigDecimal odMoney = financialDetail.getPayMoney().subtract(changeMoney);
|
||||||
|
logger.info("子单的实际金额{}",odMoney);
|
||||||
if (MoneyUtil.lte0(odMoney)) {
|
if (MoneyUtil.lte0(odMoney)) {
|
||||||
logger.info("子财务单[{}] 应支付金额={} 不需要分账", financialDetail.getId(), odMoney);
|
logger.info("子财务单[{}] 应支付金额={} 不需要分账", financialDetail.getId(), odMoney);
|
||||||
} else {
|
} else {
|
||||||
|
|
@ -864,6 +867,7 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||||
BigDecimal oasMoney = oas.getMoney();
|
BigDecimal oasMoney = oas.getMoney();
|
||||||
// 平台抽成
|
// 平台抽成
|
||||||
BigDecimal platformFee = oasMoney.multiply(pcDeptRate).add(pcDeptMoney).setScale(2, RoundingMode.UP);
|
BigDecimal platformFee = oasMoney.multiply(pcDeptRate).add(pcDeptMoney).setScale(2, RoundingMode.UP);
|
||||||
|
logger.info("平台抽成{}", platformFee);
|
||||||
// 大师傅抽成
|
// 大师傅抽成
|
||||||
BigDecimal masterFee = oasMoney.multiply(teamRete).add(teamMoney).setScale(2, RoundingMode.UP);
|
BigDecimal masterFee = oasMoney.multiply(teamRete).add(teamMoney).setScale(2, RoundingMode.UP);
|
||||||
// 如果提成>追加金额 则去掉固定提成 只计算比例提成
|
// 如果提成>追加金额 则去掉固定提成 只计算比例提成
|
||||||
|
|
@ -876,11 +880,12 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||||
if (MoneyUtil.lt(oneRate, oasMoney)) {
|
if (MoneyUtil.lt(oneRate, oasMoney)) {
|
||||||
placeOneMoney = oasMoney.multiply(oneRate).setScale(2, RoundingMode.UP);
|
placeOneMoney = oasMoney.multiply(oneRate).setScale(2, RoundingMode.UP);
|
||||||
}
|
}
|
||||||
|
logger.info("1级分销{}", placeOneMoney);
|
||||||
// 2级分销
|
// 2级分销
|
||||||
if (MoneyUtil.lt(twoRate, oasMoney)) {
|
if (MoneyUtil.lt(twoRate, oasMoney)) {
|
||||||
placeTwoMoney = oasMoney.multiply(twoRate).setScale(2, RoundingMode.UP);
|
placeTwoMoney = oasMoney.multiply(twoRate).setScale(2, RoundingMode.UP);
|
||||||
}
|
}
|
||||||
|
logger.info("2级分销{}", placeTwoMoney);
|
||||||
// 如果是大师傅自己接单,则不需要抽成
|
// 如果是大师傅自己接单,则不需要抽成
|
||||||
if(memberId.equals(masterMemberId)){
|
if(memberId.equals(masterMemberId)){
|
||||||
masterFee = BigDecimal.ZERO;
|
masterFee = BigDecimal.ZERO;
|
||||||
|
|
@ -895,22 +900,27 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||||
divMembers.add(new DivMember("0", MoneyUtil.toS(platformFee), true));
|
divMembers.add(new DivMember("0", MoneyUtil.toS(platformFee), true));
|
||||||
feeFlag = true;
|
feeFlag = true;
|
||||||
}
|
}
|
||||||
|
logger.info("平台抽成后{}", divMembers);
|
||||||
if (MoneyUtil.gt0(masterFee)) {
|
if (MoneyUtil.gt0(masterFee)) {
|
||||||
divMembers.add(new DivMember(masterMemberId, MoneyUtil.toS(masterFee), !feeFlag));
|
divMembers.add(new DivMember(masterMemberId, MoneyUtil.toS(masterFee), !feeFlag));
|
||||||
feeFlag = true;
|
feeFlag = true;
|
||||||
}
|
}
|
||||||
|
logger.info("大师傅抽成后{}", divMembers);
|
||||||
if (MoneyUtil.gt0(workerFee)) {
|
if (MoneyUtil.gt0(workerFee)) {
|
||||||
divMembers.add(new DivMember(memberId, MoneyUtil.toS(workerFee), !feeFlag));
|
divMembers.add(new DivMember(memberId, MoneyUtil.toS(workerFee), !feeFlag));
|
||||||
dtx = dtx.add(workerFee);
|
dtx = dtx.add(workerFee);
|
||||||
}
|
}
|
||||||
|
logger.info("工费抽成后{},dtx{}", divMembers,dtx);
|
||||||
if (StringUtils.isNotEmpty(placeOne)) {
|
if (StringUtils.isNotEmpty(placeOne)) {
|
||||||
divMembers.add(new DivMember(placeOne, MoneyUtil.toS(placeOneMoney), !feeFlag));
|
divMembers.add(new DivMember(placeOne, MoneyUtil.toS(placeOneMoney), !feeFlag));
|
||||||
dtx = dtx.add(placeOneMoney);
|
dtx = dtx.add(placeOneMoney);
|
||||||
}
|
}
|
||||||
|
logger.info("第一次分成{},dtx{}", divMembers,dtx);
|
||||||
if (StringUtils.isNotEmpty(placeTwo)) {
|
if (StringUtils.isNotEmpty(placeTwo)) {
|
||||||
divMembers.add(new DivMember(placeTwo, MoneyUtil.toS(placeTwoMoney), !feeFlag));
|
divMembers.add(new DivMember(placeTwo, MoneyUtil.toS(placeTwoMoney), !feeFlag));
|
||||||
dtx = dtx.add(placeTwoMoney);
|
dtx = dtx.add(placeTwoMoney);
|
||||||
}
|
}
|
||||||
|
logger.info("第二次分成{},dtx{}", divMembers,dtx);
|
||||||
String orderNo = "OAS_" + oas.getId() + "_" + System.currentTimeMillis();
|
String orderNo = "OAS_" + oas.getId() + "_" + System.currentTimeMillis();
|
||||||
//调用分账
|
//调用分账
|
||||||
logger.info("子订单[{}]的追加单[{}]发起分账: {}", orderDetailId, oas.getId(), JSON.toJSONString(divMembers));
|
logger.info("子订单[{}]的追加单[{}]发起分账: {}", orderDetailId, oas.getId(), JSON.toJSONString(divMembers));
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue