fix bug
This commit is contained in:
parent
0ee5ababdc
commit
5e0d35a989
|
|
@ -45,8 +45,8 @@ spring:
|
||||||
druid:
|
druid:
|
||||||
# 主库数据源
|
# 主库数据源
|
||||||
master:
|
master:
|
||||||
url: jdbc:mysql://103.39.234.64:3306/gqz?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
url: jdbc:mysql://211.99.98.27:3306/gqz?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
|
||||||
username: admin
|
username: root
|
||||||
password: Clunt@12345
|
password: Clunt@12345
|
||||||
# 从库数据源
|
# 从库数据源
|
||||||
slave:
|
slave:
|
||||||
|
|
|
||||||
|
|
@ -528,10 +528,12 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||||
// 一级分销售
|
// 一级分销售
|
||||||
if(customer.getCustomerPlace() != null && customer.getParentCustomerPlace() == null){
|
if(customer.getCustomerPlace() != null && customer.getParentCustomerPlace() == null){
|
||||||
placeId = AdapayUtils.getCustomerMemberId(customer.getCustomerPlace(), deptId);
|
placeId = AdapayUtils.getCustomerMemberId(customer.getCustomerPlace(), deptId);
|
||||||
saleRateOne = saleRateOne.add(saleRateTwo).add(saleRateThree);
|
saleRateThree = saleRateThree.add(saleRateTwo).add(saleRateOne);
|
||||||
|
saleRateTwo = BigDecimal.ZERO;
|
||||||
}else if(customer.getCustomerPlace() != null && customer.getParentCustomerPlace() != null){
|
}else if(customer.getCustomerPlace() != null && customer.getParentCustomerPlace() != null){
|
||||||
|
placeId = AdapayUtils.getCustomerMemberId(customer.getCustomerPlace(), deptId);
|
||||||
parentPlaceId = AdapayUtils.getCustomerMemberId(customer.getParentCustomerPlace(), deptId);
|
parentPlaceId = AdapayUtils.getCustomerMemberId(customer.getParentCustomerPlace(), deptId);
|
||||||
saleRateTwo = saleRateTwo.add(saleRateThree);
|
saleRateTwo = saleRateTwo.add(saleRateOne);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 大师傅提成
|
// 大师傅提成
|
||||||
|
|
@ -568,7 +570,7 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||||
if (paid || payedAdd) {
|
if (paid || payedAdd) {
|
||||||
changeMoney = fcRecord.getChangeMoney();
|
changeMoney = fcRecord.getChangeMoney();
|
||||||
BigDecimal dtx2 = changePaymentConfirm(fcRecord, orderDetailId, orderDetail.getWorkerId(), deptId, memberId,
|
BigDecimal dtx2 = changePaymentConfirm(fcRecord, orderDetailId, orderDetail.getWorkerId(), deptId, memberId,
|
||||||
masterMemberId, teamRete, teamMoney, deptRate, deptMoney);
|
masterMemberId, teamRete, teamMoney, deptRate, deptMoney, saleRateThree, placeId, saleRateTwo, parentPlaceId);
|
||||||
dtx = dtx.add(dtx2);
|
dtx = dtx.add(dtx2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
@ -661,8 +663,12 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||||
*/
|
*/
|
||||||
private BigDecimal changePaymentConfirm(FinancialChangeRecord fcRecord, Long orderDetailId, Long workerId, Long deptId,
|
private BigDecimal changePaymentConfirm(FinancialChangeRecord fcRecord, Long orderDetailId, Long workerId, Long deptId,
|
||||||
String memberId, String masterMemberId, BigDecimal teamRete, BigDecimal teamMoney,
|
String memberId, String masterMemberId, BigDecimal teamRete, BigDecimal teamMoney,
|
||||||
BigDecimal deptRate, BigDecimal deptMoney) throws BaseAdaPayException {
|
BigDecimal deptRate, BigDecimal deptMoney,
|
||||||
|
BigDecimal oneRate, String placeOne, BigDecimal twoRate, String placeTwo) throws BaseAdaPayException {
|
||||||
BigDecimal changeMoney = fcRecord.getChangeMoney();
|
BigDecimal changeMoney = fcRecord.getChangeMoney();
|
||||||
|
// 分销金额
|
||||||
|
BigDecimal placeOneMoney = BigDecimal.ZERO;
|
||||||
|
BigDecimal placeTwoMoney = BigDecimal.ZERO;
|
||||||
// 平台抽成
|
// 平台抽成
|
||||||
BigDecimal platformFee = changeMoney.multiply(deptRate).add(deptMoney).setScale(2, RoundingMode.UP);
|
BigDecimal platformFee = changeMoney.multiply(deptRate).add(deptMoney).setScale(2, RoundingMode.UP);
|
||||||
// 大师傅抽成
|
// 大师傅抽成
|
||||||
|
|
@ -672,12 +678,23 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||||
platformFee = changeMoney.multiply(deptRate).setScale(2, RoundingMode.UP);
|
platformFee = changeMoney.multiply(deptRate).setScale(2, RoundingMode.UP);
|
||||||
masterFee = changeMoney.multiply(teamRete).setScale(2, RoundingMode.UP);
|
masterFee = changeMoney.multiply(teamRete).setScale(2, RoundingMode.UP);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 分销抽成
|
||||||
|
// 1级分销
|
||||||
|
if (MoneyUtil.lt(oneRate, changeMoney)) {
|
||||||
|
placeOneMoney = changeMoney.multiply(oneRate).setScale(2, RoundingMode.UP);
|
||||||
|
}
|
||||||
|
// 2级分销
|
||||||
|
if (MoneyUtil.lt(twoRate, changeMoney)) {
|
||||||
|
placeTwoMoney = changeMoney.multiply(twoRate).setScale(2, RoundingMode.UP);
|
||||||
|
}
|
||||||
|
|
||||||
// 如果是大师傅自己接单,则不需要抽成
|
// 如果是大师傅自己接单,则不需要抽成
|
||||||
if(AdapayUtils.getWorkerMemberId(workerId, deptId).equals(masterMemberId)){
|
if(AdapayUtils.getWorkerMemberId(workerId, deptId).equals(masterMemberId)){
|
||||||
masterFee = BigDecimal.ZERO;
|
masterFee = BigDecimal.ZERO;
|
||||||
}
|
}
|
||||||
// 上门师傅的报酬
|
// 上门师傅的报酬
|
||||||
BigDecimal workerFee = changeMoney.subtract(platformFee).subtract(masterFee);
|
BigDecimal workerFee = changeMoney;
|
||||||
BigDecimal fineMoney = BigDecimal.ZERO;
|
BigDecimal fineMoney = BigDecimal.ZERO;
|
||||||
// 查询师傅的超时扣款记录
|
// 查询师傅的超时扣款记录
|
||||||
List<OrderTimeoutRecord> fineRecords = orderFineRecordMapper.selectUnFine(workerId, deptId);
|
List<OrderTimeoutRecord> fineRecords = orderFineRecordMapper.selectUnFine(workerId, deptId);
|
||||||
|
|
@ -705,12 +722,22 @@ public class OrderDetailServiceImpl implements OrderDetailService {
|
||||||
boolean feeFlag = false;
|
boolean feeFlag = false;
|
||||||
if (MoneyUtil.gt0(platformFee)) {
|
if (MoneyUtil.gt0(platformFee)) {
|
||||||
divMembers.add(new DivMember("0", MoneyUtil.toS(platformFee), true));
|
divMembers.add(new DivMember("0", MoneyUtil.toS(platformFee), true));
|
||||||
|
workerFee = workerFee.subtract(platformFee);
|
||||||
feeFlag = true;
|
feeFlag = true;
|
||||||
}
|
}
|
||||||
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));
|
||||||
|
workerFee = workerFee.subtract(masterFee);
|
||||||
feeFlag = true;
|
feeFlag = true;
|
||||||
}
|
}
|
||||||
|
if (MoneyUtil.gt0(placeOneMoney)) {
|
||||||
|
divMembers.add(new DivMember(placeOne, MoneyUtil.toS(placeOneMoney), !feeFlag));
|
||||||
|
workerFee = workerFee.subtract(placeOneMoney);
|
||||||
|
}
|
||||||
|
if (MoneyUtil.gt0(placeTwoMoney)) {
|
||||||
|
divMembers.add(new DivMember(placeTwo, MoneyUtil.toS(placeTwoMoney), !feeFlag));
|
||||||
|
workerFee = workerFee.subtract(placeTwoMoney);
|
||||||
|
}
|
||||||
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));
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue